Skip to content

Commit

Permalink
Change PadZeroQueue to RenewGameStatus and match
Browse files Browse the repository at this point in the history
  • Loading branch information
PsiLupan committed Sep 6, 2024
1 parent 2dc38b3 commit 4715f8e
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 24 deletions.
2 changes: 1 addition & 1 deletion asm/melee/lb/lbcardgame.s
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
/* 800199FC 000165DC 48 00 00 35 */ bl lb_80019A30
/* 80019A00 000165E0 2C 03 00 00 */ cmpwi r3, 0x0
/* 80019A04 000165E4 41 82 00 08 */ beq .L_80019A0C
/* 80019A08 000165E8 48 35 E1 4D */ bl HSD_PadZeroQueue
/* 80019A08 000165E8 48 35 E1 4D */ bl HSD_PadRenewGameStatus
.L_80019A0C:
/* 80019A0C 000165EC 38 60 00 00 */ li r3, 0x0
/* 80019A10 000165F0 48 00 00 21 */ bl lb_80019A30
Expand Down
16 changes: 10 additions & 6 deletions asm/sysdolphin/baselib/controller.s
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@
/* 000011B4 000011F4 4E 80 00 20 */ blr
.endfn HSD_PadRenewCopyStatus

.fn HSD_PadZeroQueue, global
.fn HSD_PadRenewGameStatus, global
/* 000011B8 000011F8 3C 60 00 00 */ lis r3, HSD_PadLibData@ha
/* 000011BC 000011FC C0 00 00 00 */ lfs f0, HSD_Controller_804DE5B0@sda21(r0)
/* 000011C0 00001200 38 63 00 00 */ addi r3, r3, HSD_PadLibData@l
Expand Down Expand Up @@ -1343,7 +1343,7 @@
/* 00001340 00001380 38 A5 00 44 */ addi r5, r5, 0x44
/* 00001344 00001384 42 00 FE 90 */ bdnz .L_000011D4
/* 00001348 00001388 4E 80 00 20 */ blr
.endfn HSD_PadZeroQueue
.endfn HSD_PadRenewGameStatus

.fn HSD_PadRenewStatus, global
/* 0000134C 0000138C 7C 08 02 A6 */ mflr r0
Expand All @@ -1353,7 +1353,7 @@
/* 0000135C 0000139C 48 00 00 01 */ bl HSD_PadRenewRawStatus
/* 00001360 000013A0 48 00 00 01 */ bl HSD_PadRenewMasterStatus
/* 00001364 000013A4 48 00 00 01 */ bl HSD_PadRenewCopyStatus
/* 00001368 000013A8 48 00 00 01 */ bl HSD_PadZeroQueue
/* 00001368 000013A8 48 00 00 01 */ bl HSD_PadRenewGameStatus
/* 0000136C 000013AC 80 01 00 0C */ lwz r0, 0xc(r1)
/* 00001370 000013B0 38 21 00 08 */ addi r1, r1, 0x8
/* 00001374 000013B4 7C 08 03 A6 */ mtlr r0
Expand Down Expand Up @@ -1669,9 +1669,13 @@
.skip 0x110
.endobj HSD_PadCopyStatus

.obj HSD_PadRumbleData, global
.skip 0x114
.endobj HSD_PadRumbleData
.obj HSD_PadGameStatus, global
.skip 0x110
.endobj HSD_PadGameStatus

.obj pad, local
.skip 0x4
.endobj pad

