Debian Codegraph @

libretro.c

raw symbols SCIP
1 #cxx . . $ `<file>/libretro.c`/include <sys/types.h>
2
3 #include <libretro.h>cxx . . $ `<file>/libretro-common/include/libretro.h`/
4 #include <retro_math.h>cxx . . $ `<file>/libretro-common/include/retro_math.h`/
5
6 #include "libretro_core_options.h"cxx . . $ `<file>/libretro_core_options.h`/
7
8 #include "mednafen/settings.h"cxx . . $ `<file>/mednafen/settings.h`/
9 #include "mednafen/git.h"cxx . . $ `<file>/mednafen/git.h`/
10 #include "mednafen/wswan/wswan.h"cxx . . $ `<file>/mednafen/wswan/wswan.h`/
11 #include "mednafen/mempatcher.h"cxx . . $ `<file>/mednafen/mempatcher.h`/
12 #include "mednafen/wswan/gfx.h"cxx . . $ `<file>/mednafen/wswan/gfx.h`/
13 #include "mednafen/wswan/interrupt.h"cxx . . $ `<file>/mednafen/wswan/interrupt.h`/
14 #include "mednafen/wswan/wswan-memory.h"cxx . . $ `<file>/mednafen/wswan/wswan-memory.h`/
15 #include "mednafen/wswan/start.inc"cxx . . $ `<file>/mednafen/wswan/start.inc`/
16 #include "mednafen/wswan/sound.h"cxx . . $ `<file>/mednafen/wswan/sound.h`/
17 #include "mednafen/wswan/v30mz.h"cxx . . $ `<file>/mednafen/wswan/v30mz.h`/
18 #include "mednafen/wswan/rtc.h"cxx . . $ `<file>/mednafen/wswan/rtc.h`/
19 #include "mednafen/wswan/eeprom.h"cxx . . $ `<file>/mednafen/wswan/eeprom.h`/
20
21 #if defined(_3DS)
22 void* linearMemAlign(size_t size, size_t alignment);
23 void linearFree(void* mem);
24 #endif
25
26 #define MEDNAFEN_CORE_NAME_MODULEcxx . . $ `libretro.c:26:9`! "wswan"
27 #define MEDNAFEN_CORE_NAMEcxx . . $ `libretro.c:27:9`! "Beetle WonderSwan"
28 #define MEDNAFEN_CORE_VERSIONcxx . . $ `libretro.c:28:9`! "v0.9.35.1"
29 #define MEDNAFEN_CORE_EXTENSIONScxx . . $ `libretro.c:29:9`! "ws|wsc|pc2"
30 #define MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`! (3072000.0 / (159.0 * 256.0))
31 #define MEDNAFEN_CORE_GEOMETRY_BASE_Wcxx . . $ `libretro.c:31:9`! 224
32 #define MEDNAFEN_CORE_GEOMETRY_BASE_Hcxx . . $ `libretro.c:32:9`! 144
33 #define MEDNAFEN_CORE_GEOMETRY_MAX_Wcxx . . $ `libretro.c:33:9`! 224
34 #define MEDNAFEN_CORE_GEOMETRY_MAX_Hcxx . . $ `libretro.c:34:9`! 144
35 #define MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIOcxx . . $ `libretro.c:35:9`! (14.0 / 9.0)
36 #define FB_WIDTHcxx . . $ `libretro.c:36:9`! 224
37 #define FB_HEIGHTcxx . . $ `libretro.c:37:9`! 144
38 #define FB_MAX_HEIGHTcxx . . $ `libretro.c:38:9`! FB_HEIGHT
39
40 /* Forward declarations */
41 void MDFN_LoadGameCheatscxx . . $ MDFN_LoadGameCheats(5d22bdacc48458e8).(void *override_ptr);
42 void MDFN_FlushGameCheatscxx . . $ MDFN_FlushGameCheats(d4f767463ce0a6b3).(int nosave);
43
44 /* core options */
45 static int RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. = 44100;
46
47 static int RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. = 2;
48 static int RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. = 15;
49
50 struct retro_perf_callbackcxx . . $ retro_perf_callback# perf_cbcxx . . $ perf_cb.;
51 retro_log_printf_tcxx . . $ retro_log_printf_t# log_cbcxx . . $ log_cb.;
52 static retro_video_refresh_tcxx . . $ retro_video_refresh_t# video_cbcxx . . $ video_cb.;
53 static retro_audio_sample_tcxx . . $ retro_audio_sample_t# audio_cbcxx . . $ audio_cb.;
54 static retro_audio_sample_batch_tcxx . . $ retro_audio_sample_batch_t# audio_batch_cbcxx . . $ audio_batch_cb.;
55 static retro_environment_tcxx . . $ retro_environment_t# environ_cbcxx . . $ environ_cb.;
56 static retro_input_poll_tcxx . . $ retro_input_poll_t# input_poll_cbcxx . . $ input_poll_cb.;
57 static retro_input_state_tcxx . . $ retro_input_state_t# input_state_cbcxx . . $ input_state_cb.;
58
59 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! libretro_supports_bitmaskscxx . . $ libretro_supports_bitmasks. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
60
61 typedef enumcxx . . $ $anonymous_type_f668e49e698a9e9c_0#
62 {
63 DISPLAY_ROTATION_MANUALcxx . . $ DISPLAY_ROTATION_MANUAL. = 0,
64 DISPLAY_ROTATION_PORTRAITcxx . . $ DISPLAY_ROTATION_PORTRAIT.,
65 DISPLAY_ROTATION_LANDSCAPEcxx . . $ DISPLAY_ROTATION_LANDSCAPE.
66 } retro_display_rotation_tcxx . . $ retro_display_rotation_t#;
67
68 static retro_display_rotation_tcxx . . $ retro_display_rotation_t# retro_display_rotationcxx . . $ retro_display_rotation. = DISPLAY_ROTATION_MANUALcxx . . $ DISPLAY_ROTATION_MANUAL.;
69
70 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! rotate_tallcxx . . $ rotate_tall. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
71 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! select_pressed_last_framecxx . . $ select_pressed_last_frame. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
72 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! hw_rotate_enabledcxx . . $ hw_rotate_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
73
74 static unsigned rotate_joymapcxx . . $ rotate_joymap. = 0;
75
76 static MDFN_Surfacecxx . . $ MDFN_Surface# *surfcxx . . $ surf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
77 static uint16_tcxx . . $ uint16_t# *rotate_bufcxx . . $ rotate_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
78
79 #define ROTATE_PIXEL_BUFcxx . . $ `libretro.c:79:9`!(typename_t, src, width, height, dst) \
80 { \
81 typename_t *in_ptr = (typename_t*)src; \
82 typename_t *out_ptr = (typename_t*)dst; \
83 size_t x, y; \
84 for (x = 0; x < width; x++) \
85 for (y = 0; y < height; y++) \
86 *(out_ptr + y + (((width - 1) - x) * height)) = *(in_ptr + x + (y * width)); \
87 }
88
89 static int16_tcxx . . $ int16_t# *audio_samples_bufcxx . . $ audio_samples_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
90 static int32_tcxx . . $ int32_t# audio_samples_buf_sizecxx . . $ audio_samples_buf_size. = 0;
91
92 #define RETRO_60HZ_FPScxx . . $ `libretro.c:92:9`! ((4.0 * MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`!) / 5.0)
93 #define RETRO_60HZ_CYCLE_INDEXcxx . . $ `libretro.c:93:9`! 4
94
95 typedef structcxx . . $ $anonymous_type_f668e49e698a9e9c_1#
96 {
97 int16_tcxx . . $ int16_t# *samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.;
98 int32_tcxx . . $ int32_t# samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size.;
99 int32_tcxx . . $ int32_t# samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos.;
100 int32_tcxx . . $ int32_t# samples_per_framecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_per_frame.;
101 } retro_60hz_audio_tcxx . . $ retro_60hz_audio_t#;
102
103 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_60hz_enabledcxx . . $ retro_60hz_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
104 static uint16_tcxx . . $ uint16_t# retro_60hz_countercxx . . $ retro_60hz_counter. = 0;
105 static retro_60hz_audio_tcxx . . $ retro_60hz_audio_t# retro_60hz_audiocxx . . $ retro_60hz_audio. = {0};
106
107 static void retro_60hz_deinitcxx . . $ retro_60hz_deinit(49f6e7a06ebc5aa8).(void)
108 {
109 if (retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.)
110 freecxx . . $ free(5d22bdacc48458e8).(retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.);
111
112 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
113 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. = 0;
114 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. = 0;
115 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_per_framecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_per_frame. = 0;
116
117 retro_60hz_countercxx . . $ retro_60hz_counter. = 0;
118 }
119
120 static void retro_60hz_initcxx . . $ retro_60hz_init(49f6e7a06ebc5aa8).(void)
121 {
122 retro_60hz_deinitcxx . . $ retro_60hz_deinit(49f6e7a06ebc5aa8).();
123
124 if (retro_60hz_enabledcxx . . $ retro_60hz_enabled.)
125 {
126 /* Get expected number of samples per 60Hz
127 * frame
128 * > Round down - any excess samples will be read
129 * out at the end of each 4/5 frame cycle */
130 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_per_framecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_per_frame. = ((int32_tcxx . . $ int32_t#)(RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. /
131 RETRO_60HZ_FPScxx . . $ `libretro.c:92:9`!));
132
133 /* Initial buffer size should be *twice* that of
134 * the expected number of samples per 75Hz frame */
135 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. = ((int32_tcxx . . $ int32_t#)(RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. /
136 MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`!) + 1) << 2;
137 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. = (int16_tcxx . . $ int16_t#*)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(
138 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. * sizeof(int16_tcxx . . $ int16_t#));
139
140 if (!retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.)
141 {
142 retro_60hz_deinitcxx . . $ retro_60hz_deinit(49f6e7a06ebc5aa8).();
143 retro_60hz_enabledcxx . . $ retro_60hz_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
144 }
145 }
146 }
147
148 static void retro_60hz_cache_audio_samplescxx . . $ retro_60hz_cache_audio_samples(4683f455c3e046d4).(int16_tcxx . . $ int16_t# *samples, int32_tcxx . . $ int32_t# frames)
149 {
150 int32_tcxx . . $ int32_t# buffer_capacity = retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. -
151 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos.;
152 int32_tcxx . . $ int32_t# samples_to_write = frames << 1;
153
154 /* Resize buffer if necessary */
155 if (buffer_capacity < samples_to_write)
156 {
157 int16_tcxx . . $ int16_t# *tmp_buffer = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
158 int32_tcxx . . $ int32_t# tmp_buffer_size;
159
160 tmp_buffer_size = retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. +
161 (samples_to_write - buffer_capacity);
162 tmp_buffer_size = (tmp_buffer_size << 1) - (tmp_buffer_size >> 1);
163 tmp_buffer = (int16_tcxx . . $ int16_t# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(tmp_buffer_size * sizeof(int16_tcxx . . $ int16_t#));
164
165 memcpycxx . . $ memcpy(cc817cb175f282d).(tmp_buffer, retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.,
166 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. * sizeof(int16_tcxx . . $ int16_t#));
167
168 freecxx . . $ free(5d22bdacc48458e8).(retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.);
169 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. = tmp_buffer;
170 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_sizecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_size. = tmp_buffer_size;
171 }
172
173 /* Copy samples */
174 memcpycxx . . $ memcpy(cc817cb175f282d).(retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. +
175 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos.,
176 samples, samples_to_write * sizeof(int16_tcxx . . $ int16_t#));
177 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. += samples_to_write;
178 }
179
180 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! audio_low_pass_enabledcxx . . $ audio_low_pass_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
181 static int64_tcxx . . $ int64_t# audio_low_pass_acc_leftcxx . . $ audio_low_pass_acc_left. = 0;
182 static int64_tcxx . . $ int64_t# audio_low_pass_acc_rightcxx . . $ audio_low_pass_acc_right. = 0;
183
184 static void audio_low_pass_applycxx . . $ audio_low_pass_apply(4683f455c3e046d4).(int16_tcxx . . $ int16_t# *samples, int32_tcxx . . $ int32_t# frames)
185 {
186 while (frames-- > 0)
187 {
188 int64_tcxx . . $ int64_t# drop_current_left;
189 int64_tcxx . . $ int64_t# drop_current_right;
190
191 /* Left channel */
192 drop_current_left = ((*samples << 16) - audio_low_pass_acc_leftcxx . . $ audio_low_pass_acc_left.) >> 3;
193 audio_low_pass_acc_leftcxx . . $ audio_low_pass_acc_left. += drop_current_left;
194 *samples++ = (int16_tcxx . . $ int16_t#)((audio_low_pass_acc_leftcxx . . $ audio_low_pass_acc_left. >> 16) & 0xFFFF);
195
196 /* Right channel */
197 drop_current_right = ((*samples << 16) - audio_low_pass_acc_rightcxx . . $ audio_low_pass_acc_right.) >> 3;
198 audio_low_pass_acc_rightcxx . . $ audio_low_pass_acc_right. += drop_current_right;
199 *samples++ = (int16_tcxx . . $ int16_t#)((audio_low_pass_acc_rightcxx . . $ audio_low_pass_acc_right. >> 16) & 0xFFFF);
200 }
201 }
202
203 /* Mono palettes */
204
205 struct ws_mono_palettecxx . . $ ws_mono_palette#
206 {
207 const char *namecxx . . $ ws_mono_palette#name.;
208 uint32cxx . . $ uint32# startcxx . . $ ws_mono_palette#start.;
209 uint32cxx . . $ uint32# endcxx . . $ ws_mono_palette#end.;
210 };
211
212 static struct ws_mono_palettecxx . . $ ws_mono_palette# ws_mono_palettescxx . . $ ws_mono_palettes.[] = {
213 { "default", 0x000000, 0xFFFFFF },
214 { "wonderswan", 0x3E3D20, 0x9B9D66 },
215 { "wondeswan_color", 0x1B201E, 0xD7D49D },
216 { "swancrystal", 0x151108, 0xFFFCCA },
217 { "gb_dmg", 0x00420C, 0x578200 },
218 { "gb_pocket", 0x2A3325, 0xA7B19A },
219 { "gb_light", 0x00778D, 0x01CBDF },
220 { "blossom_pink", 0x180F0F, 0xF09898 },
221 { "bubbles_blue", 0x0D1418, 0x88D0F0 },
222 { "buttercup_green", 0x12160D, 0xB8E088 },
223 { "digivice", 0x000000, 0x8C8C73 },
224 { "game_com", 0x000000, 0xA7BF6B },
225 { "gameking", 0x184221, 0x8CCE94 },
226 { "game_master", 0x2D2D2B, 0x829FA6 },
227 { "golden_wild", 0x120F0A, 0xB99F65 },
228 { "greenscale", 0x0C360C, 0x9CBE0C },
229 { "hokage_orange", 0x170D08, 0xEA8352 },
230 { "labo_fawn", 0x15110B, 0xD7AA73 },
231 { "legendary_super_saiyan", 0x101509, 0xA5DB5A },
232 { "microvision", 0x303030, 0xA0A0A0 },
233 { "million_live_gold", 0x141109, 0xCDB261 },
234 { "odyssey_gold", 0x131000, 0xC2A000 },
235 { "shiny_sky_blue", 0x0E1216, 0x8CB6DF },
236 { "slime_blue", 0x040E14, 0x2F8CCC },
237 { "ti_83", 0x181810, 0x9CA684 },
238 { "travel_wood", 0x482810, 0xF8D8B0 },
239 { "virtual_boy", 0x000000, 0xE30000 },
240 { NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, 0, 0 },
241 };
242
243 static uint32cxx . . $ uint32# mono_pal_startcxx . . $ mono_pal_start. = 0x000000;
244 static uint32cxx . . $ uint32# mono_pal_endcxx . . $ mono_pal_end. = 0xFFFFFF;
245
246 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! find_mono_palettecxx . . $ find_mono_palette(30d3b00a82c26e2c).(const char* name,
247 uint32cxx . . $ uint32# *start, uint32cxx . . $ uint32# *end)
248 {
249 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! palette_found = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
250 unsigned i;
251
252 for (i = 0; ws_mono_palettescxx . . $ ws_mono_palettes.[i].namecxx . . $ ws_mono_palette#name.; i++)
253 {
254 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(ws_mono_palettescxx . . $ ws_mono_palettes.[i].namecxx . . $ ws_mono_palette#name., name))
255 {
256 *start = ws_mono_palettescxx . . $ ws_mono_palettes.[i].startcxx . . $ ws_mono_palette#start.;
257 *end = ws_mono_palettescxx . . $ ws_mono_palettes.[i].endcxx . . $ ws_mono_palette#end.;
258 palette_found = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
259 break;
260 }
261 }
262
263 if (!palette_found)
264 {
265 *start = 0x000000;
266 *end = 0xFFFFFF;
267 }
268
269 return palette_found;
270 }
271
272 /* Frameskipping */
273
274 static unsigned frameskip_typecxx . . $ frameskip_type. = 0;
275 static unsigned frameskip_thresholdcxx . . $ frameskip_threshold. = 0;
276 static uint16_tcxx . . $ uint16_t# frameskip_countercxx . . $ frameskip_counter. = 0;
277
278 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_audio_buff_activecxx . . $ retro_audio_buff_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
279 static unsigned retro_audio_buff_occupancycxx . . $ retro_audio_buff_occupancy. = 0;
280 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_audio_buff_underruncxx . . $ retro_audio_buff_underrun. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
281 /* Maximum number of consecutive frames that
282 * can be skipped */
283 #define FRAMESKIP_MAXcxx . . $ `libretro.c:283:9`! 30
284
285 static unsigned audio_latencycxx . . $ audio_latency. = 0;
286 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! update_audio_latencycxx . . $ update_audio_latency. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
287
288 static void retro_audio_buff_status_cbcxx . . $ retro_audio_buff_status_cb(c40279fe4e322181).(
289 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! active, unsigned occupancy, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! underrun_likely)
290 {
291 retro_audio_buff_activecxx . . $ retro_audio_buff_active. = active;
292 retro_audio_buff_occupancycxx . . $ retro_audio_buff_occupancy. = occupancy;
293 retro_audio_buff_underruncxx . . $ retro_audio_buff_underrun. = underrun_likely;
294 }
295
296 static void init_frameskipcxx . . $ init_frameskip(49f6e7a06ebc5aa8).(void)
297 {
298 if (frameskip_typecxx . . $ frameskip_type. > 0)
299 {
300 struct retro_audio_buffer_status_callbackcxx . . $ retro_audio_buffer_status_callback# buf_status_cb;
301
302 buf_status_cb.callbackcxx . . $ retro_audio_buffer_status_callback#callback. = retro_audio_buff_status_cbcxx . . $ retro_audio_buff_status_cb(c40279fe4e322181).;
303 if (!environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACKcxx . . $ `libretro-common/include/libretro.h:1357:9`!,
304 &buf_status_cb))
305 {
306 if (log_cbcxx . . $ log_cb.)
307 log_cbcxx . . $ log_cb.(RETRO_LOG_WARNcxx . . $ RETRO_LOG_WARN., "Frameskip disabled - frontend does not support audio buffer status monitoring.\n");
308
309 retro_audio_buff_activecxx . . $ retro_audio_buff_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
310 retro_audio_buff_occupancycxx . . $ retro_audio_buff_occupancy. = 0;
311 retro_audio_buff_underruncxx . . $ retro_audio_buff_underrun. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
312 audio_latencycxx . . $ audio_latency. = 0;
313 }
314 else
315 {
316 float fps;
317 float latency_factor;
318 float frame_time_msec;
319
320 if (retro_60hz_enabledcxx . . $ retro_60hz_enabled.)
321 {
322 fps = (float)RETRO_60HZ_FPScxx . . $ `libretro.c:92:9`!;
323 latency_factor = 6.0f;
324 }
325 else
326 {
327 fps = (float)MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`!;
328 latency_factor = 8.0f;
329 }
330
331 /* Frameskip is enabled - increase frontend
332 * audio latency to minimise potential
333 * buffer underruns */
334 frame_time_msec = 1000.0f / fps;
335
336 /* Set latency to an integer multiple of
337 * the current frame time...
338 * > At 60Hz we normally use a 6x multiplier
339 * > The native (unusually high) 75Hz of the
340 * WonderSwan seems to place greater demands
341 * on the frontend, so we increase the
342 * multiplier to 8x; this gives the frontend
343 * more room to manoeuvre, and improves the
344 * efficacy of the 'Auto' frameskip setting */
345 audio_latencycxx . . $ audio_latency. = (unsigned)((latency_factor * frame_time_msec) + 0.5f);
346
347 /* ...then round up to nearest multiple of 32 */
348 audio_latencycxx . . $ audio_latency. = (audio_latencycxx . . $ audio_latency. + 0x1F) & ~0x1F;
349 }
350 }
351 else
352 {
353 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_AUDIO_BUFFER_STATUS_CALLBACKcxx . . $ `libretro-common/include/libretro.h:1357:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
354 audio_latencycxx . . $ audio_latency. = 0;
355 }
356
357 update_audio_latencycxx . . $ update_audio_latency. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
358 }
359
360 /* Cygne
361 *
362 * Copyright notice for this file:
363 * Copyright (C) 2002 Dox [email protected]
364 *
365 * This program is free software; you can redistribute it and/or modify
366 * it under the terms of the GNU General Public License as published by
367 * the Free Software Foundation; either version 2 of the License, or
368 * (at your option) any later version.
369 *
370 * This program is distributed in the hope that it will be useful,
371 * but WITHOUT ANY WARRANTY; without even the implied warranty of
372 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
373 * GNU General Public License for more details.
374 *
375 * You should have received a copy of the GNU General Public License
376 * along with this program; if not, write to the Free Software
377 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
378 */
379
380 int wsccxx . . $ wsc. = 1; /*color/mono*/
381 uint32cxx . . $ uint32# rom_sizecxx . . $ rom_size.;
382
383 uint16cxx . . $ uint16# WSButtonStatuscxx . . $ WSButtonStatus.;
384
385 static void Resetcxx . . $ Reset(49f6e7a06ebc5aa8).(void)
386 {
387 int u0;
388
389 v30mz_resetcxx . . $ v30mz_reset(49f6e7a06ebc5aa8).(); /* Reset CPU */
390 WSwan_MemoryResetcxx . . $ WSwan_MemoryReset(49f6e7a06ebc5aa8).();
391 WSwan_GfxResetcxx . . $ WSwan_GfxReset(49f6e7a06ebc5aa8).();
392 WSwan_SoundResetcxx . . $ WSwan_SoundReset(49f6e7a06ebc5aa8).();
393 WSwan_InterruptResetcxx . . $ WSwan_InterruptReset(49f6e7a06ebc5aa8).();
394 WSwan_RTCResetcxx . . $ WSwan_RTCReset(49f6e7a06ebc5aa8).();
395 WSwan_EEPROMResetcxx . . $ WSwan_EEPROMReset(49f6e7a06ebc5aa8).();
396
397 for(u0=0;u0<0xc9;u0++)
398 {
399 if(u0 != 0xC4 && u0 != 0xC5 && u0 != 0xBA && u0 != 0xBB)
400 WSwan_writeportcxx . . $ WSwan_writeport(cc289a6b3dfc48da).(u0,startiocxx . . $ startio.[u0]);
401 }
402
403 v30mz_set_regcxx . . $ v30mz_set_reg(c8dafc4a64bf4a1c).(NEC_SScxx . . $ NEC_SS.,0);
404 v30mz_set_regcxx . . $ v30mz_set_reg(c8dafc4a64bf4a1c).(NEC_SPcxx . . $ NEC_SP.,0x2000);
405 }
406
407 static uint8cxx . . $ uint8# *cheecxx . . $ chee. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
408
409 static void Emulatecxx . . $ Emulate(10a9d664ea04b9d1).(EmulateSpecStructcxx . . $ EmulateSpecStruct# *espec,
410 int skip_frame, int update_sample_rate)
411 {
412 espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_2#surface. = surfcxx . . $ surf.;
413 espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_2#DisplayRect..wcxx . . $ $anonymous_type_37d9811fbae164eb_0#w. = 224;
414 espec->DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_2#DisplayRect..hcxx . . $ $anonymous_type_37d9811fbae164eb_0#h. = 144;
415 espec->skipcxx . . $ $anonymous_type_643ef407c229d02_2#skip. = skip_frame;
416 espec->SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize. = 0;
417
418 if (update_sample_rate)
419 WSwan_SetSoundRatecxx . . $ WSwan_SetSoundRate(dfa6e707f7696010).(RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.);
420
421 WSButtonStatuscxx . . $ WSButtonStatus. = cheecxx . . $ chee.[0] | (cheecxx . . $ chee.[1] << 8);
422
423 MDFNMP_ApplyPeriodicCheatscxx . . $ MDFNMP_ApplyPeriodicCheats(49f6e7a06ebc5aa8).();
424
425 while (!wsExecuteLinecxx . . $ wsExecuteLine(2bff9fec511e2efe).(espec->surfacecxx . . $ $anonymous_type_643ef407c229d02_2#surface., espec->skipcxx . . $ $anonymous_type_643ef407c229d02_2#skip.));
426
427 espec->SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize. = WSwan_SoundFlushcxx . . $ WSwan_SoundFlush(33dfaf4ca3af819f).(&audio_samples_bufcxx . . $ audio_samples_buf.,
428 &audio_samples_buf_sizecxx . . $ audio_samples_buf_size.);
429
430 if (audio_low_pass_enabledcxx . . $ audio_low_pass_enabled.)
431 audio_low_pass_applycxx . . $ audio_low_pass_apply(4683f455c3e046d4).(audio_samples_bufcxx . . $ audio_samples_buf.,
432 espec->SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize.);
433
434 v30mz_timestampcxx . . $ v30mz_timestamp. = 0;
435 }
436
437 #if 0
438 typedef struct
439 {
440 const uint8 id;
441 const char *name;
442 } DLEntry;
443
444 static const DLEntry Developers[] =
445 {
446 { 0x01, "Bandai" },
447 { 0x02, "Taito" },
448 { 0x03, "Tomy" },
449 { 0x04, "Koei" },
450 { 0x05, "Data East" },
451 { 0x06, "Asmik" }, /* Asmik Ace? */
452 { 0x07, "Media Entertainment" },
453 { 0x08, "Nichibutsu" },
454 { 0x0A, "Coconuts Japan" },
455 { 0x0B, "Sammy" },
456 { 0x0C, "Sunsoft" },
457 { 0x0D, "Mebius" },
458 { 0x0E, "Banpresto" },
459 { 0x10, "Jaleco" },
460 { 0x11, "Imagineer" },
461 { 0x12, "Konami" },
462 { 0x16, "Kobunsha" },
463 { 0x17, "Bottom Up" },
464 { 0x18, "Kaga Tech" },
465 { 0x19, "Sunrise" },
466 { 0x1A, "Cyber Front" },
467 { 0x1B, "Mega House" },
468 { 0x1D, "Interbec" },
469 { 0x1E, "Nihon Application" },
470 { 0x1F, "Bandai Visual" },
471 { 0x20, "Athena" },
472 { 0x21, "KID" },
473 { 0x22, "HAL Corporation" },
474 { 0x23, "Yuki Enterprise" },
475 { 0x24, "Omega Micott" },
476 { 0x25, "Layup" },
477 { 0x26, "Kadokawa Shoten" },
478 { 0x27, "Shall Luck" },
479 { 0x28, "Squaresoft" },
480 { 0x2B, "Tom Create" },
481 { 0x2D, "Namco" },
482 { 0x2E, "Movic" }, /* ???? */
483 { 0x2F, "E3 Staff" }, /* ???? */
484 { 0x31, "Vanguard" },
485 { 0x32, "Megatron" },
486 { 0x33, "Wiz" },
487 { 0x36, "Capcom" }
488 };
489 #endif
490
491 static uint32cxx . . $ uint32# SRAMSizecxx . . $ SRAMSize.;
492
493 static int Loadcxx . . $ Load(22502bda773498f8).(const uint8_tcxx . . $ uint8_t# *data, size_t size)
494 {
495 uint32cxx . . $ uint32# pow_size = 0;
496 uint32cxx . . $ uint32# real_rom_size = 0;
497 uint8cxx . . $ uint8# header[10];
498
499 if(size < 65536)
500 return 0;
501
502 real_rom_size = (size + 0xFFFF) & ~0xFFFF;
503 pow_size = next_pow2cxx . . $ next_pow2(2141b656ce2cc063).(real_rom_size);
504 rom_sizecxx . . $ rom_size. = pow_size + (pow_size == 0);
505
506 wsCartROMcxx . . $ wsCartROM. = (uint8cxx . . $ uint8# *)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, rom_sizecxx . . $ rom_size.);
507
508 /* This real_rom_size vs rom_size funny business
509 * is intended primarily for handling
510 * WSR files. */
511 if(real_rom_size < rom_sizecxx . . $ rom_size.)
512 memsetcxx . . $ memset(d1de1e4fb215f1c6).(wsCartROMcxx . . $ wsCartROM., 0xFF, rom_sizecxx . . $ rom_size. - real_rom_size);
513
514 memcpycxx . . $ memcpy(cc817cb175f282d).(wsCartROMcxx . . $ wsCartROM. + (rom_sizecxx . . $ rom_size. - real_rom_size), data, size);
515
516 memcpycxx . . $ memcpy(cc817cb175f282d).(header, wsCartROMcxx . . $ wsCartROM. + rom_sizecxx . . $ rom_size. - 10, 10);
517
518 SRAMSizecxx . . $ SRAMSize. = 0;
519 eeprom_sizecxx . . $ eeprom_size. = 0;
520
521 switch(header[5])
522 {
523 case 0x01: SRAMSizecxx . . $ SRAMSize. = 8 * 1024; break;
524 case 0x02: SRAMSizecxx . . $ SRAMSize. = 32 * 1024; break;
525 case 0x03: SRAMSizecxx . . $ SRAMSize. = 128 * 1024; break;
526 case 0x04: SRAMSizecxx . . $ SRAMSize. = 256 * 1024; break; /* Dicing Knight!, Judgement Silver */
527 case 0x05: SRAMSizecxx . . $ SRAMSize. = 512 * 1024; break; /* Wonder Gate */
528
529 case 0x10: eeprom_sizecxx . . $ eeprom_size. = 128; break;
530 case 0x20: eeprom_sizecxx . . $ eeprom_size. = 2 *1024; break;
531 case 0x50: eeprom_sizecxx . . $ eeprom_size. = 1024; break;
532 }
533
534 if((header[8] | (header[9] << 8)) == 0x8de1 && (header[0]==0x01)&&(header[2]==0x27)) /* Detective Conan */
535 {
536 /* WS cpu is using cache/pipeline or there's protected ROM bank where pointing CS */
537 wsCartROMcxx . . $ wsCartROM.[0xfffe8]=0xea;
538 wsCartROMcxx . . $ wsCartROM.[0xfffe9]=0x00;
539 wsCartROMcxx . . $ wsCartROM.[0xfffea]=0x00;
540 wsCartROMcxx . . $ wsCartROM.[0xfffeb]=0x00;
541 wsCartROMcxx . . $ wsCartROM.[0xfffec]=0x20;
542 }
543
544 #if 0
545 if(header[6] & 0x1)
546 EmulatedWSwan.rotated = MDFN_ROTATE90;
547 #endif
548
549 MDFNMP_Initcxx . . $ MDFNMP_Init(8e1b545ea3aecce3).(16384, (1 << 20) / 1024);
550
551 v30mz_initcxx . . $ v30mz_init(1d5ff4e15148a664).(WSwan_readmem20cxx . . $ WSwan_readmem20(32407b39b2dfce37)., WSwan_writemem20cxx . . $ WSwan_writemem20(cc289a6b3dfc48da)., WSwan_readportcxx . . $ WSwan_readport(32407b39b2dfce37)., WSwan_writeportcxx . . $ WSwan_writeport(cc289a6b3dfc48da).);
552 WSwan_MemoryInitcxx . . $ WSwan_MemoryInit(83c327a91a6f0fc7).(MDFN_GetSettingBcxx . . $ MDFN_GetSettingB(c5f7da30cbc0f4e9).("wswan.language"), wsccxx . . $ wsc., SRAMSizecxx . . $ SRAMSize., falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!); /* EEPROM and SRAM are loaded in this func. */
553 WSwan_GfxInitcxx . . $ WSwan_GfxInit(49f6e7a06ebc5aa8).();
554
555 WSwan_SoundInitcxx . . $ WSwan_SoundInit(49f6e7a06ebc5aa8).();
556
557 wsMakeTilescxx . . $ wsMakeTiles(49f6e7a06ebc5aa8).();
558
559 Resetcxx . . $ Reset(49f6e7a06ebc5aa8).();
560
561 return 1;
562 }
563
564 static void CloseGamecxx . . $ CloseGame(49f6e7a06ebc5aa8).(void)
565 {
566 WSwan_MemoryKillcxx . . $ WSwan_MemoryKill(49f6e7a06ebc5aa8).();
567
568 WSwan_SoundKillcxx . . $ WSwan_SoundKill(49f6e7a06ebc5aa8).();
569
570 if(wsCartROMcxx . . $ wsCartROM.)
571 {
572 freecxx . . $ free(5d22bdacc48458e8).(wsCartROMcxx . . $ wsCartROM.);
573 wsCartROMcxx . . $ wsCartROM. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
574 }
575 }
576
577 int StateActioncxx . . $ StateAction(a45b884b8cf568d5).(StateMemcxx . . $ StateMem# *sm, int load, int data_only)
578 {
579 if(!v30mz_StateActioncxx . . $ v30mz_StateAction(a45b884b8cf568d5).(sm, load, data_only))
580 return 0;
581 /* Call MemoryStateAction before others StateActions... */
582 if(!WSwan_MemoryStateActioncxx . . $ WSwan_MemoryStateAction(a45b884b8cf568d5).(sm, load, data_only))
583 return 0;
584 if(!WSwan_GfxStateActioncxx . . $ WSwan_GfxStateAction(a45b884b8cf568d5).(sm, load, data_only))
585 return 0;
586 if(!WSwan_RTCStateActioncxx . . $ WSwan_RTCStateAction(a45b884b8cf568d5).(sm, load, data_only))
587 return 0;
588 if(!WSwan_InterruptStateActioncxx . . $ WSwan_InterruptStateAction(a45b884b8cf568d5).(sm, load, data_only))
589 return 0;
590 if(!WSwan_SoundStateActioncxx . . $ WSwan_SoundStateAction(a45b884b8cf568d5).(sm, load, data_only))
591 return 0;
592 if(!WSwan_EEPROMStateActioncxx . . $ WSwan_EEPROMStateAction(a45b884b8cf568d5).(sm, load, data_only))
593 return 0;
594 return 1;
595 }
596
597 static void DoSimpleCommandcxx . . $ DoSimpleCommand(d4f767463ce0a6b3).(int cmd)
598 {
599 switch(cmd)
600 {
601 case MDFN_MSC_POWERcxx . . $ MDFN_MSC_POWER.:
602 case MDFN_MSC_RESETcxx . . $ MDFN_MSC_RESET.:
603 Resetcxx . . $ Reset(49f6e7a06ebc5aa8).();
604 break;
605 }
606 }
607
608 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! update_audiocxx . . $ update_audio. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
609 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! update_videocxx . . $ update_video. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
610
611 static boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! MDFNI_LoadGamecxx . . $ MDFNI_LoadGame(3be9901e16357505).(
612 const char *force_module, const uint8_tcxx . . $ uint8_t# *data,
613 size_t size)
614 {
615 if(Loadcxx . . $ Load(22502bda773498f8).(data, size) <= 0)
616 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
617
618 MDFN_LoadGameCheatscxx . . $ MDFN_LoadGameCheats(5d22bdacc48458e8).(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
619 MDFNMP_InstallReadPatchescxx . . $ MDFNMP_InstallReadPatches(49f6e7a06ebc5aa8).();
620
621 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
622 }
623
624 static void MDFNI_CloseGamecxx . . $ MDFNI_CloseGame(49f6e7a06ebc5aa8).(void)
625 {
626 MDFN_FlushGameCheatscxx . . $ MDFN_FlushGameCheats(d4f767463ce0a6b3).(0);
627
628 CloseGamecxx . . $ CloseGame(49f6e7a06ebc5aa8).();
629
630 MDFNMP_Killcxx . . $ MDFNMP_Kill(49f6e7a06ebc5aa8).();
631 }
632
633 static void check_system_specscxx . . $ check_system_specs(49f6e7a06ebc5aa8).(void)
634 {
635 /* TODO - should theoretically be level 4, but apparently
636 * doesn't run at fullspeed on PSP (yet) */
637 unsigned level = 4;
638 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVELcxx . . $ `libretro-common/include/libretro.h:537:9`!, &level);
639 }
640
641 static void check_depthcxx . . $ check_depth(49f6e7a06ebc5aa8).(void)
642 {
643 if (RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. == 24)
644 {
645 enum retro_pixel_formatcxx . . $ retro_pixel_format# rgb888 = RETRO_PIXEL_FORMAT_XRGB8888cxx . . $ RETRO_PIXEL_FORMAT_XRGB8888.;
646
647 if (!environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_PIXEL_FORMATcxx . . $ `libretro-common/include/libretro.h:568:9`!, &rgb888))
648 {
649 if (log_cbcxx . . $ log_cb.) log_cbcxx . . $ log_cb.(RETRO_LOG_ERRORcxx . . $ RETRO_LOG_ERROR., "Pixel format XRGB8888 not supported by platform.\n");
650
651 RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. = 2;
652 RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. = 15;
653 }
654 }
655
656 #if defined(FRONTEND_SUPPORTS_RGB565cxx . . $ `<built-in>:412:9`!)
657 if (RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. == 2)
658 {
659 enum retro_pixel_formatcxx . . $ retro_pixel_format# rgb565 = RETRO_PIXEL_FORMAT_RGB565cxx . . $ RETRO_PIXEL_FORMAT_RGB565.;
660
661 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_PIXEL_FORMATcxx . . $ `libretro-common/include/libretro.h:568:9`!, &rgb565))
662 {
663 if (log_cbcxx . . $ log_cb.) log_cbcxx . . $ log_cb.(RETRO_LOG_INFOcxx . . $ RETRO_LOG_INFO., "Frontend supports RGB565 - will use that instead of XRGB1555.\n");
664
665 RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. = 16;
666 }
667 }
668 #endif
669 }
670
671 static void rotate_displaycxx . . $ rotate_display(49f6e7a06ebc5aa8).(void)
672 {
673 if (hw_rotate_enabledcxx . . $ hw_rotate_enabled.)
674 {
675 struct retro_game_geometrycxx . . $ retro_game_geometry# new_geom = {
676 FB_WIDTHcxx . . $ `libretro.c:36:9`!,
677 FB_HEIGHTcxx . . $ `libretro.c:37:9`!,
678 FB_WIDTHcxx . . $ `libretro.c:36:9`!,
679 FB_HEIGHTcxx . . $ `libretro.c:37:9`!,
680 rotate_tallcxx . . $ rotate_tall. ? (9.0 / 14.0) : (14.0 / 9.0)
681 };
682 unsigned rot_angle = rotate_tallcxx . . $ rotate_tall. ?
683 1 : /* 90 degrees */
684 0; /* 0 degrees */
685
686 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_GEOMETRYcxx . . $ `libretro-common/include/libretro.h:933:9`!, (void*)&new_geom);
687 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_ROTATIONcxx . . $ `libretro-common/include/libretro.h:504:9`!, (void*)&rot_angle);
688 }
689 else
690 {
691 struct retro_game_geometrycxx . . $ retro_game_geometry# new_geom = {
692 rotate_tallcxx . . $ rotate_tall. ? FB_HEIGHTcxx . . $ `libretro.c:37:9`! : FB_WIDTHcxx . . $ `libretro.c:36:9`!,
693 rotate_tallcxx . . $ rotate_tall. ? FB_WIDTHcxx . . $ `libretro.c:36:9`! : FB_HEIGHTcxx . . $ `libretro.c:37:9`!,
694 FB_WIDTHcxx . . $ `libretro.c:36:9`!,
695 FB_WIDTHcxx . . $ `libretro.c:36:9`!,
696 rotate_tallcxx . . $ rotate_tall. ? (9.0 / 14.0) : (14.0 / 9.0)
697 };
698
699 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_GEOMETRYcxx . . $ `libretro-common/include/libretro.h:933:9`!, (void*)&new_geom);
700 }
701 }
702
703 static void check_variablescxx . . $ check_variables(d4f767463ce0a6b3).(int startup)
704 {
705 struct retro_variablecxx . . $ retro_variable# var = {0};
706 uint32cxx . . $ uint32# prev_mono_pal_start;
707 uint32cxx . . $ uint32# prev_mono_pal_end;
708 unsigned prev_frameskip_type;
709 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! update_60hz_mode = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
710
711 var.keycxx . . $ retro_variable#key. = "wswan_rotate_display",
712 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
713
714 retro_display_rotationcxx . . $ retro_display_rotation. = DISPLAY_ROTATION_MANUALcxx . . $ DISPLAY_ROTATION_MANUAL.;
715
716 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
717 {
718 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "portrait"))
719 retro_display_rotationcxx . . $ retro_display_rotation. = DISPLAY_ROTATION_PORTRAITcxx . . $ DISPLAY_ROTATION_PORTRAIT.;
720 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "landscape"))
721 retro_display_rotationcxx . . $ retro_display_rotation. = DISPLAY_ROTATION_LANDSCAPEcxx . . $ DISPLAY_ROTATION_LANDSCAPE.;
722 }
723
724 switch (retro_display_rotationcxx . . $ retro_display_rotation.)
725 {
726 case DISPLAY_ROTATION_PORTRAITcxx . . $ DISPLAY_ROTATION_PORTRAIT.:
727 if (!rotate_tallcxx . . $ rotate_tall.)
728 {
729 rotate_tallcxx . . $ rotate_tall. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
730 rotate_displaycxx . . $ rotate_display(49f6e7a06ebc5aa8).();
731 }
732 break;
733 case DISPLAY_ROTATION_LANDSCAPEcxx . . $ DISPLAY_ROTATION_LANDSCAPE.:
734 if (rotate_tallcxx . . $ rotate_tall.)
735 {
736 rotate_tallcxx . . $ rotate_tall. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
737 rotate_displaycxx . . $ rotate_display(49f6e7a06ebc5aa8).();
738 }
739 break;
740 default:
741 break;
742 }
743
744 var.keycxx . . $ retro_variable#key. = "wswan_rotate_keymap",
745 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
746
747 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
748 {
749 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "disabled"))
750 rotate_joymapcxx . . $ rotate_joymap. = 0;
751 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "enabled"))
752 rotate_joymapcxx . . $ rotate_joymap. = 1;
753 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "auto"))
754 rotate_joymapcxx . . $ rotate_joymap. = 2;
755 }
756
757 var.keycxx . . $ retro_variable#key. = "wswan_mono_palette",
758 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
759
760 prev_mono_pal_start = mono_pal_startcxx . . $ mono_pal_start.;
761 prev_mono_pal_end = mono_pal_endcxx . . $ mono_pal_end.;
762
763 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
764 find_mono_palettecxx . . $ find_mono_palette(30d3b00a82c26e2c).(var.valuecxx . . $ retro_variable#value., &mono_pal_startcxx . . $ mono_pal_start., &mono_pal_endcxx . . $ mono_pal_end.);
765
766 if ((mono_pal_startcxx . . $ mono_pal_start. != prev_mono_pal_start) ||
767 (mono_pal_endcxx . . $ mono_pal_end. != prev_mono_pal_end))
768 WSwan_SetMonoPalettecxx . . $ WSwan_SetMonoPalette(2029de666eaec704).(RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH., mono_pal_startcxx . . $ mono_pal_start., mono_pal_endcxx . . $ mono_pal_end.);
769
770 var.keycxx . . $ retro_variable#key. = "wswan_frameskip";
771 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
772
773 prev_frameskip_type = frameskip_typecxx . . $ frameskip_type.;
774 frameskip_typecxx . . $ frameskip_type. = 0;
775
776 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
777 {
778 if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "auto") == 0)
779 frameskip_typecxx . . $ frameskip_type. = 1;
780 else if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "manual") == 0)
781 frameskip_typecxx . . $ frameskip_type. = 2;
782 }
783
784 var.keycxx . . $ retro_variable#key. = "wswan_frameskip_threshold";
785 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
786
787 frameskip_thresholdcxx . . $ frameskip_threshold. = 33;
788
789 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
790 frameskip_thresholdcxx . . $ frameskip_threshold. = strtolcxx . . $ strtol(44bbb87609b212fc).(var.valuecxx . . $ retro_variable#value., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, 10);
791
792 var.keycxx . . $ retro_variable#key. = "wswan_60hz_mode";
793 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
794
795 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
796 {
797 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! old_value = retro_60hz_enabledcxx . . $ retro_60hz_enabled.;
798
799 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "disabled"))
800 retro_60hz_enabledcxx . . $ retro_60hz_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
801 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "enabled"))
802 retro_60hz_enabledcxx . . $ retro_60hz_enabled. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
803
804 if (!startup && (old_value != retro_60hz_enabledcxx . . $ retro_60hz_enabled.))
805 {
806 update_videocxx . . $ update_video. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
807 update_60hz_mode = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
808 }
809 }
810
811 var.keycxx . . $ retro_variable#key. = "wswan_sound_sample_rate";
812 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
813
814 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
815 {
816 int old_value = RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.;
817
818 RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. = atoicxx . . $ atoi(5c4306d8553b3696).(var.valuecxx . . $ retro_variable#value.);
819 RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. = (RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. < 11025) ?
820 11025 : RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.;
821 RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. = (RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. > 48000) ?
822 48000 : RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.;
823
824 if (!startup && (old_value != RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.))
825 {
826 update_audiocxx . . $ update_audio. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
827 /* If audio sample rate changes, must reinitialise
828 * 60Hz mode (will be a no-op if 60Hz mode is
829 * currently inactive) */
830 update_60hz_mode = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
831 }
832 }
833
834 var.keycxx . . $ retro_variable#key. = "wswan_sound_low_pass";
835 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
836
837 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
838 {
839 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "disabled"))
840 audio_low_pass_enabledcxx . . $ audio_low_pass_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
841 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "enabled"))
842 audio_low_pass_enabledcxx . . $ audio_low_pass_enabled. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
843 }
844
845 if (startup)
846 {
847 var.keycxx . . $ retro_variable#key. = "wswan_gfx_colors";
848 var.valuecxx . . $ retro_variable#value. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
849
850 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLEcxx . . $ `libretro-common/include/libretro.h:611:9`!, &var) && var.valuecxx . . $ retro_variable#value.)
851 {
852 if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "16bit"))
853 {
854 RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. = 2;
855 RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. = 16;
856 }
857 else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(var.valuecxx . . $ retro_variable#value., "24bit"))
858 {
859 RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. = 4;
860 RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH. = 24;
861 }
862 }
863 }
864
865 if (update_60hz_mode)
866 retro_60hz_initcxx . . $ retro_60hz_init(49f6e7a06ebc5aa8).();
867
868 /* (Re)Initialise frameskipping, if required */
869 if (startup ||
870 (frameskip_typecxx . . $ frameskip_type. != prev_frameskip_type) ||
871 update_60hz_mode)
872 init_frameskipcxx . . $ init_frameskip(49f6e7a06ebc5aa8).();
873 }
874
875 void retro_initcxx . . $ retro_init(49f6e7a06ebc5aa8).(void)
876 {
877 struct retro_log_callbackcxx . . $ retro_log_callback# log;
878 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_LOG_INTERFACEcxx . . $ `libretro-common/include/libretro.h:772:9`!, &log))
879 log_cbcxx . . $ log_cb. = log.logcxx . . $ retro_log_callback#log.;
880 else
881 log_cbcxx . . $ log_cb. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
882
883 frameskip_typecxx . . $ frameskip_type. = 0;
884 frameskip_thresholdcxx . . $ frameskip_threshold. = 0;
885 frameskip_countercxx . . $ frameskip_counter. = 0;
886 retro_audio_buff_activecxx . . $ retro_audio_buff_active. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
887 retro_audio_buff_occupancycxx . . $ retro_audio_buff_occupancy. = 0;
888 retro_audio_buff_underruncxx . . $ retro_audio_buff_underrun. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
889 audio_latencycxx . . $ audio_latency. = 0;
890 update_audio_latencycxx . . $ update_audio_latency. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
891 audio_low_pass_enabledcxx . . $ audio_low_pass_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
892 audio_low_pass_acc_leftcxx . . $ audio_low_pass_acc_left. = 0;
893 audio_low_pass_acc_rightcxx . . $ audio_low_pass_acc_right. = 0;
894
895 check_system_specscxx . . $ check_system_specs(49f6e7a06ebc5aa8).();
896 check_variablescxx . . $ check_variables(d4f767463ce0a6b3).(truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!);
897 check_depthcxx . . $ check_depth(49f6e7a06ebc5aa8).();
898
899 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_INPUT_BITMASKScxx . . $ `libretro-common/include/libretro.h:1112:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!))
900 libretro_supports_bitmaskscxx . . $ libretro_supports_bitmasks. = truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
901 }
902
903 void retro_resetcxx . . $ retro_reset(49f6e7a06ebc5aa8).(void)
904 {
905 DoSimpleCommandcxx . . $ DoSimpleCommand(d4f767463ce0a6b3).(MDFN_MSC_RESETcxx . . $ MDFN_MSC_RESET.);
906 }
907
908 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_load_game_specialcxx . . $ retro_load_game_special(bd3da2cb0fb3e69a).(unsigned a, const struct retro_game_infocxx . . $ retro_game_info# *b, size_t c)
909 {
910 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
911 }
912
913 #define MAX_PLAYERScxx . . $ `libretro.c:913:9`! 1
914 #define MAX_BUTTONScxx . . $ `libretro.c:914:9`! 11
915 static uint16_tcxx . . $ uint16_t# input_bufcxx . . $ input_buf.;
916
917 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_load_gamecxx . . $ retro_load_game(19e33f369b94c047).(const struct retro_game_infocxx . . $ retro_game_info# *info)
918 {
919 const unsigned rot_angle = 0;
920
921 struct retro_input_descriptorcxx . . $ retro_input_descriptor# desc[] = {
922 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_LEFTcxx . . $ `libretro-common/include/libretro.h:194:9`!, "X Cursor Left" },
923 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_UPcxx . . $ `libretro-common/include/libretro.h:192:9`!, "X Cursor Up" },
924 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_DOWNcxx . . $ `libretro-common/include/libretro.h:193:9`!, "X Cursor Down" },
925 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_RIGHTcxx . . $ `libretro-common/include/libretro.h:195:9`!, "X Cursor Right" },
926 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_Lcxx . . $ `libretro-common/include/libretro.h:198:9`!, "Y Cursor Left" },
927 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_R2cxx . . $ `libretro-common/include/libretro.h:201:9`!, "Y Cursor Up" },
928 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_L2cxx . . $ `libretro-common/include/libretro.h:200:9`!, "Y Cursor Down" },
929 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_Rcxx . . $ `libretro-common/include/libretro.h:199:9`!, "Y Cursor Right" },
930 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_Acxx . . $ `libretro-common/include/libretro.h:196:9`!, "A" },
931 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_Bcxx . . $ `libretro-common/include/libretro.h:188:9`!, "B" },
932 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_STARTcxx . . $ `libretro-common/include/libretro.h:191:9`!, "Start" },
933 { 0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_SELECTcxx . . $ `libretro-common/include/libretro.h:190:9`!, "Rotate screen + active D-Pad" },
934
935 { 0 },
936 };
937
938 if (!info)
939 goto error;
940
941 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORScxx . . $ `libretro-common/include/libretro.h:579:9`!, desc);
942
943 if (!MDFNI_LoadGamecxx . . $ MDFNI_LoadGame(3be9901e16357505).(MEDNAFEN_CORE_NAME_MODULEcxx . . $ `libretro.c:26:9`!,
944 (const uint8_tcxx . . $ uint8_t#*)info->datacxx . . $ retro_game_info#data., info->sizecxx . . $ retro_game_info#size.))
945 goto error;
946
947 cheecxx . . $ chee. = (uint8cxx . . $ uint8# *)&input_bufcxx . . $ input_buf.;
948 surfcxx . . $ surf. = (MDFN_Surfacecxx . . $ MDFN_Surface#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, sizeof(*surfcxx . . $ surf.));
949
950 if (!surfcxx . . $ surf.)
951 goto error;
952
953 surfcxx . . $ surf.->widthcxx . . $ $anonymous_type_37d9811fbae164eb_2#width. = FB_WIDTHcxx . . $ `libretro.c:36:9`!;
954 surfcxx . . $ surf.->heightcxx . . $ $anonymous_type_37d9811fbae164eb_2#height. = FB_HEIGHTcxx . . $ `libretro.c:37:9`!;
955 surfcxx . . $ surf.->pitchcxx . . $ $anonymous_type_37d9811fbae164eb_2#pitch. = FB_WIDTHcxx . . $ `libretro.c:36:9`!;
956 surfcxx . . $ surf.->depthcxx . . $ $anonymous_type_37d9811fbae164eb_2#depth. = RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH.;
957
958 #if defined(_3DS)
959 surf->pixels = (uint16_t*)linearMemAlign(FB_WIDTH * FB_HEIGHT * sizeof(uint32_t), 128);
960 #else
961 surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels. = (uint16_tcxx . . $ uint16_t#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, FB_WIDTHcxx . . $ `libretro.c:36:9`! * FB_HEIGHTcxx . . $ `libretro.c:37:9`! * sizeof(uint32_tcxx . . $ uint32_t#));
962 #endif
963
964 if (!surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.)
965 goto error;
966
967 /* Check whether 'hardware' rotation (via frontend
968 * gfx driver) is supported */
969 hw_rotate_enabledcxx . . $ hw_rotate_enabled. = environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_ROTATIONcxx . . $ `libretro-common/include/libretro.h:504:9`!, (void*)&rot_angle);
970
971 if (!hw_rotate_enabledcxx . . $ hw_rotate_enabled. && !rotate_bufcxx . . $ rotate_buf.)
972 {
973 #if defined(_3DS)
974 rotate_buf = (uint16_t*)linearMemAlign(FB_WIDTH * FB_HEIGHT * sizeof(uint32_t), 128);
975 #else
976 rotate_bufcxx . . $ rotate_buf. = (uint16_tcxx . . $ uint16_t#*)calloccxx . . $ calloc(63a7bf2941bfcd7a).(1, FB_WIDTHcxx . . $ `libretro.c:36:9`! * FB_HEIGHTcxx . . $ `libretro.c:37:9`! * sizeof(uint32_tcxx . . $ uint32_t#));
977 #endif
978
979 if (!rotate_bufcxx . . $ rotate_buf.)
980 goto error;
981 }
982
983 rotate_tallcxx . . $ rotate_tall. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
984 select_pressed_last_framecxx . . $ select_pressed_last_frame. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
985 rotate_joymapcxx . . $ rotate_joymap. = 0;
986
987 check_variablescxx . . $ check_variables(d4f767463ce0a6b3).(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
988
989 /* Allocate an audio buffer of sufficient size
990 * for the expected number of samples per frame
991 * (size will be increased automatically if
992 * configuration changes) */
993 audio_samples_buf_sizecxx . . $ audio_samples_buf_size. = ((int32_tcxx . . $ int32_t#)(RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE. /
994 MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`!) + 1) << 1;
995 audio_samples_bufcxx . . $ audio_samples_buf. = (int16_tcxx . . $ int16_t#*)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(audio_samples_buf_sizecxx . . $ audio_samples_buf_size. * sizeof(int16_tcxx . . $ int16_t#));
996
997 if (!audio_samples_bufcxx . . $ audio_samples_buf.)
998 goto error;
999
1000 retro_60hz_initcxx . . $ retro_60hz_init(49f6e7a06ebc5aa8).();
1001
1002 WSwan_SetPixelFormatcxx . . $ WSwan_SetPixelFormat(2029de666eaec704).(RETRO_PIX_DEPTHcxx . . $ RETRO_PIX_DEPTH.,
1003 mono_pal_startcxx . . $ mono_pal_start., mono_pal_endcxx . . $ mono_pal_end.);
1004 WSwan_SetSoundRatecxx . . $ WSwan_SetSoundRate(dfa6e707f7696010).(RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.);
1005
1006 return truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`!;
1007
1008 error:
1009 if (surfcxx . . $ surf.)
1010 {
1011 if (surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.)
1012 #if defined(_3DS)
1013 linearFree(surf->pixels);
1014 #else
1015 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.);
1016 #endif
1017 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.);
1018 }
1019 surfcxx . . $ surf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1020
1021 if (rotate_bufcxx . . $ rotate_buf.)
1022 #if defined(_3DS)
1023 linearFree(rotate_buf);
1024 #else
1025 freecxx . . $ free(5d22bdacc48458e8).(rotate_bufcxx . . $ rotate_buf.);
1026 #endif
1027 rotate_bufcxx . . $ rotate_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1028
1029 if (audio_samples_bufcxx . . $ audio_samples_buf.)
1030 freecxx . . $ free(5d22bdacc48458e8).(audio_samples_bufcxx . . $ audio_samples_buf.);
1031 audio_samples_bufcxx . . $ audio_samples_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1032 audio_samples_buf_sizecxx . . $ audio_samples_buf_size. = 0;
1033
1034 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1035 }
1036
1037 void retro_unload_gamecxx . . $ retro_unload_game(49f6e7a06ebc5aa8).(void)
1038 {
1039 MDFNI_CloseGamecxx . . $ MDFNI_CloseGame(49f6e7a06ebc5aa8).();
1040
1041 if (surfcxx . . $ surf.)
1042 {
1043 if (surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.)
1044 #if defined(_3DS)
1045 linearFree(surf->pixels);
1046 #else
1047 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.);
1048 #endif
1049 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.);
1050 }
1051 surfcxx . . $ surf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1052
1053 if (rotate_bufcxx . . $ rotate_buf.)
1054 #if defined(_3DS)
1055 linearFree(rotate_buf);
1056 #else
1057 freecxx . . $ free(5d22bdacc48458e8).(rotate_bufcxx . . $ rotate_buf.);
1058 #endif
1059 rotate_bufcxx . . $ rotate_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1060
1061 if (audio_samples_bufcxx . . $ audio_samples_buf.)
1062 freecxx . . $ free(5d22bdacc48458e8).(audio_samples_bufcxx . . $ audio_samples_buf.);
1063 audio_samples_bufcxx . . $ audio_samples_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1064 audio_samples_buf_sizecxx . . $ audio_samples_buf_size. = 0;
1065
1066 retro_60hz_deinitcxx . . $ retro_60hz_deinit(49f6e7a06ebc5aa8).();
1067 }
1068
1069 static void update_inputcxx . . $ update_input(49f6e7a06ebc5aa8).(void)
1070 {
1071 static unsigned map[2][11] = {
1072 {
1073 RETRO_DEVICE_ID_JOYPAD_UPcxx . . $ `libretro-common/include/libretro.h:192:9`!, /* X Cursor horizontal-layout games */
1074 RETRO_DEVICE_ID_JOYPAD_RIGHTcxx . . $ `libretro-common/include/libretro.h:195:9`!, /* X Cursor horizontal-layout games */
1075 RETRO_DEVICE_ID_JOYPAD_DOWNcxx . . $ `libretro-common/include/libretro.h:193:9`!, /* X Cursor horizontal-layout games */
1076 RETRO_DEVICE_ID_JOYPAD_LEFTcxx . . $ `libretro-common/include/libretro.h:194:9`!, /* X Cursor horizontal-layout games */
1077 RETRO_DEVICE_ID_JOYPAD_R2cxx . . $ `libretro-common/include/libretro.h:201:9`!, /* Y Cursor UP vertical-layout games */
1078 RETRO_DEVICE_ID_JOYPAD_Rcxx . . $ `libretro-common/include/libretro.h:199:9`!, /* Y Cursor RIGHT vertical-layout games */
1079 RETRO_DEVICE_ID_JOYPAD_L2cxx . . $ `libretro-common/include/libretro.h:200:9`!, /* Y Cursor DOWN vertical-layout games */
1080 RETRO_DEVICE_ID_JOYPAD_Lcxx . . $ `libretro-common/include/libretro.h:198:9`!, /* Y Cursor LEFT vertical-layout games */
1081 RETRO_DEVICE_ID_JOYPAD_STARTcxx . . $ `libretro-common/include/libretro.h:191:9`!,
1082 RETRO_DEVICE_ID_JOYPAD_Acxx . . $ `libretro-common/include/libretro.h:196:9`!,
1083 RETRO_DEVICE_ID_JOYPAD_Bcxx . . $ `libretro-common/include/libretro.h:188:9`!,
1084 },
1085 {
1086 RETRO_DEVICE_ID_JOYPAD_Ycxx . . $ `libretro-common/include/libretro.h:189:9`!, /* X Cursor horizontal-layout games */
1087 RETRO_DEVICE_ID_JOYPAD_Xcxx . . $ `libretro-common/include/libretro.h:197:9`!, /* X Cursor horizontal-layout games */
1088 RETRO_DEVICE_ID_JOYPAD_Acxx . . $ `libretro-common/include/libretro.h:196:9`!, /* X Cursor horizontal-layout games */
1089 RETRO_DEVICE_ID_JOYPAD_Bcxx . . $ `libretro-common/include/libretro.h:188:9`!, /* X Cursor horizontal-layout games */
1090 RETRO_DEVICE_ID_JOYPAD_LEFTcxx . . $ `libretro-common/include/libretro.h:194:9`!, /* Y Cursor UP vertical-layout games */
1091 RETRO_DEVICE_ID_JOYPAD_UPcxx . . $ `libretro-common/include/libretro.h:192:9`!, /* Y Cursor RIGHT vertical-layout games */
1092 RETRO_DEVICE_ID_JOYPAD_RIGHTcxx . . $ `libretro-common/include/libretro.h:195:9`!, /* Y Cursor DOWN vertical-layout games */
1093 RETRO_DEVICE_ID_JOYPAD_DOWNcxx . . $ `libretro-common/include/libretro.h:193:9`!, /* Y Cursor LEFT vertical-layout games */
1094 RETRO_DEVICE_ID_JOYPAD_STARTcxx . . $ `libretro-common/include/libretro.h:191:9`!,
1095 RETRO_DEVICE_ID_JOYPAD_Lcxx . . $ `libretro-common/include/libretro.h:198:9`!,
1096 RETRO_DEVICE_ID_JOYPAD_Rcxx . . $ `libretro-common/include/libretro.h:199:9`!,
1097 }
1098 };
1099 unsigned i;
1100 int16_tcxx . . $ int16_t# bitmask = 0;
1101 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! select_button;
1102 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! joymap;
1103 #ifdef MSB_FIRST
1104 union {
1105 uint8_t b[2];
1106 uint16_t s;
1107 } u;
1108 #endif
1109
1110 input_bufcxx . . $ input_buf. = 0;
1111
1112 if (libretro_supports_bitmaskscxx . . $ libretro_supports_bitmasks.)
1113 bitmask = input_state_cbcxx . . $ input_state_cb.(0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, RETRO_DEVICE_ID_JOYPAD_MASKcxx . . $ `libretro-common/include/libretro.h:205:9`!);
1114 else
1115 {
1116 for (i = 0; i < (RETRO_DEVICE_ID_JOYPAD_R3cxx . . $ `libretro-common/include/libretro.h:203:9`!+1); i++)
1117 bitmask |= input_state_cbcxx . . $ input_state_cb.(0, RETRO_DEVICE_JOYPADcxx . . $ `libretro-common/include/libretro.h:110:9`!, 0, i) ? 1 << i : 0;
1118 }
1119
1120 select_button = bitmask & (1 << RETRO_DEVICE_ID_JOYPAD_SELECTcxx . . $ `libretro-common/include/libretro.h:190:9`!);
1121 if ((retro_display_rotationcxx . . $ retro_display_rotation. == DISPLAY_ROTATION_MANUALcxx . . $ DISPLAY_ROTATION_MANUAL.) &&
1122 select_button &&
1123 !select_pressed_last_framecxx . . $ select_pressed_last_frame.)
1124 {
1125 rotate_tallcxx . . $ rotate_tall. = !rotate_tallcxx . . $ rotate_tall.;
1126 rotate_displaycxx . . $ rotate_display(49f6e7a06ebc5aa8).();
1127 }
1128 select_pressed_last_framecxx . . $ select_pressed_last_frame. = select_button;
1129
1130 joymap = (rotate_joymapcxx . . $ rotate_joymap. == 2) ? rotate_tallcxx . . $ rotate_tall. : (rotate_joymapcxx . . $ rotate_joymap. ? truecxx . . $ `<external>/14268322491693841775/stdbool.h:37:9`! : falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
1131
1132 for (i = 0; i < MAX_BUTTONScxx . . $ `libretro.c:914:9`!; i++)
1133 input_bufcxx . . $ input_buf. |= map[joymap][i] != -1u && ((1 << map[joymap][i]) & bitmask) ? (1 << i) : 0;
1134
1135 #ifdef MSB_FIRST
1136 u.s = input_buf;
1137 input_buf = u.b[0] | u.b[1] << 8;
1138 #endif
1139 }
1140
1141 void retro_runcxx . . $ retro_run(49f6e7a06ebc5aa8).(void)
1142 {
1143 int total;
1144 unsigned width, height;
1145 int32cxx . . $ int32# SoundBufSize;
1146 EmulateSpecStructcxx . . $ EmulateSpecStruct# spec;
1147 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! updated = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1148 int skip_frame = 0;
1149 int update_sample_rate;
1150
1151 if (environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATEcxx . . $ `libretro-common/include/libretro.h:657:9`!, &updated) && updated)
1152 check_variablescxx . . $ check_variables(d4f767463ce0a6b3).(falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!);
1153 update_sample_rate = update_audiocxx . . $ update_audio.;
1154
1155 input_poll_cbcxx . . $ input_poll_cb.();
1156
1157 update_inputcxx . . $ update_input(49f6e7a06ebc5aa8).();
1158
1159 /* Check whether current frame should
1160 * be skipped */
1161 if ((frameskip_typecxx . . $ frameskip_type. > 0) && retro_audio_buff_activecxx . . $ retro_audio_buff_active.)
1162 {
1163 switch (frameskip_typecxx . . $ frameskip_type.)
1164 {
1165 case 1: /* auto */
1166 skip_frame = retro_audio_buff_underruncxx . . $ retro_audio_buff_underrun. ? 1 : 0;
1167 break;
1168 case 2: /* manual */
1169 skip_frame = (retro_audio_buff_occupancycxx . . $ retro_audio_buff_occupancy. < frameskip_thresholdcxx . . $ frameskip_threshold.) ? 1 : 0;
1170 break;
1171 default:
1172 skip_frame = 0;
1173 break;
1174 }
1175
1176 if (!skip_frame ||
1177 (frameskip_countercxx . . $ frameskip_counter. >= FRAMESKIP_MAXcxx . . $ `libretro.c:283:9`!))
1178 {
1179 skip_frame = 0;
1180 frameskip_countercxx . . $ frameskip_counter. = 0;
1181 }
1182 else
1183 frameskip_countercxx . . $ frameskip_counter.++;
1184 }
1185
1186 /* If frameskip settings have changed, update
1187 * frontend audio latency */
1188 if (update_audio_latencycxx . . $ update_audio_latency.)
1189 {
1190 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_MINIMUM_AUDIO_LATENCYcxx . . $ `libretro-common/include/libretro.h:1366:9`!,
1191 &audio_latencycxx . . $ audio_latency.);
1192 update_audio_latencycxx . . $ update_audio_latency. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1193 }
1194
1195 if (retro_60hz_enabledcxx . . $ retro_60hz_enabled.)
1196 {
1197 /* If we are running in 60Hz mode, then:
1198 * - Audio data must be buffered
1199 * - On every 4th call of retro_run(), an
1200 * extra frame must be emulated */
1201
1202 /* Emulate 'force skipped frame' */
1203 if (retro_60hz_countercxx . . $ retro_60hz_counter. == 0)
1204 {
1205 Emulatecxx . . $ Emulate(10a9d664ea04b9d1).(&spec, 1, update_sample_rate);
1206 update_sample_rate = 0;
1207 retro_60hz_cache_audio_samplescxx . . $ retro_60hz_cache_audio_samples(4683f455c3e046d4).(audio_samples_bufcxx . . $ audio_samples_buf.,
1208 spec.SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize.);
1209 }
1210
1211 /* Run 'regular' frame */
1212 Emulatecxx . . $ Emulate(10a9d664ea04b9d1).(&spec, skip_frame, update_sample_rate);
1213 retro_60hz_cache_audio_samplescxx . . $ retro_60hz_cache_audio_samples(4683f455c3e046d4).(audio_samples_bufcxx . . $ audio_samples_buf.,
1214 spec.SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize.);
1215
1216 retro_60hz_countercxx . . $ retro_60hz_counter.++;
1217 }
1218 else
1219 Emulatecxx . . $ Emulate(10a9d664ea04b9d1).(&spec, skip_frame, update_sample_rate);
1220
1221 if (update_audiocxx . . $ update_audio. || update_videocxx . . $ update_video.)
1222 {
1223 struct retro_system_av_infocxx . . $ retro_system_av_info# system_av_info;
1224 retro_get_system_av_infocxx . . $ retro_get_system_av_info(ec42bac1c52c94e9).(&system_av_info);
1225 environ_cbcxx . . $ environ_cb.(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFOcxx . . $ `libretro-common/include/libretro.h:821:9`!, &system_av_info);
1226 update_audiocxx . . $ update_audio. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1227 update_videocxx . . $ update_video. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1228 }
1229
1230 width = spec.DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_2#DisplayRect..wcxx . . $ $anonymous_type_37d9811fbae164eb_0#w.;
1231 height = spec.DisplayRectcxx . . $ $anonymous_type_643ef407c229d02_2#DisplayRect..hcxx . . $ $anonymous_type_37d9811fbae164eb_0#h.;
1232
1233 if (hw_rotate_enabledcxx . . $ hw_rotate_enabled. || !rotate_tallcxx . . $ rotate_tall.)
1234 {
1235 if (!skip_frame)
1236 video_cbcxx . . $ video_cb.(surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels., width, height, FB_WIDTHcxx . . $ `libretro.c:36:9`! * RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES.);
1237 else
1238 video_cbcxx . . $ video_cb.(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, width, height, FB_WIDTHcxx . . $ `libretro.c:36:9`! * RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES.);
1239 }
1240 else
1241 {
1242 if (!skip_frame)
1243 {
1244 /* Perform software-based display rotation */
1245 if (RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES. == 4)
1246 ROTATE_PIXEL_BUFcxx . . $ `libretro.c:79:9`!(
1247 uint32_t, surf->pixels, width, height, rotate_buf)
1248 else
1249 ROTATE_PIXEL_BUFcxx . . $ `libretro.c:79:9`!(
1250 uint16_t, surf->pixels, width, height, rotate_buf)
1251
1252 video_cbcxx . . $ video_cb.(rotate_bufcxx . . $ rotate_buf., height, width, FB_HEIGHTcxx . . $ `libretro.c:37:9`! * RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES.);
1253 }
1254 else
1255 video_cbcxx . . $ video_cb.(NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, height, width, FB_HEIGHTcxx . . $ `libretro.c:37:9`! * RETRO_PIX_BYTEScxx . . $ RETRO_PIX_BYTES.);
1256 }
1257
1258 if (retro_60hz_enabledcxx . . $ retro_60hz_enabled.)
1259 {
1260 /* If we are running in 60Hz mode, then
1261 * read out the expected number of samples
1262 * on each frame plus empty the buffer at
1263 * the end of each 4/5 frame cycle */
1264 int32_tcxx . . $ int32_t# frames_available = retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. >> 1;
1265 int32_tcxx . . $ int32_t# frames_to_read = retro_60hz_audiocxx . . $ retro_60hz_audio..samples_per_framecxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_per_frame.;
1266 int32_tcxx . . $ int32_t# samples_to_read;
1267
1268 frames_to_read = (frames_to_read > frames_available) ?
1269 frames_available : frames_to_read;
1270
1271 if (retro_60hz_countercxx . . $ retro_60hz_counter. >= RETRO_60HZ_CYCLE_INDEXcxx . . $ `libretro.c:93:9`!)
1272 {
1273 frames_to_read = frames_available;
1274 retro_60hz_countercxx . . $ retro_60hz_counter. = 0;
1275 }
1276 samples_to_read = frames_to_read << 1;
1277
1278 for (total = 0; total < frames_to_read; )
1279 total += audio_batch_cbcxx . . $ audio_batch_cb.(
1280 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. + (total << 1),
1281 frames_to_read - total);
1282
1283 /* Remove uploaded samples from the buffer */
1284 if (frames_to_read < frames_available)
1285 memmovecxx . . $ memmove(cc817cb175f282d).(retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf.,
1286 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_bufcxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf. + samples_to_read,
1287 (retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. - samples_to_read) *
1288 sizeof(int16_tcxx . . $ int16_t#));
1289
1290 retro_60hz_audiocxx . . $ retro_60hz_audio..samples_buf_poscxx . . $ $anonymous_type_f668e49e698a9e9c_1#samples_buf_pos. -= samples_to_read;
1291 }
1292 else
1293 for (total = 0; total < spec.SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize.; )
1294 total += audio_batch_cbcxx . . $ audio_batch_cb.(
1295 audio_samples_bufcxx . . $ audio_samples_buf. + (total << 1),
1296 spec.SoundBufSizecxx . . $ $anonymous_type_643ef407c229d02_2#SoundBufSize. - total);
1297 }
1298
1299 void retro_get_system_infocxx . . $ retro_get_system_info(f259f269f40171e3).(struct retro_system_infocxx . . $ retro_system_info# *info)
1300 {
1301 memsetcxx . . $ memset(d1de1e4fb215f1c6).(info, 0, sizeof(*info));
1302 info->library_namecxx . . $ retro_system_info#library_name. = MEDNAFEN_CORE_NAMEcxx . . $ `libretro.c:27:9`!;
1303 #ifndef GIT_VERSION
1304 #define GIT_VERSIONcxx . . $ `libretro.c:1304:9`! ""
1305 #endif
1306 info->library_versioncxx . . $ retro_system_info#library_version. = MEDNAFEN_CORE_VERSIONcxx . . $ `libretro.c:28:9`! GIT_VERSIONcxx . . $ `libretro.c:1304:9`!;
1307 info->need_fullpathcxx . . $ retro_system_info#need_fullpath. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1308 info->valid_extensionscxx . . $ retro_system_info#valid_extensions. = MEDNAFEN_CORE_EXTENSIONScxx . . $ `libretro.c:29:9`!;
1309 info->block_extractcxx . . $ retro_system_info#block_extract. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1310 }
1311
1312 void retro_get_system_av_infocxx . . $ retro_get_system_av_info(ec42bac1c52c94e9).(struct retro_system_av_infocxx . . $ retro_system_av_info# *info)
1313 {
1314 memsetcxx . . $ memset(d1de1e4fb215f1c6).(info, 0, sizeof(*info));
1315
1316 info->timingcxx . . $ retro_system_av_info#timing..fpscxx . . $ retro_system_timing#fps. = retro_60hz_enabledcxx . . $ retro_60hz_enabled. ?
1317 RETRO_60HZ_FPScxx . . $ `libretro.c:92:9`! : MEDNAFEN_CORE_TIMING_FPScxx . . $ `libretro.c:30:9`!;
1318 info->timingcxx . . $ retro_system_av_info#timing..sample_ratecxx . . $ retro_system_timing#sample_rate. = RETRO_SAMPLE_RATEcxx . . $ RETRO_SAMPLE_RATE.;
1319
1320 if (hw_rotate_enabledcxx . . $ hw_rotate_enabled. || !rotate_tallcxx . . $ rotate_tall.)
1321 {
1322 info->geometrycxx . . $ retro_system_av_info#geometry..base_widthcxx . . $ retro_game_geometry#base_width. = MEDNAFEN_CORE_GEOMETRY_BASE_Wcxx . . $ `libretro.c:31:9`!;
1323 info->geometrycxx . . $ retro_system_av_info#geometry..base_heightcxx . . $ retro_game_geometry#base_height. = MEDNAFEN_CORE_GEOMETRY_BASE_Hcxx . . $ `libretro.c:32:9`!;
1324 }
1325 else
1326 {
1327 info->geometrycxx . . $ retro_system_av_info#geometry..base_widthcxx . . $ retro_game_geometry#base_width. = MEDNAFEN_CORE_GEOMETRY_BASE_Hcxx . . $ `libretro.c:32:9`!;
1328 info->geometrycxx . . $ retro_system_av_info#geometry..base_heightcxx . . $ retro_game_geometry#base_height. = MEDNAFEN_CORE_GEOMETRY_BASE_Wcxx . . $ `libretro.c:31:9`!;
1329 }
1330
1331 info->geometrycxx . . $ retro_system_av_info#geometry..max_widthcxx . . $ retro_game_geometry#max_width. = MEDNAFEN_CORE_GEOMETRY_MAX_Wcxx . . $ `libretro.c:33:9`!;
1332 if (hw_rotate_enabledcxx . . $ hw_rotate_enabled.)
1333 info->geometrycxx . . $ retro_system_av_info#geometry..max_heightcxx . . $ retro_game_geometry#max_height. = MEDNAFEN_CORE_GEOMETRY_MAX_Hcxx . . $ `libretro.c:34:9`!;
1334 else
1335 info->geometrycxx . . $ retro_system_av_info#geometry..max_heightcxx . . $ retro_game_geometry#max_height. = MEDNAFEN_CORE_GEOMETRY_MAX_Wcxx . . $ `libretro.c:33:9`!;
1336
1337 if (rotate_tallcxx . . $ rotate_tall.)
1338 info->geometrycxx . . $ retro_system_av_info#geometry..aspect_ratiocxx . . $ retro_game_geometry#aspect_ratio. = 1.0f / MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIOcxx . . $ `libretro.c:35:9`!;
1339 else
1340 info->geometrycxx . . $ retro_system_av_info#geometry..aspect_ratiocxx . . $ retro_game_geometry#aspect_ratio. = MEDNAFEN_CORE_GEOMETRY_ASPECT_RATIOcxx . . $ `libretro.c:35:9`!;
1341 }
1342
1343 void retro_deinitcxx . . $ retro_deinit(49f6e7a06ebc5aa8).(void)
1344 {
1345 if (surfcxx . . $ surf.)
1346 {
1347 if (surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.)
1348 #if defined(_3DS)
1349 linearFree(surf->pixels);
1350 #else
1351 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.->pixelscxx . . $ $anonymous_type_37d9811fbae164eb_2#pixels.);
1352 #endif
1353 freecxx . . $ free(5d22bdacc48458e8).(surfcxx . . $ surf.);
1354 }
1355 surfcxx . . $ surf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1356
1357 if (rotate_bufcxx . . $ rotate_buf.)
1358 #if defined(_3DS)
1359 linearFree(rotate_buf);
1360 #else
1361 freecxx . . $ free(5d22bdacc48458e8).(rotate_bufcxx . . $ rotate_buf.);
1362 #endif
1363 rotate_bufcxx . . $ rotate_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1364
1365 if (audio_samples_bufcxx . . $ audio_samples_buf.)
1366 freecxx . . $ free(5d22bdacc48458e8).(audio_samples_bufcxx . . $ audio_samples_buf.);
1367 audio_samples_bufcxx . . $ audio_samples_buf. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1368 audio_samples_buf_sizecxx . . $ audio_samples_buf_size. = 0;
1369
1370 retro_60hz_deinitcxx . . $ retro_60hz_deinit(49f6e7a06ebc5aa8).();
1371 retro_60hz_enabledcxx . . $ retro_60hz_enabled. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1372
1373 libretro_supports_bitmaskscxx . . $ libretro_supports_bitmasks. = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1374 }
1375
1376 unsigned retro_get_regioncxx . . $ retro_get_region(db52760e79bf9054).(void)
1377 {
1378 return RETRO_REGION_NTSCcxx . . $ `libretro-common/include/libretro.h:256:9`!; /* No real regions of sorts for this handheld, so just set to NTSC. */
1379 }
1380
1381 unsigned retro_api_versioncxx . . $ retro_api_version(db52760e79bf9054).(void)
1382 {
1383 return RETRO_API_VERSIONcxx . . $ `libretro-common/include/libretro.h:84:9`!;
1384 }
1385
1386 void retro_set_controller_port_devicecxx . . $ retro_set_controller_port_device(b4d55b1286ff73e8).(unsigned in_port, unsigned device) { }
1387
1388 void retro_set_environmentcxx . . $ retro_set_environment(ca2745877d29563).(retro_environment_tcxx . . $ retro_environment_t# cb)
1389 {
1390 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! option_cats_supported = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1391
1392 environ_cbcxx . . $ environ_cb. = cb;
1393
1394 libretro_set_core_optionscxx . . $ libretro_set_core_options(428a286f02a06635).(environ_cbcxx . . $ environ_cb.,
1395 &option_cats_supported);
1396 }
1397
1398 void retro_set_audio_samplecxx . . $ retro_set_audio_sample(c6279dcb374ccd32).(retro_audio_sample_tcxx . . $ retro_audio_sample_t# cb)
1399 {
1400 }
1401
1402 void retro_set_audio_sample_batchcxx . . $ retro_set_audio_sample_batch(6b2060791f2f1bd1).(retro_audio_sample_batch_tcxx . . $ retro_audio_sample_batch_t# cb)
1403 {
1404 audio_batch_cbcxx . . $ audio_batch_cb. = cb;
1405 }
1406
1407 void retro_set_input_pollcxx . . $ retro_set_input_poll(964b12a25712bdc3).(retro_input_poll_tcxx . . $ retro_input_poll_t# cb)
1408 {
1409 input_poll_cbcxx . . $ input_poll_cb. = cb;
1410 }
1411
1412 void retro_set_input_statecxx . . $ retro_set_input_state(ebf409fe3ace00ad).(retro_input_state_tcxx . . $ retro_input_state_t# cb)
1413 {
1414 input_state_cbcxx . . $ input_state_cb. = cb;
1415 }
1416
1417 void retro_set_video_refreshcxx . . $ retro_set_video_refresh(185c2191abec6d3b).(retro_video_refresh_tcxx . . $ retro_video_refresh_t# cb)
1418 {
1419 video_cbcxx . . $ video_cb. = cb;
1420 }
1421
1422 size_t retro_serialize_sizecxx . . $ retro_serialize_size(f708dce9a8856c70).(void)
1423 {
1424 StateMemcxx . . $ StateMem# st;
1425
1426 st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data. = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1427 st.loccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#loc. = 0;
1428 st.lencxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#len. = 0;
1429 st.mallocedcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#malloced. = 0;
1430 st.initial_malloccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#initial_malloc. = 0;
1431
1432 if (!MDFNSS_SaveSMcxx . . $ MDFNSS_SaveSM(d855d810c36bab0b).(&st, 0, 0, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!))
1433 return 0;
1434
1435 freecxx . . $ free(5d22bdacc48458e8).(st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data.);
1436
1437 return st.lencxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#len.;
1438 }
1439
1440 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_serializecxx . . $ retro_serialize(ba504f6f2e89cb92).(void *data, size_t size)
1441 {
1442 StateMemcxx . . $ StateMem# st;
1443 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! ret = falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1444 uint8_tcxx . . $ uint8_t# *_dat = (uint8_tcxx . . $ uint8_t#*)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(size);
1445
1446 if (!_dat)
1447 return falsecxx . . $ `<external>/14268322491693841775/stdbool.h:38:9`!;
1448
1449 /* Mednafen can realloc the buffer so we need to ensure this is safe. */
1450 st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data. = _dat;
1451 st.loccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#loc. = 0;
1452 st.lencxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#len. = 0;
1453 st.mallocedcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#malloced. = size;
1454 st.initial_malloccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#initial_malloc. = 0;
1455
1456 ret = MDFNSS_SaveSMcxx . . $ MDFNSS_SaveSM(d855d810c36bab0b).(&st, 0, 0, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
1457
1458 memcpycxx . . $ memcpy(cc817cb175f282d).(data, st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data., size);
1459 freecxx . . $ free(5d22bdacc48458e8).(st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data.);
1460
1461 return ret;
1462 }
1463
1464 boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! retro_unserializecxx . . $ retro_unserialize(d7c96d367a6f87f1).(const void *data, size_t size)
1465 {
1466 StateMemcxx . . $ StateMem# st;
1467
1468 st.datacxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#data. = (uint8_tcxx . . $ uint8_t#*)data;
1469 st.loccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#loc. = 0;
1470 st.lencxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#len. = size;
1471 st.mallocedcxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#malloced. = 0;
1472 st.initial_malloccxx . . $ $anonymous_type_8d6ca9fa7c8baca5_0#initial_malloc. = 0;
1473
1474 return MDFNSS_LoadSMcxx . . $ MDFNSS_LoadSM(4d015e8c0eefb98e).(&st, 0, 0);
1475 }
1476
1477 void *retro_get_memory_datacxx . . $ retro_get_memory_data(52408c21a1e21ff7).(unsigned type)
1478 {
1479 switch (type)
1480 {
1481 case RETRO_MEMORY_SAVE_RAMcxx . . $ `libretro-common/include/libretro.h:312:9`!:
1482 if (eeprom_sizecxx . . $ eeprom_size.)
1483 return (uint8_tcxx . . $ uint8_t#*)wsEEPROMcxx . . $ wsEEPROM.;
1484 else if (SRAMSizecxx . . $ SRAMSize.)
1485 return wsSRAMcxx . . $ wsSRAM.;
1486 break;
1487 case RETRO_MEMORY_SYSTEM_RAMcxx . . $ `libretro-common/include/libretro.h:320:9`!:
1488 return (uint8_tcxx . . $ uint8_t#*)wsRAMcxx . . $ wsRAM.;
1489 default:
1490 break;
1491 }
1492
1493 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
1494 }
1495
1496 size_t retro_get_memory_sizecxx . . $ retro_get_memory_size(1892545c1754497d).(unsigned type)
1497 {
1498 switch (type)
1499 {
1500 case RETRO_MEMORY_SAVE_RAMcxx . . $ `libretro-common/include/libretro.h:312:9`!:
1501 if (eeprom_sizecxx . . $ eeprom_size.)
1502 return eeprom_sizecxx . . $ eeprom_size.;
1503 else if (SRAMSizecxx . . $ SRAMSize.)
1504 return SRAMSizecxx . . $ SRAMSize.;
1505 break;
1506 case RETRO_MEMORY_SYSTEM_RAMcxx . . $ `libretro-common/include/libretro.h:320:9`!:
1507 return wsRAMSizecxx . . $ wsRAMSize.;
1508 default:
1509 break;
1510 }
1511
1512 return 0;
1513 }
1514
1515 void retro_cheat_resetcxx . . $ retro_cheat_reset(49f6e7a06ebc5aa8).(void) { }
1516 void retro_cheat_setcxx . . $ retro_cheat_set(f058bf27fe81fd03).(unsigned a, boolcxx . . $ `<external>/14268322491693841775/stdbool.h:36:9`! b, const char *c) { }