OSDN Git Service

[VM] TRY:Use namespace {VMNAME} to separate around VMs. This feature still apply...
[csp-qt/common_source_project-fm7.git] / source / src / vm / fm7 / joystick.h
1 /*
2  * FM-7 Keyboard [joystick.h]
3  *
4  * Author: K.Ohta <whatisthis.sowhat _at_ gmail.com>
5  * License: GPLv2
6  * History:
7  *   Jun 16, 2015 : Initial
8  *
9  */
10
11 #ifndef _VM_FM7_JOYSTICK_H_
12 #define _VM_FM7_JOYSTICK_H_
13 #include "../device.h"
14
15 #include "fm7_common.h"
16 #include "../../fileio.h"
17
18 namespace FM7 {
19 class JOYSTICK : public DEVICE {
20  private:
21         bool emulate_mouse[2];
22         uint32_t joydata[2];
23         const uint32_t *rawdata;
24         const int32_t *mouse_state;
25         int dx, dy;
26         int lx, ly;
27         uint32_t mouse_button;
28         bool mouse_strobe;
29         uint32_t mouse_data;
30         int mouse_phase;
31         int mouse_timeout_event;
32         uint8_t port_b_val;
33         uint8_t lpmask;
34         int lpt_type;
35  protected:
36         DEVICE *opn;
37         
38  private:
39         uint32_t update_mouse(uint32_t mask);
40         void   update_strobe(bool flag);
41         uint32_t mouse_type;
42  public:
43         JOYSTICK(VM_TEMPLATE* parent_vm, EMU *parent_emu);
44         ~JOYSTICK();
45
46         void initialize(void);
47         void event_frame(void);
48         //void event_vline(int v, int clock);
49         
50         uint32_t read_data8(uint32_t addr);
51         void write_data8(uint32_t addr, uint32_t data);
52         void write_signal(int id, uint32_t data, uint32_t mask);
53         void event_callback(int event_id, int err);
54         
55         void reset(void);
56         void update_config();
57         bool process_state(FILEIO *state_fio, bool loading);
58         
59         void set_context_opn(DEVICE *p) {
60                 opn = p;
61         }
62 };
63
64 }
65 #endif