diff --git a/Dockerfile b/Dockerfile index c0d33680..fbe6b183 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 as build +FROM ubuntu:24.04 as build # --- basic package installation --- RUN apt-get update && \ @@ -12,7 +12,8 @@ RUN apt-get update && \ # --- python package installation --- COPY ./requirements.txt /temp/requirements.txt COPY ./tools/ppcdis/requirements.txt /temp/tools/ppcdis/requirements.txt -RUN pip install -r /temp/requirements.txt +# why bother setting up a venv for this, right? ¯\_(ツ)_/¯ +RUN pip install --break-system-packages -r /temp/requirements.txt RUN rm -rf /temp # --- wibo installation --- @@ -23,26 +24,23 @@ RUN rm wibo # --- devkitpro installation --- RUN wget https://apt.devkitpro.org/install-devkitpro-pacman RUN chmod +x install-devkitpro-pacman -## assume yes for in-script apt commands +# assume yes for in-script apt commands RUN sed -i 's/^apt-get.*$/& -y/g' install-devkitpro-pacman -## now do dkp-pacman installation RUN ./install-devkitpro-pacman RUN rm install-devkitpro-pacman -## workaround for a dumb WSL bug that happens with Windows Docker. if we don't do this, devkitPPC installation fails on Windows. +# workaround for a dumb bug that happens with Windows Docker. if we don't do this, devkitPPC installation fails on Windows. RUN if [ ! -e /etc/mtab ]; then ln -s /proc/self/mounts /etc/mtab; fi -## and finally, we get to install devkitPPC RUN dkp-pacman -S devkitPPC --noconfirm -## dear fucking god this is hacky but it works (needed otherwise next step fails) -RUN rm /usr/bin/cpp /usr/bin/g++ -## set devkitPPC executables as the default ones +# dear fucking god this is hacky but it works (needed otherwise next step fails) +RUN rm /usr/bin/cpp /usr/bin/g++ /lib/cpp +# set devkitPPC executables as the default ones RUN for file in $(find "/opt/devkitpro/devkitPPC/bin" -type f -name 'powerpc-eabi*'); do new_file=$(basename "$file" | sed 's/powerpc-eabi-//g'); update-alternatives --install "/usr/bin/$new_file" "$new_file" "$file" 0; done # --- stage ultralib headers --- -RUN mkdir -p /N64_SDK/ultra/usr/ RUN git clone https://github.com/decompals/ultralib.git /N64_SDK/ultra/usr/ -## dockerfile does not seem to support extglob, so this monstrous command works around it to delete all of ultralib except the headers we need. +# dockerfile does not seem to support extglob, so this monstrous command works around it to delete all of ultralib except the headers we need. RUN cd /N64_SDK/ultra/usr/ && find -type f -maxdepth 1 -delete && find . -not -name 'include' -type d -maxdepth 1 -exec rm -r "{}" \; -## modify Gpopmtx's param member to be unsigned int +# modify Gpopmtx's param member to be unsigned int RUN sed -i 's/unsigned char param:8;/unsigned int param:8;/g' /N64_SDK/ultra/usr/include/PR/gbi.h # --- set up work directory and env vars --- diff --git a/README.MD b/README.MD index 2c0ac959..299986bf 100644 --- a/README.MD +++ b/README.MD @@ -7,27 +7,27 @@ Decompilation in progress of Animal Crossing (GAFE01) A decompilation of the original N64 version of the game is being worked on [here](https://github.com/zeldaret/af). + ## Cloning Use `--recursive` when cloning to have ppcdis in the repository. ## Building -> ℹ️ When using Windows, it's recommended to use WSL. +> ℹ️ On Windows, the build is known to run disproportionately slow when ran natively, so we recommend using WSL. ### Docker 1. [Dump a copy of the game](./docs/extract_game.md) and extract all files. 2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*. -3. Download the [CodeWarrior 1.3.2, 1.3.2r, and 1.2.5n compilers](https://files.decomp.dev/compilers_latest.zip) and extract them to *tools/1.3.2/*, *tools/1.3.2r/*, and *tools/1.2.5n/*, respectively. -4. Install Docker. -5. Build the Docker image (`docker build -t ac-decomp .`). -6. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`). -7. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`). +3. Install Docker. +4. Set up the Docker image. If using MacOS or Linux (including WSL), run `chmod +x docker-setup.sh && ./docker-setup.sh`. If using Windows, run the `docker-setup.bat` file. +5. Run configure.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 configure.py`). +6. Run build.py (`docker run --rm -v ${PWD}:/ac-decomp ac-decomp python3 build.py`). ### Build manually -> ℹ️ When building manually from a work directory originally used for Docker, you will need to run `sudo ninja -t clean` for the build to execute properly. +> ℹ️ When building manually from a work directory previously used for Docker, you will need to run `sudo ninja -t clean` for the build to execute properly. 1. [Dump a copy of the game](./docs/extract_game.md) and extract all files. 2. Place **main.dol**, **foresta.rel.szs**, **forest_1st.arc**, and **forest_2nd.arc** in *dump/*. @@ -36,7 +36,7 @@ Use `--recursive` when cloning to have ppcdis in the repository. 5. Install Python modules from requirements.txt (`pip install -r requirements.txt`). 6. Install version 0.6.13 of [wibo](https://github.com/decompals/wibo) - Wibo is a lightweight Wine replacement that's tailor-made for use with decomp projects. Regular Wine can be used if preferred, but for the purposes of this guide, these instructions will use wibo. - - Download [version 0.6.13 GitHub release](https://github.com/decompals/wibo/releases/tag/0.6.13) and run `install ./wibo /usr/bin` to install it to your system. + - Download the [GitHub release of version 0.6.13](https://github.com/decompals/wibo/releases/tag/0.6.13) and run `install ./wibo /usr/bin` to install it to your system. 7. Install devkitPPC. - To get devkitPPC, you'll need [devkitPro Pacman](https://devkitpro.org/wiki/devkitPro_pacman#Installing_devkitPro_Pacman). - Run `dkp-pacman -S devkitPPC` once dkp-pacman is installed to install devkitPPC. diff --git a/docker-setup.bat b/docker-setup.bat new file mode 100644 index 00000000..e4c09736 --- /dev/null +++ b/docker-setup.bat @@ -0,0 +1,15 @@ +@echo off +echo "Please ensure Docker Desktop is running before continuing." +pause +curl -O https://files.decomp.dev/compilers_latest.zip +mkdir compilers_temp +tar -xf compilers_latest.zip -C compilers_temp +xcopy compilers_temp\GC\1.2.5n\ tools\1.2.5n\ /E /I +xcopy compilers_temp\GC\1.3.2\ tools\1.3.2\ /E /I +xcopy compilers_temp\GC\1.3.2r\ tools\1.3.2r\ /E /I +del compilers_latest.zip +rmdir /S /Q compilers_temp\ +docker build -t ac-decomp . +echo "Docker image setup is now complete. You may proceed with the instructions." +pause +exit diff --git a/docker-setup.sh b/docker-setup.sh new file mode 100644 index 00000000..65453b80 --- /dev/null +++ b/docker-setup.sh @@ -0,0 +1,24 @@ +echo "Please ensure Docker is installed before continuing." +read -p "Press Enter to continue or CTRL-C to exit." +if command -v curl &> /dev/null; then + curl -O https://files.decomp.dev/compilers_latest.zip +elif command -v wget &> /dev/null; then + wget https://files.decomp.dev/compilers_latest.zip +else + echo "You do not seem to have curl or wget installed on this system. Please install one or the other to continue." + exit 0 +fi + +mkdir compilers_temp +if command -v unzip &> /dev/null; then + unzip compilers_latest.zip -d compilers_temp +else + echo "You do not seem to have unzip installed on this system. Please install it to continue." + rm compilers_latest.zip + rm -r compilers_temp + exit 1 +fi +mv compilers_temp/GC/1.2.5n/ tools/ && mv compilers_temp/GC/1.3.2/ tools/ && mv compilers_temp/GC/1.3.2r/ tools/ +rm -r compilers_temp compilers_latest.zip +docker build -t ac-decomp . +echo "Docker image setup is now complete. You may proceed with the instructions."