diff --git a/dist/jb/jbhook-01.conf b/dist/jb/jbhook-01.conf index 4e26beb..c498611 100755 --- a/dist/jb/jbhook-01.conf +++ b/dist/jb/jbhook-01.conf @@ -1,6 +1,9 @@ # Run the game windowed gfx.windowed=false +# rotate the normally-horizontal game window to be vertical +gfx.vertical=false + # URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. eamuse.server=localhost:80 diff --git a/dist/jb/jbhook-02.conf b/dist/jb/jbhook-02.conf index fdb476f..ed8c434 100644 --- a/dist/jb/jbhook-02.conf +++ b/dist/jb/jbhook-02.conf @@ -1,6 +1,9 @@ # Run the game windowed gfx.windowed=false +# rotate the normally-horizontal game window to be vertical +gfx.vertical=false + # URL (e.g. http://my.eamuse.server:80/whatever) or IPV4 (e.g. 127.0.0.1:80) of the target eamuse server. The port is optional but defaults to 80. eamuse.server=localhost:80 diff --git a/src/main/jbhook-util/gfx.c b/src/main/jbhook-util/gfx.c index b0351ca..c55b1a6 100644 --- a/src/main/jbhook-util/gfx.c +++ b/src/main/jbhook-util/gfx.c @@ -146,8 +146,10 @@ static void fb_init(void) { static void __stdcall hook_glFlush(void) { // 3 bytes per RGB pixel - uint8_t pixels_raw[W*H*3]; - uint8_t pixels_rot[W*H*3]; + // these could really be stack variables but they are too big for gcc's + // default stack size, and it's no problem for 6MiB of data to hang around + static uint8_t pixels_raw[W*H*3]; + static uint8_t pixels_rot[W*H*3]; glReadPixels(0, 0, H, W, GL_RGB, GL_UNSIGNED_BYTE, pixels_raw); @@ -185,7 +187,7 @@ static void __stdcall hook_glFlush(void) { // insufficiently generic compared to something in opengl32.dll, but the render // loop of the game makes it very difficult to "catch" the rendering at the // right place otherwise. This works with all horizontal jubeats, and they -// stopped needing rotation past copious. +// stopped needing rotation fixes starting with saucer. static void hook_glBindFramebufferEXT(GLenum target, GLuint framebuffer) { fb_init(); diff --git a/src/main/jbhook2/dllmain.c b/src/main/jbhook2/dllmain.c index 75a74a9..69ca089 100644 --- a/src/main/jbhook2/dllmain.c +++ b/src/main/jbhook2/dllmain.c @@ -42,8 +42,6 @@ static struct options options; static bool my_dll_entry_init(char *sidcode, struct property_node *param) { - jbhook_util_gfx_install_vertical_hooks(); - bool eam_io_ok; bool jb_io_ok; @@ -52,6 +50,10 @@ static bool my_dll_entry_init(char *sidcode, struct property_node *param) log_info("--- Begin jbhook dll_entry_init ---"); + if(options.vertical) { + jbhook_util_gfx_install_vertical_hooks(); + } + if (!options.disable_p3ioemu) { log_assert(sidcode != NULL); // pcbid and eamid are only used here for sec check, the ones used for @@ -157,9 +159,11 @@ static HWND CDECL my_mwindow_create( log_info("---------------- Begin jbhook mwindow_create ----------------"); log_info("-------------------------------------------------------------"); - DWORD tmp = window_width; - window_width = window_height; - window_height = tmp; + if(options.vertical) { + DWORD tmp = window_width; + window_width = window_height; + window_height = tmp; + } return real_mwindow_create( hinstance, diff --git a/src/main/jbhook2/options.c b/src/main/jbhook2/options.c index 4af7a6d..7b6959f 100644 --- a/src/main/jbhook2/options.c +++ b/src/main/jbhook2/options.c @@ -65,6 +65,11 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv) break; } + case 'v': { + options->vertical = true; + break; + } + case 'a': { options->disable_adapteremu = true; break; @@ -96,6 +101,7 @@ void options_print_usage(void) " -h Print this usage message\n" " -w Run the game windowed\n" " -f Run the game in a framed window (needs -w option)\n" + " -v Rotate the normally-horizontal game window to be vertical\n" " -a Disable adapter hook\n" " -c Disable card emulation (e.g. when running on a " "real cab)\n" diff --git a/src/main/jbhook2/options.h b/src/main/jbhook2/options.h index de4d259..01965c4 100644 --- a/src/main/jbhook2/options.h +++ b/src/main/jbhook2/options.h @@ -7,6 +7,7 @@ struct options { bool windowed; bool window_framed; + bool vertical; bool disable_p3ioemu; bool disable_cardemu; bool disable_adapteremu;