X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=source%2Fsrc%2Fvm%2Fbabbage2nd%2Fdisplay.cpp;h=655ef119303d1ad8419a65406ce82a63827c7fe3;hb=9657068762e0ebc1ed5a42638db31cdcdda7c9db;hp=10849b3af8515b3e76750630c65a20a089202dcc;hpb=6698678c957cc70a359a71c9994f662d6a2d780a;p=csp-qt%2Fcommon_source_project-fm7.git diff --git a/source/src/vm/babbage2nd/display.cpp b/source/src/vm/babbage2nd/display.cpp index 10849b3af..655ef1193 100644 --- a/source/src/vm/babbage2nd/display.cpp +++ b/source/src/vm/babbage2nd/display.cpp @@ -8,7 +8,7 @@ */ #include "display.h" - +namespace BABBAGE2ND { static const int pat_7seg_led[58][34] = { {0,6,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2}, {0,6,6,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,2,2}, @@ -162,51 +162,18 @@ void DISPLAY::draw_screen() #define STATE_VERSION 1 -#include "../../statesub.h" - -void DISPLAY::decl_state() -{ - enter_decl_state(STATE_VERSION); - - DECL_STATE_ENTRY_2D_ARRAY(seg, 6, 7); - DECL_STATE_ENTRY_UINT8(ls373); - DECL_STATE_ENTRY_UINT8(pio_7seg); - DECL_STATE_ENTRY_UINT8(pio_8bit); - - leave_decl_state(); -} - -void DISPLAY::save_state(FILEIO* state_fio) +bool DISPLAY::process_state(FILEIO* state_fio, bool loading) { - if(state_entry != NULL) { - state_entry->save_state(state_fio); + if(!state_fio->StateCheckUint32(STATE_VERSION)) { + return false; } - //state_fio->FputUint32(STATE_VERSION); - //state_fio->FputInt32(this_device_id); - - //state_fio->Fwrite(seg, sizeof(seg), 1); - //state_fio->FputUint8(ls373); - //state_fio->FputUint8(pio_7seg); - //state_fio->FputUint8(pio_8bit); -} - -bool DISPLAY::load_state(FILEIO* state_fio) -{ - bool mb = false; - if(state_entry != NULL) { - mb = state_entry->load_state(state_fio); + if(!state_fio->StateCheckInt32(this_device_id)) { + return false; } - if(!mb) return false; - //if(state_fio->FgetUint32() != STATE_VERSION) { - // return false; - //} - //if(state_fio->FgetInt32() != this_device_id) { - // return false; - //} - //state_fio->Fread(seg, sizeof(seg), 1); - //ls373 = state_fio->FgetUint8(); - //pio_7seg = state_fio->FgetUint8(); - //pio_8bit = state_fio->FgetUint8(); + state_fio->StateBuffer(seg, sizeof(seg), 1); + state_fio->StateUint8(ls373); + state_fio->StateUint8(pio_7seg); + state_fio->StateUint8(pio_8bit); return true; } - +}