Fix REL Spelling + Tool Improvements (#285)

* AST conversion library

* Improved Shifted lcf

* copydate and frameworkF.str

* Fix REL Capitalization

* Fix Packaging
This commit is contained in:
jdflyer 2023-02-15 07:02:56 -07:00 committed by GitHub
parent 82ff815386
commit 5ce19327db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 688 additions and 125 deletions

View File

@ -110,9 +110,9 @@
-include rel/d/a/d_a_andsw2/Makefile
-include rel/d/a/d_a_bd/Makefile
-include rel/d/a/d_a_canoe/Makefile
-include rel/d/a/d_a_cstaf/Makefile
-include rel/d/a/d_a_cstaF/Makefile
-include rel/d/a/d_a_demo_item/Makefile
-include rel/d/a/door/d_a_door_bossl1/Makefile
-include rel/d/a/door/d_a_door_bossL1/Makefile
-include rel/d/a/e/d_a_e_dn/Makefile
-include rel/d/a/e/d_a_e_fm/Makefile
-include rel/d/a/e/d_a_e_ga/Makefile
@ -144,24 +144,24 @@
-include rel/d/a/obj/d_a_obj_digplace/Makefile
-include rel/d/a/obj/d_a_obj_eff/Makefile
-include rel/d/a/obj/d_a_obj_fmobj/Makefile
-include rel/d/a/obj/d_a_obj_gptaru/Makefile
-include rel/d/a/obj/d_a_obj_gpTaru/Makefile
-include rel/d/a/obj/d_a_obj_hhashi/Makefile
-include rel/d/a/obj/d_a_obj_kanban2/Makefile
-include rel/d/a/obj/d_a_obj_kbacket/Makefile
-include rel/d/a/obj/d_a_obj_kgate/Makefile
-include rel/d/a/obj/d_a_obj_klift00/Makefile
-include rel/d/a/obj/d_a_obj_ktonfire/Makefile
-include rel/d/a/obj/d_a_obj_ktOnFire/Makefile
-include rel/d/a/obj/d_a_obj_ladder/Makefile
-include rel/d/a/obj/d_a_obj_lv2candle/Makefile
-include rel/d/a/obj/d_a_obj_lv2Candle/Makefile
-include rel/d/a/obj/d_a_obj_magne_arm/Makefile
-include rel/d/a/obj/d_a_obj_metalbox/Makefile
-include rel/d/a/obj/d_a_obj_mgate/Makefile
-include rel/d/a/obj/d_a_obj_nameplate/Makefile
-include rel/d/a/obj/d_a_obj_ornament_cloth/Makefile
-include rel/d/a/obj/d_a_obj_rope_bridge/Makefile
-include rel/d/a/obj/d_a_obj_swallshutter/Makefile
-include rel/d/a/obj/d_a_obj_sWallShutter/Makefile
-include rel/d/a/obj/d_a_obj_stick/Makefile
-include rel/d/a/obj/d_a_obj_stonemark/Makefile
-include rel/d/a/obj/d_a_obj_stoneMark/Makefile
-include rel/d/a/obj/d_a_obj_swpropeller/Makefile
-include rel/d/a/obj/d_a_obj_swpush5/Makefile
-include rel/d/a/obj/d_a_obj_yobikusa/Makefile
@ -169,7 +169,7 @@
-include rel/d/a/d_a_shop_item/Makefile
-include rel/d/a/d_a_sq/Makefile
-include rel/d/a/d_a_swc00/Makefile
-include rel/d/a/tag/d_a_tag_cstasw/Makefile
-include rel/d/a/tag/d_a_tag_CstaSw/Makefile
-include rel/d/a/tag/d_a_tag_ajnot/Makefile
-include rel/d/a/tag/d_a_tag_attack_item/Makefile
-include rel/d/a/tag/d_a_tag_gstart/Makefile

View File

@ -349,9 +349,9 @@ RELS := \
$(BUILD_DIR)/rel/d/a/d_a_andsw2.plf \
$(BUILD_DIR)/rel/d/a/d_a_bd.plf \
$(BUILD_DIR)/rel/d/a/d_a_canoe.plf \
$(BUILD_DIR)/rel/d/a/d_a_cstaf.plf \
$(BUILD_DIR)/rel/d/a/d_a_cstaF.plf \
$(BUILD_DIR)/rel/d/a/d_a_demo_item.plf \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1.plf \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1.plf \
$(BUILD_DIR)/rel/d/a/e/d_a_e_dn.plf \
$(BUILD_DIR)/rel/d/a/e/d_a_e_fm.plf \
$(BUILD_DIR)/rel/d/a/e/d_a_e_ga.plf \
@ -383,24 +383,24 @@ RELS := \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_digplace.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_eff.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_fmobj.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_hhashi.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_kanban2.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_kbacket.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_kgate.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_klift00.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ladder.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_magne_arm.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_metalbox.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_mgate.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_nameplate.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ornament_cloth.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_rope_bridge.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stick.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_swpropeller.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_swpush5.plf \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_yobikusa.plf \
@ -408,7 +408,7 @@ RELS := \
$(BUILD_DIR)/rel/d/a/d_a_shop_item.plf \
$(BUILD_DIR)/rel/d/a/d_a_sq.plf \
$(BUILD_DIR)/rel/d/a/d_a_swc00.plf \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw.plf \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw.plf \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_ajnot.plf \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_attack_item.plf \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_gstart.plf \

View File

@ -2,17 +2,17 @@
# Generated By: dol2asm
#
M62_TARGET := $(BUILD_DIR)/rel/d/a/d_a_cstaf.plf
M62_LDSCRIPT := $(BUILD_DIR)/rel/d/a/d_a_cstaf.lcf
M62_MAP := $(BUILD_DIR)/rel/d/a/d_a_cstaf.map
M62_TARGET := $(BUILD_DIR)/rel/d/a/d_a_cstaF.plf
M62_LDSCRIPT := $(BUILD_DIR)/rel/d/a/d_a_cstaF.lcf
M62_MAP := $(BUILD_DIR)/rel/d/a/d_a_cstaF.map
M62_CPP_FILES := \
rel/executor.cpp \
rel/d/a/d_a_cstaf/d_a_cstaF.cpp \
rel/d/a/d_a_cstaF/d_a_cstaF.cpp \
M62_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/d/a/d_a_cstaf/d_a_cstaF.o \
$(BUILD_DIR)/rel/d/a/d_a_cstaF/d_a_cstaF.o \
M62_LIBS := \
@ -38,7 +38,7 @@ $(M62_TARGET): $(M62_O_FILES) $(M62_LIBS)
@python3 tools/lcf.py rel 62 --output $(M62_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M62_LDFLAGS) -o $(M62_TARGET) @build/M62_ofiles
$(BUILD_DIR)/rel/d/a/d_a_cstaf/%.o: rel/d/a/d_a_cstaf/%.cpp $(BUILD_DIR)/rel/d/a/d_a_cstaf/%.d
$(BUILD_DIR)/rel/d/a/d_a_cstaF/%.o: rel/d/a/d_a_cstaF/%.cpp $(BUILD_DIR)/rel/d/a/d_a_cstaF/%.d
@echo [ 62] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M64_TARGET := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1.plf
M64_LDSCRIPT := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1.lcf
M64_MAP := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1.map
M64_TARGET := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1.plf
M64_LDSCRIPT := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1.lcf
M64_MAP := $(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1.map
M64_CPP_FILES := \
rel/executor.cpp \
rel/d/a/door/d_a_door_bossl1/unknown_translation_unit_bss.cpp \
rel/d/a/door/d_a_door_bossl1/d_a_door_bossL1.cpp \
rel/d/a/door/d_a_door_bossL1/unknown_translation_unit_bss.cpp \
rel/d/a/door/d_a_door_bossL1/d_a_door_bossL1.cpp \
M64_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1/unknown_translation_unit_bss.o \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1/d_a_door_bossL1.o \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1/unknown_translation_unit_bss.o \
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1/d_a_door_bossL1.o \
M64_LIBS := \
@ -40,7 +40,7 @@ $(M64_TARGET): $(M64_O_FILES) $(M64_LIBS)
@python3 tools/lcf.py rel 64 --output $(M64_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M64_LDFLAGS) -o $(M64_TARGET) @build/M64_ofiles
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1/%.o: rel/d/a/door/d_a_door_bossl1/%.cpp $(BUILD_DIR)/rel/d/a/door/d_a_door_bossl1/%.d
$(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1/%.o: rel/d/a/door/d_a_door_bossL1/%.cpp $(BUILD_DIR)/rel/d/a/door/d_a_door_bossL1/%.d
@echo [ 64] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M96_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru.plf
M96_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru.lcf
M96_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru.map
M96_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru.plf
M96_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru.lcf
M96_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru.map
M96_CPP_FILES := \
rel/executor.cpp \
rel/global_destructor_chain.cpp \
rel/d/a/obj/d_a_obj_gptaru/d_a_obj_gpTaru.cpp \
rel/d/a/obj/d_a_obj_gpTaru/d_a_obj_gpTaru.cpp \
M96_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/global_destructor_chain.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru/d_a_obj_gpTaru.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru/d_a_obj_gpTaru.o \
M96_LIBS := \
@ -40,7 +40,7 @@ $(M96_TARGET): $(M96_O_FILES) $(M96_LIBS)
@python3 tools/lcf.py rel 96 --output $(M96_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M96_LDFLAGS) -o $(M96_TARGET) @build/M96_ofiles
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru/%.o: rel/d/a/obj/d_a_obj_gptaru/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gptaru/%.d
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru/%.o: rel/d/a/obj/d_a_obj_gpTaru/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_gpTaru/%.d
@echo [ 96] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M102_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire.plf
M102_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire.lcf
M102_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire.map
M102_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire.plf
M102_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire.lcf
M102_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire.map
M102_CPP_FILES := \
rel/executor.cpp \
rel/global_destructor_chain.cpp \
rel/d/a/obj/d_a_obj_ktonfire/d_a_obj_ktOnFire.cpp \
rel/d/a/obj/d_a_obj_ktOnFire/d_a_obj_ktOnFire.cpp \
M102_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/global_destructor_chain.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire/d_a_obj_ktOnFire.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire/d_a_obj_ktOnFire.o \
M102_LIBS := \
@ -40,7 +40,7 @@ $(M102_TARGET): $(M102_O_FILES) $(M102_LIBS)
@python3 tools/lcf.py rel 102 --output $(M102_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M102_LDFLAGS) -o $(M102_TARGET) @build/M102_ofiles
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire/%.o: rel/d/a/obj/d_a_obj_ktonfire/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktonfire/%.d
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire/%.o: rel/d/a/obj/d_a_obj_ktOnFire/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_ktOnFire/%.d
@echo [102] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M104_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle.plf
M104_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle.lcf
M104_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle.map
M104_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle.plf
M104_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle.lcf
M104_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle.map
M104_CPP_FILES := \
rel/executor.cpp \
rel/global_destructor_chain.cpp \
rel/d/a/obj/d_a_obj_lv2candle/d_a_obj_lv2Candle.cpp \
rel/d/a/obj/d_a_obj_lv2Candle/d_a_obj_lv2Candle.cpp \
M104_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/global_destructor_chain.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle/d_a_obj_lv2Candle.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle/d_a_obj_lv2Candle.o \
M104_LIBS := \
@ -40,7 +40,7 @@ $(M104_TARGET): $(M104_O_FILES) $(M104_LIBS)
@python3 tools/lcf.py rel 104 --output $(M104_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M104_LDFLAGS) -o $(M104_TARGET) @build/M104_ofiles
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle/%.o: rel/d/a/obj/d_a_obj_lv2candle/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2candle/%.d
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle/%.o: rel/d/a/obj/d_a_obj_lv2Candle/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_lv2Candle/%.d
@echo [104] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M111_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter.plf
M111_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter.lcf
M111_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter.map
M111_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter.plf
M111_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter.lcf
M111_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter.map
M111_CPP_FILES := \
rel/executor.cpp \
rel/global_destructor_chain.cpp \
rel/d/a/obj/d_a_obj_swallshutter/d_a_obj_sWallShutter.cpp \
rel/d/a/obj/d_a_obj_sWallShutter/d_a_obj_sWallShutter.cpp \
M111_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/global_destructor_chain.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter/d_a_obj_sWallShutter.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter/d_a_obj_sWallShutter.o \
M111_LIBS := \
@ -40,7 +40,7 @@ $(M111_TARGET): $(M111_O_FILES) $(M111_LIBS)
@python3 tools/lcf.py rel 111 --output $(M111_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M111_LDFLAGS) -o $(M111_TARGET) @build/M111_ofiles
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter/%.o: rel/d/a/obj/d_a_obj_swallshutter/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_swallshutter/%.d
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter/%.o: rel/d/a/obj/d_a_obj_sWallShutter/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_sWallShutter/%.d
@echo [111] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,17 +2,17 @@
# Generated By: dol2asm
#
M113_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark.plf
M113_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark.lcf
M113_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark.map
M113_TARGET := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark.plf
M113_LDSCRIPT := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark.lcf
M113_MAP := $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark.map
M113_CPP_FILES := \
rel/executor.cpp \
rel/d/a/obj/d_a_obj_stonemark/d_a_obj_stoneMark.cpp \
rel/d/a/obj/d_a_obj_stoneMark/d_a_obj_stoneMark.cpp \
M113_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark/d_a_obj_stoneMark.o \
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark/d_a_obj_stoneMark.o \
M113_LIBS := \
@ -38,7 +38,7 @@ $(M113_TARGET): $(M113_O_FILES) $(M113_LIBS)
@python3 tools/lcf.py rel 113 --output $(M113_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M113_LDFLAGS) -o $(M113_TARGET) @build/M113_ofiles
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark/%.o: rel/d/a/obj/d_a_obj_stonemark/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stonemark/%.d
$(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark/%.o: rel/d/a/obj/d_a_obj_stoneMark/%.cpp $(BUILD_DIR)/rel/d/a/obj/d_a_obj_stoneMark/%.d
@echo [113] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -2,19 +2,19 @@
# Generated By: dol2asm
#
M121_TARGET := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw.plf
M121_LDSCRIPT := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw.lcf
M121_MAP := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw.map
M121_TARGET := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw.plf
M121_LDSCRIPT := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw.lcf
M121_MAP := $(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw.map
M121_CPP_FILES := \
rel/executor.cpp \
rel/global_destructor_chain.cpp \
rel/d/a/tag/d_a_tag_cstasw/d_a_tag_CstaSw.cpp \
rel/d/a/tag/d_a_tag_CstaSw/d_a_tag_CstaSw.cpp \
M121_O_FILES := \
$(BUILD_DIR)/rel/executor.o \
$(BUILD_DIR)/rel/global_destructor_chain.o \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw/d_a_tag_CstaSw.o \
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw/d_a_tag_CstaSw.o \
M121_LIBS := \
@ -40,7 +40,7 @@ $(M121_TARGET): $(M121_O_FILES) $(M121_LIBS)
@python3 tools/lcf.py rel 121 --output $(M121_LDSCRIPT)
@$(LD) -opt_partial -strip_partial $(M121_LDFLAGS) -o $(M121_TARGET) @build/M121_ofiles
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw/%.o: rel/d/a/tag/d_a_tag_cstasw/%.cpp $(BUILD_DIR)/rel/d/a/tag/d_a_tag_cstasw/%.d
$(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw/%.o: rel/d/a/tag/d_a_tag_CstaSw/%.cpp $(BUILD_DIR)/rel/d/a/tag/d_a_tag_CstaSw/%.d
@echo [121] building $@
@mkdir -p $(@D)
@$(ICONV) -f UTF-8 -t CP932 < $< > $(basename $@).cpp

View File

@ -61,9 +61,9 @@
"d_a_andsw2.rel": "DAE91E481CFC63EDC9EA09D3C19649C34A11B264",
"d_a_bd.rel": "B8635FED4E8F43323A5748A59B4F6CB3BBE130E1",
"d_a_canoe.rel": "458C9B8EDF64337E1D9A9D6BB51628295F5670DD",
"d_a_cstaf.rel": "09DF9E19D740C46E6ADC2AA43FFE17F04436FD8D",
"d_a_cstaF.rel": "09DF9E19D740C46E6ADC2AA43FFE17F04436FD8D",
"d_a_demo_item.rel": "9610ACC386E0545D4F8713F87A1C8D4DFF121801",
"d_a_door_bossl1.rel": "EFA3D31496AC998C68CB801C8E88BB1979C838BF",
"d_a_door_bossL1.rel": "EFA3D31496AC998C68CB801C8E88BB1979C838BF",
"d_a_e_dn.rel": "CC9A07C2822FBFC4F3036C79FB9C4C98335AA712",
"d_a_e_fm.rel": "64C6573DFCEEF0300214A32AE63B74DA0598A446",
"d_a_e_ga.rel": "FA6AFF115B9391732EC2FCE517394C3D51AA941E",
@ -95,24 +95,24 @@
"d_a_obj_digplace.rel": "E2B1BCF7FB992AD7F94A597116E682F399BC63B1",
"d_a_obj_eff.rel": "88E38A21E88B4AB3DF62965883F49D2FE5D2ED65",
"d_a_obj_fmobj.rel": "8F91C6C115B416B2E64ADC35CC145D413D3108BB",
"d_a_obj_gptaru.rel": "065E7FA31D83D7CD5F9347A90F4B2751AA864DBE",
"d_a_obj_gpTaru.rel": "065E7FA31D83D7CD5F9347A90F4B2751AA864DBE",
"d_a_obj_hhashi.rel": "11A34DEF9788A9B89534F973F98EF051A478C972",
"d_a_obj_kanban2.rel": "593BF47D59B3D31EC18587160A25E8D19571D7E7",
"d_a_obj_kbacket.rel": "9EDC8E1BA461ACDB7D64046D712AD35430AAC480",
"d_a_obj_kgate.rel": "1FB4E048CE72776BF7D3522818B94D5FC4F06993",
"d_a_obj_klift00.rel": "7CD70757A4DE31C344A1F9B5477CD8DB17A604F4",
"d_a_obj_ktonfire.rel": "1FBB6F67D7CA07509155BC184D95860E5EA9479F",
"d_a_obj_ktOnFire.rel": "1FBB6F67D7CA07509155BC184D95860E5EA9479F",
"d_a_obj_ladder.rel": "BD71E2F4546CACF5A3983753342C41C0EA54380D",
"d_a_obj_lv2candle.rel": "F2CC3AAC95DF03EA174A5FAE92C6C0E41958A9A5",
"d_a_obj_lv2Candle.rel": "F2CC3AAC95DF03EA174A5FAE92C6C0E41958A9A5",
"d_a_obj_magne_arm.rel": "4B750CF6ECDF82CAE59A0DEC0015D2CD65CA2C3D",
"d_a_obj_metalbox.rel": "B6A13D28454114D73A6A0F6C967DEE7F4F410BD3",
"d_a_obj_mgate.rel": "95D3A773CA6B9B6D456AFECD256B98D1C10FDC7A",
"d_a_obj_nameplate.rel": "6F83A6B66C10A6F4C2FCC91CF1A460563243FF19",
"d_a_obj_ornament_cloth.rel": "A94BCA6D5D1BA78B9FA06A1008A4AE7449781B65",
"d_a_obj_rope_bridge.rel": "55D5ED00E2BEB08B47BD210E08883F5B588FDD62",
"d_a_obj_swallshutter.rel": "C6846A2BB29A03B84C8204E1DC471C20CB43939C",
"d_a_obj_sWallShutter.rel": "C6846A2BB29A03B84C8204E1DC471C20CB43939C",
"d_a_obj_stick.rel": "78F4D1E0850CBF7658F231E8DB030175CF5C1EFA",
"d_a_obj_stonemark.rel": "B8DBC313B384E70435DEB15C98AFBD3BAECB21EB",
"d_a_obj_stoneMark.rel": "B8DBC313B384E70435DEB15C98AFBD3BAECB21EB",
"d_a_obj_swpropeller.rel": "1BAE089562CF5031FFCC6EC28F39F41020A1E953",
"d_a_obj_swpush5.rel": "672F3D2FE2AED26FEAE32374ABEB563D8CC6573D",
"d_a_obj_yobikusa.rel": "C94D70FFB87AED83DF8A49C18F0FF84A61BCB5BA",
@ -120,7 +120,7 @@
"d_a_shop_item.rel": "DAAEA741567E2616811847019843093C97947BF0",
"d_a_sq.rel": "24BB6184C18421A11B770E96968889E96531F75A",
"d_a_swc00.rel": "D197D44CFA043F3076A715F999CC14C6BD8B68AB",
"d_a_tag_cstasw.rel": "C1FF514BC868C29A719884CFDF2C5248344C2334",
"d_a_tag_CstaSw.rel": "C1FF514BC868C29A719884CFDF2C5248344C2334",
"d_a_tag_ajnot.rel": "BEFE98C785FA9547AD21D099CEEE8BBCDACC81D9",
"d_a_tag_attack_item.rel": "F04D803169866C738C25A1924B15F157FB88F6D8",
"d_a_tag_gstart.rel": "CF8E2C97C71A5DC3B80E5853AA0B8F6DE4850DF9",

View File

@ -32,6 +32,130 @@ VERSION = "1.0"
# load the symbol definition file for main.dol
sys.path.append("defs")
FUNCITON_SYMBOLS = """func_802A3C3C
func_802E9368
func_802FAED0
func_802A2474
func_80339CB0
func_802F5DD0
func_802E9260
func_8001505C
func_8027EEB0
func_802A4A80
func_8007914C
func_802BF660
func_802A2328
func_80280588
func_8027833C
func_802D2DF0
func_80078B78
func_802A0A8C
func_802F5E88
func_802D1F50
func_80282200
func_80048970
func_802C0074
func_80078B80
func_802E9488
func_802F7264
func_802F6D18
func_802BF890
func_80271BA8
func_802E90C0
func_802E1D08
func_80267F80
func_8028421C
func_80284204
func_802A9EE8
func_80273724
func_80078D5C
func_80278320
func_80078B70
func_802E9564
func_802BD338
func_8027936C
func_802E1C54
func_8029F03C
func_80267D54
func_802C4928
func_802BDCB0
func_802FFBC4
func_803012CC
func_802AABF4
func_802E90E4
func_802BBCDC
func_80301FC8
func_80304EF0
func_802A2FEC
func_80070018
func_802BBD18
func_802A69D8
func_802D45E4
func_802A69F8
func_802BF898
func_802E4194
func_802BBD94
func_802FDF88
func_802841F8
func_80279364
func_80078D54
func_802807E0
func_8029F650
func_80264A5C
func_802D9B44
func_80015084
func_80077574
func_802AB538
func_8028202C
func_80281E5C
func_802FED84
func_802E980C
func_802DCCD0
func_80079154
func_80281EC8
func_8027DEBC
func_802C0190
func_802E9B0C
func_802FB338
func_802F5D40
func_80041488
func_802841EC
func_802D32B0
func_802A1B48
func_802FA928
func_802AAC3C
func_80078D4C
func_802E9BE8
func_802C5284
func_802A319C
func_80282094
func_802D1EFC
func_802585A4
func_80078B88
func_80264A54
func_80264A64
func_802F5F08
func_802E987C
func_802A0768
func_80284234
func_802CCFF8
func_80302164
func_80282118
func_80264A4C
func_802782B4
func_80284210
func_802782EC
func_80284228
func_80280808
func_80041480
func_802A0B64
func_8007915C
func_802A3104
func_802FC800
func_802FAA5C
func_802782D0
func_80301994
func_80282284"""
def lcf_generate(output_path,shiftable,map_file):
"""Script for generating .lcf files"""
@ -43,6 +167,8 @@ def lcf_generate(output_path,shiftable,map_file):
map_file = open(map_file,'r')
map_file = map_file.read()
map_file = map_file.splitlines()
else:
print("Generating LCF")
# load symbols from compiled files
symbols = []
@ -94,31 +220,32 @@ def lcf_generate(output_path,shiftable,map_file):
base_names = set(module0.SYMBOL_NAMES.keys())
main_names = set([sym.name for sym in symbols])
names = base_names - main_names
for name in names:
symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[name]]
if symbol["type"] == "StringBase": # @stringBase0 is handled below
continue
if symbol["type"] == "LinkerGenerated": # linker handles these symbols
continue
if shiftable == False:
for name in names:
symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[name]]
if symbol["type"] == "StringBase": # @stringBase0 is handled below
continue
if symbol["type"] == "LinkerGenerated": # linker handles these symbols
continue
addr = symbol['addr']
if shiftable==True:
for line in map_file:
literals_found = []
if type(symbol['name'])==str and line.find(' '+symbol['name']+' ')!=-1 and symbol['name'][0] != "@" or type(symbol['label']) == str and line.find(' '+symbol['label']+' ')!=-1:
linesplit = line.split()
if len(linesplit) > 3 and linesplit[2]!="NOT":
if line.find("lit_")!=-1:
lbl = symbol['label']
for literal in literals_found:
if literal == lbl:
print("Warning! two literals with the same name found!\n"+lbl)
literals_found.append(symbol['label'])
addr = int(linesplit[2],16)
file.write(f"\t\"{symbol['label']}\" = 0x{addr:08X};\n")
else:
addr = symbol['addr']
file.write(f"\t\"{symbol['label']}\" = 0x{addr:08X};\n")
elif shiftable == True:
realNames = []
symInfo = []
for func in FUNCITON_SYMBOLS.splitlines():
symbol = module0.SYMBOLS[module0.SYMBOL_NAMES[func]]
realNames.append(symbol['name'])
symInfo.append({'func': func, 'symbol': symbol['name']})
for line in map_file:
split = line.split()
if len(split) >5 and split[2] != 'NOT':
sym = split[5]
if sym in realNames:
#print(line)
file.write(f"\t\"{symInfo[realNames.index(sym)]['func']}\" = 0x{int(split[2],16):08X};\n")
file.write("\n")
# @stringBase0 is generated by the compiler. The dol2asm is using a trick to
@ -127,20 +254,32 @@ def lcf_generate(output_path,shiftable,map_file):
# So all references will be to the new symbol, thus the linker will think
# that the @stringBase0 symbol is never used and strip it.
file.write("\t/* @stringBase0 */\n")
for x in module0.SYMBOLS:
if x["type"] == "StringBase":
addr = x['addr']
if shiftable==True:
obj = (module0.TRANSLATION_UNITS[x['tu']].split('/')[-1])+'.o'
#print(obj)
for line in map_file:
if line.find(' '+obj)!=-1 and line.find(' '+x['name']+' ')!=-1 or line.find('\t'+obj)!=-1 and line.find(' '+x['name']+' ')!=-1:
linesplit = line.split()
if len(linesplit) > 3:
addr = int(linesplit[2],16)
file.write("\t\"%s\" = 0x%08X;\n" % (x['label'], addr))
else:
if shiftable == False:
for x in module0.SYMBOLS:
if x["type"] == "StringBase":
addr = x['addr']
file.write("\t\"%s\" = 0x%08X;\n" % (x['label'], addr))
elif shiftable == True:
stringBaseObjs = []
stringBaseSyms = []
for x in module0.SYMBOLS:
if x['type'] == 'StringBase':
#print(x)
stringBaseObjs.append((module0.TRANSLATION_UNITS[x['tu']].split('/')[-1])+'.o')
stringBaseSyms.append(x['label'])
for line in map_file:
split = line.split()
if len(split) > 6 and split[2] != 'NOT':
sym = split[5]
tu = split[6]
if tu[-2:] == '.a':
tu = split[7]
if sym == '@stringBase0' and tu in stringBaseObjs:
addr = int(split[2],16)
#print(tu)
file.write("\t\"%s\" = 0x%08X;\n" % (stringBaseSyms[stringBaseObjs.index(tu)], addr))
file.write("}\n")
file.write("\n")
@ -307,7 +446,7 @@ def get_symbols_from_object_file(obj):
def load_archive(ar_path):
symbols = []
print(ar_path)
#print(ar_path)
archive = libar.read(ar_path)
for path, data in archive.files:
obj = libelf.load_object_from_file(None, path, io.BytesIO(data))

1
tools/libast/__init__.py Normal file
View File

@ -0,0 +1 @@
from .libast import *

417
tools/libast/libast.py Normal file
View File

@ -0,0 +1,417 @@
# adpcm encoding currently doesn't work well, so this isn't being integrated into the assets scripts
# however, this can be used to convert all ast files to a wav file and to encode a wav file to a pcm16 ast file
import struct
import os
import sys
import dataclasses
import json
DSPADPCM_FILTER = [
[0, 0],
[2048, 0],
[0, 2048],
[1024, 1024],
[4096, -2048],
[3584, -1536],
[3072, -1024],
[4608, -2560],
[4200, -2248],
[4800, -2300],
[5120, -3072],
[2048, -2048],
[1024, -1024],
[-1024, 1024],
[-1024, 0],
[-2048, 0],
]
@dataclasses.dataclass
class AST_Header:
identifier: int
fileSize: int
format: int # 0 = ADPCM, 1 = PCM16
bitDepth: int
numChannels: int
unk_1: int
sampleRate: int
totalSamples: int
loopStartSample: int
loopEndSample: int
blockSize: int
unk_2: int
unk_3: int
@dataclasses.dataclass
class AST_Json:
blockSize: int
loopStartSample: int
loopEndSample: int
encodingFormat: int
loops: bool
def testWriteFunction(name, data):
open(name, "wb").write(data)
def clampSample(sample):
if sample > 32767:
sample = 32767
elif sample < -32767:
sample = -32767
return sample
def convert_to_wav(name, astData, writeFunction):
header = struct.unpack(">IIHHHHIIIIIII", astData[:44])
astHeader = AST_Header(*header)
print(astHeader)
if astHeader.bitDepth != 16:
print("Error: libast only supports 16 bit audio!")
return None
nextBlockPosition = 0x40
audioData = []
for channel in range(astHeader.numChannels):
audioData.append([])
while nextBlockPosition < astHeader.fileSize + 0x40:
currentBlockPosition = nextBlockPosition
blockHeader = struct.unpack(
">II", astData[currentBlockPosition : currentBlockPosition + 8]
)
if blockHeader[0] != 1112294219:
print("Block not found at position " + hex(currentBlockPosition))
break
blockSize = blockHeader[1]
nextBlockPosition = (
currentBlockPosition + 32 + (blockSize * astHeader.numChannels)
)
print(
"current is "
+ str(currentBlockPosition)
+ " next is "
+ str(nextBlockPosition)
+ " full is "
+ str(astHeader.fileSize + 0x40)
+ " size is "
+ str(blockSize)
)
for channel in range(astHeader.numChannels):
blockDataIndex = currentBlockPosition + 32 + (blockSize * channel)
if astHeader.format == 0: # adcpm
endIndex = blockDataIndex + ((blockSize // 9) * 9)
for i in range(blockDataIndex, endIndex, 9):
delta = 1 << ((astData[i] >> 4) & 0b1111)
id = astData[i] & 0b1111
data = []
for j in range(8):
data.append((astData[i + 1 + j] >> 4) & 0b1111)
data.append((astData[i + 1 + j]) & 0b1111)
for nibble in data:
if nibble >= 8:
nibble = nibble - 16
hist = 0
hist2 = 0
if len(audioData[channel]) == 1:
hist = audioData[channel][-1]
elif len(audioData[channel]) > 1:
hist = audioData[channel][-1]
hist2 = audioData[channel][-2]
sample = (delta * nibble) << 11
sample = sample + (
(hist * DSPADPCM_FILTER[id][0])
+ (hist2 * DSPADPCM_FILTER[id][1])
)
sample = sample >> 11
sample = clampSample(sample)
audioData[channel].append(sample)
elif astHeader.format == 1: # pcm16
for i in range(blockDataIndex, blockDataIndex + blockSize, 2):
audioData[channel].append(
struct.unpack(">h", astData[i : i + 2])[0]
)
if nextBlockPosition == astHeader.fileSize + 0x40:
break
# done parsing data
subChunk2Size = len(audioData[0]) * 2 * astHeader.numChannels
wavHeader = struct.pack(
"<ccccIccccccccIHHIIHHccccI",
bytes("R", "ascii"),
bytes("I", "ascii"),
bytes("F", "ascii"),
bytes("F", "ascii"),
36 + subChunk2Size,
bytes("W", "ascii"),
bytes("A", "ascii"),
bytes("V", "ascii"),
bytes("E", "ascii"),
bytes("f", "ascii"),
bytes("m", "ascii"),
bytes("t", "ascii"),
bytes(" ", "ascii"),
16,
1,
astHeader.numChannels,
astHeader.sampleRate,
2 * astHeader.numChannels * astHeader.sampleRate,
2 * astHeader.numChannels,
16,
bytes("d", "ascii"),
bytes("a", "ascii"),
bytes("t", "ascii"),
bytes("a", "ascii"),
subChunk2Size,
)
wavFile = bytearray(wavHeader)
print("writing")
for i in range(len(audioData[0])):
if i % 100000 == 0:
print(i)
for channel in audioData:
wavFile.append(channel[i] & 0xFF)
wavFile.append((channel[i] >> 8) & 0xFF)
loops = False
if astHeader.unk_1 == 0xFFFF:
loops = True
jsonData = AST_Json(
astHeader.blockSize,
astHeader.loopStartSample,
astHeader.loopEndSample,
astHeader.format,
loops,
)
jsonDataString = json.dumps(dataclasses.asdict(jsonData))
split = os.path.splitext(name)
open(split[0] + ".json", "w").write(jsonDataString)
writeFunction(split[0] + ".wav", wavFile)
def wav_to_ast(sourceWav, convertFunction):
wavData = open(sourceWav, "rb").read()
jsonDataString = open(os.path.splitext(sourceWav)[0] + ".json", "r").read()
jsonData = json.loads(jsonDataString)
print(jsonData)
headerData = struct.unpack("<HI", wavData[0x16:0x1C])
blockSize = jsonData["blockSize"]
loopStartSample = jsonData["loopStartSample"]
loopEndSample = jsonData["loopEndSample"]
encodingFormat = jsonData["encodingFormat"]
numChannels = headerData[0]
sampleRate = headerData[1]
astData = bytearray(20)
wavDataPos = 0x2C
loops = 0
if jsonData["loops"] == True:
loops = 0xFFFF
sampleNum = 0
if encodingFormat == 1: # pcm16
exitLoop = False
while exitLoop == False:
thisBlockSize = blockSize
if len(wavData) - wavDataPos < (blockSize * numChannels):
thisBlockSize = (len(wavData) - wavDataPos) // numChannels
exitLoop = True
astData.append(ord("B"))
astData.append(ord("L"))
astData.append(ord("C"))
astData.append(ord("K"))
# doing this is faster than adding two bytearrays together
astData.append((thisBlockSize >> 24) & 0xFF)
astData.append((thisBlockSize >> 16) & 0xFF)
astData.append((thisBlockSize >> 8) & 0xFF)
astData.append((thisBlockSize) & 0xFF) # Write as big endian
print(thisBlockSize)
for i in range(24):
astData.append(0)
sampleNum = sampleNum + (thisBlockSize // 2)
for channel in range(numChannels):
for i in range(
0, thisBlockSize * numChannels, 2 * numChannels
): # convert little to big endian
astData.append(wavData[wavDataPos + i + 1 + (channel * 2)])
astData.append(wavData[wavDataPos + i + (channel * 2)])
wavDataPos = wavDataPos + (thisBlockSize * numChannels)
elif encodingFormat == 0: # adpcm
exitLoop = False
sampleList = []
for channel in range(numChannels):
sampleList.append([])
for i in range(
0, len(wavData) - wavDataPos, 2 * numChannels
): # convert little to big endian
sampleList[channel].append(
(wavData[i + 1 + (channel * 2)] << 8) | (wavData[i + (channel * 2)])
)
for i in range(16 - (len(sampleList) % 16)):
sampleList[channel].append(0)
last = 0
penult = 0
while exitLoop == False:
thisBlockSize = blockSize
if loopEndSample - sampleNum <= ((blockSize // 9) * 16):
thisBlockSize = ((loopEndSample - sampleNum) // 16) * 9
exitLoop = True
astData.append(ord("B"))
astData.append(ord("L"))
astData.append(ord("C"))
astData.append(ord("K"))
# doing this is faster than adding two bytearrays together
astData.append((thisBlockSize >> 24) & 0xFF)
astData.append((thisBlockSize >> 16) & 0xFF)
astData.append((thisBlockSize >> 8) & 0xFF)
astData.append((thisBlockSize) & 0xFF) # Write as big endian
print(thisBlockSize)
for i in range(24):
astData.append(0)
sampleNum = sampleNum + ((thisBlockSize // 9) * 16)
print(sampleNum)
for channel in range(numChannels):
for sample in range(
sampleNum, sampleNum + ((thisBlockSize // 9) * 16), 16
):
def getSample(sampleIndex):
if len(sampleList[channel]) > sampleIndex:
return sampleList[channel][sampleIndex]
else:
return 0
# code ported from https://github.com/XAYRGA/wsystool/blob/37eb357b11b2e2b80f50784d4e993713e5e00508/wsystool/bananapeel/banan_flaaf.cs#L393
isBlank = True
for i in range(16):
if getSample(sample + i) != 0:
isBlank = False
break
if isBlank:
for i in range(9):
astData.append(0)
continue
coeffIndex = -1
minerror = 0xFFFFFFFF
for coeff in range(16):
lastCoeff = DSPADPCM_FILTER[coeff][0]
penultCoeff = DSPADPCM_FILTER[coeff][1]
foundScale = -1
coeff_error = 0
for current_scale in range(16):
step = 1 << current_scale
nibbleCoeff = 2048 << current_scale
success = True
coeff_error = 0
_last = lastCoeff
_penult = penultCoeff
for i in range(16):
prediction = clampSample(
((lastCoeff * _last) + (penultCoeff * _penult))
>> 11
)
difference = -(prediction - getSample(sample + i))
nibble = difference // step
if nibble < -8 or nibble > 7:
success = False
break
nibbleSample = nibble * nibbleCoeff
decoded = clampSample(
(
(nibbleSample)
+ (lastCoeff * _last)
+ (penultCoeff * _penult)
)
>> 11
)
_penult = _last
_last = decoded
coeff_error = coeff_error + abs(difference)
if success:
foundScale = current_scale
break
if foundScale < 0:
continue
if coeff_error < minerror:
minerror = coeff_error
coeffIndex = coeff
scale = foundScale
lastCoeff = DSPADPCM_FILTER[coeffIndex][0]
penultCoeff = DSPADPCM_FILTER[coeffIndex][1]
step = 1 << scale
nibbles = [int] * 16
for i in range(16):
prediction = clampSample(
((lastCoeff * last) + (penultCoeff * penult)) >> 11
)
difference = -(prediction - getSample(sample + i))
nibbles[i] = difference // step
nibbleSample = nibbles[i] * (2048 << scale)
decoded = clampSample(
nibbleSample + (lastCoeff * last) + (penultCoeff * penult)
>> 11
)
penult = last
last = decoded
astData.append(((scale & 0xF) << 4) | coeffIndex)
for i in range(8):
astData.append(
((nibbles[i * 2] & 0xF) << 4)
| ((nibbles[(i * 2) + 1] & 0xF))
)
astHeader = struct.pack(
">IIHHHHIIIIIII",
1398035021,
len(astData) - 20,
encodingFormat,
16,
numChannels,
loops,
sampleRate,
loopEndSample,
loopStartSample,
loopEndSample,
blockSize,
0,
0x7F000000,
)
astFile = astHeader + astData
split = os.path.splitext(sourceWav)
convertFunction(split[0] + ".ast", astFile)
if __name__ == "__main__":
if len(sys.argv) >= 2:
split = os.path.splitext(sys.argv[1])
if split[1] == ".ast":
convert_to_wav(
sys.argv[1], open(sys.argv[1], "rb").read(), testWriteFunction
)
elif split[1] == ".wav":
wav_to_ast(sys.argv[1], testWriteFunction)

View File

@ -213,7 +213,7 @@ class StringList:
def write(self):
if len(self.data) > 0:
with open(self.output_path, "w") as file:
file.write(self.data)
file.write(self.data.replace(' ','\0'))
@dataclass

View File

@ -5,7 +5,7 @@ import extract_game_assets
from pathlib import Path
import libyaz0
import libarc
import threading
from datetime import datetime
def getMaxDateFromDir(path):
@ -99,9 +99,9 @@ aMemRels = """d_a_alldie.rel
d_a_andsw2.rel
d_a_bd.rel
d_a_canoe.rel
d_a_cstaf.rel
d_a_cstaF.rel
d_a_demo_item.rel
d_a_door_bossl1.rel
d_a_door_bossL1.rel
d_a_econt.rel
d_a_e_dn.rel
d_a_e_fm.rel
@ -133,15 +133,15 @@ d_a_obj_cboard.rel
d_a_obj_digplace.rel
d_a_obj_eff.rel
d_a_obj_fmobj.rel
d_a_obj_gptaru.rel
d_a_obj_gpTaru.rel
d_a_obj_hhashi.rel
d_a_obj_kanban2.rel
d_a_obj_kbacket.rel
d_a_obj_kgate.rel
d_a_obj_klift00.rel
d_a_obj_ktonfire.rel
d_a_obj_ktOnFire.rel
d_a_obj_ladder.rel
d_a_obj_lv2candle.rel
d_a_obj_lv2Candle.rel
d_a_obj_magne_arm.rel
d_a_obj_metalbox.rel
d_a_obj_mgate.rel
@ -149,8 +149,8 @@ d_a_obj_nameplate.rel
d_a_obj_ornament_cloth.rel
d_a_obj_rope_bridge.rel
d_a_obj_stick.rel
d_a_obj_stonemark.rel
d_a_obj_swallshutter.rel
d_a_obj_stoneMark.rel
d_a_obj_sWallShutter.rel
d_a_obj_swpropeller.rel
d_a_obj_swpush5.rel
d_a_obj_yobikusa.rel
@ -160,7 +160,7 @@ d_a_sq.rel
d_a_swc00.rel
d_a_tag_ajnot.rel
d_a_tag_attack_item.rel
d_a_tag_cstasw.rel
d_a_tag_CstaSw.rel
d_a_tag_gstart.rel
d_a_tag_hinit.rel
d_a_tag_hjump.rel
@ -274,24 +274,24 @@ def copyRelFiles(gamePath, buildPath, aMemList, mMemList):
"Folder:rels/amem/\nFolder:rels/mmem/\nFolder:rels/./\nFolder:rels/../\n"
)
for i, rel in enumerate(aMemRels.splitlines()):
filesTxtData = filesTxtData + str(i + 4) + ":rels/amem/" + rel + ":0xa500\n"
filesTxtData = filesTxtData + str(i + 4) + ":rels/amem/" + rel.lower() + ":0xa500\n"
filesTxtData = filesTxtData + "Folder:rels/amem/./\nFolder:rels/amem/../\n"
for i, rel in enumerate(mMemRels.splitlines()):
filesTxtData = filesTxtData + str(i + 83) + ":rels/mmem/" + rel + ":0xa500\n"
filesTxtData = filesTxtData + str(i + 83) + ":rels/mmem/" + rel.lower() + ":0xa500\n"
filesTxtData = filesTxtData + "Folder:rels/mmem/./\nFolder:rels/mmem/../\n"
open(buildPath / "RELS.arc/_files.txt", "w").write(filesTxtData)
for rel in relArcPaths:
for rel2 in aMemRels.splitlines():
if str(rel).find(rel2) != -1:
sourceRel = open(rel, "rb").read()
open(buildPath / "RELS.arc/rels/amem/" / rel2, "wb").write(
open(buildPath / "RELS.arc/rels/amem/" / rel2.lower(), "wb").write(
libyaz0.compress(sourceRel)
)
break
for rel2 in mMemRels.splitlines():
if str(rel).find(rel2) != -1:
sourceRel = open(rel, "rb").read()
open(buildPath / "RELS.arc/rels/mmem/" / rel2, "wb").write(
open(buildPath / "RELS.arc/rels/mmem/" / rel2.lower(), "wb").write(
libyaz0.compress(sourceRel)
)
break
@ -338,6 +338,12 @@ def main(gamePath, buildPath, copyCode):
copyRelFiles(gamePath, buildPath, aMemRels.splitlines(), mMemRels.splitlines())
shutil.copy(buildPath/"dolzel2/frameworkF.str",buildPath/"dolzel2/game/files/str/Final/Release/frameworkF.str")
now = datetime.now()
copydate = str(now.year)+"/"+str(now.month).zfill(2)+"/"+str(now.day).zfill(2)+" "+str(now.hour).zfill(2)+":"+str(now.minute).zfill(2)+"\n"
open(buildPath/"dolzel2/game/files/str/Final/Release/COPYDATE","w").write(copydate)
if __name__ == "__main__":
pass