Skip to content

Commit

Permalink
vendor flips and add ninja task for it
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 committed Aug 31, 2024
1 parent d6b881d commit 0bc83e1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ jobs:
uses: cargo-bins/cargo-binstall@main
- name: Install pigment64
run: cargo binstall pigment64 -y
- name: Setup Flips
run: |
curl -L https://dl.smwcentral.net/11474/floating.zip -o floating.zip
unzip floating.zip
rm floating.zip
chmod +x flips-linux
- name: Download baserom
run: curl -L $BASEROM_US_URL -o ver/us/baserom.z64
env:
Expand All @@ -35,15 +29,12 @@ jobs:
- name: Configure
run: ./configure
- name: Build
run: ninja
- name: Create patch file
# flips works but returns a non-zero exit code if the rom shrunk
run: ./flips-linux ver/us/baserom.z64 ver/us/build/papermario.z64 papermario.bps || true
run: ninja ver/us/build/papermario.bps
- name: Upload patch as artifact
uses: actions/upload-artifact@v2
with:
name: papermario.bps
path: papermario.bps
path: ver/us/build/papermario.bps
prerelease:
name: Prerelease
runs-on: ubuntu-latest
Expand Down
15 changes: 15 additions & 0 deletions tools/build/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ def write_ninja_rules(

ninja.rule("pm_sbn", command=f"$python {BUILD_TOOLS}/audio/sbn.py $out $asset_stack")

ninja.rule("flips", command=f"bash -c '{BUILD_TOOLS}/floating/flips $baserom $in $out || true'")


def write_ninja_for_tools(ninja: ninja_syntax.Writer):
ninja.rule(
Expand Down Expand Up @@ -427,6 +429,12 @@ def rom_path(self) -> Path:
def rom_ok_path(self) -> Path:
return self.elf_path().with_suffix(".ok")

def patch_path(self) -> Path:
return self.elf_path().with_suffix(".bps")

def baserom_path(self) -> Path:
return Path(f"ver/{self.version}/baserom.z64")

def linker_script_path(self) -> Path:
# TODO: read from splat.yaml
return Path(f"ver/{self.version}/papermario.ld")
Expand Down Expand Up @@ -1253,6 +1261,13 @@ def build(
implicit=[str(self.rom_path())],
)

ninja.build(
str(self.patch_path()),
"flips",
str(self.rom_path()),
variables={"baserom": str(self.baserom_path())},
)

ninja.build("generated_code_" + self.version, "phony", generated_code)
ninja.build("inc_img_bins_" + self.version, "phony", inc_img_bins)

Expand Down
Binary file added tools/build/floating/flips
Binary file not shown.
11 changes: 11 additions & 0 deletions tools/build/floating/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Flips is licensed under GNU General Public License, version 3.0 or higher. The full legal text can
be found in boring.zip; a rough interpretation (for non-lawyers only) follows:

- You must credit the author. Don't claim it as your own. You may modify it and take credit for your
modifications, but the author (Alcaro) must be credited for the original software.
- If you modify this software, it must clearly be labeled as a modification.
- Any applications containing any part of this software must provide the full source code needed to
modify and rebuild this application, under the same license. Including this interpretation is
optional.
- The author claims no copyright over input, output, or error messages generated by this tool. Use
it however you want.

0 comments on commit 0bc83e1

Please sign in to comment.