Common: Rename General to HostSys

Actually fits what it's doing.
This commit is contained in:
Stenzek
2023-12-27 13:55:35 +10:00
committed by Connor McLaughlin
parent 911d7f6533
commit 59d29b3648
35 changed files with 63 additions and 88 deletions
+2 -2
View File
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#include "Threading.h"
#include "General.h"
#include "Assertions.h"
#include "CrashHandler.h"
#include "HostSys.h"
#include "Threading.h"
#include <mutex>
#include "fmt/core.h"
+14
View File
@@ -6,6 +6,7 @@
#include "common/Pcsx2Defs.h"
#include <bit>
#include <cstring>
#ifdef _MSC_VER
@@ -84,3 +85,16 @@ namespace Common
return std::countl_zero(static_cast<u32>(n));
}
} // namespace Common
template <typename T>
[[maybe_unused]] __fi static T GetBufferT(u8* buffer, u32 offset)
{
T value;
std::memcpy(&value, buffer + offset, sizeof(value));
return value;
}
[[maybe_unused]] __fi static u8 GetBufferU8(u8* buffer, u32 offset) { return GetBufferT<u8>(buffer, offset); }
[[maybe_unused]] __fi static u16 GetBufferU16(u8* buffer, u32 offset) { return GetBufferT<u16>(buffer, offset); }
[[maybe_unused]] __fi static u32 GetBufferU32(u8* buffer, u32 offset) { return GetBufferT<u32>(buffer, offset); }
[[maybe_unused]] __fi static u64 GetBufferU64(u8* buffer, u32 offset) { return GetBufferT<u64>(buffer, offset); }
+2 -3
View File
@@ -17,11 +17,10 @@ target_sources(common PRIVATE
Error.cpp
FastJmp.cpp
FileSystem.cpp
General.cpp
HostSys.cpp
Image.cpp
HTTPDownloader.cpp
MemorySettingsInterface.cpp
Misc.cpp
MD5Digest.cpp
PrecompiledHeader.cpp
Perf.cpp
@@ -72,8 +71,8 @@ target_sources(common PRIVATE
FPControl.h
FastJmp.h
FileSystem.h
General.h
HashCombine.h
HostSys.h
HeterogeneousContainers.h
Image.h
LRUCache.h
+1 -1
View File
@@ -7,7 +7,7 @@
#include "CocoaTools.h"
#include "Console.h"
#include "General.h"
#include "HostSys.h"
#include "WindowInfo.h"
#include <dlfcn.h>
#include <mutex>
+1 -1
View File
@@ -16,7 +16,7 @@
#include "common/Pcsx2Types.h"
#include "common/Console.h"
#include "common/General.h"
#include "common/HostSys.h"
#include "common/Threading.h"
#include "common/WindowInfo.h"
-26
View File
@@ -1,26 +0,0 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#include "General.h"
// --------------------------------------------------------------------------------------
// PageProtectionMode (implementations)
// --------------------------------------------------------------------------------------
std::string PageProtectionMode::ToString() const
{
std::string modeStr;
if (m_read)
modeStr += "Read";
if (m_write)
modeStr += "Write";
if (m_exec)
modeStr += "Exec";
if (modeStr.empty())
return "NoAccess";
if (modeStr.length() <= 5)
modeStr += "Only";
return modeStr;
}
+1 -1
View File
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
#include "General.h"
#include "HostSys.h"
#include "Console.h"
#include "VectorIntrin.h"
+12 -31
View File
@@ -9,20 +9,6 @@
#include <map>
#include <memory>
#include <string>
#include <cstring>
template <typename T>
[[maybe_unused]] __fi static T GetBufferT(u8* buffer, u32 offset)
{
T value;
std::memcpy(&value, buffer + offset, sizeof(value));
return value;
}
[[maybe_unused]] __fi static u8 GetBufferU8(u8* buffer, u32 offset) { return GetBufferT<u8>(buffer, offset); }
[[maybe_unused]] __fi static u16 GetBufferU16(u8* buffer, u32 offset) { return GetBufferT<u16>(buffer, offset); }
[[maybe_unused]] __fi static u32 GetBufferU32(u8* buffer, u32 offset) { return GetBufferT<u32>(buffer, offset); }
[[maybe_unused]] __fi static u64 GetBufferU64(u8* buffer, u32 offset) { return GetBufferT<u64>(buffer, offset); }
// --------------------------------------------------------------------------------------
// PageProtectionMode
@@ -30,46 +16,41 @@ template <typename T>
class PageProtectionMode
{
protected:
bool m_read;
bool m_write;
bool m_exec;
bool m_read = false;
bool m_write = false;
bool m_exec = false;
public:
PageProtectionMode()
{
All(false);
}
__fi constexpr PageProtectionMode() = default;
PageProtectionMode& Read(bool allow = true)
__fi constexpr PageProtectionMode& Read(bool allow = true)
{
m_read = allow;
return *this;
}
PageProtectionMode& Write(bool allow = true)
__fi constexpr PageProtectionMode& Write(bool allow = true)
{
m_write = allow;
return *this;
}
PageProtectionMode& Execute(bool allow = true)
__fi constexpr PageProtectionMode& Execute(bool allow = true)
{
m_exec = allow;
return *this;
}
PageProtectionMode& All(bool allow = true)
__fi constexpr PageProtectionMode& All(bool allow = true)
{
m_read = m_write = m_exec = allow;
return *this;
}
bool CanRead() const { return m_read; }
bool CanWrite() const { return m_write; }
bool CanExecute() const { return m_exec && m_read; }
bool IsNone() const { return !m_read && !m_write; }
std::string ToString() const;
__fi constexpr bool CanRead() const { return m_read; }
__fi constexpr bool CanWrite() const { return m_write; }
__fi constexpr bool CanExecute() const { return m_exec && m_read; }
__fi constexpr bool IsNone() const { return !m_read && !m_write; }
};
static __fi PageProtectionMode PageAccess_None()
+1 -1
View File
@@ -20,7 +20,7 @@
#include "common/BitUtils.h"
#include "common/Assertions.h"
#include "common/Console.h"
#include "common/General.h"
#include "common/HostSys.h"
// Apple uses the MAP_ANON define instead of MAP_ANONYMOUS, but they mean
// the same thing.
+1 -1
View File
@@ -4,7 +4,7 @@
#if !defined(_WIN32) && !defined(__APPLE__)
#include "common/Pcsx2Types.h"
#include "common/General.h"
#include "common/HostSys.h"
#include "common/ScopedGuard.h"
#include "common/StringUtil.h"
#include "common/Threading.h"
+1
View File
@@ -3,6 +3,7 @@
#include "common/Threading.h"
#include "common/Assertions.h"
#include "common/HostSys.h"
#ifdef _WIN32
#include "common/RedtapeWindows.h"
-1
View File
@@ -4,7 +4,6 @@
#pragma once
#include "common/Pcsx2Defs.h"
#include "common/General.h"
#if defined(__APPLE__)
#include <mach/semaphore.h>
+1 -1
View File
@@ -6,7 +6,7 @@
#include "common/BitUtils.h"
#include "common/RedtapeWindows.h"
#include "common/Console.h"
#include "common/General.h"
#include "common/HostSys.h"
#include "common/StringUtil.h"
#include "common/AlignedMalloc.h"
#include "common/Assertions.h"
+1 -2
View File
@@ -3,11 +3,10 @@
#if defined(_WIN32)
#include "common/Pcsx2Defs.h"
#include "common/HostSys.h"
#include "common/RedtapeWindows.h"
#include "common/StringUtil.h"
#include "common/Threading.h"
#include "common/General.h"
#include "common/WindowInfo.h"
#include "fmt/core.h"
+2 -3
View File
@@ -55,7 +55,6 @@
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="FileSystem.cpp" />
<ClCompile Include="General.cpp" />
<ClCompile Include="Image.cpp" />
<ClCompile Include="HTTPDownloader.cpp" />
<ClCompile Include="HTTPDownloaderCurl.cpp">
@@ -84,7 +83,7 @@
<ClCompile Include="Windows\WinHostSys.cpp" />
<ClCompile Include="Windows\WinMisc.cpp" />
<ClCompile Include="Windows\WinThreads.cpp" />
<ClCompile Include="Misc.cpp" />
<ClCompile Include="HostSys.cpp" />
<ClCompile Include="Semaphore.cpp" />
<ClCompile Include="emitter\avx.cpp" />
<ClCompile Include="emitter\bmi.cpp" />
@@ -135,7 +134,7 @@
<ClInclude Include="SettingsWrapper.h" />
<ClInclude Include="Assertions.h" />
<ClInclude Include="Console.h" />
<ClInclude Include="General.h" />
<ClInclude Include="HostSys.h" />
<ClInclude Include="Path.h" />
<ClInclude Include="PrecompiledHeader.h" />
<ClInclude Include="ReadbackSpinManager.h" />
+2 -5
View File
@@ -40,7 +40,7 @@
<ClCompile Include="emitter\movs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Misc.cpp">
<ClCompile Include="HostSys.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Perf.cpp">
@@ -124,9 +124,6 @@
<ClCompile Include="FileSystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="General.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Error.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -159,7 +156,7 @@
<ClInclude Include="emitter\implement\dwshift.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="General.h">
<ClInclude Include="HostSys.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="emitter\implement\group1.h">
-1
View File
@@ -22,7 +22,6 @@
#include "common/Console.h"
#include "common/Error.h"
#include "common/FileSystem.h"
#include "common/General.h"
#include "common/HTTPDownloader.h"
#include "common/MD5Digest.h"
#include "common/Path.h"
+1
View File
@@ -17,6 +17,7 @@
#include "IopDma.h"
#include "VMManager.h"
#include "common/BitUtils.h"
#include "common/Error.h"
#include "common/FileSystem.h"
#include "common/Path.h"
+1 -1
View File
@@ -3,7 +3,7 @@
#pragma once
#include "common/General.h"
#include "common/Pcsx2Defs.h"
#include "common/FPControl.h"
#include <array>
#include <string>
-1
View File
@@ -6,7 +6,6 @@
#include "GS.h"
#include "common/boost_spsc_queue.hpp"
#include "common/Assertions.h"
#include "common/General.h"
#include "common/Threading.h"
#include <condition_variable>
#include <functional>

Some files were not shown because too many files have changed in this diff Show More