#include "rampac2.h"
-static const uint8 header[16] = {
+static const uint8_t header[16] = {
0xaa, 0x1f, 0x04, 0x00, 0x04, 0x80, 0x00, 0x01, 0x04, 0x04, 0x01, 0x03, 0x08, 0x00, 0x00, 0x00
};
open_file(config.recent_binary_path[id - 1][0]);
} else {
// open default rampac2 file
- _TCHAR file_path[_MAX_PATH];
- _stprintf_s(file_path, _MAX_PATH, _T("%sRAMPAC%d.BIN"), emu->application_path(), id);
- open_file(file_path);
+ open_file(create_local_path(_T("RAMPAC%d.BIN"), id));
}
}
ptr = 0;
}
-void RAMPAC2::write_io8(uint32 addr, uint32 data)
+void RAMPAC2::write_io8(uint32_t addr, uint32_t data)
{
switch(addr & 0xff) {
case 0x18:
}
}
-uint32 RAMPAC2::read_io8(uint32 addr)
+uint32_t RAMPAC2::read_io8(uint32_t addr)
{
return ram[ptr & 0x7fff];
}
}
delete fio;
- _tcscpy_s(path, _MAX_PATH, file_path);
+ my_tcscpy_s(path, _MAX_PATH, file_path);
opened = true;
modified = false;
}
#define STATE_VERSION 1
-void RAMPAC2::save_state(FILEIO* state_fio)
+bool RAMPAC2::process_state(FILEIO* state_fio, bool loading)
{
- state_fio->FputUint32(STATE_VERSION);
-
- state_fio->Fwrite(ram, sizeof(ram), 1);
- state_fio->FputUint32(ptr);
- state_fio->FputBool(opened);
- state_fio->FputBool(modified);
-}
-
-bool RAMPAC2::load_state(FILEIO* state_fio)
-{
- if(state_fio->FgetUint32() != STATE_VERSION) {
+ if(!state_fio->StateCheckUint32(STATE_VERSION)) {
return false;
}
- state_fio->Fread(ram, sizeof(ram), 1);
- ptr = state_fio->FgetUint32();
- opened = state_fio->FgetBool();
- modified = state_fio->FgetBool();
+ state_fio->StateBuffer(ram, sizeof(ram), 1);
+ state_fio->StateUint32(ptr);
+ state_fio->StateBool(opened);
+ state_fio->StateBool(modified);
return true;
}
-