mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-03 22:44:30 +00:00
Match/Improve more non matching functions (#366)
* Match/Improve more non matchings * Remove SET_NEXT_GAMESTATE from preserved macros
This commit is contained in:
parent
2a2fdf7f3e
commit
b4ac94a8fd
25 changed files with 138 additions and 3869 deletions
|
@ -5,25 +5,19 @@ void func_80110990(GlobalContext* globalCtx) {
|
|||
Map_Destroy(globalCtx);
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc, stack usage and minor ordering differences
|
||||
void func_801109B0(GlobalContext* globalCtx) {
|
||||
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
|
||||
s32 parameterStart;
|
||||
s32 parameterSize;
|
||||
s32 do_actionStart;
|
||||
s32 do_actionOffset;
|
||||
s32 temp;
|
||||
u32 parameterSize;
|
||||
u16 do_actionOffset;
|
||||
u8 temp;
|
||||
|
||||
gSaveContext.unk_1422 = 0;
|
||||
gSaveContext.unk_13EA = 0;
|
||||
gSaveContext.unk_13E8 = 0;
|
||||
gSaveContext.unk_13E8 = gSaveContext.unk_13EA = 0;
|
||||
|
||||
View_Init(&interfaceCtx->view, globalCtx->state.gfxCtx);
|
||||
|
||||
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = 0;
|
||||
interfaceCtx->unk_1FA = interfaceCtx->unk_261 = interfaceCtx->unk_1FC = 0;
|
||||
interfaceCtx->unk_1F0 = 0;
|
||||
interfaceCtx->unk_1EC = interfaceCtx->unk_1EE = interfaceCtx->unk_1F0 = 0;
|
||||
interfaceCtx->unk_22E = 0;
|
||||
interfaceCtx->unk_230 = 16;
|
||||
interfaceCtx->unk_1F4 = 0.0f;
|
||||
|
@ -34,34 +28,32 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
interfaceCtx->cDownAlpha = interfaceCtx->cRightAlpha = interfaceCtx->healthAlpha = interfaceCtx->startAlpha =
|
||||
interfaceCtx->magicAlpha = 0;
|
||||
|
||||
parameterStart = _parameter_staticSegmentRomStart;
|
||||
parameterSize = _parameter_staticSegmentRomEnd - parameterStart;
|
||||
parameterSize = (u32)_parameter_staticSegmentRomEnd - (u32)_parameter_staticSegmentRomStart;
|
||||
|
||||
// Translates to: "Permanent PARAMETER Segment = %x"
|
||||
osSyncPrintf("常駐PARAMETERセグメント=%x\n", parameterSize);
|
||||
|
||||
interfaceCtx->parameterSegment = GameState_Alloc(&globalCtx->state, parameterSize, "../z_construct.c", 159);
|
||||
|
||||
osSyncPrintf("parameter->parameterSegment=%x", interfaceCtx->parameterSegment);
|
||||
osSyncPrintf("parameter->parameterSegment=%x\n", interfaceCtx->parameterSegment);
|
||||
|
||||
if (interfaceCtx->parameterSegment == NULL) {
|
||||
__assert("parameter->parameterSegment != NULL", "../z_construct.c", 161);
|
||||
}
|
||||
|
||||
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, parameterStart, parameterSize, "../z_construct.c", 162);
|
||||
DmaMgr_SendRequest1(interfaceCtx->parameterSegment, (u32)_parameter_staticSegmentRomStart, parameterSize,
|
||||
"../z_construct.c", 162);
|
||||
|
||||
interfaceCtx->do_actionSegment = GameState_Alloc(&globalCtx->state, 0x480, "../z_construct.c", 166);
|
||||
|
||||
// Translates to: "DO Action Texture Initialization"
|
||||
osSyncPrintf("DOアクション テクスチャ初期=%x\n", 0x480);
|
||||
osSyncPrintf("parameter->do_actionSegment=%x", interfaceCtx->do_actionSegment);
|
||||
osSyncPrintf("parameter->do_actionSegment=%x\n", interfaceCtx->do_actionSegment);
|
||||
|
||||
if (interfaceCtx->do_actionSegment == NULL) {
|
||||
__assert("parameter->do_actionSegment != NULL", "../z_construct.c", 169);
|
||||
}
|
||||
|
||||
do_actionStart = _do_action_staticSegmentRomStart;
|
||||
|
||||
if (gSaveContext.language == 0) {
|
||||
do_actionOffset = 0;
|
||||
} else if (gSaveContext.language == 1) {
|
||||
|
@ -70,8 +62,8 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
do_actionOffset = 0x5700;
|
||||
}
|
||||
|
||||
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, do_actionStart + do_actionOffset, 0x300, "../z_construct.c",
|
||||
174);
|
||||
DmaMgr_SendRequest1(interfaceCtx->do_actionSegment, (u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x300,
|
||||
"../z_construct.c", 174);
|
||||
|
||||
if (gSaveContext.language == 0) {
|
||||
do_actionOffset = 0x480;
|
||||
|
@ -81,8 +73,8 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
do_actionOffset = 0x5B80;
|
||||
}
|
||||
|
||||
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300), do_actionStart + do_actionOffset, 0x180,
|
||||
"../z_construct.c", 178);
|
||||
DmaMgr_SendRequest1((void*)((u32)interfaceCtx->do_actionSegment + 0x300),
|
||||
(u32)_do_action_staticSegmentRomStart + do_actionOffset, 0x180, "../z_construct.c", 178);
|
||||
|
||||
interfaceCtx->icon_itemSegment = GameState_Alloc(&globalCtx->state, 0x4000, "../z_construct.c", 190);
|
||||
|
||||
|
@ -126,11 +118,11 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
"../z_construct.c", 219);
|
||||
}
|
||||
|
||||
osSyncPrintf("EVENT=%d\n", gSaveContext.timer1State);
|
||||
osSyncPrintf("EVENT=%d\n", ((void)0, gSaveContext.timer1State));
|
||||
|
||||
if ((gSaveContext.timer1State == 4) || (gSaveContext.timer1State == 8) || (gSaveContext.timer2State == 4) ||
|
||||
(gSaveContext.timer2State == 10)) {
|
||||
osSyncPrintf("restart_flag=%d\n", gSaveContext.respawnFlag);
|
||||
osSyncPrintf("restart_flag=%d\n", ((void)0, gSaveContext.respawnFlag));
|
||||
|
||||
if ((gSaveContext.respawnFlag == -1) || (gSaveContext.respawnFlag == 1)) {
|
||||
if (gSaveContext.timer1State == 4) {
|
||||
|
@ -167,8 +159,7 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
Health_InitData(globalCtx);
|
||||
Map_Init(globalCtx);
|
||||
|
||||
interfaceCtx->unk_242 = 0;
|
||||
interfaceCtx->unk_23C = 0;
|
||||
interfaceCtx->unk_23C = interfaceCtx->unk_242 = 0;
|
||||
|
||||
R_ITEM_BTN_X(0) = 160;
|
||||
R_B_BTN_COLOR(0) = 255;
|
||||
|
@ -182,9 +173,6 @@ void func_801109B0(GlobalContext* globalCtx) {
|
|||
R_A_BTN_COLOR(1) = 200;
|
||||
R_A_BTN_COLOR(2) = 50;
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_construct/func_801109B0.s")
|
||||
#endif
|
||||
|
||||
void func_80110F68(GlobalContext* globalCtx) {
|
||||
MessageContext* msgCtx = &globalCtx->msgCtx;
|
||||
|
|
|
@ -129,14 +129,12 @@ s32 EffectSpark_Update(void* thisx) {
|
|||
}
|
||||
|
||||
// original name: "EffectSparkInfo_disp"
|
||||
#ifdef NON_MATCHING
|
||||
// minor ordering and saved register usage differences
|
||||
void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
||||
Vtx* vertices;
|
||||
EffectSpark* this = (EffectSpark*)thisx; // sp1E0
|
||||
EffectSparkElement* elem;
|
||||
EffectSpark* this = (EffectSpark*)thisx;
|
||||
GlobalContext* globalCtx;
|
||||
f32 ratio;
|
||||
s32 i;
|
||||
s32 j;
|
||||
u8 sp1D3;
|
||||
u8 sp1D2;
|
||||
u8 sp1D1;
|
||||
|
@ -153,11 +151,12 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
u8 sp1C6;
|
||||
u8 sp1C5;
|
||||
u8 sp1C4;
|
||||
s32 i;
|
||||
s32 j;
|
||||
f32 ratio;
|
||||
|
||||
globalCtx = Effect_GetGlobalCtx();
|
||||
|
||||
if (1) {}
|
||||
|
||||
OPEN_DISPS(gfxCtx, "../z_eff_spark.c", 293);
|
||||
|
||||
if (this != NULL) {
|
||||
|
@ -182,7 +181,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
if (vertices == NULL) {
|
||||
// Translates to: "Memory Allocation Failure graph_malloc"
|
||||
osSyncPrintf("EffectSparkInfo_disp():メモリー確保失敗 graph_malloc\n");
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
|
@ -210,6 +209,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
MtxF spEC;
|
||||
MtxF spAC;
|
||||
MtxF sp6C;
|
||||
EffectSparkElement* elem;
|
||||
Mtx* mtx;
|
||||
f32 temp;
|
||||
|
||||
|
@ -267,11 +267,9 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
|
||||
j += 4;
|
||||
|
||||
if (this) {}
|
||||
|
||||
mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C);
|
||||
if (mtx == NULL) {
|
||||
break;
|
||||
goto end;
|
||||
}
|
||||
|
||||
gSPMatrix(oGfxCtx->polyXlu.p++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
@ -282,8 +280,6 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
|
|||
gDPPipeSync(oGfxCtx->polyXlu.p++);
|
||||
}
|
||||
|
||||
end:
|
||||
CLOSE_DISPS(gfxCtx, "../z_eff_spark.c", 498);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eff_spark/EffectSpark_Draw.s")
|
||||
#endif
|
||||
|
|
|
@ -14,18 +14,17 @@ ElfMessage sAdultSariaMsgs[] = {
|
|||
{ 0x06, 0x30, 0x6C, 0x69 }, { 0x06, 0x30, 0x6C, 0x6A }, { 0xE0, 0x00, 0x6D, 0x00 },
|
||||
};
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// minor ordering and regalloc differences
|
||||
u32 ElfMessage_CheckCondition(ElfMessage* msg) {
|
||||
u16 temp;
|
||||
s32 type = msg->byte0 & 0x1E;
|
||||
u16 flag;
|
||||
|
||||
switch (msg->byte0 & 0x1E) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
temp = 1 << (msg->byte1 & 0x0F);
|
||||
return ((msg->byte0 & 1) == 1) == !!(gSaveContext.eventChkInf[(msg->byte1 & 0xF0) >> 4] & temp);
|
||||
flag = 1 << (msg->byte1 & 0x0F);
|
||||
return ((msg->byte0 & 1) == 1) == ((flag & gSaveContext.eventChkInf[(msg->byte1 & 0xF0) >> 4]) != 0);
|
||||
case 2:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
!!(gBitFlags[msg->byte1 - ITEM_KEY_BOSS] & gSaveContext.dungeonItems[gSaveContext.mapIndex]);
|
||||
((gSaveContext.dungeonItems[gSaveContext.mapIndex] & gBitFlags[msg->byte1 - ITEM_KEY_BOSS]) != 0);
|
||||
case 4:
|
||||
return ((msg->byte0 & 1) == 1) == (msg->byte3 == INV_CONTENT(msg->byte1));
|
||||
case 6:
|
||||
|
@ -34,16 +33,16 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
|
|||
return ((msg->byte0 & 1) == 1) == ((msg->byte1 & 0x0F) == CUR_UPG_VALUE(UPG_STRENGTH));
|
||||
case 0x10:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
!!((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
|
||||
gSaveContext.equipment);
|
||||
(((gBitFlags[msg->byte3 - ITEM_BOOTS_KOKIRI] << gEquipShifts[EQUIP_BOOTS]) &
|
||||
gSaveContext.equipment) != 0);
|
||||
case 0x20:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
!!(CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET));
|
||||
((CHECK_QUEST_ITEM(msg->byte3 - ITEM_SONG_MINUET + QUEST_SONG_MINUET)) != 0);
|
||||
case 0x30:
|
||||
return ((msg->byte0 & 1) == 1) ==
|
||||
!!(CHECK_QUEST_ITEM(msg->byte3 - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST));
|
||||
((CHECK_QUEST_ITEM(msg->byte3 - ITEM_MEDALLION_FOREST + QUEST_MEDALLION_FOREST)) != 0);
|
||||
case 0x40:
|
||||
return ((msg->byte0 & 1) == 1) == !!gSaveContext.magicAcquired;
|
||||
return ((msg->byte0 & 1) == 1) == (((void)0, gSaveContext.magicAcquired) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,10 +52,6 @@ u32 ElfMessage_CheckCondition(ElfMessage* msg) {
|
|||
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
u32 ElfMessage_CheckCondition(ElfMessage* msg);
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_elf_message/ElfMessage_CheckCondition.s")
|
||||
#endif
|
||||
|
||||
u32 func_8006BE88(ElfMessage** msgp) {
|
||||
u32 temp = true;
|
||||
|
|
|
@ -36,6 +36,7 @@ void TransitionFade_Destroy(TransitionFade* this) {
|
|||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// ordering differences
|
||||
void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
|
||||
char pad[2];
|
||||
s16 newAlpha;
|
||||
|
@ -50,7 +51,7 @@ void TransitionFade_Update(TransitionFade* this, s32 updateRate) {
|
|||
this->fadeTimer = gSaveContext.fadeDuration;
|
||||
this->isDone = 1;
|
||||
}
|
||||
if (gSaveContext.fadeDuration == 0) {
|
||||
if (!gSaveContext.fadeDuration) {
|
||||
// Divide by 0! Zero is included in ZCommonGet fade_speed
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "0除算! ZCommonGet fade_speed に0がはいってる" VT_RST);
|
||||
}
|
||||
|
|
|
@ -142,8 +142,6 @@ typedef struct {
|
|||
/* 0x10 */ s16 type;
|
||||
} struct_8011F9B8;
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc differences
|
||||
void func_8006D684(GlobalContext* globalCtx, Player* player) {
|
||||
s32 pad;
|
||||
s32 i;
|
||||
|
@ -203,9 +201,9 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
|
|||
|
||||
for (i = 0; i < ARRAY_COUNT(D_8011F9B8); i++) {
|
||||
if ((globalCtx->sceneNum == D_8011F9B8[i].scene) &&
|
||||
(gSaveContext.cutsceneIndex == D_8011F9B8[i].cutsceneIndex)) {
|
||||
(((void)0, gSaveContext.cutsceneIndex) == D_8011F9B8[i].cutsceneIndex)) {
|
||||
if (D_8011F9B8[i].type == 7) {
|
||||
if ((globalCtx->sceneNum == 99) && (gSaveContext.cutsceneIndex == 0xFFF1)) {
|
||||
if ((globalCtx->sceneNum == 99) && (((void)0, gSaveContext.cutsceneIndex) == 0xFFF1)) {
|
||||
D_8011F9B8[i].pos.x = player->actor.posRot.pos.x;
|
||||
D_8011F9B8[i].pos.y = player->actor.posRot.pos.y;
|
||||
D_8011F9B8[i].pos.z = player->actor.posRot.pos.z;
|
||||
|
@ -223,7 +221,6 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
|
|||
} else if ((D_8011F9B8[i].type == 5) || (D_8011F9B8[i].type == 6) || (D_8011F9B8[i].type == 8)) {
|
||||
Vec3f sp54;
|
||||
s32 temp;
|
||||
s32 pad2;
|
||||
|
||||
temp = 0;
|
||||
if (((gSaveContext.eventInf[0] & 0x10) >> 4) && D_8011F9B8[i].type == 6) {
|
||||
|
@ -261,21 +258,6 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
Vec3s D_8011F9A0[] = {
|
||||
{ 0xF46F, 0x0139, 0x1E14 },
|
||||
{ 0xF894, 0x0139, 0x1B67 },
|
||||
{ 0xF035, 0x0139, 0x1B15 },
|
||||
{ 0xF6F7, 0x0139, 0x1766 },
|
||||
};
|
||||
struct_8011F9B8 D_8011F9B8[] = {
|
||||
{ 93, 0xFFF0, 0x0E10, 0x0585, 0x0168, 0x8001, 8 }, { 99, 0xFFF0, 0xFF06, 0x0001, 0xF9D4, 0x4000, 6 },
|
||||
{ 99, 0xFFF1, 0x0000, 0x0000, 0x0000, 0x0000, 5 }, { 99, 0xFFF5, 0x0000, 0x0000, 0x0000, 0x0000, 7 },
|
||||
{ 81, 0xFFF3, 0xF46F, 0x0139, 0x1E14, 0x0000, 7 }, { 81, 0xFFF4, 0xF894, 0x0139, 0x1B67, 0x0000, 7 },
|
||||
{ 81, 0xFFF5, 0xF035, 0x0139, 0x1B15, 0x0000, 7 }, { 81, 0xFFF6, 0xF035, 0x0139, 0x1B15, 0x0000, 7 },
|
||||
};
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_horse/func_8006D684.s")
|
||||
#endif
|
||||
|
||||
void func_8006DC68(GlobalContext* globalCtx, Player* player) {
|
||||
if (LINK_IS_ADULT) {
|
||||
|
|
|
@ -311,11 +311,10 @@ void Map_Init(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef NON_MATCHING
|
||||
// regalloc and minor ordering differences
|
||||
void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Player* player = PLAYER;
|
||||
s16 tempX, tempY, tempZ;
|
||||
s16 tempX, tempZ;
|
||||
|
||||
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565);
|
||||
|
||||
|
@ -335,8 +334,8 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
|
|||
Matrix_Translate((R_COMPASS_OFFSET_X + tempX) / 10.0f, (R_COMPASS_OFFSET_Y - tempZ) / 10.0f, 0.0f, MTXMODE_NEW);
|
||||
Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY);
|
||||
Matrix_RotateX(-1.6f, MTXMODE_APPLY);
|
||||
tempY = (0x7FFF - player->actor.shape.rot.y) / 0x400;
|
||||
Matrix_RotateY(tempY / 10.0f, MTXMODE_APPLY);
|
||||
tempX = (0x7FFF - player->actor.shape.rot.y) / 0x400;
|
||||
Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY);
|
||||
gSPMatrix(oGfxCtx->overlay.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_map_exp.c", 585),
|
||||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
|
||||
|
||||
|
@ -360,9 +359,6 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) {
|
|||
|
||||
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 607);
|
||||
}
|
||||
#else
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_map_exp/Minimap_DrawCompassIcons.s")
|
||||
#endif
|
||||
|
||||
void Minimap_Draw(GlobalContext* globalCtx) {
|
||||
s32 pad[2];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue