More random changes

This commit is contained in:
Megamouse 2021-04-09 21:12:47 +02:00 committed by Nekotekina
parent a485957130
commit a16d8ba3ea
211 changed files with 576 additions and 748 deletions

View file

@ -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>

View file

@ -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;

View file

@ -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
}

View file

@ -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

View file

@ -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)

View file

@ -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; }

View file

@ -1,6 +1,5 @@
#pragma once
#include <cstdlib>
#include <cstring>
#include <string>
#include <vector>

View file

@ -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)
{

View file

@ -5,8 +5,6 @@
#include "util/shared_ptr.hpp"
#include <string>
#include <memory>
#include <string_view>
#include "mutex.h"
#include "lockless.h"

View file

@ -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();
}

View file

@ -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 &current : 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);
});
}
};

View file

@ -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;

View file

@ -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);

View file

@ -1,8 +1,5 @@
#include "cond.h"
#include "sync.h"
#include "lockless.h"
#include <climits>
// use constants, increase signal space

View file

@ -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;

View file

@ -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()
{
}

View file

@ -1,6 +1,5 @@
#pragma once
#include <mutex>
#include "util/types.hpp"
#include "util/atomic.hpp"

View file

@ -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>

View file

@ -120,7 +120,7 @@ static void bn_mon_muladd_dig(u8* d, u8* a, u8 b, u8* N, u32 n)
u32 dig;
u32 i;
u8 z = -(d[n - 1] + a[n - 1] * b) * inv256[N[n - 1] / 2];
const u8 z = -(d[n - 1] + a[n - 1] * b) * inv256[N[n - 1] / 2];
dig = d[n - 1] + a[n - 1] * b + N[n - 1] * z;
dig >>= 8;

View file

@ -757,7 +757,7 @@ void KeyVault::SetKlicenseeKey(u8* key)
memcpy(klicensee_key.get(), key, 0x10);
}
u8* KeyVault::GetKlicenseeKey()
u8* KeyVault::GetKlicenseeKey() const
{
return klicensee_key.get();
}
@ -782,21 +782,21 @@ void rap_to_rif(unsigned char* rap, unsigned char* rif)
{
for (i = 0; i < 16; ++i)
{
int p = RAP_PBOX[i];
const int p = RAP_PBOX[i];
key[p] ^= RAP_E1[p];
}
for (i = 15; i >= 1; --i)
{
int p = RAP_PBOX[i];
int pp = RAP_PBOX[i - 1];
const int p = RAP_PBOX[i];
const int pp = RAP_PBOX[i - 1];
key[p] ^= key[pp];
}
int o = 0;
for (i = 0; i < 16; ++i)
{
int p = RAP_PBOX[i];
unsigned char kc = key[p] - o;
unsigned char ec2 = RAP_E2[p];
const int p = RAP_PBOX[i];
const unsigned char kc = key[p] - o;
const unsigned char ec2 = RAP_E2[p];
if (o != 1 || kc != 0xFF)
{
o = kc < ec2 ? 1 : 0;

View file

@ -196,7 +196,7 @@ public:
KeyVault();
SELF_KEY FindSelfKey(u32 type, u16 revision, u64 version);
void SetKlicenseeKey(u8* key);
u8* GetKlicenseeKey();
u8* GetKlicenseeKey() const;
private:
void LoadSelfLV0Keys();

View file

@ -154,7 +154,7 @@ int decompress(unsigned char *out, unsigned char *in, unsigned int size)
{
// Set up a temporary buffer (sliding window).
memset(tmp, 0x80, 0xCA8);
while (1)
while (true)
{
// Start reading at 0xB68.
tmp_sect1 = tmp + offset + 0xB68;

View file

@ -40,7 +40,7 @@ void generate_key(int crypto_mode, int version, unsigned char *key_final, unsign
memcpy(key_final, key, 0x10);
memcpy(iv_final, iv, 0x10);
break;
};
}
}
void generate_hash(int hash_mode, int version, unsigned char *hash_final, unsigned char *hash)
@ -662,7 +662,7 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
if (memcmp(&NPD.magic, npd_magic, 4))
{
edat_log.error("EDAT: %s has invalid NPD header or already decrypted.", input_file_name);
return 1;
return true;
}
if (verbose)
@ -709,7 +709,7 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
if ((EDAT.flags & EDAT_DEBUG_DATA_FLAG) != EDAT_DEBUG_DATA_FLAG)
{
edat_log.error("EDAT: NPD hash validation failed!");
return 1;
return true;
}
}
@ -724,7 +724,7 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
if (!key)
{
edat_log.error("EDAT: A valid RAP file is needed for this EDAT file! (local activation)");
return 1;
return true;
}
}
else if ((NPD.license & 0x1) == 0x1) // Type 1: Use network activation.
@ -735,7 +735,7 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
if (!key)
{
edat_log.error("EDAT: A valid RAP file is needed for this EDAT file! (network activation)");
return 1;
return true;
}
}
@ -759,17 +759,17 @@ bool extract_all_data(const fs::file* input, const fs::file* output, const char*
if (check_data(reinterpret_cast<uchar*>(&key), &EDAT, &NPD, input, verbose))
{
edat_log.error("EDAT: Data parsing failed!");
return 1;
return true;
}
input->seek(0);
if (decrypt_data(input, output, &EDAT, &NPD, reinterpret_cast<uchar*>(&key), verbose))
{
edat_log.error("EDAT: Data decryption failed!");
return 1;
return true;
}
return 0;
return false;
}
u128 GetEdatRifKeyFromRapFile(const fs::file& rap_file)
@ -878,7 +878,7 @@ fs::file DecryptEDAT(const fs::file& input, const std::string& input_file_name,
// Read the RAP file, if provided.
if (!rap_file_name.empty())
{
fs::file rap(rap_file_name);
const fs::file rap(rap_file_name);
rifKey = GetEdatRifKeyFromRapFile(rap);
}

View file

@ -103,7 +103,7 @@ public:
u64 read(void* buffer, u64 size) override
{
u64 bytesRead = ReadData(pos, static_cast<u8*>(buffer), size);
const u64 bytesRead = ReadData(pos, static_cast<u8*>(buffer), size);
pos += bytesRead;
return bytesRead;
}

View file

@ -554,7 +554,7 @@ bool package_reader::read_param_sfo()
}
// TODO: maybe also check if VERSION matches
package_error package_reader::check_target_app_version()
package_error package_reader::check_target_app_version() const
{
if (!m_is_valid)
{

View file

@ -165,7 +165,7 @@ public:
make_package_npdrm_ver = to_hex_string(data.make_package_npdrm_ver, sizeof(data.make_package_npdrm_ver));
version = to_hex_string(data.version, sizeof(data.version), 2);
}
std::string to_string()
std::string to_string() const
{
return fmt::format("make package npdrm version: %s, version: %s", make_package_npdrm_ver, version);
}
@ -193,7 +193,7 @@ public:
version = to_hex_string(data.version, sizeof(data.version), 2);
app_version = to_hex_string(data.app_version, sizeof(data.app_version), 2);
}
std::string to_string()
std::string to_string() const
{
return fmt::format("unk: %s, firmware version: %s, version: %s, app version: %s",
unk, firmware_version, version, app_version);
@ -211,7 +211,7 @@ public:
be_t<u32> size{ 0 };
u8 sha256[32]{ 0 };
std::string to_string()
std::string to_string() const
{
return fmt::format("offset: 0x%x, size: 0x%x, sha256: 0x%x", offset, size, sha256);
}
@ -226,7 +226,7 @@ public:
u8 unk_2[8]{ 0 };
u8 param_digest[32]{ 0 }; // SHA256 of param_data. Called ParamDigest: This is sha256 digest of param.sfo.
std::string to_string()
std::string to_string() const
{
return fmt::format("param_offset: 0x%x, param_size: 0x%x, unk_1: 0x%x, psp2_system_ver: 0x%x, unk_2: 0x%x, param_digest: 0x%x",
param_offset, param_size, unk_1, psp2_system_ver, unk_2, param_digest);
@ -240,7 +240,7 @@ public:
u8 unk[32]{ 0 };
u8 unknown_data_sha256[32]{ 0 };
std::string to_string()
std::string to_string() const
{
return fmt::format("unknown_data_offset: 0x%x, unknown_data_size: 0x%x, unk: 0x%x, unknown_data_sha256: 0x%x",
unknown_data_offset, unknown_data_size, unk, unknown_data_sha256);
@ -257,7 +257,7 @@ public:
u8 unk_3[8]{ 0 };
u8 entirety_digest[32]{ 0 };
std::string to_string()
std::string to_string() const
{
return fmt::format("entirety_data_offset: 0x%x, entirety_data_size: 0x%x, flags: 0x%x, unk_1: 0x%x, unk_2: 0x%x, unk_3: 0x%x, entirety_digest: 0x%x",
entirety_data_offset, entirety_data_size, flags, unk_1, unk_2, unk_3, entirety_digest);
@ -270,7 +270,7 @@ public:
be_t<u32> psf_builder_version{ 0 };
u8 padding[32]{ 0 };
std::string to_string()
std::string to_string() const
{
return fmt::format("publishing_tools_version: 0x%x, psf_builder_version: 0x%x, padding: 0x%x",
publishing_tools_version, psf_builder_version, padding);
@ -284,7 +284,7 @@ public:
u8 unk[16]{ 0 };
u8 self_sha256[32]{ 0 };
std::string to_string()
std::string to_string() const
{
return fmt::format("self_info_offset: 0x%x, self_info_size: 0x%x, unk: 0x%x, self_sha256: 0x%x",
self_info_offset, self_info_size, unk, self_sha256);
@ -306,7 +306,7 @@ public:
~package_reader();
bool is_valid() const { return m_is_valid; }
package_error check_target_app_version();
package_error check_target_app_version() const;
bool extract_data(atomic_t<double>& sync);
psf::registry get_psf() const { return m_psf; }

View file

@ -200,7 +200,7 @@ void AppInfo::Load(const fs::file& f)
padding = Read64(f);
}
void AppInfo::Show()
void AppInfo::Show() const
{
self_log.notice("AuthID: 0x%llx", authid);
self_log.notice("VendorID: 0x%08x", vendor_id);
@ -218,7 +218,7 @@ void SectionInfo::Load(const fs::file& f)
encrypted = Read32(f);
}
void SectionInfo::Show()
void SectionInfo::Show() const
{
self_log.notice("Offset: 0x%llx", offset);
self_log.notice("Size: 0x%llx", size);
@ -236,7 +236,7 @@ void SCEVersionInfo::Load(const fs::file& f)
unknown = Read32(f);
}
void SCEVersionInfo::Show()
void SCEVersionInfo::Show() const
{
self_log.notice("Sub-header type: 0x%08x", subheader_type);
self_log.notice("Present: 0x%08x", present);
@ -290,7 +290,7 @@ void ControlInfo::Load(const fs::file& f)
}
}
void ControlInfo::Show()
void ControlInfo::Show() const
{
self_log.notice("Type: 0x%08x", type);
self_log.notice("Size: 0x%08x", size);
@ -369,7 +369,7 @@ void MetadataInfo::Load(u8* in)
memcpy(iv_pad, in + 0x30, 0x10);
}
void MetadataInfo::Show()
void MetadataInfo::Show() const
{
std::string key_str;
std::string key_pad_str;
@ -409,7 +409,7 @@ void MetadataHeader::Load(u8* in)
unknown3 = swap32(unknown3);
}
void MetadataHeader::Show()
void MetadataHeader::Show() const
{
self_log.notice("Signature input length: 0x%llx", signature_input_length);
self_log.notice("Unknown1: 0x%08x", unknown1);
@ -446,7 +446,7 @@ void MetadataSectionHeader::Load(u8* in)
compressed = swap32(compressed);
}
void MetadataSectionHeader::Show()
void MetadataSectionHeader::Show() const
{
self_log.notice("Data offset: 0x%llx", data_offset);
self_log.notice("Data size: 0x%llx", data_size);
@ -1395,7 +1395,7 @@ static bool CheckDebugSelf(fs::file& s)
// Copy the data.
char buf[2048];
while (u64 size = s.read(buf, 2048))
while (const u64 size = s.read(buf, 2048))
{
e.write(buf, size);
}
@ -1426,7 +1426,7 @@ fs::file decrypt_self(fs::file elf_or_self, u8* klic_key, SelfAdditionalInfo* ou
if (elf_or_self.size() >= 4 && elf_or_self.read<u32>() == "SCE\0"_u32 && !CheckDebugSelf(elf_or_self))
{
// Check the ELF file class (32 or 64 bit).
bool isElf32 = IsSelfElf32(elf_or_self);
const bool isElf32 = IsSelfElf32(elf_or_self);
// Start the decrypter on this SELF file.
SELFDecrypter self_dec(elf_or_self);
@ -1469,7 +1469,7 @@ bool verify_npdrm_self_headers(const fs::file& self, u8* klic_key)
if (self.size() >= 4 && self.read<u32>() == "SCE\0"_u32)
{
// Check the ELF file class (32 or 64 bit).
bool isElf32 = IsSelfElf32(self);
const bool isElf32 = IsSelfElf32(self);
// Start the decrypter on this SELF file.
SELFDecrypter self_dec(self);

View file

@ -18,7 +18,7 @@ struct AppInfo
u64 padding;
void Load(const fs::file& f);
void Show();
void Show() const;
};
struct SectionInfo
@ -31,7 +31,7 @@ struct SectionInfo
u32 encrypted;
void Load(const fs::file& f);
void Show();
void Show() const;
};
struct SCEVersionInfo
@ -42,7 +42,7 @@ struct SCEVersionInfo
u32 unknown;
void Load(const fs::file& f);
void Show();
void Show() const;
};
struct ControlInfo
@ -102,7 +102,7 @@ struct ControlInfo
};
void Load(const fs::file& f);
void Show();
void Show() const;
};
@ -114,7 +114,7 @@ struct MetadataInfo
u8 iv_pad[0x10];
void Load(u8* in);
void Show();
void Show() const;
};
struct MetadataHeader
@ -128,7 +128,7 @@ struct MetadataHeader
u32 unknown3;
void Load(u8* in);
void Show();
void Show() const;
};
struct MetadataSectionHeader
@ -145,7 +145,7 @@ struct MetadataSectionHeader
u32 compressed;
void Load(u8* in);
void Show();
void Show() const;
};
struct SectionHash
@ -213,7 +213,7 @@ struct Elf32_Ehdr
u16 e_shstrndx;
void Load(const fs::file& f);
void Show() {}
static void Show() {}
bool IsLittleEndian() const { return e_data == 1; }
bool CheckMagic() const { return e_magic == 0x7F454C46; }
u32 GetEntry() const { return e_entry; }
@ -234,7 +234,7 @@ struct Elf32_Shdr
void Load(const fs::file& f);
void LoadLE(const fs::file& f);
void Show() {}
static void Show() {}
};
struct Elf32_Phdr
@ -250,7 +250,7 @@ struct Elf32_Phdr
void Load(const fs::file& f);
void LoadLE(const fs::file& f);
void Show() {}
static void Show() {}
};
struct Elf64_Ehdr
@ -276,7 +276,7 @@ struct Elf64_Ehdr
u16 e_shstrndx;
void Load(const fs::file& f);
void Show() {}
static void Show() {}
bool CheckMagic() const { return e_magic == 0x7F454C46; }
u64 GetEntry() const { return e_entry; }
};
@ -295,7 +295,7 @@ struct Elf64_Shdr
u64 sh_entsize;
void Load(const fs::file& f);
void Show(){}
static void Show(){}
};
struct Elf64_Phdr
@ -310,7 +310,7 @@ struct Elf64_Phdr
u64 p_align;
void Load(const fs::file& f);
void Show(){}
static void Show(){}
};
struct SceHeader
@ -324,7 +324,7 @@ struct SceHeader
u64 se_esize;
void Load(const fs::file& f);
void Show(){}
static void Show(){}
bool CheckMagic() const { return se_magic == 0x53434500; }
};
@ -342,7 +342,7 @@ struct SelfHeader
u64 pad;
void Load(const fs::file& f);
void Show(){}
static void Show(){}
};
struct SelfAdditionalInfo
@ -427,7 +427,7 @@ public:
bool LoadMetadata(u8* klic_key);
bool DecryptData();
bool DecryptNPDRM(u8 *metadata, u32 metadata_size);
bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
static bool GetKeyFromRap(u8 *content_id, u8 *npdrm_key);
private:
template<typename EHdr, typename SHdr, typename PHdr>
@ -466,7 +466,7 @@ private:
// Use zlib uncompress on the new buffer.
// decomp_buf_length changes inside the call to uncompress
int rv = uncompress(decomp_buf.get(), &decomp_buf_length, zlib_buf.get() + data_buf_offset, data_buf_length);
const int rv = uncompress(decomp_buf.get(), &decomp_buf_length, zlib_buf.get() + data_buf_offset, data_buf_length);
// Check for errors (TODO: Probably safe to remove this once these changes have passed testing.)
switch (rv)

