Skip to content

Commit

Permalink
Add PSP platform (#958)
Browse files Browse the repository at this point in the history
* Add PSP platform

* black

* Add credits for font used in PSP logo

* Switch wine for wibo + bump version

* use wine again for pspsnc.exe

* bump asm-differ
  • Loading branch information
mkst authored Feb 15, 2024
1 parent 29cf418 commit 2f206fd
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
poetry run python3 libraries/download.py
- name: Install wibo
run: |-
wget https://github.com/decompals/wibo/releases/download/0.6.10/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
wget https://github.com/decompals/wibo/releases/download/0.6.12/wibo && chmod +x wibo && sudo cp wibo /usr/bin/
- name: Run backend tests
run: |-
Expand Down
18 changes: 10 additions & 8 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ RUN apt-get -y update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

RUN curl -sSL https://install.python-poetry.org/ | \
POETRY_VERSION=1.6.1 POETRY_HOME=/etc/poetry python3.10 -
POETRY_VERSION=1.6.1 POETRY_HOME=/etc/poetry python3.10 -

COPY --from=nsjail /nsjail/nsjail /bin/nsjail

COPY --from=ghcr.io/decompals/wibo:0.6.10 /usr/local/sbin/wibo /usr/bin/
COPY --from=ghcr.io/decompals/wibo:0.6.12 /usr/local/sbin/wibo /usr/bin/

RUN add-apt-repository -y ppa:dosemu2/ppa && \
apt-get update && \
Expand All @@ -75,11 +75,11 @@ ARG ENABLE_MSDOS_SUPPORT
ARG ENABLE_PS2_SUPPORT
ARG ENABLE_WIN9X_SUPPORT
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN9X_SUPPORT}" = "YES" ]; then \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN9X_SUPPORT}" = "YES" ]; then \
dpkg --add-architecture i386 && apt-get update && \
apt-get install -y -o APT::Immediate-Configure=false \
wine; \
wine; \
fi

# msdos specific
Expand Down Expand Up @@ -107,9 +107,9 @@ USER user

# initialize wine files to /home/user/.wine
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ] || \
[ "${ENABLE_NDS_ARM9_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN9X_SUPPORT}" = "YES" ]; then \
[ "${ENABLE_NDS_ARM9_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN9X_SUPPORT}" = "YES" ]; then \
wineboot --init; \
fi

Expand All @@ -123,6 +123,7 @@ ARG ENABLE_N3DS_SUPPORT
ARG ENABLE_N64_SUPPORT
ARG ENABLE_NDS_ARM9_SUPPORT
ARG ENABLE_PS1_SUPPORT
ARG ENABLE_PSP_SUPPORT
ARG ENABLE_SATURN_SUPPORT
ARG ENABLE_SWITCH_SUPPORT

Expand All @@ -135,6 +136,7 @@ ENV ENABLE_N64_SUPPORT=${ENABLE_N64_SUPPORT}
ENV ENABLE_NDS_ARM9_SUPPORT=${ENABLE_NDS_ARM9_SUPPORT}
ENV ENABLE_PS1_SUPPORT=${ENABLE_PS1_SUPPORT}
ENV ENABLE_PS2_SUPPORT=${ENABLE_PS2_SUPPORT}
ENV ENABLE_PSP_SUPPORT=${ENABLE_PSP_SUPPORT}
ENV ENABLE_SATURN_SUPPORT=${ENABLE_SATURN_SUPPORT}
ENV ENABLE_SWITCH_SUPPORT=${ENABLE_SWITCH_SUPPORT}
ENV ENABLE_WIN9X_SUPPORT=${ENABLE_WIN9X_SUPPORT}
Expand Down
6 changes: 6 additions & 0 deletions backend/compilers/compilers.linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ ps2:
- mwcps2-3.0b22-020716
- mwcps2-3.0b22-020926

psp:
- pspsnc_1.2.7503.0
- mwccpsp_3.0.1_121
- mwccpsp_3.0.1_147
- mwccpsp_3.0.1_151

saturn:
- cygnus-2.7-96Q3

Expand Down
32 changes: 32 additions & 0 deletions backend/coreapp/compilers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
NDS_ARM9,
PS1,
PS2,
PSP,
SATURN,
SWITCH,
WIN9X,
Expand Down Expand Up @@ -565,6 +566,32 @@ def available_platforms() -> List[Platform]:
cc='${WINE} "${COMPILER_DIR}/mwccps2.exe" -c $COMPILER_FLAGS -nostdinc -stderr "$INPUT" -o "$OUTPUT"',
)

# PSP
PSPSNC_1_2_7503_0 = GCCCompiler(
id="pspsnc_1.2.7503.0",
platform=PSP,
cc='${WINE} ${COMPILER_DIR}/pspsnc.exe -c -td=. ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}"',
)

MWCCPSP_CC = (
'${WIBO} ${COMPILER_DIR}/mwccpsp.exe -c ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}"'
)

MWCCPSP_3_0_1_121 = MWCCCompiler(
id="mwccpsp_3.0.1_121",
platform=PSP,
cc=MWCCPSP_CC,
)
MWCCPSP_3_0_1_147 = MWCCCompiler(
id="mwccpsp_3.0.1_147",
platform=PSP,
cc=MWCCPSP_CC,
)
MWCCPSP_3_0_1_151 = MWCCCompiler(
id="mwccpsp_3.0.1_151",
platform=PSP,
cc=MWCCPSP_CC,
)

