annotate system.h @ 1944:357878be8be6

Fix vgmplay target
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Apr 2020 14:56:44 -0700
parents 508522f08e4d
children c3c62dbf1ceb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef SYSTEM_H_
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define SYSTEM_H_
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
3 #include <stddef.h>
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include <stdint.h>
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 typedef struct system_header system_header;
1140
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
7 typedef struct system_media system_media;
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 typedef enum {
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 SYSTEM_UNKNOWN,
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 SYSTEM_GENESIS,
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 SYSTEM_SMS,
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 SYSTEM_JAGUAR
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 } system_type;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 typedef enum {
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 DEBUGGER_NATIVE,
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 DEBUGGER_GDB
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 } debugger_type;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 typedef void (*system_fun)(system_header *);
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents: 1113
diff changeset
22 typedef uint16_t (*system_fun_r16)(system_header *);
1149
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1140
diff changeset
23 typedef void (*system_str_fun)(system_header *, char *);
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1140
diff changeset
24 typedef uint8_t (*system_str_fun_r8)(system_header *, char *);
1583
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
25 typedef void (*system_u32_fun)(system_header *, uint32_t);
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
26 typedef void (*system_u8_fun)(system_header *, uint8_t);
1433
c886c54d8cf1 Added save states to SMS emulation
Michael Pavone <pavone@retrodev.com>
parents: 1208
diff changeset
27 typedef uint8_t (*system_u8_fun_r8)(system_header *, uint8_t);
1583
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
28 typedef void (*system_u8_u8_fun)(system_header *, uint8_t, uint8_t);
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
29 typedef void (*system_mabs_fun)(system_header *, uint8_t, uint16_t, uint16_t);
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
30 typedef void (*system_mrel_fun)(system_header *, uint8_t, int32_t, int32_t);
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
31 typedef uint8_t *(*system_ptrszt_fun_rptr8)(system_header *, size_t *);
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
32 typedef void (*system_ptr8_sizet_fun)(system_header *, uint8_t *, size_t);
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33
1149
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1140
diff changeset
34 #include "arena.h"
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1140
diff changeset
35 #include "romdb.h"
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1140
diff changeset
36
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 struct system_header {
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
38 system_header *next_context;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
39 system_str_fun start_context;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
40 system_fun resume_context;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
41 system_fun load_save;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
42 system_fun persist_save;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
43 system_u8_fun_r8 load_state;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
44 system_fun request_exit;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
45 system_fun soft_reset;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
46 system_fun free_context;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
47 system_fun_r16 get_open_bus_value;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
48 system_u32_fun set_speed_percent;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
49 system_fun inc_debug_mode;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
50 system_u8_u8_fun gamepad_down;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
51 system_u8_u8_fun gamepad_up;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
52 system_u8_u8_fun mouse_down;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
53 system_u8_u8_fun mouse_up;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
54 system_mabs_fun mouse_motion_absolute;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
55 system_mrel_fun mouse_motion_relative;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
56 system_u8_fun keyboard_down;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
57 system_u8_fun keyboard_up;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
58 system_fun config_updated;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
59 system_ptrszt_fun_rptr8 serialize;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
60 system_ptr8_sizet_fun deserialize;
1909
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
61 system_str_fun start_vgm_log;
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
62 system_fun stop_vgm_log;
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
63 rom_info info;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
64 arena *arena;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
65 char *next_rom;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
66 char *save_dir;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
67 uint8_t enter_debugger;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
68 uint8_t should_exit;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
69 uint8_t save_state;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
70 uint8_t delayed_load_slot;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
71 uint8_t has_keyboard;
1909
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
72 uint8_t vgm_logging;
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
73 debugger_type debugger_type;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
74 system_type type;
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 };
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
76
1140
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
77 struct system_media {
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
78 void *buffer;
1438
e2bd03ed3190 Allow reloading current ROM with a hotkey (default F5) and allow locking on a cartridge via menu
Michael Pavone <pavone@retrodev.com>
parents: 1433
diff changeset
79 char *dir;
1201
aee2177a1630 Use filename for game title in SMS mode
Michael Pavone <pavone@retrodev.com>
parents: 1149
diff changeset
80 char *name;
1140
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
81 char *extension;
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
82 system_media *chain;
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
83 uint32_t size;
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
84 };
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
85
1113
45db303fc705 Restore 68K address logging functionality
Michael Pavone <pavone@retrodev.com>
parents: 1111
diff changeset
86 #define OPT_ADDRESS_LOG (1U << 31U)
45db303fc705 Restore 68K address logging functionality
Michael Pavone <pavone@retrodev.com>
parents: 1111
diff changeset
87
1140
4490c9c12272 Detect system type from filename if header based methods fail. Allow overriding system type from command line.
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
88 system_type detect_system_type(system_media *media);
1595
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents: 1583
diff changeset
89 system_header *alloc_config_system(system_type stype, system_media *media, uint32_t opts, uint8_t force_region);
1111
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
90
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 #endif //SYSTEM_H_