OSDN Git Service

[BUILD] Set SOVERSION and GIT hash automatically.
[csp-qt/common_source_project-fm7.git] / source / src / vm / msx / msx.cpp
index 550ded6..e504736 100644 (file)
@@ -51,7 +51,7 @@
 // initialize
 // ----------------------------------------------------------------------------
 
-VM::VM(EMU* parent_emu) : emu(parent_emu)
+VM::VM(EMU* parent_emu) : VM_TEMPLATE(parent_emu)
 {
        // create devices
        first_device = last_device = NULL;
@@ -106,16 +106,6 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
 #if defined(_PX7)
        event->set_context_sound(ldp);
 #endif
-#if defined(USE_SOUND_FILES)
-#if defined(USE_FD1)
-       //if(memory->load_sound_data(MEMORY_SND_TYPE_DISK_SEEK, _T("FDDSEEK.WAV"))) {
-       //      event->set_context_sound(memory);
-       //}
-#endif
-       //drec->load_sound_data(DATAREC_SNDFILE_EJECT, _T("CMTEJECT.WAV"));
-       drec->load_sound_data(DATAREC_SNDFILE_RELAY_ON, _T("RELAY_ON.WAV"));
-       drec->load_sound_data(DATAREC_SNDFILE_RELAY_OFF, _T("RELAYOFF.WAV"));
-#endif
        event->set_context_sound(drec->get_context_noise_play());
        event->set_context_sound(drec->get_context_noise_stop());
        event->set_context_sound(drec->get_context_noise_fast());
@@ -177,6 +167,9 @@ VM::VM(EMU* parent_emu) : emu(parent_emu)
        io->set_iomap_range_rw(0xfc, 0xff, memory);
        
        // initialize all devices
+#if defined(__GIT_REPO_VERSION)
+       strncpy(_git_revision, __GIT_REPO_VERSION, sizeof(_git_revision) - 1);
+#endif
        for(DEVICE* device = first_device; device; device = device->next_device) {
                device->initialize();
        }
@@ -280,33 +273,20 @@ void VM::movie_sound_callback(uint8_t *buffer, long size)
 #ifdef USE_SOUND_VOLUME
 void VM::set_sound_device_volume(int ch, int decibel_l, int decibel_r)
 {
-       if(ch == 0) {
+       if(ch-- == 0) {
                psg->set_volume(1, decibel_l, decibel_r);
-       } else if(ch == 1) {
+       } else if(ch-- == 0) {
                pcm->set_volume(0, decibel_l, decibel_r);
-       } else if(ch == 2) {
+       } else if(ch-- == 0) {
                drec->set_volume(0, decibel_l, decibel_r);
 #if defined(_PX7)
-       } else if(ch == 3) {
+       } else if(ch-- == 0) {
                ldp->set_volume(0, decibel_l, decibel_r);
 #endif
-#if defined(USE_SOUND_FILES)
-#if defined(USE_FD1)
-               //} else if(ch == 3) {
-               //memory->set_volume(MEMORY_SND_TYPE_FDD_SEEK, decibel_l, decibel_r);
-#endif
-#if defined(_PX7)
-       } else if(ch == 4) {
-               drec->set_volume(2 + DATAREC_SNDFILE_RELAY_ON, decibel_l, decibel_r);
-               drec->set_volume(2 + DATAREC_SNDFILE_RELAY_OFF, decibel_l, decibel_r);
-               //drec->set_volume(2 + DATAREC_SNDFILE_EJECT, decibel_l, decibel_r);
-#else
-       } else if(ch == 3) {
-               drec->set_volume(2 + DATAREC_SNDFILE_RELAY_ON, decibel_l, decibel_r);
-               drec->set_volume(2 + DATAREC_SNDFILE_RELAY_OFF, decibel_l, decibel_r);
-               //drec->set_volume(2 + DATAREC_SNDFILE_EJECT, decibel_l, decibel_r);
-#endif
-#endif
+       } else if(ch-- == 0) {
+               drec->get_context_noise_play()->set_volume(0, decibel_l, decibel_r);
+               drec->get_context_noise_stop()->set_volume(0, decibel_l, decibel_r);
+               drec->get_context_noise_fast()->set_volume(0, decibel_l, decibel_r);
        }
 }
 #endif
@@ -344,61 +324,101 @@ bool VM::is_cart_inserted(int drv)
        }
 }
 
