using ADHOC
-
- Posts: 30
- Joined: Sat Apr 05, 2008 5:53 am
- Location: Germany -> Hessen -> Hanau
- Contact:
using ADHOC
Hi guys,
I need your help. I' m planing a new projetc needing ADHOC, the problem is, that I don' t know, how to use ADHOC. Kann someone post me a link to a Tut?? I want to know, how to build the connection, how to use it, mainly all. I now something about the C Programming but I' m not a pro, so give me the longest one you know xD
Great Whiches, Floorball92
I need your help. I' m planing a new projetc needing ADHOC, the problem is, that I don' t know, how to use ADHOC. Kann someone post me a link to a Tut?? I want to know, how to build the connection, how to use it, mainly all. I now something about the C Programming but I' m not a pro, so give me the longest one you know xD
Great Whiches, Floorball92
-
- Posts: 30
- Joined: Sat Apr 05, 2008 5:53 am
- Location: Germany -> Hessen -> Hanau
- Contact:
it means you miss the basic PSP headers, that's why you can't compile.main.cpp:20:23: error: pspkernel.h: No such file or directory
main.cpp:21:22: error: pspdebug.h: No such file or directory
main.cpp:22:21: error: pspctrl.h: No such file or directory
main.cpp:23:20: error: pspsdk.h: No such file or directory
main.cpp:24:24: error: pspdisplay.h: No such file or directory
pb of path or sdk installation.[/quote]
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
Pirata Nervo
if you read the whole post (2 lines without the quote) you will have seen that i wrote :
/cygwin/usr/local/pspdev/include
cf:
/cygwin/usr/local/pspdev/psp/sdk/include
which is certainly comming from the PSPSDK environment variable in the makefile.
solution : modify your makefile
I am sorry you gave up for something probably that simple.
floorball92:
I don't know if you are familliar with make/makefile/psp-g++, if you are not, there is a command which is very usefull: man
in a shell do man psp-g++ or man gcc (should be the same options) and man make. You will have a better comprehension of these tools options, and the basics to be able to compile.
if you read the whole post (2 lines without the quote) you will have seen that i wrote :
which is the case if floorball92's install is the same as mine, the headers or not under:...pb of path ...
/cygwin/usr/local/pspdev/include
cf:
but under:psp-g++ -I. -IE:/cygwin/usr/local/pspdev/include
/cygwin/usr/local/pspdev/psp/sdk/include
which is certainly comming from the PSPSDK environment variable in the makefile.
solution : modify your makefile
I am sorry you gave up for something probably that simple.
floorball92:
I don't know if you are familliar with make/makefile/psp-g++, if you are not, there is a command which is very usefull: man
in a shell do man psp-g++ or man gcc (should be the same options) and man make. You will have a better comprehension of these tools options, and the basics to be able to compile.
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
pb means : problem
-L is the gcc option for setting the path to librairies when linking
and the problem is a problem of path to headers (as the log shows it) when gcc is compiling.
The gcc option for setting the path to headers is -I
so you should have something like -IthePathToYourHeaders in your compile options of your makefile. you can set the path you want, even several -I.
It's often in a variable called INCDIR.
you should do a "man gcc " everything is explained even if not always easy to read
-L is the gcc option for setting the path to librairies when linking
and the problem is a problem of path to headers (as the log shows it) when gcc is compiling.
The gcc option for setting the path to headers is -I
so you should have something like -IthePathToYourHeaders in your compile options of your makefile. you can set the path you want, even several -I.
It's often in a variable called INCDIR.
you should do a "man gcc " everything is explained even if not always easy to read
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
I got it to work before by removing a few lines and replacing some.
This is what I get:
the errors appear where you do something like (char *)variable
Edit:
I changed the char* to unsigned char* and the only errors I get now are:
Edit2:
Changed this line:
void matchingCB(int unk1, int event, char *macSource, int size, char *data)
to:
void matchingCB(int unk1, int event, unsigned char *macSource, int size, void *data)
fixes the problem.
Now I got this error:
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/bin/ld: cannot find -lpspnet_adhocmatching
I edited the LIBS in the makefile and I was getting this error:
cp eboot.pbp F:/PSP/GAME/test
cp: cannot stat `eboot.pbp': No such file or directory
removed the copy file part and the debug and compiled everything right.
Tested and run fine although something are not working like when I press [], it crashes if I press /\ on my other psp
This is what I get:
Code: Select all
ZBadhoc.cpp: In member function ‘int ZBadhoc::requestConnection(ZBremotePsp*)’:
ZBadhoc.cpp:351: error: invalid conversion from ‘char*’ to ‘unsigned char*’
ZBadhoc.cpp:351: error: initializing argument 2 of ‘int sceNetAdhocMatchingSelectTarget(int, unsigned char*, int, int)’
ZBadhoc.cpp: In member function ‘void ZBadhoc::createMatching()’:
ZBadhoc.cpp:699: error: invalid conversion from ‘void (*)(int, int, char*, int, char*)’ to ‘void (*)(int, int, unsigned char*, int, void*)’
ZBadhoc.cpp:699: error: initializing argument 9 of ‘int sceNetAdhocMatchingCreate(int, int, int, int, int, int, int, int, void (*)(int, int, unsigned char*, int, void*))’
ZBadhoc.cpp: In member function ‘ZBremotePsp* ZBadhoc::waitForConnection()’:
ZBadhoc.cpp:1002: error: invalid conversion from ‘char*’ to ‘unsigned char*’
ZBadhoc.cpp:1002: error: initializing argument 2 of ‘int sceNetAdhocMatchingCancelTarget(int, unsigned char*)’
ZBadhoc.cpp:1010: error: invalid conversion from ‘char*’ to ‘unsigned char*’
ZBadhoc.cpp:1010: error: initializing argument 2 of ‘int sceNetAdhocMatchingSelectTarget(int, unsigned char*, int, int)’
make: *** [ZBadhoc.o] Error 1
Edit:
I changed the char* to unsigned char* and the only errors I get now are:
Code: Select all
ZBadhoc.cpp: In member function ‘void ZBadhoc::createMatching()’:
ZBadhoc.cpp:699: error: invalid conversion from ‘void (*)(int, int, char*, int, char*)’ to ‘void (*)(int, int, unsigned char*, int, void*)’
ZBadhoc.cpp:699: error: initializing argument 9 of ‘int sceNetAdhocMatchingCreate(int, int, int, int, int, int, int, int, void (*)(int, int, unsigned char*, int, void*))’
make: *** [ZBadhoc.o] Error 1
Changed this line:
void matchingCB(int unk1, int event, char *macSource, int size, char *data)
to:
void matchingCB(int unk1, int event, unsigned char *macSource, int size, void *data)
fixes the problem.
Now I got this error:
/usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/bin/ld: cannot find -lpspnet_adhocmatching
I edited the LIBS in the makefile and I was getting this error:
cp eboot.pbp F:/PSP/GAME/test
cp: cannot stat `eboot.pbp': No such file or directory
removed the copy file part and the debug and compiled everything right.
Tested and run fine although something are not working like when I press [], it crashes if I press /\ on my other psp
That's strange you had to change the char * to unsigned char *
could you have a look at pspnet_adhocmatching.h
about line 110 do you have for sceNetAdhocMatchingSelectTarget :
int sceNetAdhocMatchingSelectTarget(int matchingId, char *mac, int unk3, int unk4);
and line 47 for MatchingCallback :
typedef void (*MatchingCallback)(int unk1, int event, char *mac2, int optLen, char *optData);
It looks like we don't have the same header may be one of us has a more recent version.
concerning the crash, I ve just re-run the sample, I ve no problem. could you see where it crashs?
could you have a look at pspnet_adhocmatching.h
about line 110 do you have for sceNetAdhocMatchingSelectTarget :
int sceNetAdhocMatchingSelectTarget(int matchingId, char *mac, int unk3, int unk4);
and line 47 for MatchingCallback :
typedef void (*MatchingCallback)(int unk1, int event, char *mac2, int optLen, char *optData);
It looks like we don't have the same header may be one of us has a more recent version.
concerning the crash, I ve just re-run the sample, I ve no problem. could you see where it crashs?
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
I updated the sdk 3 or 4 weeks ago.
pspnet_adhocmatching.h
$Id: pspnet_adhocmatching.h 2356 2008-01-15 23:50:17Z iwn $
int sceNetAdhocMatchingSelectTarget(int matchingId, unsigned char *mac, int unk3, int unk4);
MatchingCallBack:
typedef void (*MatchingCallback)(int unk1, int event, unsigned char *mac2, int optLen, void *optData);
What's your revicion number?
Edit: Im updating the sdk in case you have a more recent version
Edit 2: The functions are the same as the ones I said above so you need to rewrite your source (because it is crashing) or I need to edit my file lol.
Edit 3 (wow): I edited my pspnet_adhocmatching.h so it is the same as yours but still shuts down when sending/receiving..
pspnet_adhocmatching.h
$Id: pspnet_adhocmatching.h 2356 2008-01-15 23:50:17Z iwn $
int sceNetAdhocMatchingSelectTarget(int matchingId, unsigned char *mac, int unk3, int unk4);
MatchingCallBack:
typedef void (*MatchingCallback)(int unk1, int event, unsigned char *mac2, int optLen, void *optData);
What's your revicion number?
Edit: Im updating the sdk in case you have a more recent version
Edit 2: The functions are the same as the ones I said above so you need to rewrite your source (because it is crashing) or I need to edit my file lol.
Edit 3 (wow): I edited my pspnet_adhocmatching.h so it is the same as yours but still shuts down when sending/receiving..
Last edited by Pirata Nervo on Mon Apr 21, 2008 8:55 am, edited 1 time in total.
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
-
- Posts: 30
- Joined: Sat Apr 05, 2008 5:53 am
- Location: Germany -> Hessen -> Hanau
- Contact:
I changed the path and get this:
Code: Select all
**** Build of configuration Default for project adhoc ****
make all
make: *** No rule to make target `all'. Stop.
floorball92
just do "make" not "make all"
or add the target "all" in the makefile.
---------------------
Pirata Nervo,
I updated my sdk. the signature of some functions have changed from char * to unsigned char *. But nothing very important.
You just have to remove the casts (as the macAdresse is already an u8).
And adapt the signature of the matching callback.
You recompile and it works : if it still doesn't work, try the this eboot
if this eboot is working => you may have changed too many thing in the sample
if not ....what is your firmware? can you do game sharing with games such lumines ?
just do "make" not "make all"
or add the target "all" in the makefile.
---------------------
Pirata Nervo,
I updated my sdk. the signature of some functions have changed from char * to unsigned char *. But nothing very important.
You just have to remove the casts (as the macAdresse is already an u8).
And adapt the signature of the matching callback.
You recompile and it works : if it still doesn't work, try the this eboot
if this eboot is working => you may have changed too many thing in the sample
if not ....what is your firmware? can you do game sharing with games such lumines ?
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
a cast is an explicit transformation of a type A in type B.
eg:
the old signatures of sceNetAdhocMatchingSelectTarget is:
int sceNetAdhocMatchingSelectTarget(int, char*, int, int) (<= see the 2nd arg)
But as my variable was an (u8 * ) which is the same as (unsigned char *). I had to cast it in (char *).
so the code is something like:
sceNetAdhocMatchingSelectTarget( .., (char*) myVariable , .., ..)
But you have the newer header, where the signature is
int sceNetAdhocMatchingSelectTarget(int, unsigned char*, int, int) (<= see the 2nd arg)
And the code is still :
sceNetAdhocMatchingSelectTarget( .., (char*) myVariable , .., ..)
so now you just have to remove the cast (char*) and it will compile like a charm.
that was the error line 351,1002,1010.
for the error line 699 it's similar and simpler, it's only the signature of the matching callback that has changed, so just change the signature of the function matchingCB, the second function in the source if I remember well.
If you want to use the code and adapt it to your own homebrew, you really have to read some books like thinking in C++ it's free and very good.
eg:
the old signatures of sceNetAdhocMatchingSelectTarget is:
int sceNetAdhocMatchingSelectTarget(int, char*, int, int) (<= see the 2nd arg)
But as my variable was an (u8 * ) which is the same as (unsigned char *). I had to cast it in (char *).
so the code is something like:
sceNetAdhocMatchingSelectTarget( .., (char*) myVariable , .., ..)
But you have the newer header, where the signature is
int sceNetAdhocMatchingSelectTarget(int, unsigned char*, int, int) (<= see the 2nd arg)
And the code is still :
sceNetAdhocMatchingSelectTarget( .., (char*) myVariable , .., ..)
so now you just have to remove the cast (char*) and it will compile like a charm.
that was the error line 351,1002,1010.
for the error line 699 it's similar and simpler, it's only the signature of the matching callback that has changed, so just change the signature of the function matchingCB, the second function in the source if I remember well.
If you want to use the code and adapt it to your own homebrew, you really have to read some books like thinking in C++ it's free and very good.
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
>.< I know what a cast is, I think I did not explain it right, sorry.
I just wanted to know what to change, if the char * only or the u8 * too.
I have got 3 C++ books and 2 C books ;)
I know how C++ works although I have not learned a lot of it as I don't have enough time to continue learning one of the books (I started learning one of the books but did not end it)
Edit:
Removed the (char *) from those lines
and changed in the callbacks function I changed the 1st char* to unsigned char* and the 2nd char* to void*
still crashes.
the eboot you give in your post works but not mine.
damn, lol
I just wanted to know what to change, if the char * only or the u8 * too.
I have got 3 C++ books and 2 C books ;)
I know how C++ works although I have not learned a lot of it as I don't have enough time to continue learning one of the books (I started learning one of the books but did not end it)
Edit:
Removed the (char *) from those lines
and changed in the callbacks function I changed the 1st char* to unsigned char* and the 2nd char* to void*
still crashes.
the eboot you give in your post works but not mine.
damn, lol
ok your question made me think you had problems with casts.
So if the eboot I sent you is working and the one you compile doesn't, it means :
It's not a problem of context on you PSP, so nothing block the homebrew such as a pluggin or I don't not what, it means that all the prx etc are started correctly.
If you don't have even a warning during the compile phase (which should be the case).
There is only one possibility : the link.
could you show the compile option and libs you used ?
So if the eboot I sent you is working and the one you compile doesn't, it means :
It's not a problem of context on you PSP, so nothing block the homebrew such as a pluggin or I don't not what, it means that all the prx etc are started correctly.
If you don't have even a warning during the compile phase (which should be the case).
There is only one possibility : the link.
could you show the compile option and libs you used ?
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am
No warnings, no nothing lool.
Here's my makefile:
Here's my makefile:
Code: Select all
##########################################################################
# This file is part of pspZorba samples.
#
# pspZorba samples are free softwares: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pspZorba samples is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with pspZorba samples. If not, see <http://www.gnu.org/licenses/>.
#
#########################################################################
#########################################################
#
# pspZorba : PSPlorer
# www.pspzorba.com
#########################################################
# name displayed by the XMB
PSP_EBOOT_TITLE = pspZorba-ex028
# fisrt icon displayed (*.PNG) by the XMB
PSP_EBOOT_ICON = NULL
# animation (*.PMF) displayed by the XMB
PSP_EBOOT_ANIM = NULL
# it's a picture (*.PNG)displayed after some seconds rather with transparency to allow us to see the first icon and the anim.
PSP_EBOOT_FOREGROUND = NULL
# background image (*.PNG) displayed
PSP_EBOOT_BACKGROUND = NULL
# music (*.AT3) rather a loop but not mandatory
PSP_EBOOT_SND0 = NULL
CXXFLAGS = -g -G0 -Wall -O3 -D_PSP_FW_VERSION=380 -fno-rtti -fno-exceptions
INCDIR = -I. -I/home/piratanervo/meus/380Projects/_380SDK/include -I/usr/local/pspdev/psp/sdk/include
LIBDIR = -L. -L/usr/local/pspdev/psp/sdk/lib -L/home/piratanervo/meus/380Projects/_380SDK/lib -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx
LIBS = /usr/local/pspdev/psp/sdk/lib/prxexports.o -lstdc++ -lpspnet_adhocmatching -lpspnet_adhoc -lpspnet_adhocctl -lpspwlan -lpspnet -lpspusb -lpspusbstor -lpsppower -lpspgum -lpspgu -lm -lpspumd -lpspctrl -lpspdebug -lpspge -lpspdisplay -lpspsdk -lc -lpspuser -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpspnet_inet -lpsputility
OBJECTS = main.o ZBadhoc.o
#########################################################
EBOOT.PBP: PARAM.SFO a.prx $(PSP_EBOOT_ICON) $(PSP_EBOOT_FOREGROUND) $(PSP_EBOOT_BACKGROUND) $(PSP_EBOOT_ANIM) $(PSP_EBOOT_SND0)
pack-pbp $@ PARAM.SFO $(PSP_EBOOT_ICON) $(PSP_EBOOT_ANIM) $(PSP_EBOOT_FOREGROUND) $(PSP_EBOOT_BACKGROUND) $(PSP_EBOOT_SND0) a.prx NULL
PARAM.SFO: a.prx
mksfo $(PSP_EBOOT_TITLE) $@
a.prx: a.elf
psp-prxgen $< $@
a.elf: $(OBJECTS) Makefile
psp-gcc $(CXXFLAGS) $(LIBDIR) $(OBJECTS) $(LIBS) -o $@
psp-fixup-imports $@
main.o: main.cpp ZBadhoc.h
psp-g++ $(INCDIR) $(CXXFLAGS) -c -o $@ $<
ZBadhoc.o: ZBadhoc.cpp ZBadhoc.h
psp-g++ $(INCDIR) $(CXXFLAGS) -c -o $@ $<
NULL:
cleanall: clean
clean:
rm -f $(OBJECTS) a.elf a_strip.elf PARAM.SFO EBOOT.PBP
I don't see anything wrong ...
last hypothesis :
- you may have remove/modify something in the code (not on purpose I mean)
or .... I don't know
so re-upload the sources here , use the makefile above, and recompile them (without any change at first), they are exactly the sources of the Eboot I sent you.
If it crashes ...then I am running out of idea
last hypothesis :
- you may have remove/modify something in the code (not on purpose I mean)
or .... I don't know
so re-upload the sources here , use the makefile above, and recompile them (without any change at first), they are exactly the sources of the Eboot I sent you.
If it crashes ...then I am running out of idea
--pspZorba--
NO to K1.5 !
NO to K1.5 !
-
- Posts: 409
- Joined: Tue Oct 09, 2007 4:22 am