Beispiel #1
0
void createNewProject()
{
	if (!askToSaveProject()) return;

	static struct NewProjectParameters params;
	if (DialogBoxParam(fceu_hInstance, MAKEINTRESOURCE(IDD_TASEDITOR_NEWPROJECT), taseditorWindow.hwndTASEditor, newProjectProc, (LPARAM)&params) > 0)
	{
		FCEUMOV_CreateCleanMovie();
		// apply selected options
		setInputType(currMovieData, params.inputType);
		applyMovieInputConfig();
		if (params.copyCurrentInput)
			// copy Input from current snapshot (from history)
			history.getCurrentSnapshot().inputlog.toMovie(currMovieData);
		if (!params.copyCurrentMarkers)
			markersManager.reset();
		if (params.authorName != L"") currMovieData.comments.push_back(L"author " + params.authorName);
		
		// reset Taseditor
		project.init();			// new project has blank name
		greenzone.reset();
		if (params.copyCurrentInput)
			// copy LagLog from current snapshot (from history)
			greenzone.lagLog = history.getCurrentSnapshot().laglog;
		playback.reset();
		playback.restartPlaybackFromZeroGround();
		bookmarks.reset();
		branches.reset();
		history.reset();
		pianoRoll.reset();
		selection.reset();
		editor.reset();
		splicer.reset();
		recorder.reset();
		popupDisplay.reset();
		taseditorWindow.redraw();
		taseditorWindow.updateCaption();
	}
}
Beispiel #2
0
// returns true if Taseditor is engaged at the end of the function
bool enterTASEditor()
{
	if (taseditorWindow.hwndTASEditor)
	{
		// TAS Editor is already engaged, just set focus to its window
		if (!taseditorConfig.windowIsMaximized)
			ShowWindow(taseditorWindow.hwndTASEditor, SW_SHOWNORMAL);
		SetForegroundWindow(taseditorWindow.hwndTASEditor);
		return true;
	} else if (FCEU_IsValidUI(FCEUI_TASEDITOR))
	{
		// start TAS Editor
		// create window
		taseditorWindow.init();
		if (taseditorWindow.hwndTASEditor)
		{
			enableGeneralKeyboardInput();
			// save "eoptions"
			saved_eoptions = eoptions;
			// set "Run in background"
			eoptions |= EO_BGRUN;
			// "Set high-priority thread"
			eoptions |= EO_HIGHPRIO;
			DoPriority();
			// switch off autosaves
			saved_EnableAutosave = EnableAutosave;
			EnableAutosave = 0;
			// switch on frame_display
			saved_frame_display = frame_display;
			frame_display = 1;
			UpdateCheckedMenuItems();
			
			// init modules
			editor.init();
			pianoRoll.init();
			selection.init();
			splicer.init();
			playback.init();
			greenzone.init();
			recorder.init();
			markersManager.init();
			project.init();
			bookmarks.init();
			branches.init();
			popupDisplay.init();
			history.init();
			taseditor_lua.init();
			// either start new movie or use current movie
			if (!FCEUMOV_Mode(MOVIEMODE_RECORD|MOVIEMODE_PLAY) || currMovieData.savestate.size() != 0)
			{
				if (currMovieData.savestate.size() != 0)
					FCEUD_PrintError("This version of TAS Editor doesn't work with movies starting from savestate.");
				// create new movie
				FCEUI_StopMovie();
				movieMode = MOVIEMODE_TASEDITOR;
				FCEUMOV_CreateCleanMovie();
				playback.restartPlaybackFromZeroGround();
			} else
			{
				// use current movie to create a new project
				FCEUI_StopMovie();
				movieMode = MOVIEMODE_TASEDITOR;
			}
			// if movie length is less or equal to currFrame, pad it with empty frames
			if (((int)currMovieData.records.size() - 1) < currFrameCounter)
				currMovieData.insertEmpty(-1, currFrameCounter - ((int)currMovieData.records.size() - 1));
			// ensure that movie has correct set of ports/fourscore
			setInputType(currMovieData, getInputType(currMovieData));
			// force the input configuration stored in the movie to apply to FCEUX config
			applyMovieInputConfig();
			// reset some modules that need MovieData info
			pianoRoll.reset();
			recorder.reset();
			// create initial snapshot in history
			history.reset();
			// reset Taseditor variables
			mustCallManualLuaFunction = false;
			
			SetFocus(history.hwndHistoryList);		// set focus only once, to show blue selection cursor
			SetFocus(pianoRoll.hwndList);
			FCEU_DispMessage("TAS Editor engaged", 0);
			taseditorWindow.redraw();
			return true;
		} else
		{
			// couldn't init window
			return false;
		}
	} else
	{
		// right now TAS Editor launch is not allowed by emulator
		return true;
	}
}