Asset extraction (#133)

* Added torch and ast_logo yml

* Added torch into makefile

* Added torch into tools all rule

* Fixed version and removed clang-format from c header

* Reverted settings.json unrelated change

* Bump version

* Readded -s flag

* Fixed Makefile indentation
This commit is contained in:
Lywx 2024-02-17 20:19:18 -06:00 committed by GitHub
parent 423be52768
commit 0b13c0edef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 60 additions and 23 deletions

2
.gitignore vendored
View File

@ -12,6 +12,8 @@ ctx.c.m2c
*.n64 *.n64
*.z64 *.z64
*.bin *.bin
src/assets/*
!src/assets/ast_radio.c
/build /build
tools/mio0 tools/mio0
tools/ido-recomp tools/ido-recomp

3
.gitmodules vendored
View File

@ -10,3 +10,6 @@
[submodule "tools/m2c"] [submodule "tools/m2c"]
path = tools/m2c path = tools/m2c
url = https://github.com/matt-kempster/m2c url = https://github.com/matt-kempster/m2c
[submodule "tools/Torch"]
path = tools/Torch
url = https://github.com/HarbourMasters/Torch

View File

@ -137,6 +137,7 @@ OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
ICONV := iconv ICONV := iconv
ASM_PROC := $(PYTHON) $(TOOLS)/asm-processor/build.py ASM_PROC := $(PYTHON) $(TOOLS)/asm-processor/build.py
CAT := cat CAT := cat
TORCH := tools/Torch/cmake-build-release/torch
# Prefer clang as C preprocessor if installed on the system # Prefer clang as C preprocessor if installed on the system
ifneq (,$(call find-command,clang)) ifneq (,$(call find-command,clang))
@ -231,6 +232,7 @@ ASM_DIRS := $(shell find asm/$(VERSION) -type d -not -path "asm/$(VERSION)/
BIN_DIRS := $(shell find bin -type d) BIN_DIRS := $(shell find bin -type d)
C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c)) C_FILES := $(foreach dir,$(SRC_DIRS),$(wildcard $(dir)/*.c))
C_FILES := $(filter-out %.inc.c,$(C_FILES))
S_FILES := $(foreach dir,$(ASM_DIRS) $(SRC_DIRS),$(wildcard $(dir)/*.s)) S_FILES := $(foreach dir,$(ASM_DIRS) $(SRC_DIRS),$(wildcard $(dir)/*.s))
BIN_FILES := $(foreach dir,$(BIN_DIRS),$(wildcard $(dir)/*.bin)) BIN_FILES := $(foreach dir,$(BIN_DIRS),$(wildcard $(dir)/*.bin))
O_FILES := $(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \ O_FILES := $(foreach f,$(C_FILES:.c=.o),$(BUILD_DIR)/$f) \
@ -390,6 +392,7 @@ init:
@$(MAKE) clean @$(MAKE) clean
@$(MAKE) decompress @$(MAKE) decompress
@$(MAKE) extract -j $(N_THREADS) @$(MAKE) extract -j $(N_THREADS)
@$(MAKE) assets -j $(N_THREADS)
@$(MAKE) uncompressed -j $(N_THREADS) @$(MAKE) uncompressed -j $(N_THREADS)
@$(MAKE) compressed @$(MAKE) compressed
@ -428,9 +431,12 @@ extract:
@echo "Extracting..." @echo "Extracting..."
@$(SPLAT) $(SPLAT_YAML) @$(SPLAT) $(SPLAT_YAML)
assets:
@echo "Extracting assets..."
@$(TORCH) code $(BASEROM_UNCOMPRESSED)
clean: clean:
@git clean -fdx asm/ @git clean -fdx asm/
@git clean -fdx assets/
@git clean -fdx bin/ @git clean -fdx bin/
@git clean -fdx build/ @git clean -fdx build/
@git clean -fdx linker_scripts/*.ld @git clean -fdx linker_scripts/*.ld
@ -516,4 +522,4 @@ build/src/libultra/libc/ll.o: src/libultra/libc/ll.c
# Print target for debugging # Print target for debugging
print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true print-% : ; $(info $* is a $(flavor $*) variable set to [$($*)]) @true
.PHONY: all uncompressed compressed clean init extract expected format checkformat decompress context disasm toolchain .PHONY: all uncompressed compressed clean init extract expected format checkformat decompress assets context disasm toolchain

View File

@ -0,0 +1,14 @@
:config:
segments:
seg15: 0xD25100
header:
- '#include "assets/ast_logo.h"'
nintendo_logo:
type: TEXTURE
offset: 0xF000000
format: IA8
width: 128
height: 74
ctype: u8
symbol: gNintendoLogo

11
config.yml Normal file
View File

@ -0,0 +1,11 @@
# Supported Star Fox 64 Versions: US
f7475fb11e7e6830f82883412638e8390791ab87:
name: Star Fox 64 (U) (V1.1)
path: assets/yaml/us
config:
gbi: F3DEX
sort: OFFSET
output:
binary: lylat.otr
code: src/assets

View File

@ -5,10 +5,6 @@
#include "sf64object.h" #include "sf64object.h"
#include "structs.h" #include "structs.h"
extern u16 D_F000000[]; extern u8 gNintendoLogo[];
extern u16 D_F000800[];
extern u16 D_F001000[];
extern u16 D_F001800[];
extern u16 D_F002000[];
#endif #endif

View File

@ -1,6 +1,7 @@
#include "prevent_bss_reordering.h" #include "prevent_bss_reordering.h"
#include "global.h" #include "global.h"
#include "sf64dma.h" #include "sf64dma.h"
#include "assets/ast_logo.h"
f32 D_80161A10; f32 D_80161A10;
f32 D_80161A14; f32 D_80161A14;
@ -345,11 +346,11 @@ void Game_Update(void) {
case GSTATE_SHOW_LOGO: case GSTATE_SHOW_LOGO:
RCP_SetupDL(&gMasterDisp, 0x4C); RCP_SetupDL(&gMasterDisp, 0x4C);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255); gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 255);
TextureRect_8bIA(&gMasterDisp, D_F000000, 128, 16, 100.0f, 86.0f, 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, &gNintendoLogo[128 * 16 * 0], 128, 16, 100.0f, 86.0f, 1.0f, 1.0f);
TextureRect_8bIA(&gMasterDisp, D_F000800, 128, 16, 100.0f, 102.0f, 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, &gNintendoLogo[128 * 16 * 1], 128, 16, 100.0f, 102.0f, 1.0f, 1.0f);
TextureRect_8bIA(&gMasterDisp, D_F001000, 128, 16, 100.0f, 118.0f, 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, &gNintendoLogo[128 * 16 * 2], 128, 16, 100.0f, 118.0f, 1.0f, 1.0f);
TextureRect_8bIA(&gMasterDisp, D_F001800, 128, 16, 100.0f, 134.0f, 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, &gNintendoLogo[128 * 16 * 3], 128, 16, 100.0f, 134.0f, 1.0f, 1.0f);
TextureRect_8bIA(&gMasterDisp, D_F002000, 128, 10, 100.0f, 150.0f, 1.0f, 1.0f); TextureRect_8bIA(&gMasterDisp, &gNintendoLogo[128 * 16 * 4], 128, 10, 100.0f, 150.0f, 1.0f, 1.0f);
gGameState++; gGameState++;
break; break;
case GSTATE_CHECK_SAVE: case GSTATE_CHECK_SAVE:

View File

@ -1,4 +1,6 @@
CC = gcc CC = gcc
MAKE = make
N_THREADS ?= $(shell nproc)
UNAME_S := $(shell uname -s) UNAME_S := $(shell uname -s)
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
@ -15,11 +17,12 @@ RECOMP_DIR := ido-recomp/$(DETECTED_OS)
default: all default: all
all: recomp mio0 all: recomp mio0 torch
clean: clean:
$(RM) -rf $(RECOMP_DIR) $(RM) -rf $(RECOMP_DIR)
$(RM) mio0 $(RM) mio0
$(RM) -rf Torch/build
distclean: clean distclean: clean
@ -34,4 +37,8 @@ mio0:
@echo "Building mio0..." @echo "Building mio0..."
$(CC) -Wall -Wextra -Wno-format-overflow -O2 -ffunction-sections -fdata-sections -DMIO0_STANDALONE -s -Wl,${MIO0_FLAGS} -o mio0 mio0-decompressor/libmio0.c $(CC) -Wall -Wextra -Wno-format-overflow -O2 -ffunction-sections -fdata-sections -DMIO0_STANDALONE -s -Wl,${MIO0_FLAGS} -o mio0 mio0-decompressor/libmio0.c
.PHONY: all clean distclean default torch:
@echo "Building torch..."
$(MAKE) -C Torch type=release -j$(N_THREADS)
.PHONY: all clean distclean default torch

1
tools/Torch Submodule

@ -0,0 +1 @@
Subproject commit 5b1e5d632b44cd13282ce98d8dd3c11a5c86d598

View File

@ -179,16 +179,12 @@
start: 0xCE9E70 start: 0xCE9E70
- name: ast_logo #F - name: ast_logo #F
type: bin type: code
dir: assets
start: 0xD25100 start: 0xD25100
# width: 128 vram: 0x0F000000
# height: 74 subsegments:
# subsegments: - [0xD25100, .data, ast_logo/bin]
# - [0xD25100, ia8, nintendo_logo_0, 128, 16]
# - [0xD25900, ia8, nintendo_logo_1, 128, 16]
# - [0xD26100, ia8, nintendo_logo_2, 128, 16]
# - [0xD26900, ia8, nintendo_logo_3, 128, 16]
# - [0xD27100, ia8, nintendo_logo_4, 128, 10]
- name: ast_ending #7 - name: ast_ending #7
type: bin type: bin