1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-04 06:54:33 +00:00

Fix various non matching issues and introduce #ifdef NON_EQUIVALENT instead of #if 0 (#207)

This commit is contained in:
Roman971 2020-06-14 05:29:59 +02:00 committed by GitHub
parent 031d946db7
commit 06fc61c83d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 297 additions and 1307 deletions

View file

@ -292,9 +292,9 @@ s32 func_800E7744(s32 instrument, s32 bankId, s32 instId, UnkInstrument* arg3) {
return 0;
}
#if 0
// This code is SM64 PAL's version with changes made to build here (and a couple legitimate changes made in the function).
// This function needs massive work, hence why it is not set for NON_MATCHING
#ifdef NON_EQUIVALENT
// This code is SM64 PAL's version with changes made to build here (and a couple legitimate changes made in the
// function). This function needs massive work, hence why it is not set for NON_MATCHING
void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target) {
Note* note;
NoteAttributes* attributes;
@ -302,7 +302,7 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
if (seqLayer == NO_LAYER) {
return;
}
seqLayer->unusedEu0b8 = 0;
if (seqLayer->note == NULL) {
@ -317,7 +317,8 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
}
if (note->playbackState.parentLayer != seqLayer) {
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER && note->playbackState.prevParentLayer == seqLayer && target != 6) {
if (note->playbackState.parentLayer == NO_LAYER && note->playbackState.wantedParentLayer == NO_LAYER &&
note->playbackState.prevParentLayer == seqLayer && target != 6) {
note->playbackState.adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
note->playbackState.adsr.adsrAction.action |= 0x10;
}
@ -341,11 +342,14 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
} else {
note->playbackState.adsr.adsrAction.action |= 0x20;
if (seqLayer->adsr.releaseRate == 0) {
note->playbackState.adsr.fadeOutVel = seqLayer->seqChannel->adsr.releaseRate * gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled;
note->playbackState.adsr.fadeOutVel = seqLayer->seqChannel->adsr.releaseRate *
gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled;
} else {
note->playbackState.adsr.fadeOutVel = seqLayer->adsr.releaseRate * gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled;
note->playbackState.adsr.fadeOutVel =
seqLayer->adsr.releaseRate * gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled;
}
note->playbackState.adsr.sustain = ((f32) (s32) (seqLayer->seqChannel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
note->playbackState.adsr.sustain =
((f32)(s32)(seqLayer->seqChannel->adsr.sustain) * note->playbackState.adsr.current) / 256.0f;
}
}

View file

@ -117,33 +117,31 @@ void func_800C4344(GameState* gameState) {
}
#ifdef NON_MATCHING
// Regalloc mostly
// regalloc differences
void GameState_DrawInputDisplay(u16 input, Gfx** gfx) {
static const u16 sInpDispBtnColors[] = {
GPACK_RGBA5551(31, 31, 0, 1), GPACK_RGBA5551(31, 31, 0, 1), GPACK_RGBA5551(31, 31, 0, 1),
GPACK_RGBA5551(31, 31, 0, 1), GPACK_RGBA5551(15, 15, 15, 1), GPACK_RGBA5551(15, 15, 15, 1),
GPACK_RGBA5551(31, 0, 31, 1), GPACK_RGBA5551(0, 31, 31, 1), GPACK_RGBA5551(15, 15, 15, 1),
GPACK_RGBA5551(15, 15, 15, 1), GPACK_RGBA5551(15, 15, 15, 1), GPACK_RGBA5551(15, 15, 15, 1),
GPACK_RGBA5551(31, 0, 0, 1), GPACK_RGBA5551(15, 15, 15, 1), GPACK_RGBA5551(0, 31, 15, 1),
GPACK_RGBA5551(0, 0, 31, 1),
GPACK_RGBA5551(0xFF, 0xFF, 0x00, 1), GPACK_RGBA5551(0xFF, 0xFF, 0x00, 1), GPACK_RGBA5551(0xFF, 0xFF, 0x00, 1),
GPACK_RGBA5551(0xFF, 0xFF, 0x00, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1),
GPACK_RGBA5551(0x00, 0xFF, 0xFF, 1), GPACK_RGBA5551(0xFF, 0x00, 0xFF, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1),
GPACK_RGBA5551(0x78, 0x78, 0x78, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1),
GPACK_RGBA5551(0xFF, 0x00, 0x00, 1), GPACK_RGBA5551(0x78, 0x78, 0x78, 1), GPACK_RGBA5551(0x00, 0xFF, 0x00, 1),
GPACK_RGBA5551(0x00, 0x00, 0xFF, 1),
};
s32 i, j;
s32 lrx, lry, ulx, uly;
s32 i, j, k;
Gfx* gfxP = *gfx;
gDPPipeSync(gfxP++);
gDPSetOtherMode(gfxP++,
G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE,
G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
for (i = 0, j = 1; i < 0x10; i++, j++) {
for (i = 0; i < 16; i++) {
j = i;
k = i + 1;
if (input & (1 << i)) {
gDPSetFillColor(gfxP++, (sInpDispBtnColors[i] << 0x10) | sInpDispBtnColors[i]);
ulx = i * 4 + 226;
uly = 220;
lrx = j * 4 + 225;
lry = 223;
gDPFillRectangle(gfxP++, ulx, uly, lrx, lry);
gDPFillRectangle(gfxP++, (j * 4) + 226, 220, (k * 4) + 225, 223);
gDPPipeSync(gfxP++);
}
};

View file

@ -221,7 +221,8 @@ void Graph_TaskSet00(GraphicsContext* gfxCtx) {
task->dram_stack = gGfxSPTaskStack;
task->dram_stack_size = sizeof(gGfxSPTaskStack);
task->output_buff = gGfxSPTaskOutputBuffer;
task->output_buff_size = gGfxSPTaskYieldBuffer; //! @bug (?) should be sizeof(gGfxSPTaskYieldBuffer), probably a typo
task->output_buff_size =
gGfxSPTaskYieldBuffer; //! @bug (?) should be sizeof(gGfxSPTaskYieldBuffer), probably a typo
task->data_ptr = gfxCtx->workBuffer;
Graph_OpenDisps(dispRefs, gfxCtx, "../graph.c", 828);

View file

@ -8,78 +8,80 @@
s32 D_8012D280 = 1;
OSMesgQueue* PadMgr_LockSerialMesgQueue(PadMgr* padmgr) {
OSMesgQueue* ctrlrqueue = NULL;
OSMesgQueue* ctrlrQ = NULL;
if (D_8012D280 > 2) {
// EUC-JP: ロック待ち | Waiting for lock
// "serialMsgQ Waiting for lock"
osSyncPrintf("%2d %d serialMsgQロック待ち %08x %08x %08x\n", osGetThreadId(NULL),
padmgr->queue1.validCount, padmgr, &padmgr->queue1, &ctrlrqueue);
padmgr->serialMsgQ.validCount, padmgr, &padmgr->serialMsgQ, &ctrlrQ);
}
osRecvMesg(&padmgr->queue1, &ctrlrqueue, OS_MESG_BLOCK);
osRecvMesg(&padmgr->serialMsgQ, &ctrlrQ, OS_MESG_BLOCK);
if (D_8012D280 > 2) {
// EUC-JP: をロックしました | Locked
// "serialMsgQ Locked"
osSyncPrintf("%2d %d serialMsgQをロックしました %08x\n", osGetThreadId(NULL),
padmgr->queue1.validCount, ctrlrqueue);
padmgr->serialMsgQ.validCount, ctrlrQ);
}
return ctrlrqueue;
return ctrlrQ;
}
void PadMgr_UnlockSerialMesgQueue(PadMgr* padmgr, OSMesgQueue* ctrlrqueue) {
void PadMgr_UnlockSerialMesgQueue(PadMgr* padmgr, OSMesgQueue* ctrlrQ) {
if (D_8012D280 > 2) {
// EUC-JP: ロック解除します | Unlock
// "serialMsgQ Unlock"
osSyncPrintf("%2d %d serialMsgQロック解除します %08x %08x %08x\n", osGetThreadId(NULL),
padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue);
padmgr->serialMsgQ.validCount, padmgr, &padmgr->serialMsgQ, ctrlrQ);
}
osSendMesg(&padmgr->queue1, ctrlrqueue, OS_MESG_BLOCK);
osSendMesg(&padmgr->serialMsgQ, ctrlrQ, OS_MESG_BLOCK);
if (D_8012D280 > 2) {
// EUC-JP: ロック解除しました | Unlocked
// "serialMsgQ Unlocked"
osSyncPrintf("%2d %d serialMsgQロック解除しました %08x %08x %08x\n", osGetThreadId(NULL),
padmgr->queue1.validCount, padmgr, &padmgr->queue1, ctrlrqueue);
padmgr->serialMsgQ.validCount, padmgr, &padmgr->serialMsgQ, ctrlrQ);
}
}
void PadMgr_LockPadData(PadMgr* padmgr) {
osRecvMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK);
osRecvMesg(&padmgr->lockMsgQ, NULL, OS_MESG_BLOCK);
}
void PadMgr_UnlockPadData(PadMgr* padmgr) {
osSendMesg(&padmgr->queue2, NULL, OS_MESG_BLOCK);
osSendMesg(&padmgr->lockMsgQ, NULL, OS_MESG_BLOCK);
}
#ifdef NON_MATCHING
// regalloc and minor ordering differences
void PadMgr_RumbleControl(PadMgr* padmgr) {
static u32 errcnt = 0;
static u32 D_8016A4F0;
static u32 frame;
s32 temp;
s32 triedRumbleComm;
OSMesgQueue* ctrlrqueue;
s32 ctrlr;
OSMesgQueue* ctrlrQ;
s32 var4;
s32 i;
temp = 1;
ctrlrqueue = PadMgr_LockSerialMesgQueue(padmgr);
ctrlrQ = PadMgr_LockSerialMesgQueue(padmgr);
triedRumbleComm = 0;
for (i = 0; i < 4; i++) {
if (padmgr->ctrlrIsConnected[i] != 0) {
if (padmgr->pad_status[i].status & 1) {
if (padmgr->ctrlrIsConnected[i]) {
if (padmgr->padStatus[i].status & 1) {
if (padmgr->pakType[i] == temp) {
if (padmgr->rumbleEnable[i] != 0) {
if (padmgr->rumbleCounter[i] < 3) {
osSyncPrintf(VT_FGCOL(YELLOW));
// clang-format off
if (1) {} osSyncPrintf(VT_FGCOL(YELLOW));
// clang-format on
// "Vibration pack jumble jumble"?
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック ぶるぶるぶるぶる");
osSyncPrintf(VT_RST);
if (osSetRumble(&padmgr->unk_controller[i], temp) != 0) {
padmgr->pakType[i] = 0;
osSyncPrintf(VT_FGCOL(YELLOW));
// "A communication error has occurred with the vibraton pack"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました");
osSyncPrintf(VT_RST);
} else {
@ -90,13 +92,18 @@ void PadMgr_RumbleControl(PadMgr* padmgr) {
}
} else {
if (padmgr->rumbleCounter[i] != 0) {
osSyncPrintf(VT_FGCOL(YELLOW));
// clang-format off
if (1) {} osSyncPrintf(VT_FGCOL(YELLOW));
// clang-format on
// "Stop vibration pack"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
osSyncPrintf(VT_RST);
if (osSetRumble(&padmgr->unk_controller[i], 0) != 0) {
padmgr->pakType[i] = 0;
osSyncPrintf(VT_FGCOL(YELLOW));
// "A communication error has occurred with the vibration pack"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックで通信エラーが発生しました");
osSyncPrintf(VT_RST);
} else {
@ -111,11 +118,13 @@ void PadMgr_RumbleControl(PadMgr* padmgr) {
if (padmgr->pakType[i] != 0) {
if (padmgr->pakType[i] == 1) {
osSyncPrintf(VT_FGCOL(YELLOW));
// "It seems that a vibration pack was pulled out"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックが抜かれたようです");
osSyncPrintf(VT_RST);
padmgr->pakType[i] = 0;
} else {
osSyncPrintf(VT_FGCOL(YELLOW));
// "It seems that a controller pack that is not a vibration pack was pulled out"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1,
"振動パックではないコントローラパックが抜かれたようです");
osSyncPrintf(VT_RST);
@ -127,52 +136,46 @@ void PadMgr_RumbleControl(PadMgr* padmgr) {
}
if (!triedRumbleComm) {
ctrlr = D_8016A4F0 % 4;
i = frame % 4;
if ((padmgr->ctrlrIsConnected[ctrlr] != 0) && (padmgr->pad_status[ctrlr].status & 1) &&
(padmgr->pakType[ctrlr] != 1)) {
var4 = osProbeRumblePak(ctrlrqueue, &padmgr->unk_controller[ctrlr], ctrlr);
if (padmgr->ctrlrIsConnected[i] && (padmgr->padStatus[i].status & 1) && (padmgr->pakType[i] != 1)) {
var4 = osProbeRumblePak(ctrlrQ, &padmgr->unk_controller[i], i);
if (var4 == 0) {
padmgr->pakType[ctrlr] = 1;
osSetRumble(&padmgr->unk_controller[ctrlr], 1);
osSetRumble(&padmgr->unk_controller[ctrlr], 0);
padmgr->pakType[i] = 1;
osSetRumble(&padmgr->unk_controller[i], 1);
osSetRumble(&padmgr->unk_controller[i], 0);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", ctrlr + 1, "振動パックを認識しました");
// "Recognized vibration pack"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パックを認識しました");
osSyncPrintf(VT_RST);
} else if (var4 == 11) {
padmgr->pakType[ctrlr] = 2;
padmgr->pakType[i] = 2;
} else if (var4 == 4) {
LOG_NUM("++errcnt", ++errcnt, "../padmgr.c", 282);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", ctrlr + 1, "コントローラパックの通信エラー");
// "Controller pack communication error"
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "コントローラパックの通信エラー");
osSyncPrintf(VT_RST);
}
}
}
D_8016A4F0++;
PadMgr_UnlockSerialMesgQueue(padmgr, ctrlrqueue);
frame++;
PadMgr_UnlockSerialMesgQueue(padmgr, ctrlrQ);
}
#else
u32 D_8012D284 = 0; // errcnt
u32 D_8016A4F0;
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_RumbleControl.s")
#endif
// func_800A2300 in 1.0
void PadMgr_RumbleStop(PadMgr* padmgr) {
s32 i;
OSMesgQueue* ctrlrqueue;
OSMesgQueue* ctrlrQ;
ctrlrqueue = PadMgr_LockSerialMesgQueue(padmgr);
ctrlrQ = PadMgr_LockSerialMesgQueue(padmgr);
for (i = 0; i < 4; i++) {
if (osProbeRumblePak(ctrlrqueue, &padmgr->unk_controller[i], i) == 0) {
if (osProbeRumblePak(ctrlrQ, &padmgr->unk_controller[i], i) == 0) {
if ((gFaultStruct.msgId == 0) && (padmgr->rumbleOnFrames != 0)) {
osSyncPrintf(VT_FGCOL(YELLOW));
// EUC-JP: コン | 'Con'? , EUC-JP: 振動パック 停止 | Stop vibration pack
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止");
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "振動パック 停止"); // "Stop vibration pack"
osSyncPrintf(VT_RST);
}
@ -180,7 +183,7 @@ void PadMgr_RumbleStop(PadMgr* padmgr) {
}
}
PadMgr_UnlockSerialMesgQueue(padmgr, ctrlrqueue);
PadMgr_UnlockSerialMesgQueue(padmgr, ctrlrQ);
}
void PadMgr_RumbleReset(PadMgr* padmgr) {
@ -189,102 +192,85 @@ void PadMgr_RumbleReset(PadMgr* padmgr) {
void PadMgr_RumbleSetSingle(PadMgr* padmgr, u32 ctrlr, u32 rumble) {
padmgr->rumbleEnable[ctrlr] = rumble;
padmgr->rumbleOnFrames = 0xF0;
padmgr->rumbleOnFrames = 240;
}
// 800A23CC in 1.0
void PadMgr_RumbleSet(PadMgr* padmgr, u8* ctrlrRumbles) {
s32 i;
for (i = 0; i < 4; ++i) {
for (i = 0; i < 4; i++) {
padmgr->rumbleEnable[i] = ctrlrRumbles[i];
}
padmgr->rumbleOnFrames = 0xF0;
padmgr->rumbleOnFrames = 240;
}
#if 0
void PadMgr_ProcessInputs(PadMgr* padmgr) {
/*
void *sp34;
s32 temp_s1;
s32 temp_v0_5;
u16 temp_a1;
u16 temp_v1_2;
u8 temp_v0;
void *temp_v0_2;
void *temp_v0_3;
void *temp_v0_4;
void *temp_v1;
void *phi_s0;
void *phi_s3;
s32 phi_s2;
s32 phi_s1;
*/
Input* input;
PadState* padnow1; //name from debug string
s32 i;
Input* input;
PadState* padnow1; // original name
s32 buttonDiff;
PadMgr_LockPadData(padmgr);
input = padmgr->inputs; //s0
padnow1 = padmgr->pads; //s3
for(i=0; i<padmgr->ncontrollers; ++i, ++input, ++padnow1){
input->prev.in = input->cur.in;
input->prev.status = input->cur.status;
temp_v0 = phi_s3->unk4;
switch(padnow1->errno){
case 0:
input->cur.in = padnow1->input;
input->cur.status = padnow1->status;
if (padmgr->ctrlrIsConnected[i] == 0) {
padmgr->ctrlrIsConnected[i] = 1;
osSyncPrintf(&D_80145AF0); //"\x1b[33m"
osSyncPrintf(&D_80145AF8, phi_s2 + 1, &D_80145B0C); //"padmgr: %dCon: %s\n" : "Recognized"
osSyncPrintf(&D_80145B1C); //"\x1b[m"
}
break;
case 4:
input->cur.in = input->prev.in;
input->cur.status = input->prev.status;
LogUtils_LogThreadId(&D_80145B20, 0x17c); //"../padmgr.c"
osSyncPrintf(&D_80145B2C, padmgr->ctrlrIsConnected[i]); //"this->ctrlrIsConnected[i] = %d\n"
osSyncPrintf(&D_80145B48); //"\x1b[33m"
osSyncPrintf(&D_80145B50, temp_s1, &D_80145B64); //"padmgr: %dCon: %s\n" : "Overrun error occurred"
osSyncPrintf(&D_80145B80); //"\x1b[m"
break;
case 8:
input->cur.in.button = 0;
input->cur.in.x = 0;
input->cur.in.y = 0;
temp_v0_2 = arg0 + phi_s2;
input->cur.errno = padnow1->errno;
if (temp_v0_2->ctrlrIsConnected != 0){
temp_v0_2->ctrlrIsConnected = 0;
temp_v0_2->pakType = 0;
temp_v0_2->rumbleCounter = 0xff;
osSyncPrintf(&D_80145B84); //"\x1b[33m"
osSyncPrintf(&D_80145B8C, phi_s2 + 1, &D_80145BA0); //"padmgr: %dCon: %s\n" : "Do not respond"
osSyncPrintf(&D_80145BB0); //"\x1b[m"
}
break;
default:
LogUtils_LogThreadId(&D_80145BB4, 0x18c); //"../padmgr.c"
osSyncPrintf(&D_80145BC0, padnow1->errno); //"padnow1->errno = %x\n"
Fault_AddHungupAndCrash(&D_80145BD8, 0x18d); //"../padmgr.c"
input = &padmgr->inputs[0];
padnow1 = &padmgr->pads[0];
for (i = 0; i < padmgr->ncontrollers; i++, input++, padnow1++) {
input->prev = input->cur;
if (1) {} // Necessary to match
switch (padnow1->errno) {
case 0:
input->cur = *padnow1;
if (!padmgr->ctrlrIsConnected[i]) {
padmgr->ctrlrIsConnected[i] = true;
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "認識しました"); // "Recognized"
osSyncPrintf(VT_RST);
}
break;
case 4:
input->cur = input->prev;
LOG_NUM("this->Key_switch[i]", padmgr->ctrlrIsConnected[i], "../padmgr.c", 380);
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "オーバーランエラーが発生"); // "Overrun error occurred"
osSyncPrintf(VT_RST);
break;
case 8:
input->cur.in.button = 0;
input->cur.in.x = 0;
input->cur.in.y = 0;
input->cur.errno = padnow1->errno;
if (padmgr->ctrlrIsConnected[i]) {
padmgr->ctrlrIsConnected[i] = false;
padmgr->pakType[i] = 0;
padmgr->rumbleCounter[i] = 0xFF;
osSyncPrintf(VT_FGCOL(YELLOW));
osSyncPrintf("padmgr: %dコン: %s\n", i + 1, "応答しません"); // "Do not respond"?
osSyncPrintf(VT_RST);
}
break;
default:
LOG_HEX("padnow1->errno", padnow1->errno, "../padmgr.c", 396);
Fault_AddHungupAndCrash("../padmgr.c", 397);
}
input->press.in.button = input->cur.in.button & (input->prev.in.button ^ input->cur.in.button);
input->rel.in.button = input->prev.in.button & (input->prev.in.button ^ input->cur.in.button);
buttonDiff = input->prev.in.button ^ input->cur.in.button;
input->press.in.button |= (u16)(buttonDiff & input->cur.in.button);
input->rel.in.button |= (u16)(buttonDiff & input->prev.in.button);
PadUtils_UpdateRelXY(input);
input->press.in.x = (input->cur.in.x - input->prev.in.x) + input->press.in.x;
input->press.in.y = (input->cur.in.y - input->prev.in.y) + input->press.in.y;
input->press.in.x += (s8)(input->cur.in.x - input->prev.in.x);
input->press.in.y += (s8)(input->cur.in.y - input->prev.in.y);
}
PadMgr_UnlockPadData(arg0);
PadMgr_UnlockPadData(padmgr);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_ProcessInputs.s")
#endif
void PadMgr_HandleRetraceMsg(PadMgr* padmgr) {
OSMesgQueue* queue; // s1
u32 i;
s32 i;
OSMesgQueue* queue;
u32 mask;
queue = PadMgr_LockSerialMesgQueue(padmgr);
@ -293,25 +279,24 @@ void PadMgr_HandleRetraceMsg(PadMgr* padmgr) {
padmgr->retraceCallback(padmgr, padmgr->retraceCallbackValue);
}
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
osContGetReadData(&padmgr->pads[0]);
osContGetReadData(padmgr->pads);
if (padmgr->preNMIShutdown) {
bzero(&padmgr->pads[0], 0x18);
bzero(padmgr->pads, sizeof(padmgr->pads));
}
PadMgr_ProcessInputs(padmgr);
osContStartQuery(queue);
osRecvMesg(queue, NULL, OS_MESG_BLOCK);
osContGetQuery(padmgr);
osContGetQuery(padmgr->padStatus);
PadMgr_UnlockSerialMesgQueue(padmgr, queue);
mask = 0;
for (i = 0; i - 4 != 0; ++i) {
if (padmgr->pad_status[i].errno == 0) {
if (padmgr->pad_status[i].type - 5 == 0) {
for (i = 0; i < 4; i++) {
if (padmgr->padStatus[i].errno == 0) {
if (padmgr->padStatus[i].type == 5) {
mask |= 1 << i;
} else {
LogUtils_LogThreadId("../padmgr.c", 0x1ca);
osSyncPrintf("this->pad_status[i].type = %x\n", padmgr->pad_status[i].type);
// EUC-JP: 知らない種類のコントローラが接続されています | An unknown type of controller is connected
LOG_HEX("this->pad_status[i].type", padmgr->padStatus[i].type, "../padmgr.c", 458);
// "An unknown type of controller is connected"
osSyncPrintf("知らない種類のコントローラが接続されています\n");
}
}
@ -333,63 +318,59 @@ void PadMgr_HandleRetraceMsg(PadMgr* padmgr) {
void PadMgr_HandlePreNMI(PadMgr* padmgr) {
osSyncPrintf("padmgr_HandlePreNMI()\n");
padmgr->preNMIShutdown = 1;
padmgr->preNMIShutdown = true;
PadMgr_RumbleReset(padmgr);
}
#ifdef NON_MATCHING
// Regalloc differences
void PadMgr_RequestPadData(PadMgr* padmgr, Input* inputs, s32 mode) {
u32 i;
Input* pmInputs;
Input* newin;
s32 i;
Input* ogInput;
Input* newInput;
s32 buttonDiff;
PadMgr_LockPadData(padmgr);
pmInputs = padmgr->inputs;
newin = inputs;
for (i = 0; i < 4; ++i) {
if (mode) {
*newin = *pmInputs;
pmInputs->press.in.button = 0;
pmInputs->press.in.x = 0;
pmInputs->press.in.y = 0;
pmInputs->rel.in.button = 0;
ogInput = &padmgr->inputs[0];
newInput = &inputs[0];
for (i = 0; i < 4; i++) {
if (mode != 0) {
*newInput = *ogInput;
ogInput->press.in.button = 0;
ogInput->press.in.x = 0;
ogInput->press.in.y = 0;
ogInput->rel.in.button = 0;
} else {
// Correct instructions, wrong regalloc
newin->prev = newin->cur;
newin->cur = pmInputs->cur;
newin->press.in.button = newin->cur.in.button & (newin->prev.in.button ^ newin->cur.in.button);
newin->rel.in.button = newin->prev.in.button & (newin->prev.in.button ^ newin->cur.in.button);
PadUtils_UpdateRelXY(newin);
newin->press.in.x = (newin->cur.in.x - newin->prev.in.x) + newin->press.in.x;
newin->press.in.y = (newin->cur.in.y - newin->prev.in.y) + newin->press.in.y;
newInput->prev = newInput->cur;
newInput->cur = ogInput->cur;
buttonDiff = newInput->prev.in.button ^ newInput->cur.in.button;
newInput->press.in.button = newInput->cur.in.button & buttonDiff;
newInput->rel.in.button = newInput->prev.in.button & buttonDiff;
PadUtils_UpdateRelXY(newInput);
newInput->press.in.x += (s8)(newInput->cur.in.x - newInput->prev.in.x);
newInput->press.in.y += (s8)(newInput->cur.in.y - newInput->prev.in.y);
}
++pmInputs;
++newin;
ogInput++;
newInput++;
}
PadMgr_UnlockPadData(padmgr);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/padmgr/PadMgr_RequestPadData.s")
#endif
// 800A2918 in 1.0
void PadMgr_MainProc(PadMgr* padmgr) {
s16* mesg;
void PadMgr_ThreadEntry(PadMgr* padmgr) {
s16* mesg = NULL;
s32 exit;
mesg = NULL;
// EUC-JP: コントローラスレッド実行開始 | Start of controller thread execution
// "Controller thread execution start"
osSyncPrintf("コントローラスレッド実行開始\n");
exit = 0;
exit = false;
while (!exit) {
if ((D_8012D280 > 2) && (padmgr->queue3.validCount == 0)) {
// EUC-JP: コントローラスレッドイベント待ち | Waiting for controller thread event
if ((D_8012D280 > 2) && (padmgr->interruptMsgQ.validCount == 0)) {
// "Waiting for controller thread event"
osSyncPrintf("コントローラスレッドイベント待ち %lld\n", OS_CYCLES_TO_USEC(osGetTime()));
}
osRecvMesg(&padmgr->queue3, &mesg, OS_MESG_BLOCK);
osRecvMesg(&padmgr->interruptMsgQ, &mesg, OS_MESG_BLOCK);
LogUtils_CheckNullPointer("msg", mesg, "../padmgr.c", 563);
switch (*mesg) {
@ -409,34 +390,35 @@ void PadMgr_MainProc(PadMgr* padmgr) {
PadMgr_HandlePreNMI(padmgr);
break;
case OS_SC_NMI_MSG:
exit = 1;
exit = true;
break;
}
}
IrqMgr_RemoveClient(padmgr->unk_78, &padmgr->unk_70);
// EUC-JP: コントローラスレッド実行終了 | Controller thread execution end
IrqMgr_RemoveClient(padmgr->irqMgr, &padmgr->irqClient);
// "Controller thread execution end"
osSyncPrintf("コントローラスレッド実行終了\n");
}
// func_800A2A14 in 1.0
void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* siIntMsgQ, UNK_TYPE arg2, OSId id, OSPri priority, void* stack) {
// EUC-JP: パッドマネージャ作成 | Create pad manager
void PadMgr_Init(PadMgr* padmgr, OSMesgQueue* siIntMsgQ, IrqMgr* irqMgr, OSId id, OSPri priority, void* stack) {
// "Pad Manager creation"
osSyncPrintf("パッドマネージャ作成 padmgr_Create()\n");
bzero(padmgr, sizeof(PadMgr));
padmgr->unk_78 = arg2;
osCreateMesgQueue(&padmgr->queue3, padmgr->msgbuf3, 4);
IrqMgr_AddClient(padmgr->unk_78, &padmgr->unk_70, &padmgr->queue3);
osCreateMesgQueue(&padmgr->queue1, padmgr->msgbuf1, 1);
bzero(padmgr, sizeof(PadMgr));
padmgr->irqMgr = irqMgr;
osCreateMesgQueue(&padmgr->interruptMsgQ, padmgr->interruptMsgBuf, 4);
IrqMgr_AddClient(padmgr->irqMgr, &padmgr->irqClient, &padmgr->interruptMsgQ);
osCreateMesgQueue(&padmgr->serialMsgQ, padmgr->serialMsgBuf, 1);
PadMgr_UnlockSerialMesgQueue(padmgr, siIntMsgQ);
osCreateMesgQueue(&padmgr->queue2, padmgr->msgbuf2, 1);
osCreateMesgQueue(&padmgr->lockMsgQ, padmgr->lockMsgBuf, 1);
PadMgr_UnlockPadData(padmgr);
func_800FCD40(siIntMsgQ, &padmgr->validCtrlrsMask, padmgr);
padmgr->ncontrollers = 4;
func_80104D00(padmgr->ncontrollers);
osCreateThread(&padmgr->thread, id, PadMgr_MainProc, padmgr, stack, priority);
osCreateThread(&padmgr->thread, id, PadMgr_ThreadEntry, padmgr, stack, priority);
osStartThread(&padmgr->thread);
}

View file

@ -3120,10 +3120,10 @@ void func_80062E14(GlobalContext* globalCtx, Vec3f* v, Vec3f* arg2) {
Audio_PlaySoundGeneral(NA_SE_IT_REFLECTION_WOOD, arg2, 4, &D_801333E0, &D_801333E0, &D_801333E8);
}
#if 0 // NON_MATCHING
#ifdef NON_EQUIVALENT
// Incomplete, possibly not using the same logic
s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_actor_pos, Vec3f* at_actor_pos, Vec3f* arg5, Vec3f* arg6,
Vec3f* arg7) {
s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_actor_pos, Vec3f* at_actor_pos,
Vec3f* arg5, Vec3f* arg6, Vec3f* arg7) {
// arg5 = SP + 0xA8, unk input
// arg6 = SP + 0x90, unk output
// arg7 = SP + 0x84, unk output2
@ -3161,7 +3161,7 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
phi_v0 = 0;
// ada12c: bc1f 0xada138 ~>
if (0.0f < delta_a3_a4_sp6C.y) {
if (0.0f < delta_a3_a4_sp6C.y) {
phi_v0 = 1;
}
// ada138: beqzl v0,0xada188 ~>
@ -3172,27 +3172,28 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
}
phi_v1 = 0;
if (0.0f < delta_a3_a5_sp60.y) { //ada19c: bc1f 0xada1a8 ~>
if (0.0f < delta_a3_a5_sp60.y) { // ada19c: bc1f 0xada1a8 ~>
phi_v1 = 1;
}
//ada1a8: beqzl v1,0xada1f4 ~>
// ada1a8: beqzl v1,0xada1f4 ~>
if (phi_v1 && delta_a3_a5_sp60.y < actor_ac_98_12) {
if (sqrtf(SQ(delta_a3_a5_sp60.x) + SQ(delta_a3_a5_sp60.z)) < actor_ac_98_10) {
return 3;
}
}
//ada1f4
// ada1f4
sp38 = SQ(delta_a3_a4_sp6C.x) + SQ(delta_a3_a4_sp6C.z) - SQ(actor_ac_98_10); // temp_f12;
temp_f2 = SQ(delta_a4_a5_sp54.x) + SQ(delta_a4_a5_sp54.z);
if (!(fabsf(temp_f2) < 0.008f)) { // ada23c: bc1t 0xada2f0 ~>
temp_f14 = (delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x + (delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z;
temp_f14 = (delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x +
(delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z;
temp_f0 = SQ(temp_f14);
temp_f12 = (4.0f * temp_f2) * sp38;
if (temp_f0 < temp_f12) { // ada280: bc1f 0xada290 ~>
return 0;
}
//ada290
// ada290
temp_f16_2 = temp_f0 - temp_f12;
temp_f0 = sqrtf(temp_f16_2);
if (0.0f < temp_f16_2) {
@ -3208,33 +3209,34 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
sp4C = (-temp_f14 - temp_f0) / (temp_f2 + temp_f2);
}
} else { // 0xada2f0
temp_f14 = ((delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x) + ((delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z);
temp_f14 = ((delta_a4_a5_sp54.x + delta_a4_a5_sp54.x) * delta_a3_a4_sp6C.x) +
((delta_a4_a5_sp54.z + delta_a4_a5_sp54.z) * delta_a3_a4_sp6C.z);
if (!(fabsf(temp_f14) < 0.008f)) { // ada324
phi_v0 = 0;
sp50 = -sp38 / temp_f14;
phi_v1 = 1;
} // ada340: b 0xada468
else {
if (sp38 <= 0.0f) { // ada358: bc1f 0xada460
if (sp38 <= 0.0f) { // ada358: bc1f 0xada460
phi_a0 = phi_v0;
if (phi_v0 != 0) // ada360: beqz v0,0xada388 ~>
{
phi_a0 = 0;
//ada37C
phi_a0 = 0;
// ada37C
if (delta_a3_a4_sp6C.y < actor_ac_98_12) {
phi_a0 = 1;
}
}
phi_a1 = phi_a0;
//ada38C
// ada38C
phi_a0 = phi_v1;
if (phi_v1 != 0) {
phi_a0 = 0;
phi_a0 = 0;
if (delta_a3_a5_sp60.y < actor_ac_98_12) {
phi_a0 = 1;
phi_a0 = 1;
}
}
if (phi_a1) { // ada3b4
if (phi_a1) { // ada3b4
if (phi_a0) { // ada3bc
*arg6 = delta_a3_a4_sp6C;
*arg7 = delta_a3_a5_sp60;
@ -3252,7 +3254,7 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
return 1;
}
}
//ada460
// ada460
return 0;
}
}
@ -3263,10 +3265,10 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
}
} else { // ada4a4
phi_a1 = 0;
if (sp50 < 0.0f) { //ada4ac
if (sp50 < 0.0f) { // ada4ac
phi_a1 = 1;
}
//ada4b8
// ada4b8
phi_a0 = phi_a1;
if (phi_a1 == 0) {
phi_a1 = 0;
@ -3274,7 +3276,7 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
phi_a1 = 1;
}
}
//ada4dc
// ada4dc
phi_a2 = 0;
if (sp4C < 0.0f) {
phi_a2 = 1;
@ -3339,7 +3341,7 @@ s32 func_80062ECC(f32 actor_ac_98_10, f32 actor_ac_98_12, f32 arg2, Vec3f* ac_ac
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_collision_check/func_80062ECC.s")
#endif // NON_MATCHING
#endif
s32 func_800635D0(s32 arg0) {
s32 result;

View file

@ -100,29 +100,29 @@ void func_801109B0(GlobalContext* globalCtx) {
if (gSaveContext.equips.buttonItems[0] < 0xF0) {
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x80, 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 198);
} else if (gSaveContext.equips.buttonItems[0] != 0xFF) {
DmaMgr_SendRequest1(interfaceCtx->icon_itemSegment,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x80, 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[0] * 0x1000, 0x1000,
"../z_construct.c", 203);
}
if (gSaveContext.equips.buttonItems[1] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x1000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[1] * 0x80, 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[1] * 0x1000, 0x1000,
"../z_construct.c", 209);
}
if (gSaveContext.equips.buttonItems[2] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x2000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[2] * 0x80, 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[2] * 0x1000, 0x1000,
"../z_construct.c", 214);
}
if (gSaveContext.equips.buttonItems[3] < 0xF0) {
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->icon_itemSegment + 0x3000),
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[3] * 0x80, 0x1000,
_icon_item_staticSegmentRomStart + gSaveContext.equips.buttonItems[3] * 0x1000, 0x1000,
"../z_construct.c", 219);
}

View file

@ -2775,9 +2775,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
// Start Button Texture, Color & Label
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0x78, 0x78, 0x78, interfaceCtx->startAlpha);
gSPTextureRectangle(gfxCtx->overlay.p++, sStartButtonLeftPos[gSaveContext.language] << 2, 156,
(sStartButtonLeftPos[gSaveContext.language] + 22) << 2, 68, G_TX_RENDERTILE, 0, 0, 1462,
1462);
gSPTextureRectangle(gfxCtx->overlay.p++, sStartButtonLeftPos[gSaveContext.language] << 2, 68,
(sStartButtonLeftPos[gSaveContext.language] + 22) << 2, 156, G_TX_RENDERTILE, 0, 0,
1462, 1462);
gDPPipeSync(gfxCtx->overlay.p++);
gDPSetPrimColor(gfxCtx->overlay.p++, 0, 0, 0xFF, 0xFF, 0xFF, interfaceCtx->startAlpha);
gDPSetEnvColor(gfxCtx->overlay.p++, 0x00, 0x00, 0x00, 0x00);
@ -2795,14 +2795,14 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetTile(gfxCtx->overlay.p++, G_IM_FMT_IA, G_IM_SIZ_4b, 3, 0, G_TX_RENDERTILE, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK,
G_TX_NOLOD);
gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 48, 16);
gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 188, 60);
temp = R_START_LABEL_DD(gSaveContext.language) / 100.0f;
gSPTextureRectangle(gfxCtx->overlay.p++, R_START_LABEL_X(gSaveContext.language) << 2,
R_START_LABEL_Y(gSaveContext.language) << 2,
(R_START_LABEL_X(gSaveContext.language) + (s16)(16 / temp)) << 2,
(R_START_LABEL_Y(gSaveContext.language) + (s16)(48 / temp)) << 2, G_TX_RENDERTILE, 0, 0,
(s16)(1024 / temp), (s16)(1024 / temp));
(R_START_LABEL_X(gSaveContext.language) + (s16)(16.0f / temp)) << 2,
(R_START_LABEL_Y(gSaveContext.language) + (s16)(48.0f / temp)) << 2, G_TX_RENDERTILE, 0,
0, (s16)(1024.0f / temp), (s16)(1024.0f / temp));
}
}
@ -2844,8 +2844,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
G_TX_NOLOD);
gDPSetTileSize(gfxCtx->overlay.p++, G_TX_RENDERTILE, 0, 0, 124, 28);
gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 8) << 2,
(R_C_UP_ICON_Y + 32) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024);
gSPTextureRectangle(gfxCtx->overlay.p++, R_C_UP_ICON_X << 2, R_C_UP_ICON_Y << 2, (R_C_UP_ICON_X + 32) << 2,
(R_C_UP_ICON_Y + 8) << 2, G_TX_RENDERTILE, 0, 0, 1024, 1024);
}
sCUpTimer--;
@ -3310,7 +3310,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
R_B_LABEL_DD = 1024.0f / (WREG(37 + gSaveContext.language) / 100.0f);
gSPTextureRectangle(gfxCtx->overlay.p++, R_B_LABEL_X(gSaveContext.language) << 2,
R_B_LABEL_Y(gSaveContext.language) << 2, (R_B_LABEL_X(gSaveContext.language) + 48) << 2,
R_B_LABEL_Y(gSaveContext.language) << 2, G_TX_RENDERTILE, 0, 0, R_B_LABEL_DD,
(R_B_LABEL_Y(gSaveContext.language) + 16) << 2, G_TX_RENDERTILE, 0, 0, R_B_LABEL_DD,
R_B_LABEL_DD);
}

View file

@ -1365,7 +1365,7 @@ void Gameplay_Main(GlobalContext* globalCtx) {
}
if (1 && HREG(63)) {
LOG_NUM("1", 1, "../z_play.c", 4583)
LOG_NUM("1", 1, "../z_play.c", 4583);
}
Gameplay_Draw(globalCtx);

View file

@ -128,20 +128,17 @@ s32 func_8008E9F8(Player* player, s32 arg1) {
#ifdef NON_MATCHING
// Regalloc only
void func_8008EA40(Player* player) {
s8 temp;
if ((s32)(player->stateFlags1 << 9) < 0) {
temp = player->unk_154;
if ((temp < 0) || (player->heldItemActionParam == temp)) {
if (player->stateFlags1 & 0x400000) {
if ((player->unk_154 < 0) || (player->heldItemActionParam == player->unk_154)) {
if (func_8008F1A0(player) == 0 && func_8008E9D0(player) == 0) {
player->unk_15D = 0xA;
player->unk_160 = gSaveContext.linkAge + D_80125F40[10];
player->unk_160 = gSaveContext.linkAge + &D_80125F40[10];
if (player->unk_15E == 0x12) {
player->unk_15E = 0x10;
} else if (player->unk_15E == 0x13) {
player->unk_15E = 0x11;
}
player->unk_168 = gSaveContext.linkAge + D_80125F40[player->unk_15E];
player->unk_168 = gSaveContext.linkAge + &D_80125F40[player->unk_15E];
player->unk_15B = 2;
player->unk_154 = -1;
}
@ -158,10 +155,10 @@ void func_8008EB2C(Player* player, s32 arg1) {
player->unk_15C = D_80125C98[(arg1 * 5) + 1];
player->unk_15D = D_80125C98[(arg1 * 5) + 2];
player->unk_15E = D_80125C98[(arg1 * 5) + 3];
player->unk_164 = gSaveContext.linkAge + D_80125F40[D_80125C98[(arg1 * 5) + 1]];
player->unk_160 = gSaveContext.linkAge + D_80125F40[D_80125C98[(arg1 * 5) + 2]];
player->unk_168 = gSaveContext.linkAge + D_80125F40[D_80125C98[(arg1 * 5) + 3]];
player->unk_16C = gSaveContext.linkAge + D_80125F40[D_80125C98[(arg1 * 5) + 4]];
player->unk_164 = gSaveContext.linkAge + &D_80125F40[D_80125C98[(arg1 * 5) + 1]];
player->unk_160 = gSaveContext.linkAge + &D_80125F40[D_80125C98[(arg1 * 5) + 2]];
player->unk_168 = gSaveContext.linkAge + &D_80125F40[D_80125C98[(arg1 * 5) + 3]];
player->unk_16C = gSaveContext.linkAge + &D_80125F40[D_80125C98[(arg1 * 5) + 4]];
func_8008EA40(player);
}
#else
@ -187,32 +184,30 @@ void func_8008EC70(Player* player) {
player->unk_6AD = 0;
}
#ifdef NON_MATCHING
// Regalloc, ITEM_NONE immediate not reused
void func_8008ECAC(GlobalContext* globalCtx, Player* player) {
s32 phi_v0;
s32 sword;
if (player->action != 0x56) {
player->currentShield = ((gSaveContext.equips.equipment & gEquipMasks[1]) >> gEquipShifts[1]);
player->currentTunic = (((gSaveContext.equips.equipment & gEquipMasks[2]) >> gEquipShifts[2]) - 1);
player->currentBoots = (((gSaveContext.equips.equipment & gEquipMasks[3]) >> gEquipShifts[3]) - 1);
player->currentShield = CUR_EQUIP_VALUE(EQUIP_SHIELD);
player->currentTunic = CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1;
player->currentBoots = CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1;
if (gSaveContext.buttonStatus[EQUIP_SWORD] == ITEM_NONE) {
player->currentSword = ITEM_NONE;
sword = ITEM_NONE;
player->currentSword = sword;
} else {
if (gSaveContext.equips.buttonItems[EQUIP_SWORD] == ITEM_SWORD_KNIFE) {
phi_v0 = ITEM_SWORD_BGS;
sword = ITEM_SWORD_BGS;
} else {
phi_v0 = gSaveContext.equips.buttonItems[EQUIP_SWORD];
sword = gSaveContext.equips.buttonItems[EQUIP_SWORD];
}
player->currentSword = phi_v0;
player->currentSword = sword;
}
func_8008EC04(player, func_8008E9F8(player, player->heldItemActionParam));
func_8008E750(globalCtx, player);
}
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_8008ECAC.s")
#endif
void func_8008ED9C(GlobalContext* globalCtx, Player* player, s32 item, s32 arg2) {
Inventory_UpdateBottleItem(globalCtx, item, player->heldItemCButtonIdx);
@ -509,14 +504,10 @@ void func_800906D4(GlobalContext* globalCtx, Player* player, ColliderTrisItemDim
}
}
#ifdef NON_MATCHING
// Regalloc, single stack difference
void func_800907E4(GlobalContext* globalCtx, Player* player, Vec3f* arg2, s32 arg3) {
f32 sp4C;
GraphicsContext* gfxCtx;
Gfx* dispRefs[4];
s32 temp_at;
f32 sp28;
sp4C = (player->exchangeItemId != 0) ? 6.0f : 14.0f;
gfxCtx = globalCtx->state.gfxCtx;
@ -526,19 +517,13 @@ void func_800907E4(GlobalContext* globalCtx, Player* player, Vec3f* arg2, s32 ar
gSPSegment(gfxCtx->polyOpa.p++, 0x06, player->getItemModel);
gSPSegment(gfxCtx->polyXlu.p++, 0x06, player->getItemModel);
sp28 = Math_Sins(player->actor.shape.rot.y);
Matrix_Translate((sp28 * 3.299999952316284f) + arg2->x, arg2->y + sp4C,
(Math_Coss(player->actor.shape.rot.y) * (3.299999952316284f + (IREG(90) / 10.0f))) + arg2->z,
MTXMODE_NEW);
temp_at = globalCtx->gameplayFrames;
Matrix_RotateZYX(0.0f, ((((globalCtx->gameplayFrames << 5) - temp_at) * 4) + temp_at) * 8, 0.0f, MTXMODE_APPLY);
Matrix_Scale(0.20000000298023224f, 0.20000000298023224f, 0.20000000298023224f, MTXMODE_APPLY);
Matrix_Translate(arg2->x + (Math_Sins(player->actor.shape.rot.y) * 3.3f), arg2->y + sp4C,
arg2->z + ((3.3f + (IREG(90) / 10.0f)) * Math_Coss(player->actor.shape.rot.y)), MTXMODE_NEW);
Matrix_RotateRPY(0, globalCtx->gameplayFrames * 1000, 0, MTXMODE_APPLY);
Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY);
func_800694A0(globalCtx, arg3 - 1);
Graph_CloseDisps(dispRefs, globalCtx->state.gfxCtx, "../z_player_lib.c", 0x975);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_player_lib/func_800907E4.s")
#endif
void func_800909B4(GlobalContext* globalCtx, Player* player) {
if ((player->unk_170 == 0) || !osRecvMesg(&player->unk_194, NULL, OS_MESG_NOBLOCK)) {

View file

@ -514,7 +514,6 @@ void SkelAnime_AnimateFrame(AnimationHeader* animationSeg, s32 currentFrame, s32
for (i = 0; i < limbCount; i++, dst++, index++) {
if ((dst == NULL) || (index == NULL) || (frameRotationValueTable == NULL) || (rotationValueTable == NULL)) {
if (1) {} // Necessary to match.
LOG_ADDRESS("out", dst, "../z_skelanime.c", 1392);
LOG_ADDRESS("ref_tbl", index, "../z_skelanime.c", 1393);
LOG_ADDRESS("frame_tbl", frameRotationValueTable, "../z_skelanime.c", 1394);