1
0
mirror of synced 2025-01-31 19:55:26 +01:00

FreeLibrary on MAME32 & 64

This commit is contained in:
Aaron M 2019-12-09 08:33:16 +13:00
parent 58af91c41d
commit 680480fe67
2 changed files with 18 additions and 2 deletions

View File

@ -842,6 +842,7 @@ HINSTANCE gl_hOriginalDll = NULL;
HINSTANCE gl_hjgtDll = NULL; HINSTANCE gl_hjgtDll = NULL;
HINSTANCE gl_cgGLDll = NULL; HINSTANCE gl_cgGLDll = NULL;
HINSTANCE gl_hlibavs = NULL; HINSTANCE gl_hlibavs = NULL;
extern HINSTANCE ProcDLL;
int joystick_index1; int joystick_index1;
int joystick1Index = -1; int joystick1Index = -1;
int joystick_index2 = -1; int joystick_index2 = -1;
@ -2755,23 +2756,32 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
hlp.log("detaching from process:"); hlp.log("detaching from process:");
hlp.log((char*)processName.c_str()); hlp.log((char*)processName.c_str());
keepRunning = false; keepRunning = false;
if (gl_hOriginalDll) if (gl_hOriginalDll)
{ {
FreeLibrary(gl_hOriginalDll); FreeLibrary(gl_hOriginalDll);
} }
if (gl_hjgtDll) if (gl_hjgtDll)
{ {
FreeLibrary(gl_hjgtDll); FreeLibrary(gl_hjgtDll);
} }
if (gl_hlibavs) if (gl_hlibavs)
{ {
FreeLibrary(gl_hlibavs); FreeLibrary(gl_hlibavs);
} }
if (gl_cgGLDll) if (gl_cgGLDll)
{ {
FreeLibrary(gl_cgGLDll); FreeLibrary(gl_cgGLDll);
} }
if (ProcDLL)
{
FreeLibrary(ProcDLL);
}
if (GameController) if (GameController)
{ {
if (EnableRumble == 1) if (EnableRumble == 1)
@ -2782,7 +2792,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
if (GameController2) if (GameController2)
{ {
if (EnableRumble == 1) if (EnableRumbleDevice2 == 1)
{ {
SDL_JoystickRumble(GameController2, 0, 0, 0); SDL_JoystickRumble(GameController2, 0, 0, 0);
} }
@ -2801,6 +2811,12 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
SDL_HapticStopAll(haptic); SDL_HapticStopAll(haptic);
SDL_HapticClose(haptic); // release the haptic device / clean-up. SDL_HapticClose(haptic); // release the haptic device / clean-up.
} }
if (haptic2)
{
SDL_HapticStopEffect(haptic2, effects.effect_sine_id_device2);
}
break; break;
} }

View File

@ -23,6 +23,7 @@ extern int joystick_index2;
extern SDL_Joystick* GameController2; extern SDL_Joystick* GameController2;
extern SDL_Haptic* ControllerHaptic2; extern SDL_Haptic* ControllerHaptic2;
extern SDL_Haptic* haptic2; extern SDL_Haptic* haptic2;
HINSTANCE ProcDLL = NULL;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini"); static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename); static int configFeedbackLength = GetPrivateProfileInt(TEXT("Settings"), TEXT("FeedbackLength"), 120, settingsFilename);
@ -72,7 +73,6 @@ int __stdcall mame_output(const char* name, int value);
void CallTheOutputs() void CallTheOutputs()
{ {
HINSTANCE ProcDLL;
#ifdef _WIN64 #ifdef _WIN64
ProcDLL = LoadLibrary(TEXT("MAME64.dll")); ProcDLL = LoadLibrary(TEXT("MAME64.dll"));
#else #else