Skip to content

Commit

Permalink
Add CI configuration & objdiff report (#172)
Browse files Browse the repository at this point in the history
* Add CI configuration & objdiff report

* Add mq-e, ce-e to CI
  • Loading branch information
encounter authored Sep 4, 2024
1 parent 9f54fa4 commit 356fc1b
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 213 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build

on:
push:
pull_request:

jobs:
build:
container: ghcr.io/zeldaret/oot-gc-vc-build:main
runs-on: ubuntu-latest

steps:
# Checkout the repository (shallow clone)
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive

# Set Git config
- name: Git config
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

# Copy the original files to the workspace
- name: Prepare
run: cp -R /orig .

# Build the project
- name: Build
run: |
python configure.py --map --binutils /binutils --compilers /compilers
ninja all_source build/{mq-j,mq-u,mq-e,ce-j,ce-u,ce-e}/progress.json build/report.json
# Upload progress if we're on the main branch
- name: Upload progress
if: github.ref == 'refs/heads/main'
continue-on-error: true
env:
PROGRESS_SLUG: oot-vc
PROGRESS_API_KEY: ${{ secrets.PROGRESS_API_KEY }}
run: |
for version in {mq-j,mq-u,mq-e,ce-j,ce-u,ce-e}; do
python tools/upload_progress.py -b https://progress.decomp.club/ \
-p $PROGRESS_SLUG -v $version build/$version/progress.json
done
# Upload map files
- name: Upload map
uses: actions/upload-artifact@v4
with:
name: combined_maps
path: build/**/*.MAP

# Upload progress report
- name: Upload report
uses: actions/upload-artifact@v4
with:
name: combined_report
path: build/report.json
10 changes: 9 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
type=Path,
help="path to decomp-toolkit binary or source (optional)",
)
parser.add_argument(
"--objdiff",
metavar="BINARY | DIR",
type=Path,
help="path to objdiff-cli binary or source (optional)",
)
parser.add_argument(
"--sjiswrap",
metavar="EXE",
Expand Down Expand Up @@ -124,6 +130,7 @@

config.build_dir = args.build_dir
config.dtk_path = args.dtk
config.objdiff_path = args.objdiff
config.binutils_path = args.binutils
config.compilers_path = args.compilers
config.generate_map = args.map
Expand All @@ -141,6 +148,7 @@
config.binutils_tag = "2.42-1"
config.compilers_tag = "20231018"
config.dtk_tag = "v0.8.3"
config.objdiff_tag = "v2.0.0-beta.5"
config.sjiswrap_tag = "v1.1.1"
config.wibo_tag = "0.6.11"
config.linker_version = "GC/1.1"
Expand Down Expand Up @@ -214,7 +222,7 @@ def GenericLib(lib_name: str, cflags: List[str], objects: List[Object]) -> Dict[
### Link order

# Not matching for any version
NonMatching = {}
NonMatching: List[str] = []

# Matching for all versions
Matching = config.versions
Expand Down
8 changes: 4 additions & 4 deletions src/emulator/mcardGCN.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ static bool mcardPoll(MemCard* pMCard) {
}

if (pMCard->pPollFunction != NULL) {
if (!simulatorTestReset(false, false, false, false)) {
if (!SIMULATOR_TEST_RESET(false, false, false, false)) {
return false;
} else {
pMCard->pPollFunction();
Expand Down Expand Up @@ -1375,7 +1375,7 @@ bool mcardUpdate(void) {
prevIndex = 100;
counter = 0;
while (true) {
if (!simulatorTestReset(false, false, false, false)) {
if (!SIMULATOR_TEST_RESET(false, false, false, false)) {
return false;
}

Expand Down Expand Up @@ -1428,14 +1428,14 @@ bool mcardUpdate(void) {
}

if (toggle != true && mCard.writeStatus == 0 || mCard.saveToggle != true) {
if (!simulatorTestReset(false, false, true, false)) {
if (!SIMULATOR_TEST_RESET(false, false, true, false)) {
return false;
}

if (gpSystem->eTypeROM == SRT_ZELDA1 && mCard.saveToggle == true) {
do {
mcardMenu(&mCard, MC_M_SV12, &command);
if (!simulatorTestReset(false, false, true, false)) {
if (!SIMULATOR_TEST_RESET(false, false, true, false)) {
return false;
}
} while (mCard.wait == true);
Expand Down
18 changes: 17 additions & 1 deletion tools/download_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,21 @@ def dtk_url(tag: str) -> str:
repo = "https://github.com/encounter/decomp-toolkit"
return f"{repo}/releases/download/{tag}/dtk-{system}-{arch}{suffix}"

def objdiff_cli_url(tag: str) -> str:
uname = platform.uname()
suffix = ""
system = uname.system.lower()
if system == "darwin":
system = "macos"
elif system == "windows":
suffix = ".exe"
arch = uname.machine.lower()
if arch == "amd64":
arch = "x86_64"

repo = "https://github.com/encounter/objdiff"
return f"{repo}/releases/download/{tag}/objdiff-cli-{system}-{arch}{suffix}"


def sjiswrap_url(tag: str) -> str:
repo = "https://github.com/encounter/sjiswrap"
Expand All @@ -70,6 +85,7 @@ def wibo_url(tag: str) -> str:
"binutils": binutils_url,
"compilers": compilers_url,
"dtk": dtk_url,
"objdiff-cli": objdiff_cli_url,
"sjiswrap": sjiswrap_url,
"wibo": wibo_url,
}
Expand Down Expand Up @@ -112,6 +128,6 @@ def main() -> None:
data = data.replace(b"\xb9\x41\0\0\0\xf3\xa5\x8d\x44\x24\x04", b"\xb9\x51\0\0\0\xf3\xa5\x8d\x44\x24\x04")
with open(compiler_path, "wb") as outfile:
outfile.write(data)

if __name__ == "__main__":
main()
Loading

0 comments on commit 356fc1b

Please sign in to comment.