Clean up code
This commit is contained in:
parent
3439735a48
commit
13794ea7ac
1433
dist/gamecontrollerdb.txt
vendored
Normal file
1433
dist/gamecontrollerdb.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
10
dist/keyconfig.toml
vendored
10
dist/keyconfig.toml
vendored
@ -4,14 +4,14 @@ TEST = [ "F1" ]
|
||||
SERVICE = [ "F2" ]
|
||||
DEBUG_UP = [ "UPARROW" ]
|
||||
DEBUG_DOWN = [ "DOWNARROW" ]
|
||||
DEBUG_ENTER = [ "ENTER" ]
|
||||
DEBUG_ENTER = [ "ENTER", "SDL_LSHOULDER" ]
|
||||
|
||||
COIN_ADD = [ "ENTER", "SDL_START" ]
|
||||
|
||||
P1_LEFT_BLUE = [ "D" ]
|
||||
P1_LEFT_RED = [ "F" ]
|
||||
P1_RIGHT_RED = [ "J" ]
|
||||
P1_RIGHT_BLUE = [ "K" ]
|
||||
P1_LEFT_BLUE = [ "D", "SDL_LTRIGGER" ]
|
||||
P1_LEFT_RED = [ "F", "SDL_LSTICK_PRESS" ]
|
||||
P1_RIGHT_RED = [ "J", "SDL_RSTICK_PRESS" ]
|
||||
P1_RIGHT_BLUE = [ "K", "SDL_RTRIGGER" ]
|
||||
P2_LEFT_BLUE = [ ]
|
||||
P2_LEFT_RED = [ ]
|
||||
P2_RIGHT_RED = [ ]
|
||||
|
@ -6,49 +6,49 @@ HOOK_DYNAMIC (u32, __stdcall, XinputSetState, u32 index, void *state) { return E
|
||||
HOOK_DYNAMIC (u32, __stdcall, XinputGetCapabilites, u32 index, u32 flags, void *state) { return ERROR_DEVICE_NOT_CONNECTED; }
|
||||
|
||||
// bnusio stuff
|
||||
HOOK_DYNAMIC (i64, __stdcall, ClearSram) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, Close) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, Communication, i32 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, DecService, i32 a1, u16 a2) { return false; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetBuffer, u16 a1, i64 a2, i16 a3) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, GetCDOut, u8 a1) { return false; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetCoinError, i32 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, GetCoinLock, u8 a1) { return false; }
|
||||
HOOK_DYNAMIC (u64, __stdcall, GetEncoder) { return false; }
|
||||
HOOK_DYNAMIC (void *, __stdcall, GetExpansionMode) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, ClearSram) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, Close) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, Communication, i32 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, DecService, i32 a1, u16 a2) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetBuffer, u16 a1, i64 a2, i16 a3) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, GetCDOut, u8 a1) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetCoinError, i32 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, GetCoinLock, u8 a1) { return 0; }
|
||||
HOOK_DYNAMIC (u64, __stdcall, GetEncoder) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __stdcall, GetExpansionMode) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __stdcall, GetFirmwareVersion) { return (void *)(u16)126; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, GetGout, u8 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, GetHopOut, u8 a1) { return false; }
|
||||
HOOK_DYNAMIC (char *, __stdcall, GetIoBoardName) { return false; }
|
||||
HOOK_DYNAMIC (u16, __fastcall, GetRegisterU16, i16 a1) { return false; }
|
||||
HOOK_DYNAMIC (u8, __fastcall, GetRegisterU8, u16 a1) { return false; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetService, i32 a1) { return false; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetServiceError, i32 a1) { return false; }
|
||||
HOOK_DYNAMIC (u16, __fastcall, GetStatusU16, u16 a1) { return false; }
|
||||
HOOK_DYNAMIC (u8, __fastcall, GetStatusU8, u16 a1) { return false; }
|
||||
HOOK_DYNAMIC (u64, __stdcall, GetSwIn64) { return false; }
|
||||
HOOK_DYNAMIC (void *, __stdcall, GetSystemError) { return false; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, IsConnected) { return false; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, IsWideUsio) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, Open) { return false; }
|
||||
HOOK_DYNAMIC (i32, __stdcall, ResetIoBoard) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetBuffer, u16 a1, i32 a2, i16 a3) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetCDOut, u8 a1, u8 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetCoinLock, u8 a1, u8 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetExpansionMode, i16 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetGout, u8 a1, u8 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopOut, u8 a1, u8 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopperLimit, u16 a1, i16 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopperRequest, u16 a1, i16 a2) { return false; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, SetPLCounter, i16 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetRegisterU16, u16 a1, u16 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetRegisterU8, u16 a1, u8 a2) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetSystemError, i16 a1) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SramRead, i32 a1, u8 a2, i32 a3, u16 a4) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SramWrite, i32 a1, u8 a2, i32 a3, u16 a4) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, UsbFinderInitialize) { return false; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, UsbFinderRelease) { return false; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, UsbFinderGetSerialNumber, i32 a1, i64 a2) { return true; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, GetGout, u8 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, GetHopOut, u8 a1) { return 0; }
|
||||
HOOK_DYNAMIC (char *, __stdcall, GetIoBoardName) { return 0; }
|
||||
HOOK_DYNAMIC (u16, __fastcall, GetRegisterU16, i16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (u8, __fastcall, GetRegisterU8, u16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetService, i32 a1) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, GetServiceError, i32 a1) { return 0; }
|
||||
HOOK_DYNAMIC (u16, __fastcall, GetStatusU16, u16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (u8, __fastcall, GetStatusU8, u16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (u64, __stdcall, GetSwIn64) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __stdcall, GetSystemError) { return 0; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, IsConnected) { return 0; }
|
||||
HOOK_DYNAMIC (u8, __stdcall, IsWideUsio) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, Open) { return 0; }
|
||||
HOOK_DYNAMIC (i32, __stdcall, ResetIoBoard) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetBuffer, u16 a1, i32 a2, i16 a3) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetCDOut, u8 a1, u8 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetCoinLock, u8 a1, u8 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetExpansionMode, i16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetGout, u8 a1, u8 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopOut, u8 a1, u8 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopperLimit, u16 a1, i16 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetHopperRequest, u16 a1, i16 a2) { return 0; }
|
||||
HOOK_DYNAMIC (void *, __fastcall, SetPLCounter, i16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetRegisterU16, u16 a1, u16 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetRegisterU8, u16 a1, u8 a2) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SetSystemError, i16 a1) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SramRead, i32 a1, u8 a2, i32 a3, u16 a4) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, SramWrite, i32 a1, u8 a2, i32 a3, u16 a4) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, UsbFinderInitialize) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __stdcall, UsbFinderRelease) { return 0; }
|
||||
HOOK_DYNAMIC (i64, __fastcall, UsbFinderGetSerialNumber, i32 a1, i64 a2) { return 1; }
|
||||
|
||||
void
|
||||
init_boilerplate () {
|
||||
|
@ -18,8 +18,7 @@ enumWindows (HWND handle, LPARAM param) {
|
||||
// force show cursor
|
||||
HOOK_DYNAMIC (i32, __stdcall, ShowMouse, i32 show) { return originalShowMouse (true); }
|
||||
|
||||
#define DRUM_HIT 20000
|
||||
#define IF_HIT(bind) return IsButtonTapped (bind) ? DRUM_HIT : 0
|
||||
#define ON_HIT(bind) IsButtonTapped (bind) ? 0xFFFF : 0
|
||||
|
||||
struct Keybindings EXIT = { .keycodes = { VK_ESCAPE } };
|
||||
struct Keybindings COIN_ADD = { .keycodes = { VK_RETURN }, .buttons = { SDL_CONTROLLER_BUTTON_START } };
|
||||
@ -48,14 +47,14 @@ HOOK_DYNAMIC (i64, __fastcall, DecCoin, i32 a1, u16 a2) {
|
||||
|
||||
HOOK_DYNAMIC (u16, __fastcall, GetAnalogIn, u8 which) {
|
||||
switch (which) {
|
||||
case 0: IF_HIT (P1_LEFT_BLUE); // Player 1 Left Blue
|
||||
case 1: IF_HIT (P1_LEFT_RED); // Player 1 Left Red
|
||||
case 2: IF_HIT (P1_RIGHT_RED); // Player 1 Right Red
|
||||
case 3: IF_HIT (P1_RIGHT_BLUE); // Player 1 Right Blue
|
||||
case 4: IF_HIT (P2_LEFT_BLUE); // Player 2 Left Blue
|
||||
case 5: IF_HIT (P2_LEFT_RED); // Player 2 Left Red
|
||||
case 6: IF_HIT (P2_RIGHT_RED); // Player 2 Right Red
|
||||
case 7: IF_HIT (P2_RIGHT_BLUE); // Player 2 Right Blue
|
||||
case 0: return ON_HIT (P1_LEFT_BLUE); // Player 1 Left Blue
|
||||
case 1: return ON_HIT (P1_LEFT_RED); // Player 1 Left Red
|
||||
case 2: return ON_HIT (P1_RIGHT_RED); // Player 1 Right Red
|
||||
case 3: return ON_HIT (P1_RIGHT_BLUE); // Player 1 Right Blue
|
||||
case 4: return ON_HIT (P2_LEFT_BLUE); // Player 2 Left Blue
|
||||
case 5: return ON_HIT (P2_LEFT_RED); // Player 2 Left Red
|
||||
case 6: return ON_HIT (P2_RIGHT_RED); // Player 2 Right Red
|
||||
case 7: return ON_HIT (P2_RIGHT_BLUE); // Player 2 Right Blue
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
@ -123,7 +122,6 @@ HOOK (i32, __stdcall, CrtMain, 0x140666d2c, HINSTANCE hInstance, HINSTANCE hPrev
|
||||
WRITE_MEMORY (0x140692E17, u8, 0xEB); // Shared audio
|
||||
WRITE_MEMORY (0x140517339, u8, 0xBA, 0x00, 0x00, 0x00, 0x00,
|
||||
0x90); // Disable VSync
|
||||
// Blatantly stolen patches from openparrot
|
||||
// Save settings cross session
|
||||
WRITE_MEMORY (0x140B5C528, u8, "./Setting1.bin");
|
||||
WRITE_MEMORY (0x140B5C538, u8, "./Setting2.bin");
|
||||
|
@ -84,8 +84,10 @@ typedef uint64_t u64;
|
||||
|
||||
#define COUNTOFARR(arr) sizeof (arr) / sizeof (arr[0])
|
||||
|
||||
#define INFO_COLOUR FOREGROUND_GREEN
|
||||
#define WARNING_COLOUR (FOREGROUND_RED | FOREGROUND_GREEN)
|
||||
#define ERROR_COLOUR FOREGROUND_RED
|
||||
#define printInfo(format, ...) printColour (INFO_COLOUR, format, __VA_ARGS__)
|
||||
#define printWarning(format, ...) printColour (WARNING_COLOUR, format, __VA_ARGS__)
|
||||
#define printError(format, ...) printColour (ERROR_COLOUR, format, __VA_ARGS__)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user