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 };
19 char cpu_clk_name[] = "unused";
23 g_screen_ptr = (void *)screen_buff;
26 int plat_is_dir(const char *path)
28 return (GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY) ? 1 : 0;
31 unsigned int plat_get_ticks_ms(void)
33 return GetTickCount();
36 unsigned int plat_get_ticks_us(void)
38 // XXX: maybe performance counters?
39 return GetTickCount() * 1000;
42 void plat_wait_till_us(unsigned int us)
44 int msdiff = (int)(us - plat_get_ticks_us()) / 1000;
47 while (plat_get_ticks_us() < us)
51 void plat_sleep_ms(int ms)
56 int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
61 void pemu_prep_defconfig(void)
63 memset(&defaultConfig, 0, sizeof(defaultConfig));
64 defaultConfig.s_PicoOpt|= POPT_6BTN_PAD; // for xmen proto
65 defaultConfig.s_PicoCDBuffers = 0;
66 defaultConfig.Frameskip = 0;
69 void pemu_validate_config(void)
73 void pemu_loop_prep(void)
75 PicoDrawSetOutFormat(PDF_RGB555, 1);
76 PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
80 void pemu_loop_end(void)
85 void pemu_forced_frame(int opts, int no_scale)
89 void pemu_finalize_frame(const char *fps, const char *notice_msg)
93 void plat_video_flip(void)
95 DirectScreen(g_screen_ptr);
99 void plat_video_wait_vsync(void)
103 void plat_video_toggle_renderer(int change, int is_menu)
105 // this will auto-select SMS/32X renderers
106 PicoDrawSetOutFormat(PDF_RGB555, 1);
109 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
111 EmuScreenRect.left = is_32cols ? 32 : 0;
112 EmuScreenRect.right = is_32cols ? 256+32 : 320;
113 EmuScreenRect.top = start_line;
114 EmuScreenRect.bottom = start_line + line_count;
116 PostMessage(FrameWnd, WM_COMMAND, 0x20000 | 2000, 0);
119 static int sndbuff[2*44100/50/2 + 4];
121 static void update_sound(int len)
123 /* avoid writing audio when lagging behind to prevent audio lag */
124 if (PicoSkipFrame != 2)
125 DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
128 void pemu_sound_start(void)
133 currentConfig.EmuOpt &= ~EOPT_EXT_FRMLIMIT;
135 // prepare sound stuff
136 if (currentConfig.EmuOpt & EOPT_EN_SOUND)
140 ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
142 lprintf("dsound init failed\n");
146 PsndOut = (void *)sndbuff;
147 PicoWriteSound = update_sound;
148 currentConfig.EmuOpt |= EOPT_EXT_FRMLIMIT;
152 void pemu_sound_stop(void)
157 void pemu_sound_wait(void)
161 int plat_get_root_dir(char *dst, int len)
165 ml = GetModuleFileName(NULL, dst, len);
166 while (ml > 0 && dst[ml] != '\\')
175 void plat_status_msg_busy_first(const char *msg)
179 void plat_status_msg_busy_next(const char *msg)
183 void plat_status_msg_clear(void)
187 void plat_video_menu_enter(int is_rom_loaded)
191 void plat_video_menu_begin(void)
195 void plat_video_menu_end(void)
199 void plat_update_volume(int has_changed, int is_up)
203 const char *plat_get_credits(void)
205 return "PicoDrive v" VERSION " minibeta (c) notaz, 2006-2009\n\n"
207 "fDave: base code of PicoDrive\n"
210 "MAME devs: YM2612, SN76496 and SH2 cores\n"
211 "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
212 "Special thanks (ideas, valuable information and stuff):\n"
213 "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
214 "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
217 void plat_debug_cat(char *str)
222 int mp3_get_bitrate(FILE *f, int size)
227 void mp3_start_play(FILE *f, int pos)
231 void mp3_update(int *buffer, int length, int stereo)
236 void lprintf(const char *fmt, ...)
242 vsnprintf(buf, sizeof(buf), fmt, val);
244 OutputDebugString(buf);
249 int alphasort() { return 0; }
250 int scandir() { return 0; }