git subrepo pull tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "8c86e4b95b"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "8c86e4b95b"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"
This commit is contained in:
Ethan Roseman 2021-02-15 19:04:16 +09:00
parent 96fedfeb70
commit ec4b1cc9a1
5 changed files with 23 additions and 14 deletions

View File

@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/ethteck/splat.git
branch = master
commit = e8f767532226d2c9d8f84400d5652e4d60b20262
parent = 39ea4c7a86197cf7a4bd244ee55520c0be051c52
commit = 8c86e4b95b95112444391aa5959a96dc0e1f2322
parent = 96fedfeb70807d8b812cea9f7b7a0f4990c23e3b
method = merge
cmdver = 0.4.3

View File

@ -4,7 +4,7 @@ from util.n64 import Yay0decompress
class N64SegYay0(N64Segment):
def split(self, rom_bytes, base_path):
out_dir = self.create_parent_dir(base_path + "/" + self.options.get("assets_dir", "bin"), self.name)
out_dir = self.create_parent_dir(os.path.join(base_path, self.options.get("assets_dir", "bin")), self.name)
path = os.path.join(out_dir, os.path.basename(self.name) + ".bin")
with open(path, "wb") as f:

View File

@ -3,12 +3,11 @@ from segtypes.n64.segment import N64Segment
from pathlib import Path
from segtypes.segment import Segment
class N64SegBin(N64Segment):
def split(self, rom_bytes, base_path):
out_dir = Segment.create_split_dir(base_path, self.options.get("assets_dir", "bin"))
bin_path = os.path.join(out_dir, self.name + ".bin")
bin_path = os.path.join(out_dir, self.name + ".bin")
Path(bin_path).parent.mkdir(parents=True, exist_ok=True)
with open(bin_path, "wb") as f:
f.write(rom_bytes[self.rom_start: self.rom_end])

View File

@ -188,8 +188,8 @@ class CodeSubsegment(Subsegment):
if func_name not in defined_funcs:
segment.create_c_asm_file(funcs_text, func, asm_out_dir, self, func_name)
if not os.path.exists(generic_out_path) and self.options.get("create_new_c_files", True):
self.create_c_file(funcs_text, self, asm_out_dir, base_path, generic_out_path)
if not os.path.exists(generic_out_path) and segment.options.get("create_new_c_files", True):
segment.create_c_file(funcs_text, self, asm_out_dir, base_path, generic_out_path)
else:
out_lines = self.get_asm_header()
for func in funcs_text:
@ -204,15 +204,16 @@ class CodeSubsegment(Subsegment):
class DataSubsegment(Subsegment):
def split_inner(self, segment, rom_bytes, base_path, generic_out_path):
asm_out_dir = Segment.create_split_dir(base_path, os.path.join("asm", "data"))
if not self.type.startswith("."):
asm_out_dir = Segment.create_split_dir(base_path, os.path.join("asm", "data"))
outpath = Path(os.path.join(asm_out_dir, self.name + f".{self.type}.s"))
outpath.parent.mkdir(parents=True, exist_ok=True)
outpath = Path(os.path.join(asm_out_dir, self.name + f".{self.type}.s"))
outpath.parent.mkdir(parents=True, exist_ok=True)
file_text = segment.disassemble_data(self, rom_bytes)
if file_text:
with open(outpath, "w", newline="\n") as f:
f.write(file_text)
file_text = segment.disassemble_data(self, rom_bytes)
if file_text:
with open(outpath, "w", newline="\n") as f:
f.write(file_text)
class BssSubsegment(DataSubsegment):
def __init__(self, start, end, name, type, vram, args):
@ -832,6 +833,12 @@ class N64SegCode(N64Segment):
else:
stype = "byte"
# If we're starting from a weird place, make sure our container size is correct
if dis_start % 4 != 0 and stype != "byte" and sym_len > 1:
stype = "short"
if dis_start % 2 != 0:
stype = "byte"
if not rodata_encountered and mnemonic == "jtbl":
rodata_encountered = True
ret += "\n\n\n.section .rodata"

View File

@ -34,6 +34,9 @@ class Symbol:
def contains_vram(self, offset):
return offset >= self.vram_start and offset < self.vram_end
def contains_rom(self, offset):
return offset >= self.rom and offset < self.rom_end
def __init__(self, vram, given_name=None, rom=None, type="unknown", in_overlay=False, size=4):
self.defined = False
self.referenced = False