mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-10-27 13:38:51 +01:00
win32 Pico mostly finished
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@452 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
7a87643e07
commit
2cb51c3c62
4 changed files with 42 additions and 15 deletions
|
|
@ -160,7 +160,9 @@ static int DirectClearDDraw(unsigned int colour)
|
||||||
|
|
||||||
static int DirectPresentDDraw()
|
static int DirectPresentDDraw()
|
||||||
{
|
{
|
||||||
int ret = m_pddsFrontBuffer->Blt(&FrameRectMy, m_pddsBackBuffer, &EmuScreenRect, DDBLT_WAIT, NULL);
|
int ret = 0;
|
||||||
|
if (FrameRectMy.right - FrameRectMy.left > 0 && FrameRectMy.bottom - FrameRectMy.top > 0)
|
||||||
|
ret = m_pddsFrontBuffer->Blt(&FrameRectMy, m_pddsBackBuffer, &EmuScreenRect, DDBLT_WAIT, NULL);
|
||||||
if (ret) { LOGFAIL(); return 1; }
|
if (ret) { LOGFAIL(); return 1; }
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
unsigned short *EmuScreen=NULL;
|
unsigned short *EmuScreen=NULL;
|
||||||
int EmuWidth=320,EmuHeight=224;
|
int EmuWidth=320,EmuHeight=224;
|
||||||
RECT EmuScreenRect = { 0, 0, 320, 224 };
|
RECT EmuScreenRect = { 0, 0, 320, 224 };
|
||||||
int picohw_pen_pressed = 0;
|
int PicoPadAdd = 0;
|
||||||
|
|
||||||
static int EmuScan(unsigned int num);
|
static int EmuScan(unsigned int num);
|
||||||
unsigned char *PicoDraw2FB = NULL;
|
unsigned char *PicoDraw2FB = NULL;
|
||||||
|
|
@ -59,7 +59,7 @@ int EmuFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
PicoPad[0]=input;
|
PicoPad[0]=input;
|
||||||
if (picohw_pen_pressed) PicoPad[0] |= 0x20;
|
PicoPad[0]|=PicoPadAdd;
|
||||||
|
|
||||||
PsndOut=(short *)DSoundNext;
|
PsndOut=(short *)DSoundNext;
|
||||||
PicoFrame();
|
PicoFrame();
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ int MainWidth=720,MainHeight=480;
|
||||||
static HMENU mmain = 0, mdisplay = 0, mpicohw = 0;
|
static HMENU mmain = 0, mdisplay = 0, mpicohw = 0;
|
||||||
static int rom_loaded = 0;
|
static int rom_loaded = 0;
|
||||||
static HBITMAP ppad_bmp = 0;
|
static HBITMAP ppad_bmp = 0;
|
||||||
static HBITMAP ppage_bmps[6] = { 0, };
|
static HBITMAP ppage_bmps[7] = { 0, };
|
||||||
static char rom_name[0x20*3+1];
|
static char rom_name[0x20*3+1];
|
||||||
|
|
||||||
static void UpdateRect()
|
static void UpdateRect()
|
||||||
|
|
@ -103,7 +103,7 @@ static void PrepareForROM(unsigned char *rom_data)
|
||||||
|
|
||||||
PicoPicohw.pen_pos[0] =
|
PicoPicohw.pen_pos[0] =
|
||||||
PicoPicohw.pen_pos[1] = 0x8000;
|
PicoPicohw.pen_pos[1] = 0x8000;
|
||||||
picohw_pen_pressed = 0;
|
PicoPadAdd = 0;
|
||||||
|
|
||||||
ret = extract_rom_name(rom_name, rom_data + 0x150, 0x20);
|
ret = extract_rom_name(rom_name, rom_data + 0x150, 0x20);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
|
|
@ -121,7 +121,7 @@ static void PrepareForROM(unsigned char *rom_data)
|
||||||
ppad_bmp = png2hb(path, 0);
|
ppad_bmp = png2hb(path, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 6; i++) {
|
for (i = 0; i < 7; i++) {
|
||||||
if (ppage_bmps[i] != NULL) DeleteObject(ppage_bmps[i]);
|
if (ppage_bmps[i] != NULL) DeleteObject(ppage_bmps[i]);
|
||||||
sprintf(p, "pico\\%s_%i.png", rom_name, i);
|
sprintf(p, "pico\\%s_%i.png", rom_name, i);
|
||||||
ppage_bmps[i] = png2hb(path, 1);
|
ppage_bmps[i] = png2hb(path, 1);
|
||||||
|
|
@ -267,13 +267,35 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
||||||
if (PtInRect(&rc, pt)) break;
|
if (PtInRect(&rc, pt)) break;
|
||||||
PicoPicohw.pen_pos[0] |= 0x8000;
|
PicoPicohw.pen_pos[0] |= 0x8000;
|
||||||
PicoPicohw.pen_pos[1] |= 0x8000;
|
PicoPicohw.pen_pos[1] |= 0x8000;
|
||||||
picohw_pen_pressed = 0;
|
PicoPadAdd = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd,msg,wparam,lparam);
|
return DefWindowProc(hwnd,msg,wparam,lparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void key_down(WPARAM key)
|
||||||
|
{
|
||||||
|
switch (key) {
|
||||||
|
case VK_LEFT: PicoPadAdd |= 4; break;
|
||||||
|
case VK_RIGHT: PicoPadAdd |= 8; break;
|
||||||
|
case VK_UP: PicoPadAdd |= 1; break;
|
||||||
|
case VK_DOWN: PicoPadAdd |= 2; break;
|
||||||
|
case 'X': PicoPadAdd |= 0x10; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void key_up(WPARAM key)
|
||||||
|
{
|
||||||
|
switch (key) {
|
||||||
|
case VK_LEFT: PicoPadAdd &= ~0x04; break;
|
||||||
|
case VK_RIGHT: PicoPadAdd &= ~0x08; break;
|
||||||
|
case VK_UP: PicoPadAdd &= ~0x01; break;
|
||||||
|
case VK_DOWN: PicoPadAdd &= ~0x02; break;
|
||||||
|
case 'X': PicoPadAdd &= ~0x10; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
||||||
{
|
{
|
||||||
PAINTSTRUCT ps;
|
PAINTSTRUCT ps;
|
||||||
|
|
@ -281,15 +303,17 @@ static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lp
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_CLOSE: return 0;
|
|
||||||
case WM_DESTROY: PicoSwWnd=NULL; break;
|
case WM_DESTROY: PicoSwWnd=NULL; break;
|
||||||
case WM_LBUTTONDOWN: picohw_pen_pressed = 1; return 0;
|
case WM_LBUTTONDOWN: PicoPadAdd |= 0x20; return 0;
|
||||||
case WM_LBUTTONUP: picohw_pen_pressed = 0; return 0;
|
case WM_LBUTTONUP: PicoPadAdd &= ~0x20; return 0;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
if (HIWORD(lparam) < 0x20) break;
|
||||||
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam) * 2/3;
|
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam) * 2/3;
|
||||||
PicoPicohw.pen_pos[1] = 0x2f8 + HIWORD(lparam);
|
PicoPicohw.pen_pos[1] = 0x2f8 + HIWORD(lparam) - 0x20;
|
||||||
SetTimer(FrameWnd, 100, 1000, NULL);
|
SetTimer(FrameWnd, 100, 1000, NULL);
|
||||||
break;
|
break;
|
||||||
|
case WM_KEYDOWN: key_down(wparam); break;
|
||||||
|
case WM_KEYUP: key_up(wparam); break;
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
hdc = BeginPaint(hwnd, &ps);
|
hdc = BeginPaint(hwnd, &ps);
|
||||||
if (ppage_bmps[PicoPicohw.page] == NULL)
|
if (ppage_bmps[PicoPicohw.page] == NULL)
|
||||||
|
|
@ -321,15 +345,16 @@ static LRESULT CALLBACK PicoPadWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM l
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
case WM_CLOSE: return 0;
|
|
||||||
case WM_DESTROY: PicoPadWnd=NULL; break;
|
case WM_DESTROY: PicoPadWnd=NULL; break;
|
||||||
case WM_LBUTTONDOWN: picohw_pen_pressed = 1; return 0;
|
case WM_LBUTTONDOWN: PicoPadAdd |= 0x20; return 0;
|
||||||
case WM_LBUTTONUP: picohw_pen_pressed = 0; return 0;
|
case WM_LBUTTONUP: PicoPadAdd &= ~0x20; return 0;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam);
|
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam);
|
||||||
PicoPicohw.pen_pos[1] = 0x1fc + HIWORD(lparam);
|
PicoPicohw.pen_pos[1] = 0x1fc + HIWORD(lparam);
|
||||||
SetTimer(FrameWnd, 100, 1000, NULL);
|
SetTimer(FrameWnd, 100, 1000, NULL);
|
||||||
break;
|
break;
|
||||||
|
case WM_KEYDOWN: key_down(wparam); break;
|
||||||
|
case WM_KEYUP: key_up(wparam); break;
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
if (ppad_bmp == NULL) break;
|
if (ppad_bmp == NULL) break;
|
||||||
hdc = BeginPaint(hwnd, &ps);
|
hdc = BeginPaint(hwnd, &ps);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
extern unsigned short *EmuScreen;
|
extern unsigned short *EmuScreen;
|
||||||
extern int EmuWidth,EmuHeight;
|
extern int EmuWidth,EmuHeight;
|
||||||
extern RECT EmuScreenRect;
|
extern RECT EmuScreenRect;
|
||||||
extern int picohw_pen_pressed;
|
extern int PicoPadAdd;
|
||||||
int EmuInit();
|
int EmuInit();
|
||||||
void EmuExit();
|
void EmuExit();
|
||||||
int EmuRomLoad(char *name);
|
int EmuRomLoad(char *name);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue