void CMOS::release() { FILEIO* fio = new FILEIO(); if(fio->Fopen(emu->bios_path(_T("CMOS.BIN")), FILEIO_WRITE_BINARY)) { fio->Fwrite(cmos, sizeof(cmos), 1); fio->Fclose(); } delete fio; }
void RP5C01::release() { #ifndef HAS_RP5C15 // save ram image FILEIO* fio = new FILEIO(); if(fio->Fopen(emu->bios_path(_T("RP5C01.BIN")), FILEIO_WRITE_BINARY)) { fio->Fwrite(ram, sizeof(ram), 1); fio->Fclose(); } delete fio; #endif }
void RAMPAC2::release() { // save modified data if(opened && modified) { FILEIO* fio = new FILEIO(); if(fio->Fopen(path, FILEIO_WRITE_BINARY)) { fio->Fwrite(ram, sizeof(ram), 1); fio->Fclose(); } delete fio; } }
void RTC::release() { // set power off time regs[POFMI] = TO_BCD(cur_time.minute); regs[POFH] = TO_BCD(cur_time.hour); regs[POFD] = TO_BCD(cur_time.day); // save rtc regs image FILEIO* fio = new FILEIO(); if(fio->Fopen(create_local_path(_T("RTC.BIN")), FILEIO_WRITE_BINARY)) { fio->Fwrite(regs + 8, 32, 1); fio->Fclose(); } delete fio; }
VM::~VM() { FILEIO* fio = new FILEIO(); if(fio->Fopen(create_local_path(_T("RAM.BIN")), FILEIO_WRITE_BINARY)) { fio->Fwrite(ram, sizeof(ram), 1); fio->Fclose(); } delete fio; // delete all devices for(DEVICE* device = first_device; device;) { DEVICE *next_device = device->next_device; device->release(); delete device; device = next_device; } }
void save_config() { // get config path _TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH]; GetModuleFileName(NULL, app_path, _MAX_PATH); int pt = _tcslen(app_path); while(pt >= 0 && app_path[pt] != _T('\\')) { pt--; } app_path[pt + 1] = _T('\0'); _stprintf(config_path, _T("%s%s.cfg"), app_path, _T(CONFIG_NAME)); // save config FILEIO* fio = new FILEIO(); if(fio->Fopen(config_path, FILEIO_WRITE_BINARY)) { fio->Fwrite((void *)&config, sizeof(config), 1); fio->Fclose(); } delete fio; }