Skip to content

Commit

Permalink
Merge remote-tracking branch 'decomp/main' into decomp_update_3
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanis002 committed Jul 3, 2024
2 parents 71b5a4e + baf1e8c commit 19a98d5
Show file tree
Hide file tree
Showing 22 changed files with 1,311 additions and 714 deletions.
32 changes: 20 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,21 @@ endif
# Version-specific settings
ifeq ($(VERSION),gc-us)
DEBUG := 0
CPP_DEFINES += -DTEXT_LANGUAGE=TEXT_LANG_US_JP
else ifeq ($(VERSION),gc-eu)
DEBUG := 0
CPP_DEFINES += -DTEXT_LANGUAGE=TEXT_LANG_EU
HACKEROOT := 0
else ifeq ($(VERSION),gc-eu-mq)
DEBUG := 0
CPP_DEFINES += -DOOT_MQ
CPP_DEFINES += -DTEXT_LANGUAGE=TEXT_LANG_EU -DOOT_MQ
HACKEROOT := 0
else ifeq ($(VERSION),gc-eu-mq-dbg)
DEBUG := 1
CPP_DEFINES += -DOOT_MQ
CPP_DEFINES += -DTEXT_LANGUAGE=TEXT_LANG_EU -DOOT_MQ
HACKEROOT := 0
else ifeq ($(VERSION),hackeroot-mq)
CPP_DEFINES += -DOOT_MQ
CPP_DEFINES += -DTEXT_LANGUAGE=TEXT_LANG_EU -DOOT_MQ
HACKEROOT := 1
else
$(error Unsupported version $(VERSION))
Expand Down Expand Up @@ -213,6 +215,7 @@ INC := -Iinclude -Iinclude/libc -Isrc -I$(BUILD_DIR) -I. -I$(EXTRACTED_DIR)

# Check code syntax with host compiler
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces
CHECK_WARNINGS += -Werror=implicit-function-declaration

# The `cpp` command behaves differently on macOS (it behaves as if
# `-traditional-cpp` was passed) so we use `gcc -E` instead.
Expand Down Expand Up @@ -435,7 +438,7 @@ setup: venv
$(V)$(PYTHON) tools/decompress_baserom.py $(VERSION)
$(call print,Decompressing baserom: Done!)
$(V)$(PYTHON) tools/extract_baserom.py $(BASEROM_DIR)/baserom-decompressed.z64 --oot-version $(VERSION) -o $(EXTRACTED_DIR)/baserom
$(V)$(PYTHON) tools/msgdis.py --oot-version $(VERSION) --text-out $(EXTRACTED_DIR)/text/message_data.h --staff-text-out $(EXTRACTED_DIR)/text/message_data_staff.h
$(V)$(PYTHON) tools/msgdis.py $(VERSION)
$(V)$(PYTHON) extract_assets.py -v $(VERSION) -j$(N_THREADS)
$(call print,Extracting files: Done!)
ifeq ($(VERSION),hackeroot-mq)
Expand Down Expand Up @@ -541,22 +544,27 @@ $(BUILD_DIR)/data/%.o: data/%.s
$(call print,Assembling:,$<,$@)
$(V)$(AS) $(ASFLAGS) $< -o $@

