Skip to content

Commit

Permalink
Add ctx.c and README.md to dump branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ribbanya committed Nov 11, 2023
1 parent c032597 commit 9bc7681
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 9 deletions.
6 changes: 6 additions & 0 deletions .github/packages/build-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT entrypoint.sh

FROM linux-base AS dump-asm
ARG SHORT_SHA
ARG TREE_URL
VOLUME [ "/input", "/output" ]
COPY .github/packages/dump-asm/readme.py /usr/local/bin
RUN chmod +x /usr/local/bin/readme.py
COPY .github/packages/dump-asm/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
ENV SHORT_SHA="${SHORT_SHA}"
ENV TREE_URL="${TREE_URL}"
ENTRYPOINT entrypoint.sh

# TODO
Expand Down
4 changes: 2 additions & 2 deletions .github/packages/build-linux/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
#!/bin/bash
set -euox pipefail

git clone /input /tmp/input
cd /tmp/input
Expand Down
4 changes: 2 additions & 2 deletions .github/packages/build-linux/setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
#!/bin/bash
set -euox pipefail

apt update

Expand Down
4 changes: 2 additions & 2 deletions .github/packages/check-issues/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -e
#!/bin/bash
set -euox pipefail

cd /input

Expand Down
12 changes: 9 additions & 3 deletions .github/packages/dump-asm/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
#!/bin/sh
set -e
#!/bin/bash
set -euox pipefail

git clone /input /tmp/input
cd /tmp/input
ln -s /opt/mwcc_compiler tools/

make -j"$(nproc)" WINE="$WINE" GENERATE_MAP=1 MAX_ERRORS=1

. /opt/venv/bin/activate
pip install --no-cache-dir -r requirements.txt

make -j"$(nproc)" WINE="$WINE" GENERATE_MAP=1 MAX_ERRORS=1
cp build/ssbm.us.1.2/GALE01.map /output/

readme.py >/output/README.md

python tools/parse_map.py
python tools/m2ctx/m2ctx.py -pn \
>/output/ctx.c
dadosod dol build/ssbm.us.1.2/main.dol \
-m build/map.csv \
-o /output
43 changes: 43 additions & 0 deletions .github/packages/dump-asm/readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
import os
import subprocess

if __name__ == "__main__":
short_sha = os.getenv("SHORT_SHA")
tree_url = os.getenv("TREE_URL")

progress = subprocess.run(
[
"python",
"tools/calcprogress/calcprogress.py",
"--dol",
"build/ssbm.us.1.2/main.dol",
"--map",
"build/ssbm.us.1.2/GALE01.map",
"--asm-obj-ext",
".s.o",
"--old-map",
"true",
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
).stdout.strip()

readme = f"""# Super Smash Bros Melee Dump
This is a dump of the built ELF from Super Smash Bros Melee.
* For files built from raw assembly, see [`asm`](/asm).
* For files built from C source code, see [`src`](/src).
* For the MetroWorks map file, which can be used with Dolphin, see [`GALE01.map`](/GALE01.map).
* For the context file that can be used on [decomp.me](https://decomp.me/), see [`ctx.c`](/ctx.c).
* This dump was created from commit [`{short_sha}`]({tree_url}).
# Progress
```
{progress}
```"""

print(readme)
4 changes: 4 additions & 0 deletions .github/workflows/dump-asm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ jobs:

- name: Dump assembly
run: |
short_sha="$(echo "${{ github.sha }}" | cut -c 1-7)"
tree_url="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}"
docker run --rm \
--volume "$PWD:/input:ro" \
--volume /tmp/output:/output \
-e SHORT_SHA="$short_sha" \
-e TREE_URL="$tree_url" \
${{ env.REGISTRY }}/${{ env.IMAGE }}
- name: Upload dumped assembly
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,13 @@ jobs:
- name: Try dumping assembly
if: matrix.target == 'dump-asm'
run: |
short_sha="$(echo "${{ github.sha }}" | cut -c 1-7)"
tree_url="${{ github.server_url }}/${{ github.repository }}/tree/${{ github.sha }}"
docker run --rm \
--volume "$PWD:/input:ro" \
--volume /tmp/output:/output \
-e SHORT_SHA="$short_sha" \
-e TREE_URL="$tree_url" \
"$IMAGE:test"
- name: Extract tags and labels
Expand Down

0 comments on commit 9bc7681

Please sign in to comment.