OSDN Git Service

[VM][STATE] Apply new framework to some VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc6001 / floppy.h
index a769641..e2c3d8c 100644 (file)
 #include "../../emu.h"
 #include "../device.h"
 
-#if defined(USE_SOUND_FILES)
-#define FLOPPY_SND_TBL_MAX 256
-#ifndef SIG_SOUNDER_MUTE
-#define SIG_SOUNDER_MUTE       (65536 + 0)
-#endif
-#ifndef SIG_SOUNDER_RELOAD
-#define SIG_SOUNDER_RELOAD     (65536 + 32)
-#endif
-#ifndef SIG_SOUNDER_ADD
-#define SIG_SOUNDER_ADD        (65536 + 64)
-#endif
-
-#define FLOPPY_SND_TYPE_SEEK 0
-#define FLOPPY_SND_TYPE_HEAD 1
-#endif
 class DISK;
+class NOISE;
+
 class FLOPPY : public DEVICE
 {
 private:
        DEVICE *d_ext;
+       NOISE *d_noise_seek;
+//     NOISE* d_noise_head_down;
+//     NOISE* d_noise_head_up;
        unsigned char io_B1H;
        
        DISK* disk[2];
+       
        int cur_trk[2];
        int cur_sct[2];
        int cur_pos[2];
@@ -71,10 +62,7 @@ private:
        unsigned char SendSectors;              // amount(100H unit)
        int DIO;                                                        // data direction TRUE: Buffer->CPU FALSE: CPU->Buffer
        unsigned char Status;                   // FDC status register
-#if defined(USE_SOUND_FILES)
-       int seek_track_num[2];
-       int seek_event_id[2];
-#endif
+       
        void Push(int part, unsigned char data);
        unsigned char Pop(int part);
        void Clear(int i);
@@ -112,39 +100,12 @@ private:
        unsigned char InDCH_66();
        unsigned char InDDH_66();
        
-#if defined(USE_SOUND_FILES)
-protected:
-       _TCHAR snd_seek_name[512];
-       _TCHAR snd_head_name[512];
-       int snd_seek_mix_tbl[FLOPPY_SND_TBL_MAX];
-       int snd_head_mix_tbl[FLOPPY_SND_TBL_MAX];
-       int16_t *snd_seek_data; // Read only
-       int16_t *snd_head_data; // Read only
-       int snd_seek_samples_size;
-       int snd_head_samples_size;
-       bool snd_mute;
-       int snd_level_l, snd_level_r;
-       virtual void mix_main(int32_t *dst, int count, int16_t *src, int *table, int samples);
-       void add_sound(int type);
-#endif
 public:
-       FLOPPY(VM* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
+       FLOPPY(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu)
        {
-#if defined(USE_SOUND_FILES)
-               seek_track_num[0] = seek_track_num[1] = 0;
-               cur_trk[0] = cur_trk[1] = 0;
-               seek_event_id[0] = seek_event_id[1] = -1;
-               for(int i = 0; i < FLOPPY_SND_TBL_MAX; i++) {
-                       snd_seek_mix_tbl[i] = -1;
-                       snd_head_mix_tbl[i] = -1;
-               }
-               snd_seek_data = snd_head_data = NULL;
-               snd_seek_samples_size = snd_head_samples_size = 0;
-               snd_mute = false;
-               snd_level_l = snd_level_r = decibel_to_volume(0);
-               memset(snd_seek_name, 0x00, sizeof(snd_seek_name));
-               memset(snd_head_name, 0x00, sizeof(snd_head_name));
-#endif
+               d_noise_seek = NULL;
+//             d_noise_head_down = NULL;
+//             d_noise_head_up = NULL;
                set_device_name(_T("Floppy Drive"));
        }
        ~FLOPPY() {}
@@ -153,31 +114,45 @@ public:
        void initialize();
        void release();
        void reset();
-       void event_callback(int event_id, int err);
        void write_io8(uint32_t addr, uint32_t data);
        uint32_t read_io8(uint32_t addr);
        uint32_t read_signal(int ch);
-       void save_state(FILEIO* state_fio);
-       bool load_state(FILEIO* state_fio);
+       void update_config();
+       bool process_state(FILEIO* state_fio, bool loading);
        
        // unique functions
        void set_context_ext(DEVICE* device)
        {
                d_ext = device;
        }
+       void set_context_noise_seek(NOISE* device)
+       {
+               d_noise_seek = device;
+       }
+       NOISE* get_context_noise_seek()
+       {
+               return d_noise_seek;
+       }
+//     void set_context_noise_head_down(NOISE* device)
+//     {
+//             d_noise_head_down = device;
+//     }
+//     NOISE* get_context_noise_head_down()
+//     {
+//             return d_noise_head_down;
+//     }
+//     void set_context_noise_head_up(NOISE* device)
+//     {
+//             d_noise_head_up = device;
+//     }
+//     NOISE* get_context_noise_head_up()
+//     {
+//             return d_noise_head_up;
+//     }
        DISK* get_disk_handler(int drv)
        {
                return disk[drv];
        }
-#if defined(USE_SOUND_FILES)
-       // Around SOUND. 20161004 K.O
-       bool load_sound_data(int type, const _TCHAR *pathname);
-       void release_sound_data(int type);
-       bool reload_sound_data(int type);
-       
-       void mix(int32_t *buffer, int cnt);
-       void set_volume(int ch, int decibel_l, int decibel_r);
-#endif
        void open_disk(int drv, const _TCHAR* file_path, int bank);
        void close_disk(int drv);
        bool is_disk_inserted(int drv);