1
0
mirror of https://github.com/djhackersdev/bemanitools.git synced 2025-02-21 04:48:42 +01:00

Move p3io-specific jbhook-util funcs to their own static lib

This commit is contained in:
Will Toohey 2022-04-03 21:02:38 +10:00
parent dd9b8faafe
commit 7e731916e2
15 changed files with 24 additions and 105 deletions

View File

@ -142,6 +142,7 @@ include src/main/jbio-p4io/Module.mk
include src/main/jbio/Module.mk
include src/main/jbiotest/Module.mk
include src/main/jbhook-util/Module.mk
include src/main/jbhook-util-p3io/Module.mk
include src/main/jbhook1/Module.mk
include src/main/jbhook2/Module.mk
include src/main/jbhook3/Module.mk

View File

@ -0,0 +1,6 @@
libs += jbhook-util-p3io
src_jbhook-util-p3io := \
gfx.c \
mixer.c \
p3io.c \

View File

@ -14,7 +14,7 @@
#include "imports/glhelper.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util-p3io/gfx.h"
#include "util/defs.h"
#include "util/log.h"
@ -47,71 +47,6 @@ static const struct hook_symbol jbhook_infodisp_hook_syms[] = {
.patch = hook_infodispcore_set_angle},
};
static DWORD STDCALL my_GetGlyphOutline(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2);
static DWORD(STDCALL *real_GetGlyphOutline)(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2);
static const struct hook_symbol gfx_hook_syms[] = {
{.name = "GetGlyphOutlineA",
.patch = my_GetGlyphOutline,
.link = (void **) &real_GetGlyphOutline},
{
.name = "IsDBCSLeadByteEx",
.patch = my_GetGlyphOutline, // !??
.link = (void **) &real_GetGlyphOutline // !??
},
};
static DWORD STDCALL my_GetGlyphOutline(
HDC hdc,
UINT uChar,
UINT uFormat,
LPGLYPHMETRICS lpgm,
DWORD cbBuffer,
LPVOID lpvBuffer,
const MAT2 *lpmat2)
{
if (IsDBCSLeadByteEx(CP_ACP, uChar & 0xFF)) {
log_warning("!!!!!!!!");
char tmp[2];
tmp[0] = uChar & 0xFF;
tmp[1] = (uChar >> 8) & 0xFF;
MultiByteToWideChar(
CP_ACP, MB_USEGLYPHCHARS, tmp, 2, lpvBuffer, cbBuffer);
}
return real_GetGlyphOutline(
hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, lpmat2);
}
void jbhook_util_gfx_hook_init(void)
{
hook_table_apply(NULL, "gdi32.dll", gfx_hook_syms, lengthof(gfx_hook_syms));
log_info("Inserted gfx hooks");
}
void jbhook_util_gfx_set_windowed(bool framed)
{
}
void jbhook_util_gfx_install_vertical_hooks(void) {
hook_table_apply(
NULL,

View File

@ -0,0 +1,4 @@
/**
* Rotate a horizontal-by-default jubeat window to vertical
*/
void jbhook_util_gfx_install_vertical_hooks(void);

View File

@ -5,7 +5,7 @@
#include "bemanitools/jbio.h"
#include "jbhook-util/p3io.h"
#include "jbhook-util-p3io/p3io.h"
#include "p3ioemu/emu.h"
#include "p3ioemu/uart.h"

View File

@ -6,8 +6,5 @@ libs_jbhook-util := \
src_jbhook-util := \
acio.c \
eamuse.c \
gfx.c \
mixer.c \
locale.c \
p3io.c \
p4io.c \

View File

@ -1,25 +0,0 @@
#ifndef JBHOOK_D3D8_H
#define JBHOOK_D3D8_H
#include <stdbool.h>
/**
* Hook some gfx related functions to patch gfx related stuff
* like enabling window mode.
*/
void jbhook_util_gfx_hook_init(void);
/**
* Set the game to window mode.
*
* @param framed True to add a window frame and make the window
* movable, resizable, minizable. False for no frame.
*/
void jbhook_util_gfx_set_windowed(bool framed);
/**
* Rotate a horizontal-by-default jubeat window to vertical
*/
void jbhook_util_gfx_install_vertical_hooks(void);
#endif

View File

@ -2,7 +2,7 @@ avsdlls += jbhook1
imps += glhelper
deplibs_jbhook1 := \
avs \
avs \
glhelper \
ldflags_jbhook1 := \
@ -15,7 +15,8 @@ libs_jbhook1 := \
cconfig \
eamio \
jbio \
jbhook-util \
jbhook-util \
jbhook-util-p3io \
p3ioemu \
p3io \
hook \

View File

@ -24,9 +24,10 @@
#include "jbhook-util/acio.h"
#include "jbhook-util/eamuse.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util/mixer.h"
#include "jbhook-util/p3io.h"
#include "jbhook-util-p3io/gfx.h"
#include "jbhook-util-p3io/mixer.h"
#include "jbhook-util-p3io/p3io.h"
#include "p3ioemu/devmgr.h"
#include "p3ioemu/emu.h"

View File

@ -14,6 +14,7 @@ libs_jbhook2 := \
eamio \
jbio \
jbhook-util \
jbhook-util-p3io \
p3ioemu \
p3io \
p4ioemu \

View File

@ -22,8 +22,9 @@
#include "jbhook-util/acio.h"
#include "jbhook-util/eamuse.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util/p3io.h"
#include "jbhook-util-p3io/gfx.h"
#include "jbhook-util-p3io/p3io.h"
#include "p3ioemu/devmgr.h"
#include "p3ioemu/emu.h"
@ -214,7 +215,6 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
adapter_hook_init();
}
jbhook_util_gfx_hook_init();
jbhook_util_eamuse_hook_init();
return TRUE;

View File

@ -21,7 +21,6 @@
#include "jbhook-util/acio.h"
#include "jbhook-util/eamuse.h"
#include "jbhook-util/gfx.h"
#include "jbhook-util/p4io.h"
#include "p4ioemu/device.h"
@ -143,7 +142,6 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
adapter_hook_init();
}
jbhook_util_gfx_hook_init();
jbhook_util_eamuse_hook_init();
return TRUE;