From 278922b838bb8a8569f25660f7bdcb2d271879f3 Mon Sep 17 00:00:00 2001 From: notaz Date: Mon, 4 Feb 2008 17:56:43 +0000 Subject: [PATCH] bugfixes git-svn-id: file:///home/notaz/opt/svn/PicoDrive@347 be3aeb3a-fb24-0410-a615-afba39da0efa --- platform/win32/GenaDrive/Direct.cpp | 16 +++++++++++++++- platform/win32/GenaDrive/Main.cpp | 6 +++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/platform/win32/GenaDrive/Direct.cpp b/platform/win32/GenaDrive/Direct.cpp index a726acb..b8112d3 100644 --- a/platform/win32/GenaDrive/Direct.cpp +++ b/platform/win32/GenaDrive/Direct.cpp @@ -58,7 +58,7 @@ static int DirectDrawInit() // Create the backbuffer surface ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; ddsd.dwWidth = EmuWidth; ddsd.dwHeight = EmuHeight; @@ -110,6 +110,20 @@ static int DirectScreenDDraw() dst = (int *)((char *)dst + sd.lPitch); } } + else if (sd.ddpfPixelFormat.dwRGBBitCount == 24) /* wine uses this for me */ + { + void *dst = sd.lpSurface; + for (y = 0; y < EmuHeight; y++) + { + unsigned char *dst1 = (unsigned char *) dst; + for (x = 0; x < EmuWidth; x++, dst1 += 3) + { + int s = *ps++; + dst1[2] = (s&0xf800)>>8; dst1[1] = (s&0x07e0)>>3; dst1[0] = s<<3; // BGR + } + dst = (void *)((char *)dst + sd.lPitch); + } + } else if (sd.ddpfPixelFormat.dwRGBBitCount == 16) { unsigned short *dst = (unsigned short *)sd.lpSurface; diff --git a/platform/win32/GenaDrive/Main.cpp b/platform/win32/GenaDrive/Main.cpp index 4fbbf02..724c454 100644 --- a/platform/win32/GenaDrive/Main.cpp +++ b/platform/win32/GenaDrive/Main.cpp @@ -11,6 +11,7 @@ int lock_to_1_1 = 1; int MainWidth=720,MainHeight=480; static HMENU mdisplay = 0; +static unsigned char *rom_data = NULL; static void UpdateRect() { @@ -24,7 +25,6 @@ static void UpdateRect() static void LoadROM(const char *cmdpath) { static char rompath[MAX_PATH] = { 0, }; - static unsigned char *rom_data = NULL; unsigned char *rom_data_new = NULL; unsigned int rom_size = 0; pm_file *rom = NULL; @@ -106,7 +106,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) lock_to_1_1=0; CheckMenuItem(mdisplay, 1104, MF_UNCHECKED); } - LoopWait=0; + if (rom_data != NULL) LoopWait=0; return 0; case 1104: lock_to_1_1=!lock_to_1_1; @@ -181,7 +181,7 @@ static int FrameInit() InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mfile, "&File"); InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mdisplay, "&Display"); // InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1200, "&Config"); - InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1300, "&About"); + InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING, 1300, "&About"); // Create the window: FrameWnd=CreateWindow(wc.lpszClassName,"PicoDrive " VERSION,style|WS_VISIBLE, -- 2.39.2