soywiz-archive / jspspemu

typescript psp emulator https://jspspemu.soywiz.com/
https://soywiz.com/
97 stars 34 forks source link

Doesnt load #12

Open ethanaobrien opened 3 years ago

ethanaobrien commented 3 years ago

I am trying to access this project from the https://jspspemu.soywiz.com/ url. Once I select my game it does nothing I have uploaded the console log below

jspspemu.soywiz.com-1618947966516.log

Please fix!!

soywiz commented 3 years ago

Hey @ethanaobrien thanks for reporting! This project is one that I use for experimenting to learn new things and so. I update it from time to time and maybe even once a year, or even once after several years. Project Diva is one of the games I want to get it working. IIRC the problem for it not running right now is because the executable is not correctly decrypted. But I don't know if I will be able to get it working anytime soon. My suggestion is you to use PPSSPP or JPCSP that are the most mature ones. Hope it helps!

ethanaobrien commented 3 years ago

Hey @soywiz

I'm looking into trying to fix this but I can't trace the problem. I can tell it is happening in the src/emulator/emulator.ts file, but I cannot find what in the file is causing the problem. Could you give me some info on what is crashing / not loading correctly? Some info about the emulator boot process would be helpful too. (although in some ways I think it'd be easier to translate ppsspp to wasm)

Also, just wondering, are save/load states implemented?

The reason I'd like to work on this is because I'm on a chromebook (and not enough space for the android sub-system) and because why not?

soywiz commented 3 years ago

@ethanaobrien Somewhere in the emulator.ts, there is the code deciding what executable to load. Looking at the error maybe it is trying to load BOOT.BIN, that in the case of that game is empty. It should try to load the EBOOT.BIN file instead, that is encrypted. There is some decryption code in the emu. Decryption of the main executable seems to happen here: https://github.com/jspspemu/jspspemu/blob/514634c45dbfc639327b99f72c2c47c13100f3c1/src/hle/elf_crypted_prx.ts#L285 I believe I implemented decryption from older games, and that one has a newer decryption. You could check JPCSP or PPSSPP decryption process and try to port it to JS.

ethanaobrien commented 3 years ago

@soywiz Could you give me an example of an old game so I can check the differences in data and structure of data

ethanaobrien commented 3 years ago

@soywiz You are correct, from what I've found we must use the EBOOT.BIN instead of BOOT.BIN and decrypt the file

When opening the BOOT.BIN file in notepad ++, it just shows that it is full or null bytes, but the EBOOT.BIN file obviously has some data.

Is this decrypt2 function a start at trying to decode the newer algorithms? It just seems to need to be translated from C which wouldn't be too hard

https://github.com/jspspemu/jspspemu/blob/514634c45dbfc639327b99f72c2c47c13100f3c1/src/hle/elf_crypted_prx.ts#L176