# 0x00000000 - 0x00000070
.section .sdata2, "a"
Expand Down
4 changes: 2 additions & 2 deletions config/GALE01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19453,7 +19453,7 @@ HSD_PadADConvertCheck1 = .text:0x803771D4; // type:function size:0x27C scope:glo
HSD_PadCrossDir = .text:0x80377450; // type:function size:0xBC scope:global
HSD_PadRenewMasterStatus = .text:0x8037750C; // type:function size:0x4B4 scope:global
HSD_PadRenewCopyStatus = .text:0x803779C0; // type:function size:0x194 scope:global
HSD_PadZeroQueue = .text:0x80377B54; // type:function size:0x194 scope:global
HSD_PadRenewGameStatus = .text:0x80377B54; // type:function size:0x194 scope:global
HSD_PadRenewStatus = .text:0x80377CE8; // type:function size:0x30 scope:global
HSD_PadReset = .text:0x80377D18; // type:function size:0x80 scope:global
HSD_PadInit = .text:0x80377D98; // type:function size:0x2F8 scope:global
Expand Down Expand Up @@ -25163,7 +25163,7 @@ HSD_VIData = .bss:0x804C1D80; // type:object size:0x1F4 scope:global data:4byte
HSD_PadLibData = .bss:0x804C1F78; // type:object size:0x34 scope:global data:byte
HSD_PadMasterStatus = .bss:0x804C1FAC; // type:object size:0x110 scope:global data:4byte
HSD_PadCopyStatus = .bss:0x804C20BC; // type:object size:0x110 scope:global data:4byte
HSD_PadRumbleData = .bss:0x804C21CC; // type:object size:0x114 scope:global data:4byte
HSD_PadGameStatus = .bss:0x804C21CC; // type:object size:0x110 scope:global data:4byte
HSD_Rumble_804C22E0 = .bss:0x804C22E0; // type:object size:0x30 scope:global data:4byte
...bss.0 = .bss:0x804C22E0; // type:label scope:local
HSD_Mtx_804C2310 = .bss:0x804C2310; // type:object size:0x2C scope:global
Expand Down
16 changes: 7 additions & 9 deletions src/melee/ft/fighter.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ extern ftData* gFtDataList[FTKIND_MAX];
extern MotionState ftData_MotionStateList[ftCo_MS_Count];
extern MotionState* ftData_CharacterStateTables[FTKIND_MAX];

extern HSD_PadStatus HSD_PadRumbleData[4];

extern StageInfo stage_info; // from asm/melee/gm_1A36.s

// ==== fighter.c variables ====
Expand Down Expand Up @@ -1816,20 +1814,20 @@ void Fighter_Spaghetti_8006AD10(Fighter_GObj* gobj)

} else {
SET_STICKS(fp->input.lstick.x, fp->input.lstick.y,
HSD_PadRumbleData[fp->x618_player_id].nml_stickX,
HSD_PadRumbleData[fp->x618_player_id].nml_stickY);
HSD_PadGameStatus[fp->x618_player_id].nml_stickX,
HSD_PadGameStatus[fp->x618_player_id].nml_stickY);
if (g_debugLevel < 3 && gm_8016B41C() == 0) {
SET_STICKS(
fp->input.cstick.x, fp->input.cstick.y,
HSD_PadRumbleData[fp->x618_player_id].nml_subStickX,
HSD_PadRumbleData[fp->x618_player_id].nml_subStickY);
HSD_PadGameStatus[fp->x618_player_id].nml_subStickX,
HSD_PadGameStatus[fp->x618_player_id].nml_subStickY);
} else {
fp->input.cstick.x = 0;
fp->input.cstick.y = 0;
}

tempf1 = HSD_PadRumbleData[fp->x618_player_id].nml_analogR;
tempf0 = HSD_PadRumbleData[fp->x618_player_id].nml_analogL;
tempf1 = HSD_PadGameStatus[fp->x618_player_id].nml_analogR;
tempf0 = HSD_PadGameStatus[fp->x618_player_id].nml_analogL;

fp->input.x650 = (tempf0 > tempf1) ? tempf0 : tempf1;
}
Expand Down Expand Up @@ -1858,7 +1856,7 @@ void Fighter_Spaghetti_8006AD10(Fighter_GObj* gobj)
fp->input.held_inputs = ftCo_800A198C(fp);
} else {
fp->input.held_inputs =
HSD_PadRumbleData[fp->x618_player_id].button;
HSD_PadGameStatus[fp->x618_player_id].button;
}

