Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text handler overhaul (ASCII/UTF-8, Multilang, Fonts) #60

Draft
wants to merge 19 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ sm64config.txt
!/assets/**/*custom*.bin
!/assets/**/*custom*/**/*.bin

# Pre-extracted files, to use between game versions
!/levels/**/*predone*.png
!/levels/**/*predone*/**/*.png
!/textures/**/*predone*.png
!/textures/**/*predone*/**/*.png

# Android files
!/textures/touchcontrols/*.png
platform/android/SDL/include
Expand Down
121 changes: 1 addition & 120 deletions Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,6 @@ endif
ELF := $(BUILD_DIR)/$(TARGET).elf

LD_SCRIPT := sm64.ld
CHARMAP := charmap.txt
CHARMAP_DEBUG := charmap.debug.txt
MIO0_DIR := $(BUILD_DIR)/bin
SOUND_BIN_DIR := $(BUILD_DIR)/sound
TEXTURE_DIR := textures
Expand Down Expand Up @@ -1161,7 +1159,6 @@ MIO0TOOL := $(TOOLS_DIR)/sm64tools/mio0$(WINEXT)
N64CKSUM := $(TOOLS_DIR)/sm64tools/n64cksum$(WINEXT)
N64GRAPHICS := $(TOOLS_DIR)/sm64tools/n64graphics$(WINEXT)
N64GRAPHICS_CI := $(TOOLS_DIR)/sm64tools/n64graphics_ci$(WINEXT)
TEXTCONV := $(TOOLS_DIR)/textconv$(WINEXT)
TABLEDESIGN := $(TOOLS_DIR)/tabledesign$(WINEXT)
VADPCM_ENC := $(TOOLS_DIR)/vadpcm_enc$(WINEXT)
EXTRACT_DATA_FOR_MIO := $(TOOLS_DIR)/extract_data_for_mio$(WINEXT)
Expand Down Expand Up @@ -1195,7 +1192,7 @@ YELLOW := \033[0;33m
BLINK := \033[32;5m
endif

EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data
EXTRACT_DATA_FOR_MIO := $(OBJCOPY) -O binary --only-section=.data --only-section=.rodata

# Common build print status function
define print
Expand Down Expand Up @@ -1323,29 +1320,6 @@ endif
$(SOUND_BIN_DIR)/sound_data.o: $(SOUND_FILES)
$(BUILD_DIR)/levels/scripts.o: $(BUILD_DIR)/include/level_headers.h

ifeq ($(VERSION),eu)
TEXT_DIRS := text/de text/us text/fr

# EU encoded text inserted into individual segment 0x19 files,
# and course data also duplicated in leveldata.c
$(BUILD_DIR)/bin/eu/translation_en.o: $(BUILD_DIR)/text/us/define_text.inc.c
$(BUILD_DIR)/bin/eu/translation_de.o: $(BUILD_DIR)/text/de/define_text.inc.c
$(BUILD_DIR)/bin/eu/translation_fr.o: $(BUILD_DIR)/text/fr/define_text.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/us/define_courses.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/de/define_courses.inc.c
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/fr/define_courses.inc.c
else
ifeq ($(VERSION),sh)
TEXT_DIRS := text/jp
$(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/jp/define_text.inc.c
else
TEXT_DIRS := text/$(VERSION)
# non-EU encoded text inserted into segment 0x02
$(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/$(VERSION)/define_text.inc.c
endif
endif
$(BUILD_DIR)/bin/segment2.o: $(BUILD_DIR)/text/debug_text.raw.inc.c

# N64 specific optimization files
ifeq ($(TARGET_N64),1)
$(BUILD_DIR)/actors/%.o: OPT_FLAGS := -Ofast -mlong-calls
Expand Down Expand Up @@ -1382,57 +1356,6 @@ endif
# Make sure build directory exists before compiling anything
DUMMY != mkdir -p $(ALL_DIRS)

$(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_menu_strings.h

ifeq ($(EXT_OPTIONS_MENU),1)
$(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_options_strings.h
endif

ifeq ($(CHEATS_ACTIONS),1)
$(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_cheats_strings.h
endif

ifeq ($(EXT_DEBUG_MENU),1)
$(BUILD_DIR)/include/text_strings.h: $(BUILD_DIR)/include/text_debug_strings.h
endif

ifeq ($(VERSION),eu)
LANG_O_FILES := $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
else
LANG_O_FILES :=
endif

$(BUILD_DIR)/src/menu/file_select.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
$(BUILD_DIR)/src/menu/star_select.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
$(BUILD_DIR)/src/game/ingame_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)

ifeq ($(TARGET_N64),1)
$(BUILD_DIR)/src/boot/ext_mem_screen.o: $(BUILD_DIR)/include/text_strings.h
endif

ifeq ($(EXT_OPTIONS_MENU),1)

ifeq ($(BETTERCAMERA),1)
$(BUILD_DIR)/src/extras/bettercamera.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
endif

ifeq ($(CHEATS_ACTIONS),1)
$(BUILD_DIR)/src/extras/cheats.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
endif

ifeq ($(EXT_DEBUG_MENU),1)
$(BUILD_DIR)/src/extras/debug_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
endif

$(BUILD_DIR)/src/extras/options_menu.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
endif

ifeq ($(TARGET_PORT_CONSOLE),0)
ifeq ($(DISCORDRPC),1)
$(BUILD_DIR)/src/pc/discord/discordrpc.o: $(BUILD_DIR)/include/text_strings.h $(LANG_O_FILES)
endif
endif

#==============================================================================#
# Texture Generation #
#==============================================================================#
Expand Down Expand Up @@ -1584,48 +1507,6 @@ $(BUILD_DIR)/assets/demo_data.c: assets/demo_data.json $(wildcard assets/demos/*
@$(PRINT) "$(GREEN)Generating demo data $(NO_COL)\n"
$(V)$(PYTHON) tools/demo_data_converter.py assets/demo_data.json $(DEF_INC_CFLAGS) > $@

# Encode in-game text strings
$(BUILD_DIR)/$(CHARMAP): $(CHARMAP)
$(call print,Preprocessing charmap:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF [email protected] -o $@ $<
$(BUILD_DIR)/$(CHARMAP_DEBUG): $(CHARMAP)
$(call print,Preprocessing charmap:,$<,$@)
$(V)$(CPP) $(CPPFLAGS) -DCHARMAP_DEBUG -DBUILD_DIR=$(BUILD_DIR) -MMD -MP -MT $@ -MF [email protected] -o $@ $<
$(BUILD_DIR)/include/text_strings.h: include/text_strings.h.in $(BUILD_DIR)/$(CHARMAP)
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) $< $@
$(BUILD_DIR)/include/text_menu_strings.h: include/text_menu_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) charmap_menu.txt $< $@
$(BUILD_DIR)/text/%/define_courses.inc.c: text/define_courses.inc.c text/%/courses.h
@$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n"
$(V)$(CPP) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) - $@
$(BUILD_DIR)/text/%/define_text.inc.c: text/define_text.inc.c text/%/courses.h text/%/dialogs.h
@$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n"
$(V)$(CPP) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) - $@
$(BUILD_DIR)/text/debug_text.raw.inc.c: text/debug_text.inc.c $(BUILD_DIR)/$(CHARMAP_DEBUG)
@$(PRINT) "$(GREEN)Preprocessing: $(BLUE)$@ $(NO_COL)\n"
$(V)$(CPP) $(CPPFLAGS) $< -o - -I text/$*/ | $(TEXTCONV) $(BUILD_DIR)/$(CHARMAP_DEBUG) - $@

