Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Temporary Items
# Build Outputs
# =========================

.venv/
*.gba
*.elf
*.map
Expand Down
32 changes: 23 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ UNAME := $(shell uname)
TOOLCHAIN ?= $(DEVKITARM)
PREFIX ?= arm-none-eabi-

VENV ?= .venv
VENV_ACTIVATE := $(VENV)/bin/activate
VENV_PYTHON := $(VENV)/bin/python
VENV_PIP := $(VENV)/bin/pip

export PATH := $(TOOLCHAIN)/bin:$(PATH)

ifeq ($(UNAME),Darwin)
Expand All @@ -22,6 +27,7 @@ AS := $(PREFIX)as$(EXE)
LD := $(PREFIX)ld$(EXE)
OBJCOPY := $(PREFIX)objcopy$(EXE)
STRIP := $(PREFIX)strip$(EXE)
PYTHON := python3

CC1 := tools/agbcc/bin/agbcc$(EXE)
CC1_OLD := tools/agbcc/bin/old_agbcc$(EXE)
Expand All @@ -33,8 +39,8 @@ AIF2PCM := tools/aif2pcm/aif2pcm$(EXE)
MID2AGB := tools/mid2agb/mid2agb$(EXE)
TEXTENCODE := tools/textencode/textencode$(EXE)
JSONPROC := tools/jsonproc/jsonproc$(EXE)
FETSATOOL := scripts/gfxtools/tsa_generator.py
MARTOMAP := scripts/mar_to_map.py
FETSATOOL := $(VENV_PYTHON) scripts/gfxtools/tsa_generator.py
MARTOMAP := $(VENV_PYTHON) scripts/mar_to_map.py

ifeq ($(UNAME),Darwin)
SED := sed -i ''
Expand Down Expand Up @@ -126,19 +132,26 @@ tag:

.PHONY: tag

venv: $(VENV_ACTIVATE)

$(VENV_ACTIVATE):
$(PYTHON) -m venv $(VENV)
. $(VENV_ACTIVATE)
$(VENV_PIP) install -r requirements.txt

#### Recipes ####

# Comprssed Texts Recipes
# Compressed Texts Recipes

# =========
# = Texts =
# =========
TEXT_DIR := texts
TEXT_TOOLS := scripts/texttools

TEXT_DECODER := $(PYTHON) $(TEXT_TOOLS)/textdecoder.py
TEXT_DPARSER := $(PYTHON) $(TEXT_TOOLS)/textdeparser.py
TEXT_PROCESS := $(PYTHON) $(TEXT_TOOLS)/textprocess.py
TEXT_DECODER := $(VENV_PYTHON) $(TEXT_TOOLS)/textdecoder.py
TEXT_DPARSER := $(VENV_PYTHON) $(TEXT_TOOLS)/textdeparser.py
TEXT_PROCESS := $(VENV_PYTHON) $(TEXT_TOOLS)/textprocess.py

TEXT_MAIN := $(TEXT_DIR)/texts.txt
TEXT_DEFS := $(TEXT_DIR)/textdefs.txt
Expand All @@ -147,7 +160,7 @@ TEXT_SRC := $(TEXT_MAIN) $(shell find $(TEXT_DIR) -type f -name "*.txt")
TEXT_HEADER := include/constants/msg.h
MSG_LIST := src/msg_data.c

src/msg_data.c: $(TEXT_SRC) $(TEXT_DEFS)
src/msg_data.c: $(TEXT_SRC) $(TEXT_DEFS) $(VENV_ACTIVATE)
@$(TEXT_PROCESS) $(TEXT_MAIN) $(TEXT_DEFS) $@ $(TEXT_HEADER) utf8

# Graphics Recipes
Expand All @@ -169,13 +182,14 @@ include json_data_rules.mk
%.lz: % ; $(GBAGFX) $< $@
%.rl: % ; $(GBAGFX) $< $@
%.fk: % ; ./scripts/compressor.py $< fk
%.bin: %.mar ; $(MARTOMAP) $< $@
%.bin: %.mar $(VENV_ACTIVATE)
$(MARTOMAP) $< $@
sound/%.bin: sound/%.aif ; $(AIF2PCM) $< $@

%.4bpp.h: %.4bpp
$(BIN2C) $< $(subst .,_,$(notdir $<)) | sed 's/^const //' > $@

%.feimg1.bin %.fetsa1.bin: %.png
%.feimg1.bin %.fetsa1.bin: %.png $(VENV_ACTIVATE)
$(FETSATOOL) $< $*.feimg1.bin $*.fetsa1.bin

# Battle Animation Recipes
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
numpy==2.2.5
pillow==11.2.1
ttp==0.9.5
2 changes: 1 addition & 1 deletion scripts/asm2casm.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/dump-proc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_088AF6F4.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_WmMonsterGenerateRates.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_anim_scr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_anim_sprite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_animconf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_battle_animation_pointer_table.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

# dump battle animation pointers and data pointed
# by laqieer
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_battletalk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_chapterasset.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_debugcreditpinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_debugpinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_defeattalk.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_eventinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_eventitemlist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_eventshoplist.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_eventsinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import sys, ctypes
import symbols
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_eventstrapdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_img.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys, struct, os
import array
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_imgs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys
from dump_img import dump_img
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_itembonus.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_itemdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from fe8db import ITEM_IDX, ITYPE_IDX, WPN_EXP, WPN_EFFECT
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_jidlut.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from fe8db import JID_IDX
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_jinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from fe8db import JID_IDX, UNIT_AFFIN, WPN_EXP
import symbols
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_mapanimconf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

# struct MapAnimSpellfxConf
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_one_sprite.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import sys

Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_pinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from fe8db import PID_IDX, JID_IDX, UNIT_AFFIN, WPN_EXP
import symbols
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_proc_cmds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import struct
import subprocess
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_ptr.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_ptrs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_redas.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_s16.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_supportdata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_tactician.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3
import struct

bin_file_path = "baserom.gba"
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_terraintable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

# dump move-cast, terrain-avo table, etc
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_u8.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/dump_udef.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys, ctypes
Expand Down
2 changes: 1 addition & 1 deletion scripts/enum_to_pydef.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/find_nearest_symbol.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

import subprocess
import sys
Expand Down
2 changes: 1 addition & 1 deletion scripts/gen_split_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

# split data
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate_declarations.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

PREFIX = DemonLightBg4_Close
LENGTH = 8
Expand Down
2 changes: 1 addition & 1 deletion scripts/get_lz77_compressed_data_length.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3

# get the length of lz77 compressed data
# python3 get_lz77_compressed_data_length.py baserom.gba <offset>
Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/lzss_compress.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys
import lzss_lib
Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/lzss_decompress.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys
import lzss_lib
Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/lzss_lib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

from sys import stderr

Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/tsa_analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys, struct
from collections import Counter
Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/tsa_bin_analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys, struct
from collections import Counter
Expand Down
2 changes: 1 addition & 1 deletion scripts/gfxtools/tsa_generator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

import sys, re
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion scripts/lzss_lib.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/python3
#!/usr/bin/env python3

from sys import stderr

Expand Down
Loading