main.c
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspiofilemgr.h>
#include <pspctrl.h>
#include <pspumd.h>
#define printf pspDebugScreenPrintf
#define setxy pspDebugScreenSetXY
#define settcolor pspDebugScreenSetTextColor
#define WHITE 0xFFFFFF
#define RED 0x0000FF
#define GREEN 0x00FF00
#define BLUE 0xFF0000
#define CYAN 0xFFFF00
#define YELLOW 0x00FFFF
#define BLACK 0x000000
PSP_MODULE_INFO("UMD_DUMPER",0x1000,1,1);
PSP_MAIN_THREAD_ATTR(0);
PSP_HEAP_SIZE_KB(20000);
void dump_threadstatus(void);
int done=0;
int exit_callback(int arg1, int arg2, void *common)
{
done=1;
return 0;
}
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread,0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
char write_buffer[128*1024];
void write_file(const char *readpath, const char *writepath)
{
int fdin;
int fdout;
fdin = sceIoOpen(readpath, PSP_O_RDONLY, 0777);
if(fdin >= 0)
{
int bytesRead = 1;
fdout = sceIoOpen(writepath, PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0777);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
while((bytesRead > 0) && (fdout >= 0))
{
sceIoWrite(fdout, write_buffer, bytesRead);
bytesRead = sceIoRead(fdin, write_buffer, sizeof(write_buffer));
}
if(fdout >= 0)
{
sceIoClose(fdout);
}
if(fdin >= 0)
{
sceIoClose(fdin);
}
}
}
int main(){
int i;
i = sceUmdCheckMedium();
if(i == 0)
{
sceUmdWaitDriveStat(PSP_UMD_PRESENT);
}
sceUmdActivate(1, "disc0:");
sceUmdWaitDriveStat(PSP_UMD_READY);
SceCtrlData pad;
pspDebugScreenInit();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while(!done){
sceCtrlReadBufferPositive(&pad,1);
if(pad.Buttons!=0){
if(pad.Buttons & PSP_CTRL_UP) write_file("disc0:/UMD9660.ISO","ms0:/ISO/UMD9660.ISO");
}
setxy(1,1);
settcolor(YELLOW);
printf("UMD Dumper");
setxy(0,2);
settcolor(CYAN);
printf("--------------------------------------------------------------------");
setxy(1,3);
settcolor(YELLOW);
printf("By vladgalay");
setxy(0,4);
settcolor(CYAN);
printf("--------------------------------------------------------------------");
setxy(1,5);
settcolor(GREEN);
printf("Press X to dump UMD");
setxy(0,6);
settcolor(CYAN);
printf("--------------------------------------------------------------------");
}
sceKernelExitGame();
return 0;
}
Makefile
TARGET = umd_dump
OBJS = main.o
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = UMD DUMPER
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak