| View previous topic :: View next topic |
| Author |
Message |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sat May 07, 2005 10:36 pm Post subject: Documenting PSP Library Imports |
|
|
For lack of a better place to put it I am starting this thread so that known library imports can be documented. These should be legally (if that is possible) extracted, basically DO NOT copy&paste from the SDK or similar. Of course this is really going to be a grey area but I don't think there is alot we can do about it as without these imports the psp will be kinda useless :P
Oh and try and at least work out what the functions are, we can all just read numbers in a hex editor :)
So I will start the ball rolling, these are in nem format (thx nem ;)) so if you have checked out the helloworld source it should be fairly obvious.
Controller Library
| Code: |
-= imports =-
STUB_START "sceCtrl",0x40010000,0x00030005
STUB_FUNC 0x6a2774f3,CtrlInit
STUB_FUNC 0x1f4011e6,CtrlSetAnalogMode
STUB_FUNC 0x1f803938,CtrlRead
STUB_END
-= Function Prototypes =-
/* Index for the two analog directions */
#define CTRL_ANALOG_X 0
#define CTRL_ANALOG_Y 1
/* Button bit masks */
#define CTRL_SQUARE 0x8000
#define CTRL_TRIANGLE 0x1000
#define CTRL_CIRCLE 0x2000
#define CTRL_CROSS 0x4000
#define CTRL_UP 0x0010
#define CTRL_DOWN 0x0040
#define CTRL_LEFT 0x0080
#define CTRL_RIGHT 0x0020
#define CTRL_START 0x0008
#define CTRL_SELECT 0x0001
#define CTRL_LTRIGGER 0x0100
#define CTRL_RTRIGGER 0x0200
/* Returned control data */
typedef struct _ctrl_data
{
u32 frame;
u32 buttons;
u8 analog[4];
u32 unused;
} ctrl_data_t;
/* Not 100% sure on this, init with 0 */
void CtrlInit(int unknown);
/* Pass 1 to enable analogue mode */
void CtrlSetAnalogMode(int on);
/* Read in the controller data. Unknown should be set to 1 */
void CtrlRead(ctrl_data_t* paddata, int unknown);
|
|
|
| Back to top |
|
 |
MrFreeze
Joined: 07 May 2005 Posts: 1
|
Posted: Sat May 07, 2005 10:51 pm Post subject: |
|
|
Some more ... also worth noting that the function id appears to be the first 32 bits of SHA1 over the original function name.
| Code: |
STUB_START "IoFileMgrForUser",0x40010000,0x00030005
STUB_FUNC 0xb29ddf9c,IoDopen
STUB_FUNC 0xe3eb004c,IoDread
STUB_FUNC 0xeb092469,IoDclose
STUB_END
enum {
TYPE_DIR=0x10,
TYPE_FILE=0x20
};
struct dirent {
u32 unk0;
u32 type;
u32 size;
u32 unk[19];
char name[0x108];
};
int IoDopen(const char *fn);
int IoDread(int fd, struct dirent *de);
void IoDclose(int fd);
|
|
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sun May 08, 2005 1:21 am Post subject: Re: Documenting PSP Library Imports |
|
|
| TyRaNiD wrote: |
Controller Library
| Code: |
-= imports =-
STUB_START "sceCtrl",0x40010000,0x00030005
STUB_FUNC 0x6a2774f3,CtrlInit
STUB_FUNC 0x1f4011e6,CtrlSetAnalogMode
STUB_FUNC 0x1f803938,CtrlRead
STUB_END
/* Not 100% sure on this, init with 0 */
void CtrlInit(int unknown);
/* Pass 1 to enable analogue mode */
void CtrlSetAnalogMode(int on);
/* Read in the controller data. Unknown should be set to 1 */
void CtrlRead(ctrl_data_t* paddata, int unknown);
|
|
Please, let's not go through this again .. leave the "sce" on the function name, as there's no point in stripping it. You are calling into sceCtrlInit(), not providing an open source clone called CtrlInit(). This is no different than Win32 programming, say in WINE or mingw32. |
|
| Back to top |
|
 |
