Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Improved B swapping in menus
Browse files Browse the repository at this point in the history
  • Loading branch information
yahya14 committed Jul 22, 2017
1 parent 87bea0b commit 377d4c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/patcher/gambit_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ void gambitPatches(VPADData *buffer)
{
inkstrikeEq = (uint32_t*)0x10000000;
spTimer = (uint32_t*)0x10000000;
incrementPtr = (uint32_t*)0x10000000;
PCtrlPtr = (uint32_t*)0x10000000;
}
else
{
Expand All @@ -86,12 +88,14 @@ void gambitPatches(VPADData *buffer)

inkstrikeEq = (uint32_t*)(*ptr + 0x80);
spTimer = (uint32_t*)(*ptr + 0x808);
incrementPtr = (uint32_t*)(*ptr + 0x150);
PCtrlPtr = (uint32_t*)(*ptr + 0x798);

// check if in-game menu is up
if (*ptr2 > 0x1C000000)
{
// switch if B is pressed
if (buffer->btns_d & VPAD_BUTTON_B && AppInBackground)
if (buffer->btns_d & VPAD_BUTTON_B && AppInBackground && *incrementPtr != incrementVal && *PCtrlPtr < 0x01000000)
{
drcSwap();
}
Expand Down Expand Up @@ -131,6 +135,10 @@ void gambitPatches(VPADData *buffer)
AButton = false;
touchVal = D_NEUTRAL;
}

// reset increment value
incrementVal = *incrementPtr;

}
else
{
Expand Down
3 changes: 2 additions & 1 deletion src/retain_vars.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ uint32_t* inkstrikeEq __attribute__((section(".data"))) = (uint32_t*)0x10000000;
uint32_t* spTimer __attribute__((section(".data"))) = (uint32_t*)0x10000000;

uint32_t incrementVal __attribute__((section(".data"))) = (uint32_t)0;
uint32_t* incrementPtr __attribute__((section(".data"))) = (uint32_t*)0x10000000;
uint32_t* incrementPtr __attribute__((section(".data"))) = (uint32_t*)0x10000000;
uint32_t* PCtrlPtr __attribute__((section(".data"))) = (uint32_t*)0x10000000;
1 change: 1 addition & 0 deletions src/retain_vars.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@ extern uint32_t* spTimer;

extern uint32_t incrementVal;
extern uint32_t* incrementPtr;
extern uint32_t* PCtrlPtr;

#endif // _RETAIN_VARS_H_

0 comments on commit 377d4c0

Please sign in to comment.