1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-21 18:22:33 +01:00

Warning fixes

This commit is contained in:
Nekotekina 2022-09-13 16:08:55 +03:00 committed by Ivan
parent e7fd84e031
commit b49a1f27eb
63 changed files with 165 additions and 208 deletions

View File

@ -74,7 +74,7 @@ namespace fs
using enable_bitcopy = std::true_type; using enable_bitcopy = std::true_type;
constexpr bool operator==(const stat_t&) const = default; constexpr bool operator==(const stat_t&) const = default;
}; };
// Helper, layout is equal to iovec struct // Helper, layout is equal to iovec struct
@ -793,7 +793,8 @@ namespace fs
if (write) if (write)
{ {
m_stat.mtime = std::max(m_stat.atime, ++m_stat.mtime); m_stat.mtime++;
m_stat.mtime = std::max(m_stat.atime, m_stat.mtime);
m_stat.ctime = m_stat.mtime; m_stat.ctime = m_stat.mtime;
} }
} }

View File

@ -16,7 +16,9 @@
#include <process.h> #include <process.h>
#include <sysinfoapi.h> #include <sysinfoapi.h>
#else #else
#ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#endif
#ifdef __APPLE__ #ifdef __APPLE__
#define _XOPEN_SOURCE #define _XOPEN_SOURCE
#define __USE_GNU #define __USE_GNU

View File

@ -30,7 +30,8 @@ namespace utils
if (lo()) if (lo())
{ {
version += "." + std::to_string(lo()); version += '.';
version += std::to_string(lo());
} }
if (type() != version_type::release) if (type() != version_type::release)
@ -40,7 +41,8 @@ namespace utils
version += "-" + postfix(); version += "-" + postfix();
} }
version += " " + utils::to_string(type()); version += ' ';
version += utils::to_string(type());
if (type_index() > 1) if (type_index() > 1)
{ {

View File

@ -55,6 +55,7 @@ void fmt_class_string<cpu_flag>::format(std::string& out, u64 arg)
case cpu_flag::memory: return "mem"; case cpu_flag::memory: return "mem";
case cpu_flag::pending: return "pend"; case cpu_flag::pending: return "pend";
case cpu_flag::pending_recheck: return "pend-re"; case cpu_flag::pending_recheck: return "pend-re";
case cpu_flag::notify: return "ntf";
case cpu_flag::yield: return "y"; case cpu_flag::yield: return "y";
case cpu_flag::preempt: return "PREEMPT"; case cpu_flag::preempt: return "PREEMPT";
case cpu_flag::dbg_global_pause: return "G-PAUSE"; case cpu_flag::dbg_global_pause: return "G-PAUSE";
@ -648,7 +649,7 @@ bool cpu_thread::check_state() noexcept
{ {
bool cpu_sleep_called = false; bool cpu_sleep_called = false;
bool cpu_can_stop = true; bool cpu_can_stop = true;
bool escape, retval; bool escape{}, retval{};
while (true) while (true)
{ {

View File

@ -454,30 +454,8 @@ public:
if (adecIsAtracX(type)) last_pts -= 0x10000; // hack if (adecIsAtracX(type)) last_pts -= 0x10000; // hack
} }
struct AVPacketHolder : AVPacket AVPacket* packet = av_packet_alloc();
{ std::unique_ptr<AVPacket, decltype([](AVPacket* p){av_packet_unref(p);})> packet_(packet);
AVPacketHolder(u32 data_size)
{
av_init_packet(this);
if (data_size)
{
this->data = static_cast<u8*>(av_calloc(1, data_size + AV_INPUT_BUFFER_PADDING_SIZE));
this->size = data_size + AV_INPUT_BUFFER_PADDING_SIZE;
}
else
{
this->data = nullptr;
this->size = 0;
}
}
~AVPacketHolder()
{
av_free(data);
}
} au(0);
if (just_started && just_finished) if (just_started && just_finished)
{ {
@ -544,8 +522,6 @@ public:
just_started = false; just_started = false;
} }
bool last_frame = false;
while (true) while (true)
{ {
if (Emu.IsStopped() || is_closed) if (Emu.IsStopped() || is_closed)
@ -554,14 +530,7 @@ public:
break; break;
} }
last_frame = av_read_frame(fmt, &au) < 0; av_read_frame(fmt, packet);
if (last_frame)
{
//break;
av_free(au.data);
au.data = NULL;
au.size = 0;
}
struct AdecFrameHolder : AdecFrame struct AdecFrameHolder : AdecFrame
{ {

View File

@ -175,7 +175,7 @@ static error_code check_camera_info(const VariantOfCellCameraInfo& info)
return CELL_CAMERA_ERROR_BAD_FRAMERATE; return CELL_CAMERA_ERROR_BAD_FRAMERATE;
} }
auto check_fps = [fps = info.framerate](const std::vector<s32>& range) auto check_fps = [fps = info.framerate](std::initializer_list<s32> range)
{ {
return std::find(range.begin(), range.end(), fps) != range.end(); return std::find(range.begin(), range.end(), fps) != range.end();
}; };

View File

@ -477,5 +477,3 @@ struct gem_camera_shared
atomic_t<s32> size{0}; atomic_t<s32> size{0};
atomic_t<CellCameraFormat> format{CELL_CAMERA_RAW8}; atomic_t<CellCameraFormat> format{CELL_CAMERA_RAW8};
}; };
static inline s32 get_video_buffer_size(s32 width, s32 height);

View File

@ -52,7 +52,7 @@ struct cross_controller
close_msg_dialog(); close_msg_dialog();
sysutil_register_cb([=](ppu_thread& ppu) -> s32 sysutil_register_cb([this, status](ppu_thread& ppu) -> s32
{ {
callback(ppu, CELL_CROSS_CONTROLLER_STATUS_FINALIZED, status, vm::null, userdata); callback(ppu, CELL_CROSS_CONTROLLER_STATUS_FINALIZED, status, vm::null, userdata);
return CELL_OK; return CELL_OK;
@ -74,9 +74,9 @@ struct cross_controller
// TODO: Show icons from comboplay_plugin.rco in dialog. Maybe use a new dialog or add an optional icon to this one. // TODO: Show icons from comboplay_plugin.rco in dialog. Maybe use a new dialog or add an optional icon to this one.
error_code res = open_msg_dialog(false, CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF, vm::make_str(msg), msg_dialog_callback, userdata); error_code res = open_msg_dialog(false, CELL_MSGDIALOG_TYPE_DISABLE_CANCEL_OFF, vm::make_str(msg), msg_dialog_callback, userdata);
sysutil_register_cb([=](ppu_thread& ppu) -> s32 sysutil_register_cb([this, res](ppu_thread& ppu) -> s32
{ {
callback(ppu, CELL_CROSS_CONTROLLER_STATUS_INITIALIZED, res == CELL_OK ? CELL_OK : CELL_CROSS_CONTROLLER_ERROR_INTERNAL, vm::null, userdata); callback(ppu, CELL_CROSS_CONTROLLER_STATUS_INITIALIZED, res == CELL_OK ? +CELL_OK : +CELL_CROSS_CONTROLLER_ERROR_INTERNAL, vm::null, userdata);
return CELL_OK; return CELL_OK;
}); });

View File

@ -1531,7 +1531,8 @@ error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr<char
return CELL_GAME_ERROR_PARAM; return CELL_GAME_ERROR_PARAM;
} }
error_msg += "\n" + get_localized_string(localized_string_id::CELL_GAME_ERROR_DIR_NAME, fmt::format("%s", dirName).c_str()); error_msg += '\n';
error_msg += get_localized_string(localized_string_id::CELL_GAME_ERROR_DIR_NAME, fmt::format("%s", dirName).c_str());
} }
return open_exit_dialog(error_msg, type > CELL_GAME_ERRDIALOG_NOSPACE); return open_exit_dialog(error_msg, type > CELL_GAME_ERRDIALOG_NOSPACE);

View File

@ -322,7 +322,7 @@ error_code cellGcmBindZcull(u8 index, u32 offset, u32 width, u32 height, u32 cul
{ {
return err; return err;
} }
vm::_ptr<CellGcmZcullInfo>(gcm_cfg.zculls_addr)[index] = gcm_zcull; vm::_ptr<CellGcmZcullInfo>(gcm_cfg.zculls_addr)[index] = gcm_zcull;
return CELL_OK; return CELL_OK;
} }
@ -1314,8 +1314,6 @@ void _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptr<CellGcmContext
{ {
cellGcmSys.warning("cellGcmSetFlipCommandWithWaitLabel(ctx=*0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", ctx, id, label_index, label_value); cellGcmSys.warning("cellGcmSetFlipCommandWithWaitLabel(ctx=*0x%x, id=0x%x, label_index=0x%x, label_value=0x%x)", ctx, id, label_index, label_value);
auto& gcm_cfg = g_fxo->get<gcm_config>();
rsx::make_command(ctx->current, NV406E_SEMAPHORE_OFFSET, { label_index * 0x10, label_value }); rsx::make_command(ctx->current, NV406E_SEMAPHORE_OFFSET, { label_index * 0x10, label_value });
if (auto error = gcmSetPrepareFlip<true>(ppu, ctx, id); error < 0) if (auto error = gcmSetPrepareFlip<true>(ppu, ctx, id); error < 0)

View File

@ -446,7 +446,7 @@ static bool check_gem_num(const u32 gem_num)
return gem_num < CELL_GEM_MAX_NUM; return gem_num < CELL_GEM_MAX_NUM;
} }
static inline void draw_overlay_cursor(u32 gem_num, const gem_config::gem_controller& controller, s32 x_pos, s32 y_pos, s32 x_max, s32 y_max) static inline void draw_overlay_cursor(u32 gem_num, const gem_config::gem_controller&, s32 x_pos, s32 y_pos, s32 x_max, s32 y_max)
{ {
const u16 x = static_cast<u16>(x_pos / (x_max / static_cast<f32>(rsx::overlays::overlay::virtual_width))); const u16 x = static_cast<u16>(x_pos / (x_max / static_cast<f32>(rsx::overlays::overlay::virtual_width)));
const u16 y = static_cast<u16>(y_pos / (y_max / static_cast<f32>(rsx::overlays::overlay::virtual_height))); const u16 y = static_cast<u16>(y_pos / (y_max / static_cast<f32>(rsx::overlays::overlay::virtual_height)));

View File

@ -1120,7 +1120,7 @@ error_code cellHttpAuthCacheExport(vm::ptr<u32> buf, u32 len, vm::ptr<u32> outsi
// TODO // TODO
} }
u32 size = 0; [[maybe_unused]] u32 size = 0;
// TODO // TODO
@ -2786,7 +2786,7 @@ error_code cellHttpClientAddHeader(CellHttpClientId clientId, vm::cptr<CellHttpH
error_code cellHttpClientDeleteHeader(CellHttpClientId clientId, vm::cptr<char> name) error_code cellHttpClientDeleteHeader(CellHttpClientId clientId, vm::cptr<char> name)
{ {
cellHttp.todo("cellHttpClientDeleteHeader(clientId=0x%x, name=%s)", clientId, name); cellHttp.todo("cellHttpClientDeleteHeader(clientId=0x%x, name=%s)", clientId, name);
auto& man = g_fxo->get<http_manager>(); auto& man = g_fxo->get<http_manager>();
std::lock_guard lock(man.mtx); std::lock_guard lock(man.mtx);
@ -2806,7 +2806,7 @@ error_code cellHttpClientDeleteHeader(CellHttpClientId clientId, vm::cptr<char>
error_code cellHttpClientSetSslCallback(CellHttpClientId clientId, vm::ptr<CellHttpsSslCallback> cbfunc, vm::ptr<void> userArg) error_code cellHttpClientSetSslCallback(CellHttpClientId clientId, vm::ptr<CellHttpsSslCallback> cbfunc, vm::ptr<void> userArg)
{ {
cellHttp.todo("cellHttpClientSetSslCallback(clientId=0x%x, cbfunc=*0x%x, userArg=*0x%x)", clientId, cbfunc, userArg); cellHttp.todo("cellHttpClientSetSslCallback(clientId=0x%x, cbfunc=*0x%x, userArg=*0x%x)", clientId, cbfunc, userArg);
auto& man = g_fxo->get<http_manager>(); auto& man = g_fxo->get<http_manager>();
std::lock_guard lock(man.mtx); std::lock_guard lock(man.mtx);

View File

@ -230,7 +230,7 @@ error_code cellHttpUtilBuildRequestLine(vm::cptr<CellHttpRequestLine> req, vm::p
std::string path = fmt::format("%s", req->path); std::string path = fmt::format("%s", req->path);
if (path.empty()) if (path.empty())
{ {
path = "/"; path += '/';
} }
// TODO: are the numbers properly formatted ? // TODO: are the numbers properly formatted ?
@ -805,7 +805,7 @@ error_code cellHttpUtilBase64Encoder(vm::ptr<char> out, vm::cptr<void> input, u3
error_code cellHttpUtilBase64Decoder(vm::ptr<char> output, vm::cptr<void> in, u32 len) error_code cellHttpUtilBase64Decoder(vm::ptr<char> output, vm::cptr<void> in, u32 len)
{ {
cellHttpUtil.todo("cellHttpUtilBase64Decoder(output=*0x%x, in=*0x%x, len=%d)", output, in, len); cellHttpUtil.todo("cellHttpUtilBase64Decoder(output=*0x%x, in=*0x%x, len=%d)", output, in, len);
if (!in) if (!in)
{ {

View File

@ -43,10 +43,9 @@ bool ime_jp_manager::addChar(u16 c)
if (!c || cursor >= (CELL_IMEJP_STRING_MAXLENGTH - 1) || cursor > input_string.length()) if (!c || cursor >= (CELL_IMEJP_STRING_MAXLENGTH - 1) || cursor > input_string.length())
return false; return false;
std::u16string tmp; input_string += c; // resize
tmp += c; std::memmove(input_string.data() + cursor + 1, input_string.data() + cursor, sizeof(u16) * (input_string.size() - 1 - cursor));
input_string.insert(cursor++, tmp); cursor_end = ++cursor;
cursor_end = cursor;
input_state = CELL_IMEJP_BEFORE_CONVERT; input_state = CELL_IMEJP_BEFORE_CONVERT;
return true; return true;
} }

View File

@ -49,7 +49,7 @@ KeyboardHandlerBase::KeyboardHandlerBase(utils::serial* ar)
Emu.DeferDeserialization([this]() Emu.DeferDeserialization([this]()
{ {
Init(m_info.max_connect); Init(m_info.max_connect);
init.init(); auto lk = init.init();
}); });
} }
} }

View File

@ -56,5 +56,3 @@ struct CellKbConfig
be_t<u32> read_mode; be_t<u32> read_mode;
be_t<u32> code_type; be_t<u32> code_type;
}; };
u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);

View File

@ -49,7 +49,7 @@ MouseHandlerBase::MouseHandlerBase(utils::serial* ar)
Emu.DeferDeserialization([this]() Emu.DeferDeserialization([this]()
{ {
Init(m_info.max_connect); Init(m_info.max_connect);
init.init(); auto lk = init.init();
}); });
} }
} }

View File

@ -42,7 +42,7 @@ bool check_config(vm::cptr<CellPngEncConfig> config)
if (!config || if (!config ||
config->maxWidth == 0u || config->maxWidth > 1000000u || config->maxWidth == 0u || config->maxWidth > 1000000u ||
config->maxHeight == 0u || config->maxHeight > 1000000u || config->maxHeight == 0u || config->maxHeight > 1000000u ||
config->maxBitDepth != 8u && config->maxBitDepth != 16u || (config->maxBitDepth != 8u && config->maxBitDepth != 16u) ||
static_cast<s32>(config->addMemSize) < 0 || static_cast<s32>(config->addMemSize) < 0 ||
config->exParamNum != 0u) config->exParamNum != 0u)
{ {

View File

@ -148,7 +148,7 @@ int check_filename(std::string_view file_path, bool disallow_system_files, bool
return 70; return 70;
} }
char name[CELL_SAVEDATA_FILENAME_SIZE - 3]; char name[CELL_SAVEDATA_FILENAME_SIZE + 3];
if (dotpos) if (dotpos)
{ {

View File

@ -315,7 +315,7 @@ error_code cellSysutilAvc2EstimateMemoryContainerSize(vm::cptr<CellSysutilAvc2In
val += static_cast<s32>(static_cast<f64>(window_count) * 1258291.2) + 0x1ed846; val += static_cast<s32>(static_cast<f64>(window_count) * 1258291.2) + 0x1ed846;
} }
estimated_size = (estimated_size + ((static_cast<int>(val) >> 7) + static_cast<u32>(static_cast<int>(val) < 0 && (val & 0x7f) != 0)) * 0x80 + 0x80080 & 0xfff00000) + 0x100000; estimated_size = ((estimated_size + ((static_cast<int>(val) >> 7) + static_cast<u32>(static_cast<int>(val) < 0 && (val & 0x7f) != 0)) * 0x80 + 0x80080) & 0xfff00000) + 0x100000;
*size = estimated_size; *size = estimated_size;
} }

View File

@ -636,14 +636,12 @@ struct vdec_creation_lock
vdec_creation_lock() vdec_creation_lock()
{ {
locked.init(); auto lk = locked.init();
} }
}; };
extern bool try_lock_vdec_context_creation() extern bool try_lock_vdec_context_creation()
{ {
bool exist = false;
auto& lock = g_fxo->get<vdec_creation_lock>(); auto& lock = g_fxo->get<vdec_creation_lock>();
auto reset = lock.locked.reset(); auto reset = lock.locked.reset();

View File

@ -69,7 +69,7 @@ struct sce_np_util_manager
} }
}; };
error_code sceNpUtilBandwidthTestInitStart(ppu_thread& ppu, u32 prio, u32 stack) error_code sceNpUtilBandwidthTestInitStart([[maybe_unused]] ppu_thread& ppu, u32 prio, u32 stack)
{ {
sceNpUtil.todo("sceNpUtilBandwidthTestInitStart(prio=%d, stack=%d)", prio, stack); sceNpUtil.todo("sceNpUtilBandwidthTestInitStart(prio=%d, stack=%d)", prio, stack);
@ -101,7 +101,7 @@ error_code sceNpUtilBandwidthTestGetStatus()
return not_an_error(util_manager.bandwidth_test_thread->status); return not_an_error(util_manager.bandwidth_test_thread->status);
} }
error_code sceNpUtilBandwidthTestShutdown(ppu_thread& ppu, vm::ptr<SceNpUtilBandwidthTestResult> result) error_code sceNpUtilBandwidthTestShutdown([[maybe_unused]] ppu_thread& ppu, vm::ptr<SceNpUtilBandwidthTestResult> result)
{ {
sceNpUtil.warning("sceNpUtilBandwidthTestShutdown(result=*0x%x)", result); sceNpUtil.warning("sceNpUtilBandwidthTestShutdown(result=*0x%x)", result);

View File

@ -23,6 +23,7 @@
#if !defined(_MSC_VER) #if !defined(_MSC_VER)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif #endif
extern bool is_debugger_present(); extern bool is_debugger_present();

View File

@ -38,7 +38,7 @@ extern void sys_initialize_tls(ppu_thread&, u64, u32, u32, u32);
// HLE function name cache // HLE function name cache
std::vector<std::string> g_ppu_function_names; std::vector<std::string> g_ppu_function_names;
extern atomic_t<u32> liblv2_begin = 0, liblv2_end = 0; atomic_t<u32> liblv2_begin = 0, liblv2_end = 0;
extern u32 ppu_generate_id(std::string_view name) extern u32 ppu_generate_id(std::string_view name)
{ {
@ -340,7 +340,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
while (true) while (true)
{ {
const std::string name = ar.operator std::string(); const std::string name = ar.operator std::string();
if (name.empty()) if (name.empty())
{ {
// Null termination // Null termination
@ -350,7 +350,7 @@ static void ppu_initialize_modules(ppu_linkage_info* link, utils::serial* ar = n
const auto _module = manager.at(name); const auto _module = manager.at(name);
auto& variable = _module->variables; auto& variable = _module->variables;
for (u32 i = 0, end = ar.operator usz(); i < end; i++) for (u32 i = 0, end = ar.operator usz(); i < end; i++)
{ {
auto* ptr = &variable.at(ar.operator u32()); auto* ptr = &variable.at(ar.operator u32());
@ -2466,7 +2466,7 @@ bool ppu_load_rel_exec(const ppu_rel_object& elf)
const auto& s = *ptr; const auto& s = *ptr;
ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast<u32>(s.sh_type), s.sh_addr, s.sh_size, s._sh_flags); ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast<u32>(s.sh_type), s.sh_addr, s.sh_size, s._sh_flags);
if (s.sh_type == sec_type::sht_progbits && s.sh_size && s.sh_flags().all_of(sh_flag::shf_alloc)) if (s.sh_type == sec_type::sht_progbits && s.sh_size && s.sh_flags().all_of(sh_flag::shf_alloc))
{ {
ppu_segment _sec; ppu_segment _sec;

View File

@ -721,7 +721,7 @@ struct ppu_far_jumps_t
c.bind(imm_address); c.bind(imm_address);
c.embedUInt32(pc); c.embedUInt32(pc);
#endif #endif
}, &rt); }, &rt);
} }
return it->second.func; return it->second.func;
@ -1712,7 +1712,7 @@ ppu_thread::ppu_thread(utils::serial& ar)
{ {
cmd_list cmd_list
({ ({
{ppu_cmd::ptr_call, 0}, +[](ppu_thread& ppu) -> bool {ppu_cmd::ptr_call, 0}, +[](ppu_thread&) -> bool
{ {
while (!Emu.IsStopped() && !g_fxo->get<init_pushed>().inited) while (!Emu.IsStopped() && !g_fxo->get<init_pushed>().inited)
{ {
@ -1799,7 +1799,7 @@ void ppu_thread::save(utils::serial& ar)
if (_joiner >= ppu_join_status::max) if (_joiner >= ppu_join_status::max)
{ {
// Joining thread should recover this member properly // Joining thread should recover this member properly
_joiner = ppu_join_status::joinable; _joiner = ppu_join_status::joinable;
} }
if (state & cpu_flag::again) if (state & cpu_flag::again)
@ -2888,7 +2888,7 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
std::string upper = fmt::to_upper(entry.name); std::string upper = fmt::to_upper(entry.name);
// Skip already loaded modules or HLEd ones // Skip already loaded modules or HLEd ones
auto is_ignored = [&](s64 offset) -> bool auto is_ignored = [&](s64 /*offset*/) -> bool
{ {
if (dir_queue[i] != firmware_sprx_path) if (dir_queue[i] != firmware_sprx_path)
{ {

View File

@ -291,7 +291,7 @@ struct spu_itype
// Test for constant loading instruction // Test for constant loading instruction
friend constexpr bool operator &(type value, constant_tag) friend constexpr bool operator &(type value, constant_tag)
{ {
return value >= CBD && value <= FSMBI; return value >= ILH && value <= FSMBI;
} }
}; };

View File

@ -3411,7 +3411,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
} }
case spu_itype::OR: case spu_itype::OR:
{ {
bb.reg_const[op.rt] = bb.reg_const[op.ra] & bb.reg_const[op.rb]; bb.reg_const[op.rt] = bb.reg_const[op.ra] && bb.reg_const[op.rb];
bb.reg_val32[op.rt] = bb.reg_val32[op.ra] | bb.reg_val32[op.rb]; bb.reg_val32[op.rt] = bb.reg_val32[op.ra] | bb.reg_val32[op.rb];
break; break;
} }
@ -3423,7 +3423,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
} }
case spu_itype::A: case spu_itype::A:
{ {
bb.reg_const[op.rt] = bb.reg_const[op.ra] & bb.reg_const[op.rb]; bb.reg_const[op.rt] = bb.reg_const[op.ra] && bb.reg_const[op.rb];
bb.reg_val32[op.rt] = bb.reg_val32[op.ra] + bb.reg_val32[op.rb]; bb.reg_val32[op.rt] = bb.reg_val32[op.ra] + bb.reg_val32[op.rb];
break; break;
} }
@ -3435,7 +3435,7 @@ spu_program spu_recompiler_base::analyse(const be_t<u32>* ls, u32 entry_point)
} }
case spu_itype::SF: case spu_itype::SF:
{ {
bb.reg_const[op.rt] = bb.reg_const[op.ra] & bb.reg_const[op.rb]; bb.reg_const[op.rt] = bb.reg_const[op.ra] && bb.reg_const[op.rb];
bb.reg_val32[op.rt] = bb.reg_val32[op.rb] - bb.reg_val32[op.ra]; bb.reg_val32[op.rt] = bb.reg_val32[op.rb] - bb.reg_val32[op.ra];
break; break;
} }

View File

@ -1344,7 +1344,7 @@ bool lv2_obj::sleep_unlocked(cpu_thread& thread, u64 timeout, u64 current_time)
val += cpu_flag::suspend; val += cpu_flag::suspend;
// Flag used for forced timeout notification // Flag used for forced timeout notification
ensure(!timeout || !(val & cpu_flag::notify)); ensure(!timeout || !(val & cpu_flag::notify));
return true; return true;
} }
@ -1660,7 +1660,7 @@ void lv2_obj::schedule_all(u64 current_time)
} }
} }
if (notify_later_idx - 1 < std::size(g_to_notify) - 1) if (notify_later_idx - 1 < std::size(g_to_notify) - 1)
{ {
// Null-terminate the list if it ends before last slot // Null-terminate the list if it ends before last slot
g_to_notify[notify_later_idx] = nullptr; g_to_notify[notify_later_idx] = nullptr;
@ -1906,3 +1906,9 @@ bool lv2_obj::wait_timeout(u64 usec, ppu_thread* cpu, bool scale, bool is_usleep
return true; return true;
} }
void lv2_obj::prepare_for_sleep(cpu_thread& cpu)
{
vm::temporary_unlock(cpu);
cpu_counter::remove(&cpu);
}

View File

@ -1156,7 +1156,7 @@ error_code sys_fs_opendir(ppu_thread& ppu, vm::cptr<char> path, vm::ptr<u32> fd)
} }
else else
{ {
data.emplace_back().name = "."; data.emplace_back().name += '.';
data.back().is_directory = true; data.back().is_directory = true;
data.emplace_back().name = ".."; data.emplace_back().name = "..";
data.back().is_directory = true; data.back().is_directory = true;

View File

@ -256,7 +256,8 @@ std::optional<s32> lv2_socket_p2p::sendto(s32 flags, const std::vector<u8>& buf,
sys_net.trace("[P2P] Sending a packet to %s:%d:%d", ip_str, p2p_port, p2p_vport); sys_net.trace("[P2P] Sending a packet to %s:%d:%d", ip_str, p2p_port, p2p_vport);
std::vector<u8> p2p_data(buf.size() + sizeof(u16)); std::vector<u8> p2p_data(buf.size() + sizeof(u16));
reinterpret_cast<le_t<u16>&>(p2p_data[0]) = p2p_vport; const le_t<u16> p2p_vport_le = p2p_vport;
memcpy(p2p_data.data(), &p2p_vport_le, sizeof(u16));
memcpy(p2p_data.data() + sizeof(u16), buf.data(), buf.size()); memcpy(p2p_data.data() + sizeof(u16), buf.data(), buf.size());
int native_flags = 0; int native_flags = 0;

View File

@ -206,8 +206,9 @@ std::vector<u8> generate_u2s_packet(const p2ps_encapsulated_tcp& header, const u
ensure(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload ensure(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload
std::vector<u8> packet(packet_size); std::vector<u8> packet(packet_size);
u8* packet_data = packet.data(); u8* packet_data = packet.data();
le_t<u16> dst_port_le = +header.dst_port;
*reinterpret_cast<le_t<u16>*>(packet_data) = header.dst_port; memcpy(packet_data, &dst_port_le, sizeof(u16));
memcpy(packet_data + sizeof(u16), &header, sizeof(p2ps_encapsulated_tcp)); memcpy(packet_data + sizeof(u16), &header, sizeof(p2ps_encapsulated_tcp));
if (datasize) if (datasize)
memcpy(packet_data + sizeof(u16) + sizeof(p2ps_encapsulated_tcp), data, datasize); memcpy(packet_data + sizeof(u16) + sizeof(p2ps_encapsulated_tcp), data, datasize);

View File

@ -84,7 +84,7 @@ std::shared_ptr<void> lv2_overlay::load(utils::serial& ar)
ensure(g_cfg.savestate.state_inspection_mode.get()); ensure(g_cfg.savestate.state_inspection_mode.get());
} }
return std::move(ovlm); return ovlm;
} }
void lv2_overlay::save(utils::serial& ar) void lv2_overlay::save(utils::serial& ar)

View File

@ -10,7 +10,7 @@ struct lv2_overlay final : lv2_obj, ppu_module
u32 entry; u32 entry;
lv2_overlay() = default; lv2_overlay() = default;
lv2_overlay(utils::serial& ar){} lv2_overlay(utils::serial&){}
static std::shared_ptr<void> load(utils::serial& ar); static std::shared_ptr<void> load(utils::serial& ar);
void save(utils::serial& ar); void save(utils::serial& ar);
}; };

View File

@ -343,7 +343,7 @@ std::shared_ptr<void> lv2_prx::load(utils::serial& ar)
} }
prx->state = state; prx->state = state;
return std::move(prx); return prx;
} }
void lv2_prx::save(utils::serial& ar) void lv2_prx::save(utils::serial& ar)

