| 1 | \r |
| 2 | #include "stdafx.h"\r |
| 3 | \r |
| 4 | // Loading roms, loading and saving states etc...\r |
| 5 | \r |
| 6 | int FileLoadRom()\r |
| 7 | {\r |
| 8 | OPENFILENAME ofn;\r |
| 9 | \r |
| 10 | memset(&ofn,0,sizeof(ofn));\r |
| 11 | memset(&RomName,0,sizeof(RomName));\r |
| 12 | \r |
| 13 | ofn.lStructSize=sizeof(ofn);\r |
| 14 | ofn.hwndOwner=FrameWnd;\r |
| 15 | ofn.hInstance=GetModuleHandle(NULL);\r |
| 16 | ofn.lpstrFile=RomName;\r |
| 17 | ofn.nMaxFile=260;\r |
| 18 | ofn.lpstrDefExt=L"bin";\r |
| 19 | ofn.lpstrFilter=L"Rom Files\0*.bin;*.gen;*.smd\0\0";\r |
| 20 | \r |
| 21 | GetOpenFileName(&ofn);\r |
| 22 | \r |
| 23 | UpdateWindow(FrameWnd);\r |
| 24 | \r |
| 25 | // Open new rom:\r |
| 26 | if (RomName[0]) EmulateInit();\r |
| 27 | \r |
| 28 | return 0;\r |
| 29 | }\r |
| 30 | \r |
| 31 | int FileState(int load)\r |
| 32 | {\r |
| 33 | OPENFILENAME ofn;\r |
| 34 | WCHAR name[260]={0};\r |
| 35 | \r |
| 36 | if (load==0) wcscpy(name,L"State.mds");\r |
| 37 | \r |
| 38 | memset(&ofn,0,sizeof(ofn));\r |
| 39 | ofn.lStructSize=sizeof(ofn);\r |
| 40 | ofn.hwndOwner=FrameWnd;\r |
| 41 | ofn.hInstance=GetModuleHandle(NULL);\r |
| 42 | ofn.lpstrFile=name;\r |
| 43 | ofn.nMaxFile=sizeof(name)>>1;\r |
| 44 | ofn.lpstrDefExt=L"mds";\r |
| 45 | ofn.lpstrFilter=L"MD State Files\0*.mds\0\0";\r |
| 46 | \r |
| 47 | if (load) GetOpenFileNameW(&ofn);\r |
| 48 | else GetSaveFileNameW(&ofn);\r |
| 49 | UpdateWindow(FrameWnd);\r |
| 50 | \r |
| 51 | if (name[0]==0) return 1;\r |
| 52 | \r |
| 53 | if (PmovFile) fclose(PmovFile);\r |
| 54 | \r |
| 55 | PmovFile=_wfopen(name,load ? L"rb":L"wb");\r |
| 56 | if (PmovFile==NULL) return 1;\r |
| 57 | \r |
| 58 | PmovAction=load?6:5;\r |
| 59 | PmovState(); // Save the state\r |
| 60 | \r |
| 61 | return 0;\r |
| 62 | }\r |