Merge remote-tracking branch 'upstream/master' into decomp_merge

This commit is contained in:
Yanis42
2023-09-03 16:05:13 +02:00
16 changed files with 118 additions and 4 deletions

View File

@@ -2,6 +2,8 @@
#include "message_data_fmt.h"
#include "config.h"
#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_fra[sizeof(fraMessage)] = { fraMessage END };

View File

@@ -2,6 +2,8 @@
#include "message_data_fmt.h"
#include "config.h"
#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_ger[sizeof(gerMessage)] = { gerMessage END };

View File

@@ -2,6 +2,8 @@
#include "message_data_fmt.h"
#include "config.h"
#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_nes[sizeof(nesMessage)] = { nesMessage END };

View File

@@ -2,6 +2,8 @@
#include "message_data_fmt.h"
#include "config.h"
#define DEFINE_MESSAGE(textId, type, yPos, staffMessage) \
const char _message_##textId##_staff[sizeof(staffMessage)] = { staffMessage END };

View File

@@ -183,3 +183,4 @@ def main():
if __name__ == "__main__":
main()
os.system("python3 tools/daf/daf.py -a -p ./")

View File

@@ -59,4 +59,9 @@
*/
// #define DISABLE_DEBUG_FEATURES
/**
* Disable autoscroll on crash debugger
*/
#define DISABLE_CRASH_DBG_AUTOSCROLL
#endif

View File

@@ -5,6 +5,12 @@
* GAME SETTINGS *
*****************/
// Fix annoying glitches (crashes and softlocks)
#define FIX_ANNOYING_GLITCH
// Add a fix for the Stale Reference Manipulation glitch (OoT's Pandora's Box)
#define FIX_SRM
/**
* Enable mempak-related code
*/
@@ -28,13 +34,26 @@
/**
* Enable fast text
*/
#define ENABLE_FAST_TEXT
// #define ENABLE_FAST_TEXT
/**
* Splits Farore's Wind warp point across ages. One point for child Link, one point for adult Link.
*/
// #define FW_SPLIT_AGE
/* Apply the anti-aliasing filter for the background of the pause menu. This adds a delay when pausing. */
// #define VANILLA_PAUSE_DELAY
/**
* Disable Player froze when getting a Gold Skulltula Token
*/
#define DISABLE_GS_TOKEN_FREEZE
/**
* Add Gold Skulltula count to the textbox
*/
#define GS_COUNT_IN_TEXT
/**
* Applies the anti-aliasing filter for the background of the pause menu.
* Note: this adds a significant delay when pausing.

View File

@@ -4,6 +4,8 @@
#include "ultra64.h"
#include "padmgr.h"
#include "config.h"
// These are the same as the 3-bit ansi color codes
#define FAULT_COLOR_BLACK 0
#define FAULT_COLOR_RED 1
@@ -76,7 +78,9 @@ typedef struct FaultMgr {
/* 0x7CC */ u8 exit;
/* 0x7CD */ u8 msgId;
/* 0x7CE */ u8 faultHandlerEnabled;
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
/* 0x7CF */ u8 autoScroll;
#endif
/* 0x7D0 */ OSThread* faultedThread;
/* 0x7D4 */ void (*padCallback)(Input* inputs);
/* 0x7D8 */ FaultClient* clients;

View File

