PSP Hacks - Forums
Go Back   PSP Hacks - Forums > PSP Community > PSP Programming & Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2008, 06:43 PM
Dariusc123456 Dariusc123456 is offline
PSP Hacks Member
 
Join Date: Jun 2008
Posts: 218
Dariusc123456 User Has a Beginner Reputation
Default

Hi everyone. I need help with using wireless commands and Adhoc commands. when I do it, it dont work, nor will the wlan led come on. Can someone lead me to a site or tell me how to operate those commands so I can use it in my program. I program in C.
__________________
Have you ever want to use your computer away from your home? Do you wish you can have your desktop/laptop at the palm of your hand.

Comming soon within 2008, homebrew program call \"NetPlay\" which will allow you to use your computer where ever you go. Ether through Adhoc or Wifi, it can be done. All you need is a router, for wifi, or a wifi card/adapter for adhoc. Goto http://www.psp-hacks.com/forums/viewtopic.php?id=146907 and learn more.

Reply With Quote
  #2  
Old 06-28-2008, 07:05 PM
pirata nervo pirata nervo is offline
Programmer
PSP Titan
 
Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 4,887
pirata nervo User Has a Beginner Reputation
Default

maybe post your code?
__________________

Upgrade your PSP Slim or FAT now!
NervOS Official Forum

Reply With Quote
  #3  
Old 06-28-2008, 08:42 PM
Dariusc123456 Dariusc123456 is offline
PSP Hacks Member
 
Join Date: Jun 2008
Posts: 218
Dariusc123456 User Has a Beginner Reputation
Default

Im not ready to post my code, but I can post the parts of the code.
__________________
Have you ever want to use your computer away from your home? Do you wish you can have your desktop/laptop at the palm of your hand.

Comming soon within 2008, homebrew program call \"NetPlay\" which will allow you to use your computer where ever you go. Ether through Adhoc or Wifi, it can be done. All you need is a router, for wifi, or a wifi card/adapter for adhoc. Goto http://www.psp-hacks.com/forums/viewtopic.php?id=146907 and learn more.

Reply With Quote
  #4  
Old 06-28-2008, 10:55 PM
Blade_punk's Avatar
Blade_punk Blade_punk is offline
Moderator
PSP Monk
 
Join Date: Nov 2006
Location: Candy Mountain
Posts: 2,525
Blade_punk User Has a Beginner Reputation
Default

Well then...?

Reply With Quote
  #5  
Old 06-28-2008, 11:33 PM
Dariusc123456 Dariusc123456 is offline
PSP Hacks Member
 
Join Date: Jun 2008
Posts: 218
Dariusc123456 User Has a Beginner Reputation
Default

Here is what code i use then. This wont be the full coding of my program.

Code:
if (pad.Buttons != 0){
                    if (pad.Buttons & PSP_CTRL_CROSS){
                           pspDebugScreenPrintf("Activating Wlan Mode");
				
                            int sceWlanDevIsPowerOn();
                      		 
			
				
				             }
                           }	
                         }
                     if (pad.Buttons & PSP_CTRL_CIRCLE){
                      pspDebugScreenPrintf("Activating Adhoc Mode.");
                      
		       if(sceNetAdhocInit()	< 0){
                         pspDebugScreenPrintf("ERR on ADHOC");                     
			}  
		              //retVal = sceWlanGetEtherAddr(sVal);
                          // int sceNetAdhocPdpCreate(retVal, 0x309, 0x400, 0);                      
                      }
 
    sceKernelExitGame();
 }
I remove some codes parts from so that it can just be that part. I use the including files of

Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pspwlan.h>
#include <pspnet_apctl.h>
#include <psppower.h>
#include <arpa/inet.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <psputility_netparam.h>
#include <pspnet_adhoc.h>
#include <pspnet_adhocctl.h>
#include <pspnet_adhocmatching.h>
#include <pspnet.h>
I know thats its too much included files, but those are some or the parts ill be using within my homebrew program.

Can someone please help me with the wlan connection, or the adhoc connection?
__________________
Have you ever want to use your computer away from your home? Do you wish you can have your desktop/laptop at the palm of your hand.

Comming soon within 2008, homebrew program call \"NetPlay\" which will allow you to use your computer where ever you go. Ether through Adhoc or Wifi, it can be done. All you need is a router, for wifi, or a wifi card/adapter for adhoc. Goto http://www.psp-hacks.com/forums/viewtopic.php?id=146907 and learn more.

Reply With Quote
  #6  
Old 06-29-2008, 04:24 AM
pirata nervo pirata nervo is offline
Programmer
PSP Titan
 
Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 4,887
pirata nervo User Has a Beginner Reputation
Default

Ok, start with this:
In case you don't know, prx from kd folder are libraries and you need to link them to use the adhoc or infrastructure.

Use the code below to link the libraries as you can't load them directly with a load module function as it requires kernel mode.

Code:
int utility = 0;
utility = sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);

if (utility < 0)
{
	printf("Error loading PSP_NET_MODULE_COMMON 0x%08X", utility);
}

