OSDN Git Service

[VM] Apply new APIs to all VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmr30 / fmr30.cpp
index 1af5330..7add7d3 100644 (file)
@@ -218,11 +218,10 @@ VM::VM(EMU_TEMPLATE* parent_emu) : VM_TEMPLATE(parent_emu)
        
        // initialize all devices
 #if defined(__GIT_REPO_VERSION)
-       strncpy(_git_revision, __GIT_REPO_VERSION, sizeof(_git_revision) - 1);
+       set_git_repo_version(__GIT_REPO_VERSION);
 #endif
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               device->initialize();
-       }
+       initialize_devices();
+       
        for(int drv = 0; drv < USE_HARD_DISK; drv++) {
                if(!(config.last_hard_disk_path[drv][0] != _T('\0') && FILEIO::IsFileExisting(config.last_hard_disk_path[drv]))) {
                        create_local_path(config.last_hard_disk_path[drv], _MAX_PATH, _T("SCSI%d.DAT"), drv);
@@ -458,31 +457,8 @@ uint64_t VM::get_current_clock_uint64()
 
 bool VM::process_state(FILEIO* state_fio, bool loading)
 {
-       if(!state_fio->StateCheckUint32(STATE_VERSION)) {
+       if(!(VM_TEMPLATE::process_state_core(state_fio, loading, STATE_VERSION))) {
                return false;
        }
-       for(DEVICE* device = first_device; device; device = device->next_device) {
-               const _TCHAR *name = char_to_tchar(typeid(*device).name() + 6); // skip "class "
-               int len = (int)_tcslen(name);
-               
-               if(!state_fio->StateCheckInt32(len)) {
-                       if(loading) {
-                               printf("Class name len Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
-                       }
-                       return false;
-               }
-               if(!state_fio->StateCheckBuffer(name, len, 1)) {
-                       if(loading) {
-                               printf("Class name Error: DEVID=%d EXPECT=%s\n", device->this_device_id, name);
-                       }
-                       return false;
-               }
-               if(!device->process_state(state_fio, loading)) {
-                       if(loading) {
-                               printf("Data loading Error: DEVID=%d\n", device->this_device_id);
-                       }
-                       return false;
-               }
-       }
        return true;
 }