Sircs on 5.XX
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
Sircs on 5.XX
Hi,
I am trying to get sircs to work on 5.xx.
When I call "sceSircsSend" I get "The game could not be loaded" (or similar).
I have looked into this and it seems that sircs was removed from newer firmwares.
Is there a way I can load it in my program? I noticed the file "f0:\km\sircs.prx". Would I be able to load this?
I have never loaded modules or anything like that so please be nice ;)
Thanks,
Darky
I am trying to get sircs to work on 5.xx.
When I call "sceSircsSend" I get "The game could not be loaded" (or similar).
I have looked into this and it seems that sircs was removed from newer firmwares.
Is there a way I can load it in my program? I noticed the file "f0:\km\sircs.prx". Would I be able to load this?
I have never loaded modules or anything like that so please be nice ;)
Thanks,
Darky
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
Thanks
Thanks for that, I had a feeling that's what I would need to do.
Are you able to push me in the right direction for the actual module loading?
Thanks,
Darky
Are you able to push me in the right direction for the actual module loading?
Thanks,
Darky
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
Question
Hi,
I have added the following code:
When running this code it prints "Success1", so the module seems to be loading ok.
But if I add a call to sceSircsSend() the program fails to load with "The game could not be started. (8002013C).
I am lost (and am probably in a little over my head).
What am I missing?
Thanks,
Darky
I have added the following code:
Code: Select all
SceUID mod = sceKernelLoadModule("ms0:/path/to/module/sircs.prx", 0, NULL);
if (mod >= 0)
{
mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);
if (mod < 0)
{
message = "Fail2";
}
else
{
message = "Success1";
}
}
else
{
message = "Fail1";
}
But if I add a call to sceSircsSend() the program fails to load with "The game could not be started. (8002013C).
I am lost (and am probably in a little over my head).
What am I missing?
Thanks,
Darky
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
SVN
I have it in a SVN repo.
Thanks,
Darky
Code: Select all
svn://www.nicksplace.com.au/Nicksplace/trunk/UniMote
Darky
Re: Question
The NID hasn't changed between 3.50 and 5.00 for the sircs driver so I doubt that is the issue. He should be able to load/start the one in flash.
There is a way to use your own stub and modify the STUB_START params, see moonlight's post here:
http://forums.ps2dev.org/viewtopic.php? ... tart#50787
it's always useful to try your error code in the search engine here.
Basically, remove -lpspsircs from your makefile and add one of these files to your project (depending on kernel/user mode of your app I imagine):
(for user functions, by default it is STUB_START "sceSircs",0x40010011,0x00020005)
mySceSircs.S
(for kernel functions, by default it is STUB_START "sceSircs_driver",0x00010011,0x00040005)
mySceSircs_driver.S
You should be able to get away with using the header from the sdk, but if not you might need to change the function names in the stubs slightly and make your own header file with function prototypes as well.
btw, fyi and whatnot, I got these stub files automatically with prxtool using
prxtool.exe -u sircs.prx
and just hand copied the function names from here.
The other way to do it is to use a pointer to a function instead of calling the function through stubs/header includes from the SDK, and make your own code to find out where that pointer needs to point to for that function after loading the module.
When your program is started by the PSP loadexec it is trying to link to sceSircsSend through the NID stub - but you haven't loaded the sircs module yet as the module isn't in the btcnf for the mode you are loading into, and your program isn't actually running at that initial link point to have hit the loadmodule call, so the result is a library not found/loaded error. When you don't actually call the function in code, the compile process doesn't link the stub into the binary and because of that it's never attempted to link to it at load time so this problem doesn't happen.darksaboteur wrote:When running this code it prints "Success1", so the module seems to be loading ok.
But if I add a call to sceSircsSend() the program fails to load with "The game could not be started. (8002013C).
There is a way to use your own stub and modify the STUB_START params, see moonlight's post here:
http://forums.ps2dev.org/viewtopic.php? ... tart#50787
it's always useful to try your error code in the search engine here.
Basically, remove -lpspsircs from your makefile and add one of these files to your project (depending on kernel/user mode of your app I imagine):
(for user functions, by default it is STUB_START "sceSircs",0x40010011,0x00020005)
mySceSircs.S
Code: Select all
.set noreorder
#include "pspstub.s"
STUB_START "sceSircs",0x40090011,0x00020005
STUB_FUNC 0x71EEF62D,sceSircsSend
STUB_FUNC 0x83381633,sceSircsReceive
STUB_END
mySceSircs_driver.S
Code: Select all
.set noreorder
#include "pspstub.s"
STUB_START "sceSircs_driver",0x00090011,0x00040005
STUB_FUNC 0x19155A2F,sceSircsEnd
STUB_FUNC 0x62411801,sceSircsInit
STUB_FUNC 0x71EEF62D,sceSircsSend
STUB_FUNC 0x83381633,sceSircsReceive
STUB_END
btw, fyi and whatnot, I got these stub files automatically with prxtool using
prxtool.exe -u sircs.prx
and just hand copied the function names from here.
The other way to do it is to use a pointer to a function instead of calling the function through stubs/header includes from the SDK, and make your own code to find out where that pointer needs to point to for that function after loading the module.
Re: Question
It looks like they reintroduced sircs.prx in 3.80. It was removed before that. Remember IRShell needed it to be manually installed?
Something like this but I guess its kernel mode only :/cory1492 wrote:The other way to do it is to use a pointer to a function instead of calling the function through stubs/header includes from the SDK, and make your own code to find out where that pointer needs to point to for that function after loading the module.
Code: Select all
int (* sceSircsSend)(struct sircs_data* sd, int count);
sceSircsSend = (void *)sctrlHENFindFunction("sceSIRCS_IrDA_Driver", "sceSircs_driver", 0x71EEF62D);
//or use libs.h from psplinkusb to find export if you don't want M33 SDK
Re: Question
I rarely touch IRShell, most of what I'd use it to do I can do from the PSP menu or filer. I've been meaning to look at it again though since ir learning ability was added, means it would actually be useful for me.Torch wrote:It looks like they reintroduced sircs.prx in 3.80. It was removed before that. Remember IRShell needed it to be manually installed?
Wonder why they omitted it for a while, and have never really had any official use for the ir port at all... though sony seems to like to do that (add hardware in initial versions they never wind up using, or possibly not even support through developer sdk.)
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
@cory1492
Hi,
Thanks for that, I tried your suggestion but couldn't get it to work (I'm in over my head somewhat)
Heres what I did:
- Created the mySceSircs.S file.
- Included it with #include "mySceSircs.S"
- Removed -lpspsircs from the makefile
I ended up with lots of compile errors.
I have committed the changes to SVN if anyone can check it out (or I can pastebin it if thats easier)
Thanks for all the help :),
Darky
P.S Can give write access to the SVN if it will make helping easier, just PM me
Thanks for that, I tried your suggestion but couldn't get it to work (I'm in over my head somewhat)
Heres what I did:
- Created the mySceSircs.S file.
- Included it with #include "mySceSircs.S"
- Removed -lpspsircs from the makefile
I ended up with lots of compile errors.
I have committed the changes to SVN if anyone can check it out (or I can pastebin it if thats easier)
Thanks for all the help :),
Darky
P.S Can give write access to the SVN if it will make helping easier, just PM me
I don't recall saying you had to mess with the includes? I gave pretty specific instructions, at any rate.
-create stub file
-remove -lpspsircs from makefile (so it doesn't use pspsdk pre made stubs)
.S files are not headers, they are stubs (technically it is assembly macros) - you don't include them anywhere in your C code, you just need function prototypes to call those stubs (which the original pspsircs.h should handle fine) which are later resolved to function addresses by the NID and PSP's loadcore.
-create stub file
-remove -lpspsircs from makefile (so it doesn't use pspsdk pre made stubs)
.S files are not headers, they are stubs (technically it is assembly macros) - you don't include them anywhere in your C code, you just need function prototypes to call those stubs (which the original pspsircs.h should handle fine) which are later resolved to function addresses by the NID and PSP's loadcore.
Last edited by cory1492 on Tue Jun 09, 2009 2:39 pm, edited 1 time in total.
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
Ok, sorry about that. I am pretty new to C (and programming in general).
Do I still need "#include <pspsircs.h>"?
Thanks,
Darky
Do I still need "#include <pspsircs.h>"?
Thanks,
Darky
Last edited by darksaboteur on Tue Jun 09, 2009 2:37 pm, edited 1 time in total.
Don't they need to be included in the "objs = main.o stubfile.o" etc in the make file?cory1492 wrote:.S files are not headers, they are stubs - you don't include them anywhere. You just need to make the file and build.mak (which is included already in your makefile) should handle it.
So for mySceSircs.S you should have "objs = ..... mySceSircs.o ..." in your makefile.
If you have a header that declares the functions like "#include <pspsircs.h>" then that is enough.
If you don't have a header then give prototypes for them in your code like this:
int sceSircsSend (struct sircs_data* sd, int count);
Last edited by Torch on Tue Jun 09, 2009 2:45 pm, edited 1 time in total.
torch: Not sure why you are telling him to use a NULL pointer when a standard prototype works just fine and should get resolved by loadcore? And no,
from the makefile should have macros to handle .s and .S files, but it might do things out of order on some platforms (esp. heimdall's win toolchain) that might require building a .a file first instead. I've never had to do it though, it's enough to just have the .S present with the source to get the asm link code.
Code: Select all
include $(PSPSDK)/lib/build.mak
You need the prototypes for the functions and data types for the functions you are going to import from your stub, which are in the pspsircs.h file. By all means include those from the sdk, so long as you remove the pre-built library linking reference from the makefile it should work.darksaboteur wrote:Ok, sorry about that. I am pretty new to C (and programming in general).
Do I still need "#include <pspsircs.h>"?
Last edited by cory1492 on Tue Jun 09, 2009 2:50 pm, edited 2 times in total.
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
lol, you are running into all the problems you can, I guess...
-2147352262 in hex is 0x8002013a, the error being "Library is not linked yet" meaning it hasn't been loaded/started. I see you stripped the module loading code out of your svn...
Try this, add this function above main in main.cpp - as you can see I'm not sure how to get debug messages in your code. Tried it on 5.00m33 slim and didn't see anything unusual, but I'm not sure what I'd need to test it anyway.
and change to this in main function of main.cpp, provided you have sircs.prx in flash0:/kd/ of course
-2147352262 in hex is 0x8002013a, the error being "Library is not linked yet" meaning it hasn't been loaded/started. I see you stripped the module loading code out of your svn...
Try this, add this function above main in main.cpp - as you can see I'm not sure how to get debug messages in your code. Tried it on 5.00m33 slim and didn't see anything unusual, but I'm not sure what I'd need to test it anyway.
Code: Select all
int LoadStartModule(char *path)
{
char result[45];
u32 loadResult;
u32 startResult;
int status;
SceKernelLMOption option;
SceUID mpid = 1;
memset(&option, 0, sizeof(option));
option.size = sizeof(option);
option.mpidtext = mpid;
option.mpiddata = mpid;
option.position = 0;
option.access = 1;
loadResult = sceKernelLoadModule(path, 0, &option);
if (loadResult & 0x80000000)
{
sprintf(result, "load error: 0x%08x", loadResult);
message = result;
return -1;
}
else
startResult = sceKernelStartModule(loadResult, 0, NULL, &status, NULL);
if (startResult & 0x80000000)
{
sprintf(result, "start error: 0x%08x", startResult);
message = result;
return -2;
}
return 0;
}
Code: Select all
sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);
sceUtilityLoadNetModule(PSP_NET_MODULE_INET);
LoadStartModule("flash0:/kd/sircs.prx");
netInit();
- darksaboteur
- Posts: 18
- Joined: Tue Dec 11, 2007 8:44 pm
- Location: Australia
- Contact:
YAY :D
Hi,
First off I'd like to thank you both for you help and say thank you for all your help :).
It works!
I plan to put together a sample of how to use sircs on 5.XX for other noobs like me ;)
No one happens to know some sircs codes for a Sony Receiver.....
Thanks again,
Darky
First off I'd like to thank you both for you help and say thank you for all your help :).
It works!
I plan to put together a sample of how to use sircs on 5.XX for other noobs like me ;)
No one happens to know some sircs codes for a Sony Receiver.....
Thanks again,
Darky