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 

Install a bootstrap and return to application... how?
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
darkness



Joined: 15 Jun 2008
Posts: 121

PostPosted: Tue Jul 01, 2008 3:49 am    Post subject: Reply with quote

Yes, this is that I try to say you! :)
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Tue Jul 01, 2008 3:53 am    Post subject: Reply with quote

Anyway I am already creating a patch for my NervOS 2.0.7 BETA to allow 3.xx users to run ISO's, Homebrew and PSX games without loosing the patch.
It uses the loadmodule* functions.
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Wed Jul 02, 2008 3:04 am    Post subject: Reply with quote

Excuse me,
I've builted a prx for load all the executables, but when I try to load another module from the loaded prx I have error 0x80020143 ( MODULE_MRG_BUSY)!
I think is because I'm load a module from a loaded prx, so I've to unload it for load another module or I can load it with another function from main program?
( I've to pass arguments to the module );
Thanks in advance!

EDIT:
Can I use a simple sceKernelLoadExec?
I can use all the user mode funct for load the prx because there's not patch loaded!

Ok, I'm working on pspSdkLoadStartModule ( maybe resolved )! :D
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Wed Jul 02, 2008 3:55 am    Post subject: Reply with quote

You can't load/start stop/unload a module inside module_start, module_stop functions. Create a thread and load/start it from there.
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Jul 02, 2008 4:07 am    Post subject: Reply with quote

pspSdkLoadStartModule does not work inside prx which uses KERNEL_LIBS or KERNEL_LIBC.
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Thu Jul 03, 2008 1:50 am    Post subject: Reply with quote

Thnks!!
Back to top
View user's profile Send private message
darkness



Joined: 15 Jun 2008
Posts: 121

PostPosted: Thu Jul 03, 2008 2:56 am    Post subject: Reply with quote

??? I've try to load a module but I get always error 0x800200D9!
Where is the possible problem?
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Thu Jul 03, 2008 2:59 am    Post subject: Reply with quote

code?
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Thu Jul 03, 2008 3:08 am    Post subject: Reply with quote

Code:

SceUID mod = sceKernelLoadModuleMs2(arguments[2], 0, data);
    if (mod >= 0)
    {
            mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);
            if (mod < 0)
                printf("\nError 0x%08X starting module.\n", mod);
                sleep(3000000);
    }
    else
    {
            if (mod == SCE_KERNEL_ERROR_EXCLUSIVE_LOAD)
            {
                    // Ignore this error, it means the module loaded on reboot
            }
            else
            {
                printf("\nError 0x%08X loading module.\n",  mod); <---- Here I get the error
                sleep(3000000);
            }
    }


This code is in a kernel mode prx loaded by the main programm with load / start module. ( Main programm is user mode)


Last edited by darkness on Thu Jul 03, 2008 4:55 am; edited 1 time in total
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Thu Jul 03, 2008 4:22 am    Post subject: Reply with quote

I don't think that part of code is the problem
do you get the error from:
printf("\nError 0x%08X loading modules.\n", mod);
or when running that prx (which uses the code you posted)
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Thu Jul 03, 2008 4:55 am    Post subject: Reply with quote

I've modified the code, see it!

P.S: I've to set the heap size or else?
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Thu Jul 03, 2008 7:00 am    Post subject: Reply with quote

depends of what you are trying to load and what format is your program.
is that code inside prx or pbp?
_________________

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



Joined: 09 Oct 2007
Posts: 409

PostPosted: Thu Jul 03, 2008 9:03 am    Post subject: Reply with quote

No it's not true because he is using the load module * functions and not load exec* functions
@psp.padawan, 4.0 sdk comes with a better sample :) and even with loadexec (the patch is not lost on 4.0 or higher), I needed to create a 3xxkernel.prx to use the load module functions
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Fri Jul 04, 2008 2:32 am    Post subject: Reply with quote

Is a kernel mode prx...
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri Jul 04, 2008 3:45 am    Post subject: Reply with quote

