| 1 | \r |
| 2 | // This file is part of the PicoDrive Megadrive Emulator\r |
| 3 | \r |
| 4 | // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)\r |
| 5 | \r |
| 6 | // This code is licensed under the GNU General Public License version 2.0 and the MAME License.\r |
| 7 | // You can choose the license that has the most advantages for you.\r |
| 8 | \r |
| 9 | // SVN repository can be found at http://code.google.com/p/cyclone68000/\r |
| 10 | \r |
| 11 | #include "stdafx.h"\r |
| 12 | \r |
| 13 | // Loading roms, loading and saving states etc...\r |
| 14 | \r |
| 15 | int FileLoadRom()\r |
| 16 | {\r |
| 17 | OPENFILENAME ofn;\r |
| 18 | \r |
| 19 | memset(&ofn,0,sizeof(ofn));\r |
| 20 | memset(&RomName,0,sizeof(RomName));\r |
| 21 | \r |
| 22 | ofn.lStructSize=sizeof(ofn);\r |
| 23 | ofn.hwndOwner=FrameWnd;\r |
| 24 | ofn.hInstance=GetModuleHandle(NULL);\r |
| 25 | ofn.lpstrFile=RomName;\r |
| 26 | ofn.nMaxFile=260;\r |
| 27 | ofn.lpstrDefExt=L"bin";\r |
| 28 | ofn.lpstrFilter=L"Rom Files\0*.bin;*.gen;*.smd\0\0";\r |
| 29 | \r |
| 30 | GetOpenFileName(&ofn);\r |
| 31 | \r |
| 32 | UpdateWindow(FrameWnd);\r |
| 33 | \r |
| 34 | // Open new rom:\r |
| 35 | if (RomName[0]) EmulateInit();\r |
| 36 | \r |
| 37 | return 0;\r |
| 38 | }\r |
| 39 | \r |
| 40 | int FileState(int load)\r |
| 41 | {\r |
| 42 | OPENFILENAME ofn;\r |
| 43 | WCHAR name[260]={0};\r |
| 44 | \r |
| 45 | if (load==0) wcscpy(name,L"State.mds");\r |
| 46 | \r |
| 47 | memset(&ofn,0,sizeof(ofn));\r |
| 48 | ofn.lStructSize=sizeof(ofn);\r |
| 49 | ofn.hwndOwner=FrameWnd;\r |
| 50 | ofn.hInstance=GetModuleHandle(NULL);\r |
| 51 | ofn.lpstrFile=name;\r |
| 52 | ofn.nMaxFile=sizeof(name)>>1;\r |
| 53 | ofn.lpstrDefExt=L"mds";\r |
| 54 | ofn.lpstrFilter=L"MD State Files\0*.mds\0\0";\r |
| 55 | \r |
| 56 | if (load) GetOpenFileNameW(&ofn);\r |
| 57 | else GetSaveFileNameW(&ofn);\r |
| 58 | UpdateWindow(FrameWnd);\r |
| 59 | \r |
| 60 | if (name[0]==0) return 1;\r |
| 61 | \r |
| 62 | if (PmovFile) fclose(PmovFile);\r |
| 63 | \r |
| 64 | PmovFile=_wfopen(name,load ? L"rb":L"wb");\r |
| 65 | if (PmovFile==NULL) return 1;\r |
| 66 | \r |
| 67 | PmovAction=load?6:5;\r |
| 68 | PmovState(); // Save the state\r |
| 69 | \r |
| 70 | return 0;\r |
| 71 | }\r |