View File

@ -437,17 +437,13 @@ public:
auto operator<=>(const port_config&) const = default; auto operator<=>(const port_config&) const = default;
}; };
union avport_bit struct avport_bit
{ {
struct bool hdmi_0 : 1;
{ bool hdmi_1 : 1;
bool hdmi_0 : 1; bool avmulti : 1;
bool hdmi_1 : 1; bool spdif_0 : 1;
bool avmulti : 1; bool spdif_1 : 1;
bool spdif_0 : 1;
bool spdif_1 : 1;
};
u8 raw : 5 = 0;
}; };
rsxaudio_backend_thread(); rsxaudio_backend_thread();

View File

@ -61,16 +61,6 @@ enum
enum ppu_thread_status : u32; enum ppu_thread_status : u32;
namespace vm
{
bool temporary_unlock(cpu_thread& cpu) noexcept;
}
namespace cpu_counter
{
void remove(cpu_thread*) noexcept;
}
// Base class for some kernel objects (shared set of 8192 objects). // Base class for some kernel objects (shared set of 8192 objects).
struct lv2_obj struct lv2_obj
{ {
@ -121,7 +111,7 @@ public:
static T* unqueue(T*& first, T* object, T* T::* mem_ptr = &T::next_cpu) static T* unqueue(T*& first, T* object, T* T::* mem_ptr = &T::next_cpu)
{ {
auto it = +first; auto it = +first;
if (it == object) if (it == object)
{ {
atomic_storage<T*>::release(first, it->*mem_ptr); atomic_storage<T*>::release(first, it->*mem_ptr);
@ -432,11 +422,7 @@ public:
} }
// Can be called before the actual sleep call in order to move it out of mutex scope // Can be called before the actual sleep call in order to move it out of mutex scope
static inline void prepare_for_sleep(cpu_thread& cpu) static void prepare_for_sleep(cpu_thread& cpu);
{
vm::temporary_unlock(cpu);
cpu_counter::remove(&cpu);
}
struct notify_all_t struct notify_all_t
{ {
@ -446,7 +432,7 @@ public:
} }
notify_all_t(const notify_all_t&) = delete; notify_all_t(const notify_all_t&) = delete;
static void cleanup() static void cleanup()
{ {
for (auto& cpu : g_to_notify) for (auto& cpu : g_to_notify)

View File

@ -180,7 +180,7 @@ void initialize_timebased_time(u64 timebased_init, bool reset)
} }
const u64 current = get_timebased_time(); const u64 current = get_timebased_time();
timebased_init = get_timebased_time() - timebased_init; timebased_init = current - timebased_init;
timebase_offset = timebased_init; timebase_offset = timebased_init;
systemtime_offset = timebased_init / (g_timebase_freq / 1000000); systemtime_offset = timebased_init / (g_timebase_freq / 1000000);

View File

@ -756,7 +756,8 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd)
// we have to remove dbg_pause from thread that paused execution, otherwise // we have to remove dbg_pause from thread that paused execution, otherwise
// it will be paused forever (Emu.Resume only removes dbg_global_pause) // it will be paused forever (Emu.Resume only removes dbg_global_pause)
ppu = std::static_pointer_cast<named_thread<ppu_thread>>(selected_thread.lock()); ppu = std::static_pointer_cast<named_thread<ppu_thread>>(selected_thread.lock());
ppu->state -= cpu_flag::dbg_pause; if (ppu)
ppu->state -= cpu_flag::dbg_pause;
return send_reason(); return send_reason();
} }
return send_cmd_ack(""); return send_cmd_ack("");

View File

@ -47,7 +47,7 @@ namespace IPC_socket
vm::write64(addr, value); vm::write64(addr, value);
} }
const int IPC_impl::get_port() int IPC_impl::get_port()
{ {
return g_cfg_ipc.get_port(); return g_cfg_ipc.get_port();
} }
@ -85,7 +85,7 @@ namespace IPC_socket
return Emu.GetAppVersion(); return Emu.GetAppVersion();
} }
const std::string IPC_impl::get_version_and_branch() std::string IPC_impl::get_version_and_branch()
{ {
return rpcs3::get_version_and_branch(); return rpcs3::get_version_and_branch();
} }

