OSDN Git Service

[LIBCPU_NEWDEV] Fix FTBFS.
[csp-qt/common_source_project-fm7.git] / source / src / vm / v9938.cpp
index 5b36fad..15a28b6 100644 (file)
@@ -64,7 +64,8 @@ enum
 
 #define EXPMEM_OFFSET 0x20000
 
-#define LONG_WIDTH (512 + 32)
+// LONG_WIDTH has already defined limits.h for GCC.20180614 K.O
+#define _V9938_LONG_WIDTH (512 + 32)
 
 static const char *const v9938_modes[] = {
        "TEXT 1", "MULTICOLOR", "GRAPHIC 1", "GRAPHIC 2", "GRAPHIC 3",
@@ -93,7 +94,7 @@ at most 192 KiB RAM (128 KiB base, 64 KiB expansion).
 
 //v99x8_device::v99x8_device(const machine_config &mconfig, device_type type, const char *name, const char *shortname, const char *tag, device_t *owner, UINT32 clock)
 //:   device_t(mconfig, type, name, tag, owner, clock, shortname, __FILE__),
-v99x8_device::v99x8_device(VM* parent_vm, EMU* parent_emu)
+v99x8_device::v99x8_device(VM_TEMPLATE* parent_vm, EMU* parent_emu)
 :   DEVICE(parent_vm, parent_emu),
 //     device_memory_interface(mconfig, *this),
 //     device_video_interface(mconfig, *this),
@@ -131,7 +132,7 @@ v99x8_device::v99x8_device(VM* parent_vm, EMU* parent_emu)
 
 //v9938_device::v9938_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
 //: v99x8_device(mconfig, V9938, "V9938 VDP", "v9938", tag, owner, clock)
-v9938_device::v9938_device(VM* parent_vm, EMU* parent_emu)
+v9938_device::v9938_device(VM_TEMPLATE* parent_vm, EMU* parent_emu)
 : v99x8_device(parent_vm, parent_emu)
 {
        m_model = MODEL_V9938;
@@ -141,7 +142,7 @@ v9938_device::v9938_device(VM* parent_vm, EMU* parent_emu)
 
 //v9958_device::v9958_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
 //: v99x8_device(mconfig, V9938, "V9958 VDP", "v9958", tag, owner, clock)
-v9958_device::v9958_device(VM* parent_vm, EMU* parent_emu)
+v9958_device::v9958_device(VM_TEMPLATE* parent_vm, EMU* parent_emu)
 : v99x8_device(parent_vm, parent_emu)
 {
        m_model = MODEL_V9958;
@@ -961,7 +962,7 @@ void v99x8_device::default_border(const scrntype_t *pens, scrntype_t *ln)
        int i;
 
        pen = pens[m_pal_ind16[(m_cont_reg[7]&0x0f)]];
-       i = LONG_WIDTH;
+       i = _V9938_LONG_WIDTH;
        while (i--) *ln++ = pen;
 }
 
@@ -971,7 +972,7 @@ void v99x8_device::graphic7_border(const scrntype_t *pens, scrntype_t *ln)
        int i;
 
        pen = pens[m_pal_ind256[m_cont_reg[7]]];
-       i = LONG_WIDTH;
+       i = _V9938_LONG_WIDTH;
        while (i--) *ln++ = pen;
 }
 
@@ -983,7 +984,7 @@ void v99x8_device::graphic5_border(const scrntype_t *pens, scrntype_t *ln)
 
        pen1 = pens[m_pal_ind16[(m_cont_reg[7]&0x03)]];
        pen0 = pens[m_pal_ind16[((m_cont_reg[7]>>2)&0x03)]];
-       i = LONG_WIDTH / 2;
+       i = _V9938_LONG_WIDTH / 2;
        while (i--) { *ln++ = pen0; *ln++ = pen1; }
 }
 
@@ -1886,14 +1887,14 @@ void v99x8_device::refresh_16(int line)
        if (m_cont_reg[9] & 0x08)
        {
 //             ln = &m_bitmap.pix16(m_scanline*2+((m_stat_reg[2]>>1)&1));
-               ln = screen+(m_scanline*2+((m_stat_reg[2]>>1)&1))*LONG_WIDTH;
+               ln = screen+(m_scanline*2+((m_stat_reg[2]>>1)&1))*_V9938_LONG_WIDTH;
        }
        else
        {
 //             ln = &m_bitmap.pix16(m_scanline*2);
 //             ln2 = &m_bitmap.pix16(m_scanline*2+1);
-               ln = screen+(m_scanline*2)*LONG_WIDTH;
-               ln2 = screen+(m_scanline*2+1)*LONG_WIDTH;
+               ln = screen+(m_scanline*2)*_V9938_LONG_WIDTH;
+               ln2 = screen+(m_scanline*2+1)*_V9938_LONG_WIDTH;
                double_lines = true;
        }
 
@@ -3117,9 +3118,10 @@ void v99x8_device::draw_screen()
        scrntype_t *dst;
        int y;
        if(osd == NULL) return;
+       emu->set_vm_screen_lines(__SCREEN_HEIGHT);
        for(y=0; y< __SCREEN_HEIGHT; y++) {
                if((dst = osd->get_vm_screen_buffer(y)) != NULL) {
-                       my_memcpy(dst, screen+(y+18)*LONG_WIDTH+2, __SCREEN_WIDTH*sizeof(scrntype_t));
+                       my_memcpy(dst, screen+(y+18)*_V9938_LONG_WIDTH+2, __SCREEN_WIDTH*sizeof(scrntype_t));
                }
        }
 }
@@ -3161,26 +3163,16 @@ void v99x8_device::write_signal(int id, uint32_t data, uint32_t mask)
 
 #define STATE_VERSION  2
 
-void v99x8_device::save_state(FILEIO* state_fio)
+bool v99x8_device::process_state(FILEIO* state_fio, bool loading)
 {
-       state_fio->FputUint32(STATE_VERSION);
-       state_fio->FputInt32(this_device_id);
-
-       save_load_state(state_fio, true);
-}
-
-bool v99x8_device::load_state(FILEIO* state_fio)
-{
-       if(state_fio->FgetUint32() != STATE_VERSION) {
-               return false;
-       }
-       if(state_fio->FgetInt32() != this_device_id) {
-               return false;
-       }
-
-       save_load_state(state_fio, false);
-
-       return true;
+       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+               return false;
+       }
+       if(!state_fio->StateCheckInt32(this_device_id)) {
+               return false;
+       }
+       save_load_state(state_fio, !loading);
+       return true;
 }
 
 void v99x8_device::save_load_state(FILEIO* state_fio, bool is_save)