QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

[CODING HELP] VSHMAIN.PRX replacement

This is a discussion on [CODING HELP] VSHMAIN.PRX replacement within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I'm trying to make a module to replace vshmain.prx to do some stuff, and then launch the original vshmain_real.prx Code: ...

Reply
 
LinkBack Thread Tools
Old 05-28-2008, 10:26 PM   #1

¡Éste es Spartaaaaaaa!
 
Torch's Avatar
 
Join Date: Jun 2007
Posts: 2,472
Trader Feedback: 0
Default [CODING HELP] VSHMAIN.PRX replacement

I'm trying to make a module to replace vshmain.prx to do some stuff, and then launch the original vshmain_real.prx

Code:
#include <pspkernel.h>
#include <pspthreadman.h>
#include <pspdebug.h>
#include <stdio.h>

PSP_MODULE_INFO("Password", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER);
//PSP_HEAP_SIZE_KB(1024);

#define printf    pspDebugScreenPrintf
#define VSHMAIN "flash0:/vsh/module/vshmain_real.prx"

SceUID load_module(const char *path, int flags, int type)
{
    SceKernelLMOption option;
    SceUID mpid;

    /* If the type is 0, then load the module in the kernel partition, otherwise load it
       in the user partition. */
    if (type == 0) {
        mpid = 1;
    } else {
        mpid = 2;
    }

    memset(&option, 0, sizeof(option));
    option.size = sizeof(option);
    option.mpidtext = mpid;
    option.mpiddata = mpid;
    option.position = 0;
    option.access = 1;

    return sceKernelLoadModule(path, flags, type > 0 ? &option : NULL);
}

int main_thread(SceSize args, void *argp)
{
    pspDebugScreenInit();
     printf("Arguement Size = %d\n",args);
         
    SceUID mod;
    mod = load_module(VSHMAIN, 0, 0);
    
    if (mod > 0)
    {
        sceKernelStartModule(mod, args, argp, NULL, NULL);
    }
    else
    {
         printf("Start failed %x",mod);
    }
    
    sceKernelExitDeleteThread(0);

    return 0;
}

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

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

    return 0;
}
Code:
TARGET = password
OBJS = main.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
PSP_FW_VERSION = 390

LIBDIR =
LIBS =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Password
#PSP_EBOOT_ICON="icon0.png"
#PSP_EBOOT_PIC1="pic1.png"
#PSP_EBOOT_SND0="snd0.at3"

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build_prx.mak
sceKernelStartModule always returns 0x80020148 (unsupported PRX type). I tried launching a vshmain_real.prx from ms0: as well because I read that in user mode you can't start a module from flash0:.

And is there any way get my program's arguments in the form SceSize args, void *argp by using only int main(....) instead of creating a module_start(SceSize args, void *argp) and creating another thread?
-= Double Post =-
I tried it with pspSdkLoadStartModule but it also gives 0x80020148.
__________________
You didn't hear it.
You didn't see it.
You won't say nothing to no one, never in your life.
You never heard it.
How absurd it all seems without any proof.

Last edited by Torch; 05-29-2008 at 05:48 AM.. Reason: Automerged Doublepost
Torch is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
coding , replacement , vshmainprx

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 06:44 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us