-void VM::play_tape(const _TCHAR* file_path)
+void VM::play_tape(int drv, const _TCHAR* file_path)
 {
        drec->play_tape(file_path);
+//     drec->set_remote(true);
 }
 
-void VM::rec_tape(const _TCHAR* file_path)
+void VM::rec_tape(int drv, const _TCHAR* file_path)
 {
        drec->rec_tape(file_path);
+//     drec->set_remote(true);
 }
 
-void VM::close_tape()
+void VM::close_tape(int drv)
 {
-#if defined(USE_SOUND_FILES)
-       //drec->write_signal(SIG_SOUNDER_ADD + DATAREC_SNDFILE_EJECT, 1, 1);
-#endif
        emu->lock_vm();
        drec->close_tape();
        emu->unlock_vm();
+//     drec->set_remote(false);
 }
 
-bool VM::is_tape_inserted()
+bool VM::is_tape_inserted(int drv)
 {
        return drec->is_tape_inserted();
 }
 
-bool VM::is_tape_playing()
+bool VM::is_tape_playing(int drv)
 {
        return drec->is_tape_playing();
 }
 
-bool VM::is_tape_recording()
+bool VM::is_tape_recording(int drv)
 {
        return drec->is_tape_recording();
 }
 
-int VM::get_tape_position()
+int VM::get_tape_position(int drv)
 {
        return drec->get_tape_position();
 }
 
+const _TCHAR* VM::get_tape_message(int drv)
+{
+       return drec->get_message();
+}
+
+void VM::push_play(int drv)
+{
+       drec->set_ff_rew(0);
+       drec->set_remote(true);
+}
+
+void VM::push_stop(int drv)
+{
+       drec->set_remote(false);
+}
+
+void VM::push_fast_forward(int drv)
+{
+       drec->set_ff_rew(1);
+       drec->set_remote(true);
+}
+
+void VM::push_fast_rewind(int drv)
+{
+       drec->set_ff_rew(-1);
+       drec->set_remote(true);
+}
+
+void VM::load_binary(int drv, const _TCHAR* file_path)
+{
+       if(drv == 0) {
+               pac2->open_rampac2(file_path);
+       }
+}
+
 #if defined(_PX7)
-void VM::open_laser_disc(const _TCHAR* file_path)
+void VM::open_laser_disc(int drv, const _TCHAR* file_path)
 {
        ldp->open_disc(file_path);
 }
 
-void VM::close_laser_disc()
+void VM::close_laser_disc(int drv)
 {
        ldp->close_disc();
 }
 
-bool VM::is_laser_disc_inserted()
+bool VM::is_laser_disc_inserted(int drv)
 {
        return ldp->is_disc_inserted();
 }
+
+uint32_t VM::is_laser_disc_accessed()
+{
+       return lpd->read_signal(0);
+}
 #else
 void VM::open_floppy_disk(int drv, const _TCHAR* file_path, int bank)
 {
@@ -424,6 +444,11 @@ bool VM::is_floppy_disk_protected(int drv)
 {
        return memory->is_disk_protected(drv);
 }
+
+uint32_t VM::is_floppy_disk_accessed()
+{
+       return memory->read_signal(0);
+}
 #endif
 
 bool VM::is_frame_skippable()
@@ -438,7 +463,7 @@ void VM::update_config()
        }
 }
 
-#define STATE_VERSION  3
+#define STATE_VERSION  4
 
 void VM::save_state(FILEIO* state_fio)
 {