hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.43k stars 2.19k forks source link

Fushigi no Dungeon - Fuurai no Shiren 4 Plus v3.10 cannot load #16842

Open sum2012 opened 1 year ago

sum2012 commented 1 year ago

Original reporter in https://forums.ppsspp.org/showthread.php?tid=28909

Game or games this happens in

NPJH50698-Fushigi no Dungeon - Fuurai no Shiren 4 Plus - Kami no Hitomi to Akuma no Heso (Japan) (v3.10)

What area of the game / PPSSPP

Beginning

What should happen

Can load the game

Logs

Original log: 04:21:901 LoadModuleTh E[SCEMODULE]: HLE\sceKernelModule.cpp:1270 Wrong magic number 50535000 04:21:901 LoadModuleTh E[LOADER]: HLE\sceKernelModule.cpp:2070 80020148=sceKernelLoadModuleNpDrm(ms0:/PSP/GAME/NPJH50698/f5psp.sprx, 00000000, 00000000): failed to load

After add the magic number (pull request 16841) Modify log: 57:24:317 user_main I[HLE]: HLE\scePspNpDrm_user.cpp:9 call sceNpDrmSetLicenseeKey(0880a420) 57:24:350 user_main I[SCEKERNEL]: HLE\sceKernelThread.cpp:2004 280=sceKernelCreateThread(LoadModuleThread, 08804384, 00000020, 2048, 00000000, 00000000) 57:24:350 user_main I[SCEKERNEL]: HLE\sceKernelThread.cpp:2101 0=sceKernelStartThread(280, 35, 0880a3d4) 57:24:353 LoadModuleTh E[SCEMODULE]: HLE\sceKernelModule.cpp:1285 LoadInto failed with error 80020148 57:24:353 LoadModuleTh E[LOADER]: HLE\sceKernelModule.cpp:2070 80020148=sceKernelLoadModuleNpDrm(ms0:/PSP/GAME/NPJH50698/f5psp.sprx, 00000000, 00000000): failed to loaduleNpDrm(ms0:/PSP/GAME/NPJH50698/f5psp.sprx, 00000000, 00000000): failed to load

v1.01 to v 3.1 iso patcher for windows 64 bit iso_patch.zip DLC: NPJH50698.zip

Platform

Windows

Mobile phone model or graphics card

Nvidia Geforce 710

PPSSPP version affected

All

Last working version

none

Graphics backend (3D API)

Vulkan

Checklist

sum2012 commented 1 year ago

jpcsp emulator fix in https://github.com/jpcsp/jpcsp/commit/86c10922ae09bd1a030ea763bf70d75c717e80ab @DaveeFTW are you still here ? Do you interest to add more decrypted support ?

sum2012 commented 1 year ago

@Kethen do you interest to fix it ? v1.16.6-317-g70c7bb3b0 log https://gist.github.com/sum2012/612d4b49c531cae4274f1913de109d83

Kethen commented 1 year ago

Looks like this is related to https://github.com/hrydgard/ppsspp/pull/1971

You'll likely have to get f5psp.sprx decrypted before loading, you sure jpcsp HLE can load that sprx without decrypting on a real psp first? https://github.com/jpcsp/jpcsp/blob/72a936ccc075ded750bb0d2bc2ad6881ce193161/src/jpcsp/HLE/modules/LoadExecForUser.java#L315C36-L315C58 suggests that it can't

Is there a known way to decrypt a sprx outside of a real psp now?

sum2012 commented 1 year ago

I am sure jpcsp HLE can load that sprx without decrypting on a real psp first jpcsp 7b43500 log: https://gist.github.com/sum2012/12466f5903dc44813c08cf01c3bf66bf

Is there a known way to decrypt a sprx outside of a real psp now? Maybe using LLE of Jpcsp ?

DaveeFTW commented 1 year ago

jpcsp emulator fix in jpcsp/jpcsp@86c1092 @DaveeFTW are you still here ? Do you interest to add more decrypted support ?

I'm a little tight for time, but it's something I can look at.

Kethen commented 1 year ago

@DaveeFTW I was looking at it, it seems that sceNpDrmSetLicenseeKey has to be wired up, then the decryption and key derive logic from https://github.com/jpcsp/jpcsp/blob/72a936ccc075ded750bb0d2bc2ad6881ce193161/src/jpcsp/HLE/modules/ModuleMgrForUser.java#L1169 has to be ported over

If you're interested in working on this I'll stop poking at it haha

You might find this commit useful https://github.com/Kethen/ppsspp/commit/9d641a6154f812f8d42a713197adabe1a94fa651 , that's all I've done so far, you don't have to reuse that if you have better ways to organize it

Good hunting :D