diff --git a/docs/changelog b/docs/changelog index 276de5e..8129e71 100644 --- a/docs/changelog +++ b/docs/changelog @@ -2,15 +2,15 @@ All notable changes to this project will be documented in this file. -## [Unreleased] +## [2.0.2] ### Added - - Let's go Jungle resolution patch. - - 2 Spicy resolution patch. - - 2 Spicy Patch to allow any IP for Network play. + - InitialD 5 SBRY added. - HOD4 SP CPU Frequency fix. - - ID4 and ID5 patches for Network link to allowed any NIC name and any IP. - - Harley patch for network link to allowed any NIC name and any IP. +### Fixed + - Fixed a bug when a game uses GLUT and the conf was set to NO_SDL 1 - Fixed a bug in Let's go Jungle when GPU was nVidia and Mesa was set as shader patches. + - Exclude resolution patches when the resolution is the game's original resolution. + - Reload with Right mouse click for Rambo and 2Spicy with SDL. ### [2.0.1] 2025-01-23 ### Added diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index 97026e5..b98d63d 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -367,8 +367,8 @@ static int detectGame(uint32_t elf_crc) case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB: { config.gameTitle = "Virtua Fighter 5 Final Showdown REV B"; - config.gameDVP = "DVP-5019B"; - config.gameID = "SBUV"; + config.gameDVP = "DVP-5020"; + config.gameID = "SBXX"; config.gameReleaseYear = "2010"; config.gameNativeResolutions = "1280x768"; config.gameType = FIGHTING; @@ -383,7 +383,7 @@ static int detectGame(uint32_t elf_crc) { config.gameTitle = "Virtua Fighter 5 Final Showdown REV B ver 6.0000"; config.gameDVP = "DVP-5020"; - config.gameID = "SBUV"; + config.gameID = "SBXX"; config.gameReleaseYear = "2010"; config.gameNativeResolutions = "1280x768"; config.gameType = FIGHTING; @@ -844,11 +844,26 @@ static int detectGame(uint32_t elf_crc) } break; - case INITIALD_5_EXP_30: + case INITIALD_5_EXP: { - config.gameTitle = "Initial D5 Ver 2.0"; + config.gameTitle = "Initial D5 EXP"; config.gameStatus = WORKING; config.gameDVP = "DVP-0075"; + config.gameID = "SBRY"; + config.gameReleaseYear = "2009"; + config.gameNativeResolutions = "1360x768"; + config.gameType = DRIVING; + config.width = 1360; + config.height = 768; + return 0; + } + break; + + case INITIALD_5_EXP_20: + { + config.gameTitle = "Initial D5 EXP 2.0"; + config.gameStatus = WORKING; + config.gameDVP = "DVP-0084"; config.gameID = "SBTS"; config.gameReleaseYear = "2009"; config.gameNativeResolutions = "1360x768"; @@ -859,9 +874,9 @@ static int detectGame(uint32_t elf_crc) } break; - case INITIALD_5_EXP_40: + case INITIALD_5_EXP_20A: { - config.gameTitle = "Initial D5 5 Ver 4.0"; + config.gameTitle = "Initial D5 5 EXP 2.0"; config.gameDVP = "DVP-0084A"; config.gameID = "SBQN"; config.gameReleaseYear = "2009"; @@ -1223,6 +1238,9 @@ int readConfig(FILE *configFile, EmulatorConfig *config) else if (strcmp(command, "OR2_IP") == 0) strcpy(config->or2IP, getNextToken(NULL, " ", &saveptr)); + else if (strcmp(command, "OR2_NETMASK") == 0) + strcpy(config->or2Netmask, getNextToken(NULL, " ", &saveptr)); + else if (strcmp(command, "CPU_FREQ_GHZ") == 0) config->cpuFreqGhz = atof(getNextToken(NULL, " ", &saveptr)); @@ -1513,6 +1531,7 @@ int initConfig() config.mj4EnabledAtT = 0; strcpy(config.or2IP, ""); + strcpy(config.or2Netmask, ""); config.cpuFreqGhz = 0.0f; memset(&config.arcadeInputs.analogue_deadzone_start, 0, sizeof(config.arcadeInputs.analogue_deadzone_start)); memset(&config.arcadeInputs.analogue_deadzone_middle, 0, sizeof(config.arcadeInputs.analogue_deadzone_middle)); diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 7d3c38e..91863ba 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -29,8 +29,9 @@ #define INITIALD_4_EXP_REVD 0x62cc73a9 // DVP-0030D #define INITIALD_5_JAP_REVA 0xb3183112 // DVP-0070A #define INITIALD_5_JAP_REVF 0xfc3dc85d // DVP-0070F -#define INITIALD_5_EXP_30 0x77c6b58b // DVP-0075 and DVP-0084???? -#define INITIALD_5_EXP_40 0xd4910e75 // DVP-0084A +#define INITIALD_5_EXP 0x701b88cf // DVP-0075 +#define INITIALD_5_EXP_20 0x77c6b58b // DVP-0084 +#define INITIALD_5_EXP_20A 0xd4910e75 // DVP-0084A #define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011 #define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A #define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A @@ -268,6 +269,7 @@ typedef struct int customCursorHeight; int mj4EnabledAtT; char or2IP[16]; + char or2Netmask[16]; float cpuFreqGhz; ArcadeInputs arcadeInputs; int inputMode; // 0 = both, 1 = SDL/X11 only, 2 = EVDEV only diff --git a/src/lindbergh/eeprom.c b/src/lindbergh/eeprom.c index 6ef6e5c..4859806 100644 --- a/src/lindbergh/eeprom.c +++ b/src/lindbergh/eeprom.c @@ -93,7 +93,7 @@ int initEeprom() if ((getConfig()->crc32 == OUTRUN_2_SP_SDX || getConfig()->crc32 == OUTRUN_2_SP_SDX_REVA) && strcmp(getConfig()->or2IP, "") != 0) { - if (setIP(eeprom, getConfig()->or2IP, "255.255.255.0") != 0) + if (setIP(eeprom, getConfig()->or2IP, getConfig()->or2Netmask) != 0) { printf("Error setting the new IP address."); fclose(eeprom); diff --git a/src/lindbergh/hook.c b/src/lindbergh/hook.c index a4cdec7..e53c443 100644 --- a/src/lindbergh/hook.c +++ b/src/lindbergh/hook.c @@ -255,15 +255,16 @@ void __attribute__((constructor)) hook_init() } printf("\n"); - if (getConfig()->GPUVendor == ATI_GPU - && ((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) || - (getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX) || - (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVA) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVB) || - (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX_REVA) || - (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE_REVA) || - (getConfig()->crc32 == INITIALD_5_JAP_REVA) || (getConfig()->crc32 == INITIALD_5_JAP_REVF) || - (getConfig()->crc32 == INITIALD_5_EXP_30) || (getConfig()->crc32 == INITIALD_5_EXP_40))) { - printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n",getGameName()); + if (getConfig()->GPUVendor == ATI_GPU && + ((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) || + (getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX) || + (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVA) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVB) || + (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX_REVA) || + (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE_REVA) || + (getConfig()->crc32 == INITIALD_5_JAP_REVA) || (getConfig()->crc32 == INITIALD_5_JAP_REVF) || + (getConfig()->crc32 == INITIALD_5_EXP_20) || (getConfig()->crc32 == INITIALD_5_EXP_20A))) + { + printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n", getGameName()); } } @@ -272,8 +273,7 @@ DIR *opendir(const char *dirname) DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir"); int gId = getConfig()->crc32; - if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA || - gId == INITIALD_5_JAP_REVF) + if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF) { if (strcmp(dirname, "/tmp/") == 0) { @@ -555,8 +555,7 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode) } int gId = getConfig()->crc32; - if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA || - gId == INITIALD_5_JAP_REVF) + if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF) { if (strncmp(pathname, "/tmp/", 5) == 0) { diff --git a/src/lindbergh/input.c b/src/lindbergh/input.c index 4a57717..9aa8530 100644 --- a/src/lindbergh/input.c +++ b/src/lindbergh/input.c @@ -451,6 +451,7 @@ void sdlEventDriving(SDL_Event *event) break; } } + void sdlEventShooting(SDL_Event *event) { KeyMapping keymap = getConfig()->keymap; @@ -585,13 +586,22 @@ void sdlEventShooting(SDL_Event *event) case SDL_MOUSEBUTTONUP: { if (event->button.button == SDL_BUTTON_LEFT) // Trigger + { setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN); - + } else if (event->button.button == SDL_BUTTON_RIGHT) // Reload + { + if (getConfig()->crc32 == RAMBO || getConfig()->crc32 == TOO_SPICY) + { + setAnalogue(ANALOGUE_1, -1); + setAnalogue(ANALOGUE_2, -1); + } setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_MOUSEBUTTONDOWN); - + } else if (event->button.button == SDL_BUTTON_MIDDLE) // Extra Gun Button + { setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_MOUSEBUTTONDOWN); + } } break; default: diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index 75a03ff..9412521 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -200,8 +200,9 @@ int amDongleUserInfoEx(int a, int b, char *_arcadeContext) case INITIALD_4_EXP_REVD: case INITIALD_5_JAP_REVA: case INITIALD_5_JAP_REVF: - case INITIALD_5_EXP_30: - case INITIALD_5_EXP_40: + case INITIALD_5_EXP: + case INITIALD_5_EXP_20: + case INITIALD_5_EXP_20A: memcpy(_arcadeContext, elfID, 4); break; default: @@ -258,15 +259,17 @@ int amDipswGetData(uint8_t *dip) securityBoardIn(0x38, &data); - result = (~data & 4) != 0; // Test Button - if ((~data & 8) != 0) - result |= 2; // Service Button + result = 0x00; if ((~data & 0x10) != 0) - result |= 4; // ?? - if ((char)data >= 0) - result |= 8; // ?? + result |= 0x01; // Dip 7 + if ((~data & 0x20) != 0) + result |= 0x02; // Dip 8 + if ((~data & 0x40) != 0) + result |= 0x04; // Dip 1 + if ((~data & 0x80) != 0) + result |= 0x08; // Dip 2 if ((~data & 0x100) != 0) - result |= 0x10; // Rotation + result |= 0x10; // Rotation Dip 3 if ((~data & 0x200) != 0) result |= 0x20; // Resolution Dip 4 if ((~data & 0x400) != 0) @@ -1043,6 +1046,11 @@ int initPatch() // Shader Fixes cacheModedShaderFiles(); + if (getConfig()->cpuFreqGhz != 0.0f) + { + uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0); + setVariable(0x0826829b, cpuFreq); + } } break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST: @@ -1080,6 +1088,11 @@ int initPatch() // Shader Fixes cacheModedShaderFiles(); + if (getConfig()->cpuFreqGhz != 0.0f) + { + uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0); + setVariable(0x082d019d, cpuFreq); + } } break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB_TEST: @@ -2114,7 +2127,65 @@ int initPatch() detourFunction(0x08266098, stubRetOne); // isExistNewerSource (forces shader recompilation) } break; - case INITIALD_5_EXP_30: + case INITIALD_5_EXP: + { + if (config->showDebugMessages == 1) + { + setVariable(0x093a93f0, 2); // amBackupDebugLevel + setVariable(0x093a9400, 2); // amCreditDebugLevel + setVariable(0x093a9658, 2); // amDipswDebugLevel + setVariable(0x093a965c, 2); // amDongleDebugLevel + setVariable(0x093a9660, 2); // amEepromDebugLevel + setVariable(0x093a9664, 2); // amHwmonitorDebugLevel + setVariable(0x093a9668, 2); // amJvsDebugLevel + setVariable(0x093a966c, 2); // amLibDebugLevel + setVariable(0x093a9670, 2); // amMiscDebugLevel + setVariable(0x093a9678, 2); // amSysDataDebugLevel + setVariable(0x093a9680, 2); // bcLibDebugLevel + setVariable(0x093a9674, 2); // amOsinfoDebugLevel + setVariable(0x093a9684, 0x0FFFFFFF); // s_logMask + detourFunction(0x08745e28, _putConsoleSeparate); // Debug Messages + } + // Security + detourFunction(0x08911dca, amDongleInit); + detourFunction(0x08910815, amDongleIsAvailable); + detourFunction(0x08911279, amDongleUpdate); + detourFunction(0x08911c91, amDongleUserInfoEx); + memcpy(elfID, (void *)0x084e2407, 4); // Get gameID from the ELF + // Fixes + amDipswContextAddr = (void *)0x093d94c8; + detourFunction(0x089105a8, amDipswInit); + detourFunction(0x0891062c, amDipswExit); + detourFunction(0x089106a1, amDipswGetData); + detourFunction(0x08910718, amDipswSetLed); // amDipswSetLed + detourFunction(0x08322248, stubRetOne); // isEthLinkUp + detourFunction(0x083084a2, stubRetOne); // Skip Kickback initialization + patchMemory(0x084429d9, "eb60"); // tickInitAddress + patchMemory(0x0843fb34, "C0270900"); // tickInitStoreNetwork + detourFunction(0x084deddc, stubRetZero); // doesNeedRollerCleaning + detourFunction(0x084dedf8, stubRetZero); // doesNeedStockerCleaning + patchMemory(0x0843f5ad, "c7c300030000"); // Moves Initializing text + patchMemory(0x089e314c, "47f3"); // Skips initialization + patchMemory(0x08789a49, "e92601000090"); // Prevents Full Screen set from the game + + // Mesa Patches + if (getConfig()->GPUVendor != NVIDIA_GPU) + { + detourFunction(0x0807a3f0, gl_MultiTexCoord2fARB); + detourFunction(0x0807a470, gl_Color4ub); + detourFunction(0x0807a6b0, gl_Vertex3f); + detourFunction(0x0807ae10, gl_TexCoord2f); + detourFunction(0x0807aed0, cg_GLIsProfileSupported); + patchMemory(0x087450ef, "9090"); + cacheModedShaderFiles(); + } + + detourFunction(0x08389544, stubRetOne); // isExistNewerSource + detourFunction(0x0807b370, gl_XGetProcAddressARB); + patchMemory(0x08744f2e, "00"); // Fix cutscenes + } + break; + case INITIALD_5_EXP_20: { if (config->showDebugMessages == 1) { @@ -2180,7 +2251,7 @@ int initPatch() patchMemory(0x08761a7e, "00"); // Fix cutscenes } break; - case INITIALD_5_EXP_40: + case INITIALD_5_EXP_20A: { if (config->showDebugMessages == 1) { diff --git a/src/lindbergh/resolution.c b/src/lindbergh/resolution.c index 708b7d5..00d4c34 100644 --- a/src/lindbergh/resolution.c +++ b/src/lindbergh/resolution.c @@ -150,26 +150,44 @@ void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdou case THE_HOUSE_OF_THE_DEAD_4_REVB: case THE_HOUSE_OF_THE_DEAD_4_REVC: { - right = 1280.0; - bottom = 720.0; + if ((getConfig()->width != 1280 && getConfig()->height != 768) || (getConfig()->width != 640 && getConfig()->height != 480)) + { + right = 1280.0; + bottom = 720.0; + } } break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: { - if (right == 1024.0 && bottom == 768.0) + if (getConfig()->width != 1024 && getConfig()->height != 768) { - right = 800.0; - bottom = 600.0; + if (right == 1024.0 && bottom == 768.0) + { + right = 800.0; + bottom = 600.0; + } } } break; case SEGA_RACE_TV: { - if ((right == 640.0 && bottom == 480.0) && (getConfig()->width != 640 && getConfig()->height != 480)) + if (getConfig()->width != 640 && getConfig()->height != 480) { - right = 600000.0; - bottom = 600000.0; + if ((right == 640.0 && bottom == 480.0) && (getConfig()->width != 640 && getConfig()->height != 480)) + { + right = 600000.0; + bottom = 600000.0; + } + } + } + break; + case THE_HOUSE_OF_THE_DEAD_EX: + { + if (getConfig()->width != 1280 && getConfig()->height != 768) + { + right = 600.0; + bottom = 480.0; } } break; @@ -195,10 +213,13 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) case HUMMER: case HUMMER_SDLX: { - if (width == 1280 && height == 768) + if (getConfig()->width != 1280 && getConfig()->height != 768) { - width = getConfig()->width; - height = getConfig()->height; + if (width == 1280 && height == 768) + { + width = getConfig()->width; + height = getConfig()->height; + } } } break; @@ -208,61 +229,61 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) case OUTRUN_2_SP_SDX_REVA_TEST: case OUTRUN_2_SP_SDX_REVA_TEST2: { - if ((width >= 800) && (width != 1024)) + if (getConfig()->width != 800 && getConfig()->height != 480) { - width = getConfig()->width; - height = getConfig()->height; + if ((width >= 800) && (width != 1024)) + { + width = getConfig()->width; + height = getConfig()->height; + } } } break; case SEGA_RACE_TV: { - if (width == 640 && height == 480 && returnAddress == (void *)0x08123932) + if (getConfig()->width != 640 && getConfig()->height != 480) { - x = srtvX; - width = srtvW; - height = srtvH; - } - else if (width > 640) - { - width = 0; - height = 0; - } - } - break; - case THE_HOUSE_OF_THE_DEAD_4_REVA: - case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST: - case THE_HOUSE_OF_THE_DEAD_4_REVB: - case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST: - case THE_HOUSE_OF_THE_DEAD_4_REVC: - case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST: - { - if (width == 640 && height == 480) - { - width = getConfig()->width; - height = getConfig()->height; + if (width == 640 && height == 480 && returnAddress == (void *)0x08123932) + { + x = srtvX; + width = srtvW; + height = srtvH; + } + else if (width > 640) + { + width = 0; + height = 0; + } } } break; + // case THE_HOUSE_OF_THE_DEAD_4_REVA: + // case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST: + // case THE_HOUSE_OF_THE_DEAD_4_REVB: + // case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST: + // case THE_HOUSE_OF_THE_DEAD_4_REVC: + // case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST: + // { + // if (width == 640 && height == 480) + // { + // width = getConfig()->width; + // height = getConfig()->height; + // } + // } + // break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: { - if (width == 1024 && height == 768) + if (getConfig()->width != 1024 && getConfig()->height != 768) { - width = getConfig()->width; - height = getConfig()->height; - x = 250; - y = 100; - } - } - break; - case LETS_GO_JUNGLE: - { - if (width == 1360 && height == 768) - { - width = getConfig()->width; - height = getConfig()->height; + if (width == 1024 && height == 768) + { + width = getConfig()->width; + height = getConfig()->height; + x = 250; + y = 100; + } } } break; @@ -273,9 +294,12 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) case VIRTUA_FIGHTER_5_R_REVD: case VIRTUA_FIGHTER_5_R_REVG: { - if (width == vf5FSwidth) + if ((getConfig()->width != 640 && getConfig()->height != 480) || (getConfig()->width != 1280 && getConfig()->height != 768)) { - width = getConfig()->width; + if (width == vf5FSwidth) + { + width = getConfig()->width; + } } } break; @@ -292,21 +316,24 @@ void glTexImage2D(unsigned int target, int level, int internalformat, int width, void (*_glTexImage2D)(unsigned int target, int level, int internalformat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels) = dlsym(RTLD_NEXT, "glTexImage2D"); - switch (getConfig()->crc32) + if (getConfig()->width != 800 && getConfig()->height != 480) { - case OUTRUN_2_SP_SDX: - case OUTRUN_2_SP_SDX_REVA: - { - void *addr = __builtin_return_address(0); - if ((width >= 800) && (width != 1024) && (addr != (void *)0x80d78d5) && (addr != (void *)0x080d7941)) + switch (getConfig()->crc32) { - width = getConfig()->width; - height = getConfig()->height; + case OUTRUN_2_SP_SDX: + case OUTRUN_2_SP_SDX_REVA: + { + void *addr = __builtin_return_address(0); + if ((width >= 800) && (width != 1024) && (addr != (void *)0x80d78d5) && (addr != (void *)0x080d7941)) + { + width = getConfig()->width; + height = getConfig()->height; + } } - } - break; - default: break; + default: + break; + } } _glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } @@ -1278,6 +1305,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c0308, getConfig()->width); setVariable(0x082c030c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1292,6 +1321,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_REVA: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c0a68, getConfig()->width); setVariable(0x082c0a6c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1306,6 +1337,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_REVB: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082C0AE8, getConfig()->width); setVariable(0x082C0AEC, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1320,6 +1353,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_SDX: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c2228, getConfig()->width); setVariable(0x082c222c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1334,6 +1369,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_SDX_REVA: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c2228, getConfig()->width); setVariable(0x082c222c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1348,6 +1385,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_SE: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c0b28, getConfig()->width); setVariable(0x082c0b2c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1362,6 +1401,8 @@ int initResolutionPatches() break; case AFTER_BURNER_CLIMAX_SE_REVA: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; setVariable(0x082c0b28, getConfig()->width); setVariable(0x082c0b2c, getConfig()->height); float newFontScale = getConfig()->height / 480.0; @@ -1376,6 +1417,8 @@ int initResolutionPatches() break; case SEGA_RACE_TV: { + if (getConfig()->width == 640 && getConfig()->height == 480) + break; if (getConfig()->keepAspectRatio) { srtvX = (getConfig()->width - (getConfig()->height / 3) * 4) / 2; @@ -1390,6 +1433,8 @@ int initResolutionPatches() break; case OUTRUN_2_SP_SDX: { + if (getConfig()->width <= 800 && getConfig()->height <= 480) + break; // If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is // shown. if ((getConfig()->width > 800) && (getConfig()->height > 480)) @@ -1414,6 +1459,8 @@ int initResolutionPatches() break; case OUTRUN_2_SP_SDX_REVA: { + if (getConfig()->width <= 800 && getConfig()->height <= 480) + break; // If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is // shown. if ((getConfig()->width > 800) && (getConfig()->height > 480)) @@ -1450,17 +1497,16 @@ int initResolutionPatches() case OUTRUN_2_SP_SDX_REVA_TEST: case OUTRUN_2_SP_SDX_REVA_TEST2: { + if (getConfig()->width <= 800 && getConfig()->height <= 480) + break; setVariable(0x0804a490, getConfig()->width); setVariable(0x0804a4ad, getConfig()->height); } break; case THE_HOUSE_OF_THE_DEAD_4_REVA: { - if (getConfig()->width == 1280 && getConfig()->height == 768) - { - setVariable(0x084c9dbc, 1280); - return 0; - } + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; patchMemory(0x0804d142, "9090909090"); // setresolutiontype // patchMemory(0x084c9dbc, "0005"); // patchMemory(0x08448458, "0005"); @@ -1483,11 +1529,8 @@ int initResolutionPatches() break; case THE_HOUSE_OF_THE_DEAD_4_REVB: { - if (getConfig()->width == 1280 && getConfig()->height == 768) - { - setVariable(0x084c3a9c, 1280); - return 0; - } + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; patchMemory(0x0804d174, "9090909090"); // setresolutiontype setVariable(0x084c3a9c, getConfig()->width); setVariable(0x08443118, getConfig()->width); @@ -1507,7 +1550,7 @@ int initResolutionPatches() break; case THE_HOUSE_OF_THE_DEAD_4_REVC: { - if (getConfig()->width == 1280 && getConfig()->height == 768) + if (getConfig()->width <= 1280 && getConfig()->height <= 768) { setVariable(0x084c3a9c, 1280); return 0; @@ -1531,6 +1574,8 @@ int initResolutionPatches() break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: { + if (getConfig()->width <= 1024 && getConfig()->height <= 768) + break; patchMemory(0x0804d2f4, "9090909090"); // setresolutiontype setVariable(0x084563c4, getConfig()->width); setVariable(0x08424448, getConfig()->width); @@ -1542,6 +1587,8 @@ int initResolutionPatches() break; case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: { + if (getConfig()->width <= 1024 && getConfig()->height <= 768) + break; patchMemory(0x0804d7e2, "9090909090"); // setresolutiontype setVariable(0x084c35c4, getConfig()->width); setVariable(0x08491648, getConfig()->width); @@ -1553,7 +1600,6 @@ int initResolutionPatches() break; case THE_HOUSE_OF_THE_DEAD_EX: { - patchMemory(0x087aa080, "5005"); // Boost Resolution } break; case VIRTUA_FIGHTER_5: @@ -1569,7 +1615,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_REVA: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x8053167, "01"); // Enable Anti Alias patchMemory(0x080541af, "b80a000000"); // Skips resolution set by the Dip Switches. setVariable(0x08487df8, getConfig()->width); @@ -1579,7 +1625,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_REVB: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x08053673, "01"); // Enable Anti Alias patchMemory(0x080546cf, "b80a000000"); // Skips resolution set by the Dip Switches. setVariable(0x08536bb8, getConfig()->width); @@ -1589,7 +1635,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_REVE: // Also the public REV C version { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x080546c7, "01"); // Enable Anti Alias patchMemory(0x080557a3, "b80a000000"); // Skips resolution set by the Dip Switches. setVariable(0x085efb18, getConfig()->width); @@ -1599,7 +1645,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_EXPORT: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x08052b97, "01"); // Enable Anti Alias patchMemory(0x08053c67, "b80a000000"); // Skips resolution set by the Dip Switches. setVariable(0x085259f8, getConfig()->width); @@ -1609,7 +1655,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x08054b5e, "01"); // Enable Anti Alias patchMemory(0x08055980, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1622,7 +1668,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x080548c4, "01"); // Enable Anti Alias patchMemory(0x080556e6, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1635,7 +1681,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x08054bfe, "01"); // Enable Anti Alias patchMemory(0x08055a20, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1648,7 +1694,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_R: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x0805421a, "01"); // Enable Anti Alias patchMemory(0x080554b0, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1661,7 +1707,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_R_REVD: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x080543aa, "01"); // Enable Anti Alias patchMemory(0x080555f6, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1674,7 +1720,7 @@ int initResolutionPatches() case VIRTUA_FIGHTER_5_R_REVG: { if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768)) - return 0; + break; patchMemory(0x0805436a, "01"); // Enable Anti Alias patchMemory(0x0805577c, "b80a000000"); // Skips resolution set by the Dip Switches. vf5FSwidth = (getConfig()->height * 5) / 3; @@ -1708,6 +1754,8 @@ int initResolutionPatches() break; case INITIALD_4_REVA: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0835640d, 0x0000f0e9); // Force set resolution setVariable(0x08356503, getConfig()->width); // Set ResX setVariable(0x08356508, getConfig()->height); // Set ResY @@ -1740,6 +1788,8 @@ int initResolutionPatches() break; case INITIALD_4_REVB: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0835664d, 0x0000f0e9); // Force set resolution setVariable(0x08356743, getConfig()->width); // Set ResX setVariable(0x08356748, getConfig()->height); // Set ResY @@ -1772,6 +1822,8 @@ int initResolutionPatches() break; case INITIALD_4_REVC: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0835eebd, 0x0000f0e9); // Force set resolution setVariable(0x0835efb3, getConfig()->width); // Set ResX setVariable(0x0835efb8, getConfig()->height); // Set ResY @@ -1804,6 +1856,8 @@ int initResolutionPatches() break; case INITIALD_4_REVD: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0835c55d, 0x0000f0e9); // Force set resolution setVariable(0x0835c653, getConfig()->width); // Set ResX setVariable(0x0835c658, getConfig()->height); // Set ResY @@ -1836,6 +1890,8 @@ int initResolutionPatches() break; case INITIALD_4_REVG: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x08393fbd, 0x0000f0e9); // Force set resolution setVariable(0x083940b3, getConfig()->width); // Set ResX setVariable(0x083940b8, getConfig()->height); // Set ResY @@ -1876,6 +1932,8 @@ int initResolutionPatches() break; case INITIALD_4_EXP_REVB: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0837979d, 0x0000f0e9); // Force set resolution setVariable(0x08379893, getConfig()->width); // Set ResX setVariable(0x08379898, getConfig()->height); // Set ResY @@ -1920,6 +1978,8 @@ int initResolutionPatches() break; case INITIALD_4_EXP_REVC: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0837961d, 0x0000f0e9); // Force set resolution setVariable(0x08379713, getConfig()->width); // Set ResX setVariable(0x08379718, getConfig()->height); // Set ResY @@ -1967,6 +2027,8 @@ int initResolutionPatches() break; case INITIALD_4_EXP_REVD: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; setVariable(0x0837b12d, 0x0000f0e9); // Force set resolution setVariable(0x0837b223, getConfig()->width); // Set ResX setVariable(0x0837b228, getConfig()->height); // Set ResY @@ -2009,8 +2071,61 @@ int initResolutionPatches() } } break; - case INITIALD_5_EXP_30: + case INITIALD_5_EXP: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; + patchMemory(0x0853d8cd, "E9f000"); // Accept different Resolutions + setVariable(0x0853d9c3, getConfig()->width); // Set ResX + setVariable(0x0853d9c8, getConfig()->height); // Set ResY + + patchMemory(0x08356054, "bb01000000eb6b"); // Prevents renrer.ini from loading + setVariable(0x08355f30, getConfig()->width); // Framebuffer Main Width + setVariable(0x08355f37, getConfig()->height); // Framebuffer Main Height + setVariable(0x08355fd1, 256); // Framebuffer Road Specular width + setVariable(0x08355fd8, 256); // Framebuffer Road Specular height + setVariable(0x08355ff7, getConfig()->width); // Framebuffer Glare Width + setVariable(0x08355ffe, getConfig()->height); // Framebuffer Glare Height + setVariable(0x08356024, getConfig()->width >> 2); // Framebuffer Reduced width + patchMemory(0x08356049, "00000001"); // Enable Cube Secular + // Fix Press start and Insert coins text + idDisplayTextureCAVEAddress = (void *)0x084e2470 + 5; + detourFunction(0x084e2470, idDisplayTexture); + // setViewport for track selection screen + setVariable(0x08215cae, (int)(getConfig()->height * (112.0 / 768))); + setVariable(0x08215cb6, (int)(getConfig()->width * (724.0 / 1315))); + setVariable(0x08215cbe, (int)(getConfig()->height * (592.0 / 768))); + setVariable(0x08215cc6, (int)(getConfig()->width * (962.0 / 1315))); + setVariable(0x08215cce, getConfig()->height); + // FSAA + patchMemory(0x0875aaa6, "9090"); + patchMemory(0x08788949, "01"); // FSAA Enabled + setVariable(0x08cac148, 1); // FSAA Quality + // Balloon fix + idDrawBallonCAVEAddress = (void *)0x082536c8 + 6; + iddrawBallonPutAddress = (void *)0x086d257c; + detourFunction(0x082536c8, idDrawBallon); + replaceCallAtAddress(0x08254b68, idBalloonPut); + replaceCallAtAddress(0x08254c29, idBalloonPut); + // START and VIEW CHANGE Text fix + float explanationScaleX = getConfig()->width - (1360.0 - 815.0); + float explanationScaleY = (getConfig()->height / 768.0) * 680.0; + setVariable(0x0826ac45, *(unsigned int *)&explanationScaleY); + setVariable(0x0826acbd, *(unsigned int *)&explanationScaleX); + // Scale Testmode text + if (isTestMode() && getConfig()->width >= 1920) + { + patchMemory(0x08c55ca0, "02"); + idTextShift = (getConfig()->width == 1920 ? 27 : ((1920 / getConfig()->width) * 27) + 2); + idTestTextAddress = (void *)0x08775c1c; + replaceCallAtAddress(0x0850853e, idTestText); + } + } + break; + case INITIALD_5_EXP_20: + { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; patchMemory(0x0855a48d, "E9f000"); // Accept different Resolutions setVariable(0x0855a583, getConfig()->width); // Set ResX setVariable(0x0855a588, getConfig()->height); // Set ResY @@ -2058,8 +2173,10 @@ int initResolutionPatches() } } break; - case INITIALD_5_EXP_40: + case INITIALD_5_EXP_20A: { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; patchMemory(0x0855a6dd, "E9f000"); // Accept different Resolutions setVariable(0x0855a7d3, getConfig()->width); // Set ResX setVariable(0x0855a7d8, getConfig()->height); // Set ResY @@ -2109,6 +2226,8 @@ int initResolutionPatches() break; case INITIALD_5_JAP_REVA: // ID5 - DVP-0070A { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; patchMemory(0x0853ccdd, "E9f000"); // Accept different Resolutions setVariable(0x0853cdd3, getConfig()->width); // Set ResX setVariable(0x0853cdd8, getConfig()->height); // Set ResY @@ -2158,6 +2277,8 @@ int initResolutionPatches() break; case INITIALD_5_JAP_REVF: // ID5 - DVP-0070F { + if (getConfig()->width == 1360 && getConfig()->height == 768) + break; patchMemory(0x08556bbd, "E9f000"); // Accept different Resolutions setVariable(0x08556cb3, getConfig()->width); // Set ResX setVariable(0x08556cb8, getConfig()->height); // Set ResY @@ -2334,6 +2455,8 @@ int initResolutionPatches() break; case RAMBO: { + if (getConfig()->width <= 1360 && getConfig()->height <= 768) + break; patchMemory(0x080c70d0, "9090909090"); // setresolutiontype setVariable(0x08416df0, getConfig()->width); // render res setVariable(0x08416d60, getConfig()->width); // main res @@ -2353,6 +2476,8 @@ int initResolutionPatches() break; case PRIMEVAL_HUNT: { + if (getConfig()->width <= 640 && getConfig()->height <= 480) + break; phX = 0; phY = 0; phW = getConfig()->width; @@ -2445,6 +2570,8 @@ int initResolutionPatches() break; case HARLEY_DAVIDSON: { + if (getConfig()->width <= 1360 && getConfig()->height <= 768) + break; int w = getConfig()->width; int h = getConfig()->height; setVariable(0x088a57e0, w); // main res @@ -2468,6 +2595,8 @@ int initResolutionPatches() break; case HUMMER: { + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; replaceCallAtAddress(0x080d8b58, hummerRespatch); replaceCallAtAddress(0x080d8b73, hummerRespatch); replaceCallAtAddress(0x080d8b8e, hummerRespatch); @@ -2478,6 +2607,8 @@ int initResolutionPatches() break; case HUMMER_SDLX: { + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; replaceCallAtAddress(0x080d8b14, hummerRespatch); replaceCallAtAddress(0x080d8b2f, hummerRespatch); replaceCallAtAddress(0x080d8b4a, hummerRespatch); @@ -2488,6 +2619,8 @@ int initResolutionPatches() break; case HUMMER_EXTREME: { + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; replaceCallAtAddress(0x08159eab, hummerRespatch); replaceCallAtAddress(0x08159ec9, hummerRespatch); replaceCallAtAddress(0x08159ee7, hummerRespatch); @@ -2498,6 +2631,8 @@ int initResolutionPatches() break; case HUMMER_EXTREME_MDX: { + if (getConfig()->width <= 1280 && getConfig()->height <= 768) + break; replaceCallAtAddress(0x0816348b, hummerRespatch); replaceCallAtAddress(0x081634a9, hummerRespatch); replaceCallAtAddress(0x081634c7, hummerRespatch); diff --git a/src/lindbergh/securityboard.c b/src/lindbergh/securityboard.c index 4d4a9ca..08c9ec4 100644 --- a/src/lindbergh/securityboard.c +++ b/src/lindbergh/securityboard.c @@ -1,7 +1,6 @@ #include #include "securityboard.h" -#include "config.h" #include "log.h" #define SECURITY_BOARD_FRONT_PANEL 0x38 diff --git a/src/lindbergh/shader_patches.c b/src/lindbergh/shader_patches.c index b586ac5..d82e15f 100644 --- a/src/lindbergh/shader_patches.c +++ b/src/lindbergh/shader_patches.c @@ -494,8 +494,7 @@ bool shaderFileInList(const char *pathname, int *idx) return false; } } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || - (gId == THE_HOUSE_OF_THE_DEAD_4_REVC)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC) { for (int x = 0; x < hod4ShaderPatchesCount; x++) { @@ -508,7 +507,7 @@ bool shaderFileInList(const char *pathname, int *idx) } return false; } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) { for (int x = 0; x < hod4spShaderPatchesCount; x++) { @@ -547,7 +546,7 @@ bool shaderFileInList(const char *pathname, int *idx) } return false; } - else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) + else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX) { for (int x = 0; x < hummerFilesToModCount; x++) @@ -606,20 +605,21 @@ bool shaderFileInList(const char *pathname, int *idx) else if ((gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG || - gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40) && + gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || + gId == INITIALD_5_EXP_20A) && gpuVendor != NVIDIA_GPU) { filesToMod = idShaderFilesToMod; filesToModCount = idFilesToModCount; - if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || (gId == INITIALD_4_REVD) || - (gId == INITIALD_4_REVG)) + if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG) { filesToMod = id4jShaderFilesToMod; filesToModCount = id4FilesToModCount; } searchFolder1 = "/shader/Cg/inc"; searchFolder2 = "/data/Shader"; - if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40)) + if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || + gId == INITIALD_5_EXP_20A) { searchFolder2 = "/data/V5SHADER"; } @@ -674,24 +674,22 @@ long int ftellGetShaderSize(int idx) } return gsevoNvidiaShaderPatches[idx].shaderBufferSize; } - else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL)) + else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL) { return lgjShaderFilesToMod[idx].shaderBufferSize; } - else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || - (gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || - (gId == INITIALD_5_EXP_40)) + else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA || + gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A) { return idShaderFilesToMod[idx].shaderBufferSize; } - else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || - (gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG)) + else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG) { return id4jShaderFilesToMod[idx].shaderBufferSize; } - else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || - (gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || - (gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) + else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST || + gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC || + gId == VIRTUA_TENNIS_3_REVC_TEST) { return vt3ShaderFilesToMod[idx].shaderBufferSize; } @@ -710,12 +708,11 @@ long int ftellGetShaderSize(int idx) return ramboNvidiaShaderPatches[idx].shaderBufferSize; } } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || - (gId == THE_HOUSE_OF_THE_DEAD_4_REVC)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC) { return hod4ShaderPatches[idx].shaderBufferSize; } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) { return hod4spShaderPatches[idx].shaderBufferSize; } @@ -723,7 +720,7 @@ long int ftellGetShaderSize(int idx) { return hodexShaderPatches[idx].shaderBufferSize; } - else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) + else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX) { return hummerShaderFilesToMod[idx].shaderBufferSize; } @@ -757,27 +754,25 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx) } return 1; } - else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL)) + else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL) { memcpy(buf, lgjShaderFilesToMod[idx].shaderBuffer, size); return size; } - else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || - (gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || - (gId == INITIALD_5_EXP_40)) + else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA || + gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A) { memcpy(buf, idShaderFilesToMod[idx].shaderBuffer, size); return size; } - else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || - (gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG)) + else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG) { memcpy(buf, id4jShaderFilesToMod[idx].shaderBuffer, size); return size; } - else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || - (gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || - (gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) + else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST || + gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC || + gId == VIRTUA_TENNIS_3_REVC_TEST) { memcpy(buf, vt3ShaderFilesToMod[idx].shaderBuffer, size); return size; @@ -800,13 +795,12 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx) return ramboNvidiaShaderPatches[idx].shaderBufferSize; } } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || - (gId == THE_HOUSE_OF_THE_DEAD_4_REVC)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC) { memcpy(buf, hod4ShaderPatches[idx].shaderBuffer, hod4ShaderPatches[idx].shaderBufferSize); return hod4ShaderPatches[idx].shaderBufferSize; } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) { memcpy(buf, hod4spShaderPatches[idx].shaderBuffer, hod4spShaderPatches[idx].shaderBufferSize); return hod4spShaderPatches[idx].shaderBufferSize; @@ -816,7 +810,7 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx) memcpy(buf, hodexShaderPatches[idx].shaderBuffer, hodexShaderPatches[idx].shaderBufferSize); return hodexShaderPatches[idx].shaderBufferSize; } - else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) + else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX) { memcpy(buf, hummerShaderFilesToMod[idx].shaderBuffer, hummerShaderFilesToMod[idx].shaderBufferSize); return hummerShaderFilesToMod[idx].shaderBufferSize; @@ -846,10 +840,10 @@ char *cgGetProgramString(char *program, int e) uint32_t gId = getConfig()->crc32; - if ((gId != INITIALD_4_EXP_REVB) && (gId != INITIALD_4_EXP_REVC) && (gId != INITIALD_4_EXP_REVD) && - (gId != INITIALD_4_REVA) && (gId != INITIALD_4_REVB) && (gId != INITIALD_4_REVC) && (gId != INITIALD_4_REVD) && - (gId != INITIALD_4_REVG) && (gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) && - (gId != INITIALD_5_EXP_30) && (gId != INITIALD_5_EXP_40)) + if (gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD && gId != INITIALD_4_REVA && + gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG && + gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 && + gId != INITIALD_5_EXP_20A) { return _cgGetProgramString(program, e); } @@ -1100,17 +1094,18 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i gId != VIRTUA_TENNIS_3_REVC_TEST && gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD && gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL && gId != INITIALD_4_REVA && gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG && - gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP_30 && gId != INITIALD_5_EXP_40) || + gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 && + gId != INITIALD_5_EXP_20A) || (getConfig()->GPUVendor == NVIDIA_GPU)) { if ((gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL) || getConfig()->lgjRenderWithMesa == 0) return _cgCreateProgram(context, program_type, program, profile, entry, args); } - if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || - (gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || (gId == INITIALD_4_REVD) || - (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || - (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40)) + if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA || + gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG || + gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || + gId == INITIALD_5_EXP_20A) { if ((profile == 6148) || (profile == 6150) || profile == 7001) profile = 6150; @@ -1145,8 +1140,7 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **const string, const GLint *length) { uint32_t gId = getConfig()->crc32; - if ((gId != SEGA_RACE_TV) && (gId != HUMMER) && (gId != HUMMER_SDLX) && (gId != HUMMER_EXTREME) && - (gId != HUMMER_EXTREME_MDX)) + if (gId != SEGA_RACE_TV && gId != HUMMER && gId != HUMMER_SDLX && gId != HUMMER_EXTREME && gId != HUMMER_EXTREME_MDX) { glShaderSourceARB(shaderObj, count, string, length); return; @@ -1187,7 +1181,7 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** } } } - else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) + else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX) { void *addr = __builtin_return_address(0); if ((addr != (void *)0x830a501) && (addr != (void *)0x830a485) && (addr != (void *)0x08319841) && @@ -1226,8 +1220,8 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB ** void *gl_XGetProcAddressARB(const unsigned char *procName) { int dbgMsg = getConfig()->showDebugMessages; - if ((getConfig()->crc32 != HUMMER) && (getConfig()->crc32 != HUMMER_SDLX) && - (getConfig()->crc32 != HUMMER_EXTREME) && (getConfig()->crc32 != HUMMER_EXTREME_MDX)) + if (getConfig()->crc32 != HUMMER && getConfig()->crc32 != HUMMER_SDLX && getConfig()->crc32 != HUMMER_EXTREME && + getConfig()->crc32 != HUMMER_EXTREME_MDX) { if (strcmp((const char *)procName, "glGenOcclusionQueriesNV") == 0) { @@ -1695,15 +1689,14 @@ void cacheModedShaderFiles() free(newProgram); } } - else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || - (gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || - (gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) || - (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40)) + else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA || + gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG || + gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || + gId == INITIALD_5_EXP_20A) { ShaderFilesToMod *shaderFilesToMod; int filesToModCount; - if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || - (gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG)) + if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG) { shaderFilesToMod = id4jShaderFilesToMod; filesToModCount = id4FilesToModCount; @@ -1715,8 +1708,8 @@ void cacheModedShaderFiles() } for (int x = 0; x < filesToModCount; x++) { - if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || - (gId == INITIALD_5_EXP_40)) + if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || + gId == INITIALD_5_EXP_20A) { char *fName = shaderFilesToMod[x].fileName; shaderFilesToMod[x].fileName = replaceSubstring(fName, 0, strlen(fName), "Shader", "V5SHADER"); @@ -1745,9 +1738,9 @@ void cacheModedShaderFiles() free(newProgram); } } - else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || - (gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || - (gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) + else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST || + gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC || + gId == VIRTUA_TENNIS_3_REVC_TEST) { for (int x = 0; x < vt3FilesToModCount; x++) { @@ -1826,14 +1819,13 @@ void cacheModedShaderFiles() shaderFilesToPatch = hodexShaderPatches; shaderFilesToPatchCount = hodexShaderPatchesCount; } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || - (gId == THE_HOUSE_OF_THE_DEAD_4_REVC)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC) { sprintf(folderName, "/../fs/dat/"); shaderFilesToPatchCount = hod4ShaderPatchesCount; shaderFilesToPatch = hod4ShaderPatches; } - else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) + else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) { sprintf(folderName, "/../fs/dat/"); shaderFilesToPatchCount = hod4spShaderPatchesCount; diff --git a/src/lindbergh/x11hooks.c b/src/lindbergh/x11hooks.c index 60d3ef8..cf2d5a2 100644 --- a/src/lindbergh/x11hooks.c +++ b/src/lindbergh/x11hooks.c @@ -59,7 +59,7 @@ Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int unsigned long valueMask, XSetWindowAttributes *attributes) = dlsym(RTLD_NEXT, "XCreateWindow"); - if (gettingGPUVendor || creatingWindow || GLUTGame) + if ((gettingGPUVendor || creatingWindow) || (GLUTGame && getConfig()->noSDL == 0)) { Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);