OSDN Git Service

[VM][STATE] Use namespace {VMNAME} to separate per VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / tk80bs / display.cpp
index 309b799..28a4d7b 100644 (file)
@@ -11,6 +11,8 @@
 
 #include "display.h"
 
+namespace TK80 {
+
 static const int led_pattern[LED_SIZE_Y][LED_SIZE_X] = {
 #if defined(_TK80BS) || defined(_TK80)
        {9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9},
@@ -146,7 +148,7 @@ void DISPLAY::draw_screen()
                for(int x = 0; x < 256; x += 8) {
                        int code = vram[ptr++];
                        if(code != 0x20) {
-                               vm->draw_ranges = 9;
+                               static_cast<VM *>(vm)->draw_ranges = 9;
                        }
                        code |= code_ofs;
                        uint8_t* font_base = &font[code << 3];
@@ -210,29 +212,19 @@ void DISPLAY::draw_screen()
 
 #define STATE_VERSION  1
 
-void DISPLAY::save_state(FILEIO* state_fio)
-{
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-       
-#if defined(_TK80BS)
-       state_fio->FputInt32(mode);
-#endif
-       state_fio->FputBool(dma);
-}
-
-bool DISPLAY::load_state(FILEIO* state_fio)
+bool DISPLAY::process_state(FILEIO* state_fio, bool loading)
 {
-       if(state_fio->FgetUint32() != STATE_VERSION) {
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
                return false;
        }
-       if(state_fio->FgetInt32() != this_device_id) {
+       if(!state_fio->StateCheckInt32(this_device_id)) {
                return false;
        }
 #if defined(_TK80BS)
-       mode = state_fio->FgetInt32();
+       state_fio->StateInt32(mode);
 #endif
-       dma = state_fio->FgetBool();
+       state_fio->StateBool(dma);
        return true;
 }
 
+}