1
0
mirror of synced 2024-11-23 22:40:57 +01:00

add ID Zero 2.30 and Flycast Dojo

This commit is contained in:
Boomslangnz 2022-09-17 20:24:36 +12:00
parent 9829739564
commit 1d00463ca8
7 changed files with 220 additions and 1 deletions

View File

@ -339,6 +339,18 @@ EnableDamper=0
DamperStrength=100
EnableOutputs=0
[Initial D Zero v230]
GameId=67
FeedbackLength=80
PowerMode=0
IDZMode=0
EnableForceSpringEffect=0
ForceSpringStrength=70
EscapeKeyExitViaPlugin=0
EnableDamper=0
DamperStrength=100
EnableOutputs=0
[Initial D 4]
GameId=16
FeedbackLength=5000

View File

@ -39,6 +39,7 @@
<ClInclude Include="Game Files\HOTD4.h" />
<ClInclude Include="Game Files\InitialD0v131.h" />
<ClInclude Include="Game Files\InitialD0v211.h" />
<ClInclude Include="Game Files\InitialD0v230.h" />
<ClInclude Include="Game Files\KODrive.h" />
<ClInclude Include="Game Files\MAMESupermodel.h" />
<ClInclude Include="Game Files\MarioKartGPDXUSA.h" />
@ -97,6 +98,7 @@
<ClCompile Include="Game Files\InitialD0v131.cpp" />
<ClCompile Include="Game Files\DemulInitialDInputs.cpp" />
<ClCompile Include="Game Files\InitialD0v211.cpp" />
<ClCompile Include="Game Files\InitialD0v230.cpp" />
<ClCompile Include="Game Files\KODrive.cpp" />
<ClCompile Include="Game Files\M2EmulatorDaytonaInputs.cpp" />
<ClCompile Include="Game Files\M2EmulatorIndy500Inputs.cpp" />

View File

@ -152,6 +152,7 @@
<ClCompile Include="Game Files\GaelcoTuningRace.cpp" />
<ClCompile Include="Game Files\TokyoCop.cpp" />
<ClCompile Include="Game Files\RingRiders.cpp" />
<ClCompile Include="Game Files\InitialD0v230.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="Game Files\Daytona3.h">
@ -368,6 +369,9 @@
<ClInclude Include="Game Files\RingRiders.h">
<Filter>Common Header Files</Filter>
</ClInclude>
<ClInclude Include="Game Files\InitialD0v230.h">
<Filter>Common Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<MASM Include="DLLWrapper.asm" />

View File

