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(result < 0) return result;
result = sceNetInetInit();
if(result < 0) return result;
result = sceNetApctlInit(0x8000, 48);
if(result < 0) return result;
result = sceNetResolverInit();
if(result < 0) return result;
return 0;
}
Edit: And yes... I have search the forum for anything I can come to think of... :rolleyes: