4 #include "../common/lprintf.h"
5 #include "../common/plat.h"
6 #include "../common/emu.h"
7 #include "../../pico/pico.h"
13 static unsigned short screen_buff[320 * 240];
14 static unsigned char PicoDraw2FB_[(8+320) * (8+240+8)];
15 unsigned char *PicoDraw2FB = PicoDraw2FB_;
16 const char *renderer_names[] = { NULL };
17 const char *renderer_names32x[] = { NULL };
21 g_screen_ptr = (void *)screen_buff;
24 int plat_is_dir(const char *path)
26 return (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
29 unsigned int plat_get_ticks_ms(void)
31 return GetTickCount();
34 unsigned int plat_get_ticks_us(void)
36 // XXX: maybe performance counters?
37 return GetTickCount() * 1000;
40 void plat_wait_till_us(unsigned int us)
42 int msdiff = (int)(us - plat_get_ticks_us()) / 1000;
45 while (plat_get_ticks_us() < us)
49 void plat_sleep_ms(int ms)
54 int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
59 void pemu_prep_defconfig(void)
61 memset(&defaultConfig, 0, sizeof(defaultConfig));
62 defaultConfig.s_PicoOpt|= POPT_6BTN_PAD; // for xmen proto
63 defaultConfig.s_PicoCDBuffers = 0;
64 defaultConfig.Frameskip = 0;
67 void pemu_validate_config(void)
71 void pemu_loop_prep(void)
73 PicoDrawSetOutFormat(PDF_RGB555, 1);
74 PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
78 void pemu_loop_end(void)
83 void pemu_forced_frame(int no_scale, int do_emu)
87 void pemu_finalize_frame(const char *fps, const char *notice_msg)
91 void plat_video_flip(void)
93 DirectScreen(g_screen_ptr);
97 void plat_video_wait_vsync(void)
101 void plat_video_toggle_renderer(int change, int is_menu)
103 // this will auto-select SMS/32X renderers
104 PicoDrawSetOutFormat(PDF_RGB555, 1);
107 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
109 EmuScreenRect.left = is_32cols ? 32 : 0;
110 EmuScreenRect.right = is_32cols ? 256+32 : 320;
111 EmuScreenRect.top = start_line;
112 EmuScreenRect.bottom = start_line + line_count;
114 PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 2000, 0);
117 static int sndbuff[2*44100/50/2 + 4];
119 static void update_sound(int len)
121 /* avoid writing audio when lagging behind to prevent audio lag */
122 if (PicoSkipFrame != 2)
123 DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
126 void pemu_sound_start(void)
131 currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
133 // prepare sound stuff
134 if (currentConfig.EmuOpt & EOPT_EN_SOUND)
138 ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
140 lprintf("dsound init failed\n");
144 PsndOut = (void *)sndbuff;
145 PicoWriteSound = update_sound;
146 currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
150 void pemu_sound_stop(void)
155 void pemu_sound_wait(void)
159 int plat_get_root_dir(char *dst, int len)
163 ml = GetModuleFileName(NULL, dst, len);
164 while (ml > 0 && dst[ml] != '\\')
173 void plat_status_msg_busy_first(const char *msg)
177 void plat_status_msg_busy_next(const char *msg)
181 void plat_status_msg_clear(void)
185 void plat_video_menu_enter(int is_rom_loaded)
189 void plat_video_menu_begin(void)
193 void plat_video_menu_end(void)
197 void plat_update_volume(int has_changed, int is_up)
201 const char *plat_get_credits(void)
203 return "PicoDrive v" VERSION " minibeta (c) notaz, 2006-2009\n\n"
205 "fDave: base code of PicoDrive\n"
208 "MAME devs: YM2612, SN76496 and SH2 cores\n"
209 "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
210 "Special thanks (ideas, valuable information and stuff):\n"
211 "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
212 "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
215 void plat_debug_cat(char *str)
220 int mp3_get_bitrate(void *f, int size)
225 void mp3_start_play(void *f, int pos)
229 void mp3_update(int *buffer, int length, int stereo)
234 void lprintf(const char *fmt, ...)
240 vsnprintf(buf, sizeof(buf), fmt, val);
242 OutputDebugString(buf);
247 int alphasort() { return 0; }
248 int scandir() { return 0; }