forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wlan won't initialize under psplink ?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Sat Nov 01, 2008 6:42 am    Post subject: Wlan won't initialize under psplink ? Reply with quote

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:

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;
}


(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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
_.-noel-._



Joined: 13 Aug 2007
Posts: 49

PostPosted: Tue Nov 04, 2008 12:35 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 4:57 am    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
_.-noel-._



Joined: 13 Aug 2007
Posts: 49

PostPosted: Tue Nov 04, 2008 5:08 am    Post subject: Reply with quote

hm..

you can copy the files to PSP ;)
_________________
Sry for my english
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 5:13 am    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Tue Nov 04, 2008 5:50 am    Post subject: Reply with quote

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.
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 5:59 am    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Tue Nov 04, 2008 6:55 am    Post subject: Reply with quote

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.
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 5:08 pm    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Tue Nov 04, 2008 6:28 pm    Post subject: Reply with quote

USB is user mode and launching executables too as long as you use the correct functions
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 6:30 pm    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Cpasjuste



Joined: 29 May 2005
Posts: 214

PostPosted: Tue Nov 04, 2008 7:44 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
bkc



Joined: 20 May 2008
Posts: 20
Location: Sweden

PostPosted: Tue Nov 04, 2008 8:11 pm    Post subject: Reply with quote

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 + +
  • ASM
  • Python
  • (x)HTML
  • PHP
  • CSS
  • SQL
  • JavaScript
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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