1
0
mirror of synced 2024-11-30 17:34:33 +01:00

Launch Outputs Thread quicker on games requiring it

This commit is contained in:
Boomslangnz 2023-11-25 21:46:09 +13:00
parent 90a7acf23d
commit c2689de971
2 changed files with 19 additions and 14 deletions

View File

@ -870,6 +870,8 @@ void MEMwrite(void* adr, void* ptr, int size)
VirtualProtect(adr, size, OldProtection, &OldProtection); VirtualProtect(adr, size, OldProtection, &OldProtection);
} }
extern DWORD WINAPI ThreadForOutputs(LPVOID lpParam);
// global variables // global variables
SDL_Haptic* haptic; SDL_Haptic* haptic;
SDL_Haptic* haptic2 = NULL; SDL_Haptic* haptic2 = NULL;
@ -2677,6 +2679,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
char libName[256]; char libName[256];
GetModuleFileNameA(hModule, libName, 256); GetModuleFileNameA(hModule, libName, 256);
_strupr(libName); _strupr(libName);
if (NULL != strstr(libName, "DINPUT8")) if (NULL != strstr(libName, "DINPUT8"))
{ {
currentLibrary = lib::dinput8; currentLibrary = lib::dinput8;
@ -2687,52 +2690,56 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
currentLibrary = lib::dinput; currentLibrary = lib::dinput;
strcat_s(buffer, MAX_PATH, "\\dinput.dll"); strcat_s(buffer, MAX_PATH, "\\dinput.dll");
} }
if (NULL != strstr(libName, "D3D11")) else if (NULL != strstr(libName, "D3D11"))
{ {
currentLibrary = lib::d3d11; currentLibrary = lib::d3d11;
strcat_s(buffer, MAX_PATH, "\\d3d11.dll"); strcat_s(buffer, MAX_PATH, "\\d3d11.dll");
} }
if (NULL != strstr(libName, "XINPUT1_3")) else if (NULL != strstr(libName, "XINPUT1_3"))
{ {
currentLibrary = lib::xinput1_3; currentLibrary = lib::xinput1_3;
strcat_s(buffer, MAX_PATH, "\\xinput1_3.dll"); strcat_s(buffer, MAX_PATH, "\\xinput1_3.dll");
} }
if (NULL != strstr(libName, "XINPUT1_4")) else if (NULL != strstr(libName, "XINPUT1_4"))
{ {
currentLibrary = lib::xinput1_3; currentLibrary = lib::xinput1_3;
strcat_s(buffer, MAX_PATH, "\\xinput1_4.dll"); strcat_s(buffer, MAX_PATH, "\\xinput1_4.dll");
} }
if (NULL != strstr(libName, "OPENGL32")) else if (NULL != strstr(libName, "OPENGL32"))
{ {
currentLibrary = lib::opengl32; currentLibrary = lib::opengl32;
strcat_s(buffer, MAX_PATH, "\\opengl32.dll"); strcat_s(buffer, MAX_PATH, "\\opengl32.dll");
} }
if (NULL != strstr(libName, "D3D9")) else if (NULL != strstr(libName, "D3D9"))
{ {
currentLibrary = lib::d3d9; currentLibrary = lib::d3d9;
strcat_s(buffer, MAX_PATH, "\\d3d9.dll"); strcat_s(buffer, MAX_PATH, "\\d3d9.dll");
} }
if (NULL != strstr(libName, "WINMM")) else if (NULL != strstr(libName, "WINMM"))
{ {
currentLibrary = lib::winmm; currentLibrary = lib::winmm;
strcat_s(buffer, MAX_PATH, "\\winmm.dll"); strcat_s(buffer, MAX_PATH, "\\winmm.dll");
} }
hlp.log(buffer); hlp.log(buffer);
gl_hOriginalDll = LoadLibraryA(buffer); gl_hOriginalDll = LoadLibraryA(buffer);
if (configGameId == 22 || configGameId == 34 || configGameId == 60)
CreateThread(NULL, 0, ThreadForOutputs, NULL, 0, NULL);
if (configGameId == 47) if (configGameId == 47)
{
MEMwrite((void*)(0x57B2F0), (void*)"\x33\xC0\x40\xC3", 4); MEMwrite((void*)(0x57B2F0), (void*)"\x33\xC0\x40\xC3", 4);
}
if (configGameId == 29) if (configGameId == 29)
{ {
gl_hjgtDll = LoadLibraryA("jgt.dll"); gl_hjgtDll = LoadLibraryA("jgt.dll");
gl_hlibavs = LoadLibraryA("libavs-win32-ea3.dll"); gl_hlibavs = LoadLibraryA("libavs-win32-ea3.dll");
} }
if ((configGameId == 4) || (configGameId == 37))
{ if (configGameId == 4 || configGameId == 37)
gl_cgGLDll = LoadLibraryA("cgGL.dll"); gl_cgGLDll = LoadLibraryA("cgGL.dll");
} }
}
else else
{ {
hlp.log(chainedDLL); hlp.log(chainedDLL);

View File

@ -1866,8 +1866,6 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
if (!init) if (!init)
{ {
CreateThread(NULL, 0, ThreadForOutputs, NULL, 0, NULL);
wchar_t* deviceGUIDString2 = new wchar_t[256]; wchar_t* deviceGUIDString2 = new wchar_t[256];
int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename); int Device2GUID = GetPrivateProfileString(TEXT("Settings"), TEXT("Device2GUID"), NULL, deviceGUIDString2, 256, settingsFilename);
char joystick_guid[256]; char joystick_guid[256];