 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
roby65
Joined: 01 Jun 2008 Posts: 55 Location: Mid Italy
|
Posted: Fri Jan 08, 2010 6:31 pm Post subject: Connection to AP, nothing happens |
|
|
Hi guys, i'm making a little HB to test my lib.
I want to:
connect to AP->Send a POST to a site->Write answer from site->Quit
This is the main (i'm omitting all the pspsdk includes):
| Code: |
#include "common.h"
PSP_MODULE_INFO("Platform_test", 0, 0, 71);
int main()
{
Plaform_Core_Setup_Callbacks();
pspDebugScreenInit();
pspDebugScreenClear();
char out[1001];
printf("Connecting to AP...\n");
Platform_Core_Connect_To_Apctl(0);
printf("Sending post...\n");
Platform_Common_SendPOST("www.codeforfun.it","prova.php","user=roby65","a=a",out);
printf("Result:%s\n",out);
sceKernelDelayThread(5*1000*1000);
}
|
Okay, this code enables the home button but nothing appears on the screen, like if it loops before writing "Connecting to AP..." but i can't seem to find the reason.
This is for the callbacks:
| Code: |
int Plaform_Core_Exit_Callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
int Plaform_Core_Callback_Thread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", Plaform_Core_Exit_Callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int Plaform_Core_Setup_Callbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", Plaform_Core_Callback_Thread, 0x11, 0xFA0, 0, 0);
if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
return thid;
}
|
Can someone tell me why of this problem?
ps: when i press home and i try to quit the game, the psp crashes. |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Fri Jan 08, 2010 9:19 pm Post subject: |
|
|
Hi,
in your main function there seem to be no main loop running until the home button was pressed.
The last statement before exiting should be:
| Code: | | sceKernelExitGame(); |
the main loop should look like:
| Code: | while(running()){
//do all your stuff here
mainthread();
} |
Regards |
|
| Back to top |
|
 |
roby65
Joined: 01 Jun 2008 Posts: 55 Location: Mid Italy
|
Posted: Fri Jan 08, 2010 9:40 pm Post subject: |
|
|
| anmabagima wrote: | Hi,
in your main function there seem to be no main loop running until the home button was pressed.
The last statement before exiting should be:
| Code: | | sceKernelExitGame(); |
the main loop should look like:
| Code: | while(running()){
//do all your stuff here
mainthread();
} |
Regards |
I don't want to make a loop, it should just execute until the end and then quit.
But as i see on the screen, nothing happens, and nothing appears on the screen... |
|
| Back to top |
|
 |
anmabagima
Joined: 01 Oct 2009 Posts: 96
|
Posted: Fri Jan 08, 2010 10:27 pm Post subject: |
|
|
Hi,
quite interesting - what would be the purpose of such code ?
However, if this is the case you would not need any callback setup i guess, but you need to call the exit method at the end of your code, which will end your homebrew as needed.
regarding the text on your screen:
Have you mapped the function "printf" to "pspDebugScreenPrintf"?
You need the later one to print text to the screen ..
I don't know if this makes any difference, but my "main" function looks like this:
int main(int argc, char* argv[])
Regards |
|
| Back to top |
|
 |
roby65
Joined: 01 Jun 2008 Posts: 55 Location: Mid Italy
|
Posted: Fri Jan 08, 2010 10:35 pm Post subject: |
|
|
| anmabagima wrote: | Hi,
quite interesting - what would be the purpose of such code ?
However, if this is the case you would not need any callback setup i guess, but you need to call the exit method at the end of your code, which will end your homebrew as needed.
|
Sending an HTML POST to a webpage :)
| anmabagima wrote: | regarding the text on your screen:
Have you mapped the function "printf" to "pspDebugScreenPrintf"?
You need the later one to print text to the screen ...
Regards |
Oh god, i was using printf.....
| Code: | | #define printf pspDebugScreenPrintf |
Now i can see debug, but it doesn't connect to the AP :(
What i want to do is show the connections list, maybe am i using the wrong function to do that?
edit:
i forgot this:
| Code: |
if(pspSdkLoadInetModules() < 0)
{
printf("Error, could not load inet modules\n");
sceKernelSleepThread();
}
pspSdkInetInit();
|
Now it gives me error 8002013c :( why?
Last edited by roby65 on Fri Jan 08, 2010 11:04 pm; edited 1 time in total |
|
| Back to top |
|
 |
Draan
Joined: 17 Oct 2009 Posts: 55
|
Posted: Fri Jan 08, 2010 11:00 pm Post subject: |
|
|
This can be silly but...
have you initialised all funny inet modules? |
|
| Back to top |
|
 |
roby65
Joined: 01 Jun 2008 Posts: 55 Location: Mid Italy
|
Posted: Fri Jan 08, 2010 11:05 pm Post subject: |
|
|
| Draan wrote: | This can be silly but...
have you initialised all funny inet modules? |
Lol my error, i edited the previous post, can you tell me why now it gives me this error? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|