 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
spyk
Joined: 22 Mar 2006 Posts: 14
|
Posted: Sun Jul 09, 2006 4:37 am Post subject: Use Wifi with Oslib! |
|
|
Hi all!
Hmm. I have a small problem...
I can't use wifi with Oslib.
look :
| Code: | //La librairie principale OSLib
#include <oslib/oslib.h>
//wifi
#include <pspnet.h>
#include <pspnet_inet.h>
#include <pspnet_apctl.h>
#include <pspnet_resolver.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/select.h>
//
#include <sys/socket.h>
#include <sys/types.h>
#include <netdb.h>
//
//les callbacks
PSP_MODULE_INFO("MyPSPGamePad", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
int main()
{
//Initialisation de la librairie
oslInit(0);
//Initialisation du mode graphique
oslInitGfx(OSL_PF_8888, 0);
//Initialisation de la console texte
oslInitConsole();
//affiche sur l'écran du texte
oslPrintf("pspSdkLoadInetModules()");
pspSdkLoadInetModules();
oslPrintf("pspSdkInetInit()");
pspSdkInetInit();
//attend l'appui sur une touche
oslWaitKey();
//on quitte l'application
oslEndGfx();
oslQuit();
return 0;
} |
I have made a lot of test, and in a homebrew with OSL, when we type
pspSdkLoadInetModules(), the screen of the psp stay black...
Can Anyone help me?
Has anyone made a Wifi homebrew with Old school librairie?
Thank You! |
|
| Back to top |
|
 |
swaine
Joined: 15 Feb 2007 Posts: 1
|
Posted: Thu Feb 15, 2007 1:35 pm Post subject: |
|
|
I am currently making a using OSLib with wifi capability.
Since OSLib doesn't like to load stuff in the user mode created for wifi (like in all the examples everywhere) you have to load everything before going into the user thread ("needed for DHCP").
Just to give an example...
| Code: |
int user_main(SceSize args, void* argp);
int main(void)
{
// Kernel mode thread
oslInit(0);
oslInitGfx(OSL_PF_8888, 0);
oslInitConsole();
oslStartDrawing();
oslPrintf("Loading images...");
back = oslLoadImageFile("blah.png", OSL_IN_RAM, OSL_PF_8888);
if(!back)
{
oslPrintf("ERROR");
for(int i=0;i<100;i++)
sceDisplayWaitVblankStart();
sceKernelExitGame();
return 0;
}
oslPrintf("Done\n\n");
oslPrintf("Loading Network drivers...");
if (nlhLoadDrivers(&module_info) != 0)
{
printf("Driver load error\n");
for(int i=0;i<100;i++)
sceDisplayWaitVblankStart();
sceKernelExitGame();
return 0;
}
oslPrintf("Done\n\n");
oslEndDrawing();
for(int i=0;i<100;i++)
sceDisplayWaitVblankStart();
oslEndGfx();
// create user thread, tweek stack size here if necessary
SceUID thid = sceKernelCreateThread("User Mode Thread", user_main,
0x11, // default priority
256 * 1024, // stack size (256KB is regular default)
PSP_THREAD_ATTR_USER, NULL);
// start user thread, then wait for it to do everything else
sceKernelStartThread(thid, 0, NULL);
sceKernelWaitThreadEnd(thid, NULL);
sceKernelExitGame();
return 0;
}
|
Then, in your user_main you can do your nlhInit()
and you can also do a:
oslInitGfx(OSL_PF_8888, 1);
(note: in my main I only used a single buffer cause I was using console)
and start drawing, and using the network stuff. |
|
| Back to top |
|
 |
goebish
Joined: 14 Oct 2006 Posts: 29
|
Posted: Sun Feb 18, 2007 8:03 pm Post subject: |
|
|
This is very interesting wraine !
I'm currently implementing networking in my game using OSLib, sure it will help :) |
|
| Back to top |
|
 |
|
|
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
|