Exemplo n.º 1
0
		void Main::OnEmuEvent(const Managers::Emulator::Event event,const Managers::Emulator::Data data)
		{
			switch (event)
			{
				case Managers::Emulator::EVENT_POWER_ON:
				case Managers::Emulator::EVENT_POWER_OFF:

					if (emulator.NetPlayers())
					{
						menu.ToggleModeless( event == Managers::Emulator::EVENT_POWER_ON );
					}
					else if (Fullscreen())
					{
						const bool show = (event == Managers::Emulator::EVENT_POWER_OFF);
						menu.Show( show );
						Application::Instance::ShowChildWindows( show );
					}
					break;

				case Managers::Emulator::EVENT_LOAD:
				{
					Path name;

					if (emulator.IsCart())
					{
						name = Nes::Cartridge(emulator).GetProfile()->game.title.c_str();
					}
					else if (emulator.IsNsf())
					{
						name.Import( Nes::Nsf(emulator).GetName() );
					}

					if (name.Empty())
					{
						name = emulator.GetImagePath().Target().File();
						name.Extension().Clear();
					}

					if (name.Length())
						window.Text() << (name << " - " << MainWindow::name).Ptr();

					break;
				}

				case Managers::Emulator::EVENT_UNLOAD:

					window.Text() << MainWindow::name;
					break;

				case Managers::Emulator::EVENT_NETPLAY_MODE:

					menu[IDM_VIEW_SWITCH_SCREEN].Enable( !data );
					break;
			}
		}
		const Path TapeRecorder::GetFile(Path imagePath) const
		{
			if (dialog->UseImageNaming())
			{
				imagePath.Extension() = L"tp";
				return imagePath;
			}
			else
			{
				return dialog->GetCustomFile();
			}
		}
Exemplo n.º 3
0
		const Path Browser::SaveFile(wchar_t* const filter,Path initial)
		{
			Path path;
			path.Reserve( MAX_PATH*2 );

			const Path extension( initial.Extension() );

			if (initial.File().Length() && initial.File()[0] != '.')
				path = initial.File();

			initial.File().Clear();

			Object::Pod<OPENFILENAME> ofn;

			ofn.lStructSize     = sizeof(ofn);
			ofn.hwndOwner       = Application::Instance::GetActiveWindow();
			ofn.lpstrFile       = path.Ptr();
			ofn.nMaxFile        = path.Capacity();
			ofn.lpstrInitialDir = initial.Length() ? initial.Ptr() : L".";
			ofn.Flags           = OFN_EXPLORER|OFN_PATHMUSTEXIST|OFN_HIDEREADONLY;

			if (filter)
			{
				for (uint i=0; filter[i]; ++i)
				{
					if (filter[i] == '\t')
						filter[i] = '\0';
				}

				ofn.lpstrFilter = filter;
				ofn.nFilterIndex = 1;
			}

			if (extension.Length())
				ofn.lpstrDefExt = extension.Ptr();

			if (::GetSaveFileName( &ofn ))
				path.Validate();
			else
				path.Clear();

			return path;
		}