Stop standby on scePowerUnlock if switch flipped while lock.

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

adrahil wrote:and you can use the GPIO bits to check for display enable :)
What is the port for checking display enable?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

Do you know the value for the standby event? The suspend even doesn't catch it when you hold the power switch for 3 seconds.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

http://forums.ps2dev.org/viewtopic.php?t=11294
Here I've found scePowerIsRequest functions that return 1 if you try to shutdown or suspend the PSP in the both cases ( Power switch and scePower* functions )!
I've also finded scePowerCancelRequest function, I've tried it but doesn't works, maybe there's something to do to get it working!
If I'm right with this you can resolve "all" your problems...
Here is the asm of scePowerCancelRequest

Code: Select all

scePowerCancelRequest:
	0x00002B30: 0x27BDFFF0 '...'' - addiu      $sp, $sp, -16
	0x00002B34: 0xAFBF0004 '....' - sw         $ra, 4($sp)
	0x00002B38: 0x0C0016D2 '....' - jal        sceKernelCpuSuspendIntr
	0x00002B3C: 0xAFB00000 '....' - sw         $s0, 0($sp)
	0x00002B40&#58; 0x3C040000 '...<' - lui        $a0, 0x0
	0x00002B44&#58; 0x24850258 'X..$' - addiu      $a1, $a0, 600
	0x00002B48&#58; 0x8CB00028 '&#40;...' - lw         $s0, 40&#40;$a1&#41;
	0x00002B4C&#58; 0xACA00028 '&#40;...' - sw         $zr, 40&#40;$a1&#41;
	0x00002B50&#58; 0x0C0016D6 '....' - jal        sceKernelCpuResumeIntr
	0x00002B54&#58; 0x00402021 '! @.' - move       $a0, $v0
	0x00002B58&#58; 0x02001021 '!...' - move       $v0, $s0
	0x00002B5C&#58; 0x8FBF0004 '....' - lw         $ra, 4&#40;$sp&#41;
	0x00002B60&#58; 0x8FB00000 '....' - lw         $s0, 0&#40;$sp&#41;
	0x00002B64&#58; 0x03E00008 '....' - jr         $ra
	0x00002B68&#58; 0x27BD0010 '...'' - addiu      $sp, $sp, 16
Anyway, can be the args ( a0-1-2-...) be passed directly to sceKernelCpuSuspendIntr?
In this case the scePowerCancelRequest funct has to reiceve 2 args, right?

EDIT:
Sorry, sceKernelCpuSuspendIntr is void so...
Last edited by ne0h on Thu Nov 20, 2008 12:59 am, edited 1 time in total.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

AFAIK by the time you can use any of the above functions, the suspend process is already underway and any running game would have made preparations to suspend. Only the sysevent gets called before applications are aware of it.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Oh, ok!
Sorry...

P.S:
What means AFAIK? :@
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

As Far As I Know :)

www.urbandictionary.com
Image
Upgrade your PSP
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

-.-, thanks...
SilverSpring
Posts: 110
Joined: Tue Feb 27, 2007 9:43 pm
Contact:

Post by SilverSpring »

ne0h wrote:http://forums.ps2dev.org/viewtopic.php?t=11294
Here I've found scePowerIsRequest functions that return 1 if you try to shutdown or suspend the PSP in the both cases ( Power switch and scePower* functions )!
I've also finded scePowerCancelRequest function, I've tried it but doesn't works, maybe there's something to do to get it working!
If I'm right with this you can resolve "all" your problems...
Here is the asm of scePowerCancelRequest

Code: Select all

scePowerCancelRequest&#58;
	0x00002B30&#58; 0x27BDFFF0 '...'' - addiu      $sp, $sp, -16
	0x00002B34&#58; 0xAFBF0004 '....' - sw         $ra, 4&#40;$sp&#41;
	0x00002B38&#58; 0x0C0016D2 '....' - jal        sceKernelCpuSuspendIntr
	0x00002B3C&#58; 0xAFB00000 '....' - sw         $s0, 0&#40;$sp&#41;
	0x00002B40&#58; 0x3C040000 '...<' - lui        $a0, 0x0
	0x00002B44&#58; 0x24850258 'X..$' - addiu      $a1, $a0, 600
	0x00002B48&#58; 0x8CB00028 '&#40;...' - lw         $s0, 40&#40;$a1&#41;
	0x00002B4C&#58; 0xACA00028 '&#40;...' - sw         $zr, 40&#40;$a1&#41;
	0x00002B50&#58; 0x0C0016D6 '....' - jal        sceKernelCpuResumeIntr
	0x00002B54&#58; 0x00402021 '! @.' - move       $a0, $v0
	0x00002B58&#58; 0x02001021 '!...' - move       $v0, $s0
	0x00002B5C&#58; 0x8FBF0004 '....' - lw         $ra, 4&#40;$sp&#41;
	0x00002B60&#58; 0x8FB00000 '....' - lw         $s0, 0&#40;$sp&#41;
	0x00002B64&#58; 0x03E00008 '....' - jr         $ra
	0x00002B68&#58; 0x27BD0010 '...'' - addiu      $sp, $sp, 16
Anyway, can be the args ( a0-1-2-...) be passed directly to sceKernelCpuSuspendIntr?
In this case the scePowerCancelRequest funct has to reiceve 2 args, right?

EDIT:
Sorry, sceKernelCpuSuspendIntr is void so...
scePowerCancelRequest only cancels hw requests, ie from the power switch. It doesnt cancel software requests, ie. calls from scePowerRequestStandby, scePowerRequestSuspend, scePower_driver_2875994B, & scePowerRequestColdReset.

If you look at the asm, it only zero's one global var (the hardware request), another var controls the software requests.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

SilverSpring wrote:scePowerCancelRequest only cancels hw requests, ie from the power switch. It doesnt cancel software requests, ie. calls from scePowerRequestStandby, scePowerRequestSuspend, scePower_driver_2875994B, & scePowerRequestColdReset.

If you look at the asm, it only zero's one global var (the hardware request), another var controls the software requests.
Does that mean there's a more efficient way to cancel a power switch suspend that using a sysevent? Because I only want to cancel the power switch event and not the idle timeout suspend. I have to make additional checks for this in my app when using the sysevent.

I tried to call the cancel request in the power callback for power switch pushed but it doesn't work. It still gets suspended.
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

Thanks SilverSpring
Post Reply