From 4839e3c48ab70a3bc2606c933a4573fbb77c8dd4 Mon Sep 17 00:00:00 2001 From: glankk Date: Fri, 23 Feb 2018 00:58:09 +0100 Subject: [PATCH] added make-rom-vc and patch-vc --- makefile | 2 +- patch/lua/make-patch-vc.lua | 18 ++---------------- patch/lua/make-rom-vc.lua | 3 +++ patch/lua/patch-vc.lua | 3 +++ patch/lua/patch-wad.lua | 2 +- patch/make-rom-vc | 5 +++++ patch/make-rom-vc.bat | 7 +++++++ patch/patch-vc | 6 ++++++ patch/patch-vc.bat | 8 ++++++++ 9 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 patch/lua/make-rom-vc.lua create mode 100644 patch/lua/patch-vc.lua create mode 100755 patch/make-rom-vc create mode 100644 patch/make-rom-vc.bat create mode 100755 patch/patch-vc create mode 100644 patch/patch-vc.bat diff --git a/makefile b/makefile index 8ca37e07..34f218e8 100644 --- a/makefile +++ b/makefile @@ -93,7 +93,7 @@ endef define hooks_template = HOOKS-$(1) = $$(DIR-$(1))/hooks.gsc $$(HOOKS-$(1)) : $$(ELF-$(1)) - AS="$$(AS)" CC="$$(CC)" NM="$$(NM)" READELF="$$(READELF)" CPPFLAGS="$$(CPPFLAGS)" $$(GENHOOKS) $$< > $$@ + AS="$$(AS)" CC="$$(CC)" NM="$$(NM)" READELF="$$(READELF)" CPPFLAGS="$$(subst ",\",$$(CPPFLAGS))" $$(GENHOOKS) $$< > $$@ $(1)-hooks : $$(HOOKS-$(1)) clean-$(1)-hooks : rm -f $$(HOOKS-$(1)) diff --git a/patch/lua/make-patch-vc.lua b/patch/lua/make-patch-vc.lua index abf81579..bd973952 100644 --- a/patch/lua/make-patch-vc.lua +++ b/patch/lua/make-patch-vc.lua @@ -1,17 +1,3 @@ -local arg = {...} -if #arg < 1 then - print("usage: `make-patch-vc `") - return -end wiivc = true -local make = loadfile("patch/lua/make.lua") -for i = 1, #arg do - print("making patch for `" .. arg[i] .. "`") - local rom_info, rom, patched_rom = make(arg[i]) - if rom_info ~= nil then - print("saving patch") - local rom_id = rom_info.game .. "-" .. rom_info.version .. "-" .. rom_info.region - gru.ups_create(rom, patched_rom):save("patch/ups/gz-" .. rom_id .. ".ups") - end -end -print("done") +local make_patch = loadfile("patch/lua/make-patch.lua") +return make_patch(...) diff --git a/patch/lua/make-rom-vc.lua b/patch/lua/make-rom-vc.lua new file mode 100644 index 00000000..7ead6593 --- /dev/null +++ b/patch/lua/make-rom-vc.lua @@ -0,0 +1,3 @@ +wiivc = true +local make_rom = loadfile("patch/lua/make-rom.lua") +return make_rom(...) diff --git a/patch/lua/patch-vc.lua b/patch/lua/patch-vc.lua new file mode 100644 index 00000000..3d5b5023 --- /dev/null +++ b/patch/lua/patch-vc.lua @@ -0,0 +1,3 @@ +wiivc = true +local patch = loadfile("lua/patch.lua") +return patch(...) diff --git a/patch/lua/patch-wad.lua b/patch/lua/patch-wad.lua index 60d48b35..5bf7a663 100644 --- a/patch/lua/patch-wad.lua +++ b/patch/lua/patch-wad.lua @@ -9,11 +9,11 @@ if #arg < 1 then if line == nil or line == "" then return end arg[1] = line end -wiivc = true local gzinject = os.getenv("GZINJECT") if gzinject == nil or gzinject == "" then gzinject = "gzinject" end +wiivc = true require("lua/rom_table") local n = 0 for i = 1, #arg do diff --git a/patch/make-rom-vc b/patch/make-rom-vc new file mode 100755 index 00000000..7e1cb7d4 --- /dev/null +++ b/patch/make-rom-vc @@ -0,0 +1,5 @@ +#!/usr/bin/env sh +set -e + +cd $(dirname $(readlink -f $0))/.. +gru patch/lua/make-rom-vc.lua "$@" diff --git a/patch/make-rom-vc.bat b/patch/make-rom-vc.bat new file mode 100644 index 00000000..76f56c51 --- /dev/null +++ b/patch/make-rom-vc.bat @@ -0,0 +1,7 @@ +@echo off +setlocal +pushd . +%~d0 +cd %~dp0/.. +gru patch/lua/make-rom-vc.lua %* +popd diff --git a/patch/patch-vc b/patch/patch-vc new file mode 100755 index 00000000..de343dee --- /dev/null +++ b/patch/patch-vc @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +set -e + +cd $(dirname $(readlink -f $0)) +export PATH="$(readlink -f ./bin):$PATH" +gru lua/patch-vc.lua "$@" diff --git a/patch/patch-vc.bat b/patch/patch-vc.bat new file mode 100644 index 00000000..534fbe6a --- /dev/null +++ b/patch/patch-vc.bat @@ -0,0 +1,8 @@ +@echo off +setlocal +pushd . +%~d0 +cd %~dp0 +set PATH=./bin;%PATH% +gru lua/patch-vc.lua %* +popd