$(BUILD_DIR)/assets/text/%.enc.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt
$(BUILD_DIR)/assets/text/%.enc.jpn.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt
$(call print,Encoding:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py - --output $@ --charmap assets/text/charmap.txt
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding jpn --charmap assets/text/charmap.txt - $@

$(BUILD_DIR)/assets/text/%.enc.nes.h: assets/text/%.h $(EXTRACTED_DIR)/text/%.h assets/text/charmap.txt
$(call print,Encoding:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -I$(EXTRACTED_DIR) $< | $(PYTHON) tools/msgenc.py --encoding nes --charmap assets/text/charmap.txt - $@

# Dependencies for files including message data headers
# TODO remove when full header dependencies are used.
$(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
$(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
$(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.h
$(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.h
$(BUILD_DIR)/src/code/z_message_PAL.o: $(BUILD_DIR)/assets/text/message_data.enc.h $(BUILD_DIR)/assets/text/message_data_staff.enc.h
$(BUILD_DIR)/assets/text/jpn_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.jpn.h
$(BUILD_DIR)/assets/text/nes_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
$(BUILD_DIR)/assets/text/ger_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
$(BUILD_DIR)/assets/text/fra_message_data_static.o: $(BUILD_DIR)/assets/text/message_data.enc.nes.h
$(BUILD_DIR)/assets/text/staff_message_data_static.o: $(BUILD_DIR)/assets/text/message_data_staff.enc.nes.h
$(BUILD_DIR)/src/code/z_message_PAL.o: assets/text/message_data.h assets/text/message_data_staff.h

$(BUILD_DIR)/assets/text/%.o: assets/text/%.c
$(call print,Compiling:,$<,$@)
$(V)$(CC) -c $(CFLAGS) $(MIPS_VERSION) $(OPTFLAGS) -o $@ $<
$(V)$(OBJCOPY) -O binary $@ $@.bin
$(V)$(OBJCOPY) -O binary -j.rodata $@ $@.bin

$(BUILD_DIR)/assets/%.o: $(EXTRACTED_DIR)/assets/%.c
$(call print,Compiling:,$<,$@)
Expand Down
100 changes: 54 additions & 46 deletions assets/text/charmap.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,58 @@
# Determines how certain text sequences should be encoded. The text sequence is
# converted to either the first or second tuple element based on whether the
# target encoding is the "wide" encoding. The first element is for the non-wide
# encoding, used for all languages besides JP, while the second element is for
# the wide encoding, used for JP.
{
'\n' : 0x01,
'\n' : (0x01, 0x000A),

'‾' : 0x7F,
'À' : 0x80,
'î' : 0x81,
'Â' : 0x82,
'Ä' : 0x83,
'Ç' : 0x84,
'È' : 0x85,
'É' : 0x86,
'Ê' : 0x87,
'Ë' : 0x88,
'Ï' : 0x89,
'Ô' : 0x8A,
'Ö' : 0x8B,
'Ù' : 0x8C,
'Û' : 0x8D,
'Ü' : 0x8E,
'ß' : 0x8F,
'à' : 0x90,
'á' : 0x91,
'â' : 0x92,
'ä' : 0x93,
'ç' : 0x94,
'è' : 0x95,
'é' : 0x96,
'ê' : 0x97,
'ë' : 0x98,
'ï' : 0x99,
'ô' : 0x9A,
'ö' : 0x9B,
'ù' : 0x9C,
'û' : 0x9D,
'ü' : 0x9E,
'[A]' : (0x9F, 0x839F),
'[B]' : (0xA0, 0x83A0),
'[C]' : (0xA1, 0x83A1),
'[L]' : (0xA2, 0x83A2),
'[R]' : (0xA3, 0x83A3),
'[Z]' : (0xA4, 0x83A4),
'[C-Up]' : (0xA5, 0x83A5),
'[C-Down]' : (0xA6, 0x83A6),
'[C-Left]' : (0xA7, 0x83A7),
'[C-Right]' : (0xA8, 0x83A8),
'▼' : (0xA9, 0x83A9),
'[Control-Pad]' : (0xAA, 0x83AA),
'[D-Pad]' : (0xAB, None),

'[A]' : 0x9F,
'[B]' : 0xA0,
'[C]' : 0xA1,
'[L]' : 0xA2,
'[R]' : 0xA3,
'[Z]' : 0xA4,
'[C-Up]' : 0xA5,
'[C-Down]' : 0xA6,
'[C-Left]' : 0xA7,
'[C-Right]' : 0xA8,
'▼' : 0xA9,
'[Control-Pad]' : 0xAA,
'[D-Pad]' : 0xAB,
# Possibly from a SHIFT-JIS extension, python doesn't have builtin support
'┯' : (None, 0x86D3),

'‾' : (0x7F, None),
'À' : (0x80, None),
'î' : (0x81, None),
'Â' : (0x82, None),
'Ä' : (0x83, None),
'Ç' : (0x84, None),
'È' : (0x85, None),
'É' : (0x86, None),
'Ê' : (0x87, None),
'Ë' : (0x88, None),
'Ï' : (0x89, None),
'Ô' : (0x8A, None),
'Ö' : (0x8B, None),
'Ù' : (0x8C, None),
'Û' : (0x8D, None),
'Ü' : (0x8E, None),
'ß' : (0x8F, None),
'à' : (0x90, None),
'á' : (0x91, None),
'â' : (0x92, None),
'ä' : (0x93, None),
'ç' : (0x94, None),
'è' : (0x95, None),
'é' : (0x96, None),
'ê' : (0x97, None),
'ë' : (0x98, None),
'ï' : (0x99, None),
'ô' : (0x9A, None),
'ö' : (0x9B, None),
'ù' : (0x9C, None),
'û' : (0x9D, None),
'ü' : (0x9E, None),
}
15 changes: 11 additions & 4 deletions assets/text/fra_message_data_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

#include "message_data_fmt.h"

#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_fra[sizeof(fraMessage)] = { fraMessage END };
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_fra[] = fraMessage;

#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage)
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_fra[] = fraMessage;
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */

#include "assets/text/message_data.enc.h"
// Font Message
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */

#include "assets/text/message_data.enc.nes.h"
15 changes: 11 additions & 4 deletions assets/text/ger_message_data_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@

#include "message_data_fmt.h"

#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_ger[sizeof(gerMessage)] = { gerMessage END };
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_ger[] = gerMessage;

#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage)
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_ger[] = gerMessage;
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */

#include "assets/text/message_data.enc.h"
// Font Message
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */

#include "assets/text/message_data.enc.nes.h"
17 changes: 17 additions & 0 deletions assets/text/jpn_message_data_static.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#define MESSAGE_DATA_STATIC
#define MESSAGE_WCHAR
#include "message_data_fmt.h"

#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_jpn[] = jpnMessage;

#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_jpn[] = jpnMessage;

// Font Message
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_jpn[] = jpnMessage;

#include "assets/text/message_data.enc.jpn.h"
25 changes: 23 additions & 2 deletions assets/text/message_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,33 @@
* Message 0xFFFD must be last to not break the message debugger (see R_MESSAGE_DEBUGGER_TEXTID).
* Message 0xFFFC must be immediately before message 0xFFFD to not break Font_LoadOrderedFont.
*/
DEFINE_MESSAGE_NES(0xFFFC, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
DEFINE_MESSAGE_FFFC(0xFFFC, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE,
MSG(
"0123456789あいうえおかきくけこ\n"
"さしすせそたちつてとなにぬねのはひふへほ\n"
"まみむめもやゆよらりるれろわをんぁぃぅぇ\n"
"ぉっゃゅょがぎぐげござじずぜぞだぢづでど\n"
"ばびぶべぼぱぴぷぺぽアイウエオカキクケコ\n"
"サシスセソタチツテトナニヌネノハヒフヘホ\n"
"マミムメモヤユヨラリルレロワヲンァィゥェ\n"
"ォッャュョガギグゲゴザジズゼゾダヂヅデド\n"
"バビブベボパピプペポヴABCDEFGHI\n"
"JKLMNOPQRSTUVWXYZabc\n"
"defghijklmnopqrstuvw\n"
"xyz ┯?!:−()゛゜,./"
)
,
MSG(
"0123456789\n"
"ABCDEFGHIJKLMN\n"
"OPQRSTUVWXYZ\n"
"abcdefghijklmn\n"
"opqrstuvwxyz\n"
" -.\n"
)
DEFINE_MESSAGE(0xFFFD, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, "", "", "")
,
MSG(/* UNUSED */)
,
MSG(/* UNUSED */)
)
DEFINE_MESSAGE(0xFFFD, TEXTBOX_TYPE_BLACK, TEXTBOX_POS_VARIABLE, MSG(), MSG(), MSG(), MSG())
21 changes: 17 additions & 4 deletions assets/text/nes_message_data_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@

#include "message_data_fmt.h"

#define DEFINE_MESSAGE(textId, type, yPos, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_nes[sizeof(nesMessage)] = { nesMessage END };
#define DEFINE_MESSAGE(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
const char _message_##textId##_nes[] = nesMessage;

#define DEFINE_MESSAGE_NES(textId, type, yPos, nesMessage) DEFINE_MESSAGE(textId, type, yPos, nesMessage, , )
#define DEFINE_MESSAGE_NES(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_nes[] = nesMessage;
#define DEFINE_MESSAGE_JPN(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */

#include "assets/text/message_data.enc.h"
#if (TEXT_LANGUAGE == TEXT_LANG_US_JP)
// On US/JP versions, the font message is with JPN
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Not Present */
#else
// On EU versions, the font message is with NES
#define DEFINE_MESSAGE_FFFC(textId, type, yPos, jpnMessage, nesMessage, gerMessage, fraMessage) \
/* Present */ const char _message_##textId##_nes[] = nesMessage;
#endif

#include "assets/text/message_data.enc.nes.h"
4 changes: 2 additions & 2 deletions assets/text/staff_message_data_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#include "message_data_fmt.h"

#define DEFINE_MESSAGE(textId, type, yPos, staffMessage) \
const char _message_##textId##_staff[sizeof(staffMessage)] = { staffMessage END };
const char _message_##textId##_staff[] = staffMessage;

#include "assets/text/message_data_staff.enc.h"
#include "assets/text/message_data_staff.enc.nes.h"
1 change: 1 addition & 0 deletions baseroms/gc-eu-mq-dbg/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dmadata_start: 0x12F70
text_lang_pal: true
variables:
gMtxClear: 0x8012DB20
sNesMessageEntryTable: 0x8014B320
Expand Down
1 change: 1 addition & 0 deletions baseroms/gc-eu-mq/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dmadata_start: 0x7170
text_lang_pal: true
variables:
gMtxClear: 0x800FBC00
sNesMessageEntryTable: 0x801077F0
Expand Down
1 change: 1 addition & 0 deletions baseroms/gc-eu/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dmadata_start: 0x7170
text_lang_pal: true
variables:
gMtxClear: 0x800FBC20
sNesMessageEntryTable: 0x80107810
Expand Down
3 changes: 2 additions & 1 deletion baseroms/gc-us/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
dmadata_start: 0x7170
text_lang_pal: false
variables:
gMtxClear: 0x800FE2A0
sJpnMessageEntryTable: 0x80107810
sJpnMessageEntryTable: 0x80109E8C
sNesMessageEntryTable: 0x8010DFCC
sStaffMessageEntryTable: 0x801121EC
sShadowTex: 0x80A74130
Expand Down
1 change: 1 addition & 0 deletions baseroms/hackeroot-mq/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dmadata_start: 0x12F70
text_lang_pal: true
variables:
gMtxClear: 0x8012DB20
sNesMessageEntryTable: 0x8014B320
Expand Down
1 change: 1 addition & 0 deletions include/compression.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define COMPRESSION_H

#include "ultra64.h"
#include "z64dma.h"

void* Yaz0_FirstDMA(void);
void* Yaz0_NextDMA(u8* curSrcPos);
Expand Down
Loading

0 comments on commit 19a98d5

Please sign in to comment.