1
0
mirror of synced 2025-02-17 10:58:36 +01:00

Fix various issues

MAME Changes and modify how games load
This commit is contained in:
Aaron M 2020-06-13 17:54:36 +12:00
parent 73c5919a1c
commit 389f8826b6
4 changed files with 1303 additions and 1258 deletions

View File

@ -82,8 +82,6 @@ static char* PatternScan(char* pattern, char* mask)
if (match != aAddy2) if (match != aAddy2)
{ {
delete[] buffer;
buffer = 0;
break; break;
} }
} }
@ -92,8 +90,11 @@ static char* PatternScan(char* pattern, char* mask)
currentChunk = currentChunk + mbi.RegionSize; currentChunk = currentChunk + mbi.RegionSize;
if (buffer) delete[] buffer; if (buffer)
buffer = 0; {
delete[] buffer;
buffer = 0;
}
} }
return match; return match;
} }

View File

@ -1238,16 +1238,6 @@ AlternativeMinForceRightIndy500=0
AlternativeMaxForceRightIndy500=100 AlternativeMaxForceRightIndy500=100
EnableForceSpringEffectIndy500=0 EnableForceSpringEffectIndy500=0
ForceSpringStrengthIndy500=80 ForceSpringStrengthIndy500=80
PowerModeSTCC=0
FeedbackLengthSTCC=500
MinForceSTCC=0
MaxForceSTCC=100
AlternativeMinForceLeftSTCC=0
AlternativeMaxForceLeftSTCC=-100
AlternativeMinForceRightSTCC=0
AlternativeMaxForceRightSTCC=100
EnableForceSpringEffectSTCC=0
ForceSpringStrengthSTCC=80
PowerModeSuperGT=0 PowerModeSuperGT=0
FeedbackLengthSuperGT=500 FeedbackLengthSuperGT=500
MinForceSuperGT=0 MinForceSuperGT=0
@ -1261,11 +1251,11 @@ ForceSpringStrengthSuperGT=80
PowerModeSuperChase=0 PowerModeSuperChase=0
FeedbackLengthSuperChase=500 FeedbackLengthSuperChase=500
MinForceSuperChase=0 MinForceSuperChase=0
MaxForceSuperChase=40 MaxForceSuperChase=80
AlternativeMinForceLeftSuperChase=0 AlternativeMinForceLeftSuperChase=0
AlternativeMaxForceLeftSuperChase=-40 AlternativeMaxForceLeftSuperChase=-80
AlternativeMinForceRightSuperChase=0 AlternativeMinForceRightSuperChase=0
AlternativeMaxForceRightSuperChase=40 AlternativeMaxForceRightSuperChase=80
EnableForceSpringEffectSuperChase=0 EnableForceSpringEffectSuperChase=0
ForceSpringStrengthSuperChase=80 ForceSpringStrengthSuperChase=80
PowerModeDirtDash=0 PowerModeDirtDash=0
@ -1304,6 +1294,7 @@ FFBDivideAceDriver=643
[MAME 64bit Outputs] [MAME 64bit Outputs]
GameId=22 GameId=22
ScanDelayTime=5
EnableForceSpringEffect=0 EnableForceSpringEffect=0
ForceSpringStrength=100 ForceSpringStrength=100
Device2GUID= Device2GUID=
@ -1691,16 +1682,6 @@ AlternativeMinForceRightIndy500=0
AlternativeMaxForceRightIndy500=100 AlternativeMaxForceRightIndy500=100
EnableForceSpringEffectIndy500=0 EnableForceSpringEffectIndy500=0
ForceSpringStrengthIndy500=80 ForceSpringStrengthIndy500=80
PowerModeSTCC=0
FeedbackLengthSTCC=500
MinForceSTCC=0
MaxForceSTCC=100
AlternativeMinForceLeftSTCC=0
AlternativeMaxForceLeftSTCC=-100
AlternativeMinForceRightSTCC=0
AlternativeMaxForceRightSTCC=100
EnableForceSpringEffectSTCC=0
ForceSpringStrengthSTCC=80
PowerModeSuperGT=0 PowerModeSuperGT=0
FeedbackLengthSuperGT=500 FeedbackLengthSuperGT=500
MinForceSuperGT=0 MinForceSuperGT=0
@ -1714,11 +1695,11 @@ ForceSpringStrengthSuperGT=80
PowerModeSuperChase=0 PowerModeSuperChase=0
FeedbackLengthSuperChase=500 FeedbackLengthSuperChase=500
MinForceSuperChase=0 MinForceSuperChase=0
MaxForceSuperChase=40 MaxForceSuperChase=80
AlternativeMinForceLeftSuperChase=0 AlternativeMinForceLeftSuperChase=0
AlternativeMaxForceLeftSuperChase=-40 AlternativeMaxForceLeftSuperChase=-80
AlternativeMinForceRightSuperChase=0 AlternativeMinForceRightSuperChase=0
AlternativeMaxForceRightSuperChase=40 AlternativeMaxForceRightSuperChase=80
EnableForceSpringEffectSuperChase=0 EnableForceSpringEffectSuperChase=0
ForceSpringStrengthSuperChase=80 ForceSpringStrengthSuperChase=80
PowerModeDirtDash=0 PowerModeDirtDash=0

View File

