1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-13 03:14:38 +00:00

Merge commit '8ee485d2e7' into doc_pause_menu

This commit is contained in:
Dragorn421 2024-08-01 21:47:53 +02:00
commit 4dd0649478
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
28 changed files with 488 additions and 85 deletions

View file

@ -53,18 +53,25 @@ endif
# Version-specific settings
ifeq ($(VERSION),gc-us)
REGION := US
PAL := 0
MQ := 0
DEBUG := 0
COMPARE := 0
CPP_DEFINES += -DOOT_NTSC=1 -DOOT_PAL=0 -DOOT_MQ=0
else ifeq ($(VERSION),gc-eu)
REGION := EU
PAL := 1
MQ := 0
DEBUG := 0
CPP_DEFINES += -DOOT_NTSC=0 -DOOT_PAL=1 -DOOT_MQ=0
else ifeq ($(VERSION),gc-eu-mq)
REGION := EU
PAL := 1
MQ := 1
DEBUG := 0
CPP_DEFINES += -DOOT_NTSC=0 -DOOT_PAL=1 -DOOT_MQ=1
else ifeq ($(VERSION),gc-eu-mq-dbg)
REGION := EU
PAL := 1
MQ := 1
DEBUG := 1
CPP_DEFINES += -DOOT_NTSC=0 -DOOT_PAL=1 -DOOT_MQ=1
else
$(error Unsupported version $(VERSION))
endif
@ -79,11 +86,28 @@ VENV := .venv
MAKE = make
CPPFLAGS += -P -xc -fno-dollars-in-identifiers
# Converts e.g. ntsc-1.0 to OOT_NTSC_1_0
VERSION_MACRO := OOT_$(shell echo $(VERSION) | tr a-z-. A-Z__)
CPP_DEFINES += -DOOT_VERSION=$(VERSION_MACRO)
CPP_DEFINES += -DOOT_REGION=REGION_$(REGION)
ifeq ($(PAL),0)
CPP_DEFINES += -DOOT_NTSC=1
else
CPP_DEFINES += -DOOT_PAL=1
endif
ifeq ($(MQ),0)
CPP_DEFINES += -DOOT_MQ=0
else
CPP_DEFINES += -DOOT_MQ=1
endif
ifeq ($(DEBUG),1)
CPP_DEFINES += -DOOT_DEBUG=1
OPTFLAGS := -O2
else
CPP_DEFINES += -DNDEBUG -DOOT_DEBUG=0
CPP_DEFINES += -DOOT_DEBUG=0 -DNDEBUG
OPTFLAGS := -O2 -g3
endif
@ -170,7 +194,7 @@ endif
CFLAGS += $(GBI_DEFINES)
ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude
ASFLAGS := -march=vr4300 -32 -no-pad-sections -Iinclude -I$(EXTRACTED_DIR)
ifeq ($(COMPILER),gcc)
CFLAGS += -G 0 -nostdinc $(INC) -march=vr4300 -mfix4300 -mabi=32 -mno-abicalls -mdivide-breaks -fno-PIC -fno-common -ffreestanding -fbuiltin -fno-builtin-sinf -fno-builtin-cosf $(CHECK_WARNINGS) -funsigned-char
@ -262,7 +286,16 @@ TEXTURE_FILES_OUT := $(foreach f,$(TEXTURE_FILES_PNG_EXTRACTED:.png=.inc.c),$(f:
$(foreach f,$(TEXTURE_FILES_JPG_COMMITTED:.jpg=.jpg.inc.c),$(BUILD_DIR)/$f)
# create build directories
$(shell mkdir -p $(BUILD_DIR)/baserom $(BUILD_DIR)/assets/text $(foreach dir,$(SRC_DIRS) $(UNDECOMPILED_DATA_DIRS),$(BUILD_DIR)/$(dir)) $(foreach dir,$(ASSET_BIN_DIRS),$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)))
$(shell mkdir -p $(BUILD_DIR)/baserom \
$(BUILD_DIR)/assets/text \
$(foreach dir, \
$(SRC_DIRS) \
$(UNDECOMPILED_DATA_DIRS) \
$(ASSET_BIN_DIRS_COMMITTED), \
$(BUILD_DIR)/$(dir)) \
$(foreach dir, \
$(ASSET_BIN_DIRS_EXTRACTED), \
$(dir:$(EXTRACTED_DIR)/%=$(BUILD_DIR)/%)))
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/stackcheck.o: OPTFLAGS := -O2
@ -394,6 +427,7 @@ setup: venv
$(MAKE) -C tools
$(PYTHON) tools/decompress_baserom.py $(VERSION)
$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 --oot-version $(VERSION) -o $(EXTRACTED_DIR)/baserom
$(PYTHON) tools/extract_incbins.py $(EXTRACTED_DIR)/baserom --oot-version $(VERSION) -o $(EXTRACTED_DIR)/incbin
$(PYTHON) tools/msgdis.py $(VERSION)
$(PYTHON) extract_assets.py -v $(VERSION) -j$(N_THREADS)
@ -448,7 +482,7 @@ $(BUILD_DIR)/baserom/%.o: $(EXTRACTED_DIR)/baserom/%
$(OBJCOPY) -I binary -O elf32-big $< $@
$(BUILD_DIR)/data/%.o: data/%.s
$(AS) $(ASFLAGS) $< -o $@
$(CPP) $(CPPFLAGS) -Iinclude $< | $(AS) $(ASFLAGS) -o $@
$(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt
$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding jpn --charmap assets/text/charmap.txt - $@

View file

@ -1,5 +1,70 @@
dmadata_start: 0x12F70
text_lang_pal: true
incbins:
- name: ipl3
segment: makerom
vram: 0x80000040
size: 0xFC0
- name: rspbootText
segment: boot
vram: 0x80009320
size: 0xD0
- name: aspMainText
segment: code
vram: 0x801120C0
size: 0xFB0
- name: gspS2DEX2d_fifoText
segment: code
vram: 0x80113070
size: 0x18C0
- name: njpgdspMainText
segment: code
vram: 0x80114930
size: 0xAF0
- name: gMojiFontTLUTs
segment: code
vram: 0x8012A740
size: 0x80
- name: gMojiFontTex
segment: code
vram: 0x8012A7C0
size: 0x400
- name: gSoundFontTable
segment: code
vram: 0x801550D0
size: 0x270
- name: gSequenceFontTable
segment: code
vram: 0x80155340
size: 0x1C0
- name: gSequenceTable
segment: code
vram: 0x80155500
size: 0x6F0
- name: gSampleBankTable
segment: code
vram: 0x80155BF0
size: 0x80
- name: aspMainData
segment: code
vram: 0x80155C70
size: 0x2E0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x80155F50
size: 0x1630
- name: gspF3DZEX2_NoN_PosLight_fifoData
segment: code
vram: 0x80157580
size: 0x420
- name: gspS2DEX2d_fifoData
segment: code
vram: 0x801579A0
size: 0x390
- name: njpgdspMainData
segment: code
vram: 0x80157D30
size: 0x60
variables:
gMtxClear: 0x8012DB20
sNesMessageEntryTable: 0x8014B320

View file

@ -1,5 +1,62 @@
dmadata_start: 0x7170
text_lang_pal: true
incbins:
- name: ipl3
segment: makerom
vram: 0x80000040
size: 0xFC0
- name: rspbootText
segment: boot
vram: 0x80005FC0
size: 0xD0
- name: aspMainText
segment: code
vram: 0x800E11A0
size: 0xFB0
- name: gspS2DEX2d_fifoText
segment: code
vram: 0x800E2150
size: 0x18C0
- name: njpgdspMainText
segment: code
vram: 0x800E3A10
size: 0xAF0
- name: gSoundFontTable
segment: code
vram: 0x80110470
size: 0x270
- name: gSequenceFontTable
segment: code
vram: 0x801106E0
size: 0x1C0
- name: gSequenceTable
segment: code
vram: 0x801108A0
size: 0x6F0
- name: gSampleBankTable
segment: code
vram: 0x80110F90
size: 0x80
- name: aspMainData
segment: code
vram: 0x80111010
size: 0x2E0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x801112F0
size: 0x1630
- name: gspF3DZEX2_NoN_PosLight_fifoData
segment: code
vram: 0x80112920
size: 0x420
- name: gspS2DEX2d_fifoData
segment: code
vram: 0x80112D40
size: 0x390
- name: njpgdspMainData
segment: code
vram: 0x801130D0
size: 0x60
variables:
gMtxClear: 0x800FBC00
sNesMessageEntryTable: 0x801077F0

View file

@ -1,5 +1,62 @@
dmadata_start: 0x7170
text_lang_pal: true
incbins:
- name: ipl3
segment: makerom
vram: 0x80000040
size: 0xFC0
- name: rspbootText
segment: boot
vram: 0x80005FC0
size: 0xD0
- name: aspMainText
segment: code
vram: 0x800E11C0
size: 0xFB0
- name: gspS2DEX2d_fifoText
segment: code
vram: 0x800E2170
size: 0x18C0
- name: njpgdspMainText
segment: code
vram: 0x800E3A30
size: 0xAF0
- name: gSoundFontTable
segment: code
vram: 0x80110490
size: 0x270
- name: gSequenceFontTable
segment: code
vram: 0x80110700
size: 0x1C0
- name: gSequenceTable
segment: code
vram: 0x801108C0
size: 0x6F0
- name: gSampleBankTable
segment: code
vram: 0x80110FB0
size: 0x80
- name: aspMainData
segment: code
vram: 0x80111030
size: 0x2E0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x80111310
size: 0x1630
- name: gspF3DZEX2_NoN_PosLight_fifoData
segment: code
vram: 0x80112940
size: 0x420
- name: gspS2DEX2d_fifoData
segment: code
vram: 0x80112D60
size: 0x390
- name: njpgdspMainData
segment: code
vram: 0x801130F0
size: 0x60
variables:
gMtxClear: 0x800FBC20
sNesMessageEntryTable: 0x80107810

View file

@ -1,5 +1,62 @@
dmadata_start: 0x7170
text_lang_pal: false
incbins:
- name: ipl3
segment: makerom
vram: 0x80000040
size: 0xFC0
- name: rspbootText
segment: boot
vram: 0x80005FC0
size: 0xD0
- name: aspMainText
segment: code
vram: 0x800E3840
size: 0xFB0
- name: gspS2DEX2d_fifoText
segment: code
vram: 0x800E47F0
size: 0x18C0
- name: njpgdspMainText
segment: code
vram: 0x800E60B0
size: 0xAF0
- name: gSoundFontTable
segment: code
vram: 0x80112C80
size: 0x270
- name: gSequenceFontTable
segment: code
vram: 0x80112EF0
size: 0x1C0
- name: gSequenceTable
segment: code
vram: 0x801130B0
size: 0x6F0
- name: gSampleBankTable
segment: code
vram: 0x801137A0
size: 0x80
- name: aspMainData
segment: code
vram: 0x80113820
size: 0x2E0
- name: gspF3DZEX2_NoN_PosLight_fifoText
segment: code
vram: 0x80113B00
size: 0x1630
- name: gspF3DZEX2_NoN_PosLight_fifoData
segment: code
vram: 0x80115130
size: 0x420
- name: gspS2DEX2d_fifoData
segment: code
vram: 0x80115550
size: 0x390
- name: njpgdspMainData
segment: code
vram: 0x801158E0
size: 0x60
variables:
gMtxClear: 0x800FE2A0
sJpnMessageEntryTable: 0x80109E8C

View file

@ -1,22 +1,22 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .rodata
.balign 16
glabel gSoundFontTable
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCC270, 0x270
.incbin "incbin/gSoundFontTable"
glabel gSequenceFontTable
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCC4E0, 0x1C0
.incbin "incbin/gSequenceFontTable"
glabel gSequenceTable
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCC6A0, 0x6F0
.incbin "incbin/gSequenceTable"
glabel gSampleBankTable
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCCD90, 0x80
.incbin "incbin/gSampleBankTable"

View file

@ -1,30 +1,30 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .rodata
.balign 16
glabel aspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCCE10, 0x2E0
.incbin "incbin/aspMainData"
glabel aspMainDataEnd
glabel gspF3DZEX2_NoN_PosLight_fifoTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCD0F0, 0x1630
.incbin "incbin/gspF3DZEX2_NoN_PosLight_fifoText"
glabel gspF3DZEX2_NoN_PosLight_fifoTextEnd
glabel gspF3DZEX2_NoN_PosLight_fifoDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCE720, 0x420
.incbin "incbin/gspF3DZEX2_NoN_PosLight_fifoData"
glabel gspF3DZEX2_NoN_PosLight_fifoDataEnd
glabel gspS2DEX2d_fifoDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEB40, 0x390
.incbin "incbin/gspS2DEX2d_fifoData"
glabel gspS2DEX2d_fifoDataEnd
glabel njpgdspMainDataStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBCEED0, 0x60
.incbin "incbin/njpgdspMainData"
glabel njpgdspMainDataEnd

View file

@ -1,22 +1,22 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .text
.balign 16
glabel aspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB89260, 0xFB0
.incbin "incbin/aspMainText"
glabel aspMainTextEnd
glabel gspS2DEX2d_fifoTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8A210, 0x18C0
.incbin "incbin/gspS2DEX2d_fifoText"
glabel gspS2DEX2d_fifoTextEnd
glabel njpgdspMainTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xB8BAD0, 0xAF0
.incbin "incbin/njpgdspMainText"
glabel njpgdspMainTextEnd

View file

@ -1,14 +1,14 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .text
.balign 16
glabel rspbootTextStart
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0x9F20, 0xD0
.incbin "incbin/rspbootText"
glabel rspbootTextEnd

View file

@ -1,17 +1,18 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data
.balign 16
# Unused.
# This appears to be RSP code, however it is not part of
# rspboot as rspbootTextEnd is at this symbol
/* Unused.
* This appears to be RSP code, however it is not part of
* rspboot as rspbootTextEnd is at this symbol.
*/
glabel D_800093F0
.word 0xE80C2001 # sqv $v12[0], 0x10($zero)
.word 0x34014000 # li $1, 0x4000

View file

@ -1,15 +1,15 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data
.balign 16
# Unused
/* Unused */
glabel D_80009410
.word osStopThread
.word __osSetHWIntrRoutine

View file

@ -1,15 +1,15 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data
.balign 16
# Unused
/* Unused */
glabel D_8012ABC0
.word fmodf
.word guScale

View file

@ -1,18 +1,20 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data
.balign 16
# temporary file name, rename to something more appropriate when decompiled
/* temporary file name, rename to something more appropriate when decompiled */
#if OOT_DEBUG
glabel gMojiFontTLUTs
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBA18E0, 0x80
.incbin "incbin/gMojiFontTLUTs"
glabel gMojiFontTex
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0xBA1960, 0x400
.incbin "incbin/gMojiFontTex"
#endif

View file

@ -37,10 +37,10 @@ Large code block, click to show
```
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
/* assembler directives */
.set noat /* allow manual use of $at */
.set noreorder /* don't insert nops after branches */
.set gp=64 /* allow use of 64-bit general purpose registers */
.section .data

View file

@ -1,6 +1,16 @@
#ifndef MACROS_H
#define MACROS_H
// OOT versions in build order
#define OOT_GC_JP 1
#define OOT_GC_JP_MQ 2
#define OOT_GC_US 3
#define OOT_GC_US_MQ 4
#define OOT_GC_EU_MQ_DBG 5
#define OOT_GC_EU 6
#define OOT_GC_EU_MQ 7
#define OOT_GC_JP_CE 8
#ifndef AVOID_UB
#define BAD_RETURN(type) type
#else

9
include/region.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef REGION_H
#define REGION_H
#define REGION_NULL 0
#define REGION_JP 1
#define REGION_US 2
#define REGION_EU 3
#endif

View file

@ -70,11 +70,6 @@
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
#define REGION_NULL 0
#define REGION_JP 1
#define REGION_US 2
#define REGION_EU 3
#define THREAD_PRI_IDLE_INIT 10
#define THREAD_PRI_MAIN_INIT 10
#define THREAD_PRI_DMAMGR_LOW 10 // Used when decompressing files
@ -104,9 +99,6 @@
#define STACK_TOP(stack) \
((u8*)(stack) + sizeof(stack))
// NOTE: Once we start supporting other builds, this can be changed with an ifdef
#define REGION_NATIVE REGION_EU
typedef struct {
/* 0x00 */ void* loadedRamAddr;
/* 0x04 */ RomFile file;

View file

@ -1,12 +1,17 @@
#include "macros.h"
const char gBuildTeam[] = "zelda@srd022j";
// TODO: Use per-version preprocessor defines
#if OOT_DEBUG // gc-eu-mq-dbg
#if OOT_VERSION == OOT_GC_US
const char gBuildDate[] = "02-12-19 13:28:09";
#elif OOT_VERSION == OOT_GC_EU_MQ_DBG
const char gBuildDate[] = "03-02-21 00:16:31";
#elif !OOT_MQ // gc-eu
#elif OOT_VERSION == OOT_GC_EU
const char gBuildDate[] = "03-02-21 20:12:23";
#else // gc-eu-mq
#elif OOT_VERSION == OOT_GC_EU_MQ
const char gBuildDate[] = "03-02-21 20:37:19";
#else
#error "Unsupported OOT_VERSION"
#endif
const char gBuildMakeOption[] = "";

View file

@ -1,4 +1,5 @@
#include "global.h"
#include "region.h"
#include "terminal.h"
u32 gCurrentRegion = 0;
@ -35,7 +36,7 @@ void Locale_ResetRegion(void) {
#if OOT_DEBUG
u32 func_80001F48(void) {
if (gCurrentRegion == REGION_NATIVE) {
if (gCurrentRegion == OOT_REGION) {
return 0;
}
@ -47,7 +48,7 @@ u32 func_80001F48(void) {
}
u32 func_80001F8C(void) {
if (gCurrentRegion == REGION_NATIVE) {
if (gCurrentRegion == OOT_REGION) {
return 0;
}
@ -60,6 +61,6 @@ u32 func_80001F8C(void) {
// This function appears to be unused?
u32 Locale_IsRegionNative(void) {
return gCurrentRegion == REGION_NATIVE;
return gCurrentRegion == OOT_REGION;
}
#endif

View file

@ -689,7 +689,7 @@ void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void*
SceneTableEntry* loadedScene = play->loadedScene;
u32 size = loadedScene->titleFile.vromEnd - loadedScene->titleFile.vromStart;
if ((size != 0) && (size <= 0x3000)) {
if ((size != 0) && (size <= 0x1000 * LANGUAGE_MAX)) {
DMA_REQUEST_SYNC(texture, loadedScene->titleFile.vromStart, size, "../z_actor.c", 2765);
}
@ -733,7 +733,15 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) {
OPEN_DISPS(play->state.gfxCtx, "../z_actor.c", 2824);
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
textureLanguageOffset = 0;
} else {
textureLanguageOffset = width * height;
}
#else
textureLanguageOffset = width * height * gSaveContext.language;
#endif
height = (width * height > 0x1000) ? 0x1000 / width : height;
titleSecondY = titleY + (height * 4);

View file

@ -24,4 +24,7 @@ void SaveContext_Init(void) {
gSaveContext.dogIsLost = true;
gSaveContext.nextTransitionType = TRANS_NEXT_TYPE_DEFAULT;
gSaveContext.prevHudVisibilityMode = HUD_VISIBILITY_ALL;
#if OOT_NTSC
gSaveContext.language = LANGUAGE_ENG;
#endif
}

View file

@ -168,7 +168,11 @@ void Play_SetupTransition(PlayState* this, s32 transitionType) {
break;
default:
#if OOT_NTSC
HUNGUP_AND_CRASH("../z_play.c", 2287);
#else
HUNGUP_AND_CRASH("../z_play.c", 2290);
#endif
break;
}
}

View file

@ -1,4 +1,4 @@
.section .text
.incbin "baseroms/gc-eu-mq-dbg/baserom-decompressed.z64", 0x40, 0xFC0
.incbin "incbin/ipl3"

View file

@ -1,4 +1,5 @@
#include "rom_header.h"
#include "region.h"
/* 0x00 */ ENDIAN_IDENTIFIER
/* 0x01 */ PI_DOMAIN_1_CFG(64, 18, 7, 3)
@ -9,7 +10,17 @@
/* 0x18 */ PADDING(8)
/* 0x20 */ ROM_NAME("THE LEGEND OF ZELDA")
/* 0x34 */ PADDING(7)
#if OOT_NTSC
/* 0x3B */ MEDIUM(CARTRIDGE_EXPANDABLE)
#else
/* 0x3B */ MEDIUM(CARTRIDGE)
#endif
/* 0x3C */ GAME_ID("ZL")
#if OOT_REGION == REGION_US
/* 0x3E */ REGION(US)
#elif OOT_REGION == REGION_JP
/* 0x3E */ REGION(JP)
#elif OOT_REGION == REGION_EU
/* 0x3E */ REGION(PAL)
#endif
/* 0x3F */ GAME_REVISION(15)

View file

@ -5759,8 +5759,18 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &sStreamSfxPos, &sStreamSfxProjectedPos, &sProjectedW);
Sfx_PlaySfxAtPos(&sStreamSfxProjectedPos, NA_SE_EV_WATER_WALL - SFX_FLAG);
// convert length to weight. Theoretical max of 59 lbs (127^2*.0036+.5)
#if OOT_NTSC
if (gSaveContext.language == LANGUAGE_JPN) {
gSaveContext.minigameScore = sFishLengthToWeigh;
} else {
// Convert length to weight. Theoretical max of 59 lbs (127^2*.0036+.5)
gSaveContext.minigameScore = (SQ((f32)sFishLengthToWeigh) * 0.0036f) + 0.5f;
}
#else
// Same as above, but for PAL
gSaveContext.minigameScore = (SQ((f32)sFishLengthToWeigh) * 0.0036f) + 0.5f;
#endif
#if OOT_DEBUG
if (BREG(26) != 0) {

View file

@ -10113,7 +10113,11 @@ void Player_Init(Actor* thisx, PlayState* play2) {
Player_SetEquipmentData(play, this);
this->prevBoots = this->currentBoots;
Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.save.linkAge)]);
this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x3008, "../z_player.c", 17175) + 8) & ~0xF);
// `giObjectSegment` is used for both "get item" objects and title cards. The maximum size for
// get item objects is 0x2000 (see the assert in func_8083AE40), and the maximum size for
// title cards is 0x1000 * LANGUAGE_MAX since each title card image includes all languages.
this->giObjectSegment =
(void*)(((uintptr_t)ZELDA_ARENA_MALLOC(0x1000 * LANGUAGE_MAX + 8, "../z_player.c", 17175) + 8) & ~0xF);
respawnFlag = gSaveContext.respawnFlag;

54
tools/extract_incbins.py Executable file
View file

@ -0,0 +1,54 @@
#!/usr/bin/env python3
# SPDX-FileCopyrightText: © 2024 ZeldaRET
# SPDX-License-Identifier: CC0-1.0
from __future__ import annotations
import argparse
from pathlib import Path
import sys
import dmadata
import version_config
def main():
parser = argparse.ArgumentParser(
description="Extract incbin pieces from an uncompressed ROM."
)
parser.add_argument(
"baserom_dir", metavar="BASEROM_DIR", type=Path, help="Directory of uncompressed ROM segments"
)
parser.add_argument(
"-v",
"--oot-version",
required=True,
help="OOT version",
)
parser.add_argument(
"-o",
"--output-dir",
type=Path,
required=True,
help="Output directory for incbin pieces",
)
args = parser.parse_args()
config = version_config.load_version_config(args.oot_version)
args.output_dir.mkdir(parents=True, exist_ok=True)
for incbin in config.incbins:
incbin_path = args.output_dir / incbin.name
with open(args.baserom_dir / incbin.segment, "rb") as f:
offset = incbin.vram - config.dmadata_segments[incbin.segment].vram
f.seek(offset)
incbin_data = f.read(incbin.size)
incbin_path.write_bytes(incbin_data)
print(f"Extracted {len(config.incbins)} incbin pieces to {args.output_dir}")
if __name__ == "__main__":
main()

View file

@ -26,6 +26,8 @@ class VersionConfig:
text_lang_pal: bool
# DMA segment information, in ROM order
dmadata_segments: OrderedDict[str, SegmentInfo]
# ROM pieces that are copied directly into the build with .incbin
incbins: list[IncbinConfig]
# Addresses of important variables needed for asset extraction
variables: dict[str, int]
# Assets to extract
@ -38,6 +40,14 @@ class SegmentInfo:
vram: Optional[int]
@dataclasses.dataclass
class IncbinConfig:
name: str
segment: str
vram: int
size: int
@dataclasses.dataclass
class AssetConfig:
name: str
@ -61,6 +71,14 @@ def load_version_config(version: str) -> VersionConfig:
with open(PROJECT_ROOT / f"baseroms/{version}/config.yml", "r") as f:
config = yaml.load(f, Loader=yaml.Loader)
incbins = []
for incbin in config["incbins"]:
incbins.append(
IncbinConfig(
incbin["name"], incbin["segment"], incbin["vram"], incbin["size"]
)
)
assets = []
for asset in config["assets"]:
name = asset["name"]
@ -74,6 +92,7 @@ def load_version_config(version: str) -> VersionConfig:
dmadata_start=config["dmadata_start"],
text_lang_pal=config["text_lang_pal"],
dmadata_segments=load_dmadata_segments(version),
incbins=incbins,
variables=config["variables"],
assets=assets,
)