1
0
mirror of synced 2025-01-31 11:53:54 +01:00

SR1 and SR2 changes

This commit is contained in:
Boomslangnz 2022-03-23 17:01:01 +13:00
parent 3a85fffdf3
commit b276ca9625
4 changed files with 42 additions and 18 deletions

View File

@ -31,6 +31,21 @@ void Helpers::logInit(char *msg) {
ofs.close();
}
void Helpers::info(const char* format, ...)
{
va_list args;
char buffer[1024];
va_start(args, format);
int len = _vsnprintf(buffer, sizeof(buffer), format, args);
va_end(args);
buffer[len] = '\n';
buffer[len + 1] = '\0';
OutputDebugStringA(buffer);
}
// reading memory
LPVOID Helpers::GetTranslatedOffset(INT_PTR offset)
{

View File

@ -99,6 +99,7 @@ public:
void log(char *msg);
void logInt(int value);
void logInit(char *msg);
void info(const char* format, ...);
// reading memory
LPVOID GetTranslatedOffset(INT_PTR offset);
int ReadInt32(INT_PTR offset, bool isRelativeOffset);

View File

@ -65,6 +65,7 @@ extern int DamperStrength;
static DWORD hookAddressM2A;
static DWORD hookAddressM2B;
static DWORD hookAddressM2C;
static UINT8 OldFFB;
static int InputDeviceWheelEnable = GetPrivateProfileInt(TEXT("Settings"), TEXT("InputDeviceWheelEnable"), 0, settingsFilename);
static int DaytonaAIMultiplayerHack = GetPrivateProfileInt(TEXT("Settings"), TEXT("DaytonaAIMultiplayerHack"), 0, settingsFilename);
@ -523,22 +524,29 @@ void M2Emulator::FFBLoop(EffectConstants * constants, Helpers * helpers, EffectT
helpers->log((char*)ffs.c_str());
helpers->log("got value: ");
if ((ff1 > 0xBF) && (ff1 < 0xDF))
if (OldFFB != ff1)
{
helpers->log("moving wheel left");
double percentForce = (ff1 - 191) / 31.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if ((ff1 > 0x7F) && (ff1 < 0x9F))
{
helpers->log("moving wheel right");
double percentForce = (ff1 - 127) / 31.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
if (ff1 >= 0xC0 && ff1 <= 0xDF)
{
helpers->log("moving wheel left");
double percentForce = (ff1 - 191) / 32.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
if (ff1 >= 0x80 && ff1 <= 0x9F)
{
helpers->log("moving wheel right");
double percentForce = (ff1 - 127) / 32.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
}
OldFFB = ff1;
}
if ((hWnd2 > NULL) || (hWnd7 > NULL) || (hWnd8 > NULL) || (hWnd9 > NULL) || (hWnd10 > NULL) || (hWnd11 > NULL) || (hWnd12 > NULL) || (hWnd13 > NULL))

View File

@ -2808,16 +2808,16 @@ void MAMESupermodel::FFBLoop(EffectConstants* constants, Helpers* helpers, Effec
stateFFB = newstateFFB;
}
if ((stateFFB > 0x00) && (stateFFB < 0x30))
if (stateFFB > 0x00 && stateFFB <= 0x3F)
{
double percentForce = (stateFFB) / 41.0;
double percentForce = (stateFFB) / 64.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else if ((stateFFB > 0x3F) && (stateFFB < 0x70))
else if (stateFFB > 0x3F && stateFFB <= 0x7F)
{
double percentForce = (stateFFB - 64) / 41.0;
double percentForce = (stateFFB - 64) / 64.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);