| View previous topic :: View next topic |
| Author |
Message |
etenia
Joined: 07 Sep 2006 Posts: 6
|
Posted: Mon Sep 11, 2006 1:10 am Post subject: |
|
|
| moonlight wrote: | | etenia wrote: | Is it possible to reboot the PSP in Usermode?
thanks |
scePower_0442D852 can be called in user mode. But since pspsdk doesn't support it yet, you'll have to create the stub yourself. |
Ok thanks.
I tried it after I read this topic, and PSPSDK indeed gives an error.
Maybe it's the wrong topic, but how do I create the stub myself?
(I'm new to PSP programming, and to C overall)
If I create a header file
| Code: |
void scePower_0442D852(int);
|
I get the following error:
undefined reference to `scePower_0442D852(int)'
I do include the header file.
| Code: |
#include "scePower.h"
scePower_0442D852(0);
|
|
|
| Back to top |
|
 |
weltall
Joined: 20 Feb 2004 Posts: 310
|
Posted: Mon Sep 11, 2006 2:59 am Post subject: |
|
|
you must do a stub in a asm file like the sdk does.
download the pspsdk source and check for example sceAudio.S
or you could use the prx utils to make stub file for other prxs |
|
| Back to top |
|
 |
etenia
Joined: 07 Sep 2006 Posts: 6
|
Posted: Mon Sep 11, 2006 6:55 am Post subject: |
|
|
Ok, thank you very much.
I need to look more into this, because it doesn't say much to me :) |
|
| Back to top |
|
 |
dot_blank

Joined: 28 Sep 2005 Posts: 498 Location: Brasil
|
Posted: Mon Sep 11, 2006 10:05 am Post subject: |
|
|
example of stub to firmware:
pspUtility.S(assembly):
| Code: | .set noreorder
#include "pspstub.s" //included in pspsdk
STUB_START "sceUtility",0x40010000,0x00240005
STUB_FUNC 0xc492f751,sceUtilityGameSharingInitStart
STUB_FUNC 0xefc6f80f,sceUtilityGameSharingShutdownStart
STUB_FUNC 0x7853182d,sceUtilityGameSharingUpdate
STUB_FUNC 0x946963f3,sceUtilityGameSharingGetStatus
STUB_FUNC 0x3ad50ae7,sceNetplayDialogInitStart
STUB_FUNC 0xbc6b6296,sceNetplayDialogShutdownStart
STUB_FUNC 0x417bed54,sceKernelAutomagicallyPlaybackDevice
... //rest of stubbed functions
STUB_END |
pspUtility.h (C code):
| Code: | #ifndef PSP_UTILITY_H
#define PSP_UTILITY_H
//preprocessor macros, defines, includes etc..;
//some structures for osk use
typedef struct SceUtilityOskInputFieldInfo_s {
unsigned int input_method_type;
unsigned int input_method_attributes;
unsigned int writing_language_type;
int hide_mode;
int input_character_type;
int num_lines;
int kinsoku;
SceWChar16 *message;
SceWChar16 *init_text;
int result_text_buffer_size;
SceWChar16 *result_text_buffer;
int result;
int limit_length;
} SceUtilityOskInputFieldInfo;
typedef struct SceUtilityOskParam_s {
SceUtilityParamBase base;
unsigned int num_input_fields;
SceUtilityOskInputFieldInfo *input_field_info;
int local_status;
int error;
} SceUtilityOskParam;
//prototypes for stub functions from pspUtility.S
int sceUtilityOskInitStart(SceUtilityOskParam* param);
int sceUtilityOskShutdownStart(void);
int sceUtilityOskUpdate(int animation_speed);
int sceUtilityOskGetStatus(void);
|
Makefile:
| Code: | ... //lets skip to important lines
OBJS = \
main.o \
draw.o \
pspUtility.o \ //the above pspUtility.S will be created into a object
//so we can use those stub functions
... //etc...
|
and thats all you need to use your stubs
Note: HOW to create your stubs you will have to
figure that on your own ...its too simple and clues
are plentiful on this thread for example
to get the prototypes you will have to learn Mips Asm :P
of course if you learn that first then you would not
need help from examples like this post ...so go learn!
Example of Use:
| Code: | #include "pspUtility.h"
//lets use an above function ....say sceUtilityOskInitStart();
//so we can use the sony osk...all this is done in the osk sample if
//youd like to see complete source of use
...
...
//function to handle users input
int getOskInput(const char* name, const char* input, char* output, unsigned int len){
...
//variable for osk data
SceUtilityOskParam osk;
memset(&osk, 0, sizeof(osk));
osk.base.size = sizeof(osk);
osk.base.message_lang = 2;
osk.base.ctrl_assign = GetEnterButton();
osk.base.main_thread_priority = 17;
osk.base.sub_thread_priority = 19;
osk.base.font_thread_priority = 18;
osk.base.sound_thread_priority = 16;
//also setup input field info
SceUtilityOskInputFieldInfo inparam;
memset(&inparam, 0, sizeof(inparam));
inparam.input_method_type = 0x000D;
inparam.input_method_attributes = 0;
inparam.writing_language_type = 0x0005;
inparam.hide_mode = 0;
inparam.input_character_type = 0;
inparam.num_lines = 4;
inparam.kinsoku = 1;
inparam.message = name16;
inparam.init_text = input16;
inparam.result_text_buffer = output16;
inparam.result_text_buffer_size = 512;
inparam.result = 0;
inparam.limit_length = len;
//everything is setup lets init osk
int rc = sceUtilityOskInitStart(&osk);
if(rc) {
return 1;
}
//main loop ...infinite
for(;;){
drawFrame();
//use another stub
int status = sceUtilityOskGetStatus();
switch(state) {
//... do what you will
}
drawFlip();
}
return 1;
} //end of getOskInput()
...//continue source
|
_________________ 10011011 00101010 11010111 10001001 10111010 |
|
| Back to top |
|
 |
TUniqueW

Joined: 09 Dec 2006 Posts: 12
|
Posted: Sun Dec 10, 2006 5:35 pm Post subject: |
|
|
thanks to dot_blank i have made the scepower sub here we go:
scepower.S
| Code: |
.set noreorder
#include "pspstub.s"
STUB_START "scePower", 0x40010000, 0x20005
STUB_FUNC 0x0442D852, scePower_0442D852
STUB_END
|
scepower.h
| Code: |
#ifndef PSP_POWER_H
#define PSP_POWER_H
#ifdef __cplusplus
extern "C" {
#endif
/*
Simply reboots the PSP
@code
@unknown - unknown just pass 50000 or any more then 0 only tested that
*/
int scePower_0442D852(int unknown);
#ifdef __cplusplus
}
#endif
#endif
|
correct me please .....
because I used the fucntion like this:
| Code: |
scePower_0442D852(0); //This won't work
//this should work tested 100% success
scePower_0442D852(50000);
|
and made it with no warnings. but didn't get a reboot
NOTE: PSP I'm using is on 2.71 SE-C + This function is called from a PRX loaded successfully from the PRX (as other things work perfectly).
I'm lost,
Thanks in Advance,
TUW
SOLVED! _________________ Developer: C/C++ knows nothing about assembly!
Last edited by TUniqueW on Sun Dec 10, 2006 6:20 pm; edited 1 time in total |
|
| Back to top |
|
 |
TUniqueW

Joined: 09 Dec 2006 Posts: 12
|
Posted: Sun Dec 10, 2006 6:15 pm Post subject: |
|
|
ok I fixed it my self.....
if you pass 50000 to the function it will reboot your PSP like a charm (even in user mode ) I'll edit the source
Cheers,
TUW _________________ Developer: C/C++ knows nothing about assembly! |
|
| Back to top |
|
 |
TUniqueW

Joined: 09 Dec 2006 Posts: 12
|
Posted: Mon Dec 11, 2006 5:49 am Post subject: sceSysconResetDevice |
|
|
as you said there is a simple way of rebootig:
| Code: |
sceSysconResetDevice(1, 1);
|
and that gives you a disk error
and even if you use 2 as the second argument it still gives you the error:
| Code: |
sceSysconResetDevice(1, 2);
|
but the reboot time is faster.
I have tried this two:
| Code: |
sceSysconResetDevice(2, 1); //That I thought it would reset UMD_DRIVE(?)
sceSysconResetDevice(1, 1);
|
in that PSP reboots after 3-5 mins but still Disk Error and with bright less level one. ??
Anu suggestions how to make it work without the Disk Error ?
Cheers,
TUW _________________ Developer: C/C++ knows nothing about assembly! |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Tue Jul 01, 2008 3:08 am Post subject: |
|
|
| What is the use of the 0x200 length parameters that M33 Recovery passes to VSH on exit recovery. |
|
| Back to top |
|
 |
|