mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
More random changes
This commit is contained in:
parent
a485957130
commit
a16d8ba3ea
211 changed files with 576 additions and 748 deletions
|
|
@ -295,7 +295,7 @@ namespace CRCPP
|
|||
static CRCType Finalize(CRCType remainder, CRCType finalXOR, bool reflectOutput);
|
||||
|
||||
template <typename CRCType, crcpp_uint16 CRCWidth>
|
||||
static CRCType UndoFinalize(CRCType remainder, CRCType finalXOR, bool reflectOutput);
|
||||
static CRCType UndoFinalize(CRCType crc, CRCType finalXOR, bool reflectOutput);
|
||||
|
||||
template <typename CRCType, crcpp_uint16 CRCWidth>
|
||||
static CRCType CalculateRemainder(const void * data, crcpp_size size, const Parameters<CRCType, CRCWidth> & parameters, CRCType remainder);
|
||||
|
|
@ -771,8 +771,6 @@ namespace CRCPP
|
|||
in a function even in a branch will never be executed. This also means we don't need pragmas
|
||||
to get rid of warnings, but it still can be computed at compile-time. Win-win!
|
||||
@param[in] x Compile-time expression to bound
|
||||
@tparam CRCType Integer type for storing the CRC result
|
||||
@tparam CRCWidth Number of bits in the CRC
|
||||
@return Non-negative compile-time expression
|
||||
*/
|
||||
template <typename IntegerType>
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ namespace cfg
|
|||
// Get type
|
||||
type get_type() const { return m_type; }
|
||||
|
||||
const std::string& get_name() const { return m_name; };
|
||||
const std::string& get_name() const { return m_name; }
|
||||
|
||||
// Get dynamic property for reloading configs during games
|
||||
bool get_is_dynamic() const { return m_dynamic; };
|
||||
bool get_is_dynamic() const { return m_dynamic; }
|
||||
|
||||
// Reset defaults
|
||||
virtual void from_default() = 0;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
#include <unordered_map>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <cerrno>
|
||||
#include <map>
|
||||
|
||||
#include "util/asm.hpp"
|
||||
|
|
@ -18,11 +17,6 @@ using namespace std::literals::string_literals;
|
|||
#include <cwchar>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace utils
|
||||
{
|
||||
u64 get_unique_tsc();
|
||||
}
|
||||
|
||||
static std::unique_ptr<wchar_t[]> to_wchar(const std::string& source)
|
||||
{
|
||||
// String size + null terminator
|
||||
|
|
@ -65,7 +59,7 @@ static void to_utf8(std::string& out, const wchar_t* source)
|
|||
// Resize buffer
|
||||
out.resize(buf_size - 1);
|
||||
|
||||
const int result = WideCharToMultiByte(CP_UTF8, 0, source, static_cast<int>(length) + 1, &out.front(), buf_size, NULL, NULL);
|
||||
const int result = WideCharToMultiByte(CP_UTF8, 0, source, static_cast<int>(length) + 1, &out.front(), buf_size, nullptr, nullptr);
|
||||
|
||||
// Fix the size
|
||||
out.resize(ensure(result) - 1);
|
||||
|
|
@ -593,7 +587,7 @@ bool fs::create_dir(const std::string& path)
|
|||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
if (!CreateDirectoryW(to_wchar(path).get(), NULL))
|
||||
if (!CreateDirectoryW(to_wchar(path).get(), nullptr))
|
||||
{
|
||||
int res = GetLastError();
|
||||
|
||||
|
|
@ -713,7 +707,7 @@ bool fs::rename(const std::string& from, const std::string& to, bool overwrite)
|
|||
}
|
||||
|
||||
error1 = GetLastError();
|
||||
CreateDirectoryW(ws2.get(), NULL); // TODO
|
||||
CreateDirectoryW(ws2.get(), nullptr); // TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -882,7 +876,7 @@ bool fs::truncate_file(const std::string& path, u64 length)
|
|||
|
||||
#ifdef _WIN32
|
||||
// Open the file
|
||||
const auto handle = CreateFileW(to_wchar(path).get(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
const auto handle = CreateFileW(to_wchar(path).get(), GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
g_tls_error = to_error(GetLastError());
|
||||
|
|
@ -921,7 +915,7 @@ bool fs::utime(const std::string& path, s64 atime, s64 mtime)
|
|||
|
||||
#ifdef _WIN32
|
||||
// Open the file
|
||||
const auto handle = CreateFileW(to_wchar(path).get(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
const auto handle = CreateFileW(to_wchar(path).get(), FILE_WRITE_ATTRIBUTES, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
g_tls_error = to_error(GetLastError());
|
||||
|
|
@ -1033,7 +1027,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||
share |= FILE_SHARE_WRITE;
|
||||
}
|
||||
|
||||
const HANDLE handle = CreateFileW(to_wchar(path).get(), access, share, NULL, disp, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
const HANDLE handle = CreateFileW(to_wchar(path).get(), access, share, nullptr, disp, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
@ -1100,7 +1094,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||
const int size = narrow<int>(count);
|
||||
|
||||
DWORD nread;
|
||||
ensure(ReadFile(m_handle, buffer, size, &nread, NULL)); // "file::read"
|
||||
ensure(ReadFile(m_handle, buffer, size, &nread, nullptr)); // "file::read"
|
||||
|
||||
return nread;
|
||||
}
|
||||
|
|
@ -1111,7 +1105,7 @@ fs::file::file(const std::string& path, bs_t<open_mode> mode)
|
|||
const int size = narrow<int>(count);
|
||||
|
||||
DWORD nwritten;
|
||||
ensure(WriteFile(m_handle, buffer, size, &nwritten, NULL)); // "file::write"
|
||||
ensure(WriteFile(m_handle, buffer, size, &nwritten, nullptr)); // "file::write"
|
||||
|
||||
return nwritten;
|
||||
}
|
||||
|
|
@ -1439,7 +1433,7 @@ bool fs::dir::open(const std::string& path)
|
|||
|
||||
#ifdef _WIN32
|
||||
WIN32_FIND_DATAW found;
|
||||
const auto handle = FindFirstFileExW(to_wchar(path + "/*").get(), FindExInfoBasic, &found, FindExSearchNameMatch, NULL, FIND_FIRST_EX_CASE_SENSITIVE | FIND_FIRST_EX_LARGE_FETCH);
|
||||
const auto handle = FindFirstFileExW(to_wchar(path + "/*").get(), FindExInfoBasic, &found, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_CASE_SENSITIVE | FIND_FIRST_EX_LARGE_FETCH);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
|
|
@ -1594,9 +1588,9 @@ const std::string& fs::get_config_dir()
|
|||
wchar_t buf[32768];
|
||||
constexpr DWORD size = static_cast<DWORD>(std::size(buf));
|
||||
if (GetEnvironmentVariable(L"RPCS3_CONFIG_DIR", buf, size) - 1 >= size - 1 &&
|
||||
GetModuleFileName(NULL, buf, size) - 1 >= size - 1)
|
||||
GetModuleFileName(nullptr, buf, size) - 1 >= size - 1)
|
||||
{
|
||||
MessageBoxA(0, fmt::format("GetModuleFileName() failed: error %u.", GetLastError()).c_str(), "fs::get_config_dir()", MB_ICONERROR);
|
||||
MessageBoxA(nullptr, fmt::format("GetModuleFileName() failed: error %u.", GetLastError()).c_str(), "fs::get_config_dir()", MB_ICONERROR);
|
||||
return dir; // empty
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
#include "util/vm.hpp"
|
||||
#include "util/asm.hpp"
|
||||
#include <charconv>
|
||||
#include <immintrin.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef __linux__
|
||||
|
|
@ -272,10 +271,7 @@ asmjit::Runtime& asmjit::get_global_runtime()
|
|||
#ifdef LLVM_AVAILABLE
|
||||
|
||||
#include <unordered_map>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <set>
|
||||
#include <array>
|
||||
#include <deque>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
|
|||
|
|
@ -176,7 +176,6 @@ inline FT build_function_asm(F&& builder)
|
|||
#include <unordered_map>
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "mutex.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
|
|
|
|||
|
|
@ -29,24 +29,22 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include <cstdlib>
|
||||
|
||||
// check if the scheme name is valid
|
||||
static bool IsSchemeValid( const std::string& SchemeName )
|
||||
{
|
||||
for ( auto c : SchemeName )
|
||||
return std::all_of(SchemeName.cbegin(), SchemeName.cend(), [](const auto& c)
|
||||
{
|
||||
if ( !isalpha( c ) && c != '+' && c != '-' && c != '.' ) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return isalpha(c) || c == '+' || c == '-' || c == '.';
|
||||
});
|
||||
}
|
||||
|
||||
bool LUrlParser::clParseURL::GetPort( int* OutPort ) const
|
||||
{
|
||||
if ( !IsValid() ) { return false; }
|
||||
|
||||
int Port = atoi( m_Port.c_str() );
|
||||
const int Port = atoi( m_Port.c_str() );
|
||||
|
||||
if ( Port <= 0 || Port > 65535 ) { return false; }
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/SPUThread.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
#include "Emu/Cell/lv2/sys_mmapper.h"
|
||||
#include "Emu/Cell/lv2/sys_event.h"
|
||||
#include "Emu/RSX/RSXThread.h"
|
||||
|
|
@ -2760,6 +2759,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
// Verified by more than one windows user on 16-thread CPU
|
||||
ppu_mask = spu_mask = rsx_mask = (0b10101010101010101010101010101010 & all_cores_mask);
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
// 5600X
|
||||
if (g_cfg.core.thread_scheduler == thread_scheduler_mode::alt)
|
||||
|
|
@ -2772,6 +2772,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
{
|
||||
ppu_mask = spu_mask = rsx_mask = all_cores_mask;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (thread_count > 24)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@
|
|||
#include "util/shared_ptr.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include "mutex.h"
|
||||
#include "lockless.h"
|
||||
|
|
|
|||
|
|
@ -30,31 +30,31 @@ public:
|
|||
|
||||
double GetElapsedTimeInSec() const
|
||||
{
|
||||
return double(GetElapsedTimeInMicroSec()) / 1000000.0;
|
||||
return static_cast<double>(GetElapsedTimeInMicroSec()) / 1000000.0;
|
||||
}
|
||||
|
||||
double GetElapsedTimeInMilliSec() const
|
||||
{
|
||||
return double(GetElapsedTimeInMicroSec()) / 1000.0;
|
||||
return static_cast<double>(GetElapsedTimeInMicroSec()) / 1000.0;
|
||||
}
|
||||
|
||||
u64 GetElapsedTimeInMicroSec() const
|
||||
{
|
||||
steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
const steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::microseconds>(now - m_start).count();
|
||||
}
|
||||
|
||||
u64 GetElapsedTimeInNanoSec() const
|
||||
{
|
||||
steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
const steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::nanoseconds>(now - m_start).count();
|
||||
}
|
||||
|
||||
u64 GetMsSince(steady_clock::time_point timestamp)
|
||||
u64 GetMsSince(steady_clock::time_point timestamp) const
|
||||
{
|
||||
steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
const steady_clock::time_point now = m_stopped ? m_end : steady_clock::now();
|
||||
|
||||
return std::chrono::duration_cast<std::chrono::milliseconds>(now - timestamp).count();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "util/types.hpp"
|
||||
#include "StrFmt.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace utils
|
||||
|
|
@ -271,10 +272,10 @@ namespace utils
|
|||
class address_range_vector
|
||||
{
|
||||
public:
|
||||
using vector_type = typename std::vector<address_range>;
|
||||
using iterator = typename vector_type::iterator;
|
||||
using const_iterator = typename vector_type::const_iterator;
|
||||
using size_type = typename vector_type::size_type;
|
||||
using vector_type = std::vector<address_range>;
|
||||
using iterator = vector_type::iterator;
|
||||
using const_iterator = vector_type::const_iterator;
|
||||
using size_type = vector_type::size_type;
|
||||
|
||||
private:
|
||||
vector_type data;
|
||||
|
|
@ -455,7 +456,7 @@ namespace utils
|
|||
// Will fail if ranges within the vector overlap our touch each-other
|
||||
bool check_consistency() const
|
||||
{
|
||||
usz _size = data.size();
|
||||
const usz _size = data.size();
|
||||
|
||||
for (usz i = 0; i < _size; ++i)
|
||||
{
|
||||
|
|
@ -485,20 +486,10 @@ namespace utils
|
|||
// Test for overlap with a given range
|
||||
bool overlaps(const address_range &range) const
|
||||
{
|
||||
for (const address_range ¤t : data)
|
||||
return std::any_of(data.cbegin(), data.cend(), [&range](const address_range& cur)
|
||||
{
|
||||
if (!current.valid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current.overlaps(range))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return cur.valid() && cur.overlaps(range);
|
||||
});
|
||||
}
|
||||
|
||||
// Test for overlap with a given address_range vector
|
||||
|
|
@ -530,37 +521,19 @@ namespace utils
|
|||
// Test if a given range is fully contained inside this vector
|
||||
bool contains(const address_range &range) const
|
||||
{
|
||||
for (const address_range &cur : *this)
|
||||
return std::any_of(this->begin(), this->end(), [&range](const address_range& cur)
|
||||
{
|
||||
if (!cur.valid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (range.inside(cur))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return cur.valid() && cur.inside(range);
|
||||
});
|
||||
}
|
||||
|
||||
// Test if all ranges in this vector are full contained inside a specific range
|
||||
bool inside(const address_range &range) const
|
||||
{
|
||||
for (const address_range &cur : *this)
|
||||
return std::all_of(this->begin(), this->end(), [&range](const address_range& cur)
|
||||
{
|
||||
if (!cur.valid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!cur.inside(range))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return !cur.valid() || cur.inside(range);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -650,8 +650,8 @@ std::basic_string<u32> patch_engine::apply(const std::string& name, u8* dst, u32
|
|||
|
||||
std::basic_string<u32> applied_total;
|
||||
const auto& container = m_map.at(name);
|
||||
const auto serial = Emu.GetTitleID();
|
||||
const auto app_version = Emu.GetAppVersion();
|
||||
const auto& serial = Emu.GetTitleID();
|
||||
const auto& app_version = Emu.GetAppVersion();
|
||||
|
||||
// Different containers in order to seperate the patches
|
||||
std::vector<patch_engine::patch_info> patches_for_this_serial_and_this_version;
|
||||
|
|
@ -793,7 +793,7 @@ void patch_engine::save_config(const patch_map& patches_map)
|
|||
}
|
||||
}
|
||||
|
||||
if (const auto& enabled_patches = config_map[hash].patch_info_map; enabled_patches.size() > 0)
|
||||
if (const auto& enabled_patches = config_map[hash].patch_info_map; !enabled_patches.empty())
|
||||
{
|
||||
out << hash << YAML::BeginMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ usz cfmt_append(Dst& out, const Char* fmt, Src&& src)
|
|||
const u64 arg1 = ctx.args >= 1 ? src.template get<u64>(1) : 0;
|
||||
const u64 arg2 = ctx.args >= 2 ? src.template get<u64>(2) : 0;
|
||||
|
||||
if (const usz _size = std::snprintf(0, 0, _fmt.c_str(), arg0, arg1, arg2))
|
||||
if (const usz _size = std::snprintf(nullptr, 0, _fmt.c_str(), arg0, arg1, arg2))
|
||||
{
|
||||
out.resize(out.size() + _size);
|
||||
std::snprintf(&out.front() + out.size() - _size, _size + 1, _fmt.c_str(), arg0, arg1, arg2);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
#include "cond.h"
|
||||
#include "sync.h"
|
||||
#include "lockless.h"
|
||||
|
||||
#include <climits>
|
||||
|
||||
// use constants, increase signal space
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ namespace date_time
|
|||
static inline std::string current_time()
|
||||
{
|
||||
char str[80];
|
||||
tm now = get_time(0);
|
||||
tm now = get_time(nullptr);
|
||||
strftime(str, sizeof(str), "%c", &now);
|
||||
return str;
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ namespace date_time
|
|||
static inline std::string current_time_narrow()
|
||||
{
|
||||
char str[80];
|
||||
tm now = get_time(0);
|
||||
tm now = get_time(nullptr);
|
||||
|
||||
std::string parse_buf;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/rXml.h"
|
||||
|
||||
rXmlNode::rXmlNode() : handle()
|
||||
rXmlNode::rXmlNode()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ std::string rXmlNode::GetNodeContent()
|
|||
return handle.text().get();
|
||||
}
|
||||
|
||||
rXmlDocument::rXmlDocument() : handle()
|
||||
rXmlDocument::rXmlDocument()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#pragma once
|
||||
|
||||
#include <mutex>
|
||||
#include "util/types.hpp"
|
||||
#include "util/atomic.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
/* For internal use. Don't include. */
|
||||
|
||||
#include "util/types.hpp"
|
||||
#include "util/atomic.hpp"
|
||||
#include "util/dyn_lib.hpp"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
@ -11,7 +10,7 @@
|
|||
#define NOMINMAX
|
||||
#endif
|
||||
#include <Windows.h>
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
#elif __linux__
|
||||
#include <errno.h>
|
||||
#include <sys/syscall.h>
|
||||
|
|
@ -21,7 +20,6 @@
|
|||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue