Connection to AP, nothing happens

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

Moderators: cheriff, TyRaNiD

Post Reply
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Connection to AP, nothing happens

Post by roby65 »

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: Select all

#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: Select all

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.
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

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: Select all

sceKernelExitGame(); 
the main loop should look like:

Code: Select all

while(running()){
		//do all your stuff here
		mainthread();
	}
Regards
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Post by roby65 »

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: Select all

sceKernelExitGame(); 
the main loop should look like:

Code: Select all

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...
anmabagima
Posts: 87
Joined: Thu Oct 01, 2009 8:43 pm

Post by anmabagima »

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
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Post by roby65 »

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: Select all

#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: Select all

	if&#40;pspSdkLoadInetModules&#40;&#41; < 0&#41;
	&#123;
		printf&#40;"Error, could not load inet modules\n"&#41;;
		sceKernelSleepThread&#40;&#41;;
	&#125;
	pspSdkInetInit&#40;&#41;;
Now it gives me error 8002013c :( why?
Last edited by roby65 on Fri Jan 08, 2010 11:04 pm, edited 1 time in total.
Draan
Posts: 48
Joined: Sat Oct 17, 2009 3:39 am

Post by Draan »

This can be silly but...
have you initialised all funny inet modules?
roby65
Posts: 52
Joined: Sun Jun 01, 2008 9:12 pm
Location: Mid Italy
Contact:

Post by roby65 »

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?
Post Reply