# N64
IDO53 = IDOCompiler(
Expand Down Expand Up @@ -1216,6 +1243,11 @@ def available_platforms() -> List[Platform]:
GCC281_MIPSEL,
GCC29166_MIPSEL,
GCC2952_MIPSEL,
# PSP
PSPSNC_1_2_7503_0,
MWCCPSP_3_0_1_121,
MWCCPSP_3_0_1_147,
MWCCPSP_3_0_1_151,
# Saturn
CYGNUS_2_7_96Q3,
# PS2
Expand Down
2 changes: 1 addition & 1 deletion backend/coreapp/decompiler_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def decompile(
return f"decompiled({asm})"

ret = default_source_code
if platform.arch in ["mips", "mipsee", "mipsel", "ppc"]:
if platform.arch in ["mips", "mipsee", "mipsel", "mipsel:4000", "ppc"]:
if len(asm.splitlines()) > MAX_M2C_ASM_LINES:
return "/* Too many lines to decompile; please run m2c manually */"
try:
Expand Down
33 changes: 32 additions & 1 deletion backend/coreapp/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def from_id(platform_id: str) -> Platform:
name="PlayStation",
description="MIPS (little-endian)",
arch="mipsel",
assemble_cmd='mips-linux-gnu-as -march=r3000 -mabi=32 -o "$OUTPUT" "$INPUT"',
assemble_cmd='mips-linux-gnu-as -EL -march=r3000 -mabi=32 -o "$OUTPUT" "$INPUT"',
objdump_cmd="mips-linux-gnu-objdump",
nm_cmd="mips-linux-gnu-nm",
diff_flags=COMMON_DIFF_FLAGS + COMMON_MIPS_DIFF_FLAGS,
Expand Down Expand Up @@ -285,6 +285,36 @@ def from_id(platform_id: str) -> Platform:
""",
)

PSP = Platform(
id="psp",
name="PlayStation Portable",
description="MIPS (little-endian)",
arch="mipsel:4000",
assemble_cmd='mips-linux-gnu-as -EL -march=r4000 -mabi=32 -o "$OUTPUT" "$INPUT"',
objdump_cmd="mips-linux-gnu-objdump",
nm_cmd="mips-linux-gnu-nm",
diff_flags=COMMON_DIFF_FLAGS + COMMON_MIPS_DIFF_FLAGS,
asm_prelude="""
.macro .late_rodata
.section .rodata
.endm
.macro glabel label
.global \label
.type \label, @function
\label:
.endm
.macro jlabel label
\label:
.endm
.set noat
.set noreorder
""",
)

SATURN = Platform(
id="saturn",
name="Saturn",
Expand Down Expand Up @@ -713,6 +743,7 @@ def from_id(platform_id: str) -> Platform:
"n3ds": N3DS,
"ps1": PS1,
"ps2": PS2,
"psp": PSP,
"saturn": SATURN,
"macosx": MACOSX,
"msdos": MSDOS,
Expand Down
2 changes: 1 addition & 1 deletion backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/src/app/(navfooter)/credits/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const ICON_SOURCES = {
"Saturn by JustDanPatrick": "https://upload.wikimedia.org/wikipedia/commons/archive/7/78/20220518145749%21Sega_Saturn_Black_Logo.svg",
"MS-DOS by Microsoft": "https://commons.wikimedia.org/wiki/File:Msdos-icon.svg",
"Windows 9x by Microsoft": "https://commons.wikimedia.org/wiki/File:Windows_Logo_(1992-2001).svg",
"PerSPire Font by Sean Liew": "https://www.fontspace.com/sean-liew",
}

type Contributor = {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/PlatformSelect/PlatformIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import LogoN64 from "./n64.svg"
import LogoNDS from "./nds.svg"
import LogoPS1 from "./ps1.svg"
import LogoPS2 from "./ps2.svg"
import LogoPSP from "./psp.svg"
import LogoSaturn from "./saturn.svg"
import LogoSwitch from "./switch.svg"
import UnknownIcon from "./unknown.svg"
Expand All @@ -25,6 +26,7 @@ const ICONS = {
"nds_arm9": LogoNDS,
"ps1": LogoPS1,
"ps2": LogoPS2,
"psp": LogoPSP,
"n3ds": LogoN3DS,
"switch": LogoSwitch,
"saturn": LogoSaturn,
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/PlatformSelect/psp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions frontend/src/lib/i18n/locales/en/compilers.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@

"psyq4.4-ccpsx": "CCPSX (PSYQ4.4: gcc 2.8.1 + aspsx 2.79)",

"mwccpsp_3.0.1_121": "MWCC 1.0 (3.0.1 121)",
"mwccpsp_3.0.1_147": "MWCC 1.1 (3.0.1 147)",
"mwccpsp_3.0.1_151": "MWCC 1.1 SP1 (3.0.1 151)",
"pspsnc_1.2.7503.0": "SN 1.2.7503.0",

"wcc10.5": "Watcom Optimizing C i386 Compiler 10.5",
"wpp10.5": "Watcom Optimizing C++ i386 Compiler 10.5",
"wcc10.5a": "Watcom Optimizing C i386 Compiler 10.5a",
Expand Down

0 comments on commit 2f206fd

Please sign in to comment.