Merge commit 'ce53be92716b0f5201882d6959c398b61c6cc93c'
All checks were successful
Build / build (push) Successful in 1m23s
All checks were successful
Build / build (push) Successful in 1m23s
This commit is contained in:
@ -32,10 +32,7 @@ def file_to_hex(path: str, line_prefix: str) -> tuple[str, int]:
|
||||
i = 1
|
||||
for b in data:
|
||||
out += f"{b:#0{4}x},"
|
||||
if i % 10 == 0:
|
||||
out += '\n\t'
|
||||
else:
|
||||
out += ' '
|
||||
out += '\n\t' if i % 10 == 0 else ' '
|
||||
i += 1
|
||||
return out[:-1], len(data)
|
||||
except FileNotFoundError:
|
||||
@ -47,7 +44,7 @@ def file_to_cpp(path: str, cpp_name: str) -> tuple[str, str]:
|
||||
cpp = ''
|
||||
hpp = ''
|
||||
data, data_len = file_to_hex(path, "\t")
|
||||
cpp += f'\nstatic constexpr ox::Array<uint8_t, {data_len}> {cpp_name}Data {{\n{data}\n}};\n'
|
||||
cpp += f'\nstatic const ox::Array<uint8_t, {data_len}> {cpp_name}Data {{\n{data}\n}};\n'
|
||||
cpp += f'\nox::SpanView<uint8_t> {cpp_name}() noexcept {{ return {cpp_name}Data; }}\n'
|
||||
hpp += f'\n[[nodiscard]]\nox::SpanView<uint8_t> {cpp_name}() noexcept;\n'
|
||||
return cpp, hpp
|
||||
@ -57,14 +54,8 @@ def proc_rsrc_file(rsrc_path: str):# Open and read the JSON file
|
||||
with open(rsrc_path, 'r') as file:
|
||||
data = json.load(file)
|
||||
base_path = pathlib.Path(rsrc_path).parent.absolute()
|
||||
if 'all_files' in data:
|
||||
all_files = data['all_files']
|
||||
else:
|
||||
all_files = None
|
||||
if 'namespace' in data:
|
||||
namespace = data['namespace']
|
||||
else:
|
||||
namespace = ''
|
||||
all_files = data['all_files'] if 'all_files' in data else None
|
||||
namespace = data['namespace'] if 'namespace' in data else ''
|
||||
if len(namespace) > 0:
|
||||
push_ns = f'namespace {namespace} {{\n'
|
||||
pop_ns = '\n}\n'
|
||||
@ -96,8 +87,9 @@ def proc_rsrc_file(rsrc_path: str):# Open and read the JSON file
|
||||
hpp += h
|
||||
if all_files is not None:
|
||||
all_files_func += f'\t\t{cpp_name}(),\n'
|
||||
cpp += all_files_func + '\t};\n}\n'
|
||||
hpp += all_files_func_decl
|
||||
if all_files is not None:
|
||||
cpp += all_files_func + '\t};\n}\n'
|
||||
hpp += all_files_func_decl
|
||||
cpp += pop_ns
|
||||
hpp += pop_ns
|
||||
write_txt_file(os.path.join(base_path, data['cpp']), cpp)
|
||||
|
@ -17,6 +17,10 @@ os = platform.system().lower()
|
||||
arch = platform.machine()
|
||||
host_env = f'{os}-{arch}'
|
||||
|
||||
def run(args: list[str]):
|
||||
if subprocess.run(args).returncode != 0:
|
||||
sys.exit(1)
|
||||
|
||||
# get current build type
|
||||
with open(".current_build", "r") as f:
|
||||
current_build = f.readlines()[0]
|
||||
@ -31,9 +35,9 @@ project_gba = f'{project_name}.gba'
|
||||
project_manifest = f'{project_name.lower()}-manifest.json'
|
||||
|
||||
shutil.copyfile(project_bin, project_gba)
|
||||
subprocess.run([
|
||||
run([
|
||||
f'{bin}/{project_name.lower()}-pack',
|
||||
'-src', project_dir,
|
||||
'-rom-bin', project_gba,
|
||||
'-manifest', project_manifest])
|
||||
subprocess.run(['gbafix', project_gba])
|
||||
run(['gbafix', project_gba])
|
||||
|
Reference in New Issue
Block a user