diff --git a/source-code/data/plugins/keyconfig.ini b/source-code/data/plugins/keyconfig.ini index 0e4051e..70fa507 100644 --- a/source-code/data/plugins/keyconfig.ini +++ b/source-code/data/plugins/keyconfig.ini @@ -43,6 +43,8 @@ MENU_L = Left, Up, Ds4_L1, XINPUT_LS, Ds4_DPad_Left, Ds4_DPad_Up, XINPUT_LEFT, X MENU_R = Right, Down, Ds4_R1, XINPUT_RS, Ds4_DPad_Right, Ds4_DPad_Down, XINPUT_RIGHT, XINPUT_DOWN, E, O, Ds4_L_Stick_Right, XINPUT_LRIGHT, Ds4_L_Stick_Down, XINPUT_LDOWN, Ds4_R_Stick_Right, XINPUT_RRIGHT, Ds4_R_Stick_Down, XINPUT_RDOWN MENU_CIRCLE = Spacebar +COIN = F10 + # Touch Slider: LEFT_SIDE_SLIDE_LEFT = Q, Ds4_L_Stick_Left, XINPUT_LLEFT LEFT_SIDE_SLIDE_RIGHT = E, Ds4_L_Stick_Right, XINPUT_LRIGHT diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp index a2f65c7..8ccc70d 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.cpp @@ -80,6 +80,8 @@ namespace TLAC::Components MenuCircleBinding = new Binding(); + CoinBinding = new Binding(); + FileSystem::ConfigFile configFile(framework::GetModuleDirectory(), KEY_CONFIG_FILE_NAME); configFile.OpenRead(); @@ -97,6 +99,7 @@ namespace TLAC::Components Config::BindConfigKeys(configFile.ConfigMap, "MENU_L", *MenuLBinding, { "Left", "Up" }); Config::BindConfigKeys(configFile.ConfigMap, "MENU_R", *MenuRBinding, { "Down", "Right" }); Config::BindConfigKeys(configFile.ConfigMap, "MENU_CIRCLE", *MenuCircleBinding, { "D", "L", "Spacebar" }); + Config::BindConfigKeys(configFile.ConfigMap, "COIN", *CoinBinding, { "F10" }); mouseScrollPvSelection = configFile.GetBooleanValue("mouse_scroll_pv_selection"); } @@ -295,6 +298,9 @@ namespace TLAC::Components if (buttonTestFunc(RightBinding)) buttons |= JVS_R; + if (buttonTestFunc(CoinBinding)) + addCoin(); + return buttons; } @@ -398,7 +404,7 @@ namespace TLAC::Components void InputEmulator::SetMetaButtons() { // bit 0x6e is used to skip a bunch of screens - if ((inputState->Down.Buttons & (JVS_L | JVS_R)) == 0) // ask sega okay? idk why this is needed + if ((inputState->Down.Buttons & (JVS_L | JVS_R)) == 0) // ask sega, okay? idk why this is needed { if ((inputState->Tapped.Buttons & (JVS_START | JVS_TRIANGLE | JVS_SQUARE | JVS_CROSS | JVS_CIRCLE)) != 0) inputState->SetBit(0x6e, true, InputBufferType_Tapped); @@ -416,4 +422,17 @@ namespace TLAC::Components inputState->SetBit(0x6e, false, InputBufferType_Released); } } + + void InputEmulator::addCoin() + { + printf("[TLAC] Adding coin\n"); + unsigned char* credits = (unsigned char*)0x14CD93788; + if (*credits < 9) + { + *(unsigned char*)0x14CD93A9C = 1; + (*credits)++; + (*(unsigned char*)0x14CD93A98)++; + if ((*(unsigned char*)0x14CD93A98) == 0) (*(unsigned char*)0x14CD93A98)++; + } + } } \ No newline at end of file diff --git a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h index b127a5b..c0ff2f9 100644 --- a/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h +++ b/source-code/source/plugins/TLAC/Components/Input/InputEmulator.h @@ -38,6 +38,8 @@ namespace TLAC::Components Input::Binding* MenuRBinding; Input::Binding* MenuCircleBinding; + Input::Binding* CoinBinding; + InputEmulator(); ~InputEmulator(); @@ -106,5 +108,7 @@ namespace TLAC::Components void UpdateInputBit(uint32_t bit, uint8_t keycode); void UpdateSliderLR(); void SetMetaButtons(); + + void addCoin(); }; }