[nostalgia] Rewrite pkg-gba in Python
This commit is contained in:
parent
79d43b56fb
commit
016f567c04
2
Makefile
2
Makefile
@ -12,7 +12,7 @@ endif
|
||||
|
||||
.PHONY: pkg-gba
|
||||
pkg-gba: install
|
||||
${ENV_RUN} ./scripts/pkg-gba sample_project
|
||||
${ENV_RUN} ${PYTHON3} ./scripts/pkg-gba.py sample_project
|
||||
|
||||
.PHONY: run
|
||||
run: build
|
||||
|
@ -1,16 +0,0 @@
|
||||
#! /usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
OS=$(uname | tr [:upper:] [:lower:])
|
||||
HOST_ENV=${OS}-$(uname -m)
|
||||
|
||||
BIN=./dist/${HOST_ENV}-$(cat .current_build)/bin/
|
||||
NOSTALGIA_BIN=build/gba-*/bin/nostalgia.bin
|
||||
NOSTALGIA_PROJECT=$1
|
||||
NOSTALGIA_GBA=nostalgia.gba
|
||||
|
||||
cp $NOSTALGIA_BIN $NOSTALGIA_GBA
|
||||
${BIN}/nost-pack -src $NOSTALGIA_PROJECT -rom-bin $NOSTALGIA_GBA
|
||||
gbafix $NOSTALGIA_GBA
|
32
scripts/pkg-gba.py
Executable file
32
scripts/pkg-gba.py
Executable file
@ -0,0 +1,32 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
#
|
||||
# Copyright 2016 - 2023 gary@drinkingtea.net
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
#
|
||||
|
||||
import platform
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
os = platform.system().lower()
|
||||
arch = platform.machine()
|
||||
host_env = f'{os}-{arch}'
|
||||
|
||||
# get current build type
|
||||
with open(".current_build","r") as f:
|
||||
current_build = f.readlines()[0]
|
||||
|
||||
bin = f'./dist/{host_env}-{current_build}/bin/'
|
||||
nostalgia_bin = 'build/gba-release/bin/nostalgia.bin'
|
||||
nostalgia_project = sys.argv[1]
|
||||
nostalgia_gba = 'nostalgia.gba'
|
||||
|
||||
shutil.copyfile(nostalgia_bin, nostalgia_gba)
|
||||
subprocess.run([
|
||||
f'{bin}/nost-pack', '-src', nostalgia_project, '-rom-bin', nostalgia_gba])
|
||||
subprocess.run(['gbafix', nostalgia_gba])
|
Loading…
Reference in New Issue
Block a user