Wlan won't initialize under psplink ?

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Wlan won't initialize under psplink ?

Post by bkc »

Hi.

I'm having a (pretty huge) problem with my MMORPG that I'm working on...
When I start it from vsh(xmb) it initializes wlan and connects without any problem. But now I use PSPLink (PSPHost v2.0, usb-shell) to make development go faster, and when I try to initialize wlan it says that it cant be initialized. At first I thought that it was psplink that already had initilized wlan so I tried commenting out the init-part, but then it crashed on sceNetApctlConnect instead, so obviously its not initializing wlan through psplink... and now I have no idea how to make wlan initialize under psplink...

I have cfw5.00m33-3 with 1.50 kernel addon (if thats any help)...
And I'm coding in C++ (don't think it has any difference but...)

I'd be really happy if someone could tell me if there is any bug in psplink itself or if im doing anything wrong...

wlan.cpp

Code: Select all

int wlanConnectAP(int config = 1) {
	Globals* global = new Globals;
	global->iWlanHasControl = 1;

	int err = 0;
	int stateLast = -1;
	int wlanswitch = 0;

	wlanswitch = sceWlanGetSwitchState();
	if(!wlanswitch) {
		global->iWlanHasControl = 0;
		return 5;	// WLan Switch not Turned On...
	}

	if(iInitialized == 0) {
		err = wlanInit();
		if(!err) iInitialized = 1;
		if(err) {
			global->iWlanHasControl = 0;
			return 1;		//  Couldn't Initialize Wlan...
		}
	}

	err = sceNetApctlConnect(config);
	if(err) {
		global->iWlanHasControl = 0;
		return 2;		//  Network Error...
	}
	char temp[200];
	sprintf(temp, "splash.png");
	imgSplash = loadImage(temp);
	clearScreen(cBlack);
	flipScreen();
	blitImageToScreen(0, 0, 480, 272, imgSplash, 0, 0);
	printTextScreen(25, 95, "Connecting To AccessPoint:", cGreen);
	fillScreenRect(cGrey, 25, 105, 295, 15);
	flipScreen();
	while(1) {
		int state;
		err = sceNetApctlGetState(&state);
		if(err) {
			global->iWlanHasControl = 0;
			return 3;
		}
		if(state > stateLast) {
			fillScreenRect(cBlue, 27, 107, ((290 / 4) * state), 11);
			flipScreen();
			stateLast = state;
		}
		if(state == 4) break;				//  Connected
		if(stateLast > state) {
			global->iWlanHasControl = 0;
			return 4;		//  Error
		}
		delayMS(200);						//	200 mS (5 Updates / Second)
	}
	fillScreenRect(cBlue, 27, 107, 291, 11);
	printTextScreen(25, 122, "Connected To AccessPoint", cGreen);
	flipScreen();
	delayMS(500);	//	Wait for .5 Seconds

	wlanConnected = 1;

	global->iWlanHasControl = 0;
	delete global;
	return 0;
}

int wlanInit() {
    int result;

	result = sceNetInit(128*1024, 42, 4*1024, 42, 4*1024);
	if&#40;result < 0&#41; return result;

	result = sceNetInetInit&#40;&#41;;
	if&#40;result < 0&#41; return result;

	result = sceNetApctlInit&#40;0x8000, 48&#41;;
	if&#40;result < 0&#41; return result;

	result = sceNetResolverInit&#40;&#41;;
	if&#40;result < 0&#41; return result;

	return 0;
&#125;
(Btw, Sry for my bad english. My main language is Swedish...)

Edit: And yes... I have search the forum for anything I can come to think of... :rolleyes:
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
_.-noel-._
Posts: 49
Joined: Mon Aug 13, 2007 12:57 am

Post by _.-noel-._ »

hm... which kernel runs psplink ?

if had the same problem...

i always get an exception, then i tryed with psplink OE and it worked ;)


(sry for my bad english...)
Sry for my english
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

Well... because I'm using psplink 2.0... it has to be 1.50... I'm using 5.00m33-5 with 1.50 addon... and psplink OE won't work with usb... maybe I should buy a psp-remote and make a serial-cable instead :rolleyes: ...
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
_.-noel-._
Posts: 49
Joined: Mon Aug 13, 2007 12:57 am

Post by _.-noel-._ »

hm..

you can copy the files to PSP ;)
Sry for my english
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

Yeah... But then the development time increases because I have to restart and transfer the new version of the program again and then start it again... instead of writing "reset", "ld *******.elf" in putty :-D
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I always had problems with psplink so usually I add the possibility to activate usb by pressing a button or by checking if the cable is plugged in.

Then I also add the ability to restart the application by pressing a button.
Image
Upgrade your PSP
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

There is nothing wrong with the USB :rolleyes: and pressing R acctually resets psplink :-)

The problem I'm having is that PSPLink wont let my homebrew initialize WLAN... :-)
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

I think you didn't understand.

I said I always had problems when using psplink so instead of using and to take less time than usual testing my programs I do this:
I add the possibility to activate usb by pressing a button or by checking if the cable is plugged in.

Then I also add the ability to restart the application by pressing a button.
Image
Upgrade your PSP
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

Oooh, I C... but does that work under usermode in 5.00m33-3 ? I thought that one would need kernelmode for that ?
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Pirata Nervo
Posts: 409
Joined: Tue Oct 09, 2007 4:22 am

Post by Pirata Nervo »

USB is user mode and launching executables too as long as you use the correct functions
Image
Upgrade your PSP
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

Ok... thanks :-) I'll look in to that... I was about to make my own SIO-debugging lib anyways :-)
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Cpasjuste
Posts: 214
Joined: Sun May 29, 2005 8:28 am

Post by Cpasjuste »

Hi,
I do not understand why you are running psplink 2.0, are you developping you homebrew for 1.50 kernel ?

I never add problem's with psplink 3.0 under 3xx + kernels.
User avatar
bkc
Posts: 19
Joined: Tue May 20, 2008 8:45 pm
Location: Sweden
Contact:

Post by bkc »

I'm devin for 3.xx+ (my psp has 5.00m33-3). And for some reason I can't get PSPLink 3.0 OE to work with USB-Shell (Controlling the PSP over usb-cable... sense I'm using the wlan for my game :-) ) I don't know what I'm doing wrong, it just won't work :-(

(I have Windows XP Professional SP2 and MinPSPW (Minimalistic PSPsdk for Windows)
I only speak these languages:
  • C / C + +
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Post Reply