Adding GC/Wii (MWCC) compilers (#192)

* Correct BfBB preset

* Adding more GC presets

* PR feedback

* Adding patched compilers for pikmin2/tp

* Increase new scratch container width

* updating prefix names: revenge of the colon
This commit is contained in:
Mark Street
2021-11-02 06:46:40 +00:00
committed by GitHub
parent c9dd1e9fa4
commit 29a1599fc9
38 changed files with 298 additions and 22 deletions

View File

@@ -41,4 +41,4 @@ You can CTRL+C to stop tailing logs. If you want to stop the processes then runn
## Configuration
By default the Docker `backend` image is built without PS1 support. If you wish to enable it, change `ENABLE_PS1_SUPPORT` to `YES` in the `docker-compose.yaml` and re-run the `docker-compose up --build` command.
By default the Docker `backend` image is built without PS1 and/or GC/Wii support. They can be enabled by changing the `ENABLE_PS1_SUPPORT` and/or `ENABLE_GC_WII_SUPPORT` variables to `"YES"` in the `docker-compose.yaml` and re-running the `docker-compose up --build` command.

View File

@@ -39,7 +39,7 @@ COPY --from=nsjail /bin/nsjail /bin/nsjail
# nsjail wants to mount this so ensure it exists
RUN mkdir -p /lib32
COPY compilers/download.sh /compilers/
COPY compilers/*.sh /compilers/
RUN bash /compilers/download.sh
@@ -59,6 +59,7 @@ RUN if [ "${ENABLE_PS1_SUPPORT}" = "YES" ] ; then \
# gc/wii specifics
RUN if [ "${ENABLE_GC_WII_SUPPORT}" = "YES" ] ; then \
bash /compilers/mwcc.sh && \
wget https://github.com/devkitPro/pacman/releases/download/v1.0.2/devkitpro-pacman.amd64.deb \
-O devkitpro.deb && \
echo ebc9f199da9a685e5264c87578efe29309d5d90f44f99f3dad9dcd96323fece3 devkitpro.deb | sha256sum --check && \

72
backend/compilers/mwcc.sh Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
set -euo pipefail
# patch (file, offset, value)
patch () {
echo "Patching $1 offset $2 with value $3"
printf $(printf '\\x%02X' ${3}) | dd of="${1}" bs=1 seek=${2} count=1 conv=notrunc &> /dev/null
}
compiler_dir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
compiler_url="https://cdn.discordapp.com/attachments/727918646525165659/806025523200393246/GC_WII_COMPILERS.zip"
mwcceppc_exe="mwcceppc.exe"
echo "compiler_dir is ${compiler_dir}"
declare -A GC_COMPILERS
GC_COMPILERS["1.0"]="mwcc_233_144"
GC_COMPILERS["1.1"]="mwcc_233_159"
GC_COMPILERS["1.2.5"]="mwcc_233_163"
GC_COMPILERS["1.3.2"]="mwcc_242_81"
GC_COMPILERS["2.0"]="mwcc_247_92"
GC_COMPILERS["2.5"]="mwcc_247_105"
GC_COMPILERS["2.6"]="mwcc_247_107"
GC_COMPILERS["2.7"]="mwcc_247_108"
GC_COMPILERS["3.0"]="mwcc_41_60831"
GC_COMPILERS["3.0a3"]="mwcc_41_60126"
declare -A WII_COMPILERS
WII_COMPILERS["1.0"]="mwcc_42_142"
WII_COMPILERS["1.1"]="mwcc_43_151"
WII_COMPILERS["1.3"]="mwcc_43_172"
WII_COMPILERS["1.7"]="mwcc_43_213"
echo "Downloading MWCC compilers"
wget -q -O "${compiler_dir}/compilers.zip" "${compiler_url}"
echo "Extracting compilers"
unzip -oq "${compiler_dir}/compilers.zip" -d "${compiler_dir}" && rm "${compiler_dir}/compilers.zip"
for key in "${!GC_COMPILERS[@]}"; do
compiler_id="${GC_COMPILERS[${key}]}"
compiler_version="${key}"
if [ -f "${compiler_dir}/GC/${compiler_version}/${mwcceppc_exe}" ]; then
echo "Moving ${compiler_dir}/GC/${compiler_version}/* to ${compiler_id}/"
mkdir -p "${compiler_dir}/${compiler_id}"
mv "${compiler_dir}/GC/${compiler_version}/"* "${compiler_dir}/${compiler_id}/"
fi
done
for key in "${!WII_COMPILERS[@]}"; do
compiler_id="${WII_COMPILERS[${key}]}"
compiler_version="${key}"
if [ -f "${compiler_dir}/Wii/${compiler_version}/${mwcceppc_exe}" ]; then
echo "Moving ${compiler_dir}/Wii/${compiler_version}/* to ${compiler_id}/"
mkdir -p "${compiler_dir}/${compiler_id}"
mv "${compiler_dir}/Wii/${compiler_version}/"* "${compiler_dir}/${compiler_id}/"
fi
done
# patch compilers
if [ -f "${compiler_dir}/mwcc_247_108/${mwcceppc_exe}" ]; then
mkdir -p "${compiler_dir}/mwcc_247_108_pikmin2"
cp -r "${compiler_dir}/mwcc_247_108/"* "${compiler_dir}/mwcc_247_108_pikmin2/"
patch "${compiler_dir}/mwcc_247_108_pikmin2/${mwcceppc_exe}" 222480 117
fi
if [ -f "${compiler_dir}/mwcc_247_108/${mwcceppc_exe}" ]; then
mkdir -p "${compiler_dir}/mwcc_247_108_tp"
cp -r "${compiler_dir}/mwcc_247_108/"* "${compiler_dir}/mwcc_247_108_tp/"
patch "${compiler_dir}/mwcc_247_108_tp/${mwcceppc_exe}" 1862228 109
fi

View File

@@ -1,4 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -fp hard -nostdinc ${CC_OPTS} -o \"${OUTPUT}\" \"${INPUT}\""
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -1,4 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -fp hard -nostdinc ${CC_OPTS} -o \"${OUTPUT}\" \"${INPUT}\""
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -1,4 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -fp hard -nostdinc ${CC_OPTS} -o \"${OUTPUT}\" \"${INPUT}\""
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -0,0 +1,4 @@
{
"platform": "gc_wii",
"cc": "wine \"${COMPILER_DIR}/mwcceppc.exe\" -c -proc gekko -nostdinc ${COMPILER_FLAGS} -o \"${OUTPUT}\" \"${INPUT}\""
}

View File

@@ -110,7 +110,7 @@
display: inline-flex;
flex-direction: column;
width: 20em;
min-width: 50%;
border-radius: 0.5em;
}

View File

@@ -97,8 +97,8 @@ export default function CompilerOpts({ platform, value, onChange, title, isPopup
} else {
opts = (" " + opts + " ").replace(" " + flag + " ", " ")
}
setOpts(opts.trim())
opts = opts.trim()
setOpts(opts)
},
}}>
<div className={styles.header} data-is-popup={isPopup}>

View File

@@ -40,9 +40,29 @@ export const PRESETS = [
opts: "-O2",
},
{
name: "SpongeBob SquarePants: BfBB",
compiler: "mwcc2.0",
opts: "-g",
name: "The Thousand-Year Door",
compiler: "mwcc_41_60831",
opts: "-nodefaults -Cpp_exceptions off -RTTI off -fp hard -enc SJIS -lang=c99 -O4 -use_lmw_stmw on -str pool -rostr -inline all -sdata 4 -sdata2 4",
},
{
name: "Pikmin 2",
compiler: "mwcc_247_108_pikmin2",
opts: "-nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -rostr -O4,p -use_lmw_stmw on -sdata 8 -sdata2 8 -msgstyle gcc",
},
{
name: "Battle for Bikini Bottom",
compiler: "mwcc_247_92",
opts: "-g -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -msgstyle gcc -maxerrors 1 -str reuse,pool,readonly -char unsigned -enum int -use_lmw_stmw on -inline off",
},
{
name: "Super Monkey Ball",
compiler: "mwcc_233_159",
opts: "-Cpp_exceptions off -nodefaults -O4,p -fp fmadd -fp_contract on -enum int",
},
{
name: "Twilight Princess",
compiler: "mwcc_247_108_tp",
opts: "-Cpp_exceptions off -nodefaults -O3 -fp hard -msgstyle gcc -str pool,readonly,reuse -RTTI off -maxerrors 1 -enum int",
},
]

View File

@@ -18,17 +18,44 @@ export function CommonMWCCFlags() {
<FlagOption flag="-O4,s" description="Extreme optimization + space" />
</FlagSet>
<FlagSet name="Floating point">
<FlagOption flag="-fp soft" description="Software emulation; default" />
<FlagOption flag="-fp off" description="No floating point" />
<FlagOption flag="-fp hard" description="Hardware" />
<FlagOption flag="-fp fmadd" description="Hardware + -fp_contract" />
</FlagSet>
<FlagSet name="Inline options">
<FlagOption flag="-inline on" description="Turn on inlining for 'inline' functions; default" />
<FlagOption flag="-inline off" description="Turn off inlining" />
<FlagOption flag="-inline auto" description="Auto-inline small functions" />
<FlagOption flag="-inline noauto" description="Do not auto-inline; default" />
<FlagOption flag="-inline all" description="Turn on aggressive inlining: same as '-inline on, auto'" />
<FlagOption flag="-inline deferred" description="Defer inlining until end of compilation unit" />
<FlagOption flag="-inline level=n" description="Cased; inline functions up to 'n' levels (0-8)" />
</FlagSet>
<FlagSet name="String constant options">
<FlagOption flag="-str reuse" description="Equivalent strings are the same object; default" />
<FlagOption flag="-str pool" description="Pool strings into a single data object" />
<FlagOption flag="-str readonly" description="make all string constants read-only" />
<FlagOption flag="-str reuse,pool,readonly" description="Reuse + pool + readonly" />
</FlagSet>
<Checkbox flag="-g" description="Enable debug info" />
<Checkbox flag="-Cpp_exceptions off" description="-Cpp_exceptions off" />
<Checkbox flag="-fp_contract on" description="-fp_contract on" />
<Checkbox flag="-msgstyle gcc " description="-msgstyle gcc " />
<Checkbox flag="-maxerrors 1" description="-maxerrors 1" />
<Checkbox flag="-RTTI off" description="-RTTI off" />
<Checkbox flag="-str reuse,pool,readonly" description="-str reuse,pool,readonly" />
<Checkbox flag="-char unsigned" description="-char unsigned" />
<Checkbox flag="-enum int" description="-enum int" />
<Checkbox flag="-use_lmw_stmw on" description="-use_lmw_stmw on" />
<Checkbox flag="-inline off" description="-inline off" />
<Checkbox flag="-align powerpc" description="PowerPC alignment; default" />
<Checkbox flag="-char unsigned" description="Chars are unsigned" />
<Checkbox flag="-Cpp_exceptions off" description="Disable C++ exceptions" />
<Checkbox flag="-enc SJIS" description="Specifies SJIS source encoding" />
<Checkbox flag="-enum int" description="Use int-sized enums" />
<Checkbox flag="-fp_contract on" description="Generate fused multiply-add instructions" />
<Checkbox flag="-lang=c99" description="Specify source language as c99" />
<Checkbox flag="-maxerrors 1" description="Maximum number of errors to print (1)" />
<Checkbox flag="-msgstyle gcc" description="gcc error/warning message style" />
<Checkbox flag="-nodefaults" description="Equivalent to '-nostdinc'" />
<Checkbox flag="-rostr" description="Make string constants read-only" />
<Checkbox flag="-RTTI off" description="Disable run-time typing information (for C++)" />
<Checkbox flag="-use_lmw_stmw on" description="Use multiple-word load/store instructions for structure copies; default" />
</>
}

View File

@@ -7,8 +7,21 @@ import * as Gcc281 from "./gcc2.8.1"
import * as Ido53 from "./ido5.3"
import * as Ido71 from "./ido7.1"
import * as Mwcc233b144 from "./mwcc_233_144"
import * as Mwcc233b159 from "./mwcc_233_159"
import * as Mwcc233b163 from "./mwcc_233_163"
import * as Mwcc242b81 from "./mwcc_242_81"
import * as Mwcc247b105 from "./mwcc_247_105"
import * as Mwcc247b107 from "./mwcc_247_107"
import * as Mwcc247b108 from "./mwcc_247_108"
import * as Mwcc247b108Pikmin2 from "./mwcc_247_108_pikmin2"
import * as Mwcc247b108Tp from "./mwcc_247_108_tp"
import * as Mwcc247b92 from "./mwcc_247_92"
import * as Mwcc41b60126 from "./mwcc_41_60126"
import * as Mwcc41b60831 from "./mwcc_41_60831"
import * as Mwcc42b142 from "./mwcc_42_142"
import * as Mwcc43b151 from "./mwcc_43_151"
import * as Mwcc43b172 from "./mwcc_43_172"
import * as Mwcc43b213 from "./mwcc_43_213"
import * as Psyq41 from "./psyq4.1"
import * as Psyq43 from "./psyq4.3"
import * as Psyq46 from "./psyq4.6"
@@ -19,8 +32,21 @@ const COMPILERS: CompilerModule[] = [
Ido71,
EeGcc296,
Mwcc233b144,
Mwcc233b159,
Mwcc233b163,
Mwcc242b81,
Mwcc247b105,
Mwcc247b107,
Mwcc247b108,
Mwcc247b108Pikmin2,
Mwcc247b108Tp,
Mwcc247b92,
Mwcc41b60831,
Mwcc41b60126,
Mwcc42b142,
Mwcc43b151,
Mwcc43b172,
Mwcc43b213,
Psyq41,
Psyq43,
Psyq46,

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.3.3 build 159 (GC MW 1.1)"
export const id = "mwcc_233_159"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.3.3 build 163 (GC MW 1.2.5)"
export const id = "mwcc_233_163"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.4.2 build 81 (GC MW 1.3.2)"
export const id = "mwcc_242_81"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.4.7 build 105 (GC MW 2.5)"
export const id = "mwcc_247_105"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.4.7 build 107 (GC MW 2.6)"
export const id = "mwcc_247_107"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.4.7 build 108 (GC MW 2.7: pikmin2)"
export const id = "mwcc_247_108_pikmin2"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "2.4.7 build 108 (GC MW 2.7: tp)"
export const id = "mwcc_247_108_tp"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.1 build 60126 (GC MW 3.0a3)"
export const id = "mwcc_41_60126"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.1 build 60831 (GC MW 3.0)"
export const id = "mwcc_41_60831"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.2 build 142 (Wii MW 1.0)"
export const id = "mwcc_42_142"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.3 build 151 (Wii MW 1.1)"
export const id = "mwcc_43_151"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.3 build 172 (Wii MW 1.3)"
export const id = "mwcc_43_172"
export const Flags = () => CommonMWCCFlags()

View File

@@ -0,0 +1,6 @@
import { CommonMWCCFlags } from "../compiler_settings/mwcc"
export const name = "4.3 build 213 (Wii MW 1.7)"
export const id = "mwcc_43_213"
export const Flags = () => CommonMWCCFlags()

View File

@@ -3,7 +3,7 @@
flex-direction: column;
gap: 1em;
max-width: 40em;
max-width: 50em;
padding: 1em;
cursor: default;