mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 09:45:02 +00:00
Docker Support for OSX (#91)
* Makefile machinery work
* Updating Jenkinsfile
* Initial setup for OSX repo support
* Adding ido7 to repo
* Makefile reversion
* Iniital Dockerfile
* Docker stuff
* fixbaserom cleanup
* Attempting to fix fixbaserom
* baserom_original -> input
* Revert "baserom_original -> input"
This reverts commit d9199462b6
.
* Spiffing up readme for OSX
This commit is contained in:
parent
4d3d264624
commit
f9bdb1d58a
22 changed files with 1354 additions and 21 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -24,7 +24,6 @@ baserom/
|
||||||
out.txt
|
out.txt
|
||||||
|
|
||||||
# Tool artifacts
|
# Tool artifacts
|
||||||
tools/ido7.1_compiler/*
|
|
||||||
tools/mipspro7.2_compiler/
|
tools/mipspro7.2_compiler/
|
||||||
tools/overlayhelpers/batchdisasm/output/*
|
tools/overlayhelpers/batchdisasm/output/*
|
||||||
tools/overlayhelpers/batchdisasm/output2/*
|
tools/overlayhelpers/batchdisasm/output2/*
|
||||||
|
@ -44,4 +43,4 @@ tools/asmsplitter/c/*
|
||||||
*.ci8.png
|
*.ci8.png
|
||||||
|
|
||||||
#Per-user configuration
|
#Per-user configuration
|
||||||
.python-version
|
.python-version
|
||||||
|
|
24
Dockerfile
Normal file
24
Dockerfile
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
FROM ubuntu:18.04 as build
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y \
|
||||||
|
binutils-mips-linux-gnu \
|
||||||
|
build-essential \
|
||||||
|
pkg-config \
|
||||||
|
python3 \
|
||||||
|
python3-pip \
|
||||||
|
wget \
|
||||||
|
git \
|
||||||
|
unzip
|
||||||
|
|
||||||
|
RUN wget \
|
||||||
|
https://github.com/n64decomp/qemu-irix/releases/download/v2.11-deb/qemu-irix-2.11.0-2169-g32ab296eef_amd64.deb \
|
||||||
|
-O qemu.deb && \
|
||||||
|
echo 8170f37cf03a08cc2d7c1c58f10d650ea0d158f711f6916da9364f6d8c85f741 qemu.deb | sha256sum --check && \
|
||||||
|
dpkg -i qemu.deb && \
|
||||||
|
rm qemu.deb
|
||||||
|
|
||||||
|
RUN python3 -m pip install --user colorama ansiwrap attrs watchdog python-Levenshtein
|
||||||
|
|
||||||
|
RUN mkdir /oot
|
||||||
|
WORKDIR /oot
|
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
|
@ -6,8 +6,6 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
echo 'Setting up...'
|
echo 'Setting up...'
|
||||||
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64'
|
sh 'cp /usr/local/etc/roms/baserom_oot.z64 baserom_original.z64'
|
||||||
sh 'cp -r /usr/local/etc/ido/ido7.1_compiler tools/ido7.1_compiler'
|
|
||||||
sh 'chmod +x -R tools/ido*'
|
|
||||||
sh 'make -j`nproc` setup'
|
sh 'make -j`nproc` setup'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ LD := $(MIPS_BINUTILS_PREFIX)ld
|
||||||
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
|
OBJCOPY := $(MIPS_BINUTILS_PREFIX)objcopy
|
||||||
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
|
OBJDUMP := $(MIPS_BINUTILS_PREFIX)objdump
|
||||||
|
|
||||||
# Be sure to grab ido7.1_compiler and put it in tools/ first.
|
|
||||||
CC := $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc
|
CC := $(QEMU_IRIX) -L tools/ido7.1_compiler tools/ido7.1_compiler/usr/bin/cc
|
||||||
CC_OLD := $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc
|
CC_OLD := $(QEMU_IRIX) -L tools/ido5.3_compiler tools/ido5.3_compiler/usr/bin/cc
|
||||||
|
|
||||||
|
@ -149,7 +148,7 @@ build/asm/%.o: asm/%.s
|
||||||
$(AS) $(ASFLAGS) $^ -o $@
|
$(AS) $(ASFLAGS) $^ -o $@
|
||||||
|
|
||||||
build/data/%.o: data/%.s
|
build/data/%.o: data/%.s
|
||||||
iconv --to EUC-JP $^ | $(AS) $(ASFLAGS) -o $@
|
iconv --from UTF-8 --to EUC-JP $^ | $(AS) $(ASFLAGS) -o $@
|
||||||
|
|
||||||
#build/assets/%.o: assets/%.s
|
#build/assets/%.o: assets/%.s
|
||||||
# $(AS) $(ASFLAGS) $^ -o $@
|
# $(AS) $(ASFLAGS) $^ -o $@
|
||||||
|
@ -175,7 +174,7 @@ build/src/overlays/%.o: src/overlays/%.c
|
||||||
@$(OBJDUMP) -d $@ > $(@:.o=.s)
|
@$(OBJDUMP) -d $@ > $(@:.o=.s)
|
||||||
|
|
||||||
build/asm/overlays/%.o: asm/overlays/%.s
|
build/asm/overlays/%.o: asm/overlays/%.s
|
||||||
iconv --to EUC-JP $^ | $(AS) $(ASFLAGS) -o $@
|
iconv --from UTF-8 --to EUC-JP $^ | $(AS) $(ASFLAGS) -o $@
|
||||||
|
|
||||||
build/src/%.o: src/%.c
|
build/src/%.o: src/%.c
|
||||||
$(CC) -c $(CFLAGS) $(OPTIMIZATION) -o $@ $^
|
$(CC) -c $(CFLAGS) $(OPTIMIZATION) -o $@ $^
|
27
README_OSX.md
Normal file
27
README_OSX.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
## Developing on OSX
|
||||||
|
|
||||||
|
#### Requirements
|
||||||
|
* Docker Desktop (for OSX)
|
||||||
|
* docker-sync (`gem install docker-sync`)
|
||||||
|
* a set-up baserom (see general setup guide / wiki for more details)
|
||||||
|
|
||||||
|
#### Build the docker image
|
||||||
|
`docker build . -t oot`
|
||||||
|
|
||||||
|
#### Start docker-sync and the development container
|
||||||
|
|
||||||
|
`docker-sync-stack start`
|
||||||
|
|
||||||
|
After a lot of waiting, you'll see something like "Attaching to oot_oot_1". This means the container is ready.
|
||||||
|
|
||||||
|
#### Log into the container to begin working
|
||||||
|
Note: this will be done in another tab while you leave the docker-sync tab going.
|
||||||
|
|
||||||
|
To get the container id, use `docker container ls` and use the ID from the container with image oot:latest in the following command
|
||||||
|
|
||||||
|
`docker exec-it <CONTAINER-ID> /bin/bash` You're in.
|
||||||
|
|
||||||
|
Run `make setup` followed by `make`, and you're off to the races!
|
||||||
|
|
||||||
|
#### When done working
|
||||||
|
Type Ctrl+c on the docker-cync tab to close the container and docker-sync.
|
11
docker-compose.yml
Normal file
11
docker-compose.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
oot:
|
||||||
|
volumes:
|
||||||
|
- oot-sync:/oot:nocopy
|
||||||
|
image: "oot:latest"
|
||||||
|
tty: true
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
oot-sync:
|
||||||
|
external: true
|
5
docker-sync.yml
Normal file
5
docker-sync.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
version: "2"
|
||||||
|
|
||||||
|
syncs:
|
||||||
|
oot-sync:
|
||||||
|
src: '.'
|
|
@ -1,37 +1,48 @@
|
||||||
import os.path
|
|
||||||
from os import path
|
from os import path
|
||||||
import sys
|
import sys
|
||||||
import struct
|
import struct
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
|
||||||
|
def get_str_hash(byte_array):
|
||||||
|
return str(hashlib.md5(byte_array).hexdigest())
|
||||||
|
|
||||||
|
|
||||||
|
# If the baserom exists and is correct, we don't need to change anything
|
||||||
|
if path.exists("baserom.z64"):
|
||||||
|
with open("baserom.z64", mode="rb") as file:
|
||||||
|
fileContent = bytearray(file.read())
|
||||||
|
if get_str_hash(fileContent) == "f0b7f35375f9cc8ca1b2d59d78e35405":
|
||||||
|
print("Found valid baserom - exiting early")
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
# Determine if we have a ROM file
|
# Determine if we have a ROM file
|
||||||
romFileName = ""
|
romFileName = ""
|
||||||
if (path.exists("baserom_original.z64")):
|
if path.exists("baserom_original.z64"):
|
||||||
romFileName = "baserom_original.z64"
|
romFileName = "baserom_original.z64"
|
||||||
elif (path.exists("baserom_original.n64")):
|
elif path.exists("baserom_original.n64"):
|
||||||
romFileName = "baserom_original.n64"
|
romFileName = "baserom_original.n64"
|
||||||
|
|
||||||
# Read in the original ROM
|
# Read in the original ROM
|
||||||
if (romFileName != ""):
|
if romFileName != "":
|
||||||
print("File '" + romFileName + "' found.")
|
print("File '" + romFileName + "' found.")
|
||||||
with open(romFileName, mode='rb') as file:
|
with open(romFileName, mode="rb") as file:
|
||||||
fileContent = bytearray(file.read())
|
fileContent = bytearray(file.read())
|
||||||
|
|
||||||
# Check if ROM needs to be byte swapped
|
# Check if ROM needs to be byte swapped
|
||||||
if (fileContent[0] == 0x40):
|
if fileContent[0] == 0x40:
|
||||||
# Byte Swap ROM
|
# Byte Swap ROM
|
||||||
# TODO: This is pretty slow at the moment. Look into optimizing it later...
|
# TODO: This is pretty slow at the moment. Look into optimizing it later...
|
||||||
print("ROM needs to be byte swapped...")
|
print("ROM needs to be byte swapped...")
|
||||||
i = 0
|
i = 0
|
||||||
while (i < len(fileContent)):
|
while i < len(fileContent):
|
||||||
tmp = struct.unpack_from("BBBB", fileContent, i)
|
tmp = struct.unpack_from("BBBB", fileContent, i)
|
||||||
struct.pack_into("BBBB", fileContent, i + 0, tmp[3], tmp[2], tmp[1], tmp[0])
|
struct.pack_into("BBBB", fileContent, i + 0, tmp[3], tmp[2], tmp[1], tmp[0])
|
||||||
i += 4
|
i += 4
|
||||||
|
|
||||||
perc = float(i) / float(len(fileContent))
|
perc = float(i) / float(len(fileContent))
|
||||||
|
|
||||||
if (i % (1024 * 1024 * 4) == 0):
|
if i % (1024 * 1024 * 4) == 0:
|
||||||
print(str(perc * 100) + "%")
|
print(str(perc * 100) + "%")
|
||||||
|
|
||||||
print("Byte swapping done.")
|
print("Byte swapping done.")
|
||||||
|
@ -48,10 +59,10 @@ print("Patching header...")
|
||||||
strippedContent[0x3E] = 0x50
|
strippedContent[0x3E] = 0x50
|
||||||
|
|
||||||
# Check to see if the ROM is a "vanilla" Debug ROM
|
# Check to see if the ROM is a "vanilla" Debug ROM
|
||||||
md5Hash = hashlib.md5(bytes(strippedContent)).hexdigest()
|
str_hash = get_str_hash(bytearray(strippedContent))
|
||||||
|
if str_hash != "f0b7f35375f9cc8ca1b2d59d78e35405":
|
||||||
if (str(md5Hash) != "f0b7f35375f9cc8ca1b2d59d78e35405"):
|
print("Error: Expected a hash of f0b7f35375f9cc8ca1b2d59d78e35405 but got " + str_hash + ". " +
|
||||||
print("Error: Expected a hash of f0b7f35375f9cc8ca1b2d59d78e35405 but got " + str(md5Hash) + ". The baserom has probably been tampered, find a new one")
|
"The baserom has probably been tampered, find a new one")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# Write out our new ROM
|
# Write out our new ROM
|
||||||
|
@ -60,4 +71,3 @@ with open("baserom.z64", mode="wb") as file:
|
||||||
file.write(bytes(strippedContent))
|
file.write(bytes(strippedContent))
|
||||||
|
|
||||||
print("Done!")
|
print("Done!")
|
||||||
|
|
||||||
|
|
BIN
tools/ido7.1_compiler/lib/cpp
Executable file
BIN
tools/ido7.1_compiler/lib/cpp
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/lib/libc.so.1
Executable file
BIN
tools/ido7.1_compiler/lib/libc.so.1
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/lib/libmalloc.so
Executable file
BIN
tools/ido7.1_compiler/lib/libmalloc.so
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/lib/rld
Executable file
BIN
tools/ido7.1_compiler/lib/rld
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/bin/cc
Executable file
BIN
tools/ido7.1_compiler/usr/bin/cc
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/as1
Executable file
BIN
tools/ido7.1_compiler/usr/lib/as1
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/cfe
Executable file
BIN
tools/ido7.1_compiler/usr/lib/cfe
Executable file
Binary file not shown.
1260
tools/ido7.1_compiler/usr/lib/err.english.cc
Executable file
1260
tools/ido7.1_compiler/usr/lib/err.english.cc
Executable file
File diff suppressed because it is too large
Load diff
BIN
tools/ido7.1_compiler/usr/lib/libc.so.1
Executable file
BIN
tools/ido7.1_compiler/usr/lib/libc.so.1
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/libexc.so
Executable file
BIN
tools/ido7.1_compiler/usr/lib/libexc.so
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/libm.so
Executable file
BIN
tools/ido7.1_compiler/usr/lib/libm.so
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/ugen
Executable file
BIN
tools/ido7.1_compiler/usr/lib/ugen
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/umerge
Executable file
BIN
tools/ido7.1_compiler/usr/lib/umerge
Executable file
Binary file not shown.
BIN
tools/ido7.1_compiler/usr/lib/uopt
Executable file
BIN
tools/ido7.1_compiler/usr/lib/uopt
Executable file
Binary file not shown.
Loading…
Reference in a new issue