blackdroid
Joined: 17 Jan 2004 Posts: 564 Location: Sweden
|
Posted: Sun May 08, 2005 1:29 am Post subject: |
|
|
Have to second that, lets not make the same mistake we did with ps2sdk, keep the sce prefix. its just a name, but a useful one :) _________________ Kung VU |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun May 08, 2005 1:34 am Post subject: |
|
|
Marcus, there was no symbols where I got it from, I do not even know the _proper_ name for it. I suppose I could brute force it :P What would be the point of calling it sceCtrlInit if it wasn't actually called that, and doing a hash on all 3 of those names indicates that they are definetly _not_ called what I named them :)
Of course if you want me to just tag all functions with sce which come from the kernel I guess it makes some sense :P
Last edited by TyRaNiD on Sun May 08, 2005 1:35 am; edited 1 time in total |
|
| Back to top |
|
 |
Vampire
Joined: 12 Apr 2005 Posts: 138
|
Posted: Sun May 08, 2005 1:35 am Post subject: |
|
|
| yes, please leave the "sce" on the function name... |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sun May 08, 2005 1:37 am Post subject: |
|
|
| I apologize, I had assumed you got them from wherever folks are getting symbols these days :). nem had posted some lists elsewhere with the sce prefix on the sceCtrl imports. ooPo, is it alright to copy those into here so we don't duplicate work? |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun May 08, 2005 3:24 am Post subject: |
|
|
Oki few more for fun, these will include sce prefixes as they match the hashes :P
| Code: |
-= Imports =-
STUB_START "IoFileMgrForUser",0x40010000,0x00050005
STUB_FUNC 0x6a638d83,sceIoRead
STUB_FUNC 0x42ec03ac,sceIoWrite
STUB_FUNC 0x27eb27b8,sceIoLseek
STUB_FUNC 0x810c4bc3,sceIoClose
STUB_FUNC 0x109f50bc,sceIoOpen
STUB_FUNC 0xF27A9C51,sceIoRemove
STUB_FUNC 0x6A70004,sceIoMkdir
STUB_FUNC 0x1117C65F,sceIoRmdir
STUB_FUNC 0x54F5FB11,sceIoDevctl
STUB_FUNC 0x779103A0,sceIoRename
-= Function Definitions =-
#define O_RDONLY 0x0001
#define O_WRONLY 0x0002
#define O_RDWR 0x0003
#define O_NBLOCK 0x0010
#define O_APPEND 0x0100
#define O_CREAT 0x0200
#define O_TRUNC 0x0400
#define O_NOWAIT 0x8000
int sceIoOpen(const char* file, int mode);
void sceIoClose(int fd);
int sceIoRead(int fd, void *data, int size);
int sceIoWrite(int fd, void *data, int size);
int sceIoLseek(int fd, int offset, int whence);
int sceIoRemove(const char *file);
int sceIoMkdir(const char *dir, int mode);
int sceIoRmdir(const char *dir);
int sceIoRename(const char *oldname, const char *newname);
int sceIoDevctl(const char *name int cmd, void *arg, size_t arglen, void *buf, size_t *buflen);
|
BIG NOTE:
I cannot as of yet work out how to create new files on the memstick, almost seems like it is locked unless you call something to unlock it. This means you cannot create new files although you can create an empty one from the PC and then open and truncate and then write to it. Very strange. This affects the mkdir/rmdir/rename etc as well. |
|
| Back to top |
|
 |
Orion_
Joined: 27 Jan 2005 Posts: 69
|
Posted: Sun May 08, 2005 3:36 am Post subject: |
|
|
you find all this by reversing the bios code ? o_O
amazing. |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Sun May 08, 2005 3:38 am Post subject: |
|
|
| mrbrown: I don't mind, but you should check with nem just to be sure. |
|
| Back to top |
|
 |
lmx
Joined: 01 Apr 2005 Posts: 25
|
Posted: Sun May 08, 2005 1:12 pm Post subject: |
|
|
| looks scarily like official sdk library call names to me, maybe use notscehonestgodIoOpen() |
|
| Back to top |
|
 |
