5 ms·
Dumb Question: why can't these emulators be built on top of QEMU? That seems to support a crazy amount of "hardware" - different CPU, BIOS, Audio shit, etc. Is
by djbusby 3y ago
Dumb Question: why can't these emulators be built on top of QEMU? That seems to support a crazy amount of "hardware" - different CPU, BIOS, Audio shit, etc.
Is it, in theory, possible to make, eg Atari 2600 (or NES, or Sega) emulator from QEMU?
- profile53 3y agoBasically because of very precise hardware timings. One tick/cycle of the CPU must correspond to exactly X ticks of the GPU since the code runs very close to the hardware and depends on specific behaviors (e.g. a memory store to this bank takes 4 cycles while this other bank takes 6 cycles). Qemu takes a higher level approach that basically guarantees that over a period of time, one tick of the CPU corresponds to X ticks of the GPU on average and does expose a fair amount of host memory performance characteristics such as TLB/L1/L2 cache misses. PS2 games weren’t built to account for pipeline flushes or memory stalls, for example.
- NovaDudely 3y agoYep, Ps2 was a beast of interconnected timings, data transfer and cache oddities. I still find it so funny that they figured the best way to run the GPU was to have 2560 bit wide data bus on 4MB of RAM. So you could go fill rate crazy but on a very limited data set.
- SXX 3y agoHere is humble opinion of a person who is not QEMU developer, but looked at it's code more than once for purpose of debugging my gaming VMs with VFIO. QEMU is a great project, but to begin with flexibility was not a primary design goal. Majority of QEMU targets are PC-like hardware and older consoles have unique or alien architecture. To emulate it using QEMU you'll have to patch it internals heavily. It's also written in C so you can't just integrate a lot of fancy libraries into it. QEMU is also important infrastructure project playing crucial part in *nix virtualization stack. Which means getting any code upstreamed is hard. Emulation projects primary goal is to make games run both accurately and as fast as possible which means developers will use as many shortcuts as possible. QEMU is a massive code base too. Getting into it will take a lot of time and it could be easier to maintain single-target emulator instead since it's easier for new contributors to start working on it. You'll have to fork QEMU anyway and won't be able to push your changes upstream then what the point to use it?
- netol 3y agoI just wanted to add that this may not apply to the original Xbox and PS4, as there are emulators based on QEMU. These are XQEMU/xemu and Orbital.
- tehbeard 3y agoThe key part there is that the original xbox is a Pentium III PC with, iirc some northbridge/southbridge shenanigans. And the PS4 uses a custom AMD x86-64 chip. An Xbox 360 is slightly more difficult as that is a PowerPC architecture (RISC vs. CISC of x86) Same for the PS3 except you also have those incredibly weird "SPE" cores to try and emulate as well.
- badsectoracula 3y agoIn addition to what tehbeard mentioned, Xemu at least (which is what i have experience with as i used it to do some homebrew development[0] with the open source nxdk[1] SDK) is far from accurate and largely just a means for playing OG Xbox games on modern hardware. However the GPU emulation does not take into account NV2A's performance at all and simply translates the calls to OpenGL (despite the "DirectXbox" name, the GPU is actually designed around OpenGL :-P) so it is much faster than the real one and depending on what is going on the CPU performance can also be quite faster. IIRC it doesn't even emulate the real CPU the OG Xbox has as you can accidentally use instructions in Xemu not available on the real hardware. Of course if your goal is to just have games from OG Xbox playable on a PC that is fine (if anything for most games it is an improvement as they'd run smoother) but if you want cycle accurate emulation it doesn't fit the bill. In that case basing the emulator on something like 86box might be better as that has been designed with the goal of achieving cycle accurate PC hardware emulation. [0] https://www.youtube.com/watch?v=gQpK6eX-04M https://www.youtube.com/watch?v=gQpK6eX-04M [1] https://github.com/XboxDev/nxdk/ https://github.com/XboxDev/nxdk/
- breakingcups 3y agoIt's basically what Xemu (and XQemu before it) are doing. They have a slightly more easy job though, as the entire OG Xbox architecture is basically a slightly hacked x86. Still, the console-specific stuff like the GPU does require very accurate emulation.