static void Load(MDFNFILE *fp) { try { const uint64 fp_size = fp->size(); if(fp_size > 1024 * 1024 * 8) // 4MiB maximum ROM size, 2* to be a little tolerant of garbage. throw MDFN_Error(0, _("NGP/NGPC ROM image is too large.")); ngpc_rom.length = fp_size; ngpc_rom.data = new uint8[ngpc_rom.length]; fp->read(ngpc_rom.data, ngpc_rom.length); md5_context md5; md5.starts(); md5.update(ngpc_rom.data, ngpc_rom.length); md5.finish(MDFNGameInfo->MD5); rom_loaded(); MDFN_printf(_("ROM: %uKiB\n"), (ngpc_rom.length + 1023) / 1024); MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str()); FLASH_LoadNV(); MDFNMP_Init(1024, 1024 * 1024 * 16 / 1024); NGPGfx = new NGPGFX_CLASS(); MDFNGameInfo->fps = (uint32)((uint64)6144000 * 65536 * 256 / 515 / 198); // 3072000 * 2 * 10000 / 515 / 198 MDFNGameInfo->GameSetMD5Valid = FALSE; MDFNNGPCSOUND_Init(); MDFNMP_AddRAM(16384, 0x4000, CPUExRAM); SetFRM(); // Set up fast read memory mapping bios_install(); //main_timeaccum = 0; z80_runtime = 0; reset(); } catch(...) { Cleanup(); throw; } }
static int Load(const char *name, MDFNFILE *fp) { if(!(ngpc_rom.data = (uint8 *)MDFN_malloc(GET_FSIZE_PTR(fp), _("Cart ROM")))) return(0); ngpc_rom.length = GET_FSIZE_PTR(fp); memcpy(ngpc_rom.data, GET_FDATA_PTR(fp), GET_FSIZE_PTR(fp)); md5_context md5; md5.starts(); md5.update(ngpc_rom.data, ngpc_rom.length); md5.finish(MDFNGameInfo->MD5); rom_loaded(); MDFN_printf(_("ROM: %dKiB\n"), (ngpc_rom.length + 1023) / 1024); MDFN_printf(_("ROM MD5: 0x%s\n"), md5_context::asciistr(MDFNGameInfo->MD5, 0).c_str()); MDFNMP_Init(1024, 1024 * 1024 * 16 / 1024); NGPGfx = new NGPGFX_CLASS(); MDFNGameInfo->fps = (uint32)((uint64)6144000 * 65536 * 256 / 515 / 198); // 3072000 * 2 * 10000 / 515 / 198 MDFNGameInfo->GameSetMD5Valid = FALSE; MDFNNGPCSOUND_Init(); MDFNMP_AddRAM(16384, 0x4000, CPUExRAM); SetFRM(); // Set up fast read memory mapping bios_install(); //main_timeaccum = 0; z80_runtime = 0; reset(); return(1); }
static MDFN_COLD bool Load(const uint8* romdata, int32 romlength) { const uint64 fp_size = romlength; if (fp_size > 1024 * 1024 * 8) // 4MiB maximum ROM size, 2* to be a little tolerant of garbage. return false; //throw MDFN_Error(0, _("NGP/NGPC ROM image is too large.")); ngpc_rom.length = fp_size; ngpc_rom.data = (uint8*)alloc_plain(ngpc_rom.length); memcpy(ngpc_rom.data, romdata, romlength); rom_loaded(); //if (!FLASH_LoadNV()) // return false; //MDFNMP_Init(1024, 1024 * 1024 * 16 / 1024); NGPGfx = new NGPGFX_CLASS(); //MDFNGameInfo->fps = (uint32)((uint64)6144000 * 65536 * 256 / 515 / 198); // 3072000 * 2 * 10000 / 515 / 198 MDFNNGPCSOUND_Init(); //MDFNMP_AddRAM(16384, 0x4000, CPUExRAM); SetFRM(); // Set up fast read memory mapping bios_install(); //main_timeaccum = 0; z80_runtime = 0; reset(); MDFNNGPC_SetSoundRate(44100); return true; }