//* IP.BIN dumper *//
#include "ds.h"
int main(int argc, char *argv[]) {
FILE *dst_file;
CDROM_TOC toc;
char *secbuf[2048];
char *dirp = "ip.bin";
int start,s_size,istep;
if(cdrom_read_toc(&toc, 0) != 0)
return CMD_ERROR;
start = TOC_LBA(toc.entry[1]);
start = start - 150 ;
s_size = 16;
if ((dst_file = fopen(dirp, "wb"))== NULL)
{
ds_printf("DS_ERROR: Cannot open %s for writing!\n",dirp);
return CMD_ERROR;
}
cdrom_set_sector_size (2048);
for (istep=0;istep<s_size;istep++){
if (cdrom_read_sectors(&secbuf,start+istep,1) != 0){
ds_printf("DS_ERROR: GD-ROM read error\n");
return CMD_ERROR;
}
if (fwrite(secbuf,sizeof(secbuf),1,dst_file) !=1){
ds_printf("DS_ERROR: Error write to file\n");
return CMD_ERROR;
}
}
fclose(dst_file);
return CMD_OK;
}