Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 04, 2012, 10:08:53 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Welcome to PSP-Programming.com
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: Removing Low battery/Disable savestate in Snes9xTYL 0.4.2 PBP  (Read 1919 times)
Rick81
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4
382.75 points

View Inventory
Send Money to Rick81

View Profile
« on: April 20, 2010, 09:36:25 AM »

I thought I found the ultimate portable Snes emulator when I found Snes9xTYL 0.4.2

The emulator is really good but there is one thing that freaks me out.

When the battery is low (about 30-40 minutes left) the emulator stops save stats, with the consequence that if you do not find a power cord in this time (sleep mode is inactivated when running the emulator) you lose all your progress.

I have downloaded the sourcecode and modified it (i.e. removed the Low battery/disable savestate feature) och put several hours in trying to compile it put it the compiler stops at a lot of errors (most externals). I have fixed a lot of problems but there no end of the errors.

As an backup I am thinking of directly modify the hexcode, since it should be possible to find out where one variable called os9x_lowbat is located.

There is a string (found by using hexeditor on the EBOOT.PBP file) close to this variable:

if (os9x_lowbat) {
      if (!((s_TotalFrame>>7)&15)) pgPrintBG(0,33,0xffff,"Low Battery/Saving disactivated");
      else pgPrintBGRev(0,33,0xffff,"                               ");
   }

And the variable is set at:
os9x_lowbat=scePowerIsLowBattery();

What I want to to is setting
os9x_lowbat=0 instead of the function.


Is this possible? And if it is, how do I do it? Is there a way to go from EBOOT.BPB -> assembler and then assembler -> EBOOT.PBP?

« Last Edit: April 21, 2010, 12:16:40 PM by Rick81 » Logged


Rick81
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 4
382.75 points

View Inventory
Send Money to Rick81

View Profile
« Reply #1 on: April 27, 2010, 09:07:27 AM »

I managed to hack the EBOOT.PBP to remove the Low battery/ Disable save state feature and did it in the following way:
* Unpacked the EBOOT.PBP by using "PBP Unpacker"

* Disassembled the DATA.PSP using "PSPDASM V0.20 by BOOSTER"

* Located the os9x_lowbat and scePowerIsLowBattery() in the C-code

* PSPDASM showed scePowerIsLowBattery() in plain text in assembler code

* Changed assembler lines (i.e. always setting os9x_lowbat to 0)
sw     r2,$3b00(r3)                    ;00016F44[AC623B00,'.;b.']
to
sw     0,$3b00(r3)                        ;00000CC8[AC603B00,'.;@.']

at addresses:
00016F44
00017DD8

and

sw     r2,$3b00(r16)                      ;00000BA4[AE023B00,'.;..']
to
sw     0,$3b00(r16)                       ;00000CC8[AE003B00,'.;@.']

at addresses:
0001D9F4
001266DC
00000BA4

and

(this change was required since in on place the return value from scePowerIsLowBattery was check before storing it in os9x_lowbat, this code always makes the branch, i.e. checks if 0 == 0)
beq    r2,0,$00000bd8                     ;00000BA0[1040000D,'..@.']
to
beq    0,0,$00000bd8                     ;00000BA0[1000000D,'..@.']

* Since the problem was I couldn't use the PSP compiler, I modified the DATA.PSP with the changes shown above in hex format i.e. 1040000D -> 1000000D. Note that the hexformat is swapped so the change is 0D 00 40 10 -> 0D 00 00 10 at adress 00000BA0 + offset (0x60)

* Packed the DATA.PSP and the other files to EBOOT.PBP

* Copied the the PSP and it did work..

A bit weird that it is easier the hack the machine code then getting a script that should install everything in the PSP toolchain to work, but I solved the problem.
Logged
AlphaDingDong
Combat Muskrat
All-Around Dev
Hero Member
*

Karma: +32/-3
Offline Offline

Posts: 882
2044.69 points

View Inventory
Send Money to AlphaDingDong
Hey... Are you gonna eat that?


View Profile
« Reply #2 on: April 27, 2010, 02:57:22 PM »

Lol.  Toggling one bit solved your problem.
Logged
Sakuryu
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1
134.73 points

View Inventory
Send Money to Sakuryu

View Profile
« Reply #3 on: July 14, 2010, 02:04:23 PM »

Can you send me a copy of that im trying to mod it myself and things are not going well x.x
Logged
Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.142 seconds with 27 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com