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 static unsigned char PicoDraw2FB_[(8+320) * (8+240+8)];
22 unsigned char *PicoDraw2FB = PicoDraw2FB_;
23 const char *renderer_names[] = { NULL };
24 const char *renderer_names32x[] = { NULL };
28 g_screen_ptr = (void *)screen_buff;
31 int plat_is_dir(const char *path)
33 return (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
36 unsigned int plat_get_ticks_ms(void)
38 return GetTickCount();
41 unsigned int plat_get_ticks_us(void)
43 // XXX: maybe performance counters?
44 return GetTickCount() * 1000;
47 void plat_wait_till_us(unsigned int us)
49 int msdiff = (int)(us - plat_get_ticks_us()) / 1000;
52 while (plat_get_ticks_us() < us)
56 void plat_sleep_ms(int ms)
61 int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
66 void pemu_prep_defconfig(void)
68 memset(&defaultConfig, 0, sizeof(defaultConfig));
69 defaultConfig.s_PicoOpt|= POPT_6BTN_PAD; // for xmen proto
70 defaultConfig.s_PicoCDBuffers = 0;
71 defaultConfig.Frameskip = 0;
74 void pemu_validate_config(void)
78 void pemu_loop_prep(void)
80 PicoDrawSetOutFormat(PDF_RGB555, 1);
81 PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
85 void pemu_loop_end(void)
90 void pemu_forced_frame(int no_scale, int do_emu)
94 void pemu_finalize_frame(const char *fps, const char *notice_msg)
98 void plat_video_flip(void)
100 DirectScreen(g_screen_ptr);
104 void plat_video_wait_vsync(void)
108 void plat_video_toggle_renderer(int change, int is_menu)
110 // this will auto-select SMS/32X renderers
111 PicoDrawSetOutFormat(PDF_RGB555, 1);
114 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
116 EmuScreenRect.left = is_32cols ? 32 : 0;
117 EmuScreenRect.right = is_32cols ? 256+32 : 320;
118 EmuScreenRect.top = start_line;
119 EmuScreenRect.bottom = start_line + line_count;
121 PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 2000, 0);
124 static int sndbuff[2*44100/50/2 + 4];
126 static void update_sound(int len)
128 /* avoid writing audio when lagging behind to prevent audio lag */
129 if (PicoSkipFrame != 2)
130 DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
133 void pemu_sound_start(void)
138 currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
140 // prepare sound stuff
141 if (currentConfig.EmuOpt & EOPT_EN_SOUND)
145 ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
147 lprintf("dsound init failed\n");
151 PsndOut = (void *)sndbuff;
152 PicoWriteSound = update_sound;
153 currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
157 void pemu_sound_stop(void)
162 void pemu_sound_wait(void)
166 int plat_get_root_dir(char *dst, int len)
170 ml = GetModuleFileName(NULL, dst, len);
171 while (ml > 0 && dst[ml] != '\\')
180 void plat_status_msg_busy_first(const char *msg)
184 void plat_status_msg_busy_next(const char *msg)
188 void plat_status_msg_clear(void)
192 void plat_video_menu_enter(int is_rom_loaded)
196 void plat_video_menu_begin(void)
200 void plat_video_menu_end(void)
204 void plat_update_volume(int has_changed, int is_up)
208 const char *plat_get_credits(void)
210 return "PicoDrive v" VERSION " minibeta (c) notaz, 2006-2009\n\n"
212 "fDave: base code of PicoDrive\n"
215 "MAME devs: YM2612, SN76496 and SH2 cores\n"
216 "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
217 "Special thanks (ideas, valuable information and stuff):\n"
218 "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
219 "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
222 void plat_debug_cat(char *str)
227 int mp3_get_bitrate(void *f, int size)
232 void mp3_start_play(void *f, int pos)
236 void mp3_update(int *buffer, int length, int stereo)
241 void lprintf(const char *fmt, ...)
247 vsnprintf(buf, sizeof(buf), fmt, val);
249 OutputDebugString(buf);
254 int alphasort() { return 0; }
255 int scandir() { return 0; }