ifeq ($(EXT_OPTIONS_MENU),1)
$(BUILD_DIR)/include/text_options_strings.h: include/text_options_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) $< $@

ifeq ($(CHEATS_ACTIONS),1)
$(BUILD_DIR)/include/text_cheats_strings.h: include/text_cheats_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) $< $@
endif

ifeq ($(EXT_DEBUG_MENU),1)
$(BUILD_DIR)/include/text_debug_strings.h: include/text_debug_strings.h.in
$(call print,Encoding:,$<,$@)
$(V)$(TEXTCONV) $(BUILD_DIR)/$(CHARMAP) $< $@
endif

endif

# Level headers
$(BUILD_DIR)/include/level_headers.h: levels/level_headers.h.in
$(call print,Preprocessing level headers:,$<,$@)
Expand Down
15 changes: 11 additions & 4 deletions Makefile.split
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ SEGMENTS := \
# Directories containing PNG files
TEXTURE_DIRS := \
$(wildcard textures/*/) \
$(wildcard levels/*/custom/) \
$(wildcard levels/*/predone/) \
$(wildcard textures/*/custom/) \
$(wildcard textures/*/predone/) \
$(filter %/,$(wildcard actors/*/))

ifeq ($(VERSION),cn)
Expand Down Expand Up @@ -199,6 +202,9 @@ endif
$(eval $(call level_rules,intro,generic)) # Intro (Super Mario 64 Logo)
$(eval $(call level_rules,menu,generic)) # Menu (File Select)

