2 // This file is part of the PicoDrive Megadrive Emulator
\r
4 // Copyright (c) 2011 FinalDave (emudave (at) gmail.com)
\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
9 // SVN repository can be found at http://code.google.com/p/cyclone68000/
\r
13 // Loading roms, loading and saving states etc...
\r
19 memset(&ofn,0,sizeof(ofn));
\r
20 memset(&RomName,0,sizeof(RomName));
\r
22 ofn.lStructSize=sizeof(ofn);
\r
23 ofn.hwndOwner=FrameWnd;
\r
24 ofn.hInstance=GetModuleHandle(NULL);
\r
25 ofn.lpstrFile=RomName;
\r
27 ofn.lpstrDefExt=L"bin";
\r
28 ofn.lpstrFilter=L"Rom Files\0*.bin;*.gen;*.smd\0\0";
\r
30 GetOpenFileName(&ofn);
\r
32 UpdateWindow(FrameWnd);
\r
35 if (RomName[0]) EmulateInit();
\r
40 int FileState(int load)
\r
43 WCHAR name[260]={0};
\r
45 if (load==0) wcscpy(name,L"State.mds");
\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
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
56 if (load) GetOpenFileNameW(&ofn);
\r
57 else GetSaveFileNameW(&ofn);
\r
58 UpdateWindow(FrameWnd);
\r
60 if (name[0]==0) return 1;
\r
62 if (PmovFile) fclose(PmovFile);
\r
64 PmovFile=_wfopen(name,load ? L"rb":L"wb");
\r
65 if (PmovFile==NULL) return 1;
\r
67 PmovAction=load?6:5;
\r
68 PmovState(); // Save the state
\r