hrydgard/ppsspp — pull request #3562 by Kingcom (2013-09-02 00:01:42+00:00)
Title: Try to detect PSX ISOs

You never know what some people try to load!
There's not really a surefire way to do this, I think. But this is a simple check that should catch most of them at least.

PSX games use Mode2, which means their sectors are not 2048 bytes in size, but 2352. They also have a fixed sync at the start of every sector. So if an image's size is a multiple of 2352 and has that sync at the start of the first sector, it's probably safe to say that it's not a PSP game.

There is a theoretical chance of a false positive, if a PSP game has just the right number of blocks to be a multiple of 2352 and also happens to start with those 12 bytes. But I think the chances of that are pretty small. All PSP games I saw so far had an empty system area.