2 // This file is part of the PicoDrive Megadrive Emulator
\r
4 // This code is licensed under the GNU General Public License version 2.0 and the MAME License.
\r
5 // You can choose the license that has the most advantages for you.
\r
7 // SVN repository can be found at http://code.google.com/p/cyclone68000/
\r
11 // Loading roms, loading and saving states etc...
\r
17 memset(&ofn,0,sizeof(ofn));
\r
18 memset(&RomName,0,sizeof(RomName));
\r
20 ofn.lStructSize=sizeof(ofn);
\r
21 ofn.hwndOwner=FrameWnd;
\r
22 ofn.hInstance=GetModuleHandle(NULL);
\r
23 ofn.lpstrFile=RomName;
\r
25 ofn.lpstrDefExt=L"bin";
\r
26 ofn.lpstrFilter=L"Rom Files\0*.bin;*.gen;*.smd\0\0";
\r
28 GetOpenFileName(&ofn);
\r
30 UpdateWindow(FrameWnd);
\r
33 if (RomName[0]) EmulateInit();
\r
38 int FileState(int load)
\r
41 WCHAR name[260]={0};
\r
43 if (load==0) wcscpy(name,L"State.mds");
\r
45 memset(&ofn,0,sizeof(ofn));
\r
46 ofn.lStructSize=sizeof(ofn);
\r
47 ofn.hwndOwner=FrameWnd;
\r
48 ofn.hInstance=GetModuleHandle(NULL);
\r
50 ofn.nMaxFile=sizeof(name)>>1;
\r
51 ofn.lpstrDefExt=L"mds";
\r
52 ofn.lpstrFilter=L"MD State Files\0*.mds\0\0";
\r
54 if (load) GetOpenFileNameW(&ofn);
\r
55 else GetSaveFileNameW(&ofn);
\r
56 UpdateWindow(FrameWnd);
\r
58 if (name[0]==0) return 1;
\r
60 if (PmovFile) fclose(PmovFile);
\r
62 PmovFile=_wfopen(name,load ? L"rb":L"wb");
\r
63 if (PmovFile==NULL) return 1;
\r
65 PmovAction=load?6:5;
\r
66 PmovState(); // Save the state
\r