Skip to content

Commit

Permalink
Merge pull request #333 from happyhavoc/update-mapping
Browse files Browse the repository at this point in the history
Update mapping from ghidra
  • Loading branch information
roblabla authored Dec 1, 2024
2 parents 4306106 + a0ac5cf commit 54d0ded
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions config/implemented.csv
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ th06::Controller::SetButtonFromDirectInputJoystate
th06::Controller::GetControllerInput
th06::Controller::GetInput
th06::Controller::ResetKeyboard
th06::Controller::ControllerCallback
th06::Controller::EnumGameControllersCb
th06::Supervisor::ControllerCallback
th06::Supervisor::EnumGameControllersCb
th06::EclManager::CallEclSub
th06::EclManager::Load
th06::EclManager::RunEcl
Expand Down Expand Up @@ -249,7 +249,7 @@ th06::MainMenu::WeirdSecondInputCheck
th06::MainMenu::OnUpdateOptionsMenu
th06::MainMenu::ColorMenuItem
th06::MainMenu::LoadReplayMenu
th06::MainMenu::SelectRelated
th06::MainMenu::SwapMapping
th06::MidiDevice::MidiDevice
th06::MidiDevice::Close
th06::MidiDevice::OpenDevice
Expand Down
8 changes: 4 additions & 4 deletions config/mapping.csv
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,11 @@ th06::MidiOutput::FadeOutSetVolume,0x423260,0xce,__thiscall,,void,MidiOutput*,i3
th06::AnmManager::~AnmManager,0x423330,0xb,__thiscall,,void,AnmManager*
th06::Supervisor::OnUpdate,0x42333b,0x44a,__stdcall,,ChainCallbackResult,Supervisor*
th06::Supervisor::OnDraw,0x423785,0x7c,__stdcall,,ChainCallbackResult,Supervisor*
th06::Controller::ControllerCallback,0x423801,0x6a,__stdcall,,u8,DIDEVICEOBJECTINSTANCEA*
th06::Supervisor::ControllerCallback,0x423801,0x6a,__stdcall,,u8,DIDEVICEOBJECTINSTANCEA*
th06::Supervisor::RegisterChain,0x42386b,0x9f,__stdcall,,ZunResult
th06::Supervisor::AddedCallback,0x42390a,0x20a,__stdcall,,ZunResult,Supervisor*
th06::Supervisor::SetupDInput,0x423b14,0x28c,__stdcall,,ZunResult,Supervisor*
th06::Controller::EnumGameControllersCb,0x423da0,0x3f,__stdcall,,u32,i32
th06::Supervisor::EnumGameControllersCb,0x423da0,0x3f,__stdcall,,u32,i32
th06::Supervisor::DeletedCallback,0x423ddf,0x160,default,,ZunResult,Supervisor*
th06::Supervisor::DrawFpsCounter,0x423f3f,0x1b1,__stdcall,,void
th06::AnmManager::ReleaseVertexBuffer,0x4240f0,0x37,__thiscall,,void,AnmManager*
Expand All @@ -301,7 +301,7 @@ th06::MusicRoom::OnDraw,0x42545a,0x1f2,__cdecl,,ChainCallbackResult,MusicRoom*
th06::MusicRoom::AddedCallback,0x42564c,0x74b,__cdecl,,ZunResult,MusicRoom*
th06::MusicRoom::DeletedCallback,0x425d97,0x6c,__cdecl,,ZunResult,MusicRoom*
th06::Player::Player,0x425e10,0x1e8,__thiscall,,Player*,Player*
th06::PlayerInner::PlayerInner,0x426000,0xc2,__thiscall,,PlayerBombInfo*,PlayerInner*
th06::PlayerBombInfo::PlayerBombInfo,0x426000,0xc2,__thiscall,,PlayerBombInfo*,PlayerBombInfo*
th06::Player::FireBulletReimuA,0x4260d0,0x22,default,,FireBulletResult,Player*,PlayerBullet*,u32,u32
th06::Player::FireSingleBullet,0x426100,0x31b,default,,FireBulletResult,Player*,PlayerBullet*,i32,i32,CharacterPowerData*
th06::Player::FireBulletReimuB,0x426420,0x22,default,,FireBulletResult,Player*,PlayerBullet*,u32,u32
Expand Down Expand Up @@ -421,7 +421,7 @@ th06::AnmManager::TakeScreenshot,0x435670,0xed,__thiscall,,void,AnmManager*,i32,
th06::MainMenu::MainMenu,0x43575d,0x42,__thiscall,,void,MainMenu*
th06::MainMenu::OnUpdate,0x43579f,0x1d31,__stdcall,,ChainCallbackResult,MainMenu*
th06::MainMenu::MoveCursor,0x43753c,0x136,default,,i32,MainMenu*,i32
th06::MainMenu::SelectRelated,0x437672,0x131,default,,void,MainMenu*,u16,u16,i32
th06::MainMenu::SwapMapping,0x437672,0x131,default,,void,MainMenu*,u16,u16,i32
th06::MainMenu::DrawMenuItem,0x4377a3,0xff,__stdcall,,void,AnmVm*,i32,i32,unsigned long,unsigned long,i32
th06::MainMenu::BeginStartup,0x4378a2,0x142,__thiscall,,ZunResult,MainMenu*
th06::MainMenu::WeirdSecondInputCheck,0x4379e4,0x15d,__thiscall,,i32,MainMenu*
Expand Down
20 changes: 10 additions & 10 deletions src/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,39 +205,39 @@ ChainCallbackResult MainMenu::OnUpdate(MainMenu *menu)
switch (menu->cursor)
{
case 0:
SelectRelated(menu, sVar1, menu->controlMapping[0], 1);
SwapMapping(menu, sVar1, menu->controlMapping[0], 1);
menu->controlMapping[0] = sVar1;
break;
case 1:
SelectRelated(menu, sVar1, menu->controlMapping[1], 0);
SwapMapping(menu, sVar1, menu->controlMapping[1], 0);
menu->controlMapping[1] = sVar1;
break;
case 2:
SelectRelated(menu, sVar1, menu->controlMapping[2], 1);
SwapMapping(menu, sVar1, menu->controlMapping[2], 1);
menu->controlMapping[2] = sVar1;
break;
case 3:
SelectRelated(menu, sVar1, menu->controlMapping[3], 0);
SwapMapping(menu, sVar1, menu->controlMapping[3], 0);
menu->controlMapping[3] = sVar1;
break;
case 4:
SelectRelated(menu, sVar1, menu->controlMapping[4], 0);
SwapMapping(menu, sVar1, menu->controlMapping[4], 0);
menu->controlMapping[4] = sVar1;
break;
case 5:
SelectRelated(menu, sVar1, menu->controlMapping[5], 0);
SwapMapping(menu, sVar1, menu->controlMapping[5], 0);
menu->controlMapping[5] = sVar1;
break;
case 6:
SelectRelated(menu, sVar1, menu->controlMapping[6], 0);
SwapMapping(menu, sVar1, menu->controlMapping[6], 0);
menu->controlMapping[6] = sVar1;
break;
case 7:
SelectRelated(menu, sVar1, menu->controlMapping[7], 0);
SwapMapping(menu, sVar1, menu->controlMapping[7], 0);
menu->controlMapping[7] = sVar1;
break;
case 8:
SelectRelated(menu, sVar1, menu->controlMapping[8], 0);
SwapMapping(menu, sVar1, menu->controlMapping[8], 0);
menu->controlMapping[8] = sVar1;
}
}
Expand Down Expand Up @@ -925,7 +925,7 @@ CursorMovement MainMenu::MoveCursor(MainMenu *menu, i32 menuLength)
#pragma optimize("", on)

