run app under PSP/GAME/UPDATE

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

run app under PSP/GAME/UPDATE

Post by PSPfreak! »

hey all, me again lol

everytime i use a kernel or user eboot under UPDATE it doesnt work (shows currupt), i know im going wrong somewere, just dunno (im using 1.50 kernel btw)

all im doing is reading from flash0, not flashing or anything. the other things im doing is like putting a eboot on the ms & making directiories on it aswell.

i've searched around, google and http://forums.ps2dev.org/search.php lolol

can anyone help me get this to run under UPDATE please??

Code: Select all

PSP_MODULE_INFO("write", 0x1000, 1, 0);
PSP_MAIN_THREAD_ATTR(0);

#define FILE_SIZE	    	0000

char file_buffer[FILE_SIZE];

u8 file_md5[16] =
{
	/*md5*/
};

void ErrorExit(int milisecs, char *fmt, ...)
{
	va_list list;
	char msg[256];	

	va_start(list, fmt);
	vsprintf(msg, fmt, list);
	va_end(list);

	printf(msg);

	sceKernelDelayThread(milisecs*1000);
	sceKernelExitGame();
}

void read_file(char *file, u8 *md5, char *buf, int size)
{
	SceUID fd;
	int read;
	u8 digest[16];
	
	fd= sceIoOpen(file, PSP_O_RDONLY, 0777);

	if &#40;fd < 0&#41;
	&#123;
		ErrorExit&#40;4000, "blah blah\n", file&#41;;
	&#125;
	
	read = sceIoRead&#40;fd, buf, size&#41;;

	if &#40;read != size&#41;
	&#123;
		ErrorExit&#40;4000, "blah blah\n", file&#41;;
	&#125;

	if &#40;sceKernelUtilsMd5Digest&#40;&#40;u8 *&#41;buf, size, digest&#41; < 0&#41;
	&#123;
		ErrorExit&#40;4000, "blah blah\n"&#41;;
	&#125;

	if &#40;memcmp&#40;digest, md5, 16&#41; != 0&#41;
	&#123;
		ErrorExit&#40;4000, "blah blah\n", file&#41;;
	&#125;
&#125;

/*i know this involves the use of the buffers lol, might be my problem in user??*/
int check_file&#40;&#41;
&#123;
    
    read_file&#40;"flash0&#58;/blah", filemd5, file_buffer, FILE_SIZE&#41;;
    
                 
    return 0;
&#125;

int menu&#40;&#41;
&#123;
    pspDebugScreenClear&#40;&#41;;
    
    printf&#40;"blahblah\n"&#41;;
    
    return 0;
&#125;

int Eboots&#40;&#41;
&#123;
    
    sceIoMkdir&#40;"ms0&#58;/blah", 0777&#41;;
    
				
	            SceUID fd = sceIoOpen&#40;"ms0&#58;/blah.PBP", PSP_O_WRONLY | PSP_O_CREAT, 0777&#41;;
                if&#40;fd < 0&#41;
                &#123;
                      TextColor&#40;RED&#41;;
                      ErrorExit&#40;5000, "\n\nCannot open file for writing.\n"&#41;;
                &#125;
                
                int written = sceIoWrite&#40;fd, EBOOTS, size_EBOOTS&#41;;
                
                if&#40;written != size_EBOOTS&#41;
                &#123;
                           sceIoClose&#40;fd&#41;;
                           TextColor&#40;RED&#41;;
                           ErrorExit&#40;5000, "\n\nCannot write file.\n"&#41;;
                &#125;
                
                sceIoClose&#40;fd&#41;;                
				
	            
    return 0;
&#125;

int main&#40;&#41;
&#123;
    pspDebugScreenClear&#40;&#41;;
    
    check_file&#40;&#41;;
    
    menu&#40;&#41;;
    
    while &#40;1&#41;
	&#123;
		SceCtrlData pad;

		sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
        
		if &#40;pad.Buttons & PSP_CTRL_RTRIGGER&#41;
		&#123;
                        sceKernelExitGame&#40;&#41;;
		&#125; 
        
		else if &#40;pad.Buttons & PSP_CTRL_CROSS&#41;
		&#123;
			break;
		&#125;

		sceKernelDelayThread&#40;10000&#41;;
	&#125;
	
	Eboots&#40;&#41;;

    printf&#40;"\n\n\nDone"&#41;;
    
    sceKernelExitGame&#40;&#41;;  
   return 0;
&#125; 
 

Mashphealh
Posts: 18
Joined: Wed Nov 28, 2007 4:18 am

Post by Mashphealh »

You must put eboot in vsh mode or user mode.

// - Vsh -
PSP_MODULE_INFO("Example", 0x0800, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_VSH);

// - User -
PSP_MODULE_INFO("Example", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);

Then the param.sfo of the eboot must be the param.sfo that have official sony update.
Extract it and with hex editor search the offset 0x00000840 edit the text x.yz and write a firmware version more big than 3.90. Save the param.sfo and put it on your eboot.
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

ok, that makes it show. but when i try and launch it, it doesn't load it gets to a black screen then shuts down in a few seconds. i tried it using user & vsh, then i reduced the code to see if it would work, it still doesnt load

Code: Select all


#include <pspsdk.h>
#include <pspctrl.h>

PSP_MODULE_INFO&#40;"Example", 0, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;PSP_THREAD_ATTR_USER&#41;; 

#define printf pspDebugScreenPrintf

int main&#40;&#41;
&#123;    
    printf&#40;"blahblah"&#41;;
    
    while &#40;1&#41;
	&#123;
		SceCtrlData pad;

		sceCtrlReadBufferPositive&#40;&pad, 1&#41;;
        
		if &#40;pad.Buttons & PSP_CTRL_RTRIGGER&#41;
		&#123;
                        sceKernelExitGame&#40;&#41;;
		&#125; 
        
		else if &#40;pad.Buttons & PSP_CTRL_CROSS&#41;
		&#123;
			break;
		&#125;

		sceKernelDelayThread&#40;10000&#41;;
	&#125;

    printf&#40;"blah"&#41;; 
    
    sceKernelExitGame&#40;&#41;;
    
   return 0;
&#125; 
 

i even took sceKernelExitGame(); & sceKernelDelayThread(10000); out and tried again with both user & vsh. still doesn't work...???
Last edited by PSPfreak! on Mon Feb 04, 2008 5:00 pm, edited 2 times in total.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

you are missing pspDebugScreenInit...
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

moonlight wrote:you are missing pspDebugScreenInit...
thanks man ill give a try now
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

now i get a error saying the game could not be started. (800200D9)

lol starting to get somewere

edit: this is using the full app were it uses the ms, and reads from flash0
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

i found out 800200D9 = failed to allocate the memory block
Mashphealh
Posts: 18
Joined: Wed Nov 28, 2007 4:18 am

Post by Mashphealh »

You are missing also sceKernelSleepThread(); .
Write it above of return 0 of the main function and try again.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Remember that if you compile your app as a 3.xx prx, you NEED to specify the heap size in main.c.

Code: Select all

PSP_HEAP_SIZE_MAX&#40;&#41;;
or

Code: Select all

PSP_HEAP_SIZE_KB&#40;no_of_kBs&#41;;
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

Mashphealh wrote:You are missing also sceKernelSleepThread(); .
Write it above of return 0 of the main function and try again.
i just tried that, still ended with 800200D9, then i used the one were it prints just text, i get a error 80020001 (i believe its a kernel error i think though but im not sure)
J.F. wrote:Remember that if you compile your app as a 3.xx prx, you NEED to specify the heap size in main.c.

Code: Select all

PSP_HEAP_SIZE_MAX&#40;&#41;;
or

Code: Select all

PSP_HEAP_SIZE_KB&#40;no_of_kBs&#41;;
lol im using 1.50, but can you use this on 1.50?? i have naver used it, but by the sounds of it you cant

do you have to compile it to a higher kernel for it to work??(currently compiling as 1.50) on the PARAM.SFO im using the 3.90's, but changed the PSP Update Ver. 3.80 to PSP Update Ver. 3.99, (i didnt change PSP Update Ver, just an example of were i did it)
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

PSPfreak! wrote:
Mashphealh wrote:You are missing also sceKernelSleepThread(); .
Write it above of return 0 of the main function and try again.
i just tried that, still ended with 800200D9, then i used the one were it prints just text, i get a error 80020001 (i believe its a kernel error i think though but im not sure)
J.F. wrote:Remember that if you compile your app as a 3.xx prx, you NEED to specify the heap size in main.c.

Code: Select all

PSP_HEAP_SIZE_MAX&#40;&#41;;
or

Code: Select all

PSP_HEAP_SIZE_KB&#40;no_of_kBs&#41;;
lol im using 1.50, but can you use this on 1.50?? i have naver used it, but by the sounds of it you cant
If you compile it as a prx, you get a tiny heap (I forget exactly how small) unless you specify one or the other, regardless of the firmware. If you don't compile as a prx, it defaults to MAX, but you can use KB to set how much heap space you want. At least, that's how I understand it to work.
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

so do i try & get a working app that launches from UPDATE, make a prx that writes the files to the ms, then launch the game which loads the prx? all by using fw 1.50, will that work? coz i though 1.50 cant load prx's coz there elf's but i do know that elf's can be launched.
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

*BUMP* soz
Viper8896
Posts: 110
Joined: Thu Jan 26, 2006 6:20 pm

Post by Viper8896 »

dont bump just search
User avatar
PSPfreak!
Posts: 34
Joined: Wed Nov 14, 2007 10:57 pm

Post by PSPfreak! »

Viper8896 wrote:dont bump just search
pffft, did you not read at the top of this page? or can you not read?
Post Reply