utility = sceUtilityLoadNetModule(PSP_NET_MODULE_ADHOC);
if (utility < 0)
{
	printf("Error loading PSP_NET_MODULE_ADHOC 0x%08X", utility);
}
then use:
Code:
sceNetInit(0x20000, 0x20, 0x1000, 0x20, 0x1000);
to initialize the "Net"

then initialize the adhoc:
Code:
sceNetAdhocInit();
this is the init part.
I ported a 1.50 adhoc sample from psp-programming.com to 3.xx version (should work on 4.0.1 m33 too, I haven't tried it yet)
__________________

Upgrade your PSP Slim or FAT now!
NervOS Official Forum

Reply With Quote
  #7  
Old 06-29-2008, 04:34 AM
Blade_punk's Avatar
Blade_punk Blade_punk is offline
Moderator
PSP Monk
 
Join Date: Nov 2006
Location: Candy Mountain
Posts: 2,525
Blade_punk User Has a Beginner Reputation
Default

Have you even put that 3.xx ported code into anything or did you just get bored one day and decide to get it working on the new kernel :P

Reply With Quote
  #8  
Old 06-29-2008, 05:41 AM
pirata nervo pirata nervo is offline
Programmer
PSP Titan
 
Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 4,887
pirata nervo User Has a Beginner Reputation
Default

I decied to get it working on the new kernel xD
But I need it for my adhoc file transfer for NervOS.
Haven't worked on it for a while, I have added/fixed a total of 60 things (mostly new features and 3 beta versions left until the 2.1 release)
I always forget about it.
Maybe on 2.0.9 beta I will work on it as I have done almost everything that can be done
__________________

Upgrade your PSP Slim or FAT now!
NervOS Official Forum

Reply With Quote
  #9  
Old 06-29-2008, 07:39 PM
Dariusc123456 Dariusc123456 is offline
PSP Hacks Member
 
Join Date: Jun 2008
Posts: 218
Dariusc123456 User Has a Beginner Reputation
Default

Here is the message I get when I try to compile that.

Code:
psp-gcc -I. -IC:/pspdev/psp/sdk/include -O2 -G0 -Wall   -c -o main.o main.c
main.c(24) : warning: type defaults to 'int' in declaration of 'utility'
main.c(24) : error: redefinition of 'utility'
main.c(23) : error: previous definition of 'utility' was here
main.c(24) : warning: implicit declaration of function 'sceUtilityLoadNetModule'

main.c(24) : error: 'PSP_NET_MODULE_ADHOC' undeclared here (not in a function)
main.c(24) : error: initializer element is not constant
main.c(24) : warning: data definition has no type or storage class
main.c(25) : error: syntax error before 'if'
main.c: In function 'main_thread':
main.c(34) : error: 'Return' undeclared (first use in this function)
main.c(34) : error: (Each undeclared identifier is reported only once
main.c(34) : error: for each function it appears in.)
main.c(34) : error: syntax error before numeric constant
make: *** [main.o] Error 1
I try to make a prx with this so the code I use was

Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <pspwlan.h>
#include <pspnet_apctl.h>
#include <psppower.h>
#include <arpa/inet.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <psputility_netparam.h>
#include <pspnet_adhoc.h>
#include <pspnet_adhocctl.h>
#include <pspnet_adhocmatching.h>
#include <pspnet.h>

PSP_MODULE_INFO("ADHOC_CONNECT", 0x0800, 0, 1);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_KB(1000);

int utility = 0;
utility = sceUtilityLoadNetModule(PSP_NET_MODULE_ADHOC);
if (utility < 0)
{
    printf("Error loading PSP_NET_MODULE_ADHOC 0x%08X", utility);
}

int main_thread(SceSize args, void *argp)
{

	sceNetAdhocInit();
Return 0;
}

int module_start(SceSize args, void *argp) {

    int thid;

    
    thid = sceKernelCreateThread("my prx", main_thread, 0x18, 0x0800, 0, NULL);
    if(thid >= 0) sceKernelStartThread(thid, args, argp);

    return 0;
}
Is there a problem or was there something I did wrong?
__________________
Have you ever want to use your computer away from your home? Do you wish you can have your desktop/laptop at the palm of your hand.

Comming soon within 2008, homebrew program call \"NetPlay\" which will allow you to use your computer where ever you go. Ether through Adhoc or Wifi, it can be done. All you need is a router, for wifi, or a wifi card/adapter for adhoc. Goto http://www.psp-hacks.com/forums/viewtopic.php?id=146907 and learn more.

Reply With Quote
  #10  
Old 06-29-2008, 07:44 PM
pirata nervo pirata nervo is offline
Programmer
PSP Titan
 
Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 4,887
pirata nervo User Has a Beginner Reputation
Default

Add this to your includes:
Code:
#include <pspnet.h>

#include <pspnet_adhoc.h>

#include <pspnet_adhocctl.h>

#include <pspnet_adhocmatching.h>

#include <pspnet_apctl.h>

#include <psputility.h>

#include <psputility_netmodules.h>

#include <pspwlan.h>
Add this to your LIBS in your makefile:
-lpspnet_adhocmatching -lpspnet_adhocctl -lpspnet_adhoc -lpsputility -lpspwlan
__________________

Upgrade your PSP Slim or FAT now!
NervOS Official Forum

Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 10:15 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©