Skip to content

Commit c0c00b1

Browse files
authored
Add Wii U platform with ghs 5.3.22 (#1753)
* Add Wii U platform with ghs 5.3.22 * Update m2c_wrapper.py * Use wine for GHS * Add GHS inlining modes * Set GHS temporary directory * Use local temp file for GHS * biome + ruff * Update wiiu.svg
1 parent 7403db7 commit c0c00b1

File tree

8 files changed

+61
-0
lines changed

8 files changed

+61
-0
lines changed

backend/compilers/compilers.linux.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ msdos:
212212
- bcc2.0
213213
- bcc3.1
214214

215+
wiiu:
216+
- ghs5.3.22
217+
215218
win32:
216219
- msvc4.0
217220
- msvc4.1

backend/coreapp/compilers.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
COMMON_GCC_PS1_FLAGS,
1818
COMMON_GCC_PS2_FLAGS,
1919
COMMON_GCC_SATURN_FLAGS,
20+
COMMON_GHS_FLAGS,
2021
COMMON_IDO_FLAGS,
2122
COMMON_MSVC_FLAGS,
2223
COMMON_MWCC_NDS_ARM9_FLAGS,
@@ -43,6 +44,7 @@
4344
SATURN,
4445
DREAMCAST,
4546
SWITCH,
47+
WIIU,
4648
WIN32,
4749
Platform,
4850
)
@@ -219,6 +221,13 @@ class BorlandCompiler(Compiler):
219221
library_include_flag: str = ""
220222

221223

224+
@dataclass(frozen=True)
225+
class GHSCompiler(Compiler):
226+
platform: Platform = WIIU
227+
flags: ClassVar[Flags] = COMMON_GHS_FLAGS
228+
library_include_flag: str = "-I"
229+
230+
222231
def from_id(compiler_id: str) -> Compiler:
223232
if compiler_id not in _compilers:
224233
raise APIException(
@@ -973,6 +982,13 @@ def available_platforms() -> List[Platform]:
973982
cc='"${COMPILER_DIR}"/bin/mips64-elf-gcc -I "${COMPILER_DIR}"/mips64-elf/include -c ${COMPILER_FLAGS} "${INPUT}" -o "${OUTPUT}"',
974983
)
975984

985+
# GHS
986+
GHS5322 = GHSCompiler(
987+
id="ghs5.3.22",
988+
platform=WIIU,
989+
cc='${WINE} "${COMPILER_DIR}/bin/cxppc.exe" -c -tmp="${OUTPUT}".s ${COMPILER_FLAGS} -o "${OUTPUT}" "${INPUT}"',
990+
)
991+
976992
# IRIX
977993
IDO53_IRIX = IDOCompiler(
978994
id="ido5.3_irix",
@@ -1760,6 +1776,8 @@ def available_platforms() -> List[Platform]:
17601776
XCODE_GCC400_C,
17611777
XCODE_GCC400_CPP,
17621778
PBX_GCC3,
1779+
# WIIU
1780+
GHS5322,
17631781
# WIN32
17641782
MSVC40,
17651783
MSVC41,

backend/coreapp/flags.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,24 @@ def to_json(self) -> Dict[str, Union[str, List[str]]]:
294294
),
295295
]
296296

297+
COMMON_GHS_FLAGS: Flags = [
298+
FlagSet(id="ghs_c_dialect", flags=["-c99", "-C99", "-ANSI", "-ansi", "-gcc"]),
299+
FlagSet(
300+
id="ghs_opt_level",
301+
flags=["-Ospeed", "-Osize", "-Ogeneral", "-Odebug", "-Omoredebug"],
302+
),
303+
FlagSet(id="ghs_rtti_mode", flags=["--rtti", "--no_rtti"]),
304+
FlagSet(id="ghs_exceptions_mode", flags=["--exceptions", "--no_exceptions"]),
305+
FlagSet(id="ghs_ansi_alias_mode", flags=["-ansi_alias", "-no_ansi_alias"]),
306+
FlagSet(
307+
id="ghs_inlining_mode", flags=["--max_inlining", "--inlining", "--no_inlining"]
308+
),
309+
Checkbox("ghs_gnu_mode", "--g++"),
310+
Checkbox("ghs_enable_noinline", "--enable_noinline"),
311+
Checkbox("ghs_link_once_templates", "--link_once_templates"),
312+
Checkbox("ghs_only_explicit_reg_use", "-only_explicit_reg_use"),
313+
]
314+
297315
COMMON_MSVC_FLAGS: Flags = [
298316
FlagSet(
299317
id="msvc_opt_level", flags=["/Od", "/O1", "/O2", "/Os", "/Ot", "/Og", "/Ox"]

backend/coreapp/m2c_wrapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class M2CError(Exception):
2323
"ps2": "mipsee",
2424
"psp": "mipsel",
2525
# ppc
26+
"wiiu": "ppc",
2627
"gc_wii": "ppc",
2728
"macosx": "ppc",
2829
# arm

backend/coreapp/platforms.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,17 @@ def from_id(platform_id: str) -> Platform:
251251
has_decompiler=True,
252252
)
253253

254+
WIIU = Platform(
255+
id="wiiu",
256+
name="Nintendo Wii U",
257+
description="PowerPC",
258+
arch="ppc",
259+
assemble_cmd='powerpc-eabi-as -mgekko -o "$OUTPUT" "$PRELUDE" "$INPUT"',
260+
objdump_cmd="powerpc-eabi-objdump -M broadway",
261+
nm_cmd="powerpc-eabi-nm",
262+
has_decompiler=True,
263+
)
264+
254265
_platforms: OrderedDict[str, Platform] = OrderedDict(
255266
{
256267
"dummy": DUMMY,
@@ -268,6 +279,7 @@ def from_id(platform_id: str) -> Platform:
268279
"dreamcast": DREAMCAST,
269280
"macosx": MACOSX,
270281
"msdos": MSDOS,
282+
"wiiu": WIIU,
271283
"win32": WIN32,
272284
}
273285
)

frontend/src/components/PlatformSelect/PlatformIcon.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import LogoPSP from "./psp.svg";
1717
import LogoSaturn from "./saturn.svg";
1818
import LogoSwitch from "./switch.svg";
1919
import UnknownIcon from "./unknown.svg";
20+
import LogoWiiU from "./wiiu.svg";
2021
import LogoWin32 from "./win32.svg";
2122

2223
/** In release-date order */
@@ -33,6 +34,7 @@ const ICONS = {
3334
ps2: LogoPS2,
3435
psp: LogoPSP,
3536
n3ds: LogoN3DS,
37+
wiiu: LogoWiiU,
3638
switch: LogoSwitch,
3739
saturn: LogoSaturn,
3840
dreamcast: LogoDreamcast,
Lines changed: 5 additions & 0 deletions
Loading

frontend/src/lib/i18n/locales/en/compilers.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@
8181
"gcc2.8.1pm": "GCC 2.8.1 (Paper Mario)",
8282
"gcc4.4.0-mips64-elf": "GCC 4.4.0 (mips64-elf)",
8383

84+
"ghs5.3.22": "GHS 5.3.22",
85+
8486
"ido5.3_irix": "IDO 5.3",
8587
"ido5.3_asm_irix": "IDO 5.3 AS",
8688
"ido5.3_c++_irix": "IDO 5.3 C++",

0 commit comments

Comments
 (0)