mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-01-19 15:18:38 +01:00
jbhook2 and jbhook3 gfx updates
- Fix jbhook3 window mode - Remove -f option for framed window, no value - Add -s option to show mouse cursor on window
This commit is contained in:
parent
721897d7b0
commit
28633ded37
@ -199,6 +199,10 @@ static HWND CDECL my_mwindow_create(
|
||||
window_height = tmp;
|
||||
}
|
||||
|
||||
if(options.show_cursor) {
|
||||
ShowCursor(TRUE);
|
||||
}
|
||||
|
||||
fullscreen = !options.windowed;
|
||||
|
||||
return real_mwindow_create(
|
||||
|
@ -34,10 +34,10 @@ void options_init_from_cmdline(struct options *options)
|
||||
void options_init(struct options *options)
|
||||
{
|
||||
options->windowed = false;
|
||||
options->window_framed = false;
|
||||
options->disable_p3ioemu = false;
|
||||
options->disable_cardemu = false;
|
||||
options->disable_adapteremu = false;
|
||||
options->show_cursor = false;
|
||||
}
|
||||
|
||||
bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
@ -60,11 +60,6 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
case 'f': {
|
||||
options->window_framed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'v': {
|
||||
options->vertical = true;
|
||||
break;
|
||||
@ -84,6 +79,11 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
options->disable_p3ioemu = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 's': {
|
||||
options->show_cursor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +106,8 @@ void options_print_usage(void)
|
||||
" -c Disable card emulation (e.g. when running on a "
|
||||
"real cab)\n"
|
||||
" -p Disable p3io emulation (e.g. when running on a "
|
||||
"real cab)\n");
|
||||
"real cab)\n"
|
||||
" -s Show mouse cursor on game window\n");
|
||||
}
|
||||
|
||||
void options_fini(struct options *options)
|
||||
|
@ -6,11 +6,11 @@
|
||||
|
||||
struct options {
|
||||
bool windowed;
|
||||
bool window_framed;
|
||||
bool vertical;
|
||||
bool disable_p3ioemu;
|
||||
bool disable_cardemu;
|
||||
bool disable_adapteremu;
|
||||
bool show_cursor;
|
||||
};
|
||||
|
||||
void options_init_from_cmdline(struct options *options);
|
||||
|
@ -22,4 +22,5 @@ libs_jbhook3 := \
|
||||
|
||||
src_jbhook3 := \
|
||||
dllmain.c \
|
||||
gfx.c \
|
||||
options.c
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "bemanitools/jbio.h"
|
||||
|
||||
#include "hook/iohook.h"
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "hooklib/adapter.h"
|
||||
#include "hooklib/app.h"
|
||||
@ -17,6 +18,7 @@
|
||||
|
||||
#include "imports/avs.h"
|
||||
|
||||
#include "jbhook3/gfx.h"
|
||||
#include "jbhook3/options.h"
|
||||
|
||||
#include "jbhook-util/acio.h"
|
||||
@ -47,6 +49,16 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param)
|
||||
iohook_push_handler(p4ioemu_dispatch_irp);
|
||||
iohook_push_handler(jbhook_util_ac_io_port_dispatch_irp);
|
||||
|
||||
jbhook3_gfx_init();
|
||||
|
||||
if(options.windowed) {
|
||||
jbhook3_gfx_set_windowed();
|
||||
}
|
||||
|
||||
if(options.show_cursor) {
|
||||
jbhook3_gfx_set_show_cursor();
|
||||
}
|
||||
|
||||
if (!options.disable_p4ioemu) {
|
||||
log_info("Starting up jubeat IO backend");
|
||||
|
||||
@ -119,7 +131,7 @@ static bool my_dll_entry_main(void)
|
||||
if (!options.disable_p4ioemu) {
|
||||
p4ioemu_fini();
|
||||
}
|
||||
|
||||
|
||||
options_fini(&options);
|
||||
|
||||
return result;
|
||||
@ -141,7 +153,7 @@ BOOL WINAPI DllMain(HMODULE mod, DWORD reason, void *ctx)
|
||||
if (!options.disable_adapteremu) {
|
||||
adapter_hook_init();
|
||||
}
|
||||
|
||||
|
||||
jbhook_util_eamuse_hook_init();
|
||||
|
||||
return TRUE;
|
||||
|
73
src/main/jbhook3/gfx.c
Normal file
73
src/main/jbhook3/gfx.c
Normal file
@ -0,0 +1,73 @@
|
||||
#define LOG_MODULE "jbhook-gfx"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "hook/table.h"
|
||||
|
||||
#include "jbhook3/options.h"
|
||||
|
||||
#include "util/log.h"
|
||||
|
||||
static bool jbhook3_gfx_windowed;
|
||||
static bool jbhook3_gfx_show_cursor;
|
||||
|
||||
void jbhook3_gfx_set_windowed(void)
|
||||
{
|
||||
jbhook3_gfx_windowed = true;
|
||||
}
|
||||
|
||||
void jbhook3_gfx_set_show_cursor(void)
|
||||
{
|
||||
jbhook3_gfx_show_cursor = true;
|
||||
}
|
||||
|
||||
static HWND CDECL my_GFWin32MainWindowRun(
|
||||
HINSTANCE,
|
||||
const char *,
|
||||
long,
|
||||
long,
|
||||
DWORD);
|
||||
|
||||
static HWND(CDECL *real_GFWin32MainWindowRun)(
|
||||
HINSTANCE,
|
||||
const char *,
|
||||
long,
|
||||
long,
|
||||
DWORD);
|
||||
|
||||
static const struct hook_symbol init_hook_syms[] = {
|
||||
{.name = "GFWin32MainWindowRun",
|
||||
.patch = my_GFWin32MainWindowRun,
|
||||
.link = (void **) &real_GFWin32MainWindowRun,},
|
||||
};
|
||||
|
||||
static HWND CDECL my_GFWin32MainWindowRun(
|
||||
HINSTANCE hInstance,
|
||||
const char *lpWindowName,
|
||||
long X,
|
||||
long Y,
|
||||
DWORD dwStyle
|
||||
)
|
||||
{
|
||||
if(jbhook3_gfx_windowed) {
|
||||
log_info("--- Begin jbhook GFWin32MainWindowRun ---");
|
||||
dwStyle |= WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;
|
||||
}
|
||||
|
||||
if(jbhook3_gfx_show_cursor) {
|
||||
ShowCursor(TRUE);
|
||||
}
|
||||
|
||||
return real_GFWin32MainWindowRun(hInstance, lpWindowName, X, Y, dwStyle);
|
||||
}
|
||||
|
||||
void jbhook3_gfx_init(void)
|
||||
{
|
||||
hook_table_apply(
|
||||
NULL, "gftools.dll", init_hook_syms, lengthof(init_hook_syms));
|
||||
|
||||
log_info("Inserted gfx hooks");
|
||||
}
|
3
src/main/jbhook3/gfx.h
Normal file
3
src/main/jbhook3/gfx.h
Normal file
@ -0,0 +1,3 @@
|
||||
void jbhook3_gfx_init(void);
|
||||
void jbhook3_gfx_set_windowed(void);
|
||||
void jbhook3_gfx_set_show_cursor(void);
|
@ -34,10 +34,10 @@ void options_init_from_cmdline(struct options *options)
|
||||
void options_init(struct options *options)
|
||||
{
|
||||
options->windowed = false;
|
||||
options->window_framed = false;
|
||||
options->disable_p4ioemu = false;
|
||||
options->disable_cardemu = false;
|
||||
options->disable_adapteremu = false;
|
||||
options->show_cursor = false;
|
||||
}
|
||||
|
||||
bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
@ -60,11 +60,6 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
break;
|
||||
}
|
||||
|
||||
case 'f': {
|
||||
options->window_framed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 'a': {
|
||||
options->disable_adapteremu = true;
|
||||
break;
|
||||
@ -79,6 +74,11 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv)
|
||||
options->disable_p4ioemu = true;
|
||||
break;
|
||||
}
|
||||
|
||||
case 's': {
|
||||
options->show_cursor = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,13 +95,13 @@ void options_print_usage(void)
|
||||
"\n"
|
||||
" -h Print this usage message\n"
|
||||
" -w Run the game windowed\n"
|
||||
" -f Run the game in a framed window (needs -w option)\n"
|
||||
" -a Disable adapter hook\n"
|
||||
" -c Disable card emulation (e.g. when running on a "
|
||||
"real cab)\n"
|
||||
" -p Disable p4io emulation (e.g. when running on a "
|
||||
"real cab or on a bare "
|
||||
"p4io)\n");
|
||||
"p4io)\n"
|
||||
" -s Show mouse cursor on game window\n");
|
||||
}
|
||||
|
||||
void options_fini(struct options *options)
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
struct options {
|
||||
bool windowed;
|
||||
bool window_framed;
|
||||
bool disable_p4ioemu;
|
||||
bool disable_cardemu;
|
||||
bool disable_adapteremu;
|
||||
bool show_cursor;
|
||||
};
|
||||
|
||||
void options_init_from_cmdline(struct options *options);
|
||||
|
Loading…
x
Reference in New Issue
Block a user