int handleInputFile(char *romName) { SceUID romFile; int iDepth = 0; int size; printf("handle"); initSysInfo(); //initialize it all //if it's a ZIP file, we need to handle that here. iDepth = strrchr2(romName, '.'); iDepth++; if( ( strcmp( romName + iDepth, "zip" ) == 0 ) || ( strcmp( romName + iDepth, "ZIP" ) == 0 )) { //get ROM from ZIP printf("check_zip %s",romName); if(check_zip(romName)) { char name[_MAX_PATH]; printf("loadfromzip"); if(!loadFromZipByName(mainrom, romName, name, &size)) { printf("Load failed from %s\n", romName); return 0; } m_emuInfo.romSize = size; printf("strcpy %d",size); strcpy(m_emuInfo.RomFileName, romName); printf("strcpy %d",size); } else { printf("%s not PKZIP file\n", romName); return 0; } } else { //get ROM from binary ROM file romFile = sceIoOpen(romName,PSP2_O_RDONLY,0777); if(romFile<=0) { printf("Couldn't open %s file\n", romName); return 0; } m_emuInfo.romSize = sceIoRead(romFile,mainrom,4*1024*1024); strcpy(m_emuInfo.RomFileName, romName); } printf("initRom"); if(!initRom()) { printf("initRom couldn't handle %s file\n", romName); return 0; } printf("setflashSize"); setFlashSize(m_emuInfo.romSize); return 1; }
void d_basename(const char *filename, const char *newext, dstr output) { const char *start; char *dot; start = strrchr2(filename, '/', '\\'); if (start) strcpy(output, start + 1); else strcpy(output, filename); if (newext) { dot = strrchr(output, '.'); if (dot) strcpy(dot, newext); else strcat(output, newext); } }