CUSTOM_MENU_SEG7_FILES := $(wildcard levels/menu/custom/*.png) $(wildcard levels/menu/predone/*.png)
$(BUILD_DIR)/levels/menu/leveldata.o: $(addprefix $(BUILD_DIR)/,$(patsubst %.png,%.inc.c,$(CUSTOM_MENU_SEG7_FILES)))

# --------------------------------------
# Cake Texture Rules
# --------------------------------------
Expand All @@ -219,7 +225,8 @@ $(BUILD_DIR)/levels/ending/cake.inc.c: levels/ending/cake.png
# --------------------------------------

# Others
SEGMENT2_TEXTURES := $(wildcard $(TEXTURE_DIR)/segment2/*.png) $(wildcard $(TEXTURE_DIR)/segment2/custom/*.png)
SEGMENT2_TEXTURES := $(wildcard $(TEXTURE_DIR)/segment2/*.png) $(wildcard $(TEXTURE_DIR)/segment2/custom/*.png) $(wildcard $(TEXTURE_DIR)/segment2/predone/*.png)
SEGMENT2_TEXTURES += $(CUSTOM_MENU_SEG7_FILES) # For JP colorful font
ifeq ($(VERSION),cn)
SEGMENT2_TEXTURES += $(wildcard $(TEXTURE_DIR)/segment2/cn/*.png)
endif
Expand Down Expand Up @@ -280,9 +287,9 @@ $(BUILD_DIR)/bin/mountain.elf: SEGMENT_ADDRESS := 0x09000000
$(BUILD_DIR)/bin/grass.elf: SEGMENT_ADDRESS := 0x09000000

# EU segment 19 translations
$(BUILD_DIR)/bin/eu/translation_de.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/eu/translation_en.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/eu/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_de.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_en.elf: SEGMENT_ADDRESS := 0x19000000
$(BUILD_DIR)/bin/translation_fr.elf: SEGMENT_ADDRESS := 0x19000000

# --------------------------------------
# Skybox Rules
Expand Down
6 changes: 0 additions & 6 deletions assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -875,9 +875,6 @@
"levels/menu/main_menu_seg7_eu.0AF80.ia8.png": [8,8,64,{"eu":[2647072,44928]}],
"levels/menu/main_menu_seg7_eu.0B640.ia8.png": [8,8,64,{"eu":[2647072,46656]}],
"levels/menu/main_menu_seg7_eu.0B680.ia8.png": [8,8,64,{"eu":[2647072,46720]}],
"levels/menu/main_menu_seg7_eu.0B840.ia8.png": [8,8,64,{"eu":[2647072,47168]}],
"levels/menu/main_menu_seg7_eu.0B880.ia8.png": [8,8,64,{"eu":[2647072,47232]}],
"levels/menu/main_menu_seg7_eu.0B8C0.ia8.png": [8,8,64,{"eu":[2647072,47296]}],
"levels/menu/main_menu_seg7_eu.0BDA0.rgba16.png": [64,32,4096,{"eu":[2647072,48544]}],
"levels/menu/main_menu_seg7_eu.0CDA0.rgba16.png": [64,32,4096,{"eu":[2647072,52640]}],
"levels/menu/main_menu_seg7_eu.0DDA0.rgba16.png": [64,32,4096,{"eu":[2647072,56736]}],
Expand Down Expand Up @@ -1569,8 +1566,6 @@
"textures/segment2/segment2.05800.rgba16.png": [16,16,512,{"jp":[1078992,22528],"us":[1083968,17408],"eu":[909712,18944],"sh":[934640,22528],"cn":[947456,17408]}],
"textures/segment2/segment2.05A00.rgba16.png": [16,16,512,{"jp":[1078992,23040],"us":[1083968,17920],"eu":[909712,19456],"sh":[934640,23040],"cn":[947456,17920]}],
"textures/segment2/segment2.05C00.rgba16.png": [16,16,512,{"jp":[1078992,23552],"us":[1083968,18432],"eu":[909712,19968],"sh":[934640,23552],"cn":[947456,18432]}],
"textures/segment2/segment2.05E00.rgba16.png": [16,16,512,{"jp":[1078992,24064],"sh":[934640,24064]}],
"textures/segment2/segment2.06000.rgba16.png": [16,16,512,{"jp":[1078992,24576],"sh":[934640,24576]}],
"textures/segment2/segment2.06200.rgba16.png": [8,8,128,{"jp":[1078992,25088],"us":[1083968,18944],"eu":[909712,20480],"sh":[934640,25088],"cn":[947456,82432]}],
"textures/segment2/segment2.06280.rgba16.png": [8,8,128,{"jp":[1078992,25216],"us":[1083968,19072],"eu":[909712,20608],"sh":[934640,25216],"cn":[947456,82560]}],
"textures/segment2/segment2.06300.rgba16.png": [8,8,128,{"jp":[1078992,25344],"us":[1083968,19200],"eu":[909712,20736],"sh":[934640,25344],"cn":[947456,82688]}],
Expand Down Expand Up @@ -1781,7 +1776,6 @@
"textures/segment2/segment2.13458.ia16.png": [32,32,2048,{"jp":[1078992,78936],"us":[1083968,90808],"eu":[909712,47480],"sh":[934640,78936],"cn":[947456,191272]}],
"textures/segment2/segment2.13C58.rgba16.png": [32,32,2048,{"jp":[1078992,80984],"us":[1083968,92856],"eu":[909712,49528],"sh":[934640,80984],"cn":[947456,193320]}],
"textures/segment2/segment2.14838.ia8.png": [8,8,64,{"jp":[1078992,84024],"us":[1083968,95896],"eu":[909712,52568],"sh":[934640,84024],"cn":[947456,196360]}],
"textures/segment2/segment2.umlaut.rgba16.png": [16,16,512,{"eu":[909712,17920]}],
"textures/segment2/cn/segment2_cn.04A00.rgba16.png": [16,16,512,{"cn":[947456,18944]}],
"textures/segment2/cn/segment2_cn.04C00.rgba16.png": [16,16,512,{"cn":[947456,19456]}],
"textures/segment2/cn/segment2_cn.04E00.rgba16.png": [16,16,512,{"cn":[947456,19968]}],
Expand Down
15 changes: 0 additions & 15 deletions bin/eu/translation_de.c

This file was deleted.

15 changes: 0 additions & 15 deletions bin/eu/translation_en.c

This file was deleted.

15 changes: 0 additions & 15 deletions bin/eu/translation_fr.c

This file was deleted.

Loading