I can't usre standard C IO library because they seems to crash PSPemu (fopen) so i managed to convert my code to sceIo library but i don't know where i'm wrong.
What i have to do is to write a file content in a string array as a buffer (like bin2c.exe does) but when i goes to create the buffer, i get strange character sometimes ("msQ" instead of "ms0", "<eof>" not as a escape character but as text and other strange things).
This is my current code (runScript loads the buffer as chunks of LUA code in LUA interpreter):
Code: Select all
SceUID fp = sceIoOpen(script, PSP_O_RDONLY,0777);
int size = sceIoLseek(fp, 0, SEEK_END);
sceIoLseek(fp, 0, SEEK_SET);
unsigned char *buffer = malloc(size);
sceIoRead(fp, buffer, size);
sceIoClose(fp);
debugOutput("\nLaunching script");
errMsg = runScript(buffer, true);
free(buffer);
Advertising