0
Note: This is just an idea that I've been thinking about for a few days, I'm not 100% sure it would work - but I think it could and I'm posting now just to make people aware that this could well be possible, and it could be awesome.
A little while ago, I wrote a blog post on my thoughts about a Dreamcast 2, and how SEGA probably won't build one, but with advances in technology (e.g. theopen processor foundation's "J4" SH4-compatible CPU) we might be able to build one ourselves. It was a throw-away blog post, and it's still unlikely that any SH4-compatible board will become available any time soon and even if it did there are a whole load of other things to workaround in software (e.g. PVR graphics, Maple bus etc.)
The other day I was digging around trying to reverse-engineer the Dream Arena authentication server, and I wanted to be able to run some small Katana test programs to check responses. It was at that point I discovered that QEMU has SH4 support.
For those who don't know, QEMU is a hardware-virtualization library which allows you to run programs for non-native architectures with on-the-fly translation. In simple terms, it could theoretically allow running Dreamcast binaries on x86 with a performance hit. To clarify, you could run: qemu-sh4 ./some/dreamcast/exe and it would attempt to run it.
I haven't tried this yet, I intend to, but it wouldn't get very far anyway, because the exe would call into Katana/WinCE libraries which would expect Dreamcast hardware. But then I started thinking... how could we get that exe to run? And the answer is to reimplement the Katana libraries on top of OpenGL/Unix so that the executable would call them, and they would do x86 stuff... there's another project that does almost exactly this but for Win32 libraries. It's called Wine.
I'm fairly convinced that it would be possible to reimplement the Katana SDK libraries so that they work on x86. I'm going to call this theoretical project the "OpenDC runtime". Which would mean the following:
- You could run Dreamcast games compiled for SH4 with QEMU, using the OpenDC runtime compiled for SH4
- You could compile homebrew games (if you have the source) for x86, using an x86 OpenDC runtime. Meaning developing homebrew for the Dreamcast gets a shedload easier. It would just mean recompiling and testing for SH4. If we implemented x86 support for Kos the same would be possible using the same framework (it might already work on x86, I haven't checked)
- You could swap out Katana libraries with OpenDC libraries on released games to change behaviour
- You could develop a Linux-based OpenDC OS (like SteamOS). Which ships x86 and SH4 compiled versions of the OpenDC runtime, and uses a custom launcher to work out whether to run executables with QEMU or not. You could basically build a Dreamcast-compatible console.
Now, that would all be awesome, but let's sprinkle some realism on this:
- This would be an epic undertaking - I certainly couldn't do it alone but I might be able to get a proof of concept
- Reimplementing the Katana SDK would not be trivial
- There may be places we can't "hook" our implementation
- WinCE support may get messy (although we could reuse Wine code)
- I've probably missed something obvious that makes this impossible
Still, the idea's out there now.