News for hackers. Stuff that matters.
Re:PS4 Emulator for Windows,Linux,macOS by calebj0seph on Wednesday August 21, 2024 @06:42AM (#41308900)
Genuine question - under the hood is this more of an emulator like PCSX2 or a compatibility layer like Wine?

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?

Re:PS4 Emulator for Windows,Linux,macOS by ultimaweapon on Wednesday August 21, 2024 @07:08AM (#41309049)
Most PS4 emulators work in the same way as Wine.
Re:PS4 Emulator for Windows,Linux,macOS by calebj0seph on Wednesday August 21, 2024 @08:15AM (#41309503)
Makes sense! Slightly amusing given that originally Wine was a recursive acronym for "Wine is not an emulator".
Re:PS4 Emulator for Windows,Linux,macOS by ahartmetz on Wednesday August 21, 2024 @08:26AM (#41309592)
Well, it's not a CPU (or other hardware) emulator. Console emulators usually are... or used to be, before all the x86 based consoles.
Re:PS4 Emulator for Windows,Linux,macOS by asddubs on Wednesday August 21, 2024 @09:14AM (#41309965)
I believe it was originally WINdows Emulator and was later changed to better communicate how it works under the hood
Re:PS4 Emulator for Windows,Linux,macOS by giancarlostoro on Wednesday August 21, 2024 @11:21AM (#41311179)
I'm guessing they had to get rid of "Windows" from the name?
Re:PS4 Emulator for Windows,Linux,macOS by kimbernator on Wednesday August 21, 2024 @09:55AM (#41310342)
As is the case with many recursive acronyms, based on this page: https://en.wikipedia.org/wiki/Recursive_acronym
Re:PS4 Emulator for Windows,Linux,macOS by foresto on Friday August 23, 2024 @07:45PM (#41334140)
Indeed, it was a backronym. I'm glad they finally got rid of it, because it was untrue, and because it continues to be the source of unpleasant exchanges online.

Wine doesn't emulate hardware, but it absolutely does emulate the Windows runtime environment. (In fact, it wouldn't work very well if it merely implemented APIs based on a spec instead of emulating observed behavior, since some of the bits required for compatibility are undocumented.)

Unfortunately, that phrase was in fashion at a time when a lot of people first discovered Wine, so there is now a generation of enthusiasts incorrectly chiding people who mention Wine and emulation together. And, of course, others who see this happen and don't know any better sometimes go on to perpetuate it themselves. Makes me sad every time it crosses my path.

Re:PS4 Emulator for Windows,Linux,macOS by jerf on Wednesday August 21, 2024 @10:08AM (#41310465)
When one tries to really nail down the exact, precise, 100% accurate definition of "what an emulator is", one finds it is like nailing jello to the wall.

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.

Re:PS4 Emulator for Windows,Linux,macOS by giancarlostoro on Wednesday August 21, 2024 @11:20AM (#41311172)
Create a decompiler for Shockwave so games can be preserved? Yes, absolutely. ;)

If its on your screen, it can and will be cracked / decompiled.

https://github.com/ProjectorRays/ProjectorRays

Re:PS4 Emulator for Windows,Linux,macOS by perching_aix on Wednesday August 21, 2024 @09:56AM (#41310347)
they must have a shader recompiler infra, because all the shaders are shipped precompiled directly for the platform on consoles. so it's a good bit more than what wine does, at the very least in that regard.
Re:PS4 Emulator for Windows,Linux,macOS by calebj0seph on Wednesday August 21, 2024 @10:03AM (#41310405)
Very true. I suppose Wine has to do this as well for Direct3D?
Re:PS4 Emulator for Windows,Linux,macOS by lxgr on Wednesday August 21, 2024 @10:21AM (#41310579)
For PC games and applications, Direct3D shaders are supplied in a high-level shader language (not-so-coincidentally called High-Level Shader Language), given that there is no standard GPU architecture on Windows PCs. Wine does still need to translate that to the target graphics library, as well as all the drawing calls themselves, though.

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.

Re:PS4 Emulator for Windows,Linux,macOS by FastFT on Wednesday August 21, 2024 @10:38AM (#41310749)
Not a developer in the field, but I believe generally the HLSL isn’t packaged in the game. Instead an intermediate format called DXIL is produced at build time from the HLSL, and that’s what is packaged.
Re:PS4 Emulator for Windows,Linux,macOS by lxgr on Wednesday August 21, 2024 @10:42AM (#41310790)
Ah, sorry, then I carried over an assumption from OpenGL (where GLSL is actually what's packaged, or at least was a couple of years ago when I last looked at it).

In any case, that intermediate representation is probably still easier to compile to hardware-specific code, especially if the hardware has a Direct3D implementation. That's what it's designed for, after all!

Re:PS4 Emulator for Windows,Linux,macOS by Sesse__ on Wednesday August 21, 2024 @11:00AM (#41310985)
OpenGL also supports SPIR-V, a similar intermediate format, since 2017 (it came into core in OpenGL 4.6).
Re:PS4 Emulator for Windows,Linux,macOS by account42 on Friday August 23, 2024 @04:05AM (#41327070)
Technically true but if you are going to use SPIR-V you might as well jump over to Vulkan. Do you know of any OpenGL games that actually ship SPIR-V? I can imagine it getting used in CAD applications with huge legacy OpenGL code bases but for Games OpenGL+SPIR-V doesn't really have a good use case.
Re:PS4 Emulator for Windows,Linux,macOS by Sesse__ on Friday August 23, 2024 @05:40AM (#41327554)
I guess not a lot of games really use OpenGL at all anymore? But I haven't gone around and tried making a survey. :-)
Re:PS4 Emulator for Windows,Linux,macOS by dagmx on Wednesday August 21, 2024 @10:49AM (#41310859)
No, you can’t ship precompiled shaders for desktop easily because there’s no single backend (GPU) to compile for.

Everyone ships either shader code or intermediate languages instead.

Re:PS4 Emulator for Windows,Linux,macOS by dikei on Wednesday August 21, 2024 @10:15AM (#41310521)
Yes, that used to be the weakest part of Wine. Luckily, we have DXVK now.
Re:PS4 Emulator for Windows,Linux,macOS by dagmx on Wednesday August 21, 2024 @10:50AM (#41310870)
DXVK doesn’t deal with pre compiled shaders afaik. It needs them in DXIL or HLSL to function.
Re:PS4 Emulator for Windows,Linux,macOS by compiler-devel on Wednesday August 21, 2024 @11:05AM (#41311034)
See Marcan’s 2016 CCC talk about the many differences between a ps4 and a pc. https://youtu.be/QMiubC6LdTA
Re:PS4 Emulator for Windows,Linux,macOS by s1gsegv on Thursday August 22, 2024 @12:49AM (#41316921)
Excellent talk even if you’re not interested in game consoles