OSDN Git Service

[VM_TEMPLATE] Make VM_TEMPLATE::reset() incluse common routine.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 27 Nov 2022 06:20:44 +0000 (15:20 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Sun, 27 Nov 2022 06:20:44 +0000 (15:20 +0900)
No need to define VM::reset() if has no specified process.

[VM_TEMPLATE] Add initialize_deviced() and release_devices()
              as common proccess for constructor and destructor.
[VM_TEMPLATE] Add lacked API.
[VM_TEMPLATE] Fix warning around _TCHAR* .

source/src/vm/vm_template.cpp
source/src/vm/vm_template.h

index dd1b8eb..f8c9be9 100644 (file)
@@ -23,6 +23,9 @@ VM_TEMPLATE::VM_TEMPLATE(EMU_TEMPLATE* parent_emu) :
 // drive virtual machine
 void VM_TEMPLATE::reset()
 {
+       for(DEVICE* device = first_device; device; device = device->next_device) {
+               device->reset();
+       }
 }
 
 void VM_TEMPLATE::special_reset(int num)
@@ -59,6 +62,16 @@ void VM_TEMPLATE::initialize_devices()
        }
 }
 
+void VM_TEMPLATE::release_devices()
+{
+       for(DEVICE* device = first_device; device;) {
+               DEVICE *next_device = device->next_device;
+               device->release();
+               delete device;
+               device = next_device;
+       }
+}
+
 void VM_TEMPLATE::update_dipswitch()
 {
 }
@@ -319,6 +332,11 @@ bool VM_TEMPLATE::is_floppy_disk_protected(int drv)
        return false;
 }
 
+bool VM_TEMPLATE::is_bubble_casette_inserted(int drv)
+{
+       return false;
+}
+
 void VM_TEMPLATE::is_bubble_casette_protected(int drv, bool flag)
 {
 }
index 012b793..b1e028b 100644 (file)
@@ -26,13 +26,14 @@ protected:
        {
                return m_state_version;
        }
-       inline void set_git_repo_version(_TCHAR* p)
+       inline void set_git_repo_version(const char* p)
        {
                if(p != nullptr) {
                        m_git_revision = std::string(p);
                }
        }
-       void initialize_devices();
+       virtual void initialize_devices();
+       virtual void release_devices();
 public:
        VM_TEMPLATE(EMU_TEMPLATE* parent_emu);
        virtual ~VM_TEMPLATE() {} // OK?
@@ -121,6 +122,8 @@ public:
        
        virtual void is_floppy_disk_protected(int drv, bool value);
        virtual bool is_floppy_disk_protected(int drv);
+       
+       virtual bool is_bubble_casette_inserted(int drv);
        virtual void is_bubble_casette_protected(int drv, bool flag);
        virtual bool is_bubble_casette_protected(int drv);