364 points · by RafelMri · 2y ago · 162 comments
Since the PS4 is more or less an x86 computer, I imagine most of the hard work would be implementing the system/graphics APIs of the PS4. Or are there major hardware differences between an x86 PC and the PS4 that also need to be handled?
There are also some considerations regarding texture compression, I believe, which is a function usually performed in dedicated GPU hardware, and not all GPUs support all formats.
Everyone ships either shader code or intermediate languages instead.
I've seen several people online discover what the idea of an emulator is, and then they'll say in amazement "so we could do this and that and the other?", and the answer, no matter what it is they propose, is "yes, someone's done that". Recompile the code entirely into another assembler? Partially do so? JIT it? Ship specific patches for specific content? Emulate gates? Rewrite on the fly? Shim things slightly to change what functions are loaded? All that and more has been done. And even if you draw a sharp line through those things, all the combinations you can think of have also been done, and how will you draw the line through that?
I think one of the best ways of thinking about it is that there really isn't any such thing as an emulator. There's just numbers, and they need an interpreter and the ability to reach out to some set of externally-defined functionality, and there is a profound sense in which you have to have some particular hardware manifestation of an interpreter and some functionality to get anywhere, but that particular manifestation is a lot less important than people think. This has only become more true in a world where your CPUs are already not actually executing assembler opcodes anymore, and your OS is already shimmed away from the hardware in another level, and the OS is wrapping your program in yet more abstraction before it even runs a single instruction, which may well include providing a choice of which sets of "externally-defined functionality" the numbers can ask for (different Windows subsystems, etc.). Even the "base system" has a lot of "emulators" in it nowadays. It's emulators almost all the way down! Which suggests that rather than being special, they're actually quite fundamental, and sure, sometimes you need a greater translation layer between this program written with these numbers and this particular chunk of hardware and sometimes you need less, but it's a lot less a distinction of "kind" than you might think.
This is not the only way to think about it; there are certainly valid perspectives from which "emulators" exist, e.g. as a distinct category in a software catalog they're sensible. We all know what that means. But for your own understanding of how the world works, the previous paragraph has a lot to recommend it.
1. Emulate the whole system. 2. Emulate the system API.
The first one you write the code to emulate the CPU of target system like OP code interpreter (e.g. NES). The second one you write the code to re-implement the API of the target system (e.g. Wine). For the second one you may need to write a JIT compiler if the target system use a different CPU architecture (e.g. PS3).
Most modern console emulator are the later one because how the modern console work is similar to how the PC work. It have an OS kernel and a user-mode libraries for applications.
For the latter one there are 2 kind of it. The first one is emulate the user-mode libraries and the second one is re-implement the console kernel and reuse the system libraries from the console itself.
And additionally because the past couple of console generations have had x86-64 CPUs, there's no need to do full instruction translation/emulation—something like Wine would suffice.
http://www.emulator101.com/introduction-to-chip-8.html
An average programmer can probably get an emulator for that running in a weekend, and there are lots of guides and documetnation out there for the opcodes and similar.
NES / Gameboy / GameGear / similar are probably well-documented, but they will be harder at least because the processors have more opcodes you have to care about.
Also somehow for some reason i was convinced back then that mobile phones in the future will have a CHIP8 emulator to play games :-P. Sadly(?) they got Java instead.
You are bound to have an awesome game you can find on an 8-bit system and it's really fun trying to get to the point where you can play the game: getting the logo to appear, getting the title screen up, getting the sprites working, adding controls etc.
The "big league" emulators work differently. They may be simple compilers. Instead of compiling C code or java code, they compile machine code from system A to system B. A transpiler. This affords speed beyond the simple case. Speed, however, is only necessary if the machine running the emulator is weak, or if the machine being emulated is strong.
0: https://www.reddit.com/r/SteamDeck/comments/wodw8x/i_tested_...
I'd expect running x86 code written to run on an AMD APU with a Unix-based OS in another AMD APU with a Unix-based OS to be a bit easier, probably with some VM involved (even Xemu, the original Xbox emulator, is basically a QEMU PC configuration with some Xbox-specific hardware for the GPU and audio).
I’d take that bet. Given a million years of concentrated effort, I’m feeling confident we’d find a way. Even if it takes a hobbyist replacing some internal components on the Steam Deck.
and also for the PS4
and also for the PS5
and fpPS4 is compatibility layer
check this wiki for more info : https://emulation.gametechwiki.com/index.php/PlayStation_4_e...
[0] https://en.wikipedia.org/wiki/PlayStation_4_system_software#...
This is the dev's youtube: https://www.youtube.com/watch?v=wC6s0avpQRE
I wonder what the hell Sony is doing still neglecting, almost vindictively, this S-tier culturally significant game. Are they waiting to use it for a launch PS6 title or what?
There will always be a demand for playing older games, hence emulators like this.
Now we know how the console run the game. The next step is how to use this information run the game outside the console. The good news is PS4 system is just a modified version of FreeBSD, which mean how it works is very similar to the PC. A PS4 executable is just a custom ELF file. So to run a PS4 game outside the console we need to manually map the game executable and provide the symbol it needed somehow (e.g. a custom implementation or reuse the PS4 library).
Generally speaking there's been a lot of good work in the industry for binary translation too, cf. Rosetta 2. That's another tool in the box for hoisting a binary on to a different host environment.
https://github.com/devofspine/spine
(No source code. Just binaries.)
maybe we can play gt2 remastered online
Complexity. I'm amazed that anyone would even be able to single-handedly emulate such a different architecture like PS3
A case study in favor of UBI
Read my profile, next up is a ban
And we go agane
Five Eyes or not
https://news.ycombinator.com/item?id=26222361
https://old.reddit.com/r/Games/comments/fnl0o1/why_playstati...
Also interesting and only tangentially related is that MAME used to have a rule about not supporting games within 2 years of release.