@ -50,6 +50,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
#include "Game Files/GoldenGun.h"
#include "Game Files/InitialD0v131.h"
#include "Game Files/InitialD0v211.h"
#include "Game Files/InitialD0v230.h"
#include "Game Files/InitialD4.h"
#include "Game Files/InitialD4Japan.h"
#include "Game Files/InitialD5.h"
@ -1040,6 +1041,7 @@ const int DEAD_HEAT_RIDERS = 63;
const int GAELCO_TUNING_RACE = 64;
const int TOKYO_COP = 65;
const int RING_RIDERS = 66;
const int INITIAL_D_0_230 = 67;
HINSTANCE Get_hInstance()
{
@ -2369,6 +2371,9 @@ DWORD WINAPI FFBLoop(LPVOID lpParam)
case INITIAL_D_0_211:
game = new InitialD0v211;
break;
case INITIAL_D_0_230:
game = new InitialD0v230;
break;
case INITIAL_D_4:
game = new InitialD4;
break;

View File

@ -53,10 +53,14 @@ void Flycast::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTrigge
if (!FFBGameInit)
{
HWND hwnd = FindWindowA(0, "Flycast");
HWND hwnddojo = FindWindowA(0, "Flycast Dojo");
if (pOrigProc == NULL)
if (pOrigProc == NULL && hwnd)
pOrigProc = (WNDPROC)::SetWindowLongPtr((HWND)hwnd, GWLP_WNDPROC, (LONG_PTR)HookWndProc);
if (pOrigProc == NULL && hwnddojo)
pOrigProc = (WNDPROC)::SetWindowLongPtr((HWND)hwnddojo, GWLP_WNDPROC, (LONG_PTR)HookWndProc);
if (LetsStartFFB)
{
Sleep(15000);

View File

@ -0,0 +1,172 @@
/*This file is part of FFB Arcade Plugin.
FFB Arcade Plugin is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FFB Arcade Plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
*/
#include <string>
#include "InitialD0v230.h"
#include "math.h"
static UINT8 ff;
static UINT8 oldff;
static UINT8 newff;
static UINT8 ff1;
static UINT8 ff2;
static UINT8 ff3;
extern int EnableDamper;
extern int DamperStrength;
static bool outputinit = false;
static wchar_t* settingsFilename = TEXT(".\\FFBPlugin.ini");
static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableForceSpringEffect"), 0, settingsFilename);
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
static int EscapeKeyExitViaPlugin = GetPrivateProfileInt(TEXT("Settings"), TEXT("EscapeKeyExitViaPlugin"), 0, settingsFilename);
static int IDZMode = GetPrivateProfileInt(TEXT("Settings"), TEXT("IDZMode"), 0, settingsFilename);
static int EnableOutputs = GetPrivateProfileInt(TEXT("Settings"), TEXT("EnableOutputs"), 0, settingsFilename);
void InitialD0v230::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
if (!outputinit)
{
if (EnableOutputs == 1)
{
outputinit = true;
LoadLibraryA("OutputBlaster.dll");
}
}
if (GetAsyncKeyState((VK_ESCAPE)) && (EscapeKeyExitViaPlugin == 1))
{
ExitProcess(0);
}
if (EnableDamper == 1)
{
triggers->Damper(DamperStrength / 100.0);
}
if (IDZMode == 0)
{
ff = helpers->ReadByte(0x18A720F, true);
oldff = 0;
newff = ff;
helpers->log("got value: ");
std::string ffs = std::to_string(ff);
helpers->log((char*)ffs.c_str());
if (EnableForceSpringEffect == 1)
{
triggers->Springi(ForceSpringStrength / 100.0);
}
if (oldff != newff)
{
if ((ff > 0x37) && (ff < 0x80))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff > 0x00) && (ff < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff) / 72.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
oldff = newff;
}
else
{
ff1 = helpers->ReadByte(0x18B54DC, true);
ff2 = helpers->ReadByte(0x18B54DD, true);
if (IDZMode == 1)
{
ff3 = helpers->ReadByte(0x18B54DE, true);
}
else if (IDZMode == 2)
{
ff3 = helpers->ReadByte(0x18B54DF, true);
}
if (ff1 == 80)
{
helpers->log("Spring");
triggers->Spring(1.0);
}
else if (ff1 == 0x85)
{
if ((ff2 > 0x00) && (ff2 < 0x30))
{
helpers->log("Sine");
double percentForce = ff2 / 47.0;
double percentLength = 100;
triggers->Rumble(percentForce, percentForce, percentLength);
triggers->Sine(40, 0, percentForce);
}
}
else if (ff1 == 0x86)
{
if ((ff3 > 0x00) && (ff3 < 0x4E))
{
helpers->log("Spring");
double percentForce = ff3 / 77.0;
double percentLength = 100;
triggers->Spring(percentForce);
}
}
else if (ff1 == 0x84)
{
if ((ff2 == 0x00) && (ff3 > 0x37) && (ff3 < 0x80))
{
helpers->log("moving wheel right");
double percentForce = (128 - ff3) / 72.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x00) && (ff3 < 0x49))
{
helpers->log("moving wheel left");
double percentForce = (ff3 / 72.0);
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
else
{
if ((ff2 == 0x00) && (ff3 > 0x00) && (ff3 < 0x38))
{
helpers->log("moving wheel right");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(percentForce, 0, percentLength);
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
}
else if ((ff2 == 0x01) && (ff3 > 0x48))
{
helpers->log("moving wheel left");
double percentForce = 1.0;
double percentLength = 100;
triggers->Rumble(0, percentForce, percentLength);
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
}
}
}
}
}

View File

@ -0,0 +1,20 @@
/*This file is part of FFB Arcade Plugin.
FFB Arcade Plugin is free software : you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FFB Arcade Plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
*/
#pragma once
#include "../Common Files/Game.h"
class InitialD0v230 : public Game {
public:
void FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers);
};