@@ -4,6 +4,8 @@
#include "global.h"
#include "message_data_fmt.h"
#include "config.h"
typedef enum {
/* 0 */ TEXTBOX_TYPE_BLACK,
/* 1 */ TEXTBOX_TYPE_WOODEN,

View File

@@ -44,6 +44,8 @@
#include "terminal.h"
#include "alloca.h"
#include "config.h"
void FaultDrawer_Init(void);
void FaultDrawer_SetOsSyncPrintfEnabled(u32 enabled);
void FaultDrawer_DrawRecImpl(s32 xStart, s32 yStart, s32 xEnd, s32 yEnd, u16 color);
@@ -391,15 +393,19 @@ u32 Fault_WaitForInputImpl(void) {
pressedBtn = input->press.button;
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
if (pressedBtn == BTN_L) {
sFaultInstance->autoScroll = !sFaultInstance->autoScroll;
}
#endif
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
if (sFaultInstance->autoScroll) {
if (count-- < 1) {
return false;
}
} else {
#endif
if (pressedBtn == BTN_A || pressedBtn == BTN_DRIGHT) {
return false;
}
@@ -415,7 +421,9 @@ u32 Fault_WaitForInputImpl(void) {
if (pressedBtn == BTN_DDOWN) {
FaultDrawer_SetOsSyncPrintfEnabled(false);
}
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
}
#endif
}
}
@@ -647,7 +655,9 @@ void Fault_Wait5Seconds(void) {
Fault_Sleep(1000 / 60);
} while ((osGetTime() - start) < OS_SEC_TO_CYCLES(5) + 1);
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
sFaultInstance->autoScroll = true;
#endif
}
void Fault_DrawMemDumpContents(const char* title, uintptr_t addr, u32 arg2) {
@@ -729,6 +739,7 @@ void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_
Fault_DrawMemDumpContents("Dump", addr, 0);
scrollCountdown = 600;
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
while (sFaultInstance->autoScroll) {
// Count down until it's time to move on to the next page
if (scrollCountdown == 0) {
@@ -743,6 +754,7 @@ void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_
sFaultInstance->autoScroll = false;
}
}
#endif
// Wait for input
do {
@@ -786,8 +798,10 @@ void Fault_DrawMemDump(uintptr_t pc, uintptr_t sp, uintptr_t cLeftJump, uintptr_
}
} while (!CHECK_BTN_ALL(input->press.button, BTN_L));
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
// Resume auto-scroll and move to next page
sFaultInstance->autoScroll = true;
#endif
}
/**
@@ -1056,15 +1070,21 @@ void Fault_ThreadEntry(void* arg) {
// Show fault framebuffer
Fault_DisplayFrameBuffer();
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
if (sFaultInstance->autoScroll) {
Fault_Wait5Seconds();
} else {
#endif
// Draw error bar signifying the crash screen is available
Fault_DrawCornerRec(GPACK_RGBA5551(255, 0, 0, 1));
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
}
#endif
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
// Set auto-scrolling and default colors
sFaultInstance->autoScroll = true;
#endif
FaultDrawer_SetForeColor(GPACK_RGBA5551(255, 255, 255, 1));
FaultDrawer_SetBackColor(GPACK_RGBA5551(0, 0, 0, 0));
@@ -1115,7 +1135,9 @@ void Fault_Init(void) {
sFaultInstance->faultedThread = NULL;
sFaultInstance->padCallback = Fault_PadCallback;
sFaultInstance->clients = NULL;
#ifndef DISABLE_CRASH_DBG_AUTOSCROLL
sFaultInstance->autoScroll = false;
#endif
gFaultMgr.faultHandlerEnabled = true;
osCreateMesgQueue(&sFaultInstance->queue, &sFaultInstance->msg, 1);
StackCheck_Init(&sFaultThreadInfo, sFaultStack, STACK_TOP(sFaultStack), 0, 0x100, "fault");

View File

@@ -2996,6 +2996,12 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) {
Actor_FreeOverlay(overlayEntry);
}
#ifdef FIX_SRM
// this is required to avoid having actor data still loaded in RAM after it's supposed to be deleted
// see func_80031B14
Actor_Kill(actor);
#endif
return newHead;
}

View File

@@ -3224,7 +3224,11 @@ void Message_Update(PlayState* play) {
break;
case MSGMODE_TEXT_NEXT_MSG:
Message_Decode(play);
#ifdef DISABLE_GS_TOKEN_FREEZE
if (sTextFade && (msgCtx->textId != 0xB4) && (msgCtx->textId != 0xB5)) {
#else
if (sTextFade) {
#endif
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING);
}
if (D_80153D74 != 0) {

View File

@@ -1827,9 +1827,12 @@ u8 Item_Give(PlayState* play, u8 item) {
}
}
} else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) {
#ifndef FIX_ANNOYING_GLITCH
// this conflicts with the flag used for the deku nut upgrade from the theater
if (item == ITEM_POACHERS_SAW) {
SET_ITEMGETINF(ITEMGETINF_1F);
}
#endif
temp = INV_CONTENT(item);
INV_CONTENT(item) = item;

View File

@@ -6,6 +6,8 @@
#include "z_en_si.h"
#include "config.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_9)
void EnSi_Init(Actor* thisx, PlayState* play);
@@ -93,7 +95,9 @@ void func_80AFB768(EnSi* this, PlayState* play) {
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER;
Item_Give(play, ITEM_SKULL_TOKEN);
#ifndef DISABLE_GS_TOKEN_FREEZE
player->actor.freezeTimer = 10;
#endif
Message_StartTextbox(play, 0xB4, NULL);
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
this->actionFunc = func_80AFB950;
@@ -115,7 +119,9 @@ void func_80AFB89C(EnSi* this, PlayState* play) {
if (!CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_13)) {
Item_Give(play, ITEM_SKULL_TOKEN);
#ifndef DISABLE_GS_TOKEN_FREEZE
player->actor.freezeTimer = 10;
#endif
Message_StartTextbox(play, 0xB4, NULL);
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
this->actionFunc = func_80AFB950;
@@ -125,12 +131,16 @@ void func_80AFB89C(EnSi* this, PlayState* play) {
void func_80AFB950(EnSi* this, PlayState* play) {
Player* player = GET_PLAYER(play);
#ifndef DISABLE_GS_TOKEN_FREEZE
if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) {
player->actor.freezeTimer = 10;
} else {
#endif
SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF);
Actor_Kill(&this->actor);
#ifndef DISABLE_GS_TOKEN_FREEZE
}
#endif
}
void EnSi_Update(Actor* thisx, PlayState* play) {

View File

@@ -8,6 +8,8 @@
#include "z_item_shield.h"
#include "assets/objects/object_link_child/object_link_child.h"
#include "config.h"
#define FLAGS ACTOR_FLAG_4
void ItemShield_Init(Actor* thisx, PlayState* play);
@@ -219,6 +221,9 @@ void ItemShield_Draw(Actor* thisx, PlayState* play) {
if (!(this->unk_19C & 2)) {
OPEN_DISPS(play->state.gfxCtx, "../z_item_shield.c", 457);
#ifdef FIX_ANNOYING_GLITCH
gSPSegment(POLY_OPA_DISP++, 0x0C, gCullBackDList);
#endif
Gfx_SetupDL_25Opa(play->state.gfxCtx);
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_item_shield.c", 460),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);

View File

@@ -380,15 +380,40 @@ def extract_all_text(text_out, staff_text_out):
if message[0] == 0xFFFC:
out += "#ifdef DEFINE_MESSAGE_FFFC\n"
out += f"DEFINE_MESSAGE(0x{message[0]:04X}, {textbox_type[message[1]]}, {textbox_ypos[message[2]]},"
out += "\n"
out += f"{message[3]}" + ("\n" if message[3] != "" else "") + ","
if message[0] in [0x00B4, 0x00B5]:
out += "#ifndef GS_COUNT_IN_TEXT\n"
tokenFreezeMode = (
"#ifdef DISABLE_GS_TOKEN_FREEZE\n"
+ "FADE(\"\\x20\")\n"
+ "#endif\n"
) if message[0] in [0x00B4, 0x00B5] else ""
out += f"{message[3]}" + ("\n" if message[3] != "" else "") + f"{tokenFreezeMode},"
out += "\n" if message[3] != "" else ""
out += f"{message[4]}" + ("\n" if message[4] != "" else "") + ","
out += f"{message[4]}" + ("\n" if message[4] != "" else "") + f"{tokenFreezeMode},"
out += "\n" if message[4] != "" else ""
out += f"{message[5]}\n)"
out += f"{message[5]}\n" + tokenFreezeMode
if message[0] in [0x00B4, 0x00B5]:
out += "#else\n"
out += "\"You got a \" COLOR(RED) \"Gold Skulltula Token\" COLOR(DEFAULT) \"!\\n\"\n"
out += f"\"You've collected \" COLOR(RED) TOKENS COLOR(DEFAULT) \" tokens in total.\"\n{tokenFreezeMode},\n"
out += "\"Du hast eine \" COLOR(RED) \"Goldene Skulltula\" COLOR(DEFAULT) \" zerstört!\\n\"\n"
out += f"\"Sie haben insgesamt \" COLOR(RED) TOKENS COLOR(DEFAULT) \" gesammelt.\"\n{tokenFreezeMode},\n"
out += "\"Vous venez de détruire une \" COLOR(RED) \"Skulltula d'or\" COLOR(DEFAULT) \"!\\n\"\n"
out += f"\"Vous en avez désormais \" COLOR(RED) TOKENS COLOR(DEFAULT) \".\"\n{tokenFreezeMode}"
out += "#endif\n"
out += ")"
if message[0] == 0xFFFC:
out += "\n#endif"
out += "\n\n"
with open(text_out, "w", encoding="utf8") as outfile: