Skip to content

Commit

Permalink
input-rec: Cleanup inputRec namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser authored and lightningterror committed May 10, 2021
1 parent ee0ebe1 commit 90938b1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 35 deletions.
1 change: 1 addition & 0 deletions pcsx2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ set(pcsx2RecordingSources
${rec_src}/InputRecordingFile.cpp
${rec_src}/NewRecordingFrame.cpp
${rec_src}/PadData.cpp
${rec_src}/Utilities/InputRecordingLogger.cpp
${rec_vp_src}/VirtualPad.cpp
${rec_vp_src}/VirtualPadData.cpp
${rec_vp_src}/VirtualPadResources.cpp
Expand Down
50 changes: 50 additions & 0 deletions pcsx2/Recording/Utilities/InputRecordingLogger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2021 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/

#include "PrecompiledHeader.h"

#include "InputRecordingLogger.h"

namespace inputRec
{
void log(const std::string log)
{
if (log.empty())
return;

recordingConLog(fmt::format("[REC]: {}\n", log));

// NOTE - Color is not currently used for OSD logs
if (GSosdLog)
GSosdLog(log.c_str(), wxGetApp().GetProgramLog()->GetRGBA(ConsoleColors::Color_StrongMagenta));
}

void consoleLog(const std::string log)
{
if (log.empty())
return;

recordingConLog(fmt::format("[REC]: {}\n", log));
}

void consoleMultiLog(std::vector<std::string> logs)
{
std::string log;
for (std::string l : logs)
log.append(fmt::format("[REC]: {}\n", l));

recordingConLog(log);
}
} // namespace inputRec
33 changes: 4 additions & 29 deletions pcsx2/Recording/Utilities/InputRecordingLogger.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2020 PCSX2 Dev Team
* Copyright (C) 2002-2021 PCSX2 Dev Team
*
* PCSX2 is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
Expand Down Expand Up @@ -28,32 +28,7 @@

namespace inputRec
{
static void log(const std::string log)
{
if (log.empty())
return;

recordingConLog(fmt::format("[REC]: {}\n", log));

// NOTE - Color is not currently used for OSD logs
if (GSosdLog)
GSosdLog(log.c_str(), wxGetApp().GetProgramLog()->GetRGBA(ConsoleColors::Color_StrongMagenta));
}

static void consoleLog(const std::string log)
{
if (log.empty())
return;

recordingConLog(fmt::format("[REC]: {}\n", log));
}

static void consoleMultiLog(std::vector<std::string> logs)
{
std::string log;
for (std::string l : logs)
log.append(fmt::format("[REC]: {}\n", l));

recordingConLog(log);
}
extern void log(const std::string log);
extern void consoleLog(const std::string log);
extern void consoleMultiLog(std::vector<std::string> logs);
} // namespace inputRec
1 change: 1 addition & 0 deletions pcsx2/windows/VCprojects/pcsx2.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@
<ClCompile Include="..\..\PAD\Windows\WindowsMouse.cpp" />
<ClCompile Include="..\..\PAD\Windows\WndProcEater.cpp" />
<ClCompile Include="..\..\PAD\Windows\XInputEnum.cpp" />
<ClCompile Include="..\..\Recording\Utilities\InputRecordingLogger.cpp" />
<ClCompile Include="..\..\SPU2\DplIIdecoder.cpp" />
<ClCompile Include="..\..\SPU2\debug.cpp" />
<ClCompile Include="..\..\SPU2\RegLog.cpp" />
Expand Down
10 changes: 4 additions & 6 deletions pcsx2/windows/VCprojects/pcsx2.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,9 @@
<ClCompile Include="..\..\CDVD\ChdFileReader.cpp">
<Filter>System\ISO</Filter>
</ClCompile>
<ClCompile Include="..\..\Recording\Utilities\InputRecordingLogger.cpp">
<Filter>Recording\Utilities</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Patch.h">
Expand Down Expand Up @@ -2238,9 +2241,4 @@
<Filter>AppHost\Resources</Filter>
</Manifest>
</ItemGroup>
<ItemGroup>
<Image Include="..\..\gui\Resources\NoIcon.png">
<Filter>AppHost\Resources</Filter>
</Image>
</ItemGroup>
</Project>
</Project>

0 comments on commit 90938b1

Please sign in to comment.