Update Output code and some other changes
This commit is contained in:
parent
b85da55b25
commit
ff692251a5
@ -113,9 +113,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Game Files\HOTD4.cpp" />
|
||||
<ClCompile Include="Game Files\GRID.cpp" />
|
||||
<ClCompile Include="Game Files\OutputReading.cpp" />
|
||||
<ClCompile Include="Game Files\InitialD0.cpp" />
|
||||
<ClCompile Include="Game Files\OldMame.cpp" />
|
||||
<ClCompile Include="Game Files\OutputReading.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Game Files\Daytona3.h">
|
||||
@ -230,15 +230,15 @@
|
||||
<ClInclude Include="Game Files\GRID.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\OutputReading.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\InitialD0.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\OldMame.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Game Files\OutputReading.h">
|
||||
<Filter>Common Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="DLLWrapper.asm" />
|
||||
|
@ -2815,6 +2815,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ulReasonForCall, LPVOID lpReserved)
|
||||
if (haptic2)
|
||||
{
|
||||
SDL_HapticStopEffect(haptic2, effects.effect_sine_id_device2);
|
||||
SDL_HapticStopAll(haptic2);
|
||||
SDL_HapticClose(haptic2);
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -92,7 +92,7 @@ int nascar(int ffnas) {
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CALLBACK FindWindowBySubstr(HWND hwnd, LPARAM substring)
|
||||
static BOOL CALLBACK FindWindowBySubstr(HWND hwnd, LPARAM substring)
|
||||
{
|
||||
const DWORD TITLE_SIZE = 1024;
|
||||
TCHAR windowTitle[TITLE_SIZE];
|
||||
|
@ -17,6 +17,7 @@ along with FFB Arcade Plugin.If not, see < https://www.gnu.org/licenses/>.
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <tchar.h>
|
||||
#include "SDL.h"
|
||||
extern int joystick_index1;
|
||||
extern int joystick_index2;
|
||||
@ -36,10 +37,13 @@ static int EnableForceSpringEffect = GetPrivateProfileInt(TEXT("Settings"), TEXT
|
||||
static int ForceSpringStrength = GetPrivateProfileInt(TEXT("Settings"), TEXT("ForceSpringStrength"), 0, settingsFilename);
|
||||
|
||||
static bool init = false;
|
||||
static bool EmuName = false;
|
||||
static bool RomGameName = false;
|
||||
static bool MAEffect = false;
|
||||
static bool MBEffect = false;
|
||||
static bool DirtDevilSine = false;
|
||||
static bool ForceSpringEffect = false;
|
||||
static bool DontSineUntilRaceStart = false;
|
||||
|
||||
HINSTANCE hInstance;
|
||||
HINSTANCE hPrevInstance;
|
||||
@ -47,10 +51,103 @@ LPSTR lpCmdLine;
|
||||
int nCmdShow;
|
||||
|
||||
const char* nameFFB;
|
||||
const char* romFFB;
|
||||
const char* EmulatorName;
|
||||
char* name;
|
||||
char* romname;
|
||||
char* RunningFFB;
|
||||
char* Emulator;
|
||||
int newstateFFB;
|
||||
int stateFFB;
|
||||
int stateFFBDevice2;
|
||||
|
||||
//Supermodel Emulator Games
|
||||
std::string dayto2pe("dayto2pe");
|
||||
std::string daytona2("daytona2");
|
||||
std::string dirtdvlsa("dirtdvlsa");
|
||||
std::string ecau("ecau");
|
||||
std::string lemans24("lemans24");
|
||||
std::string scud("scud");
|
||||
std::string scuda("scuda");
|
||||
std::string scudj("scudj");
|
||||
std::string scudplus("scudplus");
|
||||
std::string scudplusa("scudplusa");
|
||||
std::string srally2("srally2");
|
||||
std::string srally2x("srally2x");
|
||||
|
||||
//MAME Games
|
||||
std::string vformula("vformula");
|
||||
std::string vr("vr");
|
||||
std::string sfrush("sfrush");
|
||||
std::string sfrushrk("sfrushrk");
|
||||
std::string sfrushrkwo("sfrushrkwo");
|
||||
std::string sfrusha("sfrusha");
|
||||
std::string crusnwld("crusnwld");
|
||||
std::string crusnwld24("crusnwld24");
|
||||
std::string crusnwld23("crusnwld23");
|
||||
std::string crusnwld20("crusnwld20");
|
||||
std::string crusnwld19("crusnwld19");
|
||||
std::string crusnwld17("crusnwld17");
|
||||
std::string crusnwld13("crusnwld13");
|
||||
std::string offroadc("offroadc");
|
||||
std::string offroadc4("offroadc4");
|
||||
std::string offroadc3("offroadc3");
|
||||
std::string offroadc1("offroadc1");
|
||||
std::string crusnusa("crusnusa");
|
||||
std::string crusnusa40("crusnusa40");
|
||||
std::string crusnusa21("crusnusa21");
|
||||
std::string calspeed("calspeed");
|
||||
std::string calspeeda("calspeeda");
|
||||
std::string calspeedb("calspeedb");
|
||||
std::string outrunra("outrunra");
|
||||
std::string outrun("outrun");
|
||||
std::string outruneh("outruneh");
|
||||
std::string toutrun("toutrun");
|
||||
std::string toutrund("toutrund");
|
||||
std::string toutrunj("toutrunj");
|
||||
std::string toutrunjd("toutrunjd");
|
||||
std::string pdrift("pdrift");
|
||||
std::string pdrifta("pdrifta");
|
||||
std::string pdrifte("pdrifte");
|
||||
std::string pdriftj("pdriftj");
|
||||
std::string pdriftl("pdriftl");
|
||||
std::string orunners("orunners");
|
||||
std::string orunnersu("orunnersu");
|
||||
std::string orunnersj("orunnersj");
|
||||
std::string sf2049("sf2049");
|
||||
std::string sf2049se("sf2049se");
|
||||
std::string sf2049te("sf2049te");
|
||||
std::string harddriv1("harddriv1");
|
||||
|
||||
//Our string to load game from
|
||||
std::string Daytona2Active("Daytona2Active");
|
||||
std::string DirtDevilsActive("DirtDevilsActive");
|
||||
std::string Srally2Active("Srally2Active");
|
||||
std::string VirtuaRacingActive("VirtuaRacingActive");
|
||||
std::string SanFranActive("SanFranActive");
|
||||
std::string CrusnWldActive("CrusnWldActive");
|
||||
std::string OffroadChallengeActive("OffroadChallengeActive");
|
||||
std::string CrusnUSAActive("CrusnUSAActive");
|
||||
std::string CalSpeedActive("CalSpeedActive");
|
||||
std::string OutrunActive("OutrunActive");
|
||||
std::string PowerDriftActive("PowerDriftActive");
|
||||
std::string OutrunnersActive("OutrunnersActive");
|
||||
std::string SanFran2049Active("SanFran2049Active");
|
||||
std::string HardDrivinActive("HardDrivinActive");
|
||||
|
||||
//Names of FFB Outputs
|
||||
std::string RawDrive("RawDrive");
|
||||
std::string digit0("digit0");
|
||||
std::string wheel("wheel");
|
||||
std::string Vibration_motor("Vibration_motor");
|
||||
std::string upright_wheel_motor("upright_wheel_motor");
|
||||
std::string MA_Steering_Wheel_motor("MA_Steering_Wheel_motor");
|
||||
std::string MB_Steering_Wheel_motor("MB_Steering_Wheel_motor");
|
||||
|
||||
//Emulator Name
|
||||
std::string MAME("MAME");
|
||||
std::string Supermodel("Supermodel");
|
||||
|
||||
typedef int(__stdcall* MAME_START)(int hWnd);
|
||||
typedef int(__stdcall* MAME_STOP)(void);
|
||||
typedef int(__stdcall* MAME_COPYDATA)(int id, const char* name);
|
||||
@ -137,6 +234,9 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
hWnd = CreateWindow(L"MAMEInterop", L"MAMEInterop", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 512, 512, NULL, NULL, hInstance, NULL);
|
||||
|
||||
if (hWnd == NULL)
|
||||
MessageBox(hWnd, L"Could not create window", L"Error", MB_OK | MB_ICONERROR);
|
||||
|
||||
hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
|
||||
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL,
|
||||
8, 8, 488, 464, hWnd, NULL, GetModuleHandle(NULL), NULL);
|
||||
@ -144,8 +244,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
||||
if (hEdit == NULL)
|
||||
MessageBox(hWnd, L"Could not create edit box.", L"Error", MB_OK | MB_ICONERROR);
|
||||
|
||||
if (hWnd != NULL)
|
||||
{
|
||||
//ShowWindow(hWnd, SW_SHOW);
|
||||
UpdateWindow(hWnd);
|
||||
}
|
||||
|
||||
mame_start_ptr = mame_start;
|
||||
mame_stop_ptr = mame_stop;
|
||||
@ -255,6 +358,11 @@ int __stdcall mame_copydata(int id, const char* name)
|
||||
|
||||
wsprintf(buf, L"id %d = '%S'\r\n", id, name);
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
romFFB = name;
|
||||
}
|
||||
|
||||
AppendTextToEditCtrl(hEdit, buf);
|
||||
|
||||
return 1;
|
||||
@ -288,6 +396,21 @@ int __stdcall mame_output(const char* name, int value)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK FindWindowBySubstr(HWND hwnd, LPARAM substring)
|
||||
{
|
||||
const DWORD TITLE_SIZE = 1024;
|
||||
TCHAR windowTitle[TITLE_SIZE];
|
||||
|
||||
if (GetWindowText(hwnd, windowTitle, TITLE_SIZE))
|
||||
{
|
||||
if (_tcsstr(windowTitle, LPCTSTR(substring)) != NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD WINAPI ThreadForOutputs(LPVOID lpParam)
|
||||
{
|
||||
WinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
|
||||
@ -774,7 +897,7 @@ static int sanfran(int ffsan) {
|
||||
}
|
||||
}
|
||||
|
||||
static int crusnwld(int ffcru) {
|
||||
static int crusnwldA(int ffcru) {
|
||||
switch (ffcru) {
|
||||
|
||||
case 0xFF:
|
||||
@ -1234,7 +1357,7 @@ static int crusnwld(int ffcru) {
|
||||
}
|
||||
}
|
||||
|
||||
static int crusnusa(int ffusa) {
|
||||
static int crusnusaA(int ffusa) {
|
||||
switch (ffusa) {
|
||||
|
||||
case 0xFF:
|
||||
@ -1672,14 +1795,6 @@ static int crusnusa(int ffusa) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string RawDrive("RawDrive");
|
||||
std::string digit0("digit0");
|
||||
std::string wheel("wheel");
|
||||
std::string Vibration_motor("Vibration_motor");
|
||||
std::string upright_wheel_motor("upright_wheel_motor");
|
||||
std::string MA_Steering_Wheel_motor("MA_Steering_Wheel_motor");
|
||||
std::string MB_Steering_Wheel_motor("MB_Steering_Wheel_motor");
|
||||
|
||||
void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, EffectTriggers* triggers) {
|
||||
|
||||
if (!init)
|
||||
@ -1738,63 +1853,6 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
SDL_HapticSetGain(haptic2, 100);
|
||||
}
|
||||
|
||||
char* name = new char[256];
|
||||
sprintf(name, "%s", nameFFB);
|
||||
|
||||
//Supermodel Emulator Games
|
||||
HWND hWnd1 = FindWindowA(0, ("Supermodel - Daytona USA 2 - Power Edition"));
|
||||
HWND hWnd2 = FindWindowA(0, ("Supermodel - Daytona USA 2 - Battle on the Edge"));
|
||||
HWND hWnd3 = FindWindowA(0, ("Supermodel - Scud Race"));
|
||||
HWND hWnd4 = FindWindowA(0, ("Supermodel - Scud Race Plus"));
|
||||
HWND hWnd5 = FindWindowA(0, ("Supermodel - Le Mans 24"));
|
||||
HWND hWnd6 = FindWindowA(0, ("Supermodel - Sega Rally 2"));
|
||||
HWND hWnd7 = FindWindowA(0, ("Supermodel - Dirt Devils"));
|
||||
HWND hWnd8 = FindWindowA(0, ("Supermodel - Emergency Call Ambulance"));
|
||||
|
||||
//MAME Games
|
||||
HWND hWnd9 = FindWindowA(0, ("MAME: Virtua Formula [vformula]"));
|
||||
HWND hWnd10 = FindWindowA(0, ("MAME: Virtua Racing [vr]"));
|
||||
HWND hWnd11 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.0) [sfrush]"));
|
||||
HWND hWnd12 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (boot rom L 1.0, GUTS Oct 6 1997 / MAIN Oct 16 1997) [sfrushrk]"));
|
||||
HWND hWnd13 = FindWindowA(0, ("MAME: San Francisco Rush: The Rock (Wavenet, boot rom L 1.38, GUTS Aug 6 1997 / MAIN Aug 5 1997) [sfrushrkwo]"));
|
||||
HWND hWnd14 = FindWindowA(0, ("MAME: San Francisco Rush (boot rom L 1.06A) [sfrusha]"));
|
||||
HWND hWnd15 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.5) [crusnwld]"));
|
||||
HWND hWnd16 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.4) [crusnwld24]"));
|
||||
HWND hWnd17 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.3) [crusnwld23]"));
|
||||
HWND hWnd18 = FindWindowA(0, ("MAME: Cruis'n World (rev L2.0) [crusnwld20]"));
|
||||
HWND hWnd19 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.9) [crusnwld19]"));
|
||||
HWND hWnd20 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.7) [crusnwld17]"));
|
||||
HWND hWnd21 = FindWindowA(0, ("MAME: Cruis'n World (rev L1.3) [crusnwld13]"));
|
||||
HWND hWnd22 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]"));
|
||||
HWND hWnd23 = FindWindowA(0, ("MAME: Off Road Challenge (v1.63) [offroadc]"));
|
||||
HWND hWnd24 = FindWindowA(0, ("MAME: Off Road Challenge (v1.40) [offroadc4]"));
|
||||
HWND hWnd25 = FindWindowA(0, ("MAME: Off Road Challenge (v1.30) [offroadc3]"));
|
||||
HWND hWnd26 = FindWindowA(0, ("MAME: Off Road Challenge (v1.10) [offroadc1]"));
|
||||
HWND hWnd27 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.1) [crusnusa]"));
|
||||
HWND hWnd28 = FindWindowA(0, ("MAME: Cruis'n USA (rev L4.0) [crusnusa40]"));
|
||||
HWND hWnd29 = FindWindowA(0, ("MAME: Cruis'n USA (rev L2.1) [crusnusa21]"));
|
||||
HWND hWnd30 = FindWindowA(0, ("MAME: California Speed (Version 2.1a Apr 17 1998, GUTS 1.25 Apr 17 1998 / MAIN Apr 17 1998) [calspeed]"));
|
||||
HWND hWnd31 = FindWindowA(0, ("MAME: California Speed (Version 1.0r8 Mar 10 1998, GUTS Mar 10 1998 / MAIN Mar 10 1998) [calspeeda]"));
|
||||
HWND hWnd32 = FindWindowA(0, ("MAME: California Speed (Version 1.0r7a Mar 4 1998, GUTS Mar 3 1998 / MAIN Jan 19 1998) [calspeedb]"));
|
||||
HWND hWnd33 = FindWindowA(0, ("MAME: Out Run (sitdown/upright, Rev A) [outrunra]"));
|
||||
HWND hWnd34 = FindWindowA(0, ("MAME: Out Run (sitdown/upright, Rev B) [outrun]"));
|
||||
HWND hWnd35 = FindWindowA(0, ("MAME: Out Run (sitdown/upright, Rev B) (Enhanced Edition v1.1.0) [outruneh]"));
|
||||
HWND hWnd36 = FindWindowA(0, ("MAME: Turbo Out Run (Out Run upgrade) (FD1094 317-0118) [toutrun]"));
|
||||
HWND hWnd37 = FindWindowA(0, ("MAME: Turbo Out Run (Out Run upgrade) (bootleg of FD1094 317-0118 set) [toutrund]"));
|
||||
HWND hWnd38 = FindWindowA(0, ("MAME: Turbo Out Run (Japan, Out Run upgrade) (FD1094 317-0117) [toutrunj]"));
|
||||
HWND hWnd39 = FindWindowA(0, ("MAME: Turbo Out Run (Japan, Out Run upgrade) (bootleg of FD1094 317-0117 set) [toutrunjd]"));
|
||||
HWND hWnd40 = FindWindowA(0, ("MAME: Power Drift (World, Rev A) [pdrift]"));
|
||||
HWND hWnd41 = FindWindowA(0, ("MAME: Power Drift (World) [pdrifta]"));
|
||||
HWND hWnd42 = FindWindowA(0, ("MAME: Power Drift (World, Earlier) [pdrifte]"));
|
||||
HWND hWnd43 = FindWindowA(0, ("MAME: Power Drift (Japan) [pdriftj]"));
|
||||
HWND hWnd44 = FindWindowA(0, ("MAME: Power Drift - Link Version (Japan, Rev A) [pdriftl]"));
|
||||
HWND hWnd45 = FindWindowA(0, ("MAME: OutRunners (World) [orunners]"));
|
||||
HWND hWnd46 = FindWindowA(0, ("MAME: OutRunners (US) [orunnersu]"));
|
||||
HWND hWnd47 = FindWindowA(0, ("MAME: OutRunners (Japan) [orunnersj]"));
|
||||
HWND hWnd48 = FindWindowA(0, ("MAME: San Francisco Rush 2049 [sf2049]"));
|
||||
HWND hWnd49 = FindWindowA(0, ("MAME: San Francisco Rush 2049: Special Edition [sf2049se]"));
|
||||
HWND hWnd50 = FindWindowA(0, ("MAME: San Francisco Rush 2049 : Tournament Edition[sf2049te]"));
|
||||
|
||||
if (EnableForceSpringEffect == 1)
|
||||
{
|
||||
if (ForceSpringEffect)
|
||||
@ -1803,10 +1861,134 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd1 > NULL) || (hWnd2 > NULL) || (hWnd3 > NULL) || (hWnd4 > NULL) || (hWnd5 > NULL)) //Daytona 2,Scud Race,Le Mans 24
|
||||
romname = new char[256]; //name of rom being played
|
||||
sprintf(romname, "%s", romFFB);
|
||||
|
||||
name = new char[256]; //name of FFB currently
|
||||
sprintf(name, "%s", nameFFB);
|
||||
|
||||
if (!RomGameName)
|
||||
{
|
||||
if (romname != NULL)
|
||||
{
|
||||
//Select code to run via rom name
|
||||
if (romname == dayto2pe || romname == daytona2 || romname == scud || romname == scuda || romname == scudj || romname == scudplus || romname == scudplusa)
|
||||
{
|
||||
RunningFFB = "Daytona2Active";
|
||||
}
|
||||
|
||||
if (romname == dirtdvlsa)
|
||||
{
|
||||
RunningFFB = "DirtDevilsActive";
|
||||
}
|
||||
|
||||
if (romname == srally2 || romname == srally2x || romname == ecau)
|
||||
{
|
||||
RunningFFB = "Srally2Active";
|
||||
}
|
||||
|
||||
if (romname == vr || romname == vformula)
|
||||
{
|
||||
RunningFFB = "VirtuaRacingActive";
|
||||
}
|
||||
|
||||
if (romname == sfrush || romname == sfrusha || romname == sfrushrk || romname == sfrushrkwo)
|
||||
{
|
||||
RunningFFB = "SanFranActive";
|
||||
}
|
||||
|
||||
if (romname == crusnwld || romname == crusnwld24 || romname == crusnwld23 || romname == crusnwld20 || romname == crusnwld19 || romname == crusnwld17 || romname == crusnwld13)
|
||||
{
|
||||
RunningFFB = "CrusnWldActive";
|
||||
}
|
||||
|
||||
if (romname == offroadc || romname == offroadc4 || romname == offroadc3 || romname == offroadc1)
|
||||
{
|
||||
RunningFFB = "OffroadChallengeActive";
|
||||
}
|
||||
|
||||
if (romname == crusnusa || romname == crusnusa40 || romname == crusnusa21)
|
||||
{
|
||||
RunningFFB = "CrusnUSAActive";
|
||||
}
|
||||
|
||||
if (romname == calspeed || romname == calspeeda || romname == calspeedb)
|
||||
{
|
||||
RunningFFB = "CalSpeedActive";
|
||||
}
|
||||
|
||||
if (romname == outrunra || romname == outrun || romname == outruneh || romname == toutrun || romname == toutrund || romname == toutrunj || romname == toutrunjd)
|
||||
{
|
||||
RunningFFB = "OutrunActive";
|
||||
}
|
||||
|
||||
if (romname == pdrift || romname == pdrifta || romname == pdrifte || romname == pdriftj || romname == pdriftl)
|
||||
{
|
||||
RunningFFB = "PowerDriftActive";
|
||||
}
|
||||
|
||||
if (romname == orunners || romname == orunnersu || romname == orunnersj)
|
||||
{
|
||||
RunningFFB = "OutrunnersActive";
|
||||
}
|
||||
|
||||
if (romname == sf2049 || romname == sf2049se || romname == sf2049te)
|
||||
{
|
||||
RunningFFB = "SanFran2049Active";
|
||||
}
|
||||
|
||||
if (romname == harddriv1)
|
||||
{
|
||||
RunningFFB = "HardDrivinActive";
|
||||
}
|
||||
|
||||
if ((RunningFFB != NULL) && (RunningFFB[0] != '\0'))
|
||||
{
|
||||
RomGameName = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!EmuName)
|
||||
{
|
||||
//Select code to run via emulator name using partial window title to avoid issues with FPS showing etc
|
||||
const TCHAR MAMEstring[] = TEXT("MAME");
|
||||
EnumWindows(FindWindowBySubstr, (LPARAM)MAMEstring);
|
||||
|
||||
const TCHAR Supermodelstring[] = TEXT("Supermodel");
|
||||
EnumWindows(FindWindowBySubstr, (LPARAM)Supermodelstring);
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)MAMEstring))
|
||||
{
|
||||
EmulatorName = "MAME";
|
||||
}
|
||||
|
||||
if (!EnumWindows(FindWindowBySubstr, (LPARAM)Supermodelstring))
|
||||
{
|
||||
EmulatorName = "Supermodel";
|
||||
}
|
||||
|
||||
Emulator = new char[256]; // Emulator name
|
||||
sprintf(Emulator, "%s", EmulatorName);
|
||||
|
||||
if ((EmulatorName != NULL) && (EmulatorName[0] != '\0'))
|
||||
{
|
||||
EmuName = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ((RunningFFB != NULL) && (RunningFFB[0] != '\0'))
|
||||
{
|
||||
if (RunningFFB == Daytona2Active) //Daytona 2,Scud Race,Le Mans 24
|
||||
{
|
||||
if (Emulator == Supermodel)
|
||||
{
|
||||
if (name == RawDrive)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -1875,11 +2057,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, 0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hWnd7 > NULL) //Dirt Devils
|
||||
if (RunningFFB == DirtDevilsActive) //Dirt Devils
|
||||
{
|
||||
if (Emulator == Supermodel)
|
||||
{
|
||||
if (name == RawDrive)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -1906,11 +2095,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Rumble(percentForce, percentForce, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd6 > NULL) || (hWnd8 > NULL)) //Sega Rally 2, Emergency Call Ambulance
|
||||
if (RunningFFB == Srally2Active) //Sega Rally 2, Emergency Call Ambulance
|
||||
{
|
||||
if (Emulator == Supermodel)
|
||||
{
|
||||
if (name == RawDrive)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -1929,13 +2125,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd9 > NULL) || (hWnd10 > NULL)) //Virtua Formula, Virtua Racing
|
||||
if (RunningFFB == VirtuaRacingActive) //Virtua Formula, Virtua Racing
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
static bool DontSineUntilRaceStart = false;
|
||||
|
||||
if (name == digit0)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2006,16 +2207,22 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd11 > NULL) || (hWnd12 > NULL) || (hWnd13 > NULL) || (hWnd14 > NULL)) //San Francisco Rush
|
||||
if (RunningFFB == SanFranActive) //San Francisco Rush
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
int ffsanfranrush = 0;
|
||||
ffsanfranrush = sanfran(stateFFB);
|
||||
int ffsanfranrush = sanfran(stateFFB);
|
||||
|
||||
if ((ffsanfranrush > 0x70) && (ffsanfranrush < 0xE9))
|
||||
{
|
||||
@ -2032,16 +2239,22 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd15 > NULL) || (hWnd16 > NULL) || (hWnd17 > NULL) || (hWnd18 > NULL) || (hWnd19 > NULL) || (hWnd20 > NULL) || (hWnd21 > NULL)) //Cruis'n USA
|
||||
if (RunningFFB == CrusnWldActive) //Cruis'n World
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
int ffcrusnwld = 0;
|
||||
ffcrusnwld = crusnwld(stateFFB);
|
||||
int ffcrusnwld = crusnwldA(stateFFB);
|
||||
|
||||
if ((ffcrusnwld > 110)& (ffcrusnwld < 226))
|
||||
{
|
||||
@ -2058,11 +2271,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd22 > NULL) || (hWnd23 > NULL) || (hWnd24 > NULL) || (hWnd25 > NULL) || (hWnd26 > NULL)) //Off Road Challenge
|
||||
if (RunningFFB == OffroadChallengeActive) //Off Road Challenge
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2081,16 +2301,22 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd27 > NULL) || (hWnd28 > NULL) || (hWnd29 > NULL)) //Crusn USA
|
||||
if (RunningFFB == CrusnUSAActive) //Crusn USA
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
int ffcrusnusa = 0;
|
||||
ffcrusnusa = crusnusa(stateFFB);
|
||||
int ffcrusnusa = crusnusaA(stateFFB);
|
||||
|
||||
if ((ffcrusnusa > 0x68) && (ffcrusnusa < 0xD7))
|
||||
{
|
||||
@ -2107,11 +2333,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_LEFT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd30 > NULL) || (hWnd31 > NULL) || (hWnd32 > NULL)) //California Speed
|
||||
if (RunningFFB == CalSpeedActive) //California Speed
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2130,11 +2363,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Constant(constants->DIRECTION_FROM_RIGHT, percentForce);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd33 > NULL) || (hWnd34 > NULL) || (hWnd35 > NULL) || (hWnd36 > NULL) || (hWnd37 > NULL) || (hWnd38 > NULL) || (hWnd39 > NULL)) //Outrun,Turbo Outrun
|
||||
if (RunningFFB == OutrunActive) //Outrun,Turbo Outrun
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == Vibration_motor)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2150,11 +2390,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Rumble(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd40 > NULL) || (hWnd41 > NULL) || (hWnd42 > NULL) || (hWnd43 > NULL) || (hWnd44 > NULL)) //Power Drift
|
||||
if (RunningFFB == PowerDriftActive) //Power Drift
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == upright_wheel_motor)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2170,12 +2417,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->Rumble(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd45 > NULL) || (hWnd46 > NULL) || (hWnd47 > NULL)) //OutRunners
|
||||
if (RunningFFB == OutrunnersActive) //OutRunners
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
|
||||
if (name == MA_Steering_Wheel_motor)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
else if (name == MB_Steering_Wheel_motor)
|
||||
@ -2227,11 +2480,18 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
triggers->RumbleDevice2(0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((hWnd48 > NULL) || (hWnd49 > NULL) || (hWnd50 > NULL)) //San Fran 2049
|
||||
if (RunningFFB == SanFran2049Active) //San Fran 2049
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
helpers->log("got value: ");
|
||||
std::string ffs = std::to_string(newstateFFB);
|
||||
helpers->log((char*)ffs.c_str());
|
||||
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
@ -2251,3 +2511,27 @@ void OutputReading::FFBLoop(EffectConstants* constants, Helpers* helpers, Effect
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (RunningFFB == HardDrivinActive) //Hard Drivin
|
||||
{
|
||||
if (Emulator == MAME)
|
||||
{
|
||||
if (name == wheel)
|
||||
{
|
||||
stateFFB = newstateFFB;
|
||||
}
|
||||
|
||||
if (stateFFB > 0)
|
||||
{
|
||||
if (stateFFB != 0xE0)
|
||||
{
|
||||
static char test[256];
|
||||
memset(test, 0, 256);
|
||||
sprintf(test, "hex print: %08X", stateFFB);
|
||||
OutputDebugStringA(test);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
***FFB Arcade Plugin***
|
||||
|
||||
Version 1.3
|
||||
Version 1.3a
|
||||
|
||||
Brought to you by Boomslangnz, Ducon2016, Spazzy & pinkimo.
|
||||
|
||||
@ -10,6 +10,23 @@ While best efforts were made to try to resemble the real arcade force feedback,
|
||||
in some cases eg Mario Kart GP DX, Pokken Tournament and Battle Gear 4,effects were created entirely from scratch
|
||||
so are not using real force feedback values. Most games use correct ffb values however :)
|
||||
|
||||
***1.3a Changes***
|
||||
|
||||
- Changed to Output Reading to use rom name rather then using game's window title (FFB wouldn't work if showing FPS via Supermodel etc)
|
||||
|
||||
- Added Partial window title reading for Emulator in action (If in the future we end up with a game on MAME + Supermodel using same rom name etc)
|
||||
|
||||
- Added logging values to all Output games (MAME & Supermodel)
|
||||
|
||||
- FreeLibrary on MAME32 & MAME64 which was missing previously
|
||||
|
||||
- Changed Forced Spring to occur after 2.5 seconds rather then after first FFB Value sent on Outputs
|
||||
|
||||
- Added error messagebox if hidden window isnt created correctly on Outputs
|
||||
|
||||
- Forgot to mention last release that on Virtua Racing, set cabinet to Upright to recieve FFB values
|
||||
|
||||
|
||||
***1.3 Changes***
|
||||
|
||||
- Added optional Spring Effect to Initial D Arcade Stage Zero
|
||||
|
Loading…
Reference in New Issue
Block a user