View File

@ -33,13 +33,13 @@ namespace IPC_socket
IPC.error(fmt, std::forward<Args>(args)...); IPC.error(fmt, std::forward<Args>(args)...);
} }
static const int get_port(); static int get_port();
static pine::EmuStatus get_status(); static pine::EmuStatus get_status();
static const std::string& get_title(); static const std::string& get_title();
static const std::string& get_title_ID(); static const std::string& get_title_ID();
static const std::string& get_executable_hash(); static const std::string& get_executable_hash();
static const std::string& get_app_version(); static const std::string& get_app_version();
static const std::string get_version_and_branch(); static std::string get_version_and_branch();
public: public:
static auto constexpr thread_name = "IPC Server"sv; static auto constexpr thread_name = "IPC Server"sv;

View File

@ -59,13 +59,10 @@ namespace id_manager
{ {
static_assert(IdmCompatible<T>, "ID object must specify: id_base, id_step, id_count"); static_assert(IdmCompatible<T>, "ID object must specify: id_base, id_step, id_count");
enum : u32 static constexpr u32 base = T::id_base; // First ID (N = 0)
{ static constexpr u32 step = T::id_step; // Any ID: N * id_setp + id_base
base = T::id_base, // First ID (N = 0) static constexpr u32 count = T::id_count; // Limit: N < id_count
step = T::id_step, // Any ID: N * id_setp + id_base static constexpr u32 invalid = -+!base; // Invalid ID sample
count = T::id_count, // Limit: N < id_count
invalid = -+!base, // Invalid ID sample
};
static constexpr std::pair<u32, u32> invl_range = get_invl_range<T>(); static constexpr std::pair<u32, u32> invl_range = get_invl_range<T>();
static constexpr bool uses_lowest_id = get_force_lowest_id<T>(); static constexpr bool uses_lowest_id = get_force_lowest_id<T>();
@ -284,7 +281,7 @@ namespace id_manager
info = std::addressof(typeinfo.second); info = std::addressof(typeinfo.second);
} }
} }
ensure(info); ensure(info);
// Construct each object from information collected // Construct each object from information collected
@ -292,7 +289,7 @@ namespace id_manager
// Simulate construction semantics (idm::last_id() value) // Simulate construction semantics (idm::last_id() value)
g_id = id; g_id = id;
auto& obj = vec[get_index(id, info->base, info->step, info->count, info->invl_range)]; auto& obj = vec[get_index(id, info->base, info->step, info->count, info->invl_range)];
ensure(!obj.second); ensure(!obj.second);
obj.first = id_key(id, static_cast<u32>(static_cast<u64>(type_init_pos >> 64))); obj.first = id_key(id, static_cast<u32>(static_cast<u64>(type_init_pos >> 64)));
@ -492,7 +489,7 @@ class idm
using traits = id_manager::id_traits<Type>; using traits = id_manager::id_traits<Type>;
// Ensure make_typeinfo() is used for this type // Ensure make_typeinfo() is used for this type
stx::typedata<id_manager::typeinfo, Type>(); [[maybe_unused]] auto& td = stx::typedata<id_manager::typeinfo, Type>();
// Allocate new id // Allocate new id
std::lock_guard lock(id_manager::g_mutex); std::lock_guard lock(id_manager::g_mutex);
@ -703,7 +700,7 @@ public:
{ {
static_assert((PtrSame<T, Get> && ...), "Invalid ID type combination"); static_assert((PtrSame<T, Get> && ...), "Invalid ID type combination");
std::conditional_t<static_cast<bool>(Lock()), reader_lock, const shared_mutex&> lock(id_manager::g_mutex); [[maybe_unused]] std::conditional_t<!!Lock(), reader_lock, const shared_mutex&> lock(id_manager::g_mutex);
using func_traits = function_traits<decltype(&decltype(std::function(std::declval<F>()))::operator())>; using func_traits = function_traits<decltype(&decltype(std::function(std::declval<F>()))::operator())>;
using object_type = typename func_traits::object_type; using object_type = typename func_traits::object_type;

View File

@ -206,3 +206,5 @@ enum CellKbMappingType : s32
CELL_KB_MAPPING_PORTUGUESE_BRAZIL = 23, CELL_KB_MAPPING_PORTUGUESE_BRAZIL = 23,
CELL_KB_MAPPING_TURKISH_TURKEY = 24 CELL_KB_MAPPING_TURKISH_TURKEY = 24
}; };
u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);

