News for hackers. Stuff that matters.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by qbane on Saturday June 08, 2024 @01:33PM (#40619063)
That is why emulating, when targeting 100% accuracy, is a craftsmanship in our industry. Not only do you need to know each and every quirk the original hardware/software has, but you also need to replicate it, however peculiar it is. Consider the potential performance impact if itself is not challenging enough.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by jsheard on Saturday June 08, 2024 @01:48PM (#40619173)
Emulators have to be pragmatic about accuracy, when emulating more modern systems it's generally not feasible to target 100% hardware accuracy and usable performance, so they tend to accept compromises which are technically deviations from the real hardware but usually don't make any observable difference in practice. Anything that uses a JIT recompiler is never going to be perfectly cycle-accurate to the original hardware but it usually doesn't matter unless the game code is deliberately constructed to break emulators.

Dolphin had to reckon with that balance when a few commercial Wii games included such anti-emulator code, which abused details of the real Wii CPUs cache behavior. Technically they could have emulated the real CPU cache to make those games work seamlessly, but the performance overhead (likely a 10x slowdown) would make them unplayable, so they hacked around it instead.

https://dolphin-emu.org/blog/2017/02/01/dolphin-progress-rep...

Re:Detecting a PS2 Emulator: When 1*X does not equal X by bobmcnamara on Saturday June 08, 2024 @01:56PM (#40619224)
I once wrote something that would hard lock cortex-A8 but not the cortex-A9 we shipped on. To my knowledge, nobody tracked down why our app, once exfiltrated from our device, would crash slightly older phones.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by pm215 on Saturday June 08, 2024 @02:07PM (#40619283)
Were you exploiting an A8 erratum, or detecting "this is an A8" somehow and then making it barf in a less processor specific way?
Re:Detecting a PS2 Emulator: When 1*X does not equal X by bobmcnamara on Sunday June 09, 2024 @12:58AM (#40622155)
A8 erratum. This was ages ago, but if I recall you could place a thumb2 instruction straddling two pages, only one of which was loaded in the TLBs. If you got everything right, the A8 would hang without trapping.

Edit: it was errata #657417, long since scrubbed from arm.com

Re:Detecting a PS2 Emulator: When 1*X does not equal X by pm215 on Sunday June 09, 2024 @04:03AM (#40622774)
The A8 errata doc is at https://developer.arm.com/documentation/prdc008070/latest/ these days and does have a description of 657417 with enough detail to make writing a reproducer possible. Instructions crossing page boundaries are tricky beasts :-)
Re:Detecting a PS2 Emulator: When 1*X does not equal X by bobmcnamara on Sunday June 09, 2024 @09:05AM (#40624169)
Well look at that! I had searched Google and arm.com for that number. This was definitely it.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by AtlasBarfed on Saturday June 08, 2024 @03:14PM (#40619609)
So they'll patch around it.

You're just making your software worthless in the long run for some value probably less than 5 years, or creating a fun problem for an emu hacker.

Most of the significant losses to piracy monetarily isn't emulation, it's the chippers/mods that bypass cloned media copy protection.

Which emulator authors have a lot more control over in bypassing

Re:Detecting a PS2 Emulator: When 1*X does not equal X by pm215 on Saturday June 08, 2024 @03:42PM (#40619769)
If it hardlocked an A8 but not an A9, chances are very high that an emulator would run it with no problem, because nobody deliberately tries to emulate the kind of CPU bug that lets an app hardlock the CPU. GP appears to have been interested in deterring people from running their code on non-authorised real hardware at the time, not targeting emulator users.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by bobmcnamara on Sunday June 09, 2024 @01:14AM (#40622207)
Bingo! Didn't want someone running new product's app on old product's hardware. Company was new to building non-RTOS devices which were tightly hardware bound, wanted similar type restrictions.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by mikestew on Saturday June 08, 2024 @05:36PM (#40620328)
You assume an anti-piracy attempt when GP, from my reading, made no such statement. More of a mystery, but who cares because the problem hardware wasn’t what they shipped on.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by cwillu on Saturday June 08, 2024 @06:25PM (#40620598)
They used the word exfiltrate, it's not a stretch.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by FMecha on Saturday June 08, 2024 @02:12PM (#40619315)
>but it usually doesn't matter

When it comes to speedrunning: Some speedrunners do, though, to ensure their speedrun tech are reproducible on both emulators and real hardware.

Re:Detecting a PS2 Emulator: When 1*X does not equal X by jsheard on Saturday June 08, 2024 @02:17PM (#40619341)
That's true, the small differences between a pragmatic "accurate enough" emulator and real hardware can matter for speedrunners. The difference between real hardware running at 60fps and a principled cycle-accurate emulator running at <0.1fps would matter more, though.

For the SNES and earlier it's feasible to have exceptional accuracy and still usable performance, but for anything modern it's just not happening. Imagine trying to write a cycle-accurate emulator core for a modern CPU with instruction re-ordering, branch prediction, prefetching, asynchronous memory, etc, nevermind making it go fast.

Re:Detecting a PS2 Emulator: When 1*X does not equal X by FMecha on Saturday June 08, 2024 @04:19PM (#40619968)
>For the SNES and earlier

I think the cutline can be moved to the original PlayStation now.

>but for anything modern it's just not happening.

Which arguably explains a cultural rift in arcade emulation circles. MAME's philosophy is about cycle-accuracy, which might work for bespoke arcade hardware up to early 3D systems, whether they're bespoke (such as Namco's System 22) or console-derived (Namco's System 1x series, which all derive from the original PlayStation hardware) hardware. For newer arcade titles, which are just beefed period PCs, such kind of emulation (philosophy) would not be suffice for gameplay.

Re:Detecting a PS2 Emulator: When 1*X does not equal X by masfuerte on Saturday June 08, 2024 @06:00PM (#40620450)
> Anything that uses a JIT recompiler is never going to be perfectly cycle-accurate to the original hardware

beebjit [1] is a cycle-accurate JIT-based emulator for the BBC Micro. It can be done.

[1]: https://github.com/scarybeasts/beebjit

Re:Detecting a PS2 Emulator: When 1*X does not equal X by xcv123 on Saturday June 08, 2024 @11:52PM (#40621896)
That is not perfectly cycle-accurate, but it is accurate enough to run almost anything without issues.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by mardifoufs on Saturday June 08, 2024 @06:03PM (#40620468)
I wonder how mainframe emulators (that sometimes are used to run legacy, very critical software on modern hardware) manage to do it. Do they go for full complete emulation? As in, implementing the entire hardware in software?
Re:Detecting a PS2 Emulator: When 1*X does not equal X by xcv123 on Sunday June 09, 2024 @02:36AM (#40622484)
Mainframes typically execute batch processes on a CPU. Much simpler than a game console with a GPU. Cycle-accurate emulation is less relevant for mainframes.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by Locutus_ on Sunday June 09, 2024 @03:52AM (#40622736)
Most of those a JIT recompilers, Mainframe code doesn't usually depend on instruction cycle timing to the level that say beam-racing game code does.
Re:Detecting a PS2 Emulator: When 1*X does not equal X by immibis on Sunday June 09, 2024 @07:52AM (#40623820)
The good news is that modern systems are so unpredictable relative to each other that games can be relied upon to not require cycle-accuracy. IIRC the cycle timings can differ between different units of the same model.