Mercurial > repos > blastem
annotate libblastem.c @ 2458:09c9d2c6bac0
Avoid spawning secondary windows right on top of the main one
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Wed, 21 Feb 2024 20:34:52 -0800 |
parents | b50fa7602e39 |
children | b9bec5771993 |
rev | line source |
---|---|
1688
395f684c5379
Fixed the most glaring issues in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1687
diff
changeset
|
1 #include <stdlib.h> |
395f684c5379
Fixed the most glaring issues in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1687
diff
changeset
|
2 #include <string.h> |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 #include "libretro.h" |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 #include "system.h" |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 #include "util.h" |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 #include "vdp.h" |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 #include "render.h" |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
8 #include "io.h" |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
9 #include "genesis.h" |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
10 #include "sms.h" |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
12 static retro_environment_t retro_environment; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 RETRO_API void retro_set_environment(retro_environment_t re) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 retro_environment = re; |
1864
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
16 # define input_descriptor_macro(pad_num) \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
17 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
18 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
19 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_DOWN, "D-Pad Down" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
20 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_RIGHT, "D-Pad Right" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
21 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_B, "A" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
22 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_A, "B" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
23 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_X, "Y" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
24 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_Y, "X" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
25 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_L, "Z" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
26 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_R, "C" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
27 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_SELECT, "Mode" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
28 { pad_num, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_START, "Start" }, \ |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
29 |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
30 static const struct retro_input_descriptor desc[] = { |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
31 input_descriptor_macro(0) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
32 input_descriptor_macro(1) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
33 input_descriptor_macro(2) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
34 input_descriptor_macro(3) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
35 input_descriptor_macro(4) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
36 input_descriptor_macro(5) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
37 input_descriptor_macro(6) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
38 input_descriptor_macro(7) |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
39 { 0 }, |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
40 }; |
96323d73b8ab
add input descriptors
hizzlekizzle <hizzlekizzle@users.noreply.github.com>
parents:
1822
diff
changeset
|
41 |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
42 re(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, (void *)desc); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 static retro_video_refresh_t retro_video_refresh; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 RETRO_API void retro_set_video_refresh(retro_video_refresh_t rvf) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
48 retro_video_refresh = rvf; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
49 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
50 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
51 RETRO_API void retro_set_audio_sample(retro_audio_sample_t ras) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
52 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
53 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
54 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
55 static retro_audio_sample_batch_t retro_audio_sample_batch; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 RETRO_API void retro_set_audio_sample_batch(retro_audio_sample_batch_t rasb) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
57 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
58 retro_audio_sample_batch = rasb; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 static retro_input_poll_t retro_input_poll; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
62 RETRO_API void retro_set_input_poll(retro_input_poll_t rip) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 retro_input_poll = rip; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 static retro_input_state_t retro_input_state; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 RETRO_API void retro_set_input_state(retro_input_state_t ris) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 retro_input_state = ris; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 int headless = 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 int exit_after = 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 int z80_enabled = 1; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 char *save_filename; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 tern_node *config; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 uint8_t use_native_states = 1; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 system_header *current_system; |
2302
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
80 static system_media media; |
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
81 const system_media *current_media(void) |
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
82 { |
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
83 return &media; |
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
84 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 RETRO_API void retro_init(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
88 render_audio_initialized(RENDER_AUDIO_S16, 53693175 / (7 * 6 * 4), 2, 4, sizeof(int16_t)); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
90 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 RETRO_API void retro_deinit(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 { |
1691
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
93 if (current_system) { |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
94 retro_unload_game(); |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
95 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
97 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 RETRO_API unsigned retro_api_version(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
100 return RETRO_API_VERSION; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
101 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
102 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
103 RETRO_API void retro_get_system_info(struct retro_system_info *info) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
104 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
105 info->library_name = "BlastEm"; |
1819
4fb9af0c65b6
Update verison number in liblastem.c
Mike Pavone <pavone@retrodev.com>
parents:
1818
diff
changeset
|
106 info->library_version = "0.6.3-pre"; //TODO: share this with blastem.c |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
107 info->valid_extensions = "md|gen|sms|bin|rom"; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
108 info->need_fullpath = 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
109 info->block_extract = 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
110 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
111 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
112 static vid_std video_standard; |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
113 static uint32_t last_width, last_height; |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
114 static uint32_t overscan_top, overscan_bot, overscan_left, overscan_right; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
115 static void update_overscan(void) |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
116 { |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
117 uint8_t overscan; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
118 retro_environment(RETRO_ENVIRONMENT_GET_OVERSCAN, &overscan); |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
119 if (overscan) { |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
120 overscan_top = overscan_bot = overscan_left = overscan_right = 0; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
121 } else { |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
122 if (video_standard == VID_NTSC) { |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
123 overscan_top = 11; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
124 overscan_bot = 8; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
125 overscan_left = 13; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
126 overscan_right = 14; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
127 } else { |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
128 overscan_top = 30; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
129 overscan_bot = 24; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
130 overscan_left = 13; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
131 overscan_right = 14; |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
132 } |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
133 } |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
134 } |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
135 |
1889
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
136 static int32_t sample_rate; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
137 RETRO_API void retro_get_system_av_info(struct retro_system_av_info *info) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
138 { |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
139 update_overscan(); |
1694
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
140 last_width = LINEBUF_SIZE; |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
141 info->geometry.base_width = info->geometry.max_width = LINEBUF_SIZE - (overscan_left + overscan_right); |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
142 info->geometry.base_height = (video_standard == VID_NTSC ? 243 : 294) - (overscan_top + overscan_bot); |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
143 last_height = info->geometry.base_height; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
144 info->geometry.max_height = info->geometry.base_height * 2; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
145 info->geometry.aspect_ratio = 0; |
1889
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
146 double master_clock = video_standard == VID_NTSC ? 53693175 : 53203395; |
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
147 double lines = video_standard == VID_NTSC ? 262 : 313; |
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
148 info->timing.fps = master_clock / (3420.0 * lines); |
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
149 info->timing.sample_rate = master_clock / (7 * 6 * 24); //sample rate of YM2612 |
377f110e4cea
Report more accurate frame and sample rates to frontend in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1882
diff
changeset
|
150 sample_rate = info->timing.sample_rate; |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
151 render_audio_initialized(RENDER_AUDIO_S16, info->timing.sample_rate, 2, 4, sizeof(int16_t)); |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
152 //force adjustment of resampling parameters since target sample rate may have changed slightly |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
153 current_system->set_speed_percent(current_system, 100); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
154 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
155 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
156 RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
157 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
158 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
159 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
160 /* Resets the current game. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
161 RETRO_API void retro_reset(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
162 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
163 current_system->soft_reset(current_system); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
164 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
165 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
166 /* Runs the game for one video frame. |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
167 * During retro_run(), input_poll callback must be called at least once. |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
168 * |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
169 * If a frame is not rendered for reasons where a game "dropped" a frame, |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
170 * this still counts as a frame, and retro_run() should explicitly dupe |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
171 * a frame if GET_CAN_DUPE returns true. |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
172 * In this case, the video callback can take a NULL argument for data. |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
173 */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
174 static uint8_t started; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
175 RETRO_API void retro_run(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
176 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
177 if (started) { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
178 current_system->resume_context(current_system); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
179 } else { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
180 current_system->start_context(current_system, NULL); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
181 started = 1; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
182 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
183 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
184 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
185 /* Returns the amount of data the implementation requires to serialize |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
186 * internal state (save states). |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
187 * Between calls to retro_load_game() and retro_unload_game(), the |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
188 * returned size is never allowed to be larger than a previous returned |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
189 * value, to ensure that the frontend can allocate a save state buffer once. |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
190 */ |
1690
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
191 static size_t serialize_size_cache; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
192 RETRO_API size_t retro_serialize_size(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
193 { |
1690
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
194 if (!serialize_size_cache) { |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
195 uint8_t *tmp = current_system->serialize(current_system, &serialize_size_cache); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
196 free(tmp); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
197 } |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
198 return serialize_size_cache; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
199 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
200 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
201 /* Serializes internal state. If failed, or size is lower than |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
202 * retro_serialize_size(), it should return false, true otherwise. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
203 RETRO_API bool retro_serialize(void *data, size_t size) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
204 { |
1690
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
205 size_t actual_size; |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
206 uint8_t *tmp = current_system->serialize(current_system, &actual_size); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
207 if (actual_size > size) { |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
208 free(tmp); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
209 return 0; |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
210 } |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
211 memcpy(data, tmp, actual_size); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
212 free(tmp); |
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
213 return 1; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
214 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
215 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
216 RETRO_API bool retro_unserialize(const void *data, size_t size) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
217 { |
1690
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
218 current_system->deserialize(current_system, (uint8_t *)data, size); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
219 return 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
220 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
221 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
222 RETRO_API void retro_cheat_reset(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
223 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
224 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
225 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
226 RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
227 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
228 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
229 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
230 /* Loads a game. */ |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
231 static system_type stype; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
232 RETRO_API bool retro_load_game(const struct retro_game_info *game) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
233 { |
1690
319d90025d50
Implement serialization/deserialization in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1689
diff
changeset
|
234 serialize_size_cache = 0; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
235 if (game->path) { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
236 media.dir = path_dirname(game->path); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
237 media.name = basename_no_extension(game->path); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
238 media.extension = path_extension(game->path); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
239 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
240 media.buffer = malloc(nearest_pow2(game->size)); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
241 memcpy(media.buffer, game->data, game->size); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
242 media.size = game->size; |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
243 stype = detect_system_type(&media); |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
244 current_system = alloc_config_system(stype, &media, 0, 0); |
2302
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
245 |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
246 unsigned format = RETRO_PIXEL_FORMAT_XRGB8888; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
247 retro_environment(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &format); |
2302
0343f0d5add0
Fix libretro build for real
Michael Pavone <pavone@retrodev.com>
parents:
2001
diff
changeset
|
248 |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
249 return current_system != NULL; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
250 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
251 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
252 /* Loads a "special" kind of game. Should not be used, |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
253 * except in extreme cases. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
254 RETRO_API bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
255 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
256 return retro_load_game(info); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
257 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
258 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
259 /* Unloads a currently loaded game. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
260 RETRO_API void retro_unload_game(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
261 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
262 free(media.dir); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
263 free(media.name); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
264 free(media.extension); |
1691
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
265 media.dir = media.name = media.extension = NULL; |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
266 //buffer is freed by the context |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
267 media.buffer = NULL; |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
268 current_system->free_context(current_system); |
e96d0d3bec7f
Don't leak a system context when a game is unloaded
Mike Pavone <pavone@retrodev.com>
parents:
1690
diff
changeset
|
269 current_system = NULL; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
270 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
271 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
272 /* Gets region of game. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
273 RETRO_API unsigned retro_get_region(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
274 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
275 return video_standard == VID_NTSC ? RETRO_REGION_NTSC : RETRO_REGION_PAL; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
276 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
277 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
278 /* Gets region of memory. */ |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
279 RETRO_API void *retro_get_memory_data(unsigned id) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
280 { |
1926
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
281 switch (id) { |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
282 case RETRO_MEMORY_SYSTEM_RAM: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
283 switch (stype) { |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
284 case SYSTEM_GENESIS: { |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
285 genesis_context *gen = (genesis_context *)current_system; |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
286 return (uint8_t *)gen->work_ram; |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
287 } |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
288 #ifndef NO_Z80 |
1926
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
289 case SYSTEM_SMS: { |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
290 sms_context *sms = (sms_context *)current_system; |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
291 return sms->ram; |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
292 } |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
293 #endif |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
294 } |
1926
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
295 break; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
296 case RETRO_MEMORY_SAVE_RAM: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
297 if (stype == SYSTEM_GENESIS) { |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
298 genesis_context *gen = (genesis_context *)current_system; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
299 if (gen->save_type != SAVE_NONE) |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
300 return gen->save_storage; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
301 } |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
302 break; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
303 default: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
304 break; |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
305 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
306 return NULL; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
307 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
308 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
309 RETRO_API size_t retro_get_memory_size(unsigned id) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
310 { |
1926
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
311 switch (id) { |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
312 case RETRO_MEMORY_SYSTEM_RAM: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
313 switch (stype) { |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
314 case SYSTEM_GENESIS: |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
315 return RAM_WORDS * sizeof(uint16_t); |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
316 #ifndef NO_Z80 |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
317 case SYSTEM_SMS: |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
318 return SMS_RAM_SIZE; |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
319 #endif |
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
320 } |
1926
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
321 break; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
322 case RETRO_MEMORY_SAVE_RAM: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
323 if (stype == SYSTEM_GENESIS) { |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
324 genesis_context *gen = (genesis_context *)current_system; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
325 if (gen->save_type != SAVE_NONE) |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
326 return gen->save_size; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
327 } |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
328 break; |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
329 default: |
94f37e4b1469
Add memory hook for genesis/megadrive save and cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1924
diff
changeset
|
330 break; |
1924
81b059e3ded6
Add memory hook for cheat/rumble/cheevos support
negativeExponent <negativeExponent@users.noreply.github.com>
parents:
1889
diff
changeset
|
331 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
332 return 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
333 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
334 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
335 //blastem render backend API implementation |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
336 uint32_t render_map_color(uint8_t r, uint8_t g, uint8_t b) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
337 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
338 return r << 16 | g << 8 | b; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
339 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
340 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
341 uint8_t render_create_window(char *caption, uint32_t width, uint32_t height, window_close_handler close_handler) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
342 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
343 //not supported in lib build |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
344 return 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
345 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
346 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
347 void render_destroy_window(uint8_t which) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
348 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
349 //not supported in lib build |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
350 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
351 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
352 static uint32_t fb[LINEBUF_SIZE * 294 * 2]; |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
353 static uint8_t last_fb; |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
354 uint32_t *render_get_framebuffer(uint8_t which, int *pitch) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
355 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
356 *pitch = LINEBUF_SIZE * sizeof(uint32_t); |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
357 if (which != last_fb) { |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
358 *pitch = *pitch * 2; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
359 } |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
360 |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
361 if (which) { |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
362 return fb + LINEBUF_SIZE; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
363 } else { |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
364 return fb; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
365 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
366 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
367 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
368 void render_framebuffer_updated(uint8_t which, int width) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
369 { |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
370 unsigned height = (video_standard == VID_NTSC ? 243 : 294) - (overscan_top + overscan_bot); |
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
371 width -= (overscan_left + overscan_right); |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
372 unsigned base_height = height; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
373 if (which != last_fb) { |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
374 height *= 2; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
375 last_fb = which; |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
376 } |
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
377 if (width != last_width || height != last_height) { |
1694
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
378 struct retro_game_geometry geometry = { |
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
379 .base_width = width, |
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
380 .base_height = height, |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
381 .aspect_ratio = (float)LINEBUF_SIZE / base_height |
1694
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
382 }; |
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
383 retro_environment(RETRO_ENVIRONMENT_SET_GEOMETRY, &geometry); |
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
384 last_width = width; |
1695
3c34122754ac
Properly support interlace in libretro build
Michael Pavone <pavone@retrodev.com>
parents:
1694
diff
changeset
|
385 last_height = height; |
1694
9e4dd1595f37
Fix aspect ratio for H32 games
Michael Pavone <pavone@retrodev.com>
parents:
1691
diff
changeset
|
386 } |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
387 retro_video_refresh(fb + overscan_left + LINEBUF_SIZE * overscan_top, width, height, LINEBUF_SIZE * sizeof(uint32_t)); |
1980
81df9aa2de9b
Less hacky run on audio thread mode
Michael Pavone <pavone@retrodev.com>
parents:
1932
diff
changeset
|
388 system_request_exit(current_system, 0); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
389 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
390 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
391 uint8_t render_get_active_framebuffer(void) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
392 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
393 return 0; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
394 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
395 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
396 void render_set_video_standard(vid_std std) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
397 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
398 video_standard = std; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
399 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
400 |
2405
b50fa7602e39
Fix libblastem target
Michael Pavone <pavone@retrodev.com>
parents:
2302
diff
changeset
|
401 uint8_t render_fullscreen(void) |
1822
8500bd987dda
Make libretro target successfully build for Windows and possibly Mac
Mike Pavone <pavone@retrodev.com>
parents:
1819
diff
changeset
|
402 { |
8500bd987dda
Make libretro target successfully build for Windows and possibly Mac
Mike Pavone <pavone@retrodev.com>
parents:
1819
diff
changeset
|
403 return 1; |
8500bd987dda
Make libretro target successfully build for Windows and possibly Mac
Mike Pavone <pavone@retrodev.com>
parents:
1819
diff
changeset
|
404 } |
8500bd987dda
Make libretro target successfully build for Windows and possibly Mac
Mike Pavone <pavone@retrodev.com>
parents:
1819
diff
changeset
|
405 |
1881
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
406 uint32_t render_overscan_top() |
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
407 { |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
408 return overscan_top; |
1881
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
409 } |
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
410 |
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
411 uint32_t render_overscan_bot() |
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
412 { |
1882
62e8a8833e39
Implement overscan crop in libretro target
Michael Pavone <pavone@retrodev.com>
parents:
1881
diff
changeset
|
413 return overscan_bot; |
1881
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
414 } |
55198fc9cc1f
Don't render lines that are cropped by overscan. Allows submitting frame earlier when bottom overscan is non-zero which can reduce latency in some cases
Mike Pavone <pavone@retrodev.com>
parents:
1868
diff
changeset
|
415 |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
416 void process_events() |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
417 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
418 static int16_t prev_state[2][RETRO_DEVICE_ID_JOYPAD_L2]; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
419 static const uint8_t map[] = { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
420 BUTTON_A, BUTTON_X, BUTTON_MODE, BUTTON_START, DPAD_UP, DPAD_DOWN, |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
421 DPAD_LEFT, DPAD_RIGHT, BUTTON_B, BUTTON_Y, BUTTON_Z, BUTTON_C |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
422 }; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
423 //TODO: handle other input device types |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
424 //TODO: handle more than 2 ports when appropriate |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
425 retro_input_poll(); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
426 for (int port = 0; port < 2; port++) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
427 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
428 for (int id = RETRO_DEVICE_ID_JOYPAD_B; id < RETRO_DEVICE_ID_JOYPAD_L2; id++) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
429 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
430 int16_t new_state = retro_input_state(port, RETRO_DEVICE_JOYPAD, 0, id); |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
431 if (new_state != prev_state[port][id]) { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
432 if (new_state) { |
1689
7f42a93f18a4
Have a suitable default IO port configuration when nonIO is present from the config file. Fixed off by one in processing gamepad button events in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1688
diff
changeset
|
433 current_system->gamepad_down(current_system, port + 1, map[id]); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
434 } else { |
1689
7f42a93f18a4
Have a suitable default IO port configuration when nonIO is present from the config file. Fixed off by one in processing gamepad button events in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1688
diff
changeset
|
435 current_system->gamepad_up(current_system, port + 1, map[id]); |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
436 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
437 prev_state[port][id] = new_state; |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
438 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
439 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
440 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
441 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
442 |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
443 void render_errorbox(char *title, char *message) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
444 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
445 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
446 void render_warnbox(char *title, char *message) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
447 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
448 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
449 void render_infobox(char *title, char *message) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
450 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
451 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
452 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
453 uint8_t render_is_audio_sync(void) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
454 { |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
455 //whether this is true depends on the libretro frontend implementation |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
456 //but the sync to audio path works better here |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
457 return 1; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
458 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
459 |
1932
b387f1c5a1d0
WIP new sync mode that runs emulation on audio thread
Michael Pavone <pavone@retrodev.com>
parents:
1927
diff
changeset
|
460 uint8_t render_should_release_on_exit(void) |
b387f1c5a1d0
WIP new sync mode that runs emulation on audio thread
Michael Pavone <pavone@retrodev.com>
parents:
1927
diff
changeset
|
461 { |
b387f1c5a1d0
WIP new sync mode that runs emulation on audio thread
Michael Pavone <pavone@retrodev.com>
parents:
1927
diff
changeset
|
462 return 0; |
b387f1c5a1d0
WIP new sync mode that runs emulation on audio thread
Michael Pavone <pavone@retrodev.com>
parents:
1927
diff
changeset
|
463 } |
b387f1c5a1d0
WIP new sync mode that runs emulation on audio thread
Michael Pavone <pavone@retrodev.com>
parents:
1927
diff
changeset
|
464 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
465 void render_buffer_consumed(audio_source *src) |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
466 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
467 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
468 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
469 void *render_new_audio_opaque(void) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
470 { |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
471 return NULL; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
472 } |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
473 |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
474 void render_free_audio_opaque(void *opaque) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
475 { |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
476 } |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
477 |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
478 void render_lock_audio(void) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
479 { |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
480 } |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
481 |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
482 void render_unlock_audio() |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
483 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
484 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
485 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
486 uint32_t render_min_buffered(void) |
1817
03895a4585c3
Fix build breakage for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1695
diff
changeset
|
487 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
488 //not actually used in the sync to audio path |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
489 return 4; |
1817
03895a4585c3
Fix build breakage for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1695
diff
changeset
|
490 } |
03895a4585c3
Fix build breakage for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1695
diff
changeset
|
491 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
492 uint32_t render_audio_syncs_per_sec(void) |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
493 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
494 return 0; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
495 } |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
496 |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
497 void render_audio_created(audio_source *src) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
498 { |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
499 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
500 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
501 void render_do_audio_ready(audio_source *src) |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
502 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
503 int16_t *tmp = src->front; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
504 src->front = src->back; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
505 src->back = tmp; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
506 src->front_populated = 1; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
507 src->buffer_pos = 0; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
508 if (all_sources_ready()) { |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
509 int16_t buffer[8]; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
510 int min_remaining_out; |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
511 mix_and_convert((uint8_t *)buffer, sizeof(buffer), &min_remaining_out); |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
512 retro_audio_sample_batch(buffer, sizeof(buffer)/(2*sizeof(*buffer))); |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
513 } |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
514 } |
1688
395f684c5379
Fixed the most glaring issues in libretro build
Mike Pavone <pavone@retrodev.com>
parents:
1687
diff
changeset
|
515 |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
516 void render_source_paused(audio_source *src, uint8_t remaining_sources) |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
517 { |
1927
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
518 } |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
519 |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
520 void render_source_resumed(audio_source *src) |
9fd4bedc1a31
Update libretro target to use render_audio shared audio code
Mike Pavone <pavone@retrodev.com>
parents:
1926
diff
changeset
|
521 { |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
522 } |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
523 |
2001
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
524 void render_set_external_sync(uint8_t ext_sync_on) |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
525 { |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
526 } |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
527 |
1687
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
528 void bindings_set_mouse_mode(uint8_t mode) |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
529 { |
6c54bb5fe3b3
Hacky WIP libertro implementation
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
530 } |
1818
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
531 |
2001
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
532 void bindings_release_capture(void) |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
533 { |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
534 } |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
535 |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
536 void bindings_reacquire_capture(void) |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
537 { |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
538 } |
f77d36a975ff
Add stubs for some functions in libblastem.c to fix link failures on windows libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1980
diff
changeset
|
539 |
1818
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
540 extern const char rom_db_data[]; |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
541 char *read_bundled_file(char *name, uint32_t *sizeret) |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
542 { |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
543 if (!strcmp(name, "rom.db")) { |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
544 *sizeret = strlen(rom_db_data); |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
545 char *ret = malloc(*sizeret+1); |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
546 memcpy(ret, rom_db_data, *sizeret + 1); |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
547 return ret; |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
548 } |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
549 return NULL; |
243f3a7247f9
Include ROM DB in library binary for libretro target
Mike Pavone <pavone@retrodev.com>
parents:
1817
diff
changeset
|
550 } |