comparison event_log.h @ 1947:c36102d09351

Add missing netplay files and add in support for sending gamepad commands back to host
author Michael Pavone <pavone@retrodev.com>
date Wed, 29 Apr 2020 23:42:16 -0700
parents
children 275f1c4bdb25
comparison
equal deleted inserted replaced
1946:c3c62dbf1ceb 1947:c36102d09351
1 #ifndef EVENT_LOG_H_
2 #define EVENT_LOG_H_
3
4 enum {
5 EVENT_FLUSH = 0,
6 EVENT_ADJUST = 1,
7 EVENT_PSG_REG = 2,
8 EVENT_YM_REG = 3,
9 EVENT_VDP_REG = 4,
10 EVENT_VRAM_BYTE = 5,
11 EVENT_VRAM_BYTE_DELTA = 6,
12 EVENT_VRAM_BYTE_ONE = 7,
13 EVENT_VRAM_BYTE_AUTO = 8,
14 EVENT_VRAM_WORD = 9,
15 EVENT_VRAM_WORD_DELTA = 10,
16 EVENT_CRAM = 11,
17 EVENT_VSRAM = 12,
18 EVENT_STATE = 13
19 //14 and 15 are reserved for header types
20 };
21
22 #include "serialize.h"
23 typedef struct {
24 size_t storage;
25 int socket;
26 uint32_t last_cycle;
27 uint32_t last_word_address;
28 uint32_t last_byte_address;
29 deserialize_buffer buffer;
30 } event_reader;
31
32 #include "system.h"
33 #include "render.h"
34
35 void event_log_file(char *fname);
36 void event_log_tcp(char *address, char *port);
37 void event_system_start(system_type stype, vid_std video_std, char *name);
38 void event_cycle_adjust(uint32_t cycle, uint32_t deduction);
39 void event_log(uint8_t type, uint32_t cycle, uint8_t size, uint8_t *payload);
40 void event_vram_word(uint32_t cycle, uint32_t address, uint16_t value);
41 void event_vram_byte(uint32_t cycle, uint16_t address, uint8_t byte, uint8_t auto_inc);
42 void event_state(uint32_t cycle, serialize_buffer *state);
43 void event_flush(uint32_t cycle);
44
45 void init_event_reader(event_reader *reader, uint8_t *data, size_t size);
46 void init_event_reader_tcp(event_reader *reader, char *address, char *port);
47 uint8_t reader_next_event(event_reader *reader, uint32_t *cycle_out);
48 uint8_t reader_system_type(event_reader *reader);
49 void reader_send_gamepad_event(event_reader *reader, uint8_t pad, uint8_t button, uint8_t down);
50
51 #endif //EVENT_LOG_H_