From: notaz Date: Sun, 18 May 2008 21:24:18 +0000 (+0000) Subject: windows Pico stuff wip X-Git-Tag: v1.85~494 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67c81ee2e41f86851aeb221aed911980c07274bf;p=picodrive.git windows Pico stuff wip git-svn-id: file:///home/notaz/opt/svn/PicoDrive@448 be3aeb3a-fb24-0410-a615-afba39da0efa --- diff --git a/Pico/Cart.c b/Pico/Cart.c index 1dc3eae2..dacd793a 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -512,7 +512,7 @@ int PicoCartInsert(unsigned char *rom,unsigned int romsize) PicoCartUnloadHook = NULL; } - PicoAHW &= ~PAHW_SVP; + PicoAHW &= PAHW_MCD; PicoMemResetHooks(); PicoDmaHook = NULL; diff --git a/Pico/Pico/Memory.c b/Pico/Pico/Memory.c index ff2a15f6..3b536797 100644 --- a/Pico/Pico/Memory.c +++ b/Pico/Pico/Memory.c @@ -262,5 +262,15 @@ PICO_INTERNAL void PicoMemSetupPico(void) pm68k_read_memory_pcr_16 = m68k_read_memory_pcrp_16; pm68k_read_memory_pcr_32 = m68k_read_memory_pcrp_32; #endif +#ifdef EMU_F68K + // use standard setup, only override handlers + PicoMemSetup(); + PicoCpuFM68k.read_byte =PicoReadPico8; + PicoCpuFM68k.read_word =PicoReadPico16; + PicoCpuFM68k.read_long =PicoReadPico32; + PicoCpuFM68k.write_byte=PicoWritePico8; + PicoCpuFM68k.write_word=PicoWritePico16; + PicoCpuFM68k.write_long=PicoWritePico32; +#endif } diff --git a/Pico/carthw/svp/compiler.c b/Pico/carthw/svp/compiler.c index 7c06badb..551794e7 100644 --- a/Pico/carthw/svp/compiler.c +++ b/Pico/carthw/svp/compiler.c @@ -1398,7 +1398,7 @@ static int translate_op(unsigned int op, int *pc, int imm, int *end_cond, int *j } // ldi ri, simm - case 0x0c ... 0x0f: + case 0x0c: case 0x0d: case 0x0e: case 0x0f: tmpv = (op>>8)&7; known_regs.r[tmpv] = op; known_regb |= 1 << (tmpv + 8); diff --git a/Pico/cd/cue.c b/Pico/cd/cue.c index cfd4e274..84deba70 100644 --- a/Pico/cd/cue.c +++ b/Pico/cd/cue.c @@ -6,6 +6,10 @@ #include "../PicoInt.h" // #define elprintf(w,f,...) printf(f "\n",##__VA_ARGS__); +#ifdef _MSC_VER +#define snprintf _snprintf +#endif + static char *mystrip(char *str) { int i, len; diff --git a/platform/win32/GenaDrive/Emu.cpp b/platform/win32/GenaDrive/Emu.cpp index e1fd9764..497c023c 100644 --- a/platform/win32/GenaDrive/Emu.cpp +++ b/platform/win32/GenaDrive/Emu.cpp @@ -5,7 +5,7 @@ unsigned short *EmuScreen=NULL; int EmuWidth=320,EmuHeight=224; RECT EmuScreenRect = { 0, 0, 320, 224 }; -static int EmuScan(unsigned int num, void *sdata); +static int EmuScan(unsigned int num); unsigned char *PicoDraw2FB = NULL; int EmuInit() @@ -22,7 +22,7 @@ int EmuInit() memset(EmuScreen,0,len); PicoDrawSetColorFormat(1); - PicoScan=EmuScan; + PicoScanBegin=EmuScan; return 0; } @@ -38,18 +38,9 @@ void EmuExit() } // Megadrive scanline callback: -static int EmuScan(unsigned int num, void *sdata) +static int EmuScan(unsigned int num) { - unsigned short *pd=NULL; - unsigned short *ps=NULL; - - if (num>=(unsigned int)EmuHeight) return 0; - - // Copy scanline to screen buffer: - pd=EmuScreen+(num<<8)+(num<<6); - ps=(unsigned short *)sdata; - - memcpy(pd, ps, 320*2); + DrawLineDest=EmuScreen+(num<<8)+(num<<6); return 0; } diff --git a/platform/win32/GenaDrive/Main.cpp b/platform/win32/GenaDrive/Main.cpp index 93db3cd9..bea2317d 100644 --- a/platform/win32/GenaDrive/Main.cpp +++ b/platform/win32/GenaDrive/Main.cpp @@ -7,10 +7,11 @@ char *romname=NULL; HWND FrameWnd=NULL; RECT FrameRectMy; int lock_to_1_1 = 1; +static HWND PicoSwWnd=NULL, PicoPadWnd=NULL; int MainWidth=720,MainHeight=480; -static HMENU mdisplay = 0; +static HMENU mdisplay = 0, mpicohw = 0; static int rom_loaded = 0; static void UpdateRect() @@ -63,7 +64,7 @@ static void LoadROM(const char *cmdpath) LoopWait=1; for (i = 0; LoopWaiting == 0 && i < 10; i++) Sleep(100); - PicoUnloadCart(); + PicoCartUnload(); PicoCartInsert(rom_data_new, rom_size); rom_loaded = 1; @@ -89,7 +90,8 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) switch (LOWORD(wparam)) { case 1000: LoadROM(NULL); break; - case 1001: PostQuitMessage(0); return 0; + case 1001: PicoReset(); return 0; + case 1002: PostQuitMessage(0); return 0; case 1100: case 1101: case 1102: @@ -112,10 +114,28 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) lock_to_1_1=!lock_to_1_1; CheckMenuItem(mdisplay, 1104, lock_to_1_1 ? MF_CHECKED : MF_UNCHECKED); return 0; - case 1200: break; + case 1210: + case 1211: + i = IsWindowVisible((LOWORD(wparam)&1) ? PicoPadWnd : PicoSwWnd); + i = !i; + ShowWindow((LOWORD(wparam)&1) ? PicoPadWnd : PicoSwWnd, i ? SW_SHOWNA : SW_HIDE); + CheckMenuItem(mpicohw, LOWORD(wparam), i ? MF_CHECKED : MF_UNCHECKED); + return 0; + case 1220: + case 1221: + case 1222: + case 1223: + case 1224: + case 1225: + case 1226: + PicoPicohw.page = LOWORD(wparam) % 10; + for (i = 0; i < 7; i++) + CheckMenuItem(mpicohw, 1220 + i, MF_UNCHECKED); + CheckMenuItem(mpicohw, 1220 + PicoPicohw.page, MF_CHECKED); + return 0; case 1300: MessageBox(FrameWnd, "PicoDrive v" VERSION " (c) notaz, 2006-2008\n" - "SVP demo edition\n\n" + "SVP and Pico demo edition\n\n" "Credits:\n" "fDave: base code of PicoDrive, GenaDrive (the frontend)\n" "Chui: Fame/C\n" @@ -133,6 +153,29 @@ static LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) return DefWindowProc(hwnd,msg,wparam,lparam); } +static LRESULT CALLBACK PicoSwWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) +{ + switch (msg) + { + case WM_CLOSE: return 0; + case WM_DESTROY: PicoSwWnd=NULL; break; + } + + return DefWindowProc(hwnd,msg,wparam,lparam); +} + +static LRESULT CALLBACK PicoPadWndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam) +{ + switch (msg) + { + case WM_CLOSE: return 0; + case WM_DESTROY: PicoPadWnd=NULL; break; + } + + return DefWindowProc(hwnd,msg,wparam,lparam); +} + + static int FrameInit() { WNDCLASS wc; @@ -148,7 +191,15 @@ static int FrameInit() wc.hInstance=GetModuleHandle(NULL); wc.hCursor=LoadCursor(NULL,IDC_ARROW); wc.hbrBackground=CreateSolidBrush(0); - wc.lpszClassName="MainFrame"; + wc.lpszClassName="PicoMainFrame"; + RegisterClass(&wc); + + wc.lpszClassName="PicoSwWnd"; + wc.lpfnWndProc=PicoSwWndProc; + RegisterClass(&wc); + + wc.lpszClassName="PicoPadWnd"; + wc.lpfnWndProc=PicoPadWndProc; RegisterClass(&wc); rect.right =320;//MainWidth; @@ -171,21 +222,34 @@ static int FrameInit() // Create menu: mfile = CreateMenu(); InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1000, "&Load ROM"); - InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1001, "E&xit"); + InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1001, "&Reset"); + InsertMenu(mfile, -1, MF_BYPOSITION|MF_STRING, 1002, "E&xit"); mdisplay = CreateMenu(); InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1100, "320x224"); InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1101, "256x224"); InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1102, "640x448"); InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1103, "512x448"); InsertMenu(mdisplay, -1, MF_BYPOSITION|MF_STRING, 1104, "Lock to 1:1"); + mpicohw = CreateMenu(); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1210, "Show &Storyware"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1211, "Show &Drawing pad"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_SEPARATOR, 0, NULL); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1220, "Title page (&0)"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1221, "Page &1"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1222, "Page &2"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1223, "Page &3"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1224, "Page &4"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1225, "Page &5"); + InsertMenu(mpicohw, -1, MF_BYPOSITION|MF_STRING, 1226, "Page &6"); mmain = CreateMenu(); - 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) mpicohw, "&Pico"); // InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING|MF_POPUP, 1200, "&Config"); InsertMenu(mmain, -1, MF_BYPOSITION|MF_STRING, 1300, "&About"); // Create the window: - FrameWnd=CreateWindow(wc.lpszClassName,"PicoDrive " VERSION,style|WS_VISIBLE, + FrameWnd=CreateWindow("PicoMainFrame","PicoDrive " VERSION,style|WS_VISIBLE, left,top,width,height,NULL,mmain,NULL,NULL); CheckMenuItem(mdisplay, 1104, lock_to_1_1 ? MF_CHECKED : MF_UNCHECKED); @@ -193,6 +257,24 @@ static int FrameInit() UpdateWindow(FrameWnd); UpdateRect(); + // create Pico windows + style = WS_OVERLAPPED|WS_CAPTION|WS_BORDER; + rect.left=rect.top=0; + rect.right =320; + rect.bottom=224; + + AdjustWindowRect(&rect,style,1); + width =rect.right-rect.left; + height=rect.bottom-rect.top; + + left += 326; + PicoSwWnd=CreateWindow("PicoSwWnd","Storyware",style, + left,top,width,height,FrameWnd,NULL,NULL,NULL); + + top += 266; + PicoPadWnd=CreateWindow("PicoPadWnd","Drawing Pad",style, + left,top,width,height,FrameWnd,NULL,NULL,NULL); + return 0; } diff --git a/platform/win32/GenaDrive/Makefile.vc b/platform/win32/GenaDrive/Makefile.vc index 54369a5b..90279c14 100644 --- a/platform/win32/GenaDrive/Makefile.vc +++ b/platform/win32/GenaDrive/Makefile.vc @@ -30,11 +30,15 @@ OBJ = $(OBJ) $(R)Pico\Area.obj $(R)Pico\Cart.obj $(R)Pico\Memory.obj $(R)Pico\Mi # Pico - CD OBJ = $(OBJ) $(R)Pico\cd\Pico.obj $(R)Pico\cd\Memory.obj $(R)Pico\cd\Sek.obj $(R)Pico\cd\LC89510.obj \ $(R)Pico\cd\cd_sys.obj $(R)Pico\cd\cd_file.obj $(R)Pico\cd\gfx_cd.obj \ - $(R)Pico\cd\Area.obj $(R)Pico\cd\Misc.obj $(R)Pico\cd\pcm.obj $(R)Pico\cd\buffering.obj + $(R)Pico\cd\Area.obj $(R)Pico\cd\Misc.obj $(R)Pico\cd\pcm.obj $(R)Pico\cd\buffering.obj \ + $(R)Pico\cd\cue.obj +# Pico - Pico +OBJ = $(OBJ) $(R)Pico\Pico\Pico.obj $(R)Pico\Pico\Memory.obj $(R)Pico\Pico\xpcm.obj # Pico - sound OBJ = $(OBJ) $(R)Pico\sound\sound.obj $(R)Pico\sound\sn76496.obj $(R)Pico\sound\ym2612.obj $(R)Pico\sound\mix.obj # Pico - carthw -OBJ = $(OBJ) $(R)Pico\carthw\svp\svp.obj $(R)Pico\carthw\svp\Memory.obj $(R)Pico\carthw\svp\ssp16.obj +OBJ = $(OBJ) $(R)Pico\carthw\carthw.obj $(R)Pico\carthw\svp\svp.obj $(R)Pico\carthw\svp\Memory.obj \ + $(R)Pico\carthw\svp\ssp16.obj $(R)Pico\carthw\svp\compiler.obj # zlib OBJ = $(OBJ) $(R)zlib\gzio.obj $(R)zlib\inffast.obj $(R)zlib\inflate.obj $(R)zlib\inftrees.obj $(R)zlib\trees.obj \ $(R)zlib\deflate.obj $(R)zlib\crc32.obj $(R)zlib\adler32.obj $(R)zlib\zutil.obj $(R)zlib\compress.obj $(R)zlib\uncompr.obj diff --git a/platform/win32/GenaDrive/version.h b/platform/win32/GenaDrive/version.h index 405cb9c5..bbcef003 100644 --- a/platform/win32/GenaDrive/version.h +++ b/platform/win32/GenaDrive/version.h @@ -1,2 +1,2 @@ -#define VERSION "1.40a" +#define VERSION "1.42"