Extract assets to build folder for version

This commit is contained in:
octorock 2021-09-11 10:59:03 +02:00
parent 54b078a1aa
commit 55cd163122
3 changed files with 16 additions and 9 deletions

View File

@ -56,14 +56,16 @@ ASM_SUBDIR = asm
DATA_ASM_SUBDIR = data
SONG_SUBDIR = sound/songs
MID_SUBDIR = sound/songs/midi
ASSET_SUBDIR = assets
C_BUILDDIR = $(OBJ_DIR)/$(C_SUBDIR)
ASM_BUILDDIR = $(OBJ_DIR)/$(ASM_SUBDIR)
DATA_ASM_BUILDDIR = $(OBJ_DIR)/$(DATA_ASM_SUBDIR)
SONG_BUILDDIR = $(OBJ_DIR)/$(SONG_SUBDIR)
MID_BUILDDIR = $(OBJ_DIR)/$(MID_SUBDIR)
ASSET_BUILDDIR = $(OBJ_DIR)/$(ASSET_SUBDIR)
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(REVISION) --defsym $(GAME_LANGUAGE)=1
ASFLAGS := -mcpu=arm7tdmi --defsym $(GAME_VERSION)=1 --defsym REVISION=$(REVISION) --defsym $(GAME_LANGUAGE)=1 -I $(ASSET_BUILDDIR)
CC1 := tools/agbcc/bin/agbcc
override CFLAGS += -O2 -Wimplicit -Wparentheses -Werror -Wno-multichar
@ -147,7 +149,11 @@ MAKEFLAGS += --no-print-directory
AUTO_GEN_TARGETS :=
all: extractassets $(ROM)
# TODO do we really need this extra step just so that extractassets always runs at first?
all: extractassets
@$(MAKE) target
target: $(ROM)
@$(SHA1) $(BUILD_NAME).sha1
# kept for backwards compat
@ -157,7 +163,7 @@ compare: $(ROM)
setup: $(TOOLDIRS)
extractassets:
python tools/asset_extractor/asset_extractor.py $(GAME_VERSION)
python tools/asset_extractor/asset_extractor.py $(GAME_VERSION) $(ASSET_BUILDDIR)
$(TOOLDIRS):
@$(MAKE) -C $@

View File

@ -6,7 +6,7 @@ import yaml
verbose = False
def extract_assets(variant):
def extract_assets(variant, assets_folder):
print(f'Extract assets from {variant}.')
map = {
'USA': 'baserom.gba',
@ -37,7 +37,7 @@ def extract_assets(variant):
# This asset is not used in the current variant
continue
path = asset['path']
path = os.path.join(assets_folder, asset['path'])
if os.path.isfile(path):
if verbose:
print(f'{path} already extracted.')
@ -83,10 +83,10 @@ def extract_tileset(path):
def main():
if len(sys.argv) == 1:
extract_assets('USA')
elif len(sys.argv) == 2:
extract_assets(sys.argv[1].upper())
elif len(sys.argv) == 3:
extract_assets(sys.argv[1].upper(), sys.argv[2])
else:
print('Usage: asset_extractor.py VARIANT')
print('Usage: asset_extractor.py VARIANT BUILD_FOLDER')
if __name__ == '__main__':
main()

View File

@ -93,7 +93,8 @@ int main(int argc, char **argv)
includeDirs.push_back(file.GetSrcDir());
for (auto incbin : file.GetIncbins())
{
dependencies.insert(incbin);
// TODO add incbin dependencies in correct folder?
//dependencies.insert(incbin);
}
for (auto include : file.GetIncludes())
{