X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=platform%2Fwin32%2FGenaDrive%2FMain.cpp;h=a8e3362eb97913b54a5eaa1b75b2f9d7ba73049a;hb=4b2b67ebc7fc6205c6589243b9c9a0a172a97ebb;hp=edab4305343ae632697de8f0e7787d1dae4a2383;hpb=10d84cb2757db05bf7d66ef33575c52ed4b22053;p=picodrive.git diff --git a/platform/win32/GenaDrive/Main.cpp b/platform/win32/GenaDrive/Main.cpp index edab430..a8e3362 100644 --- a/platform/win32/GenaDrive/Main.cpp +++ b/platform/win32/GenaDrive/Main.cpp @@ -113,13 +113,16 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int) DWORD tid=0; HANDLE thread=NULL; + FrameInit(); + ret=LoopInit(); if (ret) { LoopExit(); return 1; } + // notaz: load rom static char rompath[MAX_PATH]; rompath[0] = 0; strcpy(rompath, cmdline + (cmdline[0] == '\"' ? 1 : 0)); if(rompath[strlen(rompath)-1] == '\"') rompath[strlen(rompath)-1] = 0; - FILE *rom = 0; - if(strlen(rompath) > 4) rom = fopen(rompath, "rb"); + pm_file *rom = 0; + if(strlen(rompath) > 4) rom = pm_open(rompath); if(!rom) { OPENFILENAME of; ZeroMemory(&of, sizeof(OPENFILENAME)); of.lStructSize = sizeof(OPENFILENAME); @@ -128,7 +131,7 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int) of.nMaxFile = MAX_PATH; of.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; if(!GetOpenFileName(&of)) return 1; - rom = fopen(rompath, "rb"); + rom = pm_open(rompath); if(!rom) return 1; } romname = rompath; @@ -137,17 +140,13 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int) //RDebug::Print(_L("PicoCartLoad() failed.")); //goto cleanup; } - - FrameInit(); - ret=LoopInit(); if (ret) { LoopExit(); return 1; } + pm_close(rom); PicoCartInsert(rom_data, rom_size); // only now we got the mode (pal/ntsc), so init sound now DSoundInit(); - preLoopInit(); - // Make another thread to run LoopCode(): LoopQuit=0; thread=CreateThread(NULL,0,ThreadCode,NULL,0,&tid); @@ -174,5 +173,10 @@ int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR cmdline,int) _CrtDumpMemoryLeaks(); return 0; } + +extern void error(char *text) +{ + MessageBox(FrameWnd, text, "Error", 0); +} #endif