@ -848,6 +848,7 @@ SDL_Haptic* haptic3 = NULL;
EffectCollection effects; EffectCollection effects;
EffectConstants effectConst; EffectConstants effectConst;
Helpers hlp; Helpers hlp;
EffectTriggers t;
bool keepRunning = true; bool keepRunning = true;
float wheel = 0.0f; float wheel = 0.0f;
@ -981,8 +982,8 @@ HINSTANCE Get_hInstance()
void Initialize(int device_index) void Initialize(int device_index)
{ {
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC);
hlp.log("in initialize"); hlp.log("in initialize");
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC | SDL_INIT_TIMER);
SDL_JoystickEventState(SDL_ENABLE); SDL_JoystickEventState(SDL_ENABLE);
SDL_JoystickUpdate(); SDL_JoystickUpdate();
char joystick_guid[256]; char joystick_guid[256];
@ -1054,7 +1055,6 @@ void Initialize(int device_index)
hlp.log("setting haptic auto center to 0"); hlp.log("setting haptic auto center to 0");
SDL_HapticSetAutocenter(haptic, 0); // 0 disables autocenter https://wiki.libsdl.org/SDL_HapticSetAutocenter SDL_HapticSetAutocenter(haptic, 0); // 0 disables autocenter https://wiki.libsdl.org/SDL_HapticSetAutocenter
SDL_HapticEffect tempEffect; SDL_HapticEffect tempEffect;
hlp.log("creating base effects..."); hlp.log("creating base effects...");
@ -1148,7 +1148,6 @@ void Initialize(int device_index)
effects.effect_sine_id_device3 = SDL_HapticNewEffect(haptic3, &tempEffect3); effects.effect_sine_id_device3 = SDL_HapticNewEffect(haptic3, &tempEffect3);
} }
// TODO: why don't we just define this as hackFix = true in the other file? // TODO: why don't we just define this as hackFix = true in the other file?
// Was there a reason to put it here? // Was there a reason to put it here?
// extern bool hackFix; // extern bool hackFix;
@ -1914,43 +1913,9 @@ int WorkaroundToFixRumble(void* ptr)
return 0; return 0;
} }
DWORD WINAPI FFBLoop(LPVOID lpParam) DWORD WINAPI FFBLoop2(LPVOID lpParam)
{ {
hlp.log("In FFBLoop");
if ((configGameId != 29) && (configGameId != 34)) //For games which need code to run quicker etc. Some games will crash if no sleep added
{
Sleep(2500);
}
if (EnableRumble == 1)
{
if ((configGameId != 1) && (configGameId != 9) && (configGameId != 12) && (configGameId != 26) && (configGameId != 28) && (configGameId != 29) && (configGameId != 30) && (configGameId != 31) && (configGameId != 35))
{
// Workaround for SDL_JoystickRumble rumble not stopping issue
SDL_CreateThread(WorkaroundToFixRumble, "WorkaroundToFixRumble", (void*)NULL);
}
//SPECIAL K DISABLES RUMBLE BY DEFAULT. WRITE IT TO FALSE
char RumbleDisableChar[256];
GetPrivateProfileStringA("Input.Gamepad", "DisableRumble", "", RumbleDisableChar, 256, ".\\dxgi.ini");
std::string rumbletrue("true");
std::string rumbleTRUE("TRUE");
std::string rumbleTrue("True");
std::string rumdisable(RumbleDisableChar);
if ((rumdisable.compare(rumbletrue) == 0) || (rumdisable.compare(rumbleTrue) == 0) || (rumdisable.compare(rumbleTRUE) == 0))
{
WritePrivateProfileStringA("Input.Gamepad", "DisableRumble", "false", ".\\dxgi.ini");
}
}
SDL_HapticStopAll(haptic);
Initialize(0);
hlp.log("Initialize() complete");
// assign FFB effects here // assign FFB effects here
EffectTriggers t;
t.Constant = &TriggerConstantEffect; t.Constant = &TriggerConstantEffect;
t.Spring = &TriggerSpringEffect; t.Spring = &TriggerSpringEffect;
t.Friction = &TriggerFrictionEffect; t.Friction = &TriggerFrictionEffect;
@ -2144,6 +2109,44 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
return 0; return 0;
} }
DWORD WINAPI FFBLoop(LPVOID lpParam)
{
hlp.log("In FFBLoop");
if (EnableRumble == 1)
{
if ((configGameId != 1) && (configGameId != 9) && (configGameId != 12) && (configGameId != 26) && (configGameId != 28) && (configGameId != 29) && (configGameId != 30) && (configGameId != 31) && (configGameId != 35))
{
// Workaround for SDL_JoystickRumble rumble not stopping issue
SDL_CreateThread(WorkaroundToFixRumble, "WorkaroundToFixRumble", (void*)NULL);
}
//SPECIAL K DISABLES RUMBLE BY DEFAULT. WRITE IT TO FALSE
char RumbleDisableChar[256];
GetPrivateProfileStringA("Input.Gamepad", "DisableRumble", "", RumbleDisableChar, 256, ".\\dxgi.ini");
std::string rumbletrue("true");
std::string rumbleTRUE("TRUE");
std::string rumbleTrue("True");
std::string rumdisable(RumbleDisableChar);
if ((rumdisable.compare(rumbletrue) == 0) || (rumdisable.compare(rumbleTrue) == 0) || (rumdisable.compare(rumbleTRUE) == 0))
{
WritePrivateProfileStringA("Input.Gamepad", "DisableRumble", "false", ".\\dxgi.ini");
}
}
SDL_HapticStopAll(haptic);
CreateThread(NULL, 0, FFBLoop2, (LPVOID)&keepRunning, 0, NULL);
if (configGameId != 29) //For games which need code to run quicker etc. Some games will crash if no sleep added
{
Sleep(2500);
}
Initialize(0);
hlp.log("Initialize() complete");
return 0;
}
void CreateFFBLoopThread() void CreateFFBLoopThread()
{ {
hlp.log("Before CreateThread"); hlp.log("Before CreateThread");

File diff suppressed because it is too large Load Diff