173210 / valentine-hbl

Half Byte Loader BETA
http://wololo.net/hbl
Other
22 stars 5 forks source link

Snes9x always reports low battery charge #284

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Snes9x detects a low battery level and because of that refuses to do any 
writing operation (settings/savestates) when running on battery with HBL. The 
error does not occur when running with power supply connected.

Also see this post in testing: 
http://advancedpsp.tk/foro_es/viewtopic.php?p=12295#p12295

Solution: Hook scePowerIsLowBattery() to always return 0. 
This issue is unrelated to the values returned by 
_hook_scePowerGetBatteryLifeTime() and _hook_scePowerGetBatteryLifePercent().

Original issue reported on code.google.com by jochen.s...@gmail.com on 14 Jul 2010 at 8:37

GoogleCodeExporter commented 8 years ago
how would that be done?

Original comment by eternalf...@gmail.com on 15 Jul 2010 at 5:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
get rid of your _hook_scePowerIsLowBattery(); function, and instead call 
"_hook_generic_ok", we want to keep HBL small if possible, so creating a new 
function that returns 0 is useless, we already have one.
Other than that, yes, that's the correct fix

Original comment by wagic.the.homebrew@gmail.com on 15 Jul 2010 at 11:03

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@wololo Will do man. ;)

Edit: here we are the revised fix tested and working.

For anyone interested in how it was done and thanks to wololo for letting me 
know a function already existed for 0, Should have looked before I edited 
anyway thanks again for letting me know wololo, I'll be sure to look better 
next time in the future if needed.

1st open hook.c

Find
case 0x8EFB3FA2: //scePowerGetBatteryLifeTime (avoid syscall estimation) 
hook_call = MAKE_JUMP(_hook_scePowerGetBatteryLifeTime); 
break; 

After Add This

case 0xD3075926: //scePowerIsLowBattery (avoid syscall estimation) 
hook_call = MAKE_JUMP(_hook_generic_ok); 
break; 

Compile HBL 

and there you go a fully working SNES9X TYL on r94.

Original comment by SeanC...@gmail.com on 15 Jul 2010 at 11:27

GoogleCodeExporter commented 8 years ago
Thanks Sean994, I'll add this change in my next submission

Original comment by wagic.the.homebrew@gmail.com on 15 Jul 2010 at 1:29

GoogleCodeExporter commented 8 years ago
Look what I found on the internet.

http://www.psp-programming.com/forums/index.php/topic,4841.msg36461.html

If i'm successful in compiling the code or unpacking the pbp's and modifying 
them, I'll post the build for everybody to enjoy.

Warning: I do not have any experience with compiled languages, I'm only able to 
program with Python 2/3. So if there's any problems concerning my code changes 
that can affect the well being of your PSP, i'm not responsible.

Original comment by joe...@ymail.com on 17 Jul 2010 at 5:58

GoogleCodeExporter commented 8 years ago
good luck learn as much as you can

Original comment by ktm...@gmail.com on 17 Jul 2010 at 6:08

GoogleCodeExporter commented 8 years ago
Oh yes, I forgot to add the official site for the emulator.

http://yoyofr92.free.fr/psp/snespsp.html

in case if somebody wants to attempt the hack before I arrive home later today.

Original comment by joe...@ymail.com on 17 Jul 2010 at 6:23

GoogleCodeExporter commented 8 years ago
I really don't see a point in hex editing it/using that tutorial to do what 
you're doing when you could do that with the source itself and compile it, 
doing it that way is harder and will take more time.

I think the fix that JJS mentioned will be more effective in case more 
emulators have the same issue and Masterboy/EmuMaster has this issue but it 
lets you save thankfully, So this issue wasn't a need to post on the SVN.

Anyway that's just my opinion if you wanna go ahead and do it the hard way then 
it's fine.

Original comment by SeanC...@gmail.com on 17 Jul 2010 at 11:54

GoogleCodeExporter commented 8 years ago
Fixed in r95, please verify

Original comment by wagic.the.homebrew@gmail.com on 18 Jul 2010 at 12:48

GoogleCodeExporter commented 8 years ago
Yup it's confirmed and working in r95 wololo.

Original comment by SeanC...@gmail.com on 18 Jul 2010 at 1:28

GoogleCodeExporter commented 8 years ago
Update: I don't know what else to do. I unpacked the pbp and tried to dump the 
data from DATA.PSP with pspdasm with no success. It continuously loops and 
exits with no information to work with. Trying to build the package from source 
isn't fruitful either. I downloaded several pspsdks and I don't know where to 
commence. I'm sorry everybody that I won't be able to provide you a build. On 
the other hand Wololo fixed this issue in r95. Thank you very much Wololo, you 
brought light into my dark world.

Original comment by joe...@ymail.com on 18 Jul 2010 at 2:59