#pragma optimize("s", on)
void MainMenu::SelectRelated(MainMenu *menu, i16 btnPressed, i16 oldMapping, ZunBool unk)
void MainMenu::SwapMapping(MainMenu *menu, i16 btnPressed, i16 oldMapping, ZunBool unk)
{
if (unk == 0 && menu->controlMapping[0] == btnPressed)
{
Expand Down
2 changes: 1 addition & 1 deletion src/MainMenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ struct MainMenu
static CursorMovement MoveCursor(MainMenu *menu, i32 menuLength);
static void DrawMenuItem(AnmVm *vm, i32 itemNumber, i32 cursor, D3DCOLOR activeItemColor,
D3DCOLOR inactiveItemColor, i32 spriteIdx /* I think*/);
static void SelectRelated(MainMenu *menu, i16 btnPressed, i16 oldMapping, ZunBool unk);
static void SwapMapping(MainMenu *menu, i16 btnPressed, i16 oldMapping, ZunBool unk);

i32 ReplayHandling();
static ZunResult LoadReplayMenu(MainMenu *menu);
Expand Down
8 changes: 4 additions & 4 deletions src/Supervisor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ ZunResult Supervisor::SetupDInput(Supervisor *supervisor)
supervisor->keyboard->Acquire();
GameErrorContext::Log(&g_GameErrorContext, TH_ERR_DIRECTINPUT_INITIALIZED);

supervisor->dinputIface->EnumDevices(DI8DEVCLASS_GAMECTRL, Controller::EnumGameControllersCb, NULL,
supervisor->dinputIface->EnumDevices(DI8DEVCLASS_GAMECTRL, Supervisor::EnumGameControllersCb, NULL,
DIEDFL_ATTACHEDONLY);
if (supervisor->controller)
{
Expand All @@ -708,7 +708,7 @@ ZunResult Supervisor::SetupDInput(Supervisor *supervisor)
g_Supervisor.controllerCaps.dwSize = sizeof(g_Supervisor.controllerCaps);

supervisor->controller->GetCapabilities(&g_Supervisor.controllerCaps);
supervisor->controller->EnumObjects(Controller::ControllerCallback, NULL, DIDFT_ALL);
supervisor->controller->EnumObjects(Supervisor::ControllerCallback, NULL, DIDFT_ALL);

GameErrorContext::Log(&g_GameErrorContext, TH_ERR_PAD_FOUND);
}
Expand Down Expand Up @@ -1047,7 +1047,7 @@ u16 Controller::GetInput(void)

#pragma optimize("s", on)
#pragma var_order(diprange, pvRefBackup)
BOOL CALLBACK Controller::ControllerCallback(LPCDIDEVICEOBJECTINSTANCEA lpddoi, LPVOID pvRef)
BOOL CALLBACK Supervisor::ControllerCallback(LPCDIDEVICEOBJECTINSTANCEA lpddoi, LPVOID pvRef)
{
LPVOID pvRefBackup;
DIPROPRANGE diprange;
Expand All @@ -1072,7 +1072,7 @@ BOOL CALLBACK Controller::ControllerCallback(LPCDIDEVICEOBJECTINSTANCEA lpddoi,
#pragma optimize("", on)

#pragma optimize("s", on)
BOOL CALLBACK Controller::EnumGameControllersCb(LPCDIDEVICEINSTANCEA pdidInstance, LPVOID pContext)
BOOL CALLBACK Supervisor::EnumGameControllersCb(LPCDIDEVICEINSTANCEA pdidInstance, LPVOID pContext)
{
HRESULT result;

Expand Down
4 changes: 2 additions & 2 deletions src/Supervisor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ struct Supervisor
ZunResult FadeOutMusic(f32 fadeOutSeconds);

static ZunResult SetupDInput(Supervisor *s);
static BOOL CALLBACK ControllerCallback(LPCDIDEVICEOBJECTINSTANCEA lpddoi, LPVOID pvRef);
static BOOL CALLBACK EnumGameControllersCb(LPCDIDEVICEINSTANCEA pdidInstance, LPVOID pContext);

i32 LoadPbg3(i32 pbg3FileIdx, char *filename);
void ReleasePbg3(i32 pbg3FileIdx);
Expand Down Expand Up @@ -228,8 +230,6 @@ unsigned int SetButtonFromDirectInputJoystate(u16 *outButtons, i16 controllerBut
u16 GetControllerInput(u16 buttons);
u8 *GetControllerState();
u16 GetInput(void);
BOOL CALLBACK ControllerCallback(LPCDIDEVICEOBJECTINSTANCEA lpddoi, LPVOID pvRef);
BOOL CALLBACK EnumGameControllersCb(LPCDIDEVICEINSTANCEA pdidInstance, LPVOID pContext);
void ResetKeyboard(void);
}; // namespace Controller

Expand Down

0 comments on commit 54d0ded

Please sign in to comment.