/*
Eboot.pbp
Relative pseudo C
*/
int Exit(char *message)
{
printf("%s", message); //genius work, really
sceKernelDelayThread(0x3D0900);
sceKernelExitGame();
}
int WriteFile(const char *file, void *buffer, SceSize size) //Awesome error handling ;)
{
SceUID fd = sceIoOpen(file, PSP_O_CREAT | PSP_O_TRUNC | PSP_O_WRONLY, 511);
int ret = sceIoWrite(fd, buffer, size);
sceIoClose(fd);
return ret;
}
void FlashFiles() //bet you had fun writing this ;)
{
if (WriteFile("flash0:/kd/vshctrl.prx", vshctrl, size_vshctrl) != size_vshctrl)
{
Exit("Error writting vshctrl.");
}
if (WriteFile("flash0:/kd/galaxy.prx", galaxy, size_galaxy) != size_galaxy)
{
Exit("Error writting galaxy.");
}
if (WriteFile("flash0:/kd/march33.prx", march33, size_march33) != size_march33)
{
Exit("Error writting march33.");
}
if (WriteFile("flash0:/kd/popcorn.prx", popcorn, size_popcorn) != size_popcorn)
{
Exit("Error writting popcorn.");
}
if (WriteFile("flash0:/kd/idcanager.prx", idcanager, size_idcanager) != size_idcanager)
{
Exit("Error writting idcanager.");
}
if (WriteFile("flash0:/kd/usbdevice.prx", usbdevice, size_usbdevice) != size_usbdevice)
{
Exit("Error writting usbdevice.");
}
if (WriteFile("flash0:/vsh/module/satelite.prx", satelite, size_satelite) != size_satelite)
{
Exit("Error writting satelite.");
}
if (WriteFile("flash0:/kd/systemctrl_02g.prx", systemctrl_02g, size_systemctrl_02g) != size_systemctrl_02g)
{
Exit("Error writting systemctrl.");
}
if (WriteFile("flash0:/kd/pspbtlnf_02g.bin", pspbtlnf_02g, size_pspbtlnf_02g) != size_pspbtlnf_02g)
{
Exit("Error writting pspbtlnf.");
}
if (WriteFile("flash0:/kd/pspbtlnf_02g.bin", pspbtdnf_02g, size_pspbtdnf_02g) != size_pspbtdnf_02g)
{
Exit("Error writting pspbtdnf.");
}
if (WriteFile("flash0:/kd/pspbtjnf_02g.bin", pspbtjnf_02g, size_pspbtjnf_02g) != size_pspbtjnf_02g)
{
Exit("Error writting pspbtjnf.");
}
if (WriteFile("flash0:/kd/pspbtknf_02g.bin", pspbtknf_02g, size_pspbtknf_02g) != size_pspbtknf_02g)
{
Exit("Error writting pspbtknf.");
}
}
int main() //why store strings in vars?
{
SceIoStat stat;
SceCtrlData pad;
int model; //initalize?
pspDebugScreenInit();
printf("Hen de los huevos, como falla el cabron. Custom Firmware Enabler 1.0\nBy Xenogears and Becus25\n\n");
printf("Press O to flash M33 custom firmware files into the flash.\nPress X to run the custom firmware.\nPress R to exit.\n");
while (1)
{
sceCtrlReadBufferPositive(&pad, 1);
if (pad.Buttons & PSP_CTRL_CROSS)
{
pspDebugScreenClear();
printf("\nLoading henctrl.prx...");
SceUID modid = sceKernelLoadModule("henctrl.prx", 0, NULL);
if (modid < 0)
{
Exit(" Error loading henctrl.prx");
}
printf("\nStarting henctrl.prx...");
sceKernelStartModule(modid, strlen("henctrl.prx") + 1, "henctrl.prx", NULL, NULL, NULL);
printf("Wait 5 seconds...")'
sceKernelDelayThread(0x4C4B40);
sceKernelExitGame();
}
else if (pad.Buttons & PSP_CTRL_CIRCLE)
{
if (sceIoUnassign("flash0:") < 0)
{
Exit("Error unassigning flash0:");
}
if (sceIoAssign("flash0:", "lflash0:0,0", "flashfat0:", IOASSIGN_RDWR, NULL, 0) < 0)
{
Exit("Error assigning flash0:");
}
if (!sceIoGetstat("flash0:/kd/loadexec_01g.prx", &stat)) //hello? sceKernelGetModel? >.>
model = 0;
if ((ret = sceIoGetstat("flash0:/kd/loadexec_02g.prx", &stat)) < 0 && model != ret) //model isn't even predefined...
{
Exit("Your PSP is not 2000. Exiting...");
}
else
model = 1;
printf("\nFlashing...");
FlashFiles();
printf("Done.\n\nPress X to run the custom firmware.");
}
else if (pad.Buttons & PSP_CTRL_RTRIGGER)
{
Exit("Exiting...");
}
}
return 0; //nice program flow control
}