Revision 23e39294 hw/stellaris_input.c
b/hw/stellaris_input.c | ||
---|---|---|
47 | 47 |
s->extension = 0; |
48 | 48 |
} |
49 | 49 |
|
50 |
static void stellaris_gamepad_save(QEMUFile *f, void *opaque) |
|
51 |
{ |
|
52 |
gamepad_state *s = (gamepad_state *)opaque; |
|
53 |
int i; |
|
54 |
|
|
55 |
qemu_put_be32(f, s->extension); |
|
56 |
for (i = 0; i < s->num_buttons; i++) |
|
57 |
qemu_put_byte(f, s->buttons[i].pressed); |
|
58 |
} |
|
59 |
|
|
60 |
static int stellaris_gamepad_load(QEMUFile *f, void *opaque, int version_id) |
|
61 |
{ |
|
62 |
gamepad_state *s = (gamepad_state *)opaque; |
|
63 |
int i; |
|
64 |
|
|
65 |
if (version_id != 1) |
|
66 |
return -EINVAL; |
|
67 |
|
|
68 |
s->extension = qemu_get_be32(f); |
|
69 |
for (i = 0; i < s->num_buttons; i++) |
|
70 |
s->buttons[i].pressed = qemu_get_byte(f); |
|
71 |
|
|
72 |
return 0; |
|
73 |
} |
|
74 |
|
|
50 | 75 |
/* Returns an array 5 ouput slots. */ |
51 | 76 |
void stellaris_gamepad_init(int n, qemu_irq *irq, const int *keycode) |
52 | 77 |
{ |
... | ... | |
61 | 86 |
} |
62 | 87 |
s->num_buttons = n; |
63 | 88 |
qemu_add_kbd_event_handler(stellaris_gamepad_put_key, s); |
89 |
register_savevm("stellaris_gamepad", -1, 1, |
|
90 |
stellaris_gamepad_save, stellaris_gamepad_load, s); |
|
64 | 91 |
} |
65 | 92 |
|
66 | 93 |
|
Also available in: Unified diff