what are you talking about?
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Fri Jul 04, 2008 3:53 am    Post subject: Reply with quote

Quote:
depends of what you are trying to load and what format is your program.
is that code inside prx or pbp?

My "loader" is a kernel mode prx...
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri Jul 04, 2008 3:55 am    Post subject: Reply with quote

you deleted your other post and you made me look dumb.
don't it again with me please or I won't help you anymore.
but psp.padawan also deleted his post
yeh set the heap and try again
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Fri Jul 04, 2008 4:07 am    Post subject: Reply with quote

Oh, excuse me, sorry!
I've tried to set heap size to 32 and 1024 but I still get the same error! :(
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri Jul 04, 2008 4:12 am    Post subject: Reply with quote

I think the problem is pbp you are trying to load
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
psp.padawan



Joined: 12 Nov 2007
Posts: 10

PostPosted: Fri Jul 04, 2008 4:19 am    Post subject: Reply with quote

Pirata Nervo wrote:
you deleted your other post and you made me look dumb.
don't it again with me please or I won't help you anymore.
but psp.padawan also deleted his post
yeh set the heap and try again


Pirata Nervo, I have not deleted any of my posts. The last one I had was the one with the sample. Yeah, Ive seen the 4.01 sdk sample. It works pretty good :)
Back to top
View user's profile Send private message
darkness



Joined: 15 Jun 2008
Posts: 121

PostPosted: Fri Jul 04, 2008 4:27 am    Post subject: Reply with quote

I've tried to load another pbp but I've the same error!
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri Jul 04, 2008 4:31 am    Post subject: Reply with quote

@psp.padawan I am sure there was post by you above the one (mine) which says:
No it's not true because he is using the load module * functions and not load exec* functions
@psp.padawan, 4.0 sdk comes with a better sample :) and even with loadexec (the patch is not lost on 4.0 or higher), I needed to create a 3xxkernel.prx to use the load module functions

And there was a post by by darkness too but he deleted it.

O.o

@darkness, if you dont post your code I cant help you :/
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
psp.padawan



Joined: 12 Nov 2007
Posts: 10

PostPosted: Fri Jul 04, 2008 4:52 am    Post subject: Reply with quote

Pirata Nervo wrote:
@psp.padawan I am sure there was post by you above the one (mine) which says:
No it's not true because he is using the load module * functions and not load exec* functions
@psp.padawan, 4.0 sdk comes with a better sample :) and even with loadexec (the patch is not lost on 4.0 or higher), I needed to create a 3xxkernel.prx to use the load module functions


Nope I have not responded in this thread until today where I said I did not delete any of my posts. I might be wrong, but I dont think posts can be deleted. The text can be edited but I have not seen a delete option. Anyway, the name of the person should still be there even if the post has been edited.
Back to top
View user's profile Send private message
darkness



Joined: 15 Jun 2008
Posts: 121

PostPosted: Fri Jul 04, 2008 5:02 am    Post subject: Reply with quote

??? I've already posted the code!!
Maybe you want a complete src!
Code:

PSP_MODULE_INFO("Xp", 0x1000, 1, 0);

PSP_HEAP_SIZE_KB(1024);

#define printf pspDebugScreenPrintf
#define sleep(n) sceKernelDelayThread(n)

u32 orig_funcs[2];

int ExitPatched()
{
   int k1 = pspSdkSetK1(0);

   char *program = "ms0:/PSP/GAME/Xplora_v1.0/EBOOT.PBP";
   struct SceKernelLoadExecVSHParam param;

   memset(&param, 0, sizeof(param));
   param.size = sizeof(param);
   param.args = strlen(program)+1;
   param.argp = program;
   param.key = "game";

   int res = sctrlKernelLoadExecVSHMs2(program, &param);
   pspSdkSetK1(k1);
   return res;
}

int ExitPatched2()
{
   return ExitPatched();
}

