Skip to content

Commit

Permalink
Splat update (#1136)
Browse files Browse the repository at this point in the history
* Remove splat from repo

* refactor scraps

* requirements update
  • Loading branch information
ethteck authored Jan 2, 2024
1 parent 9b96f91 commit 262428c
Show file tree
Hide file tree
Showing 166 changed files with 69 additions and 12,638 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"./tools",
"./tools/build",
"./tools/build/sprite",
"./tools/splat",
"./tools/build/imgfx"
"./tools/build/imgfx",
"./tools/splat/src"
],
"[c]": {
"editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?", // no $, for scripts
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ intervaltree
rabbitizer
n64img
python-githooks
crunch64>=0.2.0
splat64>=0.21.0
47 changes: 18 additions & 29 deletions tools/build/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def __init__(self, version: str):
self.linker_entries = None

def split(self, assets: bool, code: bool, shift: bool, debug: bool):
import split
import splat.scripts.split as split

modes = ["ld"]
if assets:
Expand Down Expand Up @@ -500,19 +500,6 @@ def write_ninja(
modern_gcc: bool,
c_maps: bool = False,
):
import segtypes
import segtypes.common.asm
import segtypes.common.bin
import segtypes.common.c
import segtypes.common.data
import segtypes.common.group
import segtypes.common.rodatabin
import segtypes.common.textbin
import segtypes.n64.header
import segtypes.n64.img
import segtypes.n64.palette
import segtypes.n64.yay0

assert self.linker_entries is not None

built_objects = set()
Expand Down Expand Up @@ -632,6 +619,8 @@ def build(
"actor_types",
)

import splat

# Build objects
for entry in self.linker_entries:
seg = entry.segment
Expand All @@ -641,16 +630,16 @@ def build(

assert entry.object_path is not None

if isinstance(seg, segtypes.n64.header.N64SegHeader):
if isinstance(seg, splat.segtypes.n64.header.N64SegHeader):
build(entry.object_path, entry.src_paths, "as")
elif isinstance(seg, segtypes.common.asm.CommonSegAsm) or (
isinstance(seg, segtypes.common.data.CommonSegData) and not seg.type[0] == "."
elif isinstance(seg, splat.segtypes.common.asm.CommonSegAsm) or (
isinstance(seg, splat.segtypes.common.data.CommonSegData) and not seg.type[0] == "."
):
build(entry.object_path, entry.src_paths, "as")
elif seg.type in ["pm_effect_loads", "pm_effect_shims"]:
build(entry.object_path, entry.src_paths, "as")
elif isinstance(seg, segtypes.common.c.CommonSegC) or (
isinstance(seg, segtypes.common.data.CommonSegData) and seg.type[0] == "."
elif isinstance(seg, splat.segtypes.common.c.CommonSegC) or (
isinstance(seg, splat.segtypes.common.data.CommonSegData) and seg.type[0] == "."
):
cflags = None
if isinstance(seg.yaml, dict):
Expand Down Expand Up @@ -733,9 +722,9 @@ def build(
)

# images embedded inside data aren't linked, but they do need to be built into .inc.c files
if isinstance(seg, segtypes.common.group.CommonSegGroup):
if isinstance(seg, splat.segtypes.common.group.CommonSegGroup):
for seg in seg.subsegments:
if isinstance(seg, segtypes.n64.img.N64SegImg):
if isinstance(seg, splat.segtypes.n64.img.N64SegImg):
flags = ""
if seg.n64img.flip_h:
flags += "--flip-x "
Expand Down Expand Up @@ -780,7 +769,7 @@ def build(
"bin_inc_c",
vars,
)
elif isinstance(seg, segtypes.n64.palette.N64SegPalette):
elif isinstance(seg, splat.segtypes.n64.palette.N64SegPalette):
src_paths = [seg.out_path().relative_to(ROOT)]
inc_dir = self.build_path() / "include" / seg.dir
bin_path = self.build_path() / seg.dir / (seg.name + ".pal.bin")
Expand Down Expand Up @@ -810,16 +799,16 @@ def build(
vars,
)
elif (
isinstance(seg, segtypes.common.bin.CommonSegBin)
or isinstance(seg, segtypes.common.textbin.CommonSegTextbin)
or isinstance(seg, segtypes.common.rodatabin.CommonSegRodatabin)
isinstance(seg, splat.segtypes.common.bin.CommonSegBin)
or isinstance(seg, splat.segtypes.common.textbin.CommonSegTextbin)
or isinstance(seg, splat.segtypes.common.rodatabin.CommonSegRodatabin)
):
build(entry.object_path, entry.src_paths, "bin")
elif isinstance(seg, segtypes.n64.yay0.N64SegYay0):
elif isinstance(seg, splat.segtypes.n64.yay0.N64SegYay0):
compressed_path = entry.object_path.with_suffix("") # remove .o
build(compressed_path, entry.src_paths, "yay0")
build(entry.object_path, [compressed_path], "bin")
elif isinstance(seg, segtypes.n64.img.N64SegImg):
elif isinstance(seg, splat.segtypes.n64.img.N64SegImg):
flags = ""
if seg.n64img.flip_h:
flags += "--flip-x "
Expand All @@ -845,7 +834,7 @@ def build(
# )
# vars = {"c_name": c_sym.name}
build(inc_dir / (seg.name + ".png.h"), entry.src_paths, "img_header")
elif isinstance(seg, segtypes.n64.palette.N64SegPalette):
elif isinstance(seg, splat.segtypes.n64.palette.N64SegPalette):
bin_path = entry.object_path.with_suffix(".bin")

build(
Expand Down Expand Up @@ -1382,7 +1371,7 @@ def make_current(self, ninja: ninja_syntax.Writer):
extra_cflags += " -Wmissing-braces -Wimplicit -Wredundant-decls -Wstrict-prototypes -Wno-redundant-decls"

# add splat to python import path
sys.path.insert(0, str((ROOT / args.splat).resolve()))
sys.path.insert(0, str((ROOT / args.splat / "src").resolve()))

ninja = ninja_syntax.Writer(open(str(ROOT / "build.ninja"), "w"), width=9999)

Expand Down
23 changes: 0 additions & 23 deletions tools/splat/.github/workflows/black.yml

This file was deleted.

23 changes: 0 additions & 23 deletions tools/splat/.github/workflows/mypy.yml

This file was deleted.

54 changes: 0 additions & 54 deletions tools/splat/.github/workflows/publish_docs_to_wiki.yml

This file was deleted.

20 changes: 0 additions & 20 deletions tools/splat/.github/workflows/unit_tests.yml

This file was deleted.

10 changes: 0 additions & 10 deletions tools/splat/.gitignore

This file was deleted.

12 changes: 0 additions & 12 deletions tools/splat/.gitrepo

This file was deleted.

Loading

0 comments on commit 262428c

Please sign in to comment.