int SysInit() { #if defined (CPU_LOG) || defined(DMA_LOG) || defined(CDR_LOG) || defined(HW_LOG) || \ defined(BIOS_LOG) || defined(GTE_LOG) || defined(PAD_LOG) emuLog = fopen("/PSXISOS/emu.log", "w"); #endif Config.Cpu = dynacore; //cpu may have changed psxInit(); LoadPlugins(); if(OpenPlugins() < 0) return -1; //Init biosFile pointers and stuff if(biosDevice != BIOSDEVICE_HLE) { biosFile_dir = (biosDevice == BIOSDEVICE_SD) ? &biosDir_libfat_Default : &biosDir_libfat_USB; biosFile_readFile = fileBrowser_libfat_readFile; biosFile_open = fileBrowser_libfat_open; biosFile_init = fileBrowser_libfat_init; biosFile_deinit = fileBrowser_libfat_deinit; if(biosFile) { free(biosFile); } biosFile = (fileBrowser_file*)memalign(32,sizeof(fileBrowser_file)); memcpy(biosFile,biosFile_dir,sizeof(fileBrowser_file)); strcat(biosFile->name, "/SCPH1001.BIN"); biosFile_init(biosFile); //initialize the bios device (it might not be the same as ISO device) Config.HLE = BIOS_USER_DEFINED; } else { Config.HLE = BIOS_HLE; } return 0; }
upse_psf_t *upse_load(char *path, upse_iofuncs_t * iofuncs) { upse_psf_t *ret; _ENTER; psxInit(); psxReset(); SPUinit(); SPUopen(); if (!(ret = _upse_load(path, 0, 0, iofuncs))) { psxShutdown(); return NULL; } if (ret->stop == (u32) ~ 0) ret->fade = 0; SPUsetlength(ret->stop, ret->fade); ret->length = ret->stop + ret->fade; _LEAVE; return ret; }
int emuLoadRom( QString * romFile ){ if( romFile->isEmpty()) return 0; SetIsoFile(romFile->toLatin1().data()); if (psxInit() == -1) { printf("PSX emulator couldn't be initialized.\n"); emuClose(); return 0; } if (LoadPlugins() == -1) { printf("Failed loading plugins.\n"); emuClose(); return 0; } psxReset(); return 1; }
PSFINFO *sexy_load(char *path,const char *pathDir,int loop_infinite) { PSFINFO *ret; if( psxInit() < 0 ) return(0); psxReset(); sexySPUinit(); sexySPUopen(); if(!(ret=LoadPSF(path,0,0,pathDir))) { psxShutdown(); return(0); } strcpy(save_path,path); strcpy(save_pathDir,pathDir); // Taken from aosdk's eng_psf.c file ... // patch illegal Chocobo Dungeon 2 code - CaitSith2 put a jump in the delay slot from a BNE // and rely on Highly Experimental's buggy-ass CPU to rescue them. Verified on real hardware // that the initial code is wrong. if (ret->game) { if (!strcmp(ret->game, "Chocobo Dungeon 2")) { if (psxMu32(0xbc090) == (0x0802f040)) { psxMemWrite32(0xbc090, 0); psxMemWrite32(0xbc094, 0x0802f040); psxMemWrite32(0xbc098, 0); } } } if(ret->stop==~0) { ret->fade=10000; // Infinity ? limit to 3 minutes ret->stop=170000; } if (loop_infinite) { ret->stop=~0; } sexysetlength(ret->stop,ret->fade); ret->length=ret->stop+ret->fade; return(ret); }
PSFINFO *sexy_load(char *path) { PSFINFO *ret; psxInit(); psxReset(); SPUinit(); SPUopen(); if(!(ret=LoadPSF(path,0,0))) { psxShutdown(); return(0); } if(ret->stop==~0) ret->fade=0; // Infinity+anything is still infinity...or is it? SPUsetlength(ret->stop,ret->fade); ret->length=ret->stop+ret->fade; return(ret); }
PSFINFO *sexy_memload(char *addr, int size) { PSFINFO *ret; psxInit(); psxReset(); sexySPUinit(); sexySPUopen(); if(!(ret=memLoadPSF(addr,size,0,0))) { psxShutdown(); return(0); } // Taken from aosdk's eng_psf.c file ... // patch illegal Chocobo Dungeon 2 code - CaitSith2 put a jump in the delay slot from a BNE // and rely on Highly Experimental's buggy-ass CPU to rescue them. Verified on real hardware // that the initial code is wrong. if (ret->game) { if (!strcmp(ret->game, "Chocobo Dungeon 2")) { if (psxMu32(0xbc090) == (0x0802f040)) { psxMemWrite32(0xbc090, 0); psxMemWrite32(0xbc094, 0x0802f040); psxMemWrite32(0xbc098, 0); } } } if(ret->stop==~0) ret->fade=0; // Infinity+anything is still infinity...or is it? setlength(ret->stop,ret->fade); ret->length=ret->stop+ret->fade; return(ret); }
int SysInit() { #ifdef GTE_DUMP gteLog = fopen("gteLog.txt","wb"); setvbuf(gteLog, NULL, _IONBF, 0); #endif #ifdef EMU_LOG #ifndef LOG_STDOUT emuLog = fopen("emuLog.txt","wb"); #else emuLog = stdout; #endif setvbuf(emuLog, NULL, _IONBF, 0); SysMessage(PSX4ALL_INT); fflush(emuLog); #endif psxInit(); LoadMcds(Config.Mcd1, Config.Mcd2); return 0; }
int EmuInit() { return psxInit(); }