Passing NULL to the second param of sceKernelLoadExecVSHDisc isn't going to cut it.
Printable View
Passing NULL to the second param of sceKernelLoadExecVSHDisc isn't going to cut it.
Oh. What's the second param sopposed to be then?Zitat:
Zitat von _dysfunctional
I wasn't sure what all the the structure's members are, but this is my guess.
Code:void launchUmdGame()
{
struct SceKernelLoadExecVSHParam param;
memset(¶m, 0, sizeof(struct SceKernelLoadExecVSHParam));
param.size = sizeof(struct SceKernelLoadExecVSHParam);
strcpy(param.key, "game");
sceKernelLoadExecVSHDisc("disc0:/PSP_GAME/SYSDIR/EBOOT.BIN", ¶m);
}
anyone knows where can i find good description of fgets, fgetc a sscanf ?
Having a quick search for those function names on google gives,
C++ Reference:
http://www.cplusplus.com/
This is a great site to find information on the standard libraries of c/c++, it includes descriptions, examples and explanations of the use of classes and functions.
Specifically:
fgets:http://www.cplusplus.com/reference/c...dio/fgets.html
fgetc:http://www.cplusplus.com/reference/c...dio/fgetc.html
sscanf:http://www.cplusplus.com/reference/c...io/sscanf.html
Hopefully this helps :).
Jono.
thx Jono ! good site also :)
Thats gotta be the most helpful FIRST post ive ever seen. Well done :tup:Zitat:
Zitat von psp_jono
Thanks guys, happy to help:).
In regards to the problem with "sceKernelLoadExecVSHDisc ", over at ps2dev I found some information about the type of the second parameter.
Quote from moonlight at ps2dev.org:
Also an example of how to set up the parameters for use with the function.Code:struct SceKernelLoadExecVSHParam {
/* Size of structure in bytes */
SceSize size;
/* Size of the arguments string */
SceSize args;
/* Pointer to the arguments strings */
void * argp;
/* "game", "updater" or "vsh" */
const char * key;
/* unknown, it seems to be some kind of flag. the firmware set it to
0x00000400. it looks like is related with the next fields of the
structure, it's better to set it to 0 if we don't know how to use
those fields */
u32 unk1;
/* unknown, the firmware always set it to 0x09CF344C, which seems to
be a pointer */
void *unk2;
/* unknown. the firmware sets it to 0 */
u32 unk3;
/* unknown. the firmware sets it to 0 */
u32 unk4;
/* unknown. the firmware sets it to 0 */
u32 unk5;
};
Quote from moonlight at ps2dev.org:
Looks pretty easy to follow, you just have to set the appropriate structure members to the correct values.Code:int main()
{
struct SceKernelLoadExecVSHParam param;
char *eboot = "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN";
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.argp = eboot;
param.args = strlen(eboot)+1;
param.key = "game";
if (sceKernelLoadExecVSHDisc(eboot, ¶m) < 0)
{
pspDebugScreenInit();
printf("error");
}
return 0;
}
Not sure if this has already been stated but you can only use this function in kernel mode.
whats wrong with this makefile ?
when compiling i get /lib/build.mak is a directory stop.Code:TARGET = bouncing
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
O = o
OBJS = $(TARGET).$(O) bouncing.$(O)
DEFAULT_CFLAGS = $(shell $(SDL_CONFIG) --cflags) MORE_CFLAGS = -g -O2 CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions
LIBS = -lSDL -lSDL_mixer $z$(SDL_CONFIG) --libs)
EXTRA_TARGETS = EBOOT.PBP
include $(PSPSDK)/lib/build.mak
Ah, thanks jono. My guess what pretty close.Zitat:
Zitat von psp_jono
What is the output of the commandZitat:
Zitat von eldiablov
ls -l $(psp-config --pspsdk-path)/lib/build.mak
?
No worries mate :).
@eldiablov:
Um it sounds like a problem with the toolchain rather than the makefile. Are you using cygwin or are you in linux, normally its because of a lack of the required packages.
[EDIT] Oops, Archaemic beat me :).
cygwin compiles the controller example just fine so it cant be the toolchain. although there was a problem with gdb compiling in the toolchain script.
This is the output i get
[email protected] ~
$ ls -l $(psp-config --pspsdk-path)/lib/build.mak
-rw-r--r-- 1 G.Ninja None 5323 Aug 1 16:47 /usr/local/pspdev/psp/sdk/lib/build.
mak
Looking over it again...there's lots of things wrong with it.
Try thatCode:TARGET = bouncing
PSPSDK = $(shell psp-config --pspsdk-path)
PSPBIN = $(shell psp-config --psp-prefix)/bin
SDL_CONFIG = $(PSPBIN)/sdl-config
O = o
OBJS = $(TARGET).$(O) bouncing.$(O)
DEFAULT_CFLAGS = $(shell $(SDL_CONFIG) --cflags)
MORE_CFLAGS = -g -O2
CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS)
CXXFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) -fno-exceptions -fno-rtti
LIBS = -lSDL -lSDL_mixer $($(SDL_CONFIG) --libs)
EXTRA_TARGETS = EBOOT.PBP
include $(PSPSDK)/lib/build.mak
same error :(
has anybody tried this code to launch a umd. i'm on 352m33 2 and have irshell installed:-Zitat:
Zitat von psp_jono
when launched from the xmb this code gives an error message then launches irshell which was really unexpected
if you do try this code, though remember to mount the umd first
i have managed to put some code together that does launch a umd but it only runs umds<=1.52 kernel and i'm looking for help making a function that loads any umd
any help would be appreciated
Try logging the return of sceKernelLoadExecVSHDisc and outputting it.
what can i do to sort out my problem ?
from what information i can gather on the net this code should launch a umd but all it does in GAME150 is crash with a blank screen and in GAME352 prints the game could not be startedCode:#include <pspkernel.h>
#include <pspdebug.h>
#include <pspumd.h>
#include <psploadexec_kernel.h>
#include <string.h>
PSP_MODULE_INFO("LOAD UMD",0,0x1000,1);
#define debug_printf pspDebugScreenPrintf
int main()
{
pspDebugScreenInit();
int umd_check = sceUmdCheckMedium(0);
if (umd_check == 0)
{
debug_printf("NO UMD DISC PRESENT - waiting for disc....\n");
sceUmdWaitDriveStat(UMD_WAITFORDISC);
}
debug_printf("UMD INSERTED\n");
sceUmdActivate(1, "disc0:");
sceUmdWaitDriveStat(UMD_WAITFORINIT);
struct SceKernelLoadExecVSHParam param;
char *eboot = "disc0:/PSP_GAME/SYSDIR/EBOOT.BIN";
memset(¶m, 0, sizeof(param));
param.size = sizeof(param);
param.argp = eboot;
param.args = strlen(eboot)+1;
param.key = "game";
SceUID mod = sceKernelLoadExecVSHDisc(eboot, ¶m);
debug_printf("%08X", mod);
sceKernelSleepThread();
return 0;
}
do you see the bolded part? when thats removed the program loads in either 150 or 352 kernel and successfully mounts the umd but trying to launch it is another matter completely.
as at present this program won't run in GAME352 i would like to know how to compile a program to run from there
Try putting PSP_MAIN_THREAD_ATTR(PSP_ THREAD_ATTR_VSH); under PSP_MODULE_INFO
thanks for the reply but it didn't help. you'd think with the psp being a umd playing device and homebrew being possible for over 2 years that there'd be ample documentation about launching a umd from your own code, but there just isn't:(Zitat:
Zitat von Archaemic
anyway i'd like to compile this code to run on the 3.52 kernel but i don't know how. does anybody out there know?
also it seems that the inclusion of sceKernelLoadExecVSHDisc causes the program to crashes immediately on startup with just a black screen. whereas just commenting out that one line, the code runs fine from either GAME150 or GAME352
later on i'm gonna try plain old sceKernelLoadExec
anyone knows, why my PRX which has nothing to do with browser, blocks browser? o_O
It's because you're not allowed to discuss UMDs + homebrew on the PS2Dev forums, which are the main PSP development forums. I'm not quite sure why. Maybe they're afraid it'll lead to piracy. (Newsflash: there are already UMD dumpers out there.)Zitat:
Zitat von brethren
Maybe it's a RAM issue? We'd kinda need more info.Zitat:
Zitat von myschoo
is there no solution to my problem. I tried reinstalling the sdk from svn. that didnt work :(
it prints msg "File has been removed", even when there's no file.txt in ms0:/Code:#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspnand_driver.h>
#include <pspiofilemgr.h>
#include <stdio.h>
PSP_MODULE_INFO("Delete File", 0, 1, 1);
#define printf pspDebugScreenPrintf
int fd;
// ========================================================= CALLBACKS
/* 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;
}
int main() {
SetupCallbacks(); // you forgot something o_O
pspDebugScreenInit(); // same here ........
fd = sceIoOpen("ms0:/file.txt", PSP_O_RDONLY, 0777);
if(!fd) {
sceIoClose(fd);
printf("File doesn't exist");
} else {
sceIoClose(fd);
sceIoRemove("ms0:/file.txt"); // its remove not delete
printf("File has been removed!");
}
sceKernelSleepThread();
return 0;
}
anyone help? o_O
edit also tried:
if(fd==NULL) {
fd < 0
Thanks Archaemic, it does work :tup:
Ugh. At least pretend that you read the header file first. :/
yes it's there... next time i will... i promise :)
Zitat:
* @return A non-negative integer is a valid fd, anything else an error
but zero isnt positve or negative ;) so you better do
because fd is holding some info , so it doesnt may be zero ;)
fd <= 0
That checks for errors (negative) and success (0). Most functions return 0 on success. Meaning this statement will run when there is an error or not.Zitat:
Zitat von hallo007
most functions , but sceIoOpen doesnt , because it returns the data of the SceUID
non-negative is also 0...Zitat:
* @return A non-negative integer is a valid fd, anything else an error
riiight k.Zitat:
Zitat von hallo007
as I said 0 isnt positive or negative and the UID returns info about the file , so it wont be 0
nvm , in the sdk samples it says always fd < 0 , but never saw it return 0 anyway
UIDs can be zero, you know.
Look, go back and read myschoo's last post. Carefully.
what data returns it ? I tought it was a memory adress to the file info
No, an SceUID is a Unique Identifier (that's what UID stands for), not a pointer.
I have coded a prx and am using dsx to print (i prefer it over blit or graphics.c). anyway the downside of dsx is that the webrowser no longer works when the prx is installed. Does anyone know enough about dsx library to help me out? if not is there a way to load and unload the module while in the xmb
maybe try to break the loop, that should stop it and maybe then browser will work... but i dunno how to start it again