1
0
mirror of synced 2025-02-28 22:50:24 +01:00

Fixed a bug in LGJ when GPU was nVidia and Mesa was set as shader patches.

This commit is contained in:
dkeruza-neo 2025-01-26 03:57:38 +01:00
parent 7ea08b3db3
commit f67f30cbcd
3 changed files with 130 additions and 111 deletions

34
docs/changelog Normal file
View File

@ -0,0 +1,34 @@
# Changelog
All notable changes to this project will be documented in this file.
## [Unreleased]
### Added
- Let's go Jungle resolution patch.
- 2 Spicy resolution patch.
- 2 Spicy Patch to allow any IP for Network play.
- 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 a bug in Let's go Jungle when GPU was nVidia and Mesa was set as shader patches.
### [2.0.1] 2025-01-23
### Added
- HOD4 Custom crosshair.
- HOD4 CPU frequency fix (Configurable via config file).
- HOD4 New resolution patch that fixes Boss battle and scales from 1280x768 instead of the lower resolution.
- Built in Logos and fonts (no more nee to use Lucida/SEGA_KakuGothic-DB-Roman_12 and logo.tga).
- Outrun 2 Easy network config from the conf file (can set your IP address in the config file and the loader will set it in the eeprom for you).
- Card Emulation for VT3 and R-tuned.
- All the now games work inside an SDL window now, unless it is disabled in the conf file.
## [2.0] - 2024-12-24
### Initial Release
- First official public release.
- Features of the loader:
- Dynamic shader modification allowing games to work on Intel, nVidia and AMD
- 5.1 Surround Sound Support
- Dynamic resolution patching allowing most games to scale properly in HD
- Original cabinet support with pass through of JVS and FFB
- Network play
- Both simple X11 and advanced evdev input system allowing for ready-to-play keyboard and mouse support or mapping of any controller

View File

@ -12,7 +12,6 @@
#undef __x86_64__
#include <arpa/inet.h>
#include <dlfcn.h>
#include <errno.h>
#include <link.h>
#include <linux/sockios.h>
#include <math.h>
@ -266,12 +265,6 @@ void __attribute__((constructor)) hook_init()
(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()->lgjRenderWithMesa &&
((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL)))
{
getConfig()->GPUVendor = AMD_GPU;
}
}
DIR *opendir(const char *dirname)
@ -468,10 +461,6 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
return fileHooks[CPUINFO];
}
if (strcmp(pathname, "/usr/lib/boot/logo_red.tga") == 0)
{
return _fopen("logo_red.tga", mode);
}
if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.tga") == 0)
{
if (!getConfig()->disableBuiltinFont)

View File

@ -435,6 +435,7 @@ bool shaderFileInList(const char *pathname, int *idx)
{
uint32_t gId = getConfig()->crc32;
char cwd[256];
int gpuVendor = getConfig()->GPUVendor;
if (gId == GHOST_SQUAD_EVOLUTION)
{
if (getConfig()->GPUVendor != NVIDIA_GPU)
@ -560,104 +561,100 @@ bool shaderFileInList(const char *pathname, int *idx)
}
return false;
}
else if (getConfig()->GPUVendor != NVIDIA_GPU)
else if (gId == TOO_SPICY && gpuVendor != NVIDIA_GPU)
{
if (gId == TOO_SPICY)
for (int x = 0; x < tooSpicyShaderPatchesCount; x++)
{
for (int x = 0; x < tooSpicyShaderPatchesCount; x++)
{
if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
(tooSpicyShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
else if (gId == THE_HOUSE_OF_THE_DEAD_EX)
{
for (int x = 0; x < hodexShaderPatchesCount; x++)
{
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
(hodexShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
const char *fName = strrchr(pathname, '/');
char searchFileName[40];
char *searchFolder1;
char *searchFolder2;
char *format;
ShaderFilesToMod *filesToMod;
int filesToModCount;
if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL))
{
filesToMod = lgjShaderFilesToMod;
filesToModCount = lgjFilesToModCount;
searchFolder1 = "/shader/Cg";
searchFolder2 = "/extraShader/Cg";
format = "%s/inc%s";
}
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))
{
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))
{
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))
{
searchFolder2 = "/data/V5SHADER";
}
format = "%s%s";
}
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))
{
filesToMod = vt3ShaderFilesToMod;
filesToModCount = vt3FilesToModCount;
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/shader";
format = "%s%s";
}
if (strstr(pathname, searchFolder1) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder1, fName);
}
else if (strstr(pathname, searchFolder2) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder2, fName);
}
else
{
return false;
}
for (int x = 0; x < filesToModCount; x++)
{
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
(tooSpicyShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
else if (gId == THE_HOUSE_OF_THE_DEAD_EX && gpuVendor != NVIDIA_GPU)
{
for (int x = 0; x < hodexShaderPatchesCount; x++)
{
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) && (hodexShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
const char *fName = strrchr(pathname, '/');
char searchFileName[40];
char *searchFolder1;
char *searchFolder2;
char *format;
ShaderFilesToMod *filesToMod;
int filesToModCount;
if ((gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL) &&
(gpuVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa == 1))
{
filesToMod = lgjShaderFilesToMod;
filesToModCount = lgjFilesToModCount;
searchFolder1 = "/shader/Cg";
searchFolder2 = "/extraShader/Cg";
format = "%s/inc%s";
}
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) &&
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))
{
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))
{
searchFolder2 = "/data/V5SHADER";
}
format = "%s%s";
}
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) &&
gpuVendor != NVIDIA_GPU)
{
filesToMod = vt3ShaderFilesToMod;
filesToModCount = vt3FilesToModCount;
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/shader";
format = "%s%s";
}
if (strstr(pathname, searchFolder1) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder1, fName);
}
else if (strstr(pathname, searchFolder2) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder2, fName);
}
else
{
return false;
}
for (int x = 0; x < filesToModCount; x++)
{
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
{
*idx = x;
return true;
}
}
return false;
}
@ -1098,17 +1095,16 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i
const char **args) = dlsym(RTLD_NEXT, "cgCreateProgram");
uint32_t gId = getConfig()->crc32;
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) && (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)) ||
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 && 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) ||
(getConfig()->GPUVendor == NVIDIA_GPU))
{
return _cgCreateProgram(context, program_type, program, profile, entry, args);
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) ||