Repository navigation
Add SHC v5.0 (Release 32) for Saturn - #2115
Conversation
|
Does rof2elf.py need updating to add a flag e.g. |
Yeah, that would work to fix the padding difference. We'd also need to update the pinned script in decompme/compilers. Would it make sense to let each scratch choose the padding value? This game uses |
|
I think KISS, so just set the padding to 0xFF for this compiler and worry about needing something different if that scenario ever comes up in the wild. |
|
Done! I opened decompme/compilers#89 first, since rof2elf.py needed the new option. It still uses 0x00 by default, so Dreamcast stays the same. This PR now passes Please merge the compilers PR first and rebuild the SHC images. Otherwise this one will break. I tested both together locally, and the padding diffs are gone. |
|
This PR is ai btw, you can find the ai's notes on how to gently make a pr that doesnt set off ai red flags here with the pr its making here |
What's the point of this? This repository has no rule banning AI-assisted contributions, and yes, I did use Astra and Opus 5.5 in combination with my existing programming experience to create this PR. This PR is to add a currently unsupported platform to decomp.me to support a game I want to decompile. If you have actual criticism on the quality of the code in this PR, I'd be all ears. |
|
Thanks for your input, this is quite a targeted PR to add/repurpose an existing compiler. The verbose comments (that I asked to be removed) along with the PR wording in general gave the impression that this was, at the minimal, guided by AI. But I don't have an issue with the result. |
|
@mkst Is this good to be merged? Should be all set. |

Hi! I'm working on a matching decomp of Tetris: The Absolute The Grand Master 2 PLUS, a Psikyo SH-2 arcade game. It turns out it was built with Hitachi SHC v5.0, which decomp.me already has for Dreamcast. But those entries hard-code
-cpu=sh4 -endian=little -fpu=single -macsave=0, so they can't produce SH-2 code.This adds
shc-v5.0r32-sh2to the Saturn platform. It reuses the Dreamcastshc-v5.0r32package throughbase_compiler, the same way the IRIX IDO compilers reuse the N64 ones, so nothing is needed in the compilers repo. It gets its own command line (-cpu=sh2 -endian=big) and a smallshc-sh2flag class. That class drops-fpu/-round, which have no effect on SH-2 (I compiled the same file with and without them under-cpu=sh2and the code is byte-identical), keeps-aggressive=2, which still applies without an FPU (it turnsx / 3.0finto a__mulsby the reciprocal0x3eaaaaabinstead of a__divsby3.0f), and adds-divisionand-macsave. Leaving those unset gives the compiler defaults,-division=cpuand-macsave=1, which I checked by compiling with and without them.I tested it on a local instance, and scratches for two functions from the ROM compiled and scored 0.
ruff check,ruff format --check,mypyand Biome pass too. One caveat is that rof2elf.py pads alignment gaps with 0x00 while this ROM has 0xFF, so a literal pool padding halfword can show up as a diff.I only added r32, since that's the release I matched against (r26 through r31 give identical output on this game). The other SHC releases could go in the same way if anyone needs them.
Let me know if this approach makes sense. Thanks for taking a look!