libretro.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. /*
  2. * libretro core glue for PicoDrive
  3. * (C) notaz, 2013
  4. *
  5. * This work is licensed under the terms of MAME license.
  6. * See COPYING file in the top-level directory.
  7. */
  8. #define _GNU_SOURCE 1 // mremap
  9. #include <stdio.h>
  10. #include <stdarg.h>
  11. #include <string.h>
  12. #include <sys/mman.h>
  13. #include <errno.h>
  14. #ifdef __MACH__
  15. #include <libkern/OSCacheControl.h>
  16. #endif
  17. #include <pico/pico_int.h>
  18. #include <pico/state.h>
  19. #include "common/input_pico.h"
  20. #include "common/version.h"
  21. #include "libretro.h"
  22. #ifndef MAP_ANONYMOUS
  23. #define MAP_ANONYMOUS MAP_ANON
  24. #endif
  25. static retro_video_refresh_t video_cb;
  26. static retro_input_poll_t input_poll_cb;
  27. static retro_input_state_t input_state_cb;
  28. static retro_environment_t environ_cb;
  29. static retro_audio_sample_batch_t audio_batch_cb;
  30. static FILE *emu_log;
  31. #define VOUT_MAX_WIDTH 320
  32. #define VOUT_MAX_HEIGHT 240
  33. static void *vout_buf;
  34. static int vout_width, vout_height;
  35. static short __attribute__((aligned(4))) sndBuffer[2*44100/50];
  36. static void snd_write(int len);
  37. #ifdef _WIN32
  38. #define SLASH '\\'
  39. #else
  40. #define SLASH '/'
  41. #endif
  42. /* functions called by the core */
  43. void cache_flush_d_inval_i(void *start, void *end)
  44. {
  45. #ifdef __arm__
  46. #if defined(__BLACKBERRY_QNX__)
  47. msync(start, end - start, MS_SYNC | MS_CACHE_ONLY | MS_INVALIDATE_ICACHE);
  48. #elif defined(__MACH__)
  49. size_t len = (char *)end - (char *)start;
  50. sys_dcache_flush(start, len);
  51. sys_icache_invalidate(start, len);
  52. #else
  53. __clear_cache(start, end);
  54. #endif
  55. #endif
  56. }
  57. void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed)
  58. {
  59. int flags = MAP_PRIVATE | MAP_ANONYMOUS;
  60. void *req, *ret;
  61. req = (void *)addr;
  62. ret = mmap(req, size, PROT_READ | PROT_WRITE, flags, -1, 0);
  63. if (ret == MAP_FAILED) {
  64. lprintf("mmap(%08lx, %zd) failed: %d\n", addr, size, errno);
  65. return NULL;
  66. }
  67. if (addr != 0 && ret != (void *)addr) {
  68. lprintf("warning: wanted to map @%08lx, got %p\n",
  69. addr, ret);
  70. if (is_fixed) {
  71. munmap(ret, size);
  72. return NULL;
  73. }
  74. }
  75. return ret;
  76. }
  77. void *plat_mremap(void *ptr, size_t oldsize, size_t newsize)
  78. {
  79. #ifdef __linux__
  80. void *ret = mremap(ptr, oldsize, newsize, 0);
  81. if (ret == MAP_FAILED)
  82. return NULL;
  83. return ret;
  84. #else
  85. void *tmp, *ret;
  86. size_t preserve_size;
  87. preserve_size = oldsize;
  88. if (preserve_size > newsize)
  89. preserve_size = newsize;
  90. tmp = malloc(preserve_size);
  91. if (tmp == NULL)
  92. return NULL;
  93. memcpy(tmp, ptr, preserve_size);
  94. munmap(ptr, oldsize);
  95. ret = mmap(ptr, newsize, PROT_READ | PROT_WRITE,
  96. MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
  97. if (ret == MAP_FAILED) {
  98. free(tmp);
  99. return NULL;
  100. }
  101. memcpy(ret, tmp, preserve_size);
  102. free(tmp);
  103. return ret;
  104. #endif
  105. }
  106. void plat_munmap(void *ptr, size_t size)
  107. {
  108. if (ptr != NULL)
  109. munmap(ptr, size);
  110. }
  111. int plat_mem_set_exec(void *ptr, size_t size)
  112. {
  113. int ret = mprotect(ptr, size, PROT_READ | PROT_WRITE | PROT_EXEC);
  114. if (ret != 0)
  115. lprintf("mprotect(%p, %zd) failed: %d\n", ptr, size, errno);
  116. return ret;
  117. }
  118. void emu_video_mode_change(int start_line, int line_count, int is_32cols)
  119. {
  120. memset(vout_buf, 0, 320 * 240 * 2);
  121. vout_width = is_32cols ? 256 : 320;
  122. PicoDrawSetOutBuf(vout_buf, vout_width * 2);
  123. }
  124. void emu_32x_startup(void)
  125. {
  126. }
  127. #ifndef ANDROID
  128. void lprintf(const char *fmt, ...)
  129. {
  130. va_list list;
  131. va_start(list, fmt);
  132. fprintf(emu_log, "PicoDrive: ");
  133. vfprintf(emu_log, fmt, list);
  134. va_end(list);
  135. fflush(emu_log);
  136. }
  137. #else
  138. #include <android/log.h>
  139. void lprintf(const char *fmt, ...)
  140. {
  141. va_list list;
  142. va_start(list, fmt);
  143. __android_log_vprint(ANDROID_LOG_INFO, "PicoDrive", fmt, list);
  144. va_end(list);
  145. }
  146. #endif
  147. /* libretro */
  148. void retro_set_environment(retro_environment_t cb)
  149. {
  150. static const struct retro_variable vars[] = {
  151. //{ "region", "Region; Auto|NTSC|PAL" },
  152. { NULL, NULL },
  153. };
  154. environ_cb = cb;
  155. cb(RETRO_ENVIRONMENT_SET_VARIABLES, (void *)vars);
  156. }
  157. void retro_set_video_refresh(retro_video_refresh_t cb) { video_cb = cb; }
  158. void retro_set_audio_sample(retro_audio_sample_t cb) { (void)cb; }
  159. void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb) { audio_batch_cb = cb; }
  160. void retro_set_input_poll(retro_input_poll_t cb) { input_poll_cb = cb; }
  161. void retro_set_input_state(retro_input_state_t cb) { input_state_cb = cb; }
  162. unsigned retro_api_version(void)
  163. {
  164. return RETRO_API_VERSION;
  165. }
  166. void retro_set_controller_port_device(unsigned port, unsigned device)
  167. {
  168. }
  169. void retro_get_system_info(struct retro_system_info *info)
  170. {
  171. memset(info, 0, sizeof(*info));
  172. info->library_name = "PicoDrive";
  173. info->library_version = VERSION;
  174. info->valid_extensions = "bin|gen|smd|md|32x|cue|iso|sms";
  175. info->need_fullpath = true;
  176. }
  177. void retro_get_system_av_info(struct retro_system_av_info *info)
  178. {
  179. memset(info, 0, sizeof(*info));
  180. info->timing.fps = Pico.m.pal ? 50 : 60;
  181. info->timing.sample_rate = 44100;
  182. info->geometry.base_width = 320;
  183. info->geometry.base_height = 240;
  184. info->geometry.max_width = VOUT_MAX_WIDTH;
  185. info->geometry.max_height = VOUT_MAX_HEIGHT;
  186. info->geometry.aspect_ratio = 4.0 / 3.0;
  187. }
  188. /* savestates */
  189. struct savestate_state {
  190. const char *load_buf;
  191. char *save_buf;
  192. size_t size;
  193. size_t pos;
  194. };
  195. size_t state_read(void *p, size_t size, size_t nmemb, void *file)
  196. {
  197. struct savestate_state *state = file;
  198. size_t bsize = size * nmemb;
  199. if (state->pos + bsize > state->size) {
  200. lprintf("savestate error: %u/%u\n",
  201. state->pos + bsize, state->size);
  202. bsize = state->size - state->pos;
  203. if ((int)bsize <= 0)
  204. return 0;
  205. }
  206. memcpy(p, state->load_buf + state->pos, bsize);
  207. state->pos += bsize;
  208. return bsize;
  209. }
  210. size_t state_write(void *p, size_t size, size_t nmemb, void *file)
  211. {
  212. struct savestate_state *state = file;
  213. size_t bsize = size * nmemb;
  214. if (state->pos + bsize > state->size) {
  215. lprintf("savestate error: %u/%u\n",
  216. state->pos + bsize, state->size);
  217. bsize = state->size - state->pos;
  218. if ((int)bsize <= 0)
  219. return 0;
  220. }
  221. memcpy(state->save_buf + state->pos, p, bsize);
  222. state->pos += bsize;
  223. return bsize;
  224. }
  225. size_t state_skip(void *p, size_t size, size_t nmemb, void *file)
  226. {
  227. struct savestate_state *state = file;
  228. size_t bsize = size * nmemb;
  229. state->pos += bsize;
  230. return bsize;
  231. }
  232. size_t state_eof(void *file)
  233. {
  234. struct savestate_state *state = file;
  235. return state->pos >= state->size;
  236. }
  237. int state_fseek(void *file, long offset, int whence)
  238. {
  239. struct savestate_state *state = file;
  240. switch (whence) {
  241. case SEEK_SET:
  242. state->pos = offset;
  243. break;
  244. case SEEK_CUR:
  245. state->pos += offset;
  246. break;
  247. case SEEK_END:
  248. state->pos = state->size + offset;
  249. break;
  250. }
  251. return (int)state->pos;
  252. }
  253. /* savestate sizes vary wildly depending if cd/32x or
  254. * carthw is active, so run the whole thing to get size */
  255. size_t retro_serialize_size(void)
  256. {
  257. struct savestate_state state = { 0, };
  258. int ret;
  259. ret = PicoStateFP(&state, 1, NULL, state_skip, NULL, state_fseek);
  260. if (ret != 0)
  261. return 0;
  262. return state.pos;
  263. }
  264. bool retro_serialize(void *data, size_t size)
  265. {
  266. struct savestate_state state = { 0, };
  267. int ret;
  268. state.save_buf = data;
  269. state.size = size;
  270. state.pos = 0;
  271. ret = PicoStateFP(&state, 1, NULL, state_write,
  272. NULL, state_fseek);
  273. return ret == 0;
  274. }
  275. bool retro_unserialize(const void *data, size_t size)
  276. {
  277. struct savestate_state state = { 0, };
  278. int ret;
  279. state.load_buf = data;
  280. state.size = size;
  281. state.pos = 0;
  282. ret = PicoStateFP(&state, 0, state_read, NULL,
  283. state_eof, state_fseek);
  284. return ret == 0;
  285. }
  286. /* cheats - TODO */
  287. void retro_cheat_reset(void)
  288. {
  289. }
  290. void retro_cheat_set(unsigned index, bool enabled, const char *code)
  291. {
  292. }
  293. /* multidisk support */
  294. static bool disk_ejected;
  295. static unsigned int disk_current_index;
  296. static unsigned int disk_count;
  297. static struct disks_state {
  298. char *fname;
  299. } disks[8];
  300. static bool disk_set_eject_state(bool ejected)
  301. {
  302. // TODO?
  303. disk_ejected = ejected;
  304. return true;
  305. }
  306. static bool disk_get_eject_state(void)
  307. {
  308. return disk_ejected;
  309. }
  310. static unsigned int disk_get_image_index(void)
  311. {
  312. return disk_current_index;
  313. }
  314. static bool disk_set_image_index(unsigned int index)
  315. {
  316. cd_img_type cd_type;
  317. int ret;
  318. if (index >= sizeof(disks) / sizeof(disks[0]))
  319. return false;
  320. if (disks[index].fname == NULL) {
  321. lprintf("missing disk #%u\n", index);
  322. // RetroArch specifies "no disk" with index == count,
  323. // so don't fail here..
  324. disk_current_index = index;
  325. return true;
  326. }
  327. lprintf("switching to disk %u: \"%s\"\n", index,
  328. disks[index].fname);
  329. ret = -1;
  330. cd_type = PicoCdCheck(disks[index].fname, NULL);
  331. if (cd_type != CIT_NOT_CD)
  332. ret = Insert_CD(disks[index].fname, cd_type);
  333. if (ret != 0) {
  334. lprintf("Load failed, invalid CD image?\n");
  335. return 0;
  336. }
  337. disk_current_index = index;
  338. return true;
  339. }
  340. static unsigned int disk_get_num_images(void)
  341. {
  342. return disk_count;
  343. }
  344. static bool disk_replace_image_index(unsigned index,
  345. const struct retro_game_info *info)
  346. {
  347. bool ret = true;
  348. if (index >= sizeof(disks) / sizeof(disks[0]))
  349. return false;
  350. if (disks[index].fname != NULL)
  351. free(disks[index].fname);
  352. disks[index].fname = NULL;
  353. if (info != NULL) {
  354. disks[index].fname = strdup(info->path);
  355. if (index == disk_current_index)
  356. ret = disk_set_image_index(index);
  357. }
  358. return ret;
  359. }
  360. static bool disk_add_image_index(void)
  361. {
  362. if (disk_count >= sizeof(disks) / sizeof(disks[0]))
  363. return false;
  364. disk_count++;
  365. return true;
  366. }
  367. static struct retro_disk_control_callback disk_control = {
  368. .set_eject_state = disk_set_eject_state,
  369. .get_eject_state = disk_get_eject_state,
  370. .get_image_index = disk_get_image_index,
  371. .set_image_index = disk_set_image_index,
  372. .get_num_images = disk_get_num_images,
  373. .replace_image_index = disk_replace_image_index,
  374. .add_image_index = disk_add_image_index,
  375. };
  376. static void disk_tray_open(void)
  377. {
  378. lprintf("cd tray open\n");
  379. disk_ejected = 1;
  380. }
  381. static void disk_tray_close(void)
  382. {
  383. lprintf("cd tray close\n");
  384. disk_ejected = 0;
  385. }
  386. static const char * const biosfiles_us[] = {
  387. "us_scd1_9210", "us_scd2_9306", "SegaCDBIOS9303", "bios_CD_U"
  388. };
  389. static const char * const biosfiles_eu[] = {
  390. "eu_mcd1_9210", "eu_mcd2_9306", "eu_mcd2_9303", "bios_CD_E"
  391. };
  392. static const char * const biosfiles_jp[] = {
  393. "jp_mcd1_9112", "jp_mcd1_9111", "bios_CD_J"
  394. };
  395. static void make_system_path(char *buf, size_t buf_size,
  396. const char *name, const char *ext)
  397. {
  398. const char *dir = NULL;
  399. if (environ_cb(RETRO_ENVIRONMENT_GET_SYSTEM_DIRECTORY, &dir) && dir) {
  400. snprintf(buf, buf_size, "%s%c%s%s", dir, SLASH, name, ext);
  401. }
  402. else {
  403. snprintf(buf, buf_size, "%s%s", name, ext);
  404. }
  405. }
  406. static const char *find_bios(int *region, const char *cd_fname)
  407. {
  408. const char * const *files;
  409. static char path[256];
  410. int i, count;
  411. FILE *f = NULL;
  412. if (*region == 4) { // US
  413. files = biosfiles_us;
  414. count = sizeof(biosfiles_us) / sizeof(char *);
  415. } else if (*region == 8) { // EU
  416. files = biosfiles_eu;
  417. count = sizeof(biosfiles_eu) / sizeof(char *);
  418. } else if (*region == 1 || *region == 2) {
  419. files = biosfiles_jp;
  420. count = sizeof(biosfiles_jp) / sizeof(char *);
  421. } else {
  422. return NULL;
  423. }
  424. for (i = 0; i < count; i++)
  425. {
  426. make_system_path(path, sizeof(path), files[i], ".bin");
  427. f = fopen(path, "rb");
  428. if (f != NULL)
  429. break;
  430. make_system_path(path, sizeof(path), files[i], ".zip");
  431. f = fopen(path, "rb");
  432. if (f != NULL)
  433. break;
  434. }
  435. if (f != NULL) {
  436. lprintf("using bios: %s\n", path);
  437. fclose(f);
  438. return path;
  439. }
  440. return NULL;
  441. }
  442. bool retro_load_game(const struct retro_game_info *info)
  443. {
  444. enum media_type_e media_type;
  445. static char carthw_path[256];
  446. size_t i;
  447. enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_RGB565;
  448. if (!environ_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) {
  449. lprintf("RGB565 suppot required, sorry\n");
  450. return false;
  451. }
  452. if (info == NULL || info->path == NULL) {
  453. lprintf("info->path required\n");
  454. return false;
  455. }
  456. for (i = 0; i < sizeof(disks) / sizeof(disks[0]); i++) {
  457. if (disks[i].fname != NULL) {
  458. free(disks[i].fname);
  459. disks[i].fname = NULL;
  460. }
  461. }
  462. disk_current_index = 0;
  463. disk_count = 1;
  464. disks[0].fname = strdup(info->path);
  465. make_system_path(carthw_path, sizeof(carthw_path), "carthw", ".cfg");
  466. media_type = PicoLoadMedia(info->path, carthw_path,
  467. find_bios, NULL);
  468. switch (media_type) {
  469. case PM_BAD_DETECT:
  470. lprintf("Failed to detect ROM/CD image type.\n");
  471. return false;
  472. case PM_BAD_CD:
  473. lprintf("Invalid CD image\n");
  474. return false;
  475. case PM_BAD_CD_NO_BIOS:
  476. lprintf("Missing BIOS\n");
  477. return false;
  478. case PM_ERROR:
  479. lprintf("Load error\n");
  480. return false;
  481. default:
  482. break;
  483. }
  484. PicoLoopPrepare();
  485. PicoWriteSound = snd_write;
  486. memset(sndBuffer, 0, sizeof(sndBuffer));
  487. PsndOut = sndBuffer;
  488. PsndRerate(1);
  489. return true;
  490. }
  491. bool retro_load_game_special(unsigned game_type, const struct retro_game_info *info, size_t num_info)
  492. {
  493. return false;
  494. }
  495. void retro_unload_game(void)
  496. {
  497. }
  498. unsigned retro_get_region(void)
  499. {
  500. return Pico.m.pal ? RETRO_REGION_PAL : RETRO_REGION_NTSC;
  501. }
  502. void *retro_get_memory_data(unsigned id)
  503. {
  504. if (id != RETRO_MEMORY_SAVE_RAM)
  505. return NULL;
  506. if (PicoAHW & PAHW_MCD)
  507. return Pico_mcd->bram;
  508. else
  509. return SRam.data;
  510. }
  511. size_t retro_get_memory_size(unsigned id)
  512. {
  513. if (id != RETRO_MEMORY_SAVE_RAM)
  514. return 0;
  515. if (PicoAHW & PAHW_MCD)
  516. // bram
  517. return 0x2000;
  518. else
  519. return SRam.size;
  520. }
  521. void retro_reset(void)
  522. {
  523. PicoReset();
  524. }
  525. static const unsigned short retro_pico_map[] = {
  526. [RETRO_DEVICE_ID_JOYPAD_B] = 1 << GBTN_B,
  527. [RETRO_DEVICE_ID_JOYPAD_Y] = 1 << GBTN_A,
  528. [RETRO_DEVICE_ID_JOYPAD_SELECT] = 1 << GBTN_MODE,
  529. [RETRO_DEVICE_ID_JOYPAD_START] = 1 << GBTN_START,
  530. [RETRO_DEVICE_ID_JOYPAD_UP] = 1 << GBTN_UP,
  531. [RETRO_DEVICE_ID_JOYPAD_DOWN] = 1 << GBTN_DOWN,
  532. [RETRO_DEVICE_ID_JOYPAD_LEFT] = 1 << GBTN_LEFT,
  533. [RETRO_DEVICE_ID_JOYPAD_RIGHT] = 1 << GBTN_RIGHT,
  534. [RETRO_DEVICE_ID_JOYPAD_A] = 1 << GBTN_C,
  535. [RETRO_DEVICE_ID_JOYPAD_X] = 1 << GBTN_Y,
  536. [RETRO_DEVICE_ID_JOYPAD_L] = 1 << GBTN_X,
  537. [RETRO_DEVICE_ID_JOYPAD_R] = 1 << GBTN_Z,
  538. };
  539. #define RETRO_PICO_MAP_LEN (sizeof(retro_pico_map) / sizeof(retro_pico_map[0]))
  540. static void snd_write(int len)
  541. {
  542. audio_batch_cb(PsndOut, len / 4);
  543. }
  544. void retro_run(void)
  545. {
  546. bool updated = false;
  547. int pad, i;
  548. if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE_UPDATE, &updated) && updated)
  549. ; //update_variables(true);
  550. input_poll_cb();
  551. PicoPad[0] = PicoPad[1] = 0;
  552. for (pad = 0; pad < 2; pad++)
  553. for (i = 0; i < RETRO_PICO_MAP_LEN; i++)
  554. if (input_state_cb(pad, RETRO_DEVICE_JOYPAD, 0, i))
  555. PicoPad[pad] |= retro_pico_map[i];
  556. PicoFrame();
  557. video_cb(vout_buf, vout_width, vout_height, vout_width * 2);
  558. }
  559. void retro_init(void)
  560. {
  561. int level;
  562. #ifdef IOS
  563. emu_log = fopen("/User/Documents/PicoDrive.log", "w");
  564. if (emu_log == NULL)
  565. emu_log = fopen("PicoDrive.log", "w");
  566. if (emu_log == NULL)
  567. #endif
  568. emu_log = stdout;
  569. level = 0;
  570. environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
  571. environ_cb(RETRO_ENVIRONMENT_SET_DISK_CONTROL_INTERFACE, &disk_control);
  572. PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80
  573. | POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_EN_MCD_GFX
  574. | POPT_EN_32X|POPT_EN_PWM
  575. | POPT_ACC_SPRITES|POPT_DIS_32C_BORDER;
  576. #ifdef __arm__
  577. PicoOpt |= POPT_EN_SVP_DRC;
  578. #endif
  579. PsndRate = 44100;
  580. PicoAutoRgnOrder = 0x184; // US, EU, JP
  581. PicoCDBuffers = 0;
  582. vout_width = 320;
  583. vout_height = 240;
  584. vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
  585. PicoInit();
  586. PicoDrawSetOutFormat(PDF_RGB555, 0);
  587. PicoDrawSetOutBuf(vout_buf, vout_width * 2);
  588. //PicoMessage = plat_status_msg_busy_next;
  589. PicoMCDopenTray = disk_tray_open;
  590. PicoMCDcloseTray = disk_tray_close;
  591. }
  592. void retro_deinit(void)
  593. {
  594. PicoExit();
  595. }