rearrange globals
[picodrive.git] / platform / win32 / plat.c
index 0c1dea6..a9cceb7 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * PicoDrive
+ * (C) notaz, 2009,2010
+ *
+ * This work is licensed under the terms of MAME license.
+ * See COPYING file in the top-level directory.
+ */
 #include <windows.h>
 #include <stdio.h>
 
 #include "main.h"
 
 static unsigned short screen_buff[320 * 240];
-static unsigned char PicoDraw2FB_[(8+320) * (8+240+8)];
-unsigned char *PicoDraw2FB = PicoDraw2FB_;
-
-char cpu_clk_name[] = "unused";
+const char *renderer_names[] = { NULL };
+const char *renderer_names32x[] = { NULL };
 
 void plat_init(void)
 {
@@ -41,7 +46,7 @@ void plat_wait_till_us(unsigned int us)
 {
        int msdiff = (int)(us - plat_get_ticks_us()) / 1000;
        if (msdiff > 6)
-;//            Sleep(msdiff - 6);
+               Sleep(msdiff - 6);
        while (plat_get_ticks_us() < us)
                ;
 }
@@ -59,29 +64,18 @@ int plat_wait_event(int *fds_hnds, int count, int timeout_ms)
 void pemu_prep_defconfig(void)
 {
        memset(&defaultConfig, 0, sizeof(defaultConfig));
-       defaultConfig.EmuOpt    = 0x9d | EOPT_RAM_TIMINGS|EOPT_CONFIRM_SAVE|EOPT_EN_CD_LEDS;
-       defaultConfig.s_PicoOpt = POPT_EN_STEREO|POPT_EN_FM|POPT_EN_PSG|POPT_EN_Z80 |
-                                 POPT_EN_MCD_PCM|POPT_EN_MCD_CDDA|POPT_ACC_SPRITES |
-                                 POPT_EN_32X|POPT_EN_PWM;
-       defaultConfig.s_PicoOpt|= POPT_6BTN_PAD; // for xmen proto
-       defaultConfig.s_PsndRate = 44100;
-       defaultConfig.s_PicoRegion = 0; // auto
-       defaultConfig.s_PicoAutoRgnOrder = 0x184; // US, EU, JP
        defaultConfig.s_PicoCDBuffers = 0;
        defaultConfig.Frameskip = 0;
 }
 
-static int EmuScanBegin16(unsigned int num)
+void pemu_validate_config(void)
 {
-       DrawLineDest = (unsigned short *) g_screen_ptr + g_screen_width * num;
-
-       return 0;
 }
 
 void pemu_loop_prep(void)
 {
-       PicoDrawSetColorFormat(1);
-       PicoScanBegin = EmuScanBegin16;
+       PicoDrawSetOutFormat(PDF_RGB555, 1);
+       PicoDrawSetOutBuf(g_screen_ptr, g_screen_width * 2);
        pemu_sound_start();
 }
 
@@ -90,11 +84,15 @@ void pemu_loop_end(void)
        pemu_sound_stop();
 }
 
-void pemu_forced_frame(int opts)
+void pemu_forced_frame(int no_scale, int do_emu)
+{
+}
+
+void pemu_finalize_frame(const char *fps, const char *notice_msg)
 {
 }
 
-void pemu_update_display(const char *fps, const char *notice_msg)
+void plat_video_flip(void)
 {
        DirectScreen(g_screen_ptr);
        DirectPresent();
@@ -104,10 +102,10 @@ void plat_video_wait_vsync(void)
 {
 }
 
-void plat_video_toggle_renderer(int is_next, int force_16bpp, int is_menu)
+void plat_video_toggle_renderer(int change, int is_menu)
 {
        // this will auto-select SMS/32X renderers
-       PicoDrawSetColorFormat(1);
+       PicoDrawSetOutFormat(PDF_RGB555, 1);
 }
 
 void emu_video_mode_change(int start_line, int line_count, int is_32cols)
@@ -125,7 +123,7 @@ static int sndbuff[2*44100/50/2 + 4];
 static void update_sound(int len)
 {
        /* avoid writing audio when lagging behind to prevent audio lag */
-       if (PicoSkipFrame != 2)
+       if (PicoIn.skipFrame != 2)
                DSoundUpdate(sndbuff, (currentConfig.EmuOpt & EOPT_NO_FRMLIMIT) ? 0 : 1);
 }
 
@@ -141,7 +139,7 @@ void pemu_sound_start(void)
        {
                PsndRerate(0);
 
-               ret = DSoundInit(FrameWnd, PsndRate, (PicoOpt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
+               ret = DSoundInit(FrameWnd, PsndRate, (PicoIn.opt & POPT_EN_STEREO) ? 1 : 0, PsndLen);
                if (ret != 0) {
                        lprintf("dsound init failed\n");
                        return;
@@ -200,10 +198,6 @@ void plat_video_menu_end(void)
 {
 }
 
-void plat_validate_config(void)
-{
-}
-
 void plat_update_volume(int has_changed, int is_up)
 {
 }
@@ -216,7 +210,7 @@ const char *plat_get_credits(void)
                "Chui: Fame/C\n"
                "NJ: CZ80\n"
                "MAME devs: YM2612, SN76496 and SH2 cores\n"
-               "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
+               "Stéphane Dallongeville: base of Fame/C (C68K), CZ80\n\n"
                "Special thanks (ideas, valuable information and stuff):\n"
                "Charles MacDonald, Eke, Exophase, Haze, Lordus, Nemesis,\n"
                "Pierpaolo Prazzoli, Rokas, Steve Snake, Tasco Deluxe.\n";
@@ -227,12 +221,12 @@ void plat_debug_cat(char *str)
 }
 
 // required by pico
-int mp3_get_bitrate(FILE *f, int size)
+int mp3_get_bitrate(void *f, int size)
 {
        return 128;
 }
 
-void mp3_start_play(FILE *f, int pos)
+void mp3_start_play(void *f, int pos)
 {
 }