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_PicoCDBuffers = 0;
68 defaultConfig.Frameskip = 0;
71 void pemu_validate_config(void)
75 void pemu_loop_prep(void)
77 PicoDrawSetOutFormat(PDF_RGB555, 1);
78 PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
82 void pemu_loop_end(void)
87 void pemu_forced_frame(int no_scale, int do_emu)
91 void pemu_finalize_frame(const char *fps, const char *notice_msg)
95 void plat_video_flip(void)
97 DirectScreen(g_screen_ptr);
101 void plat_video_wait_vsync(void)
105 void plat_video_toggle_renderer(int change, int is_menu)
107 // this will auto-select SMS/32X renderers
108 PicoDrawSetOutFormat(PDF_RGB555, 1);
111 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
113 EmuScreenRect.left = is_32cols ? 32 : 0;
114 EmuScreenRect.right = is_32cols ? 256+32 : 320;
115 EmuScreenRect.top = start_line;
116 EmuScreenRect.bottom = start_line + line_count;
118 PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 2000, 0);
121 static int sndbuff[2*44100/50/2 + 4];
123 static void update_sound(int len)
125 /* avoid writing audio when lagging behind to prevent audio lag */
126 if (PicoSkipFrame != 2)
127 DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
130 void pemu_sound_start(void)
135 currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
137 // prepare sound stuff
138 if (currentConfig.EmuOpt & EOPT_EN_SOUND)
142 ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
144 lprintf("dsound init failed\n");
148 PsndOut = (void *)sndbuff;
149 PicoWriteSound = update_sound;
150 currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
154 void pemu_sound_stop(void)
159 void pemu_sound_wait(void)
163 int plat_get_root_dir(char *dst, int len)
167 ml = GetModuleFileName(NULL, dst, len);
168 while (ml > 0 && dst[ml] != '\\')
177 void plat_status_msg_busy_first(const char *msg)
181 void plat_status_msg_busy_next(const char *msg)
185 void plat_status_msg_clear(void)
189 void plat_video_menu_enter(int is_rom_loaded)
193 void plat_video_menu_begin(void)
197 void plat_video_menu_end(void)
201 void plat_update_volume(int has_changed, int is_up)
205 const char *plat_get_credits(void)
207 return "PicoDrive v" VERSION " minibeta (c) notaz, 2006-2009\n\n"
209 "fDave: base code of PicoDrive\n"
212 "MAME devs: YM2612, SN76496 and SH2 cores\n"
213 "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
214 "Special thanks (ideas, valuable information and stuff):\n"
215 "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
216 "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
219 void plat_debug_cat(char *str)
224 int mp3_get_bitrate(void *f, int size)
229 void mp3_start_play(void *f, int pos)
233 void mp3_update(int *buffer, int length, int stereo)
238 void lprintf(const char *fmt, ...)
244 vsnprintf(buf, sizeof(buf), fmt, val);
246 OutputDebugString(buf);
251 int alphasort() { return 0; }
252 int scandir() { return 0; }