diff --git a/Utilities/File.h b/Utilities/File.h index 14ac900a8b..008c1a2bc2 100644 --- a/Utilities/File.h +++ b/Utilities/File.h @@ -74,7 +74,7 @@ namespace fs 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 @@ -793,7 +793,8 @@ namespace fs 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; } } diff --git a/Utilities/Thread.cpp b/Utilities/Thread.cpp index 508de190a7..bd7e265041 100644 --- a/Utilities/Thread.cpp +++ b/Utilities/Thread.cpp @@ -16,7 +16,9 @@ #include #include #else +#ifndef _GNU_SOURCE #define _GNU_SOURCE +#endif #ifdef __APPLE__ #define _XOPEN_SOURCE #define __USE_GNU diff --git a/Utilities/version.cpp b/Utilities/version.cpp index f31722c391..0c3cbb6da1 100644 --- a/Utilities/version.cpp +++ b/Utilities/version.cpp @@ -30,7 +30,8 @@ namespace utils if (lo()) { - version += "." + std::to_string(lo()); + version += '.'; + version += std::to_string(lo()); } if (type() != version_type::release) @@ -40,7 +41,8 @@ namespace utils version += "-" + postfix(); } - version += " " + utils::to_string(type()); + version += ' '; + version += utils::to_string(type()); if (type_index() > 1) { diff --git a/rpcs3/Emu/CPU/CPUThread.cpp b/rpcs3/Emu/CPU/CPUThread.cpp index e824214264..a246fb3600 100644 --- a/rpcs3/Emu/CPU/CPUThread.cpp +++ b/rpcs3/Emu/CPU/CPUThread.cpp @@ -55,6 +55,7 @@ void fmt_class_string::format(std::string& out, u64 arg) case cpu_flag::memory: return "mem"; case cpu_flag::pending: return "pend"; case cpu_flag::pending_recheck: return "pend-re"; + case cpu_flag::notify: return "ntf"; case cpu_flag::yield: return "y"; case cpu_flag::preempt: return "PREEMPT"; 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_can_stop = true; - bool escape, retval; + bool escape{}, retval{}; while (true) { diff --git a/rpcs3/Emu/Cell/Modules/cellAdec.cpp b/rpcs3/Emu/Cell/Modules/cellAdec.cpp index 8962e70086..34f1999dbe 100644 --- a/rpcs3/Emu/Cell/Modules/cellAdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAdec.cpp @@ -454,30 +454,8 @@ public: if (adecIsAtracX(type)) last_pts -= 0x10000; // hack } - struct AVPacketHolder : AVPacket - { - AVPacketHolder(u32 data_size) - { - av_init_packet(this); - - if (data_size) - { - this->data = static_cast(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); + AVPacket* packet = av_packet_alloc(); + std::unique_ptr packet_(packet); if (just_started && just_finished) { @@ -544,8 +522,6 @@ public: just_started = false; } - bool last_frame = false; - while (true) { if (Emu.IsStopped() || is_closed) @@ -554,14 +530,7 @@ public: break; } - last_frame = av_read_frame(fmt, &au) < 0; - if (last_frame) - { - //break; - av_free(au.data); - au.data = NULL; - au.size = 0; - } + av_read_frame(fmt, packet); struct AdecFrameHolder : AdecFrame { diff --git a/rpcs3/Emu/Cell/Modules/cellCamera.cpp b/rpcs3/Emu/Cell/Modules/cellCamera.cpp index e071ad126c..7ecad36c3e 100644 --- a/rpcs3/Emu/Cell/Modules/cellCamera.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCamera.cpp @@ -175,7 +175,7 @@ static error_code check_camera_info(const VariantOfCellCameraInfo& info) return CELL_CAMERA_ERROR_BAD_FRAMERATE; } - auto check_fps = [fps = info.framerate](const std::vector& range) + auto check_fps = [fps = info.framerate](std::initializer_list range) { return std::find(range.begin(), range.end(), fps) != range.end(); }; diff --git a/rpcs3/Emu/Cell/Modules/cellCamera.h b/rpcs3/Emu/Cell/Modules/cellCamera.h index 10c7910d7e..6c4bd35f62 100644 --- a/rpcs3/Emu/Cell/Modules/cellCamera.h +++ b/rpcs3/Emu/Cell/Modules/cellCamera.h @@ -477,5 +477,3 @@ struct gem_camera_shared atomic_t size{0}; atomic_t format{CELL_CAMERA_RAW8}; }; - -static inline s32 get_video_buffer_size(s32 width, s32 height); diff --git a/rpcs3/Emu/Cell/Modules/cellCrossController.cpp b/rpcs3/Emu/Cell/Modules/cellCrossController.cpp index 58ecd8ad31..270b706ebe 100644 --- a/rpcs3/Emu/Cell/Modules/cellCrossController.cpp +++ b/rpcs3/Emu/Cell/Modules/cellCrossController.cpp @@ -52,7 +52,7 @@ struct cross_controller 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); 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. 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; }); diff --git a/rpcs3/Emu/Cell/Modules/cellGame.cpp b/rpcs3/Emu/Cell/Modules/cellGame.cpp index 1ce9fa470f..c1a9105500 100644 --- a/rpcs3/Emu/Cell/Modules/cellGame.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGame.cpp @@ -1531,7 +1531,8 @@ error_code cellGameContentErrorDialog(s32 type, s32 errNeedSizeKB, vm::cptr CELL_GAME_ERRDIALOG_NOSPACE); diff --git a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp index 5e8c6997d8..48c8538d29 100644 --- a/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGcmSys.cpp @@ -322,7 +322,7 @@ error_code cellGcmBindZcull(u8 index, u32 offset, u32 width, u32 height, u32 cul { return err; } - + vm::_ptr(gcm_cfg.zculls_addr)[index] = gcm_zcull; return CELL_OK; } @@ -1314,8 +1314,6 @@ void _cellGcmSetFlipCommandWithWaitLabel(ppu_thread& ppu, vm::ptrget(); - rsx::make_command(ctx->current, NV406E_SEMAPHORE_OFFSET, { label_index * 0x10, label_value }); if (auto error = gcmSetPrepareFlip(ppu, ctx, id); error < 0) diff --git a/rpcs3/Emu/Cell/Modules/cellGem.cpp b/rpcs3/Emu/Cell/Modules/cellGem.cpp index 82dbc9107c..1dd20c5743 100644 --- a/rpcs3/Emu/Cell/Modules/cellGem.cpp +++ b/rpcs3/Emu/Cell/Modules/cellGem.cpp @@ -446,7 +446,7 @@ static bool check_gem_num(const u32 gem_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(x_pos / (x_max / static_cast(rsx::overlays::overlay::virtual_width))); const u16 y = static_cast(y_pos / (y_max / static_cast(rsx::overlays::overlay::virtual_height))); diff --git a/rpcs3/Emu/Cell/Modules/cellHttp.cpp b/rpcs3/Emu/Cell/Modules/cellHttp.cpp index 3e0b9137f8..6254315ecc 100644 --- a/rpcs3/Emu/Cell/Modules/cellHttp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellHttp.cpp @@ -1120,7 +1120,7 @@ error_code cellHttpAuthCacheExport(vm::ptr buf, u32 len, vm::ptr outsi // TODO } - u32 size = 0; + [[maybe_unused]] u32 size = 0; // TODO @@ -2786,7 +2786,7 @@ error_code cellHttpClientAddHeader(CellHttpClientId clientId, vm::cptr name) { cellHttp.todo("cellHttpClientDeleteHeader(clientId=0x%x, name=%s)", clientId, name); - + auto& man = g_fxo->get(); std::lock_guard lock(man.mtx); @@ -2806,7 +2806,7 @@ error_code cellHttpClientDeleteHeader(CellHttpClientId clientId, vm::cptr error_code cellHttpClientSetSslCallback(CellHttpClientId clientId, vm::ptr cbfunc, vm::ptr userArg) { cellHttp.todo("cellHttpClientSetSslCallback(clientId=0x%x, cbfunc=*0x%x, userArg=*0x%x)", clientId, cbfunc, userArg); - + auto& man = g_fxo->get(); std::lock_guard lock(man.mtx); diff --git a/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp b/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp index f6b6e5db98..4308a08bcc 100644 --- a/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp +++ b/rpcs3/Emu/Cell/Modules/cellHttpUtil.cpp @@ -230,7 +230,7 @@ error_code cellHttpUtilBuildRequestLine(vm::cptr req, vm::p std::string path = fmt::format("%s", req->path); if (path.empty()) { - path = "/"; + path += '/'; } // TODO: are the numbers properly formatted ? @@ -805,7 +805,7 @@ error_code cellHttpUtilBase64Encoder(vm::ptr out, vm::cptr input, u3 error_code cellHttpUtilBase64Decoder(vm::ptr output, vm::cptr 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) { diff --git a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp index a47b721222..adff53e320 100644 --- a/rpcs3/Emu/Cell/Modules/cellImeJp.cpp +++ b/rpcs3/Emu/Cell/Modules/cellImeJp.cpp @@ -43,10 +43,9 @@ bool ime_jp_manager::addChar(u16 c) if (!c || cursor >= (CELL_IMEJP_STRING_MAXLENGTH - 1) || cursor > input_string.length()) return false; - std::u16string tmp; - tmp += c; - input_string.insert(cursor++, tmp); - cursor_end = cursor; + input_string += c; // resize + std::memmove(input_string.data() + cursor + 1, input_string.data() + cursor, sizeof(u16) * (input_string.size() - 1 - cursor)); + cursor_end = ++cursor; input_state = CELL_IMEJP_BEFORE_CONVERT; return true; } diff --git a/rpcs3/Emu/Cell/Modules/cellKb.cpp b/rpcs3/Emu/Cell/Modules/cellKb.cpp index d065d9e55f..e7d9ce0a8c 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.cpp +++ b/rpcs3/Emu/Cell/Modules/cellKb.cpp @@ -49,7 +49,7 @@ KeyboardHandlerBase::KeyboardHandlerBase(utils::serial* ar) Emu.DeferDeserialization([this]() { Init(m_info.max_connect); - init.init(); + auto lk = init.init(); }); } } diff --git a/rpcs3/Emu/Cell/Modules/cellKb.h b/rpcs3/Emu/Cell/Modules/cellKb.h index 4f525b86db..b2911edfdc 100644 --- a/rpcs3/Emu/Cell/Modules/cellKb.h +++ b/rpcs3/Emu/Cell/Modules/cellKb.h @@ -56,5 +56,3 @@ struct CellKbConfig be_t read_mode; be_t code_type; }; - -u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); diff --git a/rpcs3/Emu/Cell/Modules/cellMouse.cpp b/rpcs3/Emu/Cell/Modules/cellMouse.cpp index eefa986a34..467e00dd99 100644 --- a/rpcs3/Emu/Cell/Modules/cellMouse.cpp +++ b/rpcs3/Emu/Cell/Modules/cellMouse.cpp @@ -49,7 +49,7 @@ MouseHandlerBase::MouseHandlerBase(utils::serial* ar) Emu.DeferDeserialization([this]() { Init(m_info.max_connect); - init.init(); + auto lk = init.init(); }); } } diff --git a/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp b/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp index 1d2cfe15a8..f723ddf888 100644 --- a/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp +++ b/rpcs3/Emu/Cell/Modules/cellPngEnc.cpp @@ -42,7 +42,7 @@ bool check_config(vm::cptr config) if (!config || config->maxWidth == 0u || config->maxWidth > 1000000u || config->maxHeight == 0u || config->maxHeight > 1000000u || - config->maxBitDepth != 8u && config->maxBitDepth != 16u || + (config->maxBitDepth != 8u && config->maxBitDepth != 16u) || static_cast(config->addMemSize) < 0 || config->exParamNum != 0u) { diff --git a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp index d1c5f3df50..4dc32ddc28 100644 --- a/rpcs3/Emu/Cell/Modules/cellSaveData.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSaveData.cpp @@ -148,7 +148,7 @@ int check_filename(std::string_view file_path, bool disallow_system_files, bool return 70; } - char name[CELL_SAVEDATA_FILENAME_SIZE - 3]; + char name[CELL_SAVEDATA_FILENAME_SIZE + 3]; if (dotpos) { diff --git a/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp b/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp index 2d7f16653c..244e324187 100644 --- a/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp +++ b/rpcs3/Emu/Cell/Modules/cellSysutilAvc2.cpp @@ -315,7 +315,7 @@ error_code cellSysutilAvc2EstimateMemoryContainerSize(vm::cptr(static_cast(window_count) * 1258291.2) + 0x1ed846; } - estimated_size = (estimated_size + ((static_cast(val) >> 7) + static_cast(static_cast(val) < 0 && (val & 0x7f) != 0)) * 0x80 + 0x80080 & 0xfff00000) + 0x100000; + estimated_size = ((estimated_size + ((static_cast(val) >> 7) + static_cast(static_cast(val) < 0 && (val & 0x7f) != 0)) * 0x80 + 0x80080) & 0xfff00000) + 0x100000; *size = estimated_size; } diff --git a/rpcs3/Emu/Cell/Modules/cellVdec.cpp b/rpcs3/Emu/Cell/Modules/cellVdec.cpp index b6041433d9..e9ca207bcf 100644 --- a/rpcs3/Emu/Cell/Modules/cellVdec.cpp +++ b/rpcs3/Emu/Cell/Modules/cellVdec.cpp @@ -636,14 +636,12 @@ struct vdec_creation_lock vdec_creation_lock() { - locked.init(); + auto lk = locked.init(); } }; extern bool try_lock_vdec_context_creation() { - bool exist = false; - auto& lock = g_fxo->get(); auto reset = lock.locked.reset(); diff --git a/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp b/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp index 7b2359b946..e4ace7fbbe 100644 --- a/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp +++ b/rpcs3/Emu/Cell/Modules/sceNpUtil.cpp @@ -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); @@ -101,7 +101,7 @@ error_code sceNpUtilBandwidthTestGetStatus() return not_an_error(util_manager.bandwidth_test_thread->status); } -error_code sceNpUtilBandwidthTestShutdown(ppu_thread& ppu, vm::ptr result) +error_code sceNpUtilBandwidthTestShutdown([[maybe_unused]] ppu_thread& ppu, vm::ptr result) { sceNpUtil.warning("sceNpUtilBandwidthTestShutdown(result=*0x%x)", result); diff --git a/rpcs3/Emu/Cell/PPUInterpreter.cpp b/rpcs3/Emu/Cell/PPUInterpreter.cpp index 391d8988d1..53e18db82b 100644 --- a/rpcs3/Emu/Cell/PPUInterpreter.cpp +++ b/rpcs3/Emu/Cell/PPUInterpreter.cpp @@ -23,6 +23,7 @@ #if !defined(_MSC_VER) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wold-style-cast" +#pragma GCC diagnostic ignored "-Wuninitialized" #endif extern bool is_debugger_present(); diff --git a/rpcs3/Emu/Cell/PPUModule.cpp b/rpcs3/Emu/Cell/PPUModule.cpp index 9296ec0a50..052023683d 100644 --- a/rpcs3/Emu/Cell/PPUModule.cpp +++ b/rpcs3/Emu/Cell/PPUModule.cpp @@ -38,7 +38,7 @@ extern void sys_initialize_tls(ppu_thread&, u64, u32, u32, u32); // HLE function name cache std::vector g_ppu_function_names; -extern atomic_t liblv2_begin = 0, liblv2_end = 0; +atomic_t liblv2_begin = 0, liblv2_end = 0; 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) { const std::string name = ar.operator std::string(); - + if (name.empty()) { // 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); auto& variable = _module->variables; - + for (u32 i = 0, end = ar.operator usz(); i < end; i++) { 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; ppu_loader.notice("** Section: sh_type=0x%x, addr=0x%llx, size=0x%llx, flags=0x%x", std::bit_cast(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)) { ppu_segment _sec; diff --git a/rpcs3/Emu/Cell/PPUThread.cpp b/rpcs3/Emu/Cell/PPUThread.cpp index 7d5c0a422b..9f3320cdf7 100644 --- a/rpcs3/Emu/Cell/PPUThread.cpp +++ b/rpcs3/Emu/Cell/PPUThread.cpp @@ -721,7 +721,7 @@ struct ppu_far_jumps_t c.bind(imm_address); c.embedUInt32(pc); #endif - }, &rt); + }, &rt); } return it->second.func; @@ -1712,7 +1712,7 @@ ppu_thread::ppu_thread(utils::serial& ar) { 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().inited) { @@ -1799,7 +1799,7 @@ void ppu_thread::save(utils::serial& ar) if (_joiner >= ppu_join_status::max) { // Joining thread should recover this member properly - _joiner = ppu_join_status::joinable; + _joiner = ppu_join_status::joinable; } if (state & cpu_flag::again) @@ -2888,7 +2888,7 @@ extern void ppu_precompile(std::vector& dir_queue, std::vector bool + auto is_ignored = [&](s64 /*offset*/) -> bool { if (dir_queue[i] != firmware_sprx_path) { diff --git a/rpcs3/Emu/Cell/SPUAnalyser.h b/rpcs3/Emu/Cell/SPUAnalyser.h index e3381f6e75..d448fca473 100644 --- a/rpcs3/Emu/Cell/SPUAnalyser.h +++ b/rpcs3/Emu/Cell/SPUAnalyser.h @@ -291,7 +291,7 @@ struct spu_itype // Test for constant loading instruction friend constexpr bool operator &(type value, constant_tag) { - return value >= CBD && value <= FSMBI; + return value >= ILH && value <= FSMBI; } }; diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index 1ea4e8078b..659363eb70 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -3411,7 +3411,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point) } 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]; break; } @@ -3423,7 +3423,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point) } 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]; break; } @@ -3435,7 +3435,7 @@ spu_program spu_recompiler_base::analyse(const be_t* ls, u32 entry_point) } 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]; break; } diff --git a/rpcs3/Emu/Cell/lv2/lv2.cpp b/rpcs3/Emu/Cell/lv2/lv2.cpp index ca51d4a82a..f8a88dabea 100644 --- a/rpcs3/Emu/Cell/lv2/lv2.cpp +++ b/rpcs3/Emu/Cell/lv2/lv2.cpp @@ -1344,7 +1344,7 @@ bool lv2_obj::sleep_unlocked(cpu_thread& thread, u64 timeout, u64 current_time) val += cpu_flag::suspend; // Flag used for forced timeout notification - ensure(!timeout || !(val & cpu_flag::notify)); + ensure(!timeout || !(val & cpu_flag::notify)); 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 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; } + +void lv2_obj::prepare_for_sleep(cpu_thread& cpu) +{ + vm::temporary_unlock(cpu); + cpu_counter::remove(&cpu); +} diff --git a/rpcs3/Emu/Cell/lv2/sys_fs.cpp b/rpcs3/Emu/Cell/lv2/sys_fs.cpp index 24a793c103..b8412c8e39 100644 --- a/rpcs3/Emu/Cell/lv2/sys_fs.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_fs.cpp @@ -1156,7 +1156,7 @@ error_code sys_fs_opendir(ppu_thread& ppu, vm::cptr path, vm::ptr fd) } else { - data.emplace_back().name = "."; + data.emplace_back().name += '.'; data.back().is_directory = true; data.emplace_back().name = ".."; data.back().is_directory = true; diff --git a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp index 7d9d5e85ee..da29d4fdd5 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2p.cpp @@ -256,7 +256,8 @@ std::optional lv2_socket_p2p::sendto(s32 flags, const std::vector& buf, sys_net.trace("[P2P] Sending a packet to %s:%d:%d", ip_str, p2p_port, p2p_vport); std::vector p2p_data(buf.size() + sizeof(u16)); - reinterpret_cast&>(p2p_data[0]) = p2p_vport; + const le_t p2p_vport_le = p2p_vport; + memcpy(p2p_data.data(), &p2p_vport_le, sizeof(u16)); memcpy(p2p_data.data() + sizeof(u16), buf.data(), buf.size()); int native_flags = 0; diff --git a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp index b7e314cebe..49e6c57770 100644 --- a/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_net/lv2_socket_p2ps.cpp @@ -206,8 +206,9 @@ std::vector generate_u2s_packet(const p2ps_encapsulated_tcp& header, const u ensure(packet_size < 65535); // packet size shouldn't be bigger than possible UDP payload std::vector packet(packet_size); u8* packet_data = packet.data(); + le_t dst_port_le = +header.dst_port; - *reinterpret_cast*>(packet_data) = header.dst_port; + memcpy(packet_data, &dst_port_le, sizeof(u16)); memcpy(packet_data + sizeof(u16), &header, sizeof(p2ps_encapsulated_tcp)); if (datasize) memcpy(packet_data + sizeof(u16) + sizeof(p2ps_encapsulated_tcp), data, datasize); diff --git a/rpcs3/Emu/Cell/lv2/sys_overlay.cpp b/rpcs3/Emu/Cell/lv2/sys_overlay.cpp index a0e5245955..e573bb2ab4 100644 --- a/rpcs3/Emu/Cell/lv2/sys_overlay.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_overlay.cpp @@ -84,7 +84,7 @@ std::shared_ptr lv2_overlay::load(utils::serial& ar) ensure(g_cfg.savestate.state_inspection_mode.get()); } - return std::move(ovlm); + return ovlm; } void lv2_overlay::save(utils::serial& ar) diff --git a/rpcs3/Emu/Cell/lv2/sys_overlay.h b/rpcs3/Emu/Cell/lv2/sys_overlay.h index 965a91809f..3d12d90568 100644 --- a/rpcs3/Emu/Cell/lv2/sys_overlay.h +++ b/rpcs3/Emu/Cell/lv2/sys_overlay.h @@ -10,7 +10,7 @@ struct lv2_overlay final : lv2_obj, ppu_module u32 entry; lv2_overlay() = default; - lv2_overlay(utils::serial& ar){} + lv2_overlay(utils::serial&){} static std::shared_ptr load(utils::serial& ar); void save(utils::serial& ar); }; diff --git a/rpcs3/Emu/Cell/lv2/sys_prx.cpp b/rpcs3/Emu/Cell/lv2/sys_prx.cpp index e1c1795e34..1ed9d7c61a 100644 --- a/rpcs3/Emu/Cell/lv2/sys_prx.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_prx.cpp @@ -343,7 +343,7 @@ std::shared_ptr lv2_prx::load(utils::serial& ar) } prx->state = state; - return std::move(prx); + return prx; } void lv2_prx::save(utils::serial& ar) diff --git a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h index 66088762be..13c12b1221 100644 --- a/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h +++ b/rpcs3/Emu/Cell/lv2/sys_rsxaudio.h @@ -437,17 +437,13 @@ public: auto operator<=>(const port_config&) const = default; }; - union avport_bit + struct avport_bit { - struct - { - bool hdmi_0 : 1; - bool hdmi_1 : 1; - bool avmulti : 1; - bool spdif_0 : 1; - bool spdif_1 : 1; - }; - u8 raw : 5 = 0; + bool hdmi_0 : 1; + bool hdmi_1 : 1; + bool avmulti : 1; + bool spdif_0 : 1; + bool spdif_1 : 1; }; rsxaudio_backend_thread(); diff --git a/rpcs3/Emu/Cell/lv2/sys_sync.h b/rpcs3/Emu/Cell/lv2/sys_sync.h index 2ed30e8926..9774e36512 100644 --- a/rpcs3/Emu/Cell/lv2/sys_sync.h +++ b/rpcs3/Emu/Cell/lv2/sys_sync.h @@ -61,16 +61,6 @@ enum 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). struct lv2_obj { @@ -121,7 +111,7 @@ public: static T* unqueue(T*& first, T* object, T* T::* mem_ptr = &T::next_cpu) { auto it = +first; - + if (it == object) { atomic_storage::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 - static inline void prepare_for_sleep(cpu_thread& cpu) - { - vm::temporary_unlock(cpu); - cpu_counter::remove(&cpu); - } + static void prepare_for_sleep(cpu_thread& cpu); struct notify_all_t { @@ -446,7 +432,7 @@ public: } notify_all_t(const notify_all_t&) = delete; - + static void cleanup() { for (auto& cpu : g_to_notify) diff --git a/rpcs3/Emu/Cell/lv2/sys_time.cpp b/rpcs3/Emu/Cell/lv2/sys_time.cpp index 71af7982c7..70bc2a5297 100644 --- a/rpcs3/Emu/Cell/lv2/sys_time.cpp +++ b/rpcs3/Emu/Cell/lv2/sys_time.cpp @@ -180,7 +180,7 @@ void initialize_timebased_time(u64 timebased_init, bool reset) } const u64 current = get_timebased_time(); - timebased_init = get_timebased_time() - timebased_init; + timebased_init = current - timebased_init; timebase_offset = timebased_init; systemtime_offset = timebased_init / (g_timebase_freq / 1000000); diff --git a/rpcs3/Emu/GDB.cpp b/rpcs3/Emu/GDB.cpp index f5778ae52b..b68b2d5e70 100644 --- a/rpcs3/Emu/GDB.cpp +++ b/rpcs3/Emu/GDB.cpp @@ -756,7 +756,8 @@ bool gdb_thread::cmd_vcont(gdb_cmd& cmd) // we have to remove dbg_pause from thread that paused execution, otherwise // it will be paused forever (Emu.Resume only removes dbg_global_pause) ppu = std::static_pointer_cast>(selected_thread.lock()); - ppu->state -= cpu_flag::dbg_pause; + if (ppu) + ppu->state -= cpu_flag::dbg_pause; return send_reason(); } return send_cmd_ack(""); diff --git a/rpcs3/Emu/IPC_socket.cpp b/rpcs3/Emu/IPC_socket.cpp index 844a023538..2d8944d71f 100644 --- a/rpcs3/Emu/IPC_socket.cpp +++ b/rpcs3/Emu/IPC_socket.cpp @@ -47,7 +47,7 @@ namespace IPC_socket vm::write64(addr, value); } - const int IPC_impl::get_port() + int IPC_impl::get_port() { return g_cfg_ipc.get_port(); } @@ -85,7 +85,7 @@ namespace IPC_socket 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(); } diff --git a/rpcs3/Emu/IPC_socket.h b/rpcs3/Emu/IPC_socket.h index 92aeb22493..053e323166 100644 --- a/rpcs3/Emu/IPC_socket.h +++ b/rpcs3/Emu/IPC_socket.h @@ -33,13 +33,13 @@ namespace IPC_socket IPC.error(fmt, std::forward(args)...); } - static const int get_port(); + static int get_port(); static pine::EmuStatus get_status(); static const std::string& get_title(); static const std::string& get_title_ID(); static const std::string& get_executable_hash(); static const std::string& get_app_version(); - static const std::string get_version_and_branch(); + static std::string get_version_and_branch(); public: static auto constexpr thread_name = "IPC Server"sv; diff --git a/rpcs3/Emu/IdManager.h b/rpcs3/Emu/IdManager.h index d94b659d02..4c98a35e43 100644 --- a/rpcs3/Emu/IdManager.h +++ b/rpcs3/Emu/IdManager.h @@ -59,13 +59,10 @@ namespace id_manager { static_assert(IdmCompatible, "ID object must specify: id_base, id_step, id_count"); - enum : u32 - { - base = T::id_base, // First ID (N = 0) - step = T::id_step, // Any ID: N * id_setp + id_base - count = T::id_count, // Limit: N < id_count - invalid = -+!base, // Invalid ID sample - }; + 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 + static constexpr u32 count = T::id_count; // Limit: N < id_count + static constexpr u32 invalid = -+!base; // Invalid ID sample static constexpr std::pair invl_range = get_invl_range(); static constexpr bool uses_lowest_id = get_force_lowest_id(); @@ -284,7 +281,7 @@ namespace id_manager info = std::addressof(typeinfo.second); } } - + ensure(info); // Construct each object from information collected @@ -292,7 +289,7 @@ namespace id_manager // Simulate construction semantics (idm::last_id() value) 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); obj.first = id_key(id, static_cast(static_cast(type_init_pos >> 64))); @@ -492,7 +489,7 @@ class idm using traits = id_manager::id_traits; // Ensure make_typeinfo() is used for this type - stx::typedata(); + [[maybe_unused]] auto& td = stx::typedata(); // Allocate new id std::lock_guard lock(id_manager::g_mutex); @@ -703,7 +700,7 @@ public: { static_assert((PtrSame && ...), "Invalid ID type combination"); - std::conditional_t(Lock()), reader_lock, const shared_mutex&> lock(id_manager::g_mutex); + [[maybe_unused]] std::conditional_t lock(id_manager::g_mutex); using func_traits = function_traits()))::operator())>; using object_type = typename func_traits::object_type; diff --git a/rpcs3/Emu/Io/Keyboard.h b/rpcs3/Emu/Io/Keyboard.h index ac54e7fdd2..e53595d16b 100644 --- a/rpcs3/Emu/Io/Keyboard.h +++ b/rpcs3/Emu/Io/Keyboard.h @@ -206,3 +206,5 @@ enum CellKbMappingType : s32 CELL_KB_MAPPING_PORTUGUESE_BRAZIL = 23, CELL_KB_MAPPING_TURKISH_TURKEY = 24 }; + +u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode); diff --git a/rpcs3/Emu/Io/KeyboardHandler.h b/rpcs3/Emu/Io/KeyboardHandler.h index 179578c0ad..f5ef273f5e 100644 --- a/rpcs3/Emu/Io/KeyboardHandler.h +++ b/rpcs3/Emu/Io/KeyboardHandler.h @@ -7,8 +7,6 @@ #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 { Key_Shift = 0x01000020, @@ -36,7 +34,7 @@ struct KbButton u32 m_keyCode = 0; u32 m_outKeyCode = 0; bool m_pressed = false; - + KbButton() = default; KbButton(u32 keyCode, u32 outKeyCode, bool pressed = false) : m_keyCode(keyCode) diff --git a/rpcs3/Emu/Io/usio.cpp b/rpcs3/Emu/Io/usio.cpp index cd62bca995..f5132a24f2 100644 --- a/rpcs3/Emu/Io/usio.cpp +++ b/rpcs3/Emu/Io/usio.cpp @@ -108,8 +108,8 @@ void usb_device_usio::translate_input() const auto handler = pad::get_current_handler(); std::vector 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 u16 BIG_HIT = 0xA40; + constexpr le_t c_small_hit = 0x4A0; + constexpr le_t c_big_hit = 0xA40; auto translate_from_pad = [&](u8 pad_number, u8 player) { @@ -136,35 +136,35 @@ void usb_device_usio::translate_input() { case CELL_PAD_CTRL_SQUARE: // Strong hit side left - *reinterpret_cast*>(&input_buf[32 + offset]) = BIG_HIT; + std::memcpy(input_buf.data() + 32 + offset, &c_big_hit, sizeof(u16)); break; case CELL_PAD_CTRL_CROSS: // Strong hit center right - *reinterpret_cast*>(&input_buf[36 + offset]) = BIG_HIT; + std::memcpy(input_buf.data() + 36 + offset, &c_big_hit, sizeof(u16)); break; case CELL_PAD_CTRL_CIRCLE: // Strong hit side right - *reinterpret_cast*>(&input_buf[38 + offset]) = BIG_HIT; + std::memcpy(input_buf.data() + 38 + offset, &c_big_hit, sizeof(u16)); break; case CELL_PAD_CTRL_TRIANGLE: // Strong hit center left - *reinterpret_cast*>(&input_buf[34 + offset]) = BIG_HIT; + std::memcpy(input_buf.data() + 34 + offset, &c_big_hit, sizeof(u16)); break; case CELL_PAD_CTRL_L1: // Small hit center left - *reinterpret_cast*>(&input_buf[34 + offset]) = SMALL_HIT; + std::memcpy(input_buf.data() + 34 + offset, &c_small_hit, sizeof(u16)); break; case CELL_PAD_CTRL_R1: // Small hit center right - *reinterpret_cast*>(&input_buf[36 + offset]) = SMALL_HIT; + std::memcpy(input_buf.data() + 36 + offset, &c_small_hit, sizeof(u16)); break; case CELL_PAD_CTRL_L2: // Small hit side left - *reinterpret_cast*>(&input_buf[32 + offset]) = SMALL_HIT; + std::memcpy(input_buf.data() + 32 + offset, &c_small_hit, sizeof(u16)); break; case CELL_PAD_CTRL_R2: // Small hit side right - *reinterpret_cast*>(&input_buf[38 + offset]) = SMALL_HIT; + std::memcpy(input_buf.data() + 38 + offset, &c_small_hit, sizeof(u16)); break; default: break; diff --git a/rpcs3/Emu/Memory/vm.cpp b/rpcs3/Emu/Memory/vm.cpp index 22b150128f..46c804e8df 100644 --- a/rpcs3/Emu/Memory/vm.cpp +++ b/rpcs3/Emu/Memory/vm.cpp @@ -1613,8 +1613,6 @@ namespace vm m_common->map_critical(vm::get_super_ptr(addr)); } - auto& m_map = (m.*block_map)(); - std::shared_ptr null_shm; while (true) diff --git a/rpcs3/Emu/RSX/Common/BufferUtils.cpp b/rpcs3/Emu/RSX/Common/BufferUtils.cpp index 4227e9fa0d..670f6d0ac6 100644 --- a/rpcs3/Emu/RSX/Common/BufferUtils.cpp +++ b/rpcs3/Emu/RSX/Common/BufferUtils.cpp @@ -27,34 +27,34 @@ #if defined(__AVX512F__) && defined(__AVX512VL__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && defined(__AVX512BW__) [[maybe_unused]] constexpr bool s_use_ssse3 = true; -constexpr bool s_use_sse4_1 = true; -constexpr bool s_use_avx2 = true; -constexpr bool s_use_avx3 = true; +[[maybe_unused]] constexpr bool s_use_sse4_1 = true; +[[maybe_unused]] constexpr bool s_use_avx2 = true; +[[maybe_unused]] constexpr bool s_use_avx3 = true; #elif defined(__AVX2__) [[maybe_unused]] constexpr bool s_use_ssse3 = true; -constexpr bool s_use_sse4_1 = true; -constexpr bool s_use_avx2 = true; -constexpr bool s_use_avx3 = false; +[[maybe_unused]] constexpr bool s_use_sse4_1 = true; +[[maybe_unused]] constexpr bool s_use_avx2 = true; +[[maybe_unused]] constexpr bool s_use_avx3 = false; #elif defined(__SSE4_1__) [[maybe_unused]] constexpr bool s_use_ssse3 = true; -constexpr bool s_use_sse4_1 = true; -constexpr bool s_use_avx2 = false; -constexpr bool s_use_avx3 = false; +[[maybe_unused]] constexpr bool s_use_sse4_1 = true; +[[maybe_unused]] constexpr bool s_use_avx2 = false; +[[maybe_unused]] constexpr bool s_use_avx3 = false; #elif defined(__SSSE3__) [[maybe_unused]] constexpr bool s_use_ssse3 = true; -constexpr bool s_use_sse4_1 = false; -constexpr bool s_use_avx2 = false; -constexpr bool s_use_avx3 = false; +[[maybe_unused]] constexpr bool s_use_sse4_1 = false; +[[maybe_unused]] constexpr bool s_use_avx2 = false; +[[maybe_unused]] constexpr bool s_use_avx3 = false; #elif defined(ARCH_X64) [[maybe_unused]] const bool s_use_ssse3 = utils::has_ssse3(); -const bool s_use_sse4_1 = utils::has_sse41(); -const bool s_use_avx2 = utils::has_avx2(); -const bool s_use_avx3 = utils::has_avx512(); +[[maybe_unused]] const bool s_use_sse4_1 = utils::has_sse41(); +[[maybe_unused]] const bool s_use_avx2 = utils::has_avx2(); +[[maybe_unused]] const bool s_use_avx3 = utils::has_avx512(); #else [[maybe_unused]] constexpr bool s_use_ssse3 = true; // Non x86 -constexpr bool s_use_sse4_1 = true; // Non x86 -constexpr bool s_use_avx2 = false; -constexpr bool s_use_avx3 = false; +[[maybe_unused]] constexpr bool s_use_sse4_1 = true; // Non x86 +[[maybe_unused]] constexpr bool s_use_avx2 = false; +[[maybe_unused]] constexpr bool s_use_avx3 = false; #endif const v128 s_bswap_u32_mask = v128::from32(0x00010203, 0x04050607, 0x08090a0b, 0x0c0d0e0f); diff --git a/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp b/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp index cbe97f9987..383fd9485a 100644 --- a/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp +++ b/rpcs3/Emu/RSX/Common/surface_cache_dma.hpp @@ -63,7 +63,7 @@ namespace rsx { // All is well return *this; - } + } } // Data does not exist or is not contiguous. Merge the layer @@ -87,7 +87,7 @@ namespace rsx address += BlockSize; } - auto unified = Traits::merge_bo_list(cmd, bo_list); + auto unified = Traits::template merge_bo_list(cmd, bo_list); ensure(unified); m_buffer_list[block_for(start_address)].acquire(unified); diff --git a/rpcs3/Emu/RSX/Common/surface_store.h b/rpcs3/Emu/RSX/Common/surface_store.h index 43c4ed52ea..6bd77704be 100644 --- a/rpcs3/Emu/RSX/Common/surface_store.h +++ b/rpcs3/Emu/RSX/Common/surface_store.h @@ -435,7 +435,7 @@ namespace rsx if (!pitch_compatible) { // 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); } diff --git a/rpcs3/Emu/RSX/GL/glutils/blitter.cpp b/rpcs3/Emu/RSX/GL/glutils/blitter.cpp index ba8993d684..0d3bf16267 100644 --- a/rpcs3/Emu/RSX/GL/glutils/blitter.cpp +++ b/rpcs3/Emu/RSX/GL/glutils/blitter.cpp @@ -9,7 +9,7 @@ namespace gl { 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); diff --git a/rpcs3/Emu/RSX/GL/glutils/common.cpp b/rpcs3/Emu/RSX/GL/glutils/common.cpp index 3c5dfc4db1..05320ee90f 100644 --- a/rpcs3/Emu/RSX/GL/glutils/common.cpp +++ b/rpcs3/Emu/RSX/GL/glutils/common.cpp @@ -1,4 +1,3 @@ -#pragma once #include "state_tracker.hpp" #include "vao.hpp" diff --git a/rpcs3/Emu/RSX/Program/CgBinaryFragmentProgram.cpp b/rpcs3/Emu/RSX/Program/CgBinaryFragmentProgram.cpp index c3b7bc7237..5a2e373e14 100644 --- a/rpcs3/Emu/RSX/Program/CgBinaryFragmentProgram.cpp +++ b/rpcs3/Emu/RSX/Program/CgBinaryFragmentProgram.cpp @@ -62,7 +62,7 @@ std::string CgBinaryDisasm::GetMask() 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() diff --git a/rpcs3/Emu/RSX/Program/CgBinaryVertexProgram.cpp b/rpcs3/Emu/RSX/Program/CgBinaryVertexProgram.cpp index 85f0a3f5e2..38cc1fe9a0 100644 --- a/rpcs3/Emu/RSX/Program/CgBinaryVertexProgram.cpp +++ b/rpcs3/Emu/RSX/Program/CgBinaryVertexProgram.cpp @@ -124,7 +124,8 @@ std::string CgBinaryDisasm::GetSRCDisasm(const u32 n) switch (src[n].reg_type) { case 1: //temp - ret += "R" + std::to_string(src[n].tmp_src); + ret += 'R'; + ret += std::to_string(src[n].tmp_src); break; case 2: //input if (d1.input_src < reg_table.size()) diff --git a/rpcs3/Emu/RSX/RSXZCULL.cpp b/rpcs3/Emu/RSX/RSXZCULL.cpp index d0ff179aab..bb31769679 100644 --- a/rpcs3/Emu/RSX/RSXZCULL.cpp +++ b/rpcs3/Emu/RSX/RSXZCULL.cpp @@ -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 rsx_log.warning("Reports area at location %s was accessed. ZCULL optimizations will be disabled.", location_tostring(location)); diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index 9bf54c6c82..c8193dc213 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -47,7 +47,7 @@ namespace vk VkPipelineStageFlags dst_stage, 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: //case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL: diff --git a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp index 20131a9db3..2a946671d3 100644 --- a/rpcs3/Emu/RSX/VK/VKRenderPass.cpp +++ b/rpcs3/Emu/RSX/VK/VKRenderPass.cpp @@ -31,7 +31,7 @@ namespace vk // Internal utils static u64 encode_layout(VkImageLayout layout) { - switch (layout) + switch (+layout) { case VK_IMAGE_LAYOUT_GENERAL: case VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL: @@ -77,7 +77,7 @@ namespace vk // Encoders 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_DEPTH_STENCIL_ATTACHMENT_OPTIMAL: diff --git a/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp b/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp index f61d89a2a0..c7d61177d1 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp @@ -78,7 +78,7 @@ namespace vk VkPipelineStageFlags src_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: // Avoid this layout as it is unoptimized @@ -127,7 +127,7 @@ namespace vk fmt::throw_exception("Attempted to transition to an invalid layout"); } - switch (current_layout) + switch (+current_layout) { case VK_IMAGE_LAYOUT_GENERAL: // Avoid this layout as it is unoptimized diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index b1716e267c..7cd19057ca 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -750,17 +750,17 @@ namespace rsx 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(); } - void set_zcull_stats_enable(thread* rsx, u32, u32 arg) + void set_zcull_stats_enable(thread* rsx, u32, u32) { 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(); } @@ -1006,7 +1006,7 @@ namespace rsx } // 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 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 = vm::_ptr(dst_address); - const auto src = reinterpret_cast*>(fifo_span.data()); + const auto src = utils::bless>(fifo_span.data()); if (!dst_address) { @@ -1825,7 +1825,7 @@ namespace rsx template 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); } diff --git a/rpcs3/Emu/VFS.cpp b/rpcs3/Emu/VFS.cpp index 30dffd8ec9..2630d317f3 100644 --- a/rpcs3/Emu/VFS.cpp +++ b/rpcs3/Emu/VFS.cpp @@ -317,7 +317,8 @@ std::string vfs::get(std::string_view vpath, std::vector* out_dir, // Handle /host_root (not escaped, not processed) if (out_path) { - *out_path = "/"; + out_path->clear(); + *out_path += '/'; *out_path += fmt::merge(name_list, "/"); *out_path += vpath; } @@ -339,7 +340,8 @@ std::string vfs::get(std::string_view vpath, std::vector* out_dir, // Merge path fragments if (out_path) { - *out_path = "/"; + out_path->clear(); + *out_path += '/'; *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); } - + mount_path->emplace_back(); // 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 // Prepend "/host_root" to path and return the constructed string - result = "/"; + result.clear(); + result += '/'; for (const auto& name : *mount_path) { diff --git a/rpcs3/main.cpp b/rpcs3/main.cpp index 5e34f8d84c..7b692a6457 100644 --- a/rpcs3/main.cpp +++ b/rpcs3/main.cpp @@ -537,7 +537,7 @@ int main(int argc, char** argv) std::string argument_str; 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 += " "; } sys_log.notice("argc: %d, argv: %s", argc, argument_str); diff --git a/rpcs3/rpcs3qt/debugger_list.cpp b/rpcs3/rpcs3qt/debugger_list.cpp index 5e013676fb..efb837b9dc 100644 --- a/rpcs3/rpcs3qt/debugger_list.cpp +++ b/rpcs3/rpcs3qt/debugger_list.cpp @@ -97,7 +97,7 @@ u32 debugger_list::GetStartAddress(u32 address) 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) { @@ -116,7 +116,7 @@ void debugger_list::ShowAddress(u32 addr, bool select_addr, bool 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; } @@ -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 current_pc = m_cpu->get_pc(); 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) { @@ -250,7 +250,7 @@ void debugger_list::scroll(s32 steps) 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(m_cpu)->try_get_pc_of_x_cmds_backwards(-steps, m_start_addr); count == 0u - steps) { steps = 0; @@ -388,7 +388,7 @@ void debugger_list::resizeEvent(QResizeEvent* event) 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(rect().height() - frameWidth() * 2, visualItemRect(item(0)).height()); if (old_size <= m_item_count) diff --git a/rpcs3/util/media_utils.cpp b/rpcs3/util/media_utils.cpp index d2d00603d8..c7171c9b7c 100644 --- a/rpcs3/util/media_utils.cpp +++ b/rpcs3/util/media_utils.cpp @@ -181,7 +181,7 @@ namespace utils AVCodecContext* context = nullptr; AVFrame* frame = nullptr; SwrContext* swr = nullptr; - + ~scoped_av() { // Clean up @@ -358,14 +358,14 @@ namespace utils } duration_ms = stream->duration / 1000; - - AVPacket packet{}; - av_init_packet(&packet); + + AVPacket* packet = av_packet_alloc(); + std::unique_ptr packet_(packet); // 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)); has_error = true; diff --git a/rpcs3/util/simd.hpp b/rpcs3/util/simd.hpp index 6d2e912e63..98ada37470 100644 --- a/rpcs3/util/simd.hpp +++ b/rpcs3/util/simd.hpp @@ -2591,7 +2591,7 @@ inline v128 gv_extend_lo_s8(const v128& vec) #if defined(__SSE4_1__) return _mm_cvtepi8_epi16(vec); #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) return int16x8_t(vmovl_s8(vget_low_s8(vec))); #endif @@ -2613,7 +2613,7 @@ inline v128 gv_extend_hi_s8(const v128& vec) #if defined(__SSE4_1__) return _mm_cvtepi8_epi16(_mm_loadu_si64(vec._bytes + 8)); #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) return int16x8_t(vmovl_s8(vget_high_s8(vec))); #endif @@ -2642,7 +2642,7 @@ inline v128 gv_extend_lo_s16(const v128& vec) #if defined(__SSE4_1__) return _mm_cvtepi16_epi32(vec); #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) return int32x4_t(vmovl_s16(vget_low_s16(vec))); #endif @@ -2664,7 +2664,7 @@ inline v128 gv_extend_hi_s16(const v128& vec) #if defined(__SSE4_1__) return _mm_cvtepi16_epi32(_mm_loadu_si64(vec._bytes + 8)); #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) return int32x4_t(vmovl_s16(vget_high_s16(vec))); #endif diff --git a/rpcs3/util/vm_native.cpp b/rpcs3/util/vm_native.cpp index afaf2c67f2..a620e9d99e 100644 --- a/rpcs3/util/vm_native.cpp +++ b/rpcs3/util/vm_native.cpp @@ -229,7 +229,7 @@ namespace utils 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 if (is_memory_mapping && has_win10_memory_mapping_api())