if (gm_8016B0FC()) {
Expand Down
78 changes: 73 additions & 5 deletions src/sysdolphin/baselib/controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
PadLibData HSD_PadLibData;
HSD_PadStatus HSD_PadMasterStatus[4];
HSD_PadStatus HSD_PadCopyStatus[4];
HSD_PadStatus HSD_PadGameStatus[4];

u8 HSD_PadGetRawQueueCount(void)
{
Expand Down Expand Up @@ -174,8 +175,8 @@ void HSD_PadRenewCopyStatus(void)
cp->nml_analogB = mp->nml_analogB;
} else {
cp->button = 0;
cp->subStickY = '\0';
cp->subStickX = '\0';
cp->subStickY = 0;
cp->subStickX = 0;
cp->stickY = 0;
cp->stickX = 0;
cp->analogB = 0;
Expand Down Expand Up @@ -210,17 +211,84 @@ void HSD_PadRenewCopyStatus(void)
return;
}

void HSD_PadZeroQueue(void)
void HSD_PadRenewGameStatus(void)
{
NOT_IMPLEMENTED;
int iVar1;
HSD_PadStatus* mp;
HSD_PadStatus* gs;
PadLibData* p;

int i;

p = &HSD_PadLibData;
for (i = 0; i < 4; i++) {
mp = &HSD_PadMasterStatus[i];
gs = &HSD_PadGameStatus[i];

gs->last_button = gs->button;
gs->err = mp->err;
if (gs->err == 0) {
gs->button = mp->button;
gs->stickX = mp->stickX;
gs->stickY = mp->stickY;
gs->subStickX = mp->subStickX;
gs->subStickY = mp->subStickY;
gs->analogL = mp->analogL;
gs->analogR = mp->analogR;
gs->analogA = mp->analogA;
gs->analogB = mp->analogB;
gs->nml_stickX = mp->nml_stickX;
gs->nml_stickY = mp->nml_stickY;
gs->nml_subStickX = mp->nml_subStickX;
gs->nml_subStickY = mp->nml_subStickY;
gs->nml_analogL = mp->nml_analogL;
gs->nml_analogR = mp->nml_analogR;
gs->nml_analogA = mp->nml_analogA;
gs->nml_analogB = mp->nml_analogB;
} else {
gs->button = 0;
gs->subStickY = 0;
gs->subStickX = 0;
gs->stickY = 0;
gs->stickX = 0;
gs->analogB = 0;
gs->analogA = 0;
gs->analogR = 0;
gs->analogL = 0;
gs->nml_subStickY = 0.0;
gs->nml_subStickX = 0.0;
gs->nml_stickY = 0.0;
gs->nml_stickX = 0.0;
gs->nml_analogB = 0.0;
gs->nml_analogA = 0.0;
gs->nml_analogR = 0.0;
gs->nml_analogL = 0.0;
}
gs->trigger = gs->button & (gs->last_button ^ gs->button);
gs->release = gs->last_button & (gs->last_button ^ gs->button);
if (gs->last_button ^ gs->button) {
gs->repeat = gs->trigger;
gs->repeat_count = p->repeat_start;
} else {
iVar1 = gs->repeat_count - 1;
gs->repeat_count = iVar1;
if (iVar1 != 0) {
gs->repeat = 0;
} else {
gs->repeat = gs->button;
gs->repeat_count = p->repeat_interval;
}
}
};
return;
}

void HSD_PadRenewStatus(void)
{
HSD_PadRenewRawStatus(0);
HSD_PadRenewMasterStatus();
HSD_PadRenewCopyStatus();
HSD_PadZeroQueue();
HSD_PadRenewGameStatus();
}

void HSD_PadReset(void)
Expand Down
3 changes: 2 additions & 1 deletion src/sysdolphin/baselib/controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,14 @@ struct PadLibData {
};

extern HSD_PadStatus HSD_PadMasterStatus[4];
extern HSD_PadStatus HSD_PadGameStatus[4];

void HSD_PadFlushQueue(HSD_FlushType);
u8 HSD_PadGetRawQueueCount(void);
s32 HSD_PadGetResetSwitch(void);
void HSD_PadRenewRawStatus(int);
void HSD_PadRenewMasterStatus(void);
void HSD_PadZeroQueue(void);
void HSD_PadRenewGameStatus(void);
void HSD_PadRenewStatus(void);
void HSD_PadReset(void);
void HSD_PadInit(s32, u8*, s32, HSD_PadRumbleListData*);
Expand Down

0 comments on commit 4715f8e

Please sign in to comment.