hey does this not work with binary files?
im doing a test with an mp3 and it doesn't load the file correctly.
#include "pbpPlus/pbpPlus.h"
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include "mp3player.h"
#include <stdio.h>
#include <string.h>
PSP_MODULE_INFO("Mp3 Player Example", 0, 1, 1);
#define printf pspDebugScreenPrintf
// TWILIGHT ZONE! <do doo do doo>
/* 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;
}
// END OF TWILIGHT ZONE! <do doo do do>
void* pbpFileContext = NULL;
int main()
{
pspDebugScreenInit();
pbpFileContext = pbpPlusOpen("./EBOOT.PBP");
char* tempString = pbpPlusFileRead(pbpFileContext, "1.mp3");
char buffer[5*1024];
FILE* outfile = fopen("1.mp3", "w");
if(tempString) {
pspDebugScreenSetXY(0, 2);
pspDebugScreenPrintf(tempString);
} else {
pspDebugScreenPrintf("Error loading files from PBP.");
}
strcpy(buffer,tempString);
fprintf(outfile,buffer);
printf("printing file.");
fclose(outfile);
printf("closing file");
scePowerSetClockFrequency(333, 333, 166);
SetupCallbacks();
pspAudioInit();
SceCtrlData pad;
int i;
MP3_Init(1);
MP3_Load("1.mp3");
MP3_Play();
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
}
else
if(pad.Buttons & PSP_CTRL_CIRCLE) {
MP3_Pause();
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
if (MP3_EndOfStream() == 1) {
MP3_Stop();
}
}
MP3_Stop();
MP3_FreeTune();
sceKernelSleepThread();
return 0;}