ooPo Site Admin
Joined: 17 Jan 2004 Posts: 2032 Location: Canada
|
Posted: Sun May 08, 2005 1:19 pm Post subject: |
|
|
From this thread, if you had read carefully:
| Quote: | | Please, let's not go through this again .. leave the "sce" on the function name, as there's no point in stripping it. You are calling into sceCtrlInit(), not providing an open source clone called CtrlInit(). This is no different than Win32 programming, say in WINE or mingw32. |
| Quote: | | Have to second that, lets not make the same mistake we did with ps2sdk, keep the sce prefix. its just a name, but a useful one :) |
| Quote: | | yes, please leave the "sce" on the function name... |
The reasoning and general acceptance of using sce prefixes. |
|
| Back to top |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Sun May 08, 2005 10:33 pm Post subject: |
|
|
*bump* :P
Anyway a couple more useless ones, and no I don't know the official names so please do not ask.
| Code: |
STUB_START "sceSuspendForUser",0x40000000,0x00020005
STUB_FUNC 0xEADB1BD7,"DisableSuspend"
STUB_FUNC 0x3AEE7261,"EnableSuspend"
STUB_END
/* Parameters unknown for these functions, set to 0 */
/* Disable the suspend facility */
void DisableSuspend(int param);
/* Enable the suspend facility, if someone tried to suspend it during the disable period it will immediately suspend */
void EnableSuspend(int param);
|
|
|
| Back to top |
|
 |
Vampire
Joined: 12 Apr 2005 Posts: 138
|
Posted: Mon May 09, 2005 2:18 am Post subject: |
|
|
some library names:
| Code: | IoFileMgrForUser
Kernel_Library
LoadExecForUser
ModuleMgrForUser
StdioForUser
SysMemUserForUser
ThreadManForUser
UtilsForUser
sceAtrac3plus
sceAudio
sceCtrl
sceDisplay
sceGe_user
sceLibFont
sceHttp
sceMpeg
sceNet
sceNetAdhoc
sceNetAdhocctl
sceNetAdhocMatching
sceNetApctl
sceNetInet
sceNetResolver
sceOpenPSID
sceParseHttp
sceParseUri
scePower
sceRtc
sceSasCore
sceSsl
sceSuspendForUser
sceUmdUser
sceUtility
sceWlanDrv |
|
|
| Back to top |
|
 |
Pikoro
Joined: 13 Jan 2005 Posts: 56
|
Posted: Mon May 09, 2005 7:29 pm Post subject: |
|
|
This could all be dumped into the wiki... http://wiki.psphacks.net that was created because someone in #pspdev on irc requested it.
*shrugs* might make it all a little easier to read |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Thu May 12, 2005 3:18 pm Post subject: |
|
|
| Also stickied. It's too bad we can't merge this with the 'Library function list' thread. |
|
| Back to top |
|
 |
Vampire
Joined: 12 Apr 2005 Posts: 138
|
Posted: Thu May 19, 2005 9:21 pm Post subject: |
|
|
| TyRaNiD wrote: | | I cannot as of yet work out how to create new files on the memstick, almost seems like it is locked unless you call something to unlock it. This means you cannot create new files although you can create an empty one from the PC and then open and truncate and then write to it. Very strange. This affects the mkdir/rmdir/rename etc as well. |
sceIoMkdir(dir, 0777);
sceIoOpen(path,O_CREAT|O_WRONLY|O_TRUNC, 0777) |
|
| Back to top |
|
 |
loser
Joined: 07 Feb 2005 Posts: 25
|
Posted: Fri May 20, 2005 12:11 am Post subject: |
|
|
sceIoOpen("ms0:/myfile.txt", O_CREAT|O_RDWR|O_TRUNC, 0777)
works fine for me |
|
| Back to top |
|
 |
Arwin
Joined: 12 Jul 2005 Posts: 426
|
Posted: Fri Jul 15, 2005 1:13 am Post subject: |
|
|
| Wouldn't it be better to just unsticky this and the other function thread now that we have http://svn.pspdev.org ? |
|
| Back to top |
|
 |
|