View file

@ -45,7 +45,7 @@ u64 hex_to_u64(const char* hex_str)
void hex_to_bytes(unsigned char* data, const char* hex_str, unsigned int str_length)
{
auto strn_length = (str_length > 0) ? str_length : std::strlen(hex_str);
const auto strn_length = (str_length > 0) ? str_length : std::strlen(hex_str);
auto data_length = strn_length / 2;
char tmp_buf[3] = {0, 0, 0};
@ -93,7 +93,7 @@ void aesecb128_encrypt(unsigned char *key, unsigned char *in, unsigned char *out
bool hmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len)
{
std::unique_ptr<u8[]> out(new u8[key_len]);
const std::unique_ptr<u8[]> out(new u8[key_len]);
sha1_hmac(key, key_len, in, in_len, out.get());
@ -107,7 +107,7 @@ void hmac_hash_forge(unsigned char *key, int key_len, unsigned char *in, int in_
bool cmac_hash_compare(unsigned char *key, int key_len, unsigned char *in, int in_len, unsigned char *hash, int hash_len)
{
std::unique_ptr<u8[]> out(new u8[key_len]);
const std::unique_ptr<u8[]> out(new u8[key_len]);
aes_context ctx;
aes_setkey_enc(&ctx, key, 128);
@ -127,7 +127,7 @@ char* extract_file_name(const char* file_path, char real_file_name[CRYPTO_MAX_PA
{
std::string_view v(file_path);
if (auto pos = v.find_last_of(fs::delim); pos != umax)
if (const auto pos = v.find_last_of(fs::delim); pos != umax)
{
v.remove_prefix(pos + 1);
}

View file

@ -2,7 +2,6 @@
#include "Emu/Audio/AudioBackend.h"
#include "3rdparty/OpenAL/include/alext.h"
#include <memory>
class OpenALBackend : public AudioBackend
{
@ -19,23 +18,23 @@ private:
public:
OpenALBackend();
virtual ~OpenALBackend() override;
~OpenALBackend() override;
virtual const char* GetName() const override { return "OpenAL"; }
const char* GetName() const override { return "OpenAL"; }
static const u32 capabilities = PLAY_PAUSE_FLUSH | IS_PLAYING | GET_NUM_ENQUEUED_SAMPLES | SET_FREQUENCY_RATIO;
virtual u32 GetCapabilities() const override { return capabilities; }
u32 GetCapabilities() const override { return capabilities; }
virtual void Open(u32 num_buffers) override;
virtual void Close() override;
void Open(u32 num_buffers) override;
void Close() override;
virtual void Play() override;
virtual void Pause() override;
virtual bool IsPlaying() override;
void Play() override;
void Pause() override;
bool IsPlaying() override;
virtual bool AddData(const void* src, u32 size) override;
virtual void Flush() override;
bool AddData(const void* src, u32 num_samples) override;
void Flush() override;
virtual u64 GetNumEnqueuedSamples() override;
virtual f32 SetFrequencyRatio(f32 new_ratio) override;
};
u64 GetNumEnqueuedSamples() override;
f32 SetFrequencyRatio(f32 new_ratio) override;
};

View file

@ -73,7 +73,7 @@ bool AudioBackend::has_capability(u32 cap) const
void AudioBackend::dump_capabilities(std::string& out) const
{
u32 count = 0;
u32 capabilities = GetCapabilities();
const u32 capabilities = GetCapabilities();
if (capabilities & PLAY_PAUSE_FLUSH)
{

View file

@ -13,7 +13,7 @@ AudioDumper::AudioDumper(u16 ch)
if (const std::string id = Emu.GetTitleID(); !id.empty())
{
path += id + "_";
};
}
path += date_time::current_time_narrow<'_'>() + ".wav";
m_output.open(path, fs::rewrite);
m_output.write(m_header); // write initial file header

View file

@ -12,9 +12,7 @@ LOG_CHANNEL(FAudio_, "FAudio");
FAudioBackend::FAudioBackend()
: AudioBackend()
{
u32 res;
res = FAudioCreate(&m_instance, 0, FAUDIO_DEFAULT_PROCESSOR);
u32 res = FAudioCreate(&m_instance, 0, FAUDIO_DEFAULT_PROCESSOR);
if (res)
{
FAudio_.fatal("FAudioCreate() failed(0x%08x)", res);
@ -53,7 +51,7 @@ void FAudioBackend::Play()
{
AUDIT(m_source_voice != nullptr);
u32 res = FAudioSourceVoice_Start(m_source_voice, 0, FAUDIO_COMMIT_NOW);
const u32 res = FAudioSourceVoice_Start(m_source_voice, 0, FAUDIO_COMMIT_NOW);
if (res)
{
FAudio_.error("FAudioSourceVoice_Start() failed(0x%08x)", res);
@ -65,7 +63,7 @@ void FAudioBackend::Pause()
{
AUDIT(m_source_voice != nullptr);
u32 res = FAudioSourceVoice_Stop(m_source_voice, 0, FAUDIO_COMMIT_NOW);
const u32 res = FAudioSourceVoice_Stop(m_source_voice, 0, FAUDIO_COMMIT_NOW);
if (res)
{
FAudio_.error("FAudioSourceVoice_Stop() failed(0x%08x)", res);
@ -77,7 +75,7 @@ void FAudioBackend::Flush()
{
AUDIT(m_source_voice != nullptr);
u32 res = FAudioSourceVoice_FlushSourceBuffers(m_source_voice);
const u32 res = FAudioSourceVoice_FlushSourceBuffers(m_source_voice);
if (res)
{
FAudio_.error("FAudioSourceVoice_FlushSourceBuffers() failed(0x%08x)", res);
@ -112,7 +110,7 @@ void FAudioBackend::Open(u32 /* num_buffers */)
waveformatex.wBitsPerSample = m_sample_size * 8;
waveformatex.cbSize = 0;
u32 res = FAudio_CreateSourceVoice(m_instance, &m_source_voice, &waveformatex, 0, FAUDIO_DEFAULT_FREQ_RATIO, nullptr, nullptr, nullptr);
const u32 res = FAudio_CreateSourceVoice(m_instance, &m_source_voice, &waveformatex, 0, FAUDIO_DEFAULT_FREQ_RATIO, nullptr, nullptr, nullptr);
if (res)
{
FAudio_.error("FAudio_CreateSourceVoice() failed(0x%08x)", res);
@ -143,11 +141,11 @@ bool FAudioBackend::AddData(const void* src, u32 num_samples)
buffer.LoopCount = 0;
buffer.LoopLength = 0;
buffer.pAudioData = static_cast<const u8*>(src);
buffer.pContext = 0;
buffer.pContext = nullptr;
buffer.PlayBegin = 0;
buffer.PlayLength = AUDIO_BUFFER_SAMPLES;
u32 res = FAudioSourceVoice_SubmitSourceBuffer(m_source_voice, &buffer, nullptr);
const u32 res = FAudioSourceVoice_SubmitSourceBuffer(m_source_voice, &buffer, nullptr);
if (res)
{
FAudio_.error("FAudioSourceVoice_SubmitSourceBuffer() failed(0x%08x)", res);
@ -171,7 +169,7 @@ f32 FAudioBackend::SetFrequencyRatio(f32 new_ratio)
{
new_ratio = std::clamp(new_ratio, FAUDIO_MIN_FREQ_RATIO, FAUDIO_DEFAULT_FREQ_RATIO);
u32 res = FAudioSourceVoice_SetFrequencyRatio(m_source_voice, new_ratio, FAUDIO_COMMIT_NOW);
const u32 res = FAudioSourceVoice_SetFrequencyRatio(m_source_voice, new_ratio, FAUDIO_COMMIT_NOW);
if (res)
{
FAudio_.error("FAudioSourceVoice_SetFrequencyRatio() failed(0x%08x)", res);

View file

@ -16,32 +16,32 @@ private:
public:
FAudioBackend();
virtual ~FAudioBackend() override;
~FAudioBackend() override;
FAudioBackend(const FAudioBackend&) = delete;
FAudioBackend& operator=(const FAudioBackend&) = delete;
virtual const char* GetName() const override
const char* GetName() const override
{
return "FAudio";
};
}
static const u32 capabilities = PLAY_PAUSE_FLUSH | IS_PLAYING | GET_NUM_ENQUEUED_SAMPLES | SET_FREQUENCY_RATIO;
virtual u32 GetCapabilities() const override
u32 GetCapabilities() const override
{
return capabilities;
};
}
virtual void Open(u32 /* num_buffers */) override;
virtual void Close() override;
void Open(u32 /* num_buffers */) override;
void Close() override;
virtual void Play() override;
virtual void Pause() override;
virtual bool IsPlaying() override;
void Play() override;
void Pause() override;
bool IsPlaying() override;
virtual bool AddData(const void* src, u32 num_samples) override;
virtual void Flush() override;
bool AddData(const void* src, u32 num_samples) override;
void Flush() override;
virtual u64 GetNumEnqueuedSamples() override;
virtual f32 SetFrequencyRatio(f32 new_ratio) override;
u64 GetNumEnqueuedSamples() override;
f32 SetFrequencyRatio(f32 new_ratio) override;
};

View file

@ -4,9 +4,7 @@
#include <algorithm>
#include "util/logs.hpp"
#include "Utilities/StrFmt.h"
#include "Emu/System.h"
#include "Emu/system_config.h"
#include "XAudio2Backend.h"
#include <Windows.h>
@ -23,7 +21,7 @@ XAudio2Backend::XAudio2Backend()
// In order to prevent errors on CreateMasteringVoice, apparently we need CoInitializeEx according to:
// https://docs.microsoft.com/en-us/windows/win32/api/xaudio2fx/nf-xaudio2fx-xaudio2createvolumemeter
CoInitializeEx(NULL, COINIT_MULTITHREADED);
CoInitializeEx(nullptr, COINIT_MULTITHREADED);
HRESULT hr = XAudio2Create(instance.GetAddressOf(), 0, XAUDIO2_DEFAULT_PROCESSOR);
if (FAILED(hr))
@ -66,7 +64,7 @@ void XAudio2Backend::Play()
{
AUDIT(m_source_voice != nullptr);
HRESULT hr = m_source_voice->Start();
const HRESULT hr = m_source_voice->Start();
if (FAILED(hr))
{
XAudio.error("Start() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
@ -84,7 +82,7 @@ void XAudio2Backend::Pause()
{
AUDIT(m_source_voice != nullptr);
HRESULT hr = m_source_voice->Stop();
const HRESULT hr = m_source_voice->Stop();
if (FAILED(hr))
{
XAudio.error("Stop() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
@ -94,8 +92,6 @@ void XAudio2Backend::Pause()
void XAudio2Backend::Open(u32 /* num_buffers */)
{
HRESULT hr;
WAVEFORMATEX waveformatex;
waveformatex.wFormatTag = m_convert_to_u16 ? WAVE_FORMAT_PCM : WAVE_FORMAT_IEEE_FLOAT;
waveformatex.nChannels = m_channels;
@ -105,7 +101,7 @@ void XAudio2Backend::Open(u32 /* num_buffers */)
waveformatex.wBitsPerSample = m_sample_size * 8;
waveformatex.cbSize = 0;
hr = m_xaudio2_instance->CreateSourceVoice(&m_source_voice, &waveformatex, 0, XAUDIO2_DEFAULT_FREQ_RATIO);
const HRESULT hr = m_xaudio2_instance->CreateSourceVoice(&m_source_voice, &waveformatex, 0, XAUDIO2_DEFAULT_FREQ_RATIO);
if (FAILED(hr))
{
XAudio.error("CreateSourceVoice() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
@ -152,7 +148,7 @@ bool XAudio2Backend::AddData(const void* src, u32 num_samples)
buffer.PlayBegin = 0;
buffer.PlayLength = AUDIO_BUFFER_SAMPLES;
HRESULT hr = m_source_voice->SubmitSourceBuffer(&buffer);
const HRESULT hr = m_source_voice->SubmitSourceBuffer(&buffer);
if (FAILED(hr))
{
XAudio.error("AddData() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
@ -167,7 +163,7 @@ void XAudio2Backend::Flush()
{
AUDIT(m_source_voice != nullptr);
HRESULT hr = m_source_voice->FlushSourceBuffers();
const HRESULT hr = m_source_voice->FlushSourceBuffers();
if (FAILED(hr))
{
XAudio.error("FlushSourceBuffers() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));
@ -190,7 +186,7 @@ f32 XAudio2Backend::SetFrequencyRatio(f32 new_ratio)
{
new_ratio = std::clamp(new_ratio, XAUDIO2_MIN_FREQ_RATIO, XAUDIO2_DEFAULT_FREQ_RATIO);
HRESULT hr = m_source_voice->SetFrequencyRatio(new_ratio);
const HRESULT hr = m_source_voice->SetFrequencyRatio(new_ratio);
if (FAILED(hr))
{
XAudio.error("SetFrequencyRatio() failed: %s (0x%08x)", std::system_category().message(hr), static_cast<u32>(hr));

View file

@ -19,28 +19,28 @@ private:
public:
XAudio2Backend();
virtual ~XAudio2Backend() override;
~XAudio2Backend() override;
XAudio2Backend(const XAudio2Backend&) = delete;
XAudio2Backend& operator=(const XAudio2Backend&) = delete;
virtual const char* GetName() const override { return "XAudio2"; };
const char* GetName() const override { return "XAudio2"; }
static const u32 capabilities = PLAY_PAUSE_FLUSH | IS_PLAYING | GET_NUM_ENQUEUED_SAMPLES | SET_FREQUENCY_RATIO;
virtual u32 GetCapabilities() const override { return capabilities; };
u32 GetCapabilities() const override { return capabilities; }
virtual bool Initialized() const override { return m_xaudio2_instance != nullptr; }
bool Initialized() const override { return m_xaudio2_instance != nullptr; }
virtual void Open(u32 /* num_buffers */) override;
virtual void Close() override;
void Open(u32 /* num_buffers */) override;
void Close() override;
virtual void Play() override;
virtual void Pause() override;
virtual bool IsPlaying() override;
void Play() override;
void Pause() override;
bool IsPlaying() override;
virtual bool AddData(const void* src, u32 num_samples) override;
virtual void Flush() override;
bool AddData(const void* src, u32 num_samples) override;
void Flush() override;
virtual u64 GetNumEnqueuedSamples() override;
virtual f32 SetFrequencyRatio(f32 new_ratio) override;
u64 GetNumEnqueuedSamples() override;
f32 SetFrequencyRatio(f32 new_ratio) override;
};

View file

@ -17,7 +17,6 @@
#include <unordered_map>
#include <map>
#include <immintrin.h>
#include <emmintrin.h>
DECLARE(cpu_thread::g_threads_created){0};
@ -875,14 +874,13 @@ std::string cpu_thread::get_name() const
{
return thread_ctrl::get_name(*static_cast<const named_thread<ppu_thread>*>(this));
}
else if (id_type() == 2)
if (id_type() == 2)
{
return thread_ctrl::get_name(*static_cast<const named_thread<spu_thread>*>(this));
}
else
{
fmt::throw_exception("Invalid cpu_thread type");
}
fmt::throw_exception("Invalid cpu_thread type");
}
u32 cpu_thread::get_pc() const
@ -1181,7 +1179,7 @@ void cpu_thread::flush_profilers() noexcept
return;
}
if (g_cfg.core.spu_prof || false)
if (g_cfg.core.spu_prof)
{
g_fxo->get<cpu_profiler>().registered.push(0);
}

View file

@ -147,7 +147,7 @@ public:
virtual void cpu_return() {}
// Callback for thread_ctrl::wait or RSX wait
virtual void cpu_wait(bs_t<cpu_flag> flags);
virtual void cpu_wait(bs_t<cpu_flag> old);
// Callback for function abortion stats on Emu.Stop()
virtual void cpu_on_stop() {}
@ -175,9 +175,6 @@ public:
// Internal method
bool push(cpu_thread* _this) noexcept;
// Called after suspend_post
void post() noexcept;
};
// Suspend all threads and execute op (may be executed by other thread than caller!)

View file

@ -71,7 +71,7 @@ void cpu_translator::initialize(llvm::LLVMContext& context, llvm::ExecutionEngin
}
}
llvm::Value* cpu_translator::bitcast(llvm::Value* val, llvm::Type* type)
llvm::Value* cpu_translator::bitcast(llvm::Value* val, llvm::Type* type) const
{
uint s1 = type->getScalarSizeInBits();
uint s2 = val->getType()->getScalarSizeInBits();
@ -110,7 +110,7 @@ std::pair<bool, v128> cpu_translator::get_const_vector<v128>(llvm::Value* c, u32
{
if (const auto ci = llvm::dyn_cast<llvm::ConstantInt>(c); ci && ci->getBitWidth() == 128)
{
auto cv = ci->getValue();
const auto& cv = ci->getValue();
result._u64[0] = cv.extractBitsAsZExtValue(64, 0);
result._u64[1] = cv.extractBitsAsZExtValue(64, 64);
@ -213,23 +213,23 @@ llvm::Constant* cpu_translator::make_const_vector<v128>(v128 v, llvm::Type* t)
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u8*>(v._bytes), 16));
}
else if (sct->isIntegerTy(16))
if (sct->isIntegerTy(16))
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u16*>(v._bytes), 8));
}
else if (sct->isIntegerTy(32))
if (sct->isIntegerTy(32))
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u32*>(v._bytes), 4));
}
else if (sct->isIntegerTy(64))
if (sct->isIntegerTy(64))
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const u64*>(v._bytes), 2));
}
else if (sct->isFloatTy())
if (sct->isFloatTy())
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const f32*>(v._bytes), 4));
}
else if (sct->isDoubleTy())
if (sct->isDoubleTy())
{
return llvm::ConstantDataVector::get(m_context, llvm::makeArrayRef(reinterpret_cast<const f64*>(v._bytes), 2));
}

View file

@ -29,16 +29,8 @@
#include "util/types.hpp"
#include "Utilities/StrFmt.h"
#include "Utilities/BitField.h"
#include "util/logs.hpp"
#include "Utilities/JIT.h"
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <array>
#include <vector>
#include "util/v128.hpp"
enum class i2 : char
@ -846,6 +838,8 @@ struct llvm_neg
{
return ir->CreateFNeg(v1);
}
// TODO: return value ?
}
llvm_match_tuple<A1> match(llvm::Value*& value) const
@ -2432,7 +2426,7 @@ protected:
bool m_use_avx512_icl = false;
// IR builder
llvm::IRBuilder<>* m_ir;
llvm::IRBuilder<>* m_ir = nullptr;
void initialize(llvm::LLVMContext& context, llvm::ExecutionEngine& engine);
@ -2500,7 +2494,7 @@ public:
}
// Bitcast with immediate constant folding
llvm::Value* bitcast(llvm::Value* val, llvm::Type* type);
llvm::Value* bitcast(llvm::Value* val, llvm::Type* type) const;
template <typename T>
llvm::Value* bitcast(llvm::Value* val)

View file

@ -63,7 +63,6 @@ bool statichle_handler::load_patterns()
auto char_to_u8 = [&](u8 char1, u8 char2) -> u16
{
u8 hv, lv;
if (char1 == '.' && char2 == '.')
return 0xFFFF;
@ -73,8 +72,8 @@ bool statichle_handler::load_patterns()
return -1;
}
hv = char1 > '9' ? char1 - 'A' + 10 : char1 - '0';
lv = char2 > '9' ? char2 - 'A' + 10 : char2 - '0';
const u8 hv = char1 > '9' ? char1 - 'A' + 10 : char1 - '0';
const u8 lv = char2 > '9' ? char2 - 'A' + 10 : char2 - '0';
return (hv << 4) | lv;
};
@ -101,7 +100,6 @@ bool statichle_handler::load_patterns()
u16 statichle_handler::gen_CRC16(const u8* data_p, usz length)
{
unsigned char i;
unsigned int data;
if (length == 0)
@ -110,7 +108,7 @@ u16 statichle_handler::gen_CRC16(const u8* data_p, usz length)
do
{
data = *data_p++;
for (i = 0; i < 8; i++)
for (unsigned char i = 0; i < 8; i++)
{
if ((crc ^ data) & 1)
crc = (crc >> 1) ^ POLY;

View file

@ -29,7 +29,7 @@ public:
bool check_against_patterns(vm::cptr<u8>& data, u32 size, u32 addr);
protected:
u16 gen_CRC16(const u8* data_p, usz length);
static u16 gen_CRC16(const u8* data_p, usz length);
std::vector<shle_pattern> hle_patterns;
};

View file

@ -30,7 +30,6 @@ extern "C"
#include "cellAdec.h"
#include <mutex>
#include <thread>
extern std::mutex g_mutex_avcodec_open2;
@ -356,7 +355,7 @@ public:
fmt::throw_exception("avformat_alloc_context() failed");
}
io_buf = static_cast<u8*>(av_malloc(4096));
fmt->pb = avio_alloc_context(io_buf, 256, 0, this, adecRead, NULL, NULL);
fmt->pb = avio_alloc_context(io_buf, 256, 0, this, adecRead, nullptr, nullptr);
if (!fmt->pb)
{
fmt::throw_exception("avio_alloc_context() failed");
@ -466,7 +465,7 @@ public:
}
else
{
data = NULL;
data = nullptr;
size = 0;
}
}
@ -490,7 +489,7 @@ public:
{
AVDictionary* opts = nullptr;
av_dict_set(&opts, "probesize", "96", 0);
err = avformat_open_input(&fmt, NULL, input_format, &opts);
err = avformat_open_input(&fmt, nullptr, input_format, &opts);
if (err || opts)
{
fmt::throw_exception("avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
@ -687,9 +686,8 @@ next:
case adecClose:
{
buf_size = adec.reader.size;
break;
}
break;
case adecDecodeAu:
{
std::memcpy(buf, vm::base(adec.reader.addr), adec.reader.size);
@ -706,9 +704,9 @@ next:
adec.reader.size = adec.task.au.size;
adec.reader.has_ats = adec.use_ats_headers;
//cellAdec.notice("Audio AU: size = 0x%x, pts = 0x%llx", adec.task.au.size, adec.task.au.pts);
break;
}
break;
case adecStartSeq: // TODO ?
default:
{
cellAdec.error("adecRawRead(): unknown task (%d)", +task.type);
@ -728,14 +726,12 @@ next:
{
return res;
}
else
{
std::memcpy(buf, vm::base(adec.reader.addr), buf_size);
adec.reader.addr += buf_size;
adec.reader.size -= buf_size;
return res + buf_size;
}
std::memcpy(buf, vm::base(adec.reader.addr), buf_size);
adec.reader.addr += buf_size;
adec.reader.size -= buf_size;
return res + buf_size;
}
bool adecCheckType(s32 type)

View file

@ -7,7 +7,6 @@
#include "cellAudio.h"
#include "emmintrin.h"
#include "immintrin.h"
#include <cmath>
LOG_CHANNEL(cellAudio);
@ -65,7 +64,7 @@ void cell_audio_config::reset()
desired_buffer_duration = raw.desired_buffer_duration * 1000llu;
buffering_enabled = raw.buffering_enabled && backend->has_capability(AudioBackend::PLAY_PAUSE_FLUSH | AudioBackend::IS_PLAYING);;
buffering_enabled = raw.buffering_enabled && backend->has_capability(AudioBackend::PLAY_PAUSE_FLUSH | AudioBackend::IS_PLAYING);
minimum_block_period = audio_block_period / 2;
maximum_block_period = (6 * audio_block_period) / 5;
@ -160,7 +159,7 @@ f32 audio_ringbuffer::set_frequency_ratio(f32 new_ratio)
return frequency_ratio;
}
u64 audio_ringbuffer::get_timestamp() const
u64 audio_ringbuffer::get_timestamp()
{
return get_system_time() - Emu.GetPauseTime();
}

View file

@ -307,7 +307,7 @@ public:
return buffer[num].get();
}
u64 get_timestamp() const;
static u64 get_timestamp();
float* get_current_buffer() const
{

View file

@ -1,7 +1,5 @@
#pragma once
#include "Emu/Memory/vm_ptr.h"
// Error codes
enum CellAudioOutError
{

View file

@ -8,7 +8,6 @@
#include "cellAudioIn.h"
#include "cellAudioOut.h"
#include "cellVideoOut.h"
#include "cellSysutil.h"
LOG_CHANNEL(cellAvconfExt);
@ -108,6 +107,7 @@ avconf_manager::avconf_manager()
curindex++;
break;
case microphone_handler::null:
default: break;
}
}

View file

@ -547,7 +547,7 @@ error_code cellCameraGetType(s32 dev_num, vm::ptr<s32> type)
return CELL_CAMERA_ERROR_DEVICE_NOT_FOUND;
}
switch (g_cfg.io.camera_type)
switch (g_cfg.io.camera_type.get())
{
case fake_camera_type::unknown: *type = CELL_CAMERA_TYPE_UNKNOWN; break;
case fake_camera_type::eyetoy: *type = CELL_CAMERA_EYETOY; break;

View file

@ -354,10 +354,9 @@ error_code cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::pt
}
// Get the baseLineY value
s32 baseLineY;
s32 ascent, descent, lineGap;
stbtt_GetFontVMetrics(font->stbfont, &ascent, &descent, &lineGap);
baseLineY = static_cast<int>(ascent * scale); // ???
const s32 baseLineY = static_cast<int>(ascent * scale); // ???
// Move the rendered character to the surface
unsigned char* buffer = vm::_ptr<unsigned char>(surface->buffer.addr());
@ -375,7 +374,7 @@ error_code cellFontRenderCharGlyphImage(vm::ptr<CellFont> font, u32 code, vm::pt
buffer[(static_cast<s32>(y) + ypos + yoff + baseLineY) * surface->width + static_cast<s32>(x) + xpos] = box[ypos * width + xpos];
}
}
stbtt_FreeBitmap(box, 0);
stbtt_FreeBitmap(box, nullptr);
return CELL_OK;
}
@ -389,7 +388,7 @@ error_code cellFontSetEffectSlant(vm::ptr<CellFont> font, float slantParam)
{
cellFont.trace("cellFontSetEffectSlant(font=*0x%x, slantParam=%f)", font, slantParam);
if (slantParam < -1.0 || slantParam > 1.0)
if (slantParam < -1.0f || slantParam > 1.0f)
{
return CELL_FONT_ERROR_INVALID_PARAMETER;
}

View file

@ -7,8 +7,6 @@
#include "Emu/Cell/lv2/sys_sync.h"
#include "cellFs.h"
#include "Utilities/StrUtil.h"
#include <mutex>
LOG_CHANNEL(cellFs);

View file

@ -1,6 +1,5 @@
#pragma once
#include "Emu/Cell/lv2/sys_fs.h"
#include "Emu/Memory/vm_ptr.h"
// CellFsRingBuffer.copy

View file

@ -18,8 +18,6 @@
#include "util/init_mutex.hpp"
#include "util/asm.hpp"
#include <thread>
LOG_CHANNEL(cellGame);
template<>

View file

@ -354,7 +354,7 @@ struct CellHddGameStatSet
typedef void(CellHddGameStatCallback)(vm::ptr<CellHddGameCBResult> cbResult, vm::ptr<CellHddGameStatGet> get, vm::ptr<CellHddGameStatSet> set);
typedef void(CellGameThemeInstallCallback)(u32 fileOffset, u32 readSize, vm::ptr<void> buf);
typedef void(CellGameDiscEjectCallback)(void);
typedef void(CellGameDiscEjectCallback)();
typedef void(CellGameDiscInsertCallback)(u32 discType, vm::ptr<char> titleId);
typedef void(CellDiscGameDiscEjectCallback)(void);
typedef void(CellDiscGameDiscEjectCallback)();
typedef void(CellDiscGameDiscInsertCallback)(u32 discType, vm::ptr<char> titleId);

View file

@ -124,7 +124,9 @@ struct gem_config
connected_controllers = 1;
break;
}
default: break;
case move_handler::null:
default:
break;
}
// Assign status and port number
@ -143,7 +145,7 @@ struct gem_config
*/
static bool check_gem_num(const u32 gem_num)
{
return gem_num >= 0 && gem_num < CELL_GEM_MAX_NUM;
return gem_num < CELL_GEM_MAX_NUM;
}
/**

View file

@ -93,6 +93,7 @@ error_code cellGifDecOpen(PMainHandle mainHandle, PPSubHandle subHandle, PSrc sr
current_subHandle.fd = idm::make<lv2_fs_object, lv2_file>(src->fileName.get_ptr(), std::move(file_s), 0, 0, real_path);
break;
}
default: break; // TODO
}
subHandle->set(vm::alloc(sizeof(GifStream), vm::main));
@ -131,6 +132,7 @@ error_code cellGifDecReadHeader(PMainHandle mainHandle, PSubHandle subHandle, PI
file->file.read(buffer, sizeof(buffer));
break;
}
default: break; // TODO
}
if (*utils::bless<be_t<u32>>(buffer + 0) != 0x47494638u ||
@ -217,6 +219,7 @@ error_code cellGifDecDecodeData(PMainHandle mainHandle, PSubHandle subHandle, vm
file->file.read(gif.get(), fileSize);
break;
}
default: break; // TODO
}
//Decode GIF file. (TODO: Is there any faster alternative? Can we do it without external libraries?)

View file

@ -6,7 +6,6 @@
#ifdef _WIN32
#include <windows.h>
#include <winhttp.h>
#include <codecvt>
#pragma comment(lib, "Winhttp.lib")
#endif

View file

@ -84,6 +84,7 @@ error_code cellJpgDecOpen(u32 mainHandle, vm::ptr<u32> subHandle, vm::ptr<CellJp
current_subHandle.fd = idm::make<lv2_fs_object, lv2_file>(src->fileName.get_ptr(), std::move(file_s), 0, 0, real_path);
break;
}
default: break; // TODO
}
// From now, every u32 subHandle argument is a pointer to a CellJpgDecSubHandle struct.
@ -146,6 +147,7 @@ error_code cellJpgDecReadHeader(u32 mainHandle, u32 subHandle, vm::ptr<CellJpgDe
file->file.read(buffer.get(), fileSize);
break;
}
default: break; // TODO
}
if (*utils::bless<le_t<u32>>(buffer.get() + 0) != 0xE0FFD8FF || // Error: Not a valid SOI header
@ -226,6 +228,7 @@ error_code cellJpgDecDecodeData(u32 mainHandle, u32 subHandle, vm::ptr<u8> data,
file->file.read(jpg.get(), fileSize);
break;
}
default: break; // TODO
}
//Decode JPG file. (TODO: Is there any faster alternative? Can we do it without external libraries?)

View file

@ -167,12 +167,11 @@ bool _L10nCodeParse(s32 code, HostCode& retCode)
s32 _OEM2Wide(HostCode oem_code, const std::string& src, std::wstring& dst)
{
//Such length returned should include the '\0' character.
s32 length = MultiByteToWideChar(oem_code, 0, src.c_str(), -1, NULL, 0);
const s32 length = MultiByteToWideChar(oem_code, 0, src.c_str(), -1, nullptr, 0);
wchar_t *store = new wchar_t[length]();
MultiByteToWideChar(oem_code, 0, src.c_str(), -1, (LPWSTR)store, length);
std::wstring result(store);
dst = result;
MultiByteToWideChar(oem_code, 0, src.c_str(), -1, static_cast<LPWSTR>(store), length);
dst = std::wstring(store);
delete[] store;
store = nullptr;
@ -184,12 +183,11 @@ s32 _OEM2Wide(HostCode oem_code, const std::string& src, std::wstring& dst)
s32 _Wide2OEM(HostCode oem_code, const std::wstring& src, std::string& dst)
{
//Such length returned should include the '\0' character.
s32 length = WideCharToMultiByte(oem_code, 0, src.c_str(), -1, NULL, 0, NULL, NULL);
const s32 length = WideCharToMultiByte(oem_code, 0, src.c_str(), -1, nullptr, 0, nullptr, nullptr);
char *store = new char[length]();
WideCharToMultiByte(oem_code, 0, src.c_str(), -1, store, length, NULL, NULL);
std::string result(store);
dst = result;
WideCharToMultiByte(oem_code, 0, src.c_str(), -1, store, length, nullptr, nullptr);
dst = std::string(store);
delete[] store;
store = nullptr;
@ -219,10 +217,10 @@ s32 _ConvertStr(s32 src_code, const void *src, s32 src_len, s32 dst_code, void *
return ConverterUnknown;
#ifdef _MSC_VER
std::string wrapped_source = std::string(static_cast<const char *>(src), src_len);
std::string target = _OemToOem(srcCode, dstCode, wrapped_source);
const std::string wrapped_source = std::string(static_cast<const char *>(src), src_len);
const std::string target = _OemToOem(srcCode, dstCode, wrapped_source);
if (dst != NULL)
if (dst != nullptr)
{
if (target.length() > *dst_len) return DSTExhausted;
memcpy(dst, target.c_str(), target.length());

View file

@ -155,6 +155,7 @@ void mic_context::load_config_and_init()
mic_list.at(0).add_device(device_list[0]);
break;
}
case microphone_handler::null:
default: break;
}
}
@ -211,6 +212,7 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
}
break;
case microphone_handler::rocksmith: num_channels = 1; break;
case microphone_handler::null:
default: ensure(false); break;
}
@ -226,7 +228,7 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
num_al_channels = AL_FORMAT_STEREO16;
break;
case 4:
if (alcIsExtensionPresent(NULL, "AL_EXT_MCFORMATS") == AL_TRUE)
if (alcIsExtensionPresent(nullptr, "AL_EXT_MCFORMATS") == AL_TRUE)
{
num_al_channels = AL_FORMAT_QUAD16;
}
@ -437,6 +439,7 @@ void microphone_device::get_raw(const u32 num_samples)
}
break;
case microphone_handler::null:
default: ensure(false); break;
}
@ -491,6 +494,7 @@ void microphone_device::get_dsp(const u32 num_samples)
}
break;
case microphone_handler::null:
default: ensure(false); break;
}

View file

@ -9,12 +9,9 @@
#include "cellNetCtl.h"
#include "Utilities/StrUtil.h"
#include "Emu/IdManager.h"
#include "Emu/NP/np_handler.h"
#include <thread>
LOG_CHANNEL(cellNetCtl);
template <>
@ -228,7 +225,7 @@ struct netstart_hack
{
static constexpr std::string_view thread_name = "NetStart Hack";
void operator()(int)
void operator()(int) const
{
thread_ctrl::wait_for(500'000);

View file

@ -140,7 +140,7 @@ error_code cellOskDialogLoadAsync(u32 container, vm::ptr<CellOskDialogParam> dia
atomic_t<bool> result = false;
osk->on_osk_close = [maxLength, wptr = std::weak_ptr<OskDialogBase>(osk)](s32 status)
osk->on_osk_close = [wptr = std::weak_ptr<OskDialogBase>(osk)](s32 status)
{
const auto osk = wptr.lock();

View file

@ -148,6 +148,7 @@ u8 pamfGetStreamType(vm::ptr<CellPamfReader> pSelf, u32 stream)
case 0x80: return CELL_PAMF_STREAM_TYPE_PAMF_LPCM;
case 0x81: return CELL_PAMF_STREAM_TYPE_AC3;
case 0xdd: return CELL_PAMF_STREAM_TYPE_USER_DATA;
default: break;
}
cellPamf.todo("pamfGetStreamType(): unsupported stream type found(0x%x)", header.type);
@ -196,6 +197,7 @@ u8 pamfGetStreamChannel(vm::ptr<CellPamfReader> pSelf, u32 stream)
ensure((header.fid_minor & 0xf0) == 0x20);
return header.fid_minor % 16;
}
default: break;
}
cellPamf.todo("pamfGetStreamChannel(): unsupported stream type found(0x%x)", header.type);

View file

@ -446,7 +446,7 @@ public:
{
}
u32 get_max_size() const
static u32 get_max_size()
{
return sq_size;
}

View file

@ -2,9 +2,9 @@
#include "Emu/VFS.h"
#include "Emu/IdManager.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_fs.h"
#include "png.h"
#include "cellPng.h"
#include "cellPngDec.h"
#if PNG_LIBPNG_VER_MAJOR >= 1 && (PNG_LIBPNG_VER_MINOR < 5 \
@ -579,7 +579,7 @@ error_code pngDecSetParameter(PStream stream, PInParam in_param, POutParam out_p
}
// flag to keep unknown chunks
png_set_keep_unknown_chunks(stream->png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, 0, 0);
png_set_keep_unknown_chunks(stream->png_ptr, PNG_HANDLE_CHUNK_IF_SAFE, nullptr, 0);
// Scale 16 bit depth down to 8 bit depth.
if (stream->info.bitDepth == 16u && in_param->outputBitDepth == 8u)

View file

@ -1,7 +1,5 @@
#pragma once
#include "cellPng.h"
#include "Emu/Memory/vm_ptr.h"
#include "png.h"

View file

@ -72,7 +72,7 @@ error_code cellRecOpen(vm::cptr<char> pDirName, vm::cptr<char> pFileName, vm::cp
rec.cb = cb;
rec.cbUserData = cbUserData;
sysutil_register_cb([=, &rec](ppu_thread& ppu) -> s32
sysutil_register_cb([=](ppu_thread& ppu) -> s32
{
cb(ppu, CELL_REC_STATUS_OPEN, CELL_OK, cbUserData);
return CELL_OK;

View file

@ -584,8 +584,8 @@ error_code cellRtcParseRfc3339(vm::ptr<CellRtcTick> pUtc, vm::cptr<char> pszDate
char char_1 = pszDateTime[1];
char char_2 = pszDateTime[2];
char char_3 = pszDateTime[3];
if (((((((*pszDateTime - 0x30U) < 10) && ('/' < char_1)) && (char_1 < ':')) && (('/' < char_2 && (char_2 < ':')))) && ('/' < char_3)) && (char_3 < ':'))
const char char_3 = pszDateTime[3];
if (((*pszDateTime - 0x30U) < 10) && ('/' < char_1) && (char_1 < ':') && ('/' < char_2) && (char_2 < ':') && ('/' < char_3) && (char_3 < ':'))
{
date_time->year = (char_2 << 1) + (char_2 << 3) + *pszDateTime * 1000 + char_1 * 100 + char_3 + 0x2fb0;
}

View file

@ -643,7 +643,7 @@ error_code cellSailPlayerInitialize2(ppu_thread& ppu,
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_STATE_CHANGED;
event.u32x2.minor = 0;
pSelf->callback(ppu, pSelf->callbackArg, event, CELL_SAIL_PLAYER_STATE_INITIALIZED, 0);
};
}
return CELL_OK;
}
@ -782,7 +782,7 @@ error_code cellSailPlayerBoot(ppu_thread& ppu, vm::ptr<CellSailPlayer> pSelf, u6
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_STATE_CHANGED;
event.u32x2.minor = 0;
pSelf->callback(ppu, pSelf->callbackArg, event, CELL_SAIL_PLAYER_STATE_BOOT_TRANSITION, 0);
};
}
// TODO: Do stuff here
pSelf->booted = true;
@ -792,7 +792,7 @@ error_code cellSailPlayerBoot(ppu_thread& ppu, vm::ptr<CellSailPlayer> pSelf, u6
event.u32x2.major = CELL_SAIL_EVENT_PLAYER_CALL_COMPLETED;
event.u32x2.minor = CELL_SAIL_PLAYER_CALL_BOOT;
pSelf->callback(ppu, pSelf->callbackArg, event, 0, 0);
};
}
return CELL_OK;
}

View file

@ -591,7 +591,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr<CellSearchContentId> list
av_format_ctx = avformat_alloc_context();
// Open input file
if (avformat_open_input(&av_format_ctx, (vfs::get(vpath) + "/" + item.name).c_str(), 0, &av_dict_opts) < 0)
if (avformat_open_input(&av_format_ctx, (vfs::get(vpath) + "/" + item.name).c_str(), nullptr, &av_dict_opts) < 0)
{
// Failed to open file
av_dict_free(&av_dict_opts);
@ -601,7 +601,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr<CellSearchContentId> list
av_dict_free(&av_dict_opts);
// Find stream information
if (avformat_find_stream_info(av_format_ctx, 0) < 0)
if (avformat_find_stream_info(av_format_ctx, nullptr) < 0)
{
// Failed to load stream information
avformat_free_context(av_format_ctx);
@ -671,14 +671,14 @@ error_code cellSearchStartContentSearchInList(vm::cptr<CellSearchContentId> list
std::string value;
info.trackNumber = 0;
tag = av_dict_get(av_format_ctx->metadata, "track", 0, AV_DICT_IGNORE_SUFFIX);
tag = av_dict_get(av_format_ctx->metadata, "track", nullptr, AV_DICT_IGNORE_SUFFIX);
if (tag != nullptr)
{
std::string tmp(tag->value);
info.trackNumber = stoi(tmp.substr(0, tmp.find("/")));
info.trackNumber = stoi(tmp.substr(0, tmp.find('/')));
}
tag = av_dict_get(av_format_ctx->metadata, "album", 0, AV_DICT_IGNORE_SUFFIX);
tag = av_dict_get(av_format_ctx->metadata, "album", nullptr, AV_DICT_IGNORE_SUFFIX);
if (tag != nullptr)
{
value = tag->value;
@ -718,7 +718,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr<CellSearchContentId> list
}
}
tag = av_dict_get(av_format_ctx->metadata, "artist", 0, AV_DICT_IGNORE_SUFFIX);
tag = av_dict_get(av_format_ctx->metadata, "artist", nullptr, AV_DICT_IGNORE_SUFFIX);
if (tag != nullptr)
{
value = tag->value;
@ -733,7 +733,7 @@ error_code cellSearchStartContentSearchInList(vm::cptr<CellSearchContentId> list
strcpy_trunc(info.artistName, "Unknown Artist");
}
tag = av_dict_get(av_format_ctx->metadata, "genre", 0, AV_DICT_IGNORE_SUFFIX);
tag = av_dict_get(av_format_ctx->metadata, "genre", nullptr, AV_DICT_IGNORE_SUFFIX);
if (tag != nullptr)
{
value = tag->value;

View file

@ -772,7 +772,7 @@ struct alignas(128) CellSpurs
}
}
u8 wklStatus(u32 wid)
u8 wklStatus(u32 wid) const
{
if (wid & 0x10)
{

View file

@ -1,10 +1,7 @@
#include "stdafx.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_lwmutex.h"
#include "Emu/Cell/lv2/sys_lwcond.h"
#include "Emu/Cell/lv2/sys_spu.h"
#include "cellSpurs.h"
#include "cellSpursJq.h"
LOG_CHANNEL(cellSpursJq);

View file

@ -1,6 +1,5 @@
#include "stdafx.h"
#include "Loader/ELF.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Memory/vm_reservation.h"
#include "Emu/Cell/SPUThread.h"
@ -10,9 +9,6 @@
#include "Emu/Cell/lv2/sys_spu.h"
#include "cellSpurs.h"
#include <thread>
#include <mutex>
#include "util/asm.hpp"
#include "util/v128.hpp"
#include "util/v128sse.hpp"

View file

@ -24,8 +24,8 @@ enum CellStorageDataParamSize
CELL_STORAGEDATA_TITLE_MAX = 256
};
const char* CELL_STORAGEDATA_IMPORT_FILENAME = "IMPORT.BIN";
const char* CELL_STORAGEDATA_EXPORT_FILENAME = "EXPORT.BIN";
inline const char* CELL_STORAGEDATA_IMPORT_FILENAME = "IMPORT.BIN";
inline const char* CELL_STORAGEDATA_EXPORT_FILENAME = "EXPORT.BIN";
struct CellStorageDataSetParam
{

View file

@ -48,6 +48,7 @@ error_code cellSubDisplayGetRequiredMemory(vm::ptr<CellSubDisplayParam> pParam)
case CELL_SUBDISPLAY_VERSION_0001: return not_an_error(CELL_SUBDISPLAY_0001_MEMORY_CONTAINER_SIZE);
case CELL_SUBDISPLAY_VERSION_0002: return not_an_error(CELL_SUBDISPLAY_0002_MEMORY_CONTAINER_SIZE);
case CELL_SUBDISPLAY_VERSION_0003: return not_an_error(CELL_SUBDISPLAY_0003_MEMORY_CONTAINER_SIZE);
default: break;
}
return CELL_SUBDISPLAY_ERROR_INVALID_VALUE;

View file

@ -68,7 +68,7 @@ struct syscache_info
}
}
void clear(bool remove_root) noexcept
void clear(bool remove_root) const noexcept
{
// Clear cache
if (!vfs::host::remove_all(cache_root + cache_id, cache_root, &g_mp_sys_dev_hdd1, remove_root))

View file

@ -157,6 +157,7 @@ void fmt_class_string<CellSysutilParamId>::format(std::string& out, u64 arg)
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1011: return "ID_x1011";
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1012: return "ID_x1012";
case CELL_SYSUTIL_SYSTEMPARAM_ID_x1024: return "ID_x1024";
default: break;
}
return unknown;

View file

@ -883,7 +883,7 @@ error_code cellVdecGetPicture(u32 handle, vm::cptr<CellVdecPicFormat> format, vm
}
}
vdec->sws = sws_getCachedContext(vdec->sws, w, h, in_f, w, h, out_f, SWS_POINT, NULL, NULL, NULL);
vdec->sws = sws_getCachedContext(vdec->sws, w, h, in_f, w, h, out_f, SWS_POINT, nullptr, nullptr, nullptr);
u8* in_data[4] = { frame->data[0], frame->data[1], frame->data[2], alpha_plane.get() };
int in_line[4] = { frame->linesize[0], frame->linesize[1], frame->linesize[2], w * 1 };

View file

@ -277,14 +277,14 @@ error_code cellVpostExec(u32 handle, vm::cptr<u8> inPicBuff, vm::cptr<CellVpostC
//u64 stamp1 = get_guest_system_time();
vpost->sws = sws_getCachedContext(vpost->sws, w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, NULL, NULL, NULL);
vpost->sws = sws_getCachedContext(vpost->sws, w, h, AV_PIX_FMT_YUVA420P, ow, oh, AV_PIX_FMT_RGBA, SWS_BILINEAR, nullptr, nullptr, nullptr);
//u64 stamp2 = get_guest_system_time();
const u8* in_data[4] = { &inPicBuff[0], &inPicBuff[w * h], &inPicBuff[w * h * 5 / 4], pA.get() };
int ws = w;
int in_line[4] = { ws, ws/2, ws/2, ws };
u8* out_data[4] = { outPicBuff.get_ptr(), NULL, NULL, NULL };
u8* out_data[4] = { outPicBuff.get_ptr(), nullptr, nullptr, nullptr };
int out_line[4] = { static_cast<int>(ow * 4), 0, 0, 0 };
sws_scale(vpost->sws, in_data, in_line, 0, h, out_data, out_line);

View file

@ -6,7 +6,6 @@
#include "libmixer.h"
#include <cmath>
#include <thread>
#include <mutex>
LOG_CHANNEL(libmixer);

View file

@ -2875,7 +2875,7 @@ error_code sceNpManagerRequestTicket(vm::cptr<SceNpId> npId, vm::cptr<char> serv
return SCE_NP_ERROR_INVALID_STATE;
}
nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast<const u8 *>(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount);
nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), static_cast<const u8*>(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount);
return CELL_OK;
}
@ -2908,7 +2908,7 @@ error_code sceNpManagerRequestTicket2(vm::cptr<SceNpId> npId, vm::cptr<SceNpTick
return SCE_NP_ERROR_INVALID_STATE;
}
nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), reinterpret_cast<const u8 *>(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount);
nph.req_ticket(0x00020001, npId.get_ptr(), serviceId.get_ptr(), static_cast<const u8*>(cookie.get_ptr()), cookieSize, entitlementId.get_ptr(), consumedCount);
return CELL_OK;
}

View file

@ -18,7 +18,6 @@
#include "Emu/Cell/lv2/sys_process.h"
#include "Emu/Cell/lv2/sys_fs.h"
#include <cmath>
#include <shared_mutex>
#include "util/asm.hpp"
@ -827,6 +826,7 @@ error_code sceNpTrophyGetGameInfo(u32 context, u32 handle, vm::ptr<SceNpTrophyGa
case 'S': data->unlockedSilver++; break;
case 'G': data->unlockedGold++; break;
case 'P': data->unlockedPlatinum++; break;
default: break;
}
}
}
@ -1038,6 +1038,7 @@ static error_code NpTrophyGetTrophyInfo(const trophy_context_t* ctxt, s32 trophy
case 'S': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_SILVER; break;
case 'G': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_GOLD; break;
case 'P': tmp_details.trophyGrade = SCE_NP_TROPHY_GRADE_PLATINUM; break;
default: break;
}
for (std::shared_ptr<rXmlNode> n2 = n->GetChildren(); n2; n2 = n2->GetNext())

View file

@ -93,17 +93,10 @@ s32 sce_np_tus_manager::add_transaction_context(s32 titleCtxId)
bool sce_np_tus_manager::check_transaction_context_id(s32 transId)
{
for (const auto& title_context : title_contexts)
return std::any_of(title_contexts.cbegin(), title_contexts.cend(), [&transId](const auto& c)
{
const auto& transactions = title_context.second.transaction_contexts;
if (transactions.find(transId) != transactions.end())
{
return true;
}
}
return false;
return c.second.transaction_contexts.contains(transId);
});
}
bool sce_np_tus_manager::remove_transaction_context_id(s32 transId)
@ -202,7 +195,7 @@ error_code sceNpTusCreateTitleCtx(vm::cptr<SceNpCommunicationId> communicationId
return SCE_NP_COMMUNITY_ERROR_TOO_MANY_OBJECTS;
}
return not_an_error(id);;
return not_an_error(id);
}
error_code sceNpTusDestroyTitleCtx(s32 titleCtxId)

View file

@ -2,8 +2,6 @@
#include "Emu/Cell/lv2/sys_tty.h"
#include "Emu/Cell/PPUModule.h"
#include "Utilities/cfmt.h"
#include <string.h>
#include <ctype.h>
LOG_CHANNEL(sysPrxForUser);
@ -16,7 +14,7 @@ struct ps3_fmt_src
ppu_thread* ctx;
u32 g_count;
bool test(usz) const
static bool test(usz)
{
return true;
}
@ -40,7 +38,7 @@ struct ps3_fmt_src
return out.size() - start;
}
usz type(usz) const
static usz type(usz)
{
return 0;
}

View file

@ -3,7 +3,6 @@
#include "Emu/Cell/lv2/sys_lwmutex.h"
#include "Emu/Cell/lv2/sys_lwcond.h"
#include "Emu/Cell/lv2/sys_mutex.h"
#include "Emu/Cell/lv2/sys_cond.h"
#include "sysPrxForUser.h"
@ -100,7 +99,7 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
}
// if locking succeeded
lwmutex->lock_var.atomic_op([](typename sys_lwmutex_t::sync_var_t& var)
lwmutex->lock_var.atomic_op([](sys_lwmutex_t::sync_var_t& var)
{
var.waiter++;
var.owner = lwmutex_reserved;
@ -114,7 +113,7 @@ error_code sys_lwcond_signal(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond)
return 0;
}
lwmutex->lock_var.atomic_op([&](typename sys_lwmutex_t::sync_var_t& var)
lwmutex->lock_var.atomic_op([&](sys_lwmutex_t::sync_var_t& var)
{
var.waiter--;
var.owner = ppu.id;
@ -253,7 +252,7 @@ error_code sys_lwcond_signal_to(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u
}
// if locking succeeded
lwmutex->lock_var.atomic_op([](typename sys_lwmutex_t::sync_var_t& var)
lwmutex->lock_var.atomic_op([](sys_lwmutex_t::sync_var_t& var)
{
var.waiter++;
var.owner = lwmutex_reserved;
@ -267,7 +266,7 @@ error_code sys_lwcond_signal_to(ppu_thread& ppu, vm::ptr<sys_lwcond_t> lwcond, u
return 0;
}
lwmutex->lock_var.atomic_op([&](typename sys_lwmutex_t::sync_var_t& var)
lwmutex->lock_var.atomic_op([&](sys_lwmutex_t::sync_var_t& var)
{
var.waiter--;
var.owner = ppu.id;

View file

@ -2,7 +2,6 @@
#include "Emu/VFS.h"
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/lv2/sys_spu.h"
#include "Crypto/unself.h"
#include "Loader/ELF.h"
@ -23,7 +22,7 @@ struct spu_elf_ldr
be_t<u64> ehdr_off;
be_t<u64> phdr_off;
s32 get_ehdr(vm::ptr<elf_ehdr<elf_be, u64>> out)
s32 get_ehdr(vm::ptr<elf_ehdr<elf_be, u64>> out) const
{
if (!src)
{
@ -57,7 +56,7 @@ struct spu_elf_ldr
return 0;
}
s32 get_phdr(vm::ptr<elf_phdr<elf_be, u64>> out, u32 count)
s32 get_phdr(vm::ptr<elf_phdr<elf_be, u64>> out, u32 count) const
{
if (!src)
{

View file

@ -1189,7 +1189,7 @@ struct ppu_acontext
}
// Range XOR
spec_gpr operator ^(const spec_gpr& rhs)
spec_gpr operator ^(const spec_gpr& rhs) const
{
return (~*this & rhs) | (*this & ~rhs);
}

View file

@ -1063,6 +1063,7 @@ std::shared_ptr<lv2_prx> ppu_load_prx(const ppu_prx_object& elf, const std::stri
break;
}
default : break;
}
}

View file

@ -97,6 +97,7 @@ PPUTranslator::PPUTranslator(LLVMContext& context, Module* _module, const ppu_mo
ppu_log.error("Ignoring 64-bit relocation at 0x%x (%u)", rel.addr, rel.type);
continue;
}
default: break;
}
// Align relocation address (TODO)

View file

@ -8,7 +8,7 @@ inline void try_start(spu_thread& spu)
{
reader_lock lock(spu.run_ctrl_mtx);
if (spu.status_npc.fetch_op([](typename spu_thread::status_npc_sync_var& value)
if (spu.status_npc.fetch_op([](spu_thread::status_npc_sync_var& value)
{
if (value.status & SPU_STATUS_RUNNING)
{

View file

@ -17,7 +17,6 @@
#include "util/sysinfo.hpp"
#include <cmath>
#include <mutex>
#include <thread>
#define SPU_OFF_128(x, ...) asmjit::x86::oword_ptr(*cpu, offset32(&spu_thread::x, ##__VA_ARGS__))
@ -1514,6 +1513,7 @@ void spu_recompiler::RDCH(spu_opcode_t op)
c->movdqa(SPU_OFF_128(gpr, op.rt), vr);
return;
}
default: break;
}
c->lea(addr->r64(), get_pc(m_pos));
@ -2505,6 +2505,7 @@ void spu_recompiler::WRCH(spu_opcode_t op)
{
return;
}
default: break;
}
c->lea(addr->r64(), get_pc(m_pos));

View file

@ -164,7 +164,7 @@ std::pair<bool, v128> SPUDisAsm::try_get_const_value(u32 reg, u32 pc) const
return {};
}
typename SPUDisAsm::insert_mask_info SPUDisAsm::try_get_insert_mask_info(const v128& mask)
SPUDisAsm::insert_mask_info SPUDisAsm::try_get_insert_mask_info(const v128& mask)
{
if ((mask & v128::from8p(0xe0)) != v128{})
{

View file

@ -96,8 +96,7 @@ private:
}
}
private:
std::string& FixOp(std::string& op)
std::string& FixOp(std::string& op) const
{
if (m_mode != cpu_disasm_mode::normal)
{

View file

@ -738,7 +738,7 @@ spu_function_t spu_runtime::rebuild_ubertrampoline(u32 id_inst)
workload.back().size = size0;
workload.back().level = 0;
workload.back().from = -1;
workload.back().rel32 = 0;
workload.back().rel32 = nullptr;
workload.back().beg = beg;
workload.back().end = _end;
@ -1760,6 +1760,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
m_use_rb[pos / 4] = s_reg_mfc_eal;
break;
}
default: break;
}
break;
@ -3226,11 +3227,8 @@ void spu_recompiler_base::dump(const spu_program& result, std::string& out)
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Verifier.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/Analysis/Lint.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/Transforms/Scalar.h"
#include "llvm/Transforms/IPO.h"
#include "llvm/Transforms/Vectorize.h"
#ifdef _MSC_VER
#pragma warning(pop)
#else
@ -6160,6 +6158,7 @@ public:
{
return;
}
default: break;
}
update_pc();

View file

@ -321,7 +321,7 @@ public:
static void old_interpreter(spu_thread&, void* ls, u8*);
// Get the function data at specified address
spu_program analyse(const be_t<u32>* ls, u32 lsa);
spu_program analyse(const be_t<u32>* ls, u32 entry_point);
// Print analyser internal state
void dump(const spu_program& result, std::string& out);

View file

@ -20,9 +20,7 @@
#include "Emu/Cell/SPUDisAsm.h"
#include "Emu/Cell/SPUAnalyser.h"
#include "Emu/Cell/SPUThread.h"
#include "Emu/Cell/SPUInterpreter.h"
#include "Emu/Cell/SPURecompiler.h"
#include "Emu/Cell/RawSPUThread.h"
#include "Emu/Cell/timers.hpp"
#include <cmath>
@ -3106,7 +3104,7 @@ bool spu_thread::is_exec_code(u32 addr) const
return true;
}
u32 spu_thread::get_mfc_completed()
u32 spu_thread::get_mfc_completed() const
{
return ch_tag_mask & ~mfc_fence;
}
@ -3123,7 +3121,7 @@ bool spu_thread::process_mfc_cmd()
return false;
}
thread_ctrl::wait_on(state, old);;
thread_ctrl::wait_on(state, old);
}
spu::scheduler::concurrent_execution_watchdog watchdog(*this);
@ -3487,7 +3485,7 @@ bool spu_thread::process_mfc_cmd()
ch_mfc_cmd.cmd, ch_mfc_cmd.lsa, ch_mfc_cmd.eal, ch_mfc_cmd.tag, ch_mfc_cmd.size);
}
bool spu_thread::reservation_check(u32 addr, const decltype(rdata)& data)
bool spu_thread::reservation_check(u32 addr, const decltype(rdata)& data) const
{
if (!addr)
{

View file

@ -5,7 +5,6 @@
#include "Emu/Memory/vm.h"
#include "MFC.h"
#include <map>
#include "util/v128.hpp"
#include "util/logs.hpp"
#include "util/to_endian.hpp"
@ -354,12 +353,12 @@ public:
data.release(u64{count} << off_count | value);
}
u32 get_value()
u32 get_value() const
{
return static_cast<u32>(data);
}
u32 get_count()
u32 get_count() const
{
return static_cast<u32>(data >> off_count);
}
@ -790,13 +789,13 @@ public:
void do_putlluc(const spu_mfc_cmd& args);
bool do_putllc(const spu_mfc_cmd& args);
void do_mfc(bool wait = true);
u32 get_mfc_completed();
u32 get_mfc_completed() const;
bool process_mfc_cmd();
ch_events_t get_events(u32 mask_hint = -1, bool waiting = false, bool reading = false);
void set_events(u32 bits);
void set_interrupt_status(bool enable);
bool check_mfc_interrupts(u32 nex_pc);
bool check_mfc_interrupts(u32 next_pc);
bool is_exec_code(u32 addr) const; // Only a hint, do not rely on it other than debugging purposes
u32 get_ch_count(u32 ch);
s64 get_ch_value(u32 ch);
@ -834,7 +833,7 @@ public:
// Returns true if reservation existed but was just discovered to be lost
// It is safe to use on any address, even if not directly accessed by SPU (so it's slower)
bool reservation_check(u32 addr, const decltype(rdata)& data);
bool reservation_check(u32 addr, const decltype(rdata)& data) const;
bool read_reg(const u32 addr, u32& value);
bool write_reg(const u32 addr, const u32 value);

View file

@ -1075,7 +1075,7 @@ extern void ppu_execute_syscall(ppu_thread& ppu, u64 code)
{
g_fxo->get<named_thread<ppu_syscall_usage>>().stat[code]++;
if (auto func = g_ppu_syscall_table[code].first)
if (const auto func = g_ppu_syscall_table[code].first)
{
func(ppu);
ppu_log.trace("Syscall '%s' (%llu) finished, r3=0x%llx", ppu_syscall_code(code), code, ppu.gpr[3]);
@ -1263,6 +1263,7 @@ bool lv2_obj::awake_unlocked(cpu_thread* cpu, s32 prio)
break;
}
}
break;
}
case enqueue_cmd:
{

View file

@ -26,7 +26,7 @@ error_code sys_cond_create(ppu_thread& ppu, vm::ptr<u32> cond_id, u32 mutex_id,
const auto _attr = *attr;
if (auto error = lv2_obj::create<lv2_cond>(_attr.pshared, _attr.ipc_key, _attr.flags, [&]
if (const auto error = lv2_obj::create<lv2_cond>(_attr.pshared, _attr.ipc_key, _attr.flags, [&]
{
return std::make_shared<lv2_cond>(
_attr.pshared,
@ -59,7 +59,7 @@ error_code sys_cond_destroy(ppu_thread& ppu, u32 cond_id)
return CELL_EBUSY;
}
cond.mutex->obj_count.atomic_op([](typename lv2_mutex::count_info& info){ info.cond_count--; });
cond.mutex->obj_count.atomic_op([](lv2_mutex::count_info& info){ info.cond_count--; });
return {};
});
@ -224,7 +224,7 @@ error_code sys_cond_wait(ppu_thread& ppu, u32 cond_id, u64 timeout)
// Unlock the mutex
const auto count = cond.mutex->lock_count.exchange(0);
if (auto cpu = cond.mutex->reown<ppu_thread>())
if (const auto cpu = cond.mutex->reown<ppu_thread>())
{
cond.mutex->append(cpu);
}

View file

@ -42,9 +42,9 @@ struct lv2_cond final : lv2_obj
{
}
CellError on_id_create()
CellError on_id_create() const
{
if (!mutex->obj_count.fetch_op([](typename lv2_mutex::count_info& info)
if (!mutex->obj_count.fetch_op([](lv2_mutex::count_info& info)
{
if (info.mutex_count)
return info.cond_count++, true;

View file

@ -115,7 +115,7 @@ void lv2_config::remove_service_event(u32 id)
// LV2 Config Service Listener
bool lv2_config_service_listener::check_service(const lv2_config_service& service)
bool lv2_config_service_listener::check_service(const lv2_config_service& service) const
{
// Filter by type
if (type == SYS_CONFIG_SERVICE_LISTENER_ONCE && !service_events.empty())
@ -152,7 +152,7 @@ bool lv2_config_service_listener::notify(const std::shared_ptr<lv2_config_servic
return false;
// Create service event and notify queue!
auto event = lv2_config_service_event::create(handle, service, *this);
const auto event = lv2_config_service_event::create(handle, service, *this);
return notify(event);
}
@ -216,7 +216,7 @@ void lv2_config_service::notify() const
bool lv2_config_service_event::notify() const
{
auto _handle = handle.lock();
const auto _handle = handle.lock();
if (!_handle)
{
return false;
@ -228,9 +228,9 @@ bool lv2_config_service_event::notify() const
// LV2 Config Service Event
void lv2_config_service_event::write(sys_config_service_event_t *dst)
void lv2_config_service_event::write(sys_config_service_event_t *dst) const
{
auto registered = service->is_registered();
const auto registered = service->is_registered();
dst->service_listener_handle = listener.get_id();
dst->registered = registered;
@ -242,7 +242,7 @@ void lv2_config_service_event::write(sys_config_service_event_t *dst)
dst->verbosity = service->verbosity;
dst->padding = service->padding;
auto size = service->data.size();
const auto size = service->data.size();
dst->data_size = static_cast<u32>(size);
memcpy(dst->data, service->data.data(), size);
}
@ -390,7 +390,7 @@ error_code sys_config_register_service(u32 config_hdl, sys_config_service_id ser
}
// Create service
auto service = lv2_config_service::create(service_id, user_id, verbosity, 0, data_buf.get_ptr(), size);
const auto service = lv2_config_service::create(service_id, user_id, verbosity, 0, data_buf.get_ptr(), size);
if (!service)
{
return CELL_EAGAIN;

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