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 

[SOLVED] sctrlKernelLoadExecVSHMs2()

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
vista200



Joined: 19 Mar 2008
Posts: 13

PostPosted: Wed Mar 19, 2008 8:23 am    Post subject: [SOLVED] sctrlKernelLoadExecVSHMs2() Reply with quote

Hey everyone!

This is my first post in this forum, so please be patient with me!

I'm trying to run an Homebrew from my own program, but it won't work!

I've implemented the systemctrl.h from the 3.71 M33 SDK, which has the sctrlKernelLoadExecVSHMs2()-function, but when I try to compile the code, I get this errors:

Code:
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
390   -c -o main.o main.c
In file included from main.c:4:
./include/systemctrl.h:189: error: expected ')' before '*' token
./include/systemctrl.h:230: error: expected '=', ',', ';', 'asm' or '__attribute
__' before 'sctrlHENSetStartModuleHandler'
make: *** [main.o] Error 1


In this error messages I can't see a mistake of me, but there seem to be mistakes in D_A's code.

I took the code from here: http://forums.ps2dev.org/viewtopic.php?t=9247

main.c:
Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <string.h>
#include "./include/systemctrl.h"

PSP_MODULE_INFO("Hello World", 0, 1, 1);

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

void execEboot(char *target)
{   
   struct SceKernelLoadExecVSHParam param;
         
   memset(&param, 0, sizeof(param));
         
   param.key = "game";
   param.size = sizeof(param);
   param.args = strlen(target)+1;
   param.argp = target;

   sctrlKernelLoadExecVSHMs2(target, &param);   

}

int main() {

SetupCallbacks();
pspDebugScreenInit();
printf("Hello World");
execEboot("ms0:/PSP/GAME/PSPTube/EBOOT.PBP");
sceKernelSleepThread();

return 0;
}


and makefile:
Code:
TARGET = hello
OBJS = main.o

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World
PSP_FW_VERSION = 390

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


Thanks in advance,
vista200


Last edited by vista200 on Wed Mar 19, 2008 7:32 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Mar 19, 2008 8:53 am    Post subject: Reply with quote

Open your systemctrl.h file and add this after the includes:
Code:

typedef struct SceModule2
{
   struct SceModule   *next; // 0
   u16               attribute; // 4
   u8               version[2]; // 6
   char            modname[27]; // 8
   char            terminal; // 0x23
   char            mod_state;   // 0x24
    char            unk1;    // 0x25
   char            unk2[2]; // 0x26
   u32               unk3;   // 0x28
   SceUID            modid; // 0x2C
   u32               unk4; // 0x30
   SceUID            mem_id; // 0x34
   u32               mpid_text;   // 0x38
   u32               mpid_data; // 0x3C
   void *            ent_top; // 0x40
   unsigned int      ent_size; // 0x44
   void *            stub_top; // 0x48
   u32               stub_size; // 0x4C
   u32               entry_addr_; // 0x50
   u32               unk5[4]; // 0x54
   u32               entry_addr; // 0x64
   u32               gp_value; // 0x68
   u32               text_addr; // 0x6C
   u32               text_size; // 0x70
   u32               data_size;   // 0x74
   u32               bss_size; // 0x78
   u32               nsegment; // 0x7C
   u32               segmentaddr[4]; // 0x80
   u32               segmentsize[4]; // 0x90
} SceModule2;

_________________

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



Joined: 19 Mar 2008
Posts: 13

PostPosted: Wed Mar 19, 2008 11:07 am    Post subject: Half way to success! Reply with quote

Hey again!

Thanks for the tip! Now I can compile my project without problems, but when I try to launch a Homebrew or an official Update, nothing happens.

I've also tried in User- and Kernel-Mode.

I think, that an example would help me very much!

So please, could someone show me, how it works!? I'm getting crazy! I've searched a lot in the web and here in the forum, but i found nothing applicable for me.

I do two printfs, one before and one after the execEboot(), both show their texts, but nothing is launched. Something goes wrong here... The program doesn't even hang: I can exit it through the HOME-Button.

Thanks again!
vista200
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Wed Mar 19, 2008 7:19 pm    Post subject: Reply with quote

Paste your code again please.
_________________

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



Joined: 19 Mar 2008
Posts: 13

PostPosted: Wed Mar 19, 2008 7:31 pm    Post subject: It works! Reply with quote

Thanks, but now it works. It's like magic! But here's the code again:

main.c:
Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <string.h>
#include <systemctrl.h>

PSP_MODULE_INFO("Hello World", 0, 1, 1);
PSP_MAIN_THREAD_ATTR (0);

#define printf pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;

cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);

sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;

thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}

return thid;
}

void execEboot(char *target)
{   
   struct SceKernelLoadExecVSHParam param;
         
   memset(&param, 0, sizeof(param));
         
   param.key = "game";
   param.size = sizeof(param);
   param.args = strlen(target)+1;
   param.argp = target;

   sctrlKernelLoadExecVSHMs2(target, &param);   

}

int main() {
pspDebugScreenInit();
SetupCallbacks();

printf("Hello World");
execEboot("ms0:/PSP/GAME/PSPTube/EBOOT.PBP");

sceKernelSleepThread();

return 0;
}


makefile:
Code:
TARGET = hello
OBJS = main.o

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

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World

LIBS = -lpspsystemctrl_user

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak


As stated above, I don't know what happened to the code, but it works!

Thanks for the help!
vista200
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Question_dev



Joined: 24 Aug 2007
Posts: 88

PostPosted: Sun Mar 23, 2008 3:04 am    Post subject: Reply with quote

I dont now why,

But i get ALWAYS with excute eboot codes, a compile error :



Code:
main.c: In function 'execEboot':
main.c(92) : error: storage size of 'param' isn't known
main.c(101) : warning: implicit declaration of function 'sctrlKernelLoadExecVSHM
s2'



Help, TY !!
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sun Mar 23, 2008 3:51 am    Post subject: Reply with quote

@Question_dev, this function:
sctrlKernelLoadExecVSHM
does not exist
_________________

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



Joined: 24 Aug 2007
Posts: 88

PostPosted: Sun Mar 23, 2008 4:02 am    Post subject: Reply with quote

...I now ...

But i wrote :

main.c: In function 'execEboot':
main.c(92) : error: storage size of 'param' isn't known
main.c(101) : warning: implicit declaration of function 'sctrlKernelLoadExecVSHMs2'

(s2 was on next line...)

TY
Back to top
View user's profile Send private message
Pirata Nervo



Joined: 09 Oct 2007
Posts: 409

PostPosted: Sun Mar 23, 2008 5:56 am    Post subject: Reply with quote

sorry I did not see it.
Post your code then
_________________

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
Page 1 of 1

 
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