Removed unnecesary prefixing

This commit is contained in:
KiritoDv
2023-08-26 11:28:48 -06:00
parent b0ce7b3c9e
commit ce180a0b63
4 changed files with 12 additions and 33 deletions
+1 -8
View File
@@ -52,17 +52,10 @@ add_subdirectory(tools)
# Find Python 3 for the custom target
find_package(Python3 COMPONENTS Interpreter REQUIRED)
set(TOOLS_PATH "")
if(WIN32)
set(TOOLS_PATH ${CMAKE_BINARY_DIR}/$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>)
message(STATUS "TOOLS_PATH: ${TOOLS_PATH}")
endif()
# Add a custom target to extract assets
add_custom_target(
ExtractAssets
COMMAND ${CMAKE_COMMAND} -E env "TOOLS_PATH=$<TARGET_FILE_DIR:mio0>" ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py ${VERSION} ${TOOLS_PATH}
COMMAND ${CMAKE_COMMAND} -E env "TOOLS_PATH=$<TARGET_FILE_DIR:mio0>" ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/extract_assets.py ${VERSION}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Running asset extraction..."
DEPENDS Tools
+1 -8
View File
@@ -76,12 +76,6 @@ def main():
clean_assets(local_asset_file)
sys.exit(0)
prefix = ""
if len(sys.argv) > 2:
prefix = sys.argv[2]
print("Prefixing assets with", prefix)
exit(1)
all_langs = ["jp", "us", "eu", "sh"]
if not langs or not all(a in all_langs for a in langs):
langs_str = " ".join("[" + lang + "]" for lang in all_langs)
@@ -179,7 +173,6 @@ def main():
sys.executable,
"tools/disassemble_sound.py",
"baserom." + lang + ".z64",
prefix
]
def append_args(key):
size, locs = asset_map["@sound " + key + " " + lang]
@@ -202,7 +195,7 @@ def main():
if mio0 is not None:
image = subprocess.run(
[
f"{prefix}{'mio0.exe' if os.name == 'nt' else 'tools/mio0'}",
'tools/mio0.exe' if os.name == 'nt' else 'tools/mio0',
"-d",
"-o",
str(mio0),
-4
View File
@@ -3,11 +3,7 @@
#include <libultra/types.h>
#include "types.h"
#ifdef _WIN32
#include <strings.h>
#else
#include <string.h>
#endif
#define MEMORY_POOL_LEFT 0
#define MEMORY_POOL_RIGHT 1
+10 -13
View File
@@ -516,14 +516,13 @@ def write_aifc(entry, out):
writer.finish()
def write_aiff(prefix, entry, filename):
def write_aiff(entry, filename):
temp = tempfile.NamedTemporaryFile(suffix=".aifc", delete=False)
try:
write_aifc(entry, temp)
temp.flush()
temp.close()
aifc_decode = os.path.join(prefix, "aifc_decode.exe" if os.name == "nt" else "aifc_decode")
print(aifc_decode)
aifc_decode = os.path.join(os.path.dirname(__file__), 'aifc_decode.exe' if os.name == 'nt' else 'aifc_decode')
subprocess.run([aifc_decode, temp.name, filename], check=True)
finally:
temp.close()
@@ -601,7 +600,7 @@ def main():
else:
args.append(a)
expected_num_args = 6 + (0 if only_samples else 2)
expected_num_args = 5 + (0 if only_samples else 2)
if (
need_help
or len(args) != expected_num_args
@@ -618,14 +617,13 @@ def main():
sys.exit(0 if need_help else 1)
rom_file = open(args[0], "rb")
prefix = args[1]
def read_at(offset, size):
rom_file.seek(int(offset))
return rom_file.read(int(size))
ctl_data = read_at(args[2], args[3])
tbl_data = read_at(args[4], args[5])
ctl_data = read_at(args[1], args[2])
tbl_data = read_at(args[3], args[4])
ctl_header_data = None
tbl_header_data = None
@@ -634,8 +632,8 @@ def main():
tbl_header_data = read_at(shindou_headers[2], shindou_headers[3])
if not only_samples:
samples_out_dir = args[6]
banks_out_dir = args[7]
samples_out_dir = args[5]
banks_out_dir = args[6]
banks = []
@@ -685,8 +683,7 @@ def main():
if dir not in created_dirs:
os.makedirs(dir, exist_ok=True)
created_dirs.add(dir)
os.makedirs(dir, exist_ok=True)
write_aiff(prefix, entry, filename)
write_aiff(entry, filename)
return
# Generate aiff files
@@ -714,7 +711,7 @@ def main():
# (The last chunk follows a more complex garbage pattern)
assert all(x == 0 for x in garbage)
filename = os.path.join(dir, entry.name + ".aiff")
write_aiff(prefix, entry, filename)
write_aiff(entry, filename)
# Generate sound bank .json files
os.makedirs(banks_out_dir, exist_ok=True)
@@ -811,4 +808,4 @@ def main():
if __name__ == "__main__":
main()
main()