mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
more win32 Pico work
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@449 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
67c81ee2e4
commit
42989e7d7e
4 changed files with 52 additions and 4 deletions
|
@ -34,7 +34,7 @@ static u32 PicoReadPico8(u32 a)
|
||||||
case 0x01: d = PicoPicohw.r1; break;
|
case 0x01: d = PicoPicohw.r1; break;
|
||||||
case 0x03:
|
case 0x03:
|
||||||
d = PicoPad[0]&0x1f; // d-pad
|
d = PicoPad[0]&0x1f; // d-pad
|
||||||
d |= (PicoPad[0]&0x20) << 2; // red button -> C
|
d |= (PicoPad[0]&0x20) << 2; // pen push -> C
|
||||||
d = ~d;
|
d = ~d;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -4,6 +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;
|
||||||
|
|
||||||
static int EmuScan(unsigned int num);
|
static int EmuScan(unsigned int num);
|
||||||
unsigned char *PicoDraw2FB = NULL;
|
unsigned char *PicoDraw2FB = NULL;
|
||||||
|
@ -58,6 +59,7 @@ int EmuFrame()
|
||||||
}
|
}
|
||||||
|
|
||||||
PicoPad[0]=input;
|
PicoPad[0]=input;
|
||||||
|
if (picohw_pen_pressed) PicoPad[0] |= 0x20;
|
||||||
|
|
||||||
PsndOut=(short *)DSoundNext;
|
PsndOut=(short *)DSoundNext;
|
||||||
PicoFrame();
|
PicoFrame();
|
||||||
|
|
|
@ -11,7 +11,7 @@ static HWND PicoSwWnd=NULL, PicoPadWnd=NULL;
|
||||||
|
|
||||||
int MainWidth=720,MainHeight=480;
|
int MainWidth=720,MainHeight=480;
|
||||||
|
|
||||||
static HMENU mdisplay = 0, mpicohw = 0;
|
static HMENU mmain = 0, mdisplay = 0, mpicohw = 0;
|
||||||
static int rom_loaded = 0;
|
static int rom_loaded = 0;
|
||||||
|
|
||||||
static void UpdateRect()
|
static void UpdateRect()
|
||||||
|
@ -23,6 +23,22 @@ static void UpdateRect()
|
||||||
FrameRectMy = wi.rcClient;
|
FrameRectMy = wi.rcClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void PrepareFroROM()
|
||||||
|
{
|
||||||
|
int show = PicoAHW & PAHW_PICO;
|
||||||
|
EnableMenuItem(mmain, 2, MF_BYPOSITION|(show ? MF_ENABLED : MF_GRAYED));
|
||||||
|
ShowWindow(PicoPadWnd, show ? SW_SHOWNA : SW_HIDE);
|
||||||
|
ShowWindow(PicoSwWnd, show ? SW_SHOWNA : SW_HIDE);
|
||||||
|
CheckMenuItem(mpicohw, 1210, show ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
CheckMenuItem(mpicohw, 1211, show ? MF_CHECKED : MF_UNCHECKED);
|
||||||
|
PostMessage(FrameWnd, WM_COMMAND, 1220 + PicoPicohw.page, 0);
|
||||||
|
DrawMenuBar(FrameWnd);
|
||||||
|
|
||||||
|
PicoPicohw.pen_pos[0] =
|
||||||
|
PicoPicohw.pen_pos[1] = 0x8000;
|
||||||
|
picohw_pen_pressed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void LoadROM(const char *cmdpath)
|
static void LoadROM(const char *cmdpath)
|
||||||
{
|
{
|
||||||
static char rompath[MAX_PATH] = { 0, };
|
static char rompath[MAX_PATH] = { 0, };
|
||||||
|
@ -67,6 +83,8 @@ static void LoadROM(const char *cmdpath)
|
||||||
PicoCartUnload();
|
PicoCartUnload();
|
||||||
PicoCartInsert(rom_data_new, rom_size);
|
PicoCartInsert(rom_data_new, rom_size);
|
||||||
|
|
||||||
|
PrepareFroROM();
|
||||||
|
|
||||||
rom_loaded = 1;
|
rom_loaded = 1;
|
||||||
romname = rompath;
|
romname = rompath;
|
||||||
LoopWait=0;
|
LoopWait=0;
|
||||||
|
@ -78,6 +96,8 @@ static int rect_heights[4] = { 224, 224, 448, 448 };
|
||||||
// Window proc for the frame window:
|
// Window proc for the frame window:
|
||||||
static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
||||||
{
|
{
|
||||||
|
POINT pt;
|
||||||
|
RECT rc;
|
||||||
int i;
|
int i;
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
@ -148,6 +168,16 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WM_TIMER:
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
GetWindowRect(PicoSwWnd, &rc);
|
||||||
|
if (PtInRect(&rc, pt)) break;
|
||||||
|
GetWindowRect(PicoPadWnd, &rc);
|
||||||
|
if (PtInRect(&rc, pt)) break;
|
||||||
|
PicoPicohw.pen_pos[0] |= 0x8000;
|
||||||
|
PicoPicohw.pen_pos[1] |= 0x8000;
|
||||||
|
picohw_pen_pressed = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd,msg,wparam,lparam);
|
return DefWindowProc(hwnd,msg,wparam,lparam);
|
||||||
|
@ -159,6 +189,13 @@ static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lp
|
||||||
{
|
{
|
||||||
case WM_CLOSE: return 0;
|
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_LBUTTONUP: picohw_pen_pressed = 0; return 0;
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam) * 2/3;
|
||||||
|
PicoPicohw.pen_pos[1] = 0x2f8 + HIWORD(lparam);
|
||||||
|
SetTimer(FrameWnd, 100, 1000, NULL);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd,msg,wparam,lparam);
|
return DefWindowProc(hwnd,msg,wparam,lparam);
|
||||||
|
@ -170,6 +207,13 @@ static LRESULT CALLBACK PicoPadWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM l
|
||||||
{
|
{
|
||||||
case WM_CLOSE: return 0;
|
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_LBUTTONUP: picohw_pen_pressed = 0; return 0;
|
||||||
|
case WM_MOUSEMOVE:
|
||||||
|
PicoPicohw.pen_pos[0] = 0x03c + LOWORD(lparam);
|
||||||
|
PicoPicohw.pen_pos[1] = 0x1fc + HIWORD(lparam);
|
||||||
|
SetTimer(FrameWnd, 100, 1000, NULL);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return DefWindowProc(hwnd,msg,wparam,lparam);
|
return DefWindowProc(hwnd,msg,wparam,lparam);
|
||||||
|
@ -180,7 +224,7 @@ static int FrameInit()
|
||||||
{
|
{
|
||||||
WNDCLASS wc;
|
WNDCLASS wc;
|
||||||
RECT rect={0,0,0,0};
|
RECT rect={0,0,0,0};
|
||||||
HMENU mmain, mfile;
|
HMENU mfile;
|
||||||
int style=0;
|
int style=0;
|
||||||
int left=0,top=0,width=0,height=0;
|
int left=0,top=0,width=0,height=0;
|
||||||
|
|
||||||
|
@ -245,6 +289,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) mfile, "&File");
|
||||||
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mdisplay, "&Display");
|
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mdisplay, "&Display");
|
||||||
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mpicohw, "&Pico");
|
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, (UINT_PTR) mpicohw, "&Pico");
|
||||||
|
EnableMenuItem(mmain, 2, MF_BYPOSITION|MF_GRAYED);
|
||||||
// InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1200, "&Config");
|
// InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1200, "&Config");
|
||||||
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING, 1300, "&About");
|
InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING, 1300, "&About");
|
||||||
|
|
||||||
|
@ -269,7 +314,7 @@ static int FrameInit()
|
||||||
|
|
||||||
left += 326;
|
left += 326;
|
||||||
PicoSwWnd=CreateWindow("PicoSwWnd","Storyware",style,
|
PicoSwWnd=CreateWindow("PicoSwWnd","Storyware",style,
|
||||||
left,top,width,height,FrameWnd,NULL,NULL,NULL);
|
left,top,width+160,height,FrameWnd,NULL,NULL,NULL);
|
||||||
|
|
||||||
top += 266;
|
top += 266;
|
||||||
PicoPadWnd=CreateWindow("PicoPadWnd","Drawing Pad",style,
|
PicoPadWnd=CreateWindow("PicoPadWnd","Drawing Pad",style,
|
||||||
|
|
|
@ -24,6 +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;
|
||||||
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