0x8002013a, Use ad-hoc ?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
kYp
Posts: 1
Joined: Mon Mar 12, 2007 2:19 am

0x8002013a, Use ad-hoc ?

Post by kYp »

Hi,First of all my ingles :)
I can´t work with wifi, my code is :

Code: Select all

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspwlan.h>
#include <pspsdk.h>
#include <pspnet_adhoc.h>
#include <string.h>

PSP_MODULE_INFO&#40;"Wifi", 0x1000, 1, 1&#41;;
/* Define the main thread's attribute value &#40;optional&#41; */
PSP_MAIN_THREAD_ATTR&#40;0&#41;;
SceUID load_start_module&#40;const char *path, int flags, int type&#41;;
int sceNetInit&#40;u32 r4, u32 r5, u32 r6, u32 r7, u32 r8&#41;;
/* Define printf, just to make typing easier */
#define printf	pspDebugScreenPrintf

int user_main&#40;SceSize args, void *argp&#41;&#123;
    SceCtrlData pad;
    u32 err;
    printf&#40;"User main\n"&#41;;
    printf&#40;"sceNetInit&#40;&#41;\n"&#41;;
    err = sceNetInit&#40;0x20000, 0x20, 0x1000, 0x20, 0x1000&#41;;
    printf&#40;"Return&#58; %x\n",err&#41;;
    printf&#40;"sceNetAdhocInit&#40;&#41;\n"&#41;;
    err = sceNetAdhocInit&#40;&#41;;
    printf&#40;"Return&#58; %x\n",err&#41;;
    while&#40;1&#41;&#123;
    sceCtrlReadBufferPositive&#40;&pad,1&#41;;
    if&#40; pad.Buttons & PSP_CTRL_DOWN &#41; &#123; break; &#125;
    &#125;
&#125;

int main&#40;int argc, char *argp&#91;&#93;&#41;&#123;
    pspDebugScreenInit&#40;&#41;;
    printf&#40;"Loading PRX...\n"&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/ifhandle.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/memab.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/pspnet_adhoc_auth.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/pspnet.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/pspnet_adhoc.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/pspnet_adhocctl.prx", 0, 0&#41;&#41;;
    printf&#40;"Return&#58; %x\n",load_start_module&#40;"flash0&#58;/kd/pspnet_adhoc_matching.prx", 0, 0&#41;&#41;;
    
    /* create user thread */
    SceUID thid = sceKernelCreateThread&#40;"User Mode Thread", user_main,
            0x11, // default priority
            256 * 1024, // stack size &#40;256KB is regular default&#41;
            PSP_THREAD_ATTR_USER, NULL&#41;; //# user mode

    // start user thread, then wait for it to do everything else
    sceKernelStartThread&#40;thid, 0, 0&#41;;
    sceKernelWaitThreadEnd&#40;thid, NULL&#41;;

	/* quick clean exit */
	sceKernelExitGame&#40;&#41;;
	
    return 0;
&#125;
SceUID load_start_module&#40;const char *path, int flags, int type&#41;
&#123;
	SceKernelLMOption option;
	SceUID mpid;
    SceModule *mod;
	SceUID modid;
    int fd;
    /* If the type is 0, then load the module in the kernel partition, otherwise load it
	   in the user partition. */
	if &#40;type == 0&#41; &#123;
		mpid = 1;
	&#125; else &#123;
		mpid = 2;
	&#125;

	memset&#40;&option, 0, sizeof&#40;option&#41;&#41;;
	option.size = sizeof&#40;option&#41;;
	option.mpidtext = mpid;
	option.mpiddata = mpid;
	option.position = 0;
	option.access = 1;

	modid = sceKernelLoadModule&#40;path, flags, type > 0 ? &option &#58; NULL&#41;;
    mod = sceKernelFindModuleByUID&#40;modid&#41;;    
	return sceKernelStartModule&#40;modid, 0, NULL, &fd, NULL&#41;;
&#125;
sceNetInit(0x20000, 0x20, 0x1000, 0x20, 0x1000); and sceNetAdhocInit();
return the error SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED = 0x8002013a , why ? I read some post, but i didn´t find the info or i didn´t understand it
:)
Post Reply