int RestoreExitGame()
{
   int k1 = pspSdkSetK1(0);
   
   sctrlHENPatchSyscall((u32)ExitPatched, (void *)orig_funcs[0]);
   sctrlHENPatchSyscall((u32)ExitPatched2, (void *)orig_funcs[1]);

   pspSdkSetK1(k1);
   return 0;
}

void SetConfFile(int n)
{
   int k1 = pspSdkSetK1(0);
   sctrlSESetBootConfFileIndex(n);
   pspSdkSetK1(k1);
}

void SetUmdFile(char *umdfile)
{
   int k1 = pspSdkSetK1(0);
   sctrlSESetUmdFile(umdfile);
   pspSdkSetK1(k1);
}

int main_thread(SceSize args, void *argp)
{
    pspDebugScreenInit();
   
    // Patcher function
    orig_funcs[0] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x05572A5F);
    orig_funcs[1] = sctrlHENFindFunction("sceLoadExec", "LoadExecForUser", 0x2AC9954B);
    sctrlHENPatchSyscall(orig_funcs[0], ExitPatched);
    sctrlHENPatchSyscall(orig_funcs[1], ExitPatched2);
   
   
    // Loader funcions
   
    SceUID mod = sceKernelLoadModuleMs2("ms0:/PSP/GAME/Filer_5.0/EBOOT.PBP", 0, NULL);
   
   
    // Starter function
   
    if (mod >= 0)
    {
            mod = sceKernelStartModule(mod, 0, NULL, NULL, NULL);
            if (mod < 0)
                printf("\nError 0x%08X starting module.\n", mod);
                sleep(3000000);
    }
    else
    {
            if (mod == SCE_KERNEL_ERROR_EXCLUSIVE_LOAD)
            {
                    // Ignore this error, it means the module loaded on reboot
            }
            else
            {
                printf("\nError 0x%08X loading module.\n",  mod);
                sleep(3000000);
            }
    }
   
    return 0;
}



int module_start(SceSize args, void *argp)
{
    SceUID th = sceKernelCreateThread("main_thread", main_thread, 8, 4*1024, 0, NULL);

    if (th >= 0)
    {
      sceKernelStartThread(th, args, argp);
    }
    return 0;
}


int module_stop(SceSize args, void *argp)
{
    return 0;
}

(I've never delete a post, maybe I've edit it for add info or else...)
However thanks!
Back to top
View user's profile Send private message
psp.padawan



Joined: 12 Nov 2007
Posts: 10

PostPosted: Fri Jul 04, 2008 5:22 am    Post subject: Reply with quote

darkness, that code is from the rdriver code from 401M33 sdk sample right? It was originally coded as a kernel library ( 0x1007 ). You have mixed the kernel library code with kernel module code (0x1000).
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Fri Jul 04, 2008 6:13 am    Post subject: Reply with quote

yeh he is misunderstanding 0x1000 with 0x1006/0x1007 lool.

use prx for exports and a pbp to use the exports ;)

I guess I am having illusions lol, wtf
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Sat Jul 05, 2008 1:07 am    Post subject: Reply with quote

This is only a try, if I put it in 0x1007 I have the same error!
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat Jul 05, 2008 1:31 am    Post subject: Reply with quote

No, you do not understand what is 0x1007/0x1006 supposed to be used on.
You can create a prx (like dax did for the sample) to export kernel functions to a usermode pbp
_________________

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



Joined: 15 Jun 2008
Posts: 121

PostPosted: Sat Jul 05, 2008 1:43 am    Post subject: Reply with quote

Ok, thanks very much, I'll try to write my first stub file for export the functions!

P.S: If I call a external function in main prog the problem of load module is solved or the problem remain?
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sat Jul 05, 2008 1:45 am    Post subject: Reply with quote

you don't write stubs, you must type:
psp-build-exports -s nameofexportsfile.exp

and it makes the stub for you.
yes the problem should be solved
_________________

Upgrade your PSP
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Goto page Previous  1, 2, 3, 4, 5  Next
Page 3 of 5

 
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