diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 248e21aac..40c564aad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: |- diff --git a/backend/Dockerfile b/backend/Dockerfile index 2dde2a46c..3eef0b52b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -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} diff --git a/backend/compilers/compilers.linux.yaml b/backend/compilers/compilers.linux.yaml index b8bfcd462..914100f34 100644 --- a/backend/compilers/compilers.linux.yaml +++ b/backend/compilers/compilers.linux.yaml @@ -169,6 +169,9 @@ psp: saturn: - cygnus-2.7-96Q3 +dreamcast: + - shc-v5.1r11 + macosx: - gcc-5026 - gcc-5363 diff --git a/backend/coreapp/compilers.py b/backend/coreapp/compilers.py index f609dbc36..2591079c4 100644 --- a/backend/coreapp/compilers.py +++ b/backend/coreapp/compilers.py @@ -9,6 +9,7 @@ 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 @@ 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 @@ def available_platforms() -> List[Platform]: 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 @@ def available_platforms() -> List[Platform]: MWCCPSP_3_0_1_219, # Saturn CYGNUS_2_7_96Q3, + # Dreamcast + SHC_V51R11, # PS2 EE_GCC29_990721, EE_GCC29_991111, diff --git a/backend/coreapp/flags.py b/backend/coreapp/flags.py index 9c31b5b92..dbcfebd8b 100644 --- a/backend/coreapp/flags.py +++ b/backend/coreapp/flags.py @@ -109,6 +109,15 @@ def to_json(self) -> Dict[str, Union[str, List[str]]]: 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( diff --git a/backend/coreapp/platforms.py b/backend/coreapp/platforms.py index e028e664a..bf2a47716 100644 --- a/backend/coreapp/platforms.py +++ b/backend/coreapp/platforms.py @@ -164,6 +164,18 @@ def from_id(platform_id: str) -> 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 @@ def from_id(platform_id: str) -> Platform: "ps2": PS2, "psp": PSP, "saturn": SATURN, + "dreamcast": DREAMCAST, "macosx": MACOSX, "msdos": MSDOS, "win32": WIN32, diff --git a/docker-compose.yaml b/docker-compose.yaml index 06447dfd5..9f893fe14 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -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 diff --git a/frontend/src/app/(navfooter)/credits/page.tsx b/frontend/src/app/(navfooter)/credits/page.tsx index 21a14039f..15f230927 100644 --- a/frontend/src/app/(navfooter)/credits/page.tsx +++ b/frontend/src/app/(navfooter)/credits/page.tsx @@ -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", diff --git a/frontend/src/components/PlatformSelect/PlatformIcon.tsx b/frontend/src/components/PlatformSelect/PlatformIcon.tsx index c93cdf0ae..e600d47f2 100644 --- a/frontend/src/components/PlatformSelect/PlatformIcon.tsx +++ b/frontend/src/components/PlatformSelect/PlatformIcon.tsx @@ -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) diff --git a/frontend/src/components/PlatformSelect/dreamcast.svg b/frontend/src/components/PlatformSelect/dreamcast.svg new file mode 100644 index 000000000..362945ced --- /dev/null +++ b/frontend/src/components/PlatformSelect/dreamcast.svg @@ -0,0 +1,9 @@ + + + image/svg+xml + + + Layer 1 + + + \ No newline at end of file diff --git a/frontend/src/lib/i18n/locales/en/compilers.json b/frontend/src/lib/i18n/locales/en/compilers.json index 0e0bd7723..5c46408ea 100644 --- a/frontend/src/lib/i18n/locales/en/compilers.json +++ b/frontend/src/lib/i18n/locales/en/compilers.json @@ -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",