RetroAchievements / rcheevos

Library to parse and evaluate achievements and leaderboards for RetroAchievements
MIT License
86 stars 33 forks source link

hash whole file for PSP homebrew files (EBOOT.PBP) #333

Closed Jamiras closed 4 months ago

Jamiras commented 4 months ago

closes #244

hrydgard commented 4 months ago

This will accept some files that PPSSPP will not, such as EBOOTs with PSX isos inside (which then won't run anyway, so maybe it doesn't matter). Otherwise looks good, maybe it's fine as-is really.

Jamiras commented 4 months ago

Is there some way to identify those sort of EBOOTs so we could exclude them from generating a hash? We already indirectly exclude UMD video discs because they don't have a PSP_GAME folder, where we expect to find the EBOOT.BIN.

Even if we don't explicitly exclude them from hashing, if the hash isn't registered on the server, it won't load achievements. And we have some policies around creating sets for the same game on alternate systems.

hrydgard commented 4 months ago

Had to go look at our somewhat messy identification code for the details :) link 1 link 2

After first checking that the first four bytes are "\x00PBP", then read four bytes at offset 0x24 to get the offset of the internal archive, then read 4 bytes at that offset to get a magic number to look at.

This can be "NPUM" which means an embedded UMD (this is a game demo, most likely), or "PSIS" which means it's a PSX ISO. Otherwise, go ahead and hash.

For an extra check can also look at the PARAM.SFO file embedded in the PBP (which has a simple structure), if it's "CATEGORY" field is "ME", it's a PSX ISO.

Up to you whether this is all worth checking!

TheFetishMachine commented 4 months ago

This can be "NPUM" which means an embedded UMD (this is a game demo, most likely), or "PSIS" which means it's a PSX ISO. Otherwise, go ahead and hash.

Just wanted to quickly mention that there's a usecase for wanting to hash PSP game demos as well; there's some that have exclusive content not present in the full game they're a demo of e.g. the Locoroco Halloween and Christmas demos, so I'd recommend not excluding them from hashing.

For an extra check can also look at the PARAM.SFO file embedded in the PBP (which has a simple structure), if it's "CATEGORY" field is "ME", it's a PSX ISO.

Somewhat related, some people have expressed desire to be able to hash PSP PSX releases and link them to their respective PS1 entries and be able get achievements for them that way. I can see this making some sense (and there's some precedence with stuff like virtual console releases of games for Nintendo consoles getting linked), and while I'm not sure about it, there is always the possibility of a PSX rerelease having some exclusive and/or otherwise unavailable content. Might be worth considering as well.

Jamiras commented 4 months ago

Up to you whether this is all worth checking!

For now, I'm going to just let them hash and assume the hash won't resolve to a game on the server.