diff --git a/Makefile b/Makefile index 76b608e..98c0277 100644 --- a/Makefile +++ b/Makefile @@ -4,18 +4,23 @@ BUILD_DIR = build # Source files SOURCES = \ src/main.cpp \ - src/bin.cpp + src/game_data.cpp -# Output file name +# Assets files +ASSETS = \ + assets/player-sheets/player_idle_sheet.png \ + assets/player-sheets/player_run_sheet.png + +# Output target name OUTPUT = 2D_Engine_Casio_Tool # Compiler and flags CXX = g++ -CXXFLAGS = -std=c++17 -g +CXXFLAGS = -std=c++17 -g -I. LDFLAGS = # Deduce objects -OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) +OBJECTS = $(SOURCES:%.cpp=$(BUILD_DIR)/%.o) $(ASSETS:%=$(BUILD_DIR)/%.o) # Verbose mode ifeq ($(VERBOSE), 1) @@ -53,6 +58,10 @@ $(BUILD_DIR)/%.o: %.cpp $(Q)mkdir -p $(dir $@) $(Q)$(CXX) $(CXXFLAGS) -MMD -MP -c $< -o $@ +# Convert .png.o from .png +$(BUILD_DIR)/%.png.o: %.png + fxconv --toolchain=GNU --cg $< -o $@ + # Source files dependencies -include $(OBJECTS:.o=.d) diff --git a/assets/fxconv-metadata.txt b/assets/fxconv-metadata.txt new file mode 100644 index 0000000..9f19cbb --- /dev/null +++ b/assets/fxconv-metadata.txt @@ -0,0 +1,3 @@ +*.png: + type: bopti-image + name_regex: (.*)\.png img_\1 diff --git a/assets/player-sheets/fxconv-metadata.txt b/assets/player-sheets/fxconv-metadata.txt new file mode 100644 index 0000000..9f19cbb --- /dev/null +++ b/assets/player-sheets/fxconv-metadata.txt @@ -0,0 +1,3 @@ +*.png: + type: bopti-image + name_regex: (.*)\.png img_\1 diff --git a/assets/player-sheets/player_death_sheet.png b/assets/player-sheets/player_death_sheet.png new file mode 100644 index 0000000..1f6103a Binary files /dev/null and b/assets/player-sheets/player_death_sheet.png differ diff --git a/assets/player-sheets/player_idle_sheet.png b/assets/player-sheets/player_idle_sheet.png new file mode 100644 index 0000000..7d078c2 Binary files /dev/null and b/assets/player-sheets/player_idle_sheet.png differ diff --git a/assets/player-sheets/player_run_sheet.png b/assets/player-sheets/player_run_sheet.png new file mode 100644 index 0000000..7130a65 Binary files /dev/null and b/assets/player-sheets/player_run_sheet.png differ diff --git a/assets/tileset.png b/assets/tileset.png new file mode 100644 index 0000000..4d36a9c Binary files /dev/null and b/assets/tileset.png differ diff --git a/fxconv/fxconv.py b/fxconv/fxconv.py index 6e8c89b..a1851e2 100644 --- a/fxconv/fxconv.py +++ b/fxconv/fxconv.py @@ -1211,18 +1211,6 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None, The symbol name must have a leading underscore if it is to be declared and used from a C program. - The toolchain can be any target triplet for which the compiler is - available. The architecture is deduced from some typical triplets; - otherwise it can be set, usually as "sh3" or "sh4-nofpu". This affects the - --binary-architecture flag of objcopy. If arch is set to "fx" or "cg", this - function tries to be smart and: - - * Uses the name of the compiler if it contains a full architecture name - such as "sh3", "sh4" or "sh4-nofpu"; - * Uses "sh3" for fx9860g and "sh4-nofpu" for fxcg50 if the toolchain is - "sh-elf", which is a custom set; - * Fails otherwise. - The section name can be specified, along with its flags. A typical example would be section=".rodata,contents,alloc,load,readonly,data", which is the default. @@ -1254,19 +1242,14 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None, # Toolchain parameters if toolchain is None: - toolchain = "sh3eb-elf" + toolchain = "GNU" if section is None: section = ".rodata,contents,alloc,load,readonly,data" - if arch in ["fx", "cg", None] and toolchain in ["sh3eb-elf", "sh4eb-elf", - "sh4eb-nofpu-elf"]: - arch = toolchain.replace("eb-", "-")[:-4] - - elif arch == "fx" and toolchain == "sh-elf": + if arch == "fx" and toolchain == "GNU": arch = "sh3" - elif arch == "cg" and toolchain == "sh-elf": + elif arch == "cg" and toolchain == "GNU": arch = "sh4-nofpu" - elif arch in ["fx", "cg", None]: raise FxconvError(f"non-trivial architecture for {toolchain} must be "+ "specified") @@ -1287,7 +1270,7 @@ def elf(data, output, symbol, toolchain=None, arch=None, section=None, sybl = "_binary_" + fp_obj.name.replace("/", "_") objcopy_args = [ - f"{toolchain}-objcopy", "-I", "binary", "-O", "elf32-sh", + f"objcopy", "-I", "binary", "-O", "elf64-sh", "--binary-architecture", arch, "--file-alignment", "4", "--rename-section", f".data={section}", "--redefine-sym", f"{sybl}_start={symbol}",