MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / create

Method create

pcsx2/Recording/InputRecording.cpp:39–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37InputRecording g_InputRecording;
38
39bool InputRecording::create(const std::string& fileName, const bool fromSaveState, const std::string& authorName)
40{
41 if (!m_file.openNew(fileName, fromSaveState))
42 {
43 return false;
44 }
45
46 m_controls.setRecordMode();
47 if (fromSaveState)
48 {
49 std::string savestatePath = fmt::format("{}_SaveState.p2s", fileName);
50 if (FileSystem::FileExists(savestatePath.c_str()))
51 {
52 FileSystem::CopyFilePath(savestatePath.c_str(), fmt::format("{}.bak", savestatePath).c_str(), true);
53 }
54 m_type = Type::FROM_SAVESTATE;
55 m_is_active = true;
56 m_initial_load_complete = true;
57 m_watching_for_rerecords = true;
58 setStartingFrame(g_FrameCount);
59 VMManager::SaveState(savestatePath.c_str(), true, false, [](const std::string& error) {
60 SaveState_ReportSaveErrorOSD(error, std::nullopt);
61 });
62 }
63 else
64 {
65 m_starting_frame = 0;
66 m_type = Type::POWER_ON;
67 m_initial_load_complete = false;
68 m_is_active = true;
69 // TODO - should this be an explicit [full] boot instead of a reset?
70 VMManager::Reset();
71 }
72
73 m_file.setEmulatorVersion();
74 m_file.setAuthor(authorName);
75 m_file.setGameName(VMManager::GetTitle(false));
76 m_file.writeHeader();
77 initializeState();
78 InputRec::log(TRANSLATE_STR("InputRecording", "Started new input recording"), Host::OSD_INFO_DURATION);
79 InputRec::consoleLog(fmt::format("Filename {}", m_file.getFilename()));
80 return true;
81}
82
83bool InputRecording::play(const std::string& filename)
84{

Callers 1

Calls 12

ResetFunction · 0.85
logFunction · 0.85
consoleLogFunction · 0.85
openNewMethod · 0.80
setRecordModeMethod · 0.80
setEmulatorVersionMethod · 0.80
setAuthorMethod · 0.80
setGameNameMethod · 0.80
formatFunction · 0.50
c_strMethod · 0.45
writeHeaderMethod · 0.45

Tested by

no test coverage detected