View File

@ -7,8 +7,6 @@
#include "util/init_mutex.hpp" #include "util/init_mutex.hpp"
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); // (TODO: Can it be problematic to place SysCalls in middle of nowhere?)
enum QtKeys enum QtKeys
{ {
Key_Shift = 0x01000020, Key_Shift = 0x01000020,
@ -36,7 +34,7 @@ struct KbButton
u32 m_keyCode = 0; u32 m_keyCode = 0;
u32 m_outKeyCode = 0; u32 m_outKeyCode = 0;
bool m_pressed = false; bool m_pressed = false;
KbButton() = default; KbButton() = default;
KbButton(u32 keyCode, u32 outKeyCode, bool pressed = false) KbButton(u32 keyCode, u32 outKeyCode, bool pressed = false)
: m_keyCode(keyCode) : m_keyCode(keyCode)

View File

@ -108,8 +108,8 @@ void usb_device_usio::translate_input()
const auto handler = pad::get_current_handler(); const auto handler = pad::get_current_handler();
std::vector<u8> input_buf = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; std::vector<u8> input_buf = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0x60, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
constexpr u16 SMALL_HIT = 0x4A0; constexpr le_t<u16> c_small_hit = 0x4A0;
constexpr u16 BIG_HIT = 0xA40; constexpr le_t<u16> c_big_hit = 0xA40;
auto translate_from_pad = [&](u8 pad_number, u8 player) auto translate_from_pad = [&](u8 pad_number, u8 player)
{ {
@ -136,35 +136,35 @@ void usb_device_usio::translate_input()
{ {
case CELL_PAD_CTRL_SQUARE: case CELL_PAD_CTRL_SQUARE:
// Strong hit side left // Strong hit side left
*reinterpret_cast<le_t<u16>*>(&input_buf[32 + offset]) = BIG_HIT; std::memcpy(input_buf.data() + 32 + offset, &c_big_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_CROSS: case CELL_PAD_CTRL_CROSS:
// Strong hit center right // Strong hit center right
*reinterpret_cast<le_t<u16>*>(&input_buf[36 + offset]) = BIG_HIT; std::memcpy(input_buf.data() + 36 + offset, &c_big_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_CIRCLE: case CELL_PAD_CTRL_CIRCLE:
// Strong hit side right // Strong hit side right
*reinterpret_cast<le_t<u16>*>(&input_buf[38 + offset]) = BIG_HIT; std::memcpy(input_buf.data() + 38 + offset, &c_big_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_TRIANGLE: case CELL_PAD_CTRL_TRIANGLE:
// Strong hit center left // Strong hit center left
*reinterpret_cast<le_t<u16>*>(&input_buf[34 + offset]) = BIG_HIT; std::memcpy(input_buf.data() + 34 + offset, &c_big_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_L1: case CELL_PAD_CTRL_L1:
// Small hit center left // Small hit center left
*reinterpret_cast<le_t<u16>*>(&input_buf[34 + offset]) = SMALL_HIT; std::memcpy(input_buf.data() + 34 + offset, &c_small_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_R1: case CELL_PAD_CTRL_R1:
// Small hit center right // Small hit center right
*reinterpret_cast<le_t<u16>*>(&input_buf[36 + offset]) = SMALL_HIT; std::memcpy(input_buf.data() + 36 + offset, &c_small_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_L2: case CELL_PAD_CTRL_L2:
// Small hit side left // Small hit side left
*reinterpret_cast<le_t<u16>*>(&input_buf[32 + offset]) = SMALL_HIT; std::memcpy(input_buf.data() + 32 + offset, &c_small_hit, sizeof(u16));
break; break;
case CELL_PAD_CTRL_R2: case CELL_PAD_CTRL_R2:
// Small hit side right // Small hit side right
*reinterpret_cast<le_t<u16>*>(&input_buf[38 + offset]) = SMALL_HIT; std::memcpy(input_buf.data() + 38 + offset, &c_small_hit, sizeof(u16));
break; break;
default: default:
break; break;

View File

@ -1613,8 +1613,6 @@ namespace vm
m_common->map_critical(vm::get_super_ptr(addr)); m_common->map_critical(vm::get_super_ptr(addr));
} }
auto& m_map = (m.*block_map)();
std::shared_ptr<utils::shm> null_shm; std::shared_ptr<utils::shm> null_shm;
while (true) while (true)

View File

@ -27,34 +27,34 @@
#if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && defined(__AVX512BW__) #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && defined(__AVX512BW__)
[[maybe_unused]] constexpr bool s_use_ssse3 = true; [[maybe_unused]] constexpr bool s_use_ssse3 = true;
constexpr bool s_use_sse4_1 = true; [[maybe_unused]] constexpr bool s_use_sse4_1 = true;
constexpr bool s_use_avx2 = true; [[maybe_unused]] constexpr bool s_use_avx2 = true;
constexpr bool s_use_avx3 = true; [[maybe_unused]] constexpr bool s_use_avx3 = true;
#elif defined(__AVX2__) #elif defined(__AVX2__)
[[maybe_unused]] constexpr bool s_use_ssse3 = true; [[maybe_unused]] constexpr bool s_use_ssse3 = true;
constexpr bool s_use_sse4_1 = true; [[maybe_unused]] constexpr bool s_use_sse4_1 = true;
constexpr bool s_use_avx2 = true; [[maybe_unused]] constexpr bool s_use_avx2 = true;
constexpr bool s_use_avx3 = false; [[maybe_unused]] constexpr bool s_use_avx3 = false;
#elif defined(__SSE4_1__) #elif defined(__SSE4_1__)
[[maybe_unused]] constexpr bool s_use_ssse3 = true; [[maybe_unused]] constexpr bool s_use_ssse3 = true;
constexpr bool s_use_sse4_1 = true; [[maybe_unused]] constexpr bool s_use_sse4_1 = true;
constexpr bool s_use_avx2 = false; [[maybe_unused]] constexpr bool s_use_avx2 = false;
constexpr bool s_use_avx3 = false; [[maybe_unused]] constexpr bool s_use_avx3 = false;
#elif defined(__SSSE3__) #elif defined(__SSSE3__)
[[maybe_unused]] constexpr bool s_use_ssse3 = true; [[maybe_unused]] constexpr bool s_use_ssse3 = true;
constexpr bool s_use_sse4_1 = false; [[maybe_unused]] constexpr bool s_use_sse4_1 = false;
constexpr bool s_use_avx2 = false; [[maybe_unused]] constexpr bool s_use_avx2 = false;
constexpr bool s_use_avx3 = false; [[maybe_unused]] constexpr bool s_use_avx3 = false;
#elif defined(ARCH_X64) #elif defined(ARCH_X64)
[[maybe_unused]] const bool s_use_ssse3 = utils::has_ssse3(); [[maybe_unused]] const bool s_use_ssse3 = utils::has_ssse3();
const bool s_use_sse4_1 = utils::has_sse41(); [[maybe_unused]] const bool s_use_sse4_1 = utils::has_sse41();
const bool s_use_avx2 = utils::has_avx2(); [[maybe_unused]] const bool s_use_avx2 = utils::has_avx2();
const bool s_use_avx3 = utils::has_avx512(); [[maybe_unused]] const bool s_use_avx3 = utils::has_avx512();
#else #else
[[maybe_unused]] constexpr bool s_use_ssse3 = true; // Non x86 [[maybe_unused]] constexpr bool s_use_ssse3 = true; // Non x86
constexpr bool s_use_sse4_1 = true; // Non x86 [[maybe_unused]] constexpr bool s_use_sse4_1 = true; // Non x86
constexpr bool s_use_avx2 = false; [[maybe_unused]] constexpr bool s_use_avx2 = false;
constexpr bool s_use_avx3 = false; [[maybe_unused]] constexpr bool s_use_avx3 = false;
#endif #endif
const v128 s_bswap_u32_mask = v128::from32(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f); const v128 s_bswap_u32_mask = v128::from32(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f);

View File

@ -63,7 +63,7 @@ namespace rsx
{ {
// All is well // All is well
return *this; return *this;
} }
} }
// Data does not exist or is not contiguous. Merge the layer // Data does not exist or is not contiguous. Merge the layer
@ -87,7 +87,7 @@ namespace rsx
address += BlockSize; address += BlockSize;
} }
auto unified = Traits::merge_bo_list<BlockSize>(cmd, bo_list); auto unified = Traits::template merge_bo_list<BlockSize>(cmd, bo_list);
ensure(unified); ensure(unified);
m_buffer_list[block_for(start_address)].acquire(unified); m_buffer_list[block_for(start_address)].acquire(unified);

View File

@ -435,7 +435,7 @@ namespace rsx
if (!pitch_compatible) if (!pitch_compatible)
{ {
// This object should be pitch-converted and re-intersected with // This object should be pitch-converted and re-intersected with
if (old_surface_storage = Traits::convert_pitch(command_list, surface, pitch)) if (old_surface_storage = Traits::convert_pitch(command_list, surface, pitch); old_surface_storage)
{ {
old_surface = Traits::get(old_surface_storage); old_surface = Traits::get(old_surface_storage);
} }

View File

@ -9,7 +9,7 @@ namespace gl
{ {
blitter* g_hw_blitter = nullptr; blitter* g_hw_blitter = nullptr;
void blitter::copy_image(gl::command_context& cmd, const texture* src, const texture* dst, int src_level, int dst_level, const position3i& src_offset, const position3i& dst_offset, const size3i& size) const void blitter::copy_image(gl::command_context&, const texture* src, const texture* dst, int src_level, int dst_level, const position3i& src_offset, const position3i& dst_offset, const size3i& size) const
{ {
ensure(src_level == 0); ensure(src_level == 0);

View File

@ -1,4 +1,3 @@
#pragma once
#include "state_tracker.hpp" #include "state_tracker.hpp"
#include "vao.hpp" #include "vao.hpp"

View File

@ -62,7 +62,7 @@ std::string CgBinaryDisasm::GetMask() const
std::string CgBinaryDisasm::AddRegDisAsm(u32 index, int fp16) const std::string CgBinaryDisasm::AddRegDisAsm(u32 index, int fp16) const
{ {
return std::string(fp16 ? "H" : "R") + std::to_string(index); return (fp16 ? 'H' : 'R') + std::to_string(index);
} }
std::string CgBinaryDisasm::AddConstDisAsm() std::string CgBinaryDisasm::AddConstDisAsm()

View File

@ -124,7 +124,8 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n)
switch (src[n].reg_type) switch (src[n].reg_type)
{ {
case 1: //temp case 1: //temp
ret += "R" + std::to_string(src[n].tmp_src); ret += 'R';
ret += std::to_string(src[n].tmp_src);
break; break;
case 2: //input case 2: //input
if (d1.input_src < reg_table.size()) if (d1.input_src < reg_table.size())

View File

@ -848,7 +848,7 @@ namespace rsx
} }
} }
void ZCULL_control::disable_optimizations(::rsx::thread* ptimer, u32 location) void ZCULL_control::disable_optimizations(::rsx::thread*, u32 location)
{ {
// Externally synchronized // Externally synchronized
rsx_log.warning("Reports area at location %s was accessed. ZCULL optimizations will be disabled.", location_tostring(location)); rsx_log.warning("Reports area at location %s was accessed. ZCULL optimizations will be disabled.", location_tostring(location));

View File

@ -47,7 +47,7 @@ namespace vk
VkPipelineStageFlags dst_stage, VkPipelineStageFlags dst_stage,
const rsx::sampled_image_descriptor_base* sampler_state) const rsx::sampled_image_descriptor_base* sampler_state)
{ {
switch (auto raw = view->image(); raw->current_layout) switch (auto raw = view->image(); +raw->current_layout)
{ {
default: default:
//case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: //case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:

View File

@ -31,7 +31,7 @@ namespace vk
// Internal utils // Internal utils
static u64 encode_layout(VkImageLayout layout) static u64 encode_layout(VkImageLayout layout)
{ {
switch (layout) switch (+layout)
{ {
case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_GENERAL:
case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL: case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL:
@ -77,7 +77,7 @@ namespace vk
// Encoders // Encoders
inline void set_layout(u32 index, VkImageLayout layout) inline void set_layout(u32 index, VkImageLayout layout)
{ {
switch (layout) switch (+layout)
{ {
case VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT: case VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT:
case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: case VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL:

View File

@ -78,7 +78,7 @@ namespace vk
VkPipelineStageFlags src_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; VkPipelineStageFlags src_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
VkPipelineStageFlags dst_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; VkPipelineStageFlags dst_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
switch (new_layout) switch (+new_layout)
{ {
case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_GENERAL:
// Avoid this layout as it is unoptimized // Avoid this layout as it is unoptimized
@ -127,7 +127,7 @@ namespace vk
fmt::throw_exception("Attempted to transition to an invalid layout"); fmt::throw_exception("Attempted to transition to an invalid layout");
} }
switch (current_layout) switch (+current_layout)
{ {
case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_GENERAL:
// Avoid this layout as it is unoptimized // Avoid this layout as it is unoptimized

View File

@ -750,17 +750,17 @@ namespace rsx
rsx->enable_conditional_rendering(address_ptr); rsx->enable_conditional_rendering(address_ptr);
} }
void set_zcull_render_enable(thread* rsx, u32, u32 arg) void set_zcull_render_enable(thread* rsx, u32, u32)
{ {
rsx->notify_zcull_info_changed(); rsx->notify_zcull_info_changed();
} }
void set_zcull_stats_enable(thread* rsx, u32, u32 arg) void set_zcull_stats_enable(thread* rsx, u32, u32)
{ {
rsx->notify_zcull_info_changed(); rsx->notify_zcull_info_changed();
} }
void set_zcull_pixel_count_enable(thread* rsx, u32, u32 arg) void set_zcull_pixel_count_enable(thread* rsx, u32, u32)
{ {
rsx->notify_zcull_info_changed(); rsx->notify_zcull_info_changed();
} }
@ -1006,7 +1006,7 @@ namespace rsx
} }
// Get position of the current command arg // Get position of the current command arg
const u32 src_offset = rsx->fifo_ctrl->get_pos(); [[maybe_unused]] const u32 src_offset = rsx->fifo_ctrl->get_pos();
// FIFO args count including this one // FIFO args count including this one
const u32 fifo_args_cnt = rsx->fifo_ctrl->get_remaining_args_count() + 1; const u32 fifo_args_cnt = rsx->fifo_ctrl->get_remaining_args_count() + 1;
@ -1088,7 +1088,7 @@ namespace rsx
const auto dst_address = get_address(dst_offset + (x * 2) + (y * out_pitch), dst_dma, data_length); const auto dst_address = get_address(dst_offset + (x * 2) + (y * out_pitch), dst_dma, data_length);
const auto dst = vm::_ptr<u16>(dst_address); const auto dst = vm::_ptr<u16>(dst_address);
const auto src = reinterpret_cast<const be_t<u32>*>(fifo_span.data()); const auto src = utils::bless<const be_t<u32>>(fifo_span.data());
if (!dst_address) if (!dst_address)
{ {
@ -1825,7 +1825,7 @@ namespace rsx
template<u32 index> template<u32 index>
struct driver_flip struct driver_flip
{ {
static void impl(thread* rsx, u32 /*reg*/, u32 arg) static void impl(thread*, u32 /*reg*/, u32 arg)
{ {
sys_rsx_context_attribute(0x55555555, 0x102, index, arg, 0, 0); sys_rsx_context_attribute(0x55555555, 0x102, index, arg, 0, 0);
} }

View File

@ -317,7 +317,8 @@ std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir,
// Handle /host_root (not escaped, not processed) // Handle /host_root (not escaped, not processed)
if (out_path) if (out_path)
{ {
*out_path = "/"; out_path->clear();
*out_path += '/';
*out_path += fmt::merge(name_list, "/"); *out_path += fmt::merge(name_list, "/");
*out_path += vpath; *out_path += vpath;
} }
@ -339,7 +340,8 @@ std::string vfs::get(std::string_view vpath, std::vector<std::string>* out_dir,
// Merge path fragments // Merge path fragments
if (out_path) if (out_path)
{ {
*out_path = "/"; out_path->clear();
*out_path += '/';
*out_path += fmt::merge(name_list, "/"); *out_path += fmt::merge(name_list, "/");
} }
@ -389,7 +391,7 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
return vfs::retrieve(rpath, &table.root, &mount_path_empty); return vfs::retrieve(rpath, &table.root, &mount_path_empty);
} }
mount_path->emplace_back(); mount_path->emplace_back();
// Try to extract host root mount point name (if exists) // Try to extract host root mount point name (if exists)
@ -456,7 +458,8 @@ std::string vfs::retrieve(std::string_view path, const vfs_directory* node, std:
{ {
// If failed to find mount point for path and /host_root is mounted // If failed to find mount point for path and /host_root is mounted
// Prepend "/host_root" to path and return the constructed string // Prepend "/host_root" to path and return the constructed string
result = "/"; result.clear();
result += '/';
for (const auto& name : *mount_path) for (const auto& name : *mount_path)
{ {

View File

@ -537,7 +537,7 @@ int main(int argc, char** argv)
std::string argument_str; std::string argument_str;
for (int i = 0; i < argc; i++) for (int i = 0; i < argc; i++)
{ {
argument_str += "'" + std::string(argv[i]) + "'"; argument_str += '\'' + std::string(argv[i]) + '\'';
if (i != argc - 1) argument_str += " "; if (i != argc - 1) argument_str += " ";
} }
sys_log.notice("argc: %d, argv: %s", argc, argument_str); sys_log.notice("argc: %d, argv: %s", argc, argument_str);

View File

@ -97,7 +97,7 @@ u32 debugger_list::GetStartAddress(u32 address)
void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct) void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct)
{ {
const decltype(spu_thread::local_breakpoints)* spu_bps_list; const decltype(spu_thread::local_breakpoints)* spu_bps_list{};
if (m_cpu && m_cpu->id_type() == 2) if (m_cpu && m_cpu->id_type() == 2)
{ {
@ -116,7 +116,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct)
if (select_addr || direct) if (select_addr || direct)
{ {
// The user wants to survey a specific memory location, do not interfere from this point forth // The user wants to survey a specific memory location, do not interfere from this point forth
m_follow_thread = false; m_follow_thread = false;
} }
@ -161,7 +161,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool direct)
const u32 address_limits = (is_spu ? 0x3fffc : ~3); const u32 address_limits = (is_spu ? 0x3fffc : ~3);
const u32 current_pc = m_cpu->get_pc(); const u32 current_pc = m_cpu->get_pc();
m_start_addr &= address_limits; m_start_addr &= address_limits;
u32 pc = m_start_addr; pc = m_start_addr;
for (uint i = 0, count = 4; i < m_item_count; ++i, pc = (pc + count) & address_limits) for (uint i = 0, count = 4; i < m_item_count; ++i, pc = (pc + count) & address_limits)
{ {
@ -250,7 +250,7 @@ void debugger_list::scroll(s32 steps)
if (m_cpu && m_cpu->id_type() == 0x55 && steps < 0) if (m_cpu && m_cpu->id_type() == 0x55 && steps < 0)
{ {
// If scrolling backwards (upwards), try to obtain the start of commands tail // If scrolling backwards (upwards), try to obtain the start of commands tail
if (auto [count, res] = static_cast<rsx::thread*>(m_cpu)->try_get_pc_of_x_cmds_backwards(-steps, m_start_addr); count == 0u - steps) if (auto [count, res] = static_cast<rsx::thread*>(m_cpu)->try_get_pc_of_x_cmds_backwards(-steps, m_start_addr); count == 0u - steps)
{ {
steps = 0; steps = 0;
@ -388,7 +388,7 @@ void debugger_list::resizeEvent(QResizeEvent* event)
const u32 old_size = m_item_count; const u32 old_size = m_item_count;
// It is fine if the QWidgetList is a tad bit larger than the frame // It is fine if the QWidgetList is a tad bit larger than the frame
m_item_count = utils::aligned_div<u32>(rect().height() - frameWidth() * 2, visualItemRect(item(0)).height()); m_item_count = utils::aligned_div<u32>(rect().height() - frameWidth() * 2, visualItemRect(item(0)).height());
if (old_size <= m_item_count) if (old_size <= m_item_count)

View File

@ -181,7 +181,7 @@ namespace utils
AVCodecContext* context = nullptr; AVCodecContext* context = nullptr;
AVFrame* frame = nullptr; AVFrame* frame = nullptr;
SwrContext* swr = nullptr; SwrContext* swr = nullptr;
~scoped_av() ~scoped_av()
{ {
// Clean up // Clean up
@ -358,14 +358,14 @@ namespace utils
} }
duration_ms = stream->duration / 1000; duration_ms = stream->duration / 1000;
AVPacket packet{}; AVPacket* packet = av_packet_alloc();
av_init_packet(&packet); std::unique_ptr<AVPacket, decltype([](AVPacket* p){av_packet_unref(p);})> packet_(packet);
// Iterate through frames // Iterate through frames
while (thread_ctrl::state() != thread_state::aborting && av_read_frame(av.format, &packet) >= 0) while (thread_ctrl::state() != thread_state::aborting && av_read_frame(av.format, packet) >= 0)
{ {
if (int err = avcodec_send_packet(av.context, &packet); err < 0) if (int err = avcodec_send_packet(av.context, packet); err < 0)
{ {
media_log.error("audio_decoder: Queuing error: %d='%s'", err, av_error_to_string(err)); media_log.error("audio_decoder: Queuing error: %d='%s'", err, av_error_to_string(err));
has_error = true; has_error = true;

View File

@ -2591,7 +2591,7 @@ inline v128 gv_extend_lo_s8(const v128& vec)
#if defined(__SSE4_1__) #if defined(__SSE4_1__)
return _mm_cvtepi8_epi16(vec); return _mm_cvtepi8_epi16(vec);
#elif defined(ARCH_X64) #elif defined(ARCH_X64)
return _mm_srai_epi16(_mm_unpacklo_epi8(_mm_undefined_si128(), vec), 8); return _mm_srai_epi16(_mm_unpacklo_epi8(vec, vec), 8);
#elif defined(ARCH_ARM64) #elif defined(ARCH_ARM64)
return int16x8_t(vmovl_s8(vget_low_s8(vec))); return int16x8_t(vmovl_s8(vget_low_s8(vec)));
#endif #endif
@ -2613,7 +2613,7 @@ inline v128 gv_extend_hi_s8(const v128& vec)
#if defined(__SSE4_1__) #if defined(__SSE4_1__)
return _mm_cvtepi8_epi16(_mm_loadu_si64(vec._bytes + 8)); return _mm_cvtepi8_epi16(_mm_loadu_si64(vec._bytes + 8));
#elif defined(ARCH_X64) #elif defined(ARCH_X64)
return _mm_srai_epi16(_mm_unpackhi_epi8(_mm_undefined_si128(), vec), 8); return _mm_srai_epi16(_mm_unpackhi_epi8(vec, vec), 8);
#elif defined(ARCH_ARM64) #elif defined(ARCH_ARM64)
return int16x8_t(vmovl_s8(vget_high_s8(vec))); return int16x8_t(vmovl_s8(vget_high_s8(vec)));
#endif #endif
@ -2642,7 +2642,7 @@ inline v128 gv_extend_lo_s16(const v128& vec)
#if defined(__SSE4_1__) #if defined(__SSE4_1__)
return _mm_cvtepi16_epi32(vec); return _mm_cvtepi16_epi32(vec);
#elif defined(ARCH_X64) #elif defined(ARCH_X64)
return _mm_srai_epi32(_mm_unpacklo_epi16(_mm_undefined_si128(), vec), 16); return _mm_srai_epi32(_mm_unpacklo_epi16(vec, vec), 16);
#elif defined(ARCH_ARM64) #elif defined(ARCH_ARM64)
return int32x4_t(vmovl_s16(vget_low_s16(vec))); return int32x4_t(vmovl_s16(vget_low_s16(vec)));
#endif #endif
@ -2664,7 +2664,7 @@ inline v128 gv_extend_hi_s16(const v128& vec)
#if defined(__SSE4_1__) #if defined(__SSE4_1__)
return _mm_cvtepi16_epi32(_mm_loadu_si64(vec._bytes + 8)); return _mm_cvtepi16_epi32(_mm_loadu_si64(vec._bytes + 8));
#elif defined(ARCH_X64) #elif defined(ARCH_X64)
return _mm_srai_epi32(_mm_unpackhi_epi16(_mm_undefined_si128(), vec), 16); return _mm_srai_epi32(_mm_unpackhi_epi16(vec, vec), 16);
#elif defined(ARCH_ARM64) #elif defined(ARCH_ARM64)
return int32x4_t(vmovl_s16(vget_high_s16(vec))); return int32x4_t(vmovl_s16(vget_high_s16(vec)));
#endif #endif

View File

@ -229,7 +229,7 @@ namespace utils
return _prot; return _prot;
} }
void* memory_reserve(usz size, void* use_addr, bool is_memory_mapping) void* memory_reserve(usz size, void* use_addr, [[maybe_unused]] bool is_memory_mapping)
{ {
#ifdef _WIN32 #ifdef _WIN32
if (is_memory_mapping && has_win10_memory_mapping_api()) if (is_memory_mapping && has_win10_memory_mapping_api())