SHC/Dreamcast support (#1276)

* SHC support

* fixed platform icon order

* remove unnecessary ARG in dockerfile

* tidied up dreamcast CC, moved some flags to settings

* enable dreamcast support in CI

* fixed formatting

* cleaned up cc even more as per mkst's advice
This commit is contained in:
Exant64
2024-06-10 14:38:13 +03:00
committed by GitHub
parent 11b09b99f5
commit bd7dac639b
11 changed files with 77 additions and 0 deletions
+1
View File
@@ -169,6 +169,7 @@ jobs:
--build-arg ENABLE_GC_WII_SUPPORT=YES \
--build-arg ENABLE_PS2_SUPPORT=YES \
--build-arg ENABLE_SATURN_SUPPORT=YES \
--build-arg ENABLE_DREAMCAST_SUPPORT=YES \
--build-arg ENABLE_WIN32_SUPPORT=YES
- name: Run tests
run: |-
+4
View File
@@ -77,8 +77,10 @@ RUN add-apt-repository -y ppa:dosemu2/ppa && \
ARG ENABLE_MSDOS_SUPPORT
ARG ENABLE_PS2_SUPPORT
ARG ENABLE_WIN32_SUPPORT
ARG ENABLE_DREAMCAST_SUPPORT
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_DREAMCAST_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN32_SUPPORT}" = "YES" ]; then \
dpkg --add-architecture i386 && apt-get update && \
apt-get install -y -o APT::Immediate-Configure=false \
@@ -130,6 +132,7 @@ USER user
RUN if [ "${ENABLE_MSDOS_SUPPORT}" = "YES" ] || \
[ "${ENABLE_NDS_ARM9_SUPPORT}" = "YES" ] || \
[ "${ENABLE_PS2_SUPPORT}" = "YES" ] || \
[ "${ENABLE_DREAMCAST_SUPPORT}" = "YES" ] || \
[ "${ENABLE_WIN32_SUPPORT}" = "YES" ]; then \
wineboot --init; \
fi
@@ -151,6 +154,7 @@ ENV ENABLE_GC_WII_SUPPORT=${ENABLE_GC_WII_SUPPORT}
ENV ENABLE_MACOSX_SUPPORT=${ENABLE_MACOSX_SUPPORT}
ENV ENABLE_MSDOS_SUPPORT=${ENABLE_MSDOS_SUPPORT}
ENV ENABLE_N3DS_SUPPORT=${ENABLE_N3DS_SUPPORT}
ENV ENABLE_DREAMCAST_SUPPORT=${ENABLE_DREAMCAST_SUPPORT}
ENV ENABLE_N64_SUPPORT=${ENABLE_N64_SUPPORT}
ENV ENABLE_NDS_ARM9_SUPPORT=${ENABLE_NDS_ARM9_SUPPORT}
ENV ENABLE_PS1_SUPPORT=${ENABLE_PS1_SUPPORT}
+3
View File
@@ -169,6 +169,9 @@ psp:
saturn:
- cygnus-2.7-96Q3
dreamcast:
- shc-v5.1r11
macosx:
- gcc-5026
- gcc-5363
+19
View File
@@ -9,6 +9,7 @@ from coreapp import platforms
from coreapp.flags import (
COMMON_ARMCC_FLAGS,
COMMON_CLANG_FLAGS,
COMMON_SHC_FLAGS,
COMMON_GCC_FLAGS,
COMMON_GCC_PS1_FLAGS,
COMMON_GCC_PS2_FLAGS,
@@ -36,6 +37,7 @@ from coreapp.platforms import (
PS2,
PSP,
SATURN,
DREAMCAST,
SWITCH,
WIN32,
Platform,
@@ -107,6 +109,12 @@ class ArmccCompiler(Compiler):
library_include_flag: str = "-J"
@dataclass(frozen=True)
class SHCCompiler(Compiler):
flags: ClassVar[Flags] = COMMON_SHC_FLAGS
library_include_flag: str = ""
@dataclass(frozen=True)
class GCCCompiler(Compiler):
is_gcc: ClassVar[bool] = True
@@ -502,6 +510,15 @@ CYGNUS_2_7_96Q3 = GCCSaturnCompiler(
cc=SATURN_CC,
)
DREAMCAST_CC = (
'cat "$INPUT" | unix2dos > dos_src.c && '
"cp -r ${COMPILER_DIR}/bin/* . && "
"(SHC_LIB=. SHC_TMP=. ${WINE} ${COMPILER_DIR}/bin/shc.exe dos_src.c ${COMPILER_FLAGS} -comment=nonest -cpu=sh4 -division=cpu -fpu=single -endian=little -extra=a=1800 -pic=0 -macsave=0 -sjis -string=const -aggressive=2 -object=dos_src.obj) && "
"${WIBO} ${COMPILER_DIR}/bin/elfcnv.exe dos_src.obj ${OUTPUT}"
)
SHC_V51R11 = SHCCompiler(id="shc-v5.1r11", platform=DREAMCAST, cc=DREAMCAST_CC)
# PS2
EE_GCC29_990721 = GCCPS2Compiler(
id="ee-gcc2.9-990721",
@@ -1496,6 +1513,8 @@ _all_compilers: List[Compiler] = [
MWCCPSP_3_0_1_219,
# Saturn
CYGNUS_2_7_96Q3,
# Dreamcast
SHC_V51R11,
# PS2
EE_GCC29_990721,
EE_GCC29_991111,
+9
View File
@@ -109,6 +109,15 @@ COMMON_CLANG_FLAGS: Flags = [
Checkbox(id="clang_no_exceptions", flag="-fno-exceptions"),
]
COMMON_SHC_FLAGS: Flags = [
FlagSet(id="shc_opt_level", flags=["-optimize=0", "-optimize=1"]),
FlagSet(id="shc_opt_type", flags=["-speed", "-size"]),
FlagSet(id="shc_round", flags=["-round=zero", "-round=nearest"]),
Checkbox(id="shc_debug", flag="-debug"),
Checkbox(id="shc_loop", flag="-loop"),
Checkbox(id="shc_inline", flag="-inline"),
]
COMMON_GCC_FLAGS: Flags = [
FlagSet(id="gcc_opt_level", flags=["-O0", "-O1", "-O2", "-O3"]),
FlagSet(
+13
View File
@@ -164,6 +164,18 @@ SATURN = Platform(
diff_flags=COMMON_DIFF_FLAGS,
)
DREAMCAST = Platform(
id="dreamcast",
name="Dreamcast",
description="SH4 (little-endian)",
arch="sh4",
assemble_cmd='sh-elf-as --isa=sh4 --little --relax -o "$OUTPUT" "$PRELUDE" "$INPUT"',
objdump_cmd="sh-elf-objdump",
nm_cmd="sh-elf-nm",
diff_flags=COMMON_DIFF_FLAGS,
has_decompiler=False,
)
PS2 = Platform(
id="ps2",
name="PlayStation 2",
@@ -241,6 +253,7 @@ _platforms: OrderedDict[str, Platform] = OrderedDict(
"ps2": PS2,
"psp": PSP,
"saturn": SATURN,
"dreamcast": DREAMCAST,
"macosx": MACOSX,
"msdos": MSDOS,
"win32": WIN32,
+1
View File
@@ -23,6 +23,7 @@ services:
ENABLE_MSDOS_SUPPORT: "NO"
ENABLE_PS2_SUPPORT: "NO"
ENABLE_WIN32_SUPPORT: "NO"
ENABLE_DREAMCAST_SUPPORT: "NO"
# dont install clang by default
ENABLE_SWITCH_SUPPORT: "NO"
# dont install dosemu by default
@@ -26,6 +26,7 @@ const ICON_SOURCES = {
"Happy Mac by NiloGlock": "https://commons.wikimedia.org/wiki/File:Happy_Mac.svg",
"Tiger-like-x by Althepal": "https://commons.wikimedia.org/wiki/File:Tiger-like-x.svg",
"Saturn by JustDanPatrick": "https://upload.wikimedia.org/wikipedia/commons/archive/7/78/20220518145749%21Sega_Saturn_Black_Logo.svg",
"Dreamcast by Sega": "https://en.wikipedia.org/wiki/File:Dreamcast_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",
@@ -1,3 +1,4 @@
import LogoDreamcast from "./dreamcast.svg"
import LogoGBA from "./gba.svg"
import LogoGCWii from "./gc_wii.svg"
import LogoIRIX from "./irix.svg"
@@ -30,6 +31,7 @@ const ICONS = {
"n3ds": LogoN3DS,
"switch": LogoSwitch,
"saturn": LogoSaturn,
"dreamcast": LogoDreamcast,
}
export const PLATFORMS = Object.keys(ICONS)
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

@@ -177,6 +177,8 @@
"gcc2.91.66-mipsel": "gcc 2.91.66 + maspsx",
"gcc2.95.2-mipsel": "gcc 2.95.2 + maspsx",
"shc-v5.1r11": "SHC v5.1 (Release 11)",
"psyq3.3": "PSYQ3.3 (gcc 2.6.0 + aspsx 2.21)",
"psyq3.5": "PSYQ3.5 (gcc 2.6.0 + aspsx 2.34)",
"psyq3.6": "PSYQ3.6 (gcc 2.7.2 + aspsx 2.34)",
@@ -365,6 +367,19 @@
"msvc_fastcall": "__fastcall calling convention",
"msvc_stdcall": "__stdcall calling convention",
"shc_opt_level": "Optimization level",
"shc_opt_level.-optimize=0": "Optimization: off",
"shc_opt_level.-optimize=1": "Optimization: on",
"shc_opt_type": "Optimization type",
"shc_opt_type.speed": "Optimization for speed",
"shc_opt_type.size": "Optimization for size",
"shc_round": "Floating-point rounding options",
"shc_round.-round=zero": "Round to zero",
"shc_round.-round=nearest": "Round to nearest",
"shc_debug": "Debug",
"shc_loop": "Loop unrolling",
"shc_inline": "Inline static functions",
"psyq_opt_level": "Optimization level",
"psyq_opt_level.-O0": "No optimization",
"psyq_opt_level.-O1": "Some optimization",