5 * This work is licensed under the terms of MAME license.
6 * See COPYING file in the top-level directory.
11 #include "../common/lprintf.h"
12 #include "../common/plat.h"
13 #include "../common/emu.h"
14 #include "../../pico/pico.h"
20 static unsigned short screen_buff[320 * 240];
21 const char *renderer_names[] = { NULL };
22 const char *renderer_names32x[] = { NULL };
26 g_screen_ptr = (void *)screen_buff;
29 int plat_is_dir(const char *path)
31 return (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
34 unsigned int plat_get_ticks_ms(void)
36 return GetTickCount();
39 unsigned int plat_get_ticks_us(void)
41 // XXX: maybe performance counters?
42 return GetTickCount() * 1000;
45 void plat_wait_till_us(unsigned int us)
47 int msdiff = (int)(us - plat_get_ticks_us()) / 1000;
50 while (plat_get_ticks_us() < us)
54 void plat_sleep_ms(int ms)
59 int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
64 void pemu_prep_defconfig(void)
66 memset(&defaultConfig, 0, sizeof(defaultConfig));
67 defaultConfig.s_PicoOpt|= POPT_6BTN_PAD; // for xmen proto
68 defaultConfig.s_PicoCDBuffers = 0;
69 defaultConfig.Frameskip = 0;
72 void pemu_validate_config(void)
76 void pemu_loop_prep(void)
78 PicoDrawSetOutFormat(PDF_RGB555, 1);
79 PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
83 void pemu_loop_end(void)
88 void pemu_forced_frame(int no_scale, int do_emu)
92 void pemu_finalize_frame(const char *fps, const char *notice_msg)
96 void plat_video_flip(void)
98 DirectScreen(g_screen_ptr);
102 void plat_video_wait_vsync(void)
106 void plat_video_toggle_renderer(int change, int is_menu)
108 // this will auto-select SMS/32X renderers
109 PicoDrawSetOutFormat(PDF_RGB555, 1);
112 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
114 EmuScreenRect.left = is_32cols ? 32 : 0;
115 EmuScreenRect.right = is_32cols ? 256+32 : 320;
116 EmuScreenRect.top = start_line;
117 EmuScreenRect.bottom = start_line + line_count;
119 PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 2000, 0);
122 static int sndbuff[2*44100/50/2 + 4];
124 static void update_sound(int len)
126 /* avoid writing audio when lagging behind to prevent audio lag */
127 if (PicoSkipFrame != 2)
128 DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
131 void pemu_sound_start(void)
136 currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
138 // prepare sound stuff
139 if (currentConfig.EmuOpt & EOPT_EN_SOUND)
143 ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
145 lprintf("dsound init failed\n");
149 PsndOut = (void *)sndbuff;
150 PicoWriteSound = update_sound;
151 currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
155 void pemu_sound_stop(void)
160 void pemu_sound_wait(void)
164 int plat_get_root_dir(char *dst, int len)
168 ml = GetModuleFileName(NULL, dst, len);
169 while (ml > 0 && dst[ml] != '\\')
178 void plat_status_msg_busy_first(const char *msg)
182 void plat_status_msg_busy_next(const char *msg)
186 void plat_status_msg_clear(void)
190 void plat_video_menu_enter(int is_rom_loaded)
194 void plat_video_menu_begin(void)
198 void plat_video_menu_end(void)
202 void plat_update_volume(int has_changed, int is_up)
206 const char *plat_get_credits(void)
208 return "PicoDrive v" VERSION " minibeta (c) notaz, 2006-2009\n\n"
210 "fDave: base code of PicoDrive\n"
213 "MAME devs: YM2612, SN76496 and SH2 cores\n"
214 "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
215 "Special thanks (ideas, valuable information and stuff):\n"
216 "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
217 "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
220 void plat_debug_cat(char *str)
225 int mp3_get_bitrate(void *f, int size)
230 void mp3_start_play(void *f, int pos)
234 void mp3_update(int *buffer, int length, int stereo)
239 void lprintf(const char *fmt, ...)
245 vsnprintf(buf, sizeof(buf), fmt, val);
247 OutputDebugString(buf);
252 int alphasort() { return 0; }
253 int scandir() { return 0; }