annotate system.h @ 2298:9d68799f945b

Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
author Michael Pavone <pavone@retrodev.com>
date Thu, 09 Mar 2023 22:49:42 -0800
parents 92449b47cce8
children 9f0c67e5c50a
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>
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
5 #include <stdio.h>
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2289
diff changeset
6 #include "flac.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
7
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 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
9 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
10
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 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
12 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
13 SYSTEM_GENESIS,
1946
c3c62dbf1ceb WIP netplay support
Michael Pavone <pavone@retrodev.com>
parents: 1909
diff changeset
14 SYSTEM_GENESIS_PLAYER,
1472
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
15 SYSTEM_SEGACD,
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
16 SYSTEM_SMS,
1946
c3c62dbf1ceb WIP netplay support
Michael Pavone <pavone@retrodev.com>
parents: 1909
diff changeset
17 SYSTEM_SMS_PLAYER,
c3c62dbf1ceb WIP netplay support
Michael Pavone <pavone@retrodev.com>
parents: 1909
diff changeset
18 SYSTEM_JAGUAR,
2289
92449b47cce8 Integrate VGM player into main blastem binary
Michael Pavone <pavone@retrodev.com>
parents: 2271
diff changeset
19 SYSTEM_MEDIA_PLAYER
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
20 } 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
21
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 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
23 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
24 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
25 } 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
26
2243
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
27 enum {
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
28 DEBUG_PLANE,
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
29 DEBUG_VRAM,
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
30 DEBUG_CRAM,
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
31 DEBUG_COMPOSITE,
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
32 DEBUG_OSCILLOSCOPE,
2271
3ef80963c2a7 Fix stamp address mask and add WIP CD graphics debug view
Michael Pavone <pavone@retrodev.com>
parents: 2243
diff changeset
33 DEBUG_CD_GRAPHICS,
2243
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
34 NUM_DEBUG_TYPES
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
35 };
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
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 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
38 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
39 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
40 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
41 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
42 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
43 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
44 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
45 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
46 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
47 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
48 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
49
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
50 #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
51 #include "romdb.h"
2215
a8af8d898a7c Fix windows build for real
Michael Pavone <pavone@retrodev.com>
parents: 2179
diff changeset
52 typedef struct event_reader event_reader;
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
53
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
54 struct system_header {
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 system_header *next_context;
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
56 system_str_fun start_context;
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
57 system_fun resume_context;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 system_fun load_save;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59 system_fun persist_save;
1433
c886c54d8cf1 Added save states to SMS emulation
Michael Pavone <pavone@retrodev.com>
parents: 1208
diff changeset
60 system_u8_fun_r8 load_state;
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
61 system_fun request_exit;
1208
95f5253e75c7 Implement soft reset in Genesis mode
Michael Pavone <pavone@retrodev.com>
parents: 1201
diff changeset
62 system_fun soft_reset;
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
63 system_fun free_context;
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
64 system_fun_r16 get_open_bus_value;
1583
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
65 system_u32_fun set_speed_percent;
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
66 system_fun inc_debug_mode;
1583
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
67 system_u8_u8_fun gamepad_down;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
68 system_u8_u8_fun gamepad_up;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
69 system_u8_u8_fun mouse_down;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
70 system_u8_u8_fun mouse_up;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
71 system_mabs_fun mouse_motion_absolute;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
72 system_mrel_fun mouse_motion_relative;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
73 system_u8_fun keyboard_down;
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
74 system_u8_fun keyboard_up;
1595
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents: 1583
diff changeset
75 system_fun config_updated;
1690
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
76 system_ptrszt_fun_rptr8 serialize;
319d90025d50 Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents: 1643
diff changeset
77 system_ptr8_sizet_fun deserialize;
1909
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
78 system_str_fun start_vgm_log;
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
79 system_fun stop_vgm_log;
2243
0d1d5dccdd28 Initial implementation of oscilloscope debug view
Michael Pavone <pavone@retrodev.com>
parents: 2215
diff changeset
80 system_u8_fun toggle_debug_view;
1595
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents: 1583
diff changeset
81 rom_info info;
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
82 arena *arena;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 char *next_rom;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 char *save_dir;
2179
9a8dd4ba2753 Implement frame advance debugger command
Michael Pavone <pavone@retrodev.com>
parents: 2116
diff changeset
85 int enter_debugger_frames;
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
86 uint8_t enter_debugger;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
87 uint8_t should_exit;
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
88 uint8_t save_state;
1479
a568dca999b2 Fix genesis save state loading via Nuklear UI, sms probably still needs work
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
89 uint8_t delayed_load_slot;
1583
430dd12e4010 Refactor to split device bindings from IO emulation code
Michael Pavone <pavone@retrodev.com>
parents: 1479
diff changeset
90 uint8_t has_keyboard;
1909
508522f08e4d Initial stab at VGM logging support
Michael Pavone <pavone@retrodev.com>
parents: 1690
diff changeset
91 uint8_t vgm_logging;
1980
81df9aa2de9b Less hacky run on audio thread mode
Michael Pavone <pavone@retrodev.com>
parents: 1946
diff changeset
92 uint8_t force_release;
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
93 debugger_type 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
94 system_type 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
95 };
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96
1472
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
97 typedef enum {
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
98 MEDIA_CART,
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
99 MEDIA_CDROM
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
100 } media_type;
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
101
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
102 typedef enum {
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
103 TRACK_AUDIO,
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
104 TRACK_DATA
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
105 } track_type;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
106
2116
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
107 enum {
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
108 SUBCODES_NONE,
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
109 SUBCODES_RAW,
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
110 SUBCODES_COOKED
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
111 };
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
112
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
113 typedef struct {
2114
2449c88cea36 Enhance support for CUE files and add initial support for cdrdao TOC files
Michael Pavone <pavone@retrodev.com>
parents: 2089
diff changeset
114 FILE *f;
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2289
diff changeset
115 flac_file *flac;
2114
2449c88cea36 Enhance support for CUE files and add initial support for cdrdao TOC files
Michael Pavone <pavone@retrodev.com>
parents: 2089
diff changeset
116 uint32_t file_offset;
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
117 uint32_t fake_pregap;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
118 uint32_t pregap_lba;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
119 uint32_t start_lba;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
120 uint32_t end_lba;
2114
2449c88cea36 Enhance support for CUE files and add initial support for cdrdao TOC files
Michael Pavone <pavone@retrodev.com>
parents: 2089
diff changeset
121 uint16_t sector_bytes;
2089
0db3af42dd72 Fix some byte order stuff for audio tracks
Michael Pavone <pavone@retrodev.com>
parents: 2080
diff changeset
122 uint8_t need_swap;
2116
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
123 uint8_t has_subcodes;
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
124 track_type type;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
125 } track_info;
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
126
2080
bafb757e1cd2 Implement CD audio
Michael Pavone <pavone@retrodev.com>
parents: 2076
diff changeset
127 typedef uint8_t (*seek_fun)(system_media *media, uint32_t sector);
2076
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
128 typedef uint8_t (*read_fun)(system_media *media, uint32_t offset);
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
129
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
130 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
131 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
132 char *dir;
1201
aee2177a1630 Use filename for game title in SMS mode
Michael Pavone <pavone@retrodev.com>
parents: 1149
diff changeset
133 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
134 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
135 system_media *chain;
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
136 track_info *tracks;
2116
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
137 uint8_t *tmp_buffer;
2076
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
138 seek_fun seek;
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
139 read_fun read;
2116
cd057d6fe030 Initial stab at subcode emulation
Michael Pavone <pavone@retrodev.com>
parents: 2114
diff changeset
140 read_fun read_subcodes;
2059
6399a776e981 Add basic support for BIN/CUE images
Michael Pavone <pavone@retrodev.com>
parents: 2053
diff changeset
141 uint32_t num_tracks;
2089
0db3af42dd72 Fix some byte order stuff for audio tracks
Michael Pavone <pavone@retrodev.com>
parents: 2080
diff changeset
142 uint32_t cur_track;
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
143 uint32_t size;
2076
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
144 uint32_t cur_sector;
1472
d2d637dbacfb Change load_rom into load_media with some interface changes in preparation for CD support
Michael Pavone <pavone@retrodev.com>
parents: 1438
diff changeset
145 media_type type;
2076
3f29e2726522 Added basic support for ISO images for games that only have a data track
Michael Pavone <pavone@retrodev.com>
parents: 2059
diff changeset
146 uint8_t in_fake_pregap;
2298
9d68799f945b Added basic FLAC seek implementation and added support for FLAC tracks in CUE sheets
Michael Pavone <pavone@retrodev.com>
parents: 2289
diff changeset
147 uint8_t byte_storage[3];
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
148 };
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
149
1113
45db303fc705 Restore 68K address logging functionality
Michael Pavone <pavone@retrodev.com>
parents: 1111
diff changeset
150 #define OPT_ADDRESS_LOG (1U << 31U)
45db303fc705 Restore 68K address logging functionality
Michael Pavone <pavone@retrodev.com>
parents: 1111
diff changeset
151
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
152 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
153 system_header *alloc_config_system(system_type stype, system_media *media, uint32_t opts, uint8_t force_region);
1946
c3c62dbf1ceb WIP netplay support
Michael Pavone <pavone@retrodev.com>
parents: 1909
diff changeset
154 system_header *alloc_config_player(system_type stype, event_reader *reader);
1980
81df9aa2de9b Less hacky run on audio thread mode
Michael Pavone <pavone@retrodev.com>
parents: 1946
diff changeset
155 void system_request_exit(system_header *system, uint8_t force_release);
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
156
2eb54e24914e Mostly working changes to allow support for multiple emulated system types in main blastem program
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
157 #endif //SYSTEM_H_