diff --git a/src/lindbergh/blitStretching.c b/src/lindbergh/blitStretching.c index 9dc2c3b..136d753 100644 --- a/src/lindbergh/blitStretching.c +++ b/src/lindbergh/blitStretching.c @@ -58,7 +58,7 @@ void blitSetWidthandHeightSize() blitWidth = 640; blitHeight = 480; } - else if (gId == QUIZ_AXA || gId == QUIZ_AXA_LIVE || gId == MJ4_REVG || gId == MJ4_EVO) + else if (gId == QUIZ_AXA || gId == QUIZ_AXA_LIVE || gGrp == GROUP_MJ4) { blitWidth = 1024; blitHeight = 768; @@ -155,4 +155,4 @@ void blitStretch() glBindFramebuffer(GL_FRAMEBUFFER, 0); } -} \ No newline at end of file +} diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 4f1fc7d..9707bc1 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -37,6 +37,8 @@ #define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011 #define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A #define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A +#define MJ4_REVA 0x6eb2a533 // DVP-0049A +#define MJ4_REVF 0x220ac11 // DVP-0049F #define MJ4_REVG 0x57813a7 // DVP-0049G #define MJ4_EVO 0xb785a0e9 // DVP-0081 #define OUTRUN_2_SP_SDX 0x92c196d5 // DVP-0015 @@ -133,6 +135,7 @@ typedef enum GROUP_ID4_JAP, GROUP_ID5, GROUP_LGJ, + GROUP_MJ4, GROUP_OUTRUN, GROUP_OUTRUN_TEST, GROUP_RAMBO, @@ -338,4 +341,4 @@ char *getGameNativeResolutions(); const char *getLindberghColourString(Colour lindberghColour); const char *getGameRegionString(GameRegion region); const char *getGpuTypeString(GpuType gpuType); -extern SDL_Keycode getSDLKeycode(const char *input); \ No newline at end of file +extern SDL_Keycode getSDLKeycode(const char *input); diff --git a/src/lindbergh/gameData.c b/src/lindbergh/gameData.c index 278cf50..e5a7482 100644 --- a/src/lindbergh/gameData.c +++ b/src/lindbergh/gameData.c @@ -32,8 +32,10 @@ static const GameData gameData[] = { {LETS_GO_JUNGLE, "Let's Go Jungle! Lost on the Island of Spice!", "lgj", "DVP-0011", "SBLU", "2006", "1360x768", WORKING, SEGA_TYPE_3, SHOOTING, 1360, 768, GROUP_LGJ, 0, 0, 0, 0, 0, 0, YELLOW}, {LETS_GO_JUNGLE_REVA, "Let's Go Jungle! Lost on the Island of Spice! Rev A", "lgj-rev-a", "DVP-0011A", "SBLU", "2006", "1360x768", WORKING, SEGA_TYPE_3, SHOOTING, 1360, 768, GROUP_LGJ, 0, 0, 0, 0, 0, 0, YELLOW}, {LETS_GO_JUNGLE_SPECIAL, "Let's Go Jungle! Special!", "lgj-sp", "DVP-0036", "SBNR", "2007", "1024x768", WORKING, SEGA_TYPE_3, SHOOTING, 1024, 768, GROUP_LGJ, 1, 0, 0, 0, 0, 0, YELLOW}, - {MJ4_EVO, "SEGA Network Taisen Mahjong MJ4 Evolution", "mj4-evo", "DVP-0081", "SBTA", "2008", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, -1, 0, 0, 0, 0, 0, 1, YELLOW}, - {MJ4_REVG, "SEGA Network Taisen Mahjong MJ4", "mj4-rev-g", "DVP-0049G", "SBPN", "2007", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, -1, 0, 0, 0, 0, 0, 1, YELLOW}, + {MJ4_EVO, "SEGA Network Taisen Mahjong MJ4 Evolution", "mj4-evo", "DVP-0081", "SBTA", "2008", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, GROUP_MJ4, 0, 0, 0, 0, 0, 1, YELLOW}, + {MJ4_REVA, "SEGA Network Taisen Mahjong MJ4 Rev A", "mj4-rev-a", "DVP-0049A", "SBPN", "2007", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, GROUP_MJ4, 0, 0, 0, 0, 0, 1, YELLOW}, + {MJ4_REVF, "SEGA Network Taisen Mahjong MJ4 Rev F", "mj4-rev-f", "DVP-0049F", "SBPN", "2007", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, GROUP_MJ4, 0, 0, 0, 0, 0, 1, YELLOW}, + {MJ4_REVG, "SEGA Network Taisen Mahjong MJ4 Rev G", "mj4-rev-g", "DVP-0049G", "SBPN", "2007", "1024x768", WORKING, SEGA_TYPE_3, MAHJONG, 1024, 768, GROUP_MJ4, 0, 0, 0, 0, 0, 1, YELLOW}, {OUTRUN_2_SP_SDX, "Outrun 2 SP SDX", "outrun2", "DVP-0015", "SBMB", "2006", "800x480", WORKING, SEGA_TYPE_3, DRIVING, 800, 480, GROUP_OUTRUN, 0, 1, 1, 0, 0, 0, YELLOW}, {OUTRUN_2_SP_SDX_TEST, "Outrun 2 SP SDX", "outrun2", "DVP-0015", "SBMB", "2006", "800x480", WORKING, SEGA_TYPE_3, DRIVING, 800, 480, GROUP_OUTRUN_TEST, 0, 1, 1, 0, 0, 0, YELLOW}, {OUTRUN_2_SP_SDX_REVA, "Outrun 2 SP SDX Rev A", "outrun2-rev-a", "DVP-0015A", "SBMB", "2006", "800x480", WORKING, SEGA_TYPE_3, DRIVING, 800, 480, GROUP_OUTRUN, 0, 1, 1, 0, 0, 0, YELLOW}, diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index 56306ac..5b63687 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -1640,7 +1640,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result) { struct tm *(*_gmtime_r)(const time_t *, struct tm *) = (struct tm * (*)(const time_t *, struct tm *)) dlsym(RTLD_NEXT, "gmtime_r"); - if ((gId == MJ4_REVG || gId == MJ4_EVO) && getConfig()->mj4EnabledAtT == 1) + if ((gGrp == GROUP_MJ4) && getConfig()->mj4EnabledAtT == 1) { time_t target_time = 1735286445; struct tm *res = _gmtime_r(&target_time, result); @@ -1660,4 +1660,4 @@ struct tm *gmtime_r(const time_t *timep, struct tm *result) return res; } return _gmtime_r(timep, result); -} \ No newline at end of file +} diff --git a/src/lindbergh/lindbergh.c b/src/lindbergh/lindbergh.c index 9a1b1c5..02d7c8a 100644 --- a/src/lindbergh/lindbergh.c +++ b/src/lindbergh/lindbergh.c @@ -94,7 +94,9 @@ uint32_t cleanElfCRC32[] = { 0xB0A96E34, // DVP-0043 | vf5 0xF99E5635, // DVP-0044 | drive.elf 0x4143F6B4, // DVP-0048A | main.exe - 0x65489691, // DVP-0049 | mj4 + 0x93210094, // DVP-0049A | mj4 + 0x561DC942, // DVP-0049F | mj4 + 0x65489691, // DVP-0049G | mj4 0x653BC83B, // DVP-0057 | a.elf 0x04D88552, // DVP-0057B | a.elf 0x089D6051, // DVP-0060 | dsr diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index d22379e..ac36c72 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -1774,6 +1774,94 @@ int initPatch() } } break; + case MJ4_REVA: + { + setVariable(0x0a250914, 2); + setVariable(0x0a250910, 2); + setVariable(0x0a25090c, 2); + setVariable(0x0a250908, 2); + setVariable(0x0a250900, 2); + setVariable(0x0a2508fc, 2); + + // Security + detourFunction(0x085c9d64, amDongleInit); + detourFunction(0x085c881d, amDongleIsAvailable); + detourFunction(0x085c883a, amDongleIsDevelop); + detourFunction(0x085c9213, amDongleUpdate); + + // Fixes and patches to bypss network check + amDipswContextAddr = (void *)0x0a27a81c; // Address of amDipswContext + detourFunction(0x085c85b0, amDipswInit); + detourFunction(0x085c8634, amDipswExit); + detourFunction(0x085c86a9, amDipswGetData); + detourFunction(0x085c8720, amDipswSetLed); + + detourFunction(0x080e209c, stubRetZero); // skip checks + detourFunction(0x080ed218, stubRetZero); + patchMemoryFromString(0x080e8e81, "75"); + patchMemoryFromString(0x0887ce98, "00"); + patchMemoryFromString(0x080e8e93, "909090909090"); // test skip countdown + + patchMemoryFromString(0x085e43ad, "2e2f72616d2f746f2e74787400"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e43c4, "2e2f72616d2f66726f6d2e74787400"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e43dd, "2e2f72616d2f2e746d7000"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e442d, "2e2f72616d00"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e443d, "2e2f666f6f3100"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e444e, "2e2f666f6f3200"); // Patch /home/disk2 folder + patchMemoryFromString(0x085e7b03, "2e2f72616d2f746d7000"); // Patch /home/disk2 folder + patchMemoryFromString(0x085eb1c7, "2e2f00"); // Patch /home/disk2 folder + + // Mesa Patches + if (GPUVendor != NVIDIA_GPU) + { + detourFunction(0x08050b44, gl_ProgramStringARB); + } + } + break; + case MJ4_REVF: + { + setVariable(0x0a2d3654, 2); + setVariable(0x0a2d3650, 2); + setVariable(0x0a2d364c, 2); + setVariable(0x0a2d3648, 2); + setVariable(0x0a2d3640, 2); + setVariable(0x0a2d363c, 2); + + // Security + detourFunction(0x0860533a, amDongleInit); + detourFunction(0x08603df5, amDongleIsAvailable); + detourFunction(0x08603e12, amDongleIsDevelop); + detourFunction(0x086047eb, amDongleUpdate); + + // Fixes and patches to bypss network check + amDipswContextAddr = (void *)0x0a2fd57c; // Address of amDipswContext + detourFunction(0x08603b88, amDipswInit); + detourFunction(0x08603c0c, amDipswExit); + detourFunction(0x08603c81, amDipswGetData); + detourFunction(0x08603cf7, amDipswSetLed); + + detourFunction(0x080e24fc, stubRetZero); // skip checks + detourFunction(0x080ed74c, stubRetZero); + patchMemoryFromString(0x080e9339, "75"); + patchMemoryFromString(0x088d2f38, "00"); + patchMemoryFromString(0x080e934b, "909090909090"); // test skip countdown + + patchMemoryFromString(0x0862036d, "2e2f72616d2f746f2e74787400"); // Patch /home/disk2 folder + patchMemoryFromString(0x08620384, "2e2f72616d2f66726f6d2e74787400"); // Patch /home/disk2 folder + patchMemoryFromString(0x0862039d, "2e2f72616d2f2e746d7000"); // Patch /home/disk2 folder + patchMemoryFromString(0x086203ed, "2e2f72616d00"); // Patch /home/disk2 folder + patchMemoryFromString(0x086203fd, "2e2f666f6f3100"); // Patch /home/disk2 folder + patchMemoryFromString(0x0862040e, "2e2f666f6f3200"); // Patch /home/disk2 folder + patchMemoryFromString(0x08623ae3, "2e2f72616d2f746d7000"); // Patch /home/disk2 folder + patchMemoryFromString(0x086275b3, "2e2f00"); // Patch /home/disk2 folder + + // Mesa Patches + if (GPUVendor != NVIDIA_GPU) + { + detourFunction(0x08050d50, gl_ProgramStringARB); + } + } + break; case MJ4_REVG: { setVariable(0x0acf85d4, 2); diff --git a/src/lindbergh/resolution.c b/src/lindbergh/resolution.c index a296bf1..a378f96 100644 --- a/src/lindbergh/resolution.c +++ b/src/lindbergh/resolution.c @@ -2438,6 +2438,13 @@ int initResolutionPatches() setVariable(addressC + 0x8, (size_t)newWidthSPtrLGJ); } break; + case MJ4_REVA: + { + patchMemoryFromString(0x080520b1, "01"); // Enable Anti Alias + patchMemoryFromString(0x080520aa, "03"); // Force 1024x768 + patchMemoryFromString(0x080531fa, "b803000000"); // Skips resolution set by the Dip Switches. + } + break; case MJ4_REVG: { patchMemoryFromString(0x080524a1, "01"); // Enable Anti Alias diff --git a/src/lindbergh/sdlCalls.c b/src/lindbergh/sdlCalls.c index dad6601..4cfcbae 100644 --- a/src/lindbergh/sdlCalls.c +++ b/src/lindbergh/sdlCalls.c @@ -118,7 +118,7 @@ void startSDL(int *argcp, char **argv) SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1); if (gGrp == GROUP_ABC || gGrp == GROUP_VF5 || gId == R_TUNED || gId == GHOST_SQUAD_EVOLUTION || gId == SEGA_RACE_TV || - gId == MJ4_REVG || gId == MJ4_EVO) + gGrp == GROUP_MJ4 ) { SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); } @@ -140,7 +140,7 @@ void startSDL(int *argcp, char **argv) exit(EXIT_FAILURE); } - if (gId == GHOST_SQUAD_EVOLUTION || gId == MJ4_EVO || gId == MJ4_REVG) + if (gId == GHOST_SQUAD_EVOLUTION || gGrp == GROUP_MJ4) SDL_SetWindowSize(sdlWindow, gWidth, gHeight + 1); x11Display = (Display *)SDL_GetPointerProperty(SDL_GetWindowProperties(sdlWindow), SDL_PROP_WINDOW_X11_DISPLAY_POINTER, NULL); @@ -215,7 +215,7 @@ void startSDL(int *argcp, char **argv) if (customCursor) setCursor(customCursor); - if ((gId == MJ4_REVG || gId == MJ4_EVO || gId == QUIZ_AXA || gId == QUIZ_AXA_LIVE) && strcmp(getConfig()->touchCursor, "") != 0 && + if ((gGrp == GROUP_MJ4 || gId == QUIZ_AXA || gId == QUIZ_AXA_LIVE) && strcmp(getConfig()->touchCursor, "") != 0 && getConfig()->emulateTouchscreen) setCursor(touchCursor); else if (getConfig()->hideCursor) diff --git a/src/lindbergh/shaderPatches.c b/src/lindbergh/shaderPatches.c index bda51cd..e562e29 100644 --- a/src/lindbergh/shaderPatches.c +++ b/src/lindbergh/shaderPatches.c @@ -564,7 +564,7 @@ void gl_ProgramStringARB(int target, int program_fmt, int program_len, char *pro program = newProgram; program_len = newProgramLen; } - else if (gId == MJ4_REVG || gId == MJ4_EVO) + else if (gGrp == GROUP_MJ4) { if (target == GL_VERTEX_PROGRAM_ARB) {