Discover gbpak and rumble functions

This commit is contained in:
Ryan Dwyer
2021-09-23 18:36:28 +10:00
parent 6e216d3f09
commit d1a5f42edd
31 changed files with 581 additions and 574 deletions
+22 -22
View File
@@ -126,7 +126,7 @@ u32 var80070118 = 0x78000000;
u32 var8007011c = 0x00000000;
#if VERSION >= VERSION_NTSC_1_0
void bgun0f097ba0(s32 handnum, s32 weaponnum)
void bgunRumble(s32 handnum, s32 weaponnum)
{
u32 stack;
s32 contpadtouse1;
@@ -134,24 +134,24 @@ void bgun0f097ba0(s32 handnum, s32 weaponnum)
bool singlewield = false;
s32 contpad1;
s32 contpad2;
s32 a;
s32 b;
s32 contpad1hasrumble;
s32 contpad2hasrumble;
joyGetContpadNumsForPlayer(g_Vars.currentplayernum, &contpad1, &contpad2);
if (optionsGetControlMode(g_Vars.currentplayerstats->mpindex) >= CONTROLMODE_21
&& contpad1 >= 0 && contpad2 >= 0) {
a = pak0f116914(contpad1) == 1;
b = pak0f116914(contpad2) == 1;
contpad1hasrumble = pakGetType(contpad1) == PAKTYPE_RUMBLE;
contpad2hasrumble = pakGetType(contpad2) == PAKTYPE_RUMBLE;
if (!weaponHasFlag(weaponnum, WEAPONFLAG_DUALWIELD)) {
singlewield = true;
}
if (a && b) {
if (contpad1hasrumble && contpad2hasrumble) {
if (singlewield) {
pak0f11dc04(contpad1, 0.2f, 2, 4);
pak0f11dc04(contpad2, 0.2f, 2, 4);
pakRumble(contpad1, 0.2f, 2, 4);
pakRumble(contpad2, 0.2f, 2, 4);
} else {
s32 contpadtouse1 = contpad1;
@@ -159,26 +159,26 @@ void bgun0f097ba0(s32 handnum, s32 weaponnum)
contpadtouse1 = contpad2;
}
pak0f11dc04(contpadtouse1, 0.2f, 2, 4);
pakRumble(contpadtouse1, 0.2f, 2, 4);
}
} else {
s32 contpadtouse2 = contpad1;
if (b) {
if (contpad2hasrumble) {
contpadtouse2 = contpad2;
}
pak0f11dc04(contpadtouse2, 0.2f, 2, 4);
pakRumble(contpadtouse2, 0.2f, 2, 4);
}
} else {
if (contpad1 >= 0) {
pak0f11dc04(contpad1, 0.2f, 2, 4);
pakRumble(contpad1, 0.2f, 2, 4);
}
}
}
#else
GLOBAL_ASM(
glabel bgun0f097ba0
glabel bgunRumble
/* f095b30: 27bdffd0 */ addiu $sp,$sp,-48
/* f095b34: 3c08800a */ lui $t0,0x800a
/* f095b38: 2508e6c0 */ addiu $t0,$t0,-6464
@@ -192,7 +192,7 @@ glabel bgun0f097ba0
/* f095b58: 28410004 */ slti $at,$v0,0x4
/* f095b5c: 1420007c */ bnez $at,.NB0f095d50
/* f095b60: 2508e6c0 */ addiu $t0,$t0,-6464
/* f095b64: 0fc44336 */ jal pak0f116914
/* f095b64: 0fc44336 */ jal pakGetType
/* f095b68: 8104028f */ lb $a0,0x28f($t0)
/* f095b6c: 3c08800a */ lui $t0,0x800a
/* f095b70: 2508e6c0 */ addiu $t0,$t0,-6464
@@ -233,7 +233,7 @@ glabel bgun0f097ba0
/* f095be8: 01f82021 */ addu $a0,$t7,$t8
/* f095bec: 0004ce00 */ sll $t9,$a0,0x18
/* f095bf0: 00192603 */ sra $a0,$t9,0x18
/* f095bf4: 0fc44336 */ jal pak0f116914
/* f095bf4: 0fc44336 */ jal pakGetType
/* f095bf8: afa6001c */ sw $a2,0x1c($sp)
/* f095bfc: 8fa6001c */ lw $a2,0x1c($sp)
/* f095c00: 3c08800a */ lui $t0,0x800a
@@ -282,7 +282,7 @@ glabel bgun0f097ba0
/* f095c98: 34a5cccd */ ori $a1,$a1,0xcccd
/* f095c9c: 03002025 */ or $a0,$t8,$zero
/* f095ca0: 24060002 */ addiu $a2,$zero,0x2
/* f095ca4: 0fc45e2f */ jal pak0f11dc04
/* f095ca4: 0fc45e2f */ jal pakRumble
/* f095ca8: 24070004 */ addiu $a3,$zero,0x4
/* f095cac: 1000002f */ beqz $zero,.NB0f095d6c
/* f095cb0: 8fbf0014 */ lw $ra,0x14($sp)
@@ -327,7 +327,7 @@ glabel bgun0f097ba0
/* f095d34: 34a5cccd */ ori $a1,$a1,0xcccd
/* f095d38: 01a02025 */ or $a0,$t5,$zero
/* f095d3c: 24060002 */ addiu $a2,$zero,0x2
/* f095d40: 0fc45e2f */ jal pak0f11dc04
/* f095d40: 0fc45e2f */ jal pakRumble
/* f095d44: 24070004 */ addiu $a3,$zero,0x4
/* f095d48: 10000008 */ beqz $zero,.NB0f095d6c
/* f095d4c: 8fbf0014 */ lw $ra,0x14($sp)
@@ -336,7 +336,7 @@ glabel bgun0f097ba0
/* f095d54: 34a5cccd */ ori $a1,$a1,0xcccd
/* f095d58: 8104028f */ lb $a0,0x28f($t0)
/* f095d5c: 24060002 */ addiu $a2,$zero,0x2
/* f095d60: 0fc45e2f */ jal pak0f11dc04
/* f095d60: 0fc45e2f */ jal pakRumble
/* f095d64: 24070004 */ addiu $a3,$zero,0x4
/* f095d68: 8fbf0014 */ lw $ra,0x14($sp)
.NB0f095d6c:
@@ -5903,7 +5903,7 @@ glabel var7f1ac320
/* f09a868: 8fad0058 */ lw $t5,0x58($sp)
/* f09a86c: 8fa4005c */ lw $a0,0x5c($sp)
/* f09a870: 8da50000 */ lw $a1,0x0($t5)
/* f09a874: 0fc25ee8 */ jal bgun0f097ba0
/* f09a874: 0fc25ee8 */ jal bgunRumble
/* f09a878: afa70064 */ sw $a3,0x64($sp)
/* f09a87c: 8fae0054 */ lw $t6,0x54($sp)
/* f09a880: 24060001 */ addiu $a2,$zero,0x1
@@ -6233,7 +6233,7 @@ glabel var7f1ac320
/* f09a868: 8fad0058 */ lw $t5,0x58($sp)
/* f09a86c: 8fa4005c */ lw $a0,0x5c($sp)
/* f09a870: 8da50000 */ lw $a1,0x0($t5)
/* f09a874: 0fc25ee8 */ jal bgun0f097ba0
/* f09a874: 0fc25ee8 */ jal bgunRumble
/* f09a878: afa70064 */ sw $a3,0x64($sp)
/* f09a87c: 8fae0054 */ lw $t6,0x54($sp)
/* f09a880: 24060001 */ addiu $a2,$zero,0x1
@@ -6563,7 +6563,7 @@ glabel var7f1ac320
/* f0988a4: 8fad0050 */ lw $t5,0x50($sp)
/* f0988a8: 8fa40054 */ lw $a0,0x54($sp)
/* f0988ac: 8da50000 */ lw $a1,0x0($t5)
/* f0988b0: 0fc256cc */ jal bgun0f097ba0
/* f0988b0: 0fc256cc */ jal bgunRumble
/* f0988b4: afa7005c */ sw $a3,0x5c($sp)
/* f0988b8: 8fae004c */ lw $t6,0x4c($sp)
/* f0988bc: 24060001 */ addiu $a2,$zero,0x1
@@ -6835,7 +6835,7 @@ const char var7f1ab898[] = "rofftime";
// hand->stateflags |= HANDSTATEFLAG_00000020;
// hand->stateflags |= HANDSTATEFLAG_00000010;
//
// bgun0f097ba0(handnum, info->weaponnum);
// bgunRumble(handnum, info->weaponnum);
//
// if (usesammo && func->ammoindex >= 0) {
// hand->loadedammo[func->ammoindex] -= hand->shotstotake;
+2 -2
View File
@@ -467,7 +467,7 @@ s32 cheatMenuHandleDialog(s32 operation, struct menudialog *dialog, union handle
if (operation == MENUOP_OPEN) {
func0f14a52c();
if (pak0f11e78c()) {
if (gbpakIsAnyPerfectDark()) {
gamefileSetFlag(GAMEFILEFLAG_USED_TRANSFERPAK);
}
@@ -497,7 +497,7 @@ s32 cheatMenuHandleDialog(s32 operation, struct menudialog *dialog, union handle
}
if (operation == MENUOP_CLOSE) {
if (pak0f11e78c()) {
if (gbpakIsAnyPerfectDark()) {
gamefileSetFlag(GAMEFILEFLAG_USED_TRANSFERPAK);
}
+4 -4
View File
@@ -4502,19 +4502,19 @@ void chrDamage(struct chrdata *chr, f32 damage, struct coord *vector, struct gse
joyGetContpadNumsForPlayer(g_Vars.currentplayernum, &contpad1, &contpad2);
if (contpad1 >= 0) {
pak0f11dc04(contpad1, 0.25f, -1, -1);
pakRumble(contpad1, 0.25f, -1, -1);
}
if (contpad2 >= 0) {
pak0f11dc04(contpad2, 0.25f, -1, -1);
pakRumble(contpad2, 0.25f, -1, -1);
}
#else
setCurrentPlayerNum(propGetPlayerNum(vprop));
pak0f11dc04((s8)g_Vars.currentplayernum, 0.25f, -1, -1);
pakRumble((s8)g_Vars.currentplayernum, 0.25f, -1, -1);
if (optionsGetControlMode(g_Vars.currentplayerstats->mpindex) >= CONTROLMODE_21) {
pak0f11dc04((s8)(PLAYERCOUNT() + g_Vars.currentplayernum), 0.25f, -1, -1);
pakRumble((s8)(PLAYERCOUNT() + g_Vars.currentplayernum), 0.25f, -1, -1);
}
#endif
+3 -3
View File
@@ -225,7 +225,7 @@ void filelistUpdate(struct filelist *list)
}
list->deviceguids[dis2dev[i]].fileid = 0;
list->deviceguids[dis2dev[i]].deviceserial = pakGetDeviceSerial(dis2dev[i]);
list->deviceguids[dis2dev[i]].deviceserial = pakGetSerial(dis2dev[i]);
} else {
// PFS error?
list->spacesfree[dis2dev[i]] = -1;
@@ -254,7 +254,7 @@ void filelistUpdate(struct filelist *list)
list->devicestartindexes[dev2dis[filedevices[i]]] = list->numfiles;
}
file->deviceserial = pakGetDeviceSerial(filedevices[i]);
file->deviceserial = pakGetSerial(filedevices[i]);
file->fileid = sp1288[i];
list->numfiles++;
@@ -267,7 +267,7 @@ void filelistUpdate(struct filelist *list)
if (list->deviceguids[filedevices[i]].fileid == 0) {
list->deviceguids[filedevices[i]].fileid = sp1288[i];
list->deviceguids[filedevices[i]].deviceserial = pakGetDeviceSerial(filedevices[i]);
list->deviceguids[filedevices[i]].deviceserial = pakGetSerial(filedevices[i]);
}
}
}
+1 -1
View File
@@ -2423,7 +2423,7 @@ char *pakMenuTextEditingPakName(struct menuitem *item)
s32 pakSelectionMenuHandler(s32 operation, struct menuitem *item, union handlerdata *data)
{
if (operation == MENUOP_CHECKDISABLED) {
if (!pakIsConnected((s8)item->param)) {
if (!pakIsMemoryPak((s8)item->param)) {
return true;
}
}
+4 -4
View File
@@ -559,7 +559,7 @@ glabel var7f1ad568
/* f0b7318: adc80004 */ sw $t0,0x4($t6)
/* f0b731c: adc10008 */ sw $at,0x8($t6)
/* f0b7320: 8e31d03c */ lw $s1,%lo(g_StageSetup+0xc)($s1)
/* f0b7324: 0fc47788 */ jal pak0f11de20
/* f0b7324: 0fc47788 */ jal pakEnableRumbleForPlayer
/* f0b7328: 8244028f */ lb $a0,0x28f($s2)
/* f0b732c: 8e490284 */ lw $t1,0x284($s2)
/* f0b7330: a12019b3 */ sb $zero,0x19b3($t1)
@@ -896,7 +896,7 @@ glabel var7f1ad568
// u32 stack[4];
// s32 aiStack188[34]; // 5c
//
// pak0f11de20(g_Vars.currentplayernum);
// pakEnableRumbleForPlayer(g_Vars.currentplayernum);
//
// g_Vars.currentplayer->dostartnewlife = false;
//
@@ -3473,7 +3473,7 @@ void func0f0ba010(void)
var8009de2c = -1;
g_InCutscene = 1;
pak0f11dcb0(1);
pakStopRumbleForAllPaks(true);
g_Vars.in_cutscene = g_Vars.tickmode == TICKMODE_CUTSCENE && g_CutsceneCurAnimFrame60 < animGetNumFrames(g_CutsceneAnimNum) - 1;
g_Vars.cutsceneskip60ths = 0;
}
@@ -14136,7 +14136,7 @@ Gfx *currentPlayerRenderHud(Gfx *gdl)
bool pass = false;
if (g_Vars.currentplayer->isdead == 1) {
pak0f11dd58(g_Vars.currentplayernum);
pakDisableRumbleForPlayer(g_Vars.currentplayernum);
g_Vars.currentplayer->isdead = 2;
pass = true;
}
+12 -12
View File
@@ -650,12 +650,12 @@ glabel var7f1b1f44nc
/* f1627d0: 3c018008 */ lui $at,0x8008
/* f1627d4: ac206874 */ sw $zero,0x6874($at)
/* f1627d8: 3c018008 */ lui $at,0x8008
/* f1627dc: 0c005812 */ jal joy000150c4
/* f1627dc: 0c005812 */ jal joyIsCyclicPollingEnabled
/* f1627e0: ac206870 */ sw $zero,0x6870($at)
/* f1627e4: 10400008 */ beqz $v0,.NB0f162808
/* f1627e8: 3c057f1b */ lui $a1,0x7f1b
/* f1627ec: 24a51e20 */ addiu $a1,$a1,0x1e20
/* f1627f0: 0c00581b */ jal joyGetLock
/* f1627f0: 0c00581b */ jal joyDisableCyclicPolling
/* f1627f4: 240402f8 */ addiu $a0,$zero,0x2f8
/* f1627f8: 3c11800a */ lui $s1,0x800a
/* f1627fc: 2631e6c0 */ addiu $s1,$s1,-6464
@@ -6948,7 +6948,7 @@ glabel var7f1b8ed0pf
/* f16c7a4: 10000003 */ b .PF0f16c7b4
/* f16c7a8: a28004d1 */ sb $zero,0x4d1($s4)
.PF0f16c7ac:
/* f16c7ac: 0fc47a8d */ jal pak0f11df38
/* f16c7ac: 0fc47a8d */ jal pakEnableRumbleForAllPlayers
/* f16c7b0: a29804d1 */ sb $t8,0x4d1($s4)
.PF0f16c7b4:
/* f16c7b4: 2415ffff */ li $s5,-1
@@ -8222,7 +8222,7 @@ void lvTick(void)
g_Vars.paksconnected2 = 0;
} else {
g_Vars.paksconnected2 = 31;
pak0f11df38();
pakEnableRumbleForAllPlayers();
}
g_Vars.joydisableframestogo = -1;
@@ -8566,12 +8566,12 @@ glabel lvTick
.NB0f166764:
/* f166764: 14400018 */ bnez $v0,.NB0f1667c8
/* f166768: 00000000 */ sll $zero,$zero,0x0
/* f16676c: 0c005812 */ jal joy000150c4
/* f16676c: 0c005812 */ jal joyIsCyclicPollingEnabled
/* f166770: 00000000 */ sll $zero,$zero,0x0
/* f166774: 14400004 */ bnez $v0,.NB0f166788
/* f166778: 24040cce */ addiu $a0,$zero,0xcce
/* f16677c: 3c057f1b */ lui $a1,0x7f1b
/* f166780: 0c005834 */ jal joyReleaseLock
/* f166780: 0c005834 */ jal joyEnableCyclicPolling
/* f166784: 24a51e98 */ addiu $a1,$a1,0x1e98
.NB0f166788:
/* f166788: 8e8204b4 */ lw $v0,0x4b4($s4)
@@ -8588,7 +8588,7 @@ glabel lvTick
/* f1667b0: 10000003 */ beqz $zero,.NB0f1667c0
/* f1667b4: a28004d1 */ sb $zero,0x4d1($s4)
.NB0f1667b8:
/* f1667b8: 0fc45ecc */ jal pak0f11df38
/* f1667b8: 0fc45ecc */ jal pakEnableRumbleForAllPlayers
/* f1667bc: a28f04d1 */ sb $t7,0x4d1($s4)
.NB0f1667c0:
/* f1667c0: 2415ffff */ addiu $s5,$zero,-1
@@ -9821,7 +9821,7 @@ void lvRecordDistanceMoved(void)
void lvReset(void)
{
pak0f11dcb0(1);
pakStopRumbleForAllPaks(true);
if (g_MiscAudioHandle && audioIsPlaying(g_MiscAudioHandle)) {
audioStop(g_MiscAudioHandle);
@@ -9872,9 +9872,9 @@ void lvCheckPauseStateChanged(void)
if (paused != var80084010) {
if (paused) {
pak0f11deb8();
pakDisableRumbleForAllPlayers();
} else {
pak0f11df38();
pakEnableRumbleForAllPlayers();
}
}
@@ -9884,11 +9884,11 @@ void lvCheckPauseStateChanged(void)
void lvSetPaused(bool paused)
{
if (paused) {
pak0f11deb8();
pakDisableRumbleForAllPlayers();
snd0000fe20();
} else {
snd0000fe50();
pak0f11df38();
pakEnableRumbleForAllPlayers();
}
var80084014 = paused;
+325 -320
View File
File diff suppressed because it is too large Load Diff