mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
C-style cast cleanup VII
This commit is contained in:
parent
d2fd3c6bc4
commit
835892aa51
@ -297,7 +297,7 @@ public:
|
||||
while (num_segs < 16)
|
||||
{
|
||||
auto ptr = ::mmap(nullptr, max_size, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1, 0);
|
||||
if (ptr != MAP_FAILED)
|
||||
if (ptr != reinterpret_cast<void*>(-1))
|
||||
found_segs[num_segs++] = Segment(ptr, static_cast<u32>(max_size));
|
||||
else if (max_size > 0x1000000)
|
||||
max_size -= 0x1000000;
|
||||
|
@ -766,9 +766,9 @@ uint64_t* darwin_x64reg(x64_context *context, int reg)
|
||||
|
||||
#define X64REG(context, reg) (freebsd_x64reg(context, reg))
|
||||
#ifdef __DragonFly__
|
||||
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((union savefpu*)(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg]))
|
||||
# define XMMREG(context, reg) (reinterpret_cast<v128*>((reinterpret_cast<union savefpu*>(context)->uc_mcontext.mc_fpregs)->sv_xmm.sv_xmm[reg]))
|
||||
#else
|
||||
# define XMMREG(context, reg) (reinterpret_cast<v128*>(((struct savefpu*)(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg]))
|
||||
# define XMMREG(context, reg) (reinterpret_cast<v128*>((reinterpret_cast<struct savefpu*>(context)->uc_mcontext.mc_fpstate)->sv_xmm[reg]))
|
||||
#endif
|
||||
#define EFLAGS(context) ((context)->uc_mcontext.mc_rflags)
|
||||
|
||||
@ -1714,7 +1714,7 @@ void thread_base::initialize(bool(*wait_cb)(const void*))
|
||||
#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
pthread_set_name_np(pthread_self(), m_name.get().c_str());
|
||||
#elif defined(__NetBSD__)
|
||||
pthread_setname_np(pthread_self(), "%s", (void*)m_name.get().c_str());
|
||||
pthread_setname_np(pthread_self(), "%s", const_cast<void*>(static_cast<void*>(m_name.get().c_str())));
|
||||
#elif !defined(_WIN32)
|
||||
pthread_setname_np(pthread_self(), m_name.get().substr(0, 15).c_str());
|
||||
#endif
|
||||
@ -1902,7 +1902,7 @@ u64 thread_base::get_cycles()
|
||||
mach_port_name_t port = pthread_mach_thread_np(reinterpret_cast<pthread_t>(m_thread.load()));
|
||||
mach_msg_type_number_t count = THREAD_BASIC_INFO_COUNT;
|
||||
thread_basic_info_data_t info;
|
||||
kern_return_t ret = thread_info(port, THREAD_BASIC_INFO, (thread_info_t)&info, &count);
|
||||
kern_return_t ret = thread_info(port, THREAD_BASIC_INFO, reinterpret_cast<thread_info_t>(&info), &count);
|
||||
if (ret == KERN_SUCCESS)
|
||||
{
|
||||
cycles = static_cast<u64>(info.user_time.seconds + info.system_time.seconds) * 1'000'000'000 +
|
||||
@ -2187,7 +2187,7 @@ void thread_ctrl::set_thread_affinity_mask(u64 mask)
|
||||
// Supports only one core
|
||||
thread_affinity_policy_data_t policy = { static_cast<integer_t>(utils::cnttz64(mask)) };
|
||||
thread_port_t mach_thread = pthread_mach_thread_np(pthread_self());
|
||||
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, (thread_policy_t)&policy, 1);
|
||||
thread_policy_set(mach_thread, THREAD_AFFINITY_POLICY, reinterpret_cast<thread_policy_t>(&policy), 1);
|
||||
#elif defined(__linux__) || defined(__DragonFly__) || defined(__FreeBSD__)
|
||||
cpu_set_t cs;
|
||||
CPU_ZERO(&cs);
|
||||
|
@ -65,6 +65,11 @@ namespace utils
|
||||
#else
|
||||
auto ptr = ::mmap(use_addr, size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
|
||||
if (ptr == reinterpret_cast<void*>(-1))
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (use_addr && ptr != use_addr)
|
||||
{
|
||||
::munmap(ptr, size);
|
||||
@ -90,7 +95,7 @@ namespace utils
|
||||
#ifdef _WIN32
|
||||
verify(HERE), ::VirtualFree(pointer, size, MEM_DECOMMIT);
|
||||
#else
|
||||
verify(HERE), ::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
verify(HERE), ::mmap(pointer, size, PROT_NONE, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0) != reinterpret_cast<void*>(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -100,7 +105,7 @@ namespace utils
|
||||
memory_decommit(pointer, size);
|
||||
memory_commit(pointer, size, prot);
|
||||
#else
|
||||
verify(HERE), ::mmap(pointer, size, +prot, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0);
|
||||
verify(HERE), ::mmap(pointer, size, +prot, MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0) != reinterpret_cast<void*>(-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,14 @@
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
#include "Emu/Cell/lv2/sys_sync.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
#include "libavcodec/avcodec.h"
|
||||
@ -12,6 +20,11 @@ extern "C"
|
||||
#define AV_INPUT_BUFFER_PADDING_SIZE FF_INPUT_BUFFER_PADDING_SIZE
|
||||
#endif
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "cellPamf.h"
|
||||
#include "cellAdec.h"
|
||||
|
@ -6,12 +6,25 @@
|
||||
#include "Emu/Cell/lv2/sys_ppu_thread.h"
|
||||
#include "sysPrxForUser.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libswscale/swscale.h"
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "cellPamf.h"
|
||||
#include "cellVdec.h"
|
||||
@ -214,8 +227,8 @@ struct vdec_context final
|
||||
|
||||
packet.data = vm::_ptr<u8>(au_addr);
|
||||
packet.size = au_size;
|
||||
packet.pts = au_pts != -1 ? au_pts : AV_NOPTS_VALUE;
|
||||
packet.dts = au_dts != -1 ? au_dts : AV_NOPTS_VALUE;
|
||||
packet.pts = au_pts != -1 ? au_pts : INT64_MIN;
|
||||
packet.dts = au_dts != -1 ? au_dts : INT64_MIN;
|
||||
|
||||
if (next_pts == 0 && au_pts != -1)
|
||||
{
|
||||
@ -235,8 +248,8 @@ struct vdec_context final
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.pts = AV_NOPTS_VALUE;
|
||||
packet.dts = AV_NOPTS_VALUE;
|
||||
packet.pts = INT64_MIN;
|
||||
packet.dts = INT64_MIN;
|
||||
cellVdec.trace("End sequence...");
|
||||
}
|
||||
|
||||
@ -289,12 +302,12 @@ struct vdec_context final
|
||||
fmt::throw_exception("Repeated frames not supported (0x%x)", frame->repeat_pict);
|
||||
}
|
||||
|
||||
if (frame->pkt_pts != AV_NOPTS_VALUE)
|
||||
if (frame->pkt_pts != INT64_MIN)
|
||||
{
|
||||
next_pts = frame->pkt_pts;
|
||||
}
|
||||
|
||||
if (frame->pkt_dts != AV_NOPTS_VALUE)
|
||||
if (frame->pkt_dts != INT64_MIN)
|
||||
{
|
||||
next_dts = frame->pkt_dts;
|
||||
}
|
||||
|
@ -3,10 +3,23 @@
|
||||
#include "Emu/IdManager.h"
|
||||
#include "Emu/Cell/PPUModule.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
#include "libswscale/swscale.h"
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "cellVpost.h"
|
||||
|
||||
|
@ -1,9 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
#include "libswscale/swscale.h"
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "Utilities/BEType.h"
|
||||
|
||||
|
@ -1,6 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
#include <libusb.h>
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "Emu/Memory/vm.h"
|
||||
#include "Emu/Cell/lv2/sys_usbd.h"
|
||||
|
||||
|
@ -679,7 +679,7 @@ private:
|
||||
case driver_vendor::NVIDIA:
|
||||
{
|
||||
// 10 + 8 + 8 + 6
|
||||
const auto major_version = VK_VERSION_MAJOR(props.driverVersion);
|
||||
const auto major_version = props.driverVersion >> 22;
|
||||
const auto minor_version = (props.driverVersion >> 14) & 0xff;
|
||||
const auto patch = (props.driverVersion >> 6) & 0xff;
|
||||
const auto revision = (props.driverVersion & 0x3f);
|
||||
@ -690,9 +690,9 @@ private:
|
||||
{
|
||||
// 10 + 10 + 12 (standard vulkan encoding created with VK_MAKE_VERSION)
|
||||
return fmt::format("%u.%u.%u",
|
||||
VK_VERSION_MAJOR(props.driverVersion),
|
||||
VK_VERSION_MINOR(props.driverVersion),
|
||||
VK_VERSION_PATCH(props.driverVersion));
|
||||
(props.driverVersion >> 22),
|
||||
(props.driverVersion >> 12) & 0x3ff,
|
||||
(props.driverVersion) & 0x3ff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1385,10 +1385,10 @@ private:
|
||||
u32 encoded_component_map() const
|
||||
{
|
||||
#if (VK_DISABLE_COMPONENT_SWIZZLE)
|
||||
u32 result = (u32)info.components.a - 1;
|
||||
result |= ((u32)info.components.r - 1) << 3;
|
||||
result |= ((u32)info.components.g - 1) << 6;
|
||||
result |= ((u32)info.components.b - 1) << 9;
|
||||
u32 result = static_cast<u32>(info.components.a) - 1;
|
||||
result |= (static_cast<u32>(info.components.r) - 1) << 3;
|
||||
result |= (static_cast<u32>(info.components.g) - 1) << 6;
|
||||
result |= (static_cast<u32>(info.components.b) - 1) << 9;
|
||||
|
||||
return result;
|
||||
#else
|
||||
@ -2036,7 +2036,7 @@ public:
|
||||
|
||||
class swapchain_MacOS : public native_swapchain_base
|
||||
{
|
||||
void* nsView = NULL;
|
||||
void* nsView = nullptr;
|
||||
|
||||
public:
|
||||
swapchain_MacOS(physical_device &gpu, uint32_t _present_queue, uint32_t _graphics_queue, VkFormat format = VK_FORMAT_B8G8R8A8_UNORM)
|
||||
@ -2082,10 +2082,10 @@ public:
|
||||
|
||||
class swapchain_X11 : public native_swapchain_base
|
||||
{
|
||||
Display *display = NULL;
|
||||
Window window = (Window)NULL;
|
||||
XImage* pixmap = NULL;
|
||||
GC gc = NULL;
|
||||
Display* display = nullptr;
|
||||
Window window = 0;
|
||||
XImage* pixmap = nullptr;
|
||||
GC gc = nullptr;
|
||||
int bit_depth = 24;
|
||||
|
||||
public:
|
||||
@ -2118,7 +2118,10 @@ public:
|
||||
}
|
||||
|
||||
XVisualInfo visual{};
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
if (!XMatchVisualInfo(display, DefaultScreen(display), bit_depth, TrueColor, &visual))
|
||||
#pragma GCC diagnostic pop
|
||||
{
|
||||
LOG_ERROR(RSX, "Could not find matching visual info!" HERE);
|
||||
return false;
|
||||
@ -2147,7 +2150,10 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
gc = DefaultGC(display, DefaultScreen(display));
|
||||
#pragma GCC diagnostic pop
|
||||
}
|
||||
|
||||
void destroy(bool full=true) override
|
||||
|
@ -6,10 +6,23 @@
|
||||
#include "Overlays/overlays.h"
|
||||
#include "Utilities/sysinfo.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push, 0)
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wall"
|
||||
#pragma GCC diagnostic ignored "-Wextra"
|
||||
#pragma GCC diagnostic ignored "-Wold-style-cast"
|
||||
#endif
|
||||
extern "C"
|
||||
{
|
||||
#include "libswscale/swscale.h"
|
||||
}
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#else
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
namespace rsx
|
||||
{
|
||||
|
@ -28,6 +28,8 @@ else()
|
||||
add_compile_options(-msse -msse2 -mcx16)
|
||||
add_compile_options(-fno-strict-aliasing)
|
||||
|
||||
add_compile_options(-Werror=old-style-cast)
|
||||
|
||||
#TODO Clean the code so these are removed
|
||||
add_compile_options(-Wno-unused-variable)
|
||||
add_compile_options(-Wno-reorder)
|
||||
|
@ -383,14 +383,14 @@ void ds3_pad_handler::get_extended_info(const std::shared_ptr<PadDevice>& device
|
||||
|
||||
#ifdef _WIN32
|
||||
// Official Sony Windows DS3 driver seems to do the same modification of this value as the ps3
|
||||
pad->m_sensors[0].m_value = *((le_t<u16> *)&ds3dev->buf[41 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[0].m_value = *reinterpret_cast<le_t<u16, 1>*>(&ds3dev->buf[41 + DS3_HID_OFFSET]);
|
||||
#else
|
||||
// When getting raw values from the device this adjustement is needed
|
||||
pad->m_sensors[0].m_value = 512 - (*((le_t<u16> *)&ds3dev->buf[41]) - 512);
|
||||
pad->m_sensors[0].m_value = 512 - (*reinterpret_cast<le_t<u16, 1>*>(&ds3dev->buf[41]) - 512);
|
||||
#endif
|
||||
pad->m_sensors[1].m_value = *((le_t<u16> *)&ds3dev->buf[45 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[2].m_value = *((le_t<u16> *)&ds3dev->buf[43 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[3].m_value = *((le_t<u16> *)&ds3dev->buf[47 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[1].m_value = *reinterpret_cast<le_t<u16, 1>*>(&ds3dev->buf[45 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[2].m_value = *reinterpret_cast<le_t<u16, 1>*>(&ds3dev->buf[43 + DS3_HID_OFFSET]);
|
||||
pad->m_sensors[3].m_value = *reinterpret_cast<le_t<u16, 1>*>(&ds3dev->buf[47 + DS3_HID_OFFSET]);
|
||||
|
||||
// Those are formulas used to adjust sensor values in sys_hid code but I couldn't find all the vars.
|
||||
//auto polish_value = [](s32 value, s32 dword_0x0, s32 dword_0x4, s32 dword_0x8, s32 dword_0xC, s32 dword_0x18, s32 dword_0x1C) -> u16
|
||||
@ -403,7 +403,7 @@ void ds3_pad_handler::get_extended_info(const std::shared_ptr<PadDevice>& device
|
||||
// value += dword_0x8;
|
||||
// if (value < dword_0x18) return dword_0x18;
|
||||
// if (value > dword_0x1C) return dword_0x1C;
|
||||
// return (u16)value;
|
||||
// return static_cast<u16>(value);
|
||||
//};
|
||||
|
||||
// dword_0x0 and dword_0xC are unknown
|
||||
@ -516,8 +516,8 @@ void ds3_pad_handler::apply_pad_data(const std::shared_ptr<PadDevice>& device, c
|
||||
|
||||
if (dev->large_motor != pad->m_vibrateMotors[0].m_value || dev->small_motor != pad->m_vibrateMotors[1].m_value)
|
||||
{
|
||||
dev->large_motor = (u8)pad->m_vibrateMotors[0].m_value;
|
||||
dev->small_motor = (u8)pad->m_vibrateMotors[1].m_value;
|
||||
dev->large_motor = static_cast<u8>(pad->m_vibrateMotors[0].m_value);
|
||||
dev->small_motor = static_cast<u8>(pad->m_vibrateMotors[1].m_value);
|
||||
send_output_report(dev);
|
||||
}
|
||||
}
|
||||
|
@ -738,8 +738,8 @@ ds4_pad_handler::DS4DataStatus ds4_pad_handler::GetRawData(const std::shared_ptr
|
||||
{
|
||||
const s16 rawValue = read_s16(&buf[calibOffset]);
|
||||
const s16 calValue = ApplyCalibration(rawValue, device->calibData[i]);
|
||||
buf[calibOffset++] = ((u16)calValue >> 0) & 0xFF;
|
||||
buf[calibOffset++] = ((u16)calValue >> 8) & 0xFF;
|
||||
buf[calibOffset++] = (static_cast<u16>(calValue) >> 0) & 0xFF;
|
||||
buf[calibOffset++] = (static_cast<u16>(calValue) >> 8) & 0xFF;
|
||||
}
|
||||
}
|
||||
memcpy(device->padData.data(), &buf[offset], 64);
|
||||
@ -847,9 +847,9 @@ void ds4_pad_handler::get_extended_info(const std::shared_ptr<PadDevice>& device
|
||||
// all we need to do is convert to ds3 range
|
||||
|
||||
// accel
|
||||
f32 accelX = (((s16)((u16)(buf[20] << 8) | buf[19])) / static_cast<f32>(DS4_ACC_RES_PER_G)) * -1;
|
||||
f32 accelY = (((s16)((u16)(buf[22] << 8) | buf[21])) / static_cast<f32>(DS4_ACC_RES_PER_G)) * -1;
|
||||
f32 accelZ = (((s16)((u16)(buf[24] << 8) | buf[23])) / static_cast<f32>(DS4_ACC_RES_PER_G)) * -1;
|
||||
f32 accelX = static_cast<s16>((buf[20] << 8) | buf[19]) / static_cast<f32>(DS4_ACC_RES_PER_G) * -1;
|
||||
f32 accelY = static_cast<s16>((buf[22] << 8) | buf[21]) / static_cast<f32>(DS4_ACC_RES_PER_G) * -1;
|
||||
f32 accelZ = static_cast<s16>((buf[24] << 8) | buf[23]) / static_cast<f32>(DS4_ACC_RES_PER_G) * -1;
|
||||
|
||||
// now just use formula from ds3
|
||||
accelX = accelX * 113 + 512;
|
||||
@ -861,7 +861,7 @@ void ds4_pad_handler::get_extended_info(const std::shared_ptr<PadDevice>& device
|
||||
pad->m_sensors[2].m_value = Clamp0To1023(accelZ);
|
||||
|
||||
// gyroX is yaw, which is all that we need
|
||||
f32 gyroX = (((s16)((u16)(buf[16] << 8) | buf[15])) / static_cast<f32>(DS4_GYRO_RES_PER_DEG_S)) * -1;
|
||||
f32 gyroX = static_cast<s16>((buf[16] << 8) | buf[15]) / static_cast<f32>(DS4_GYRO_RES_PER_DEG_S) * -1;
|
||||
//const int gyroY = ((u16)(buf[14] << 8) | buf[13]) / 256;
|
||||
//const int gyroZ = ((u16)(buf[18] << 8) | buf[17]) / 256;
|
||||
|
||||
|
@ -80,7 +80,7 @@ void keyboard_pad_handler::Key(const u32 code, bool pressed, u16 value)
|
||||
bool is_max = pad->m_sticks[i].m_keyCodeMax == code;
|
||||
bool is_min = pad->m_sticks[i].m_keyCodeMin == code;
|
||||
|
||||
u16 normalized_value = std::max(u16(1), static_cast<u16>(std::floor((double)value / 2.0)));
|
||||
u16 normalized_value = std::max<u16>(1, static_cast<u16>(std::floor(value / 2.0)));
|
||||
|
||||
if (is_max)
|
||||
m_stick_max[i] = pressed ? 128 + normalized_value : 128;
|
||||
@ -267,22 +267,22 @@ void keyboard_pad_handler::keyPressEvent(QKeyEvent* event)
|
||||
return;
|
||||
case Qt::Key_K:
|
||||
m_multi_y = std::min(m_multi_y + 0.1, 5.0);
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", (int)(m_multi_y * 100));
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
|
||||
event->ignore();
|
||||
return;
|
||||
case Qt::Key_J:
|
||||
m_multi_y = std::max(0.0, m_multi_y - 0.1);
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", (int)(m_multi_y * 100));
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier y = %d", static_cast<int>(m_multi_y * 100));
|
||||
event->ignore();
|
||||
return;
|
||||
case Qt::Key_H:
|
||||
m_multi_x = std::min(m_multi_x + 0.1, 5.0);
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", (int)(m_multi_x * 100));
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
|
||||
event->ignore();
|
||||
return;
|
||||
case Qt::Key_G:
|
||||
m_multi_x = std::max(0.0, m_multi_x - 0.1);
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", (int)(m_multi_x * 100));
|
||||
LOG_SUCCESS(GENERAL, "mouse move adjustment: multiplier x = %d", static_cast<int>(m_multi_x * 100));
|
||||
event->ignore();
|
||||
return;
|
||||
default:
|
||||
@ -318,19 +318,19 @@ void keyboard_pad_handler::mouseMoveEvent(QMouseEvent* event)
|
||||
|
||||
if (m_target && m_target->visibility() == QWindow::Visibility::FullScreen && m_target->isActive())
|
||||
{
|
||||
// get the screen dimensions
|
||||
// get the screen dimensions
|
||||
const QSize screen = m_target->size();
|
||||
|
||||
// get the center of the screen in global coordinates
|
||||
// get the center of the screen in global coordinates
|
||||
QPoint p_center = m_target->geometry().topLeft() + QPoint(screen.width() / 2, screen.height() / 2);
|
||||
|
||||
// reset the mouse to the center for consistent results since edge movement won't be registered
|
||||
// reset the mouse to the center for consistent results since edge movement won't be registered
|
||||
QCursor::setPos(m_target->screen(), p_center);
|
||||
|
||||
// convert the center into screen coordinates
|
||||
// convert the center into screen coordinates
|
||||
p_center = m_target->mapFromGlobal(p_center);
|
||||
|
||||
// get the delta of the mouse position to the screen center
|
||||
// get the delta of the mouse position to the screen center
|
||||
const QPoint p_delta = event->pos() - p_center;
|
||||
|
||||
movement_x = p_delta.x();
|
||||
@ -345,8 +345,8 @@ void keyboard_pad_handler::mouseMoveEvent(QMouseEvent* event)
|
||||
last_pos_y = event->y();
|
||||
}
|
||||
|
||||
movement_x = m_multi_x * (double)movement_x;
|
||||
movement_y = m_multi_y * (double)movement_y;
|
||||
movement_x = m_multi_x * movement_x;
|
||||
movement_y = m_multi_y * movement_y;
|
||||
|
||||
if (movement_x < 0)
|
||||
{
|
||||
@ -525,8 +525,8 @@ bool keyboard_pad_handler::bindPadToDevice(std::shared_ptr<Pad> pad, const std::
|
||||
|
||||
m_deadzone_x = p_profile->mouse_deadzone_x;
|
||||
m_deadzone_y = p_profile->mouse_deadzone_y;
|
||||
m_multi_x = (double)p_profile->mouse_acceleration_x / 100.0;
|
||||
m_multi_y = (double)p_profile->mouse_acceleration_y / 100.0;
|
||||
m_multi_x = p_profile->mouse_acceleration_x / 100.0;
|
||||
m_multi_y = p_profile->mouse_acceleration_y / 100.0;
|
||||
m_l_stick_lerp_factor = p_profile->l_stick_lerp_factor / 100.0f;
|
||||
m_r_stick_lerp_factor = p_profile->r_stick_lerp_factor / 100.0f;
|
||||
|
||||
@ -642,8 +642,8 @@ void keyboard_pad_handler::ThreadProc()
|
||||
// we already applied the following values on keypress if we used factor 1
|
||||
if (stick_lerp_factor < 1.0f)
|
||||
{
|
||||
const f32 v0 = (f32)bindings[i]->m_sticks[j].m_value;
|
||||
const f32 v1 = (f32)m_stick_val[j];
|
||||
const f32 v0 = static_cast<f32>(bindings[i]->m_sticks[j].m_value);
|
||||
const f32 v1 = static_cast<f32>(m_stick_val[j]);
|
||||
|
||||
// linear interpolation from the current stick value v0 to the desired stick value v1
|
||||
f32 res = lerp(v0, v1, stick_lerp_factor);
|
||||
@ -651,7 +651,7 @@ void keyboard_pad_handler::ThreadProc()
|
||||
// round to the correct direction to prevent sticky sticks on small factors
|
||||
res = (v0 <= v1) ? std::ceil(res) : std::floor(res);
|
||||
|
||||
bindings[i]->m_sticks[j].m_value = (u16)res;
|
||||
bindings[i]->m_sticks[j].m_value = static_cast<u16>(res);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,8 +92,8 @@ void pad_thread::Init()
|
||||
{
|
||||
case pad_handler::keyboard:
|
||||
keyptr = std::make_shared<keyboard_pad_handler>();
|
||||
keyptr->moveToThread((QThread *)curthread);
|
||||
keyptr->SetTargetWindow((QWindow *)curwindow);
|
||||
keyptr->moveToThread(static_cast<QThread*>(curthread));
|
||||
keyptr->SetTargetWindow(static_cast<QWindow*>(curwindow));
|
||||
cur_pad_handler = keyptr;
|
||||
break;
|
||||
case pad_handler::ds3:
|
||||
|
@ -26,7 +26,8 @@ cheat_manager_dialog* cheat_manager_dialog::inst = nullptr;
|
||||
template <>
|
||||
void fmt_class_string<cheat_type>::format(std::string& out, u64 arg)
|
||||
{
|
||||
format_enum(out, arg, [](cheat_type value) {
|
||||
format_enum(out, arg, [](cheat_type value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case cheat_type::unsigned_8_cheat: return "Unsigned 8 bits";
|
||||
@ -37,6 +38,7 @@ void fmt_class_string<cheat_type>::format(std::string& out, u64 arg)
|
||||
case cheat_type::signed_16_cheat: return "Signed 16 bits";
|
||||
case cheat_type::signed_32_cheat: return "Signed 32 bits";
|
||||
case cheat_type::signed_64_cheat: return "Signed 64 bits";
|
||||
case cheat_type::max: break;
|
||||
}
|
||||
|
||||
return unknown;
|
||||
@ -59,7 +61,9 @@ namespace YAML
|
||||
u64 type64 = 0;
|
||||
if (!cfg::try_to_enum_value(&type64, &fmt_class_string<cheat_type>::format, node[1].Scalar()))
|
||||
return false;
|
||||
rhs.type = (cheat_type)type64;
|
||||
if (type64 >= cheat_type_max)
|
||||
return false;
|
||||
rhs.type = cheat_type{::narrow<u8>(type64)};
|
||||
rhs.red_script = node[2].as<std::string>();
|
||||
return true;
|
||||
}
|
||||
@ -68,8 +72,8 @@ namespace YAML
|
||||
|
||||
YAML::Emitter& operator<<(YAML::Emitter& out, const cheat_info& rhs)
|
||||
{
|
||||
std::string type_formatted{};
|
||||
fmt_class_string<cheat_type>::format(type_formatted, (u64)rhs.type);
|
||||
std::string type_formatted;
|
||||
fmt::append(type_formatted, "%s", rhs.type);
|
||||
|
||||
out << YAML::BeginSeq << rhs.description << type_formatted << rhs.red_script << YAML::EndSeq;
|
||||
|
||||
@ -80,7 +84,8 @@ bool cheat_info::from_str(const std::string& cheat_line)
|
||||
{
|
||||
auto cheat_vec = fmt::split(cheat_line, {"@@@"}, false);
|
||||
|
||||
if (cheat_vec.size() != 5)
|
||||
s64 val64 = 0;
|
||||
if (cheat_vec.size() != 5 || !cfg::try_to_int64(&val64, cheat_vec[2], 0, cheat_type_max - 1))
|
||||
{
|
||||
log_cheat.fatal("Failed to parse cheat line");
|
||||
return false;
|
||||
@ -88,7 +93,7 @@ bool cheat_info::from_str(const std::string& cheat_line)
|
||||
|
||||
game = cheat_vec[0];
|
||||
description = cheat_vec[1];
|
||||
type = (cheat_type)std::stoul(cheat_vec[2]);
|
||||
type = cheat_type{::narrow<u8>(val64)};
|
||||
offset = std::stoul(cheat_vec[3]);
|
||||
red_script = cheat_vec[4];
|
||||
|
||||
@ -97,7 +102,7 @@ bool cheat_info::from_str(const std::string& cheat_line)
|
||||
|
||||
std::string cheat_info::to_str() const
|
||||
{
|
||||
std::string cheat_str = game + "@@@" + description + "@@@" + std::to_string((int)type) + "@@@" + std::to_string(offset) + "@@@" + red_script + "@@@";
|
||||
std::string cheat_str = game + "@@@" + description + "@@@" + std::to_string(static_cast<u8>(type)) + "@@@" + std::to_string(offset) + "@@@" + red_script + "@@@";
|
||||
return cheat_str;
|
||||
}
|
||||
|
||||
@ -498,13 +503,13 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent)
|
||||
edt_cheat_search_value = new QLineEdit();
|
||||
cbx_cheat_search_type = new QComboBox();
|
||||
|
||||
for (u64 i = 0; i <= (u64)cheat_type::signed_64_cheat; i++)
|
||||
for (u64 i = 0; i < cheat_type_max; i++)
|
||||
{
|
||||
std::string type_formatted{};
|
||||
fmt_class_string<cheat_type>::format(type_formatted, i);
|
||||
std::string type_formatted;
|
||||
fmt::append(type_formatted, "%s", static_cast<cheat_type>(i));
|
||||
cbx_cheat_search_type->insertItem(i, QString::fromStdString(type_formatted));
|
||||
}
|
||||
cbx_cheat_search_type->setCurrentIndex((int)cheat_type::signed_32_cheat);
|
||||
cbx_cheat_search_type->setCurrentIndex(static_cast<u8>(cheat_type::signed_32_cheat));
|
||||
grp_add_cheat_sub_layout->addWidget(btn_new_search);
|
||||
grp_add_cheat_sub_layout->addWidget(btn_filter_results);
|
||||
grp_add_cheat_sub_layout->addWidget(edt_cheat_search_value);
|
||||
@ -565,7 +570,7 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent)
|
||||
if (success)
|
||||
{
|
||||
if (cheat->type >= cheat_type::signed_8_cheat && cheat->type <= cheat_type::signed_64_cheat)
|
||||
cur_value = tr("%1").arg((s64)result_value);
|
||||
cur_value = tr("%1").arg(static_cast<s64>(result_value));
|
||||
else
|
||||
cur_value = tr("%1").arg(result_value);
|
||||
|
||||
@ -714,7 +719,7 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent)
|
||||
}
|
||||
|
||||
// TODO: better way to do this?
|
||||
switch ((cheat_type)cbx_cheat_search_type->currentIndex())
|
||||
switch (static_cast<cheat_type>(cbx_cheat_search_type->currentIndex()))
|
||||
{
|
||||
case cheat_type::unsigned_8_cheat: results = convert_and_set<u8>(final_offset); break;
|
||||
case cheat_type::unsigned_16_cheat: results = convert_and_set<u16>(final_offset); break;
|
||||
@ -759,7 +764,7 @@ cheat_manager_dialog::cheat_manager_dialog(QWidget* parent)
|
||||
QAction* add_to_cheat_list = new QAction(tr("Add to cheat list"), menu);
|
||||
|
||||
u32 offset = offsets_found[lst_search->currentRow()];
|
||||
cheat_type type = (cheat_type)cbx_cheat_search_type->currentIndex();
|
||||
cheat_type type = static_cast<cheat_type>(cbx_cheat_search_type->currentIndex());
|
||||
std::string name = Emu.GetTitle();
|
||||
|
||||
connect(add_to_cheat_list, &QAction::triggered, [=]() {
|
||||
@ -879,7 +884,7 @@ void cheat_manager_dialog::do_the_search()
|
||||
QString qstr_to_search = edt_cheat_search_value->text();
|
||||
|
||||
// TODO: better way to do this?
|
||||
switch ((cheat_type)cbx_cheat_search_type->currentIndex())
|
||||
switch (static_cast<cheat_type>(cbx_cheat_search_type->currentIndex()))
|
||||
{
|
||||
case cheat_type::unsigned_8_cheat: res_conv = convert_and_search<u8>(); break;
|
||||
case cheat_type::unsigned_16_cheat: res_conv = convert_and_search<u16>(); break;
|
||||
@ -928,7 +933,7 @@ void cheat_manager_dialog::update_cheat_list()
|
||||
tbl_cheats->setItem(row, 1, new QTableWidgetItem(QString::fromStdString(offset.second.description)));
|
||||
|
||||
std::string type_formatted;
|
||||
fmt_class_string<cheat_type>::format(type_formatted, (u64)offset.second.type);
|
||||
fmt::append(type_formatted, "%s", offset.second.type);
|
||||
QTableWidgetItem* item_type = new QTableWidgetItem(QString::fromStdString(type_formatted));
|
||||
item_type->setFlags(item_type->flags() & ~Qt::ItemIsEditable);
|
||||
tbl_cheats->setItem(row, 2, item_type);
|
||||
|
@ -18,8 +18,11 @@ enum class cheat_type : u8
|
||||
signed_16_cheat,
|
||||
signed_32_cheat,
|
||||
signed_64_cheat,
|
||||
max
|
||||
};
|
||||
|
||||
constexpr u8 cheat_type_max = static_cast<u8>(cheat_type::max);
|
||||
|
||||
struct cheat_info
|
||||
{
|
||||
std::string game;
|
||||
|
@ -331,7 +331,7 @@ void debugger_frame::UpdateUnitList()
|
||||
|
||||
const auto on_select = [&](u32, cpu_thread& cpu)
|
||||
{
|
||||
QVariant var_cpu = qVariantFromValue((void *)&cpu);
|
||||
QVariant var_cpu = qVariantFromValue<void*>(&cpu);
|
||||
m_choice_units->addItem(qstr(cpu.get_name()), var_cpu);
|
||||
if (old_cpu == var_cpu) m_choice_units->setCurrentIndex(m_choice_units->count() - 1);
|
||||
};
|
||||
@ -363,7 +363,7 @@ void debugger_frame::OnSelectUnit()
|
||||
{
|
||||
const auto on_select = [&](u32, cpu_thread& cpu)
|
||||
{
|
||||
cpu_thread* data = (cpu_thread *)m_choice_units->currentData().value<void *>();
|
||||
cpu_thread* data = static_cast<cpu_thread*>(m_choice_units->currentData().value<void*>());
|
||||
return data == &cpu;
|
||||
};
|
||||
|
||||
@ -526,14 +526,14 @@ u64 debugger_frame::EvaluateExpression(const QString& expression)
|
||||
|
||||
for (int i = 0; i < 32; ++i)
|
||||
{
|
||||
scriptEngine.globalObject().setProperty(QString("r%1hi").arg(i), QJSValue((u32)(ppu->gpr[i] >> 32)));
|
||||
scriptEngine.globalObject().setProperty(QString("r%1").arg(i), QJSValue((u32)(ppu->gpr[i])));
|
||||
scriptEngine.globalObject().setProperty(QString("r%1hi").arg(i), QJSValue(static_cast<u32>(ppu->gpr[i] >> 32)));
|
||||
scriptEngine.globalObject().setProperty(QString("r%1").arg(i), QJSValue(static_cast<u32>(ppu->gpr[i])));
|
||||
}
|
||||
|
||||
scriptEngine.globalObject().setProperty("lrhi", QJSValue((u32)(ppu->lr >> 32 )));
|
||||
scriptEngine.globalObject().setProperty("lr", QJSValue((u32)(ppu->lr)));
|
||||
scriptEngine.globalObject().setProperty("ctrhi", QJSValue((u32)(ppu->ctr >> 32)));
|
||||
scriptEngine.globalObject().setProperty("ctr", QJSValue((u32)(ppu->ctr)));
|
||||
scriptEngine.globalObject().setProperty("lrhi", QJSValue(static_cast<u32>(ppu->lr >> 32)));
|
||||
scriptEngine.globalObject().setProperty("lr", QJSValue(static_cast<u32>(ppu->lr)));
|
||||
scriptEngine.globalObject().setProperty("ctrhi", QJSValue(static_cast<u32>(ppu->ctr >> 32)));
|
||||
scriptEngine.globalObject().setProperty("ctr", QJSValue(static_cast<u32>(ppu->ctr)));
|
||||
scriptEngine.globalObject().setProperty("cia", QJSValue(ppu->cia));
|
||||
}
|
||||
else
|
||||
|
@ -239,7 +239,7 @@ void emu_settings::Microphone_Creator::ParseDevices(std::string list)
|
||||
}
|
||||
|
||||
const auto devices_list = fmt::split(list, { "@@@" });
|
||||
for (u32 index = 0; index < std::min((u32)4, (u32)devices_list.size()); index++)
|
||||
for (u32 index = 0; index < std::min<u32>(4, ::size32(devices_list)); index++)
|
||||
{
|
||||
sel_list[index] = devices_list[index];
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
|
||||
{
|
||||
if (minutes_played <= 0)
|
||||
{
|
||||
if (seconds_played == 1)
|
||||
if (seconds_played == 1)
|
||||
{
|
||||
return tr("%0 second").arg(seconds_played);
|
||||
}
|
||||
@ -398,7 +398,7 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
|
||||
|
||||
if (seconds_played <= 0)
|
||||
{
|
||||
if (minutes_played == 1)
|
||||
if (minutes_played == 1)
|
||||
{
|
||||
return tr("%0 minute").arg(minutes_played);
|
||||
}
|
||||
@ -408,11 +408,11 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
|
||||
{
|
||||
return tr("%0 minute and %1 second").arg(minutes_played).arg(seconds_played);
|
||||
}
|
||||
if (minutes_played == 1)
|
||||
if (minutes_played == 1)
|
||||
{
|
||||
return tr("%0 minute and %1 seconds").arg(minutes_played).arg(seconds_played);
|
||||
}
|
||||
if (seconds_played == 1)
|
||||
if (seconds_played == 1)
|
||||
{
|
||||
return tr("%0 minutes and %1 second").arg(minutes_played).arg(seconds_played);
|
||||
}
|
||||
@ -421,7 +421,7 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
|
||||
|
||||
if (minutes_played <= 0)
|
||||
{
|
||||
if (hours_played == 1)
|
||||
if (hours_played == 1)
|
||||
{
|
||||
return tr("%0 hour").arg(hours_played);
|
||||
}
|
||||
@ -431,11 +431,11 @@ QString game_list_frame::GetPlayTimeBySerial(const QString& serial)
|
||||
{
|
||||
return tr("%0 hour and %1 minute").arg(hours_played).arg(minutes_played);
|
||||
}
|
||||
if (hours_played == 1)
|
||||
if (hours_played == 1)
|
||||
{
|
||||
return tr("%0 hour and %1 minutes").arg(hours_played).arg(minutes_played);
|
||||
}
|
||||
if (minutes_played == 1)
|
||||
if (minutes_played == 1)
|
||||
{
|
||||
return tr("%0 hours and %1 minute").arg(hours_played).arg(minutes_played);
|
||||
}
|
||||
@ -1860,7 +1860,7 @@ int game_list_frame::PopulateGameList()
|
||||
std::string selected_item = CurrentSelectionIconPath();
|
||||
|
||||
m_gameList->clearContents();
|
||||
m_gameList->setRowCount((int)m_game_data.size());
|
||||
m_gameList->setRowCount(m_game_data.size());
|
||||
|
||||
int row = 0, index = -1;
|
||||
for (const auto& game : m_game_data)
|
||||
|
@ -60,7 +60,8 @@ void gl_gs_frame::set_current(draw_context_t ctx)
|
||||
fmt::throw_exception("Null context handle passed to set_current" HERE);
|
||||
}
|
||||
|
||||
auto context = (GLContext*)(ctx);
|
||||
const auto context = static_cast<GLContext*>(ctx);
|
||||
|
||||
if (!context->handle->makeCurrent(context->surface))
|
||||
{
|
||||
if (!context->owner)
|
||||
@ -81,8 +82,8 @@ void gl_gs_frame::set_current(draw_context_t ctx)
|
||||
|
||||
void gl_gs_frame::delete_context(draw_context_t ctx)
|
||||
{
|
||||
const auto gl_ctx = static_cast<GLContext*>(ctx);
|
||||
|
||||
auto gl_ctx = (GLContext*)ctx;
|
||||
gl_ctx->handle->doneCurrent();
|
||||
|
||||
#ifdef _MSC_VER
|
||||
@ -115,6 +116,7 @@ void gl_gs_frame::flip(draw_context_t context, bool skip_frame)
|
||||
//Do not swap buffers if frame skip is active
|
||||
if (skip_frame) return;
|
||||
|
||||
auto gl_ctx = (GLContext*)context;
|
||||
const auto gl_ctx = static_cast<GLContext*>(context);
|
||||
|
||||
gl_ctx->handle->swapBuffers(gl_ctx->surface);
|
||||
}
|
||||
|
@ -218,16 +218,16 @@ void gs_frame::show()
|
||||
display_handle_t gs_frame::handle() const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return (HWND) this->winId();
|
||||
return reinterpret_cast<HWND>(this->winId());
|
||||
#elif defined(__APPLE__)
|
||||
return (void*) this->winId(); //NSView
|
||||
return reinterpret_cast<void*>(this->winId()); //NSView
|
||||
#else
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
QPlatformNativeInterface *native = QGuiApplication::platformNativeInterface();
|
||||
struct wl_display *wl_dpy = static_cast<struct wl_display *>(
|
||||
native->nativeResourceForWindow("display", NULL));
|
||||
struct wl_surface *wl_surf = static_cast<struct wl_surface *>(
|
||||
native->nativeResourceForWindow("surface", (QWindow *)this));
|
||||
native->nativeResourceForWindow("surface", const_cast<QWindow*>(static_cast<const QWindow*>(this))));
|
||||
if (wl_dpy != nullptr && wl_surf != nullptr)
|
||||
{
|
||||
return std::make_pair(wl_dpy, wl_surf);
|
||||
@ -235,7 +235,7 @@ display_handle_t gs_frame::handle() const
|
||||
else
|
||||
{
|
||||
#endif
|
||||
return std::make_pair(XOpenDisplay(0), (unsigned long)(this->winId()));
|
||||
return std::make_pair(XOpenDisplay(0), static_cast<ulong>(this->winId()));
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
}
|
||||
#endif
|
||||
@ -298,7 +298,7 @@ void gs_frame::flip(draw_context_t, bool /*skip_frame*/)
|
||||
|
||||
if ((m_show_fps_in_title = g_cfg.misc.show_fps_in_title.get()))
|
||||
{
|
||||
fps_title = qstr(fmt::format("FPS: %.2f", (double)m_frames / fps_t.GetElapsedTimeInSec()));
|
||||
fps_title = qstr(fmt::format("FPS: %.2f", m_frames / fps_t.GetElapsedTimeInSec()));
|
||||
|
||||
if (!m_windowTitle.isEmpty())
|
||||
{
|
||||
@ -338,8 +338,8 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
|
||||
}
|
||||
|
||||
std::vector<u8> sshot_data_alpha(sshot_data.size());
|
||||
const u32* sshot_ptr = (const u32*)sshot_data.data();
|
||||
u32* alpha_ptr = (u32*)sshot_data_alpha.data();
|
||||
const u32* sshot_ptr = reinterpret_cast<const u32*>(sshot_data.data());
|
||||
u32* alpha_ptr = reinterpret_cast<u32*>(sshot_data_alpha.data());
|
||||
|
||||
for (size_t index = 0; index < sshot_data.size() / sizeof(u32); index++)
|
||||
{
|
||||
@ -354,13 +354,13 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
|
||||
|
||||
std::vector<u8*> rows(sshot_height);
|
||||
for (size_t y = 0; y < sshot_height; y++)
|
||||
rows[y] = (u8*)sshot_data_alpha.data() + y * sshot_width * 4;
|
||||
rows[y] = sshot_data_alpha.data() + y * sshot_width * 4;
|
||||
|
||||
png_set_rows(write_ptr, info_ptr, &rows[0]);
|
||||
png_set_write_fn(write_ptr, &encoded_png,
|
||||
[](png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
{
|
||||
std::vector<u8>* p = (std::vector<u8>*)png_get_io_ptr(png_ptr);
|
||||
std::vector<u8>* p = static_cast<std::vector<u8>*>(png_get_io_ptr(png_ptr));
|
||||
p->insert(p->end(), data, data + length);
|
||||
},
|
||||
nullptr);
|
||||
@ -531,7 +531,7 @@ void gs_frame::UpdateProgress(int progress, bool disable)
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
//Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), (double)progress / (double)m_gauge_max);
|
||||
properties.insert(QStringLiteral("progress"), 1. * progress / m_gauge_max);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -197,9 +197,9 @@ void gui_application::InitializeCallbacks()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0: ((gs_frame*)m_game_window)->progress_reset(value); break;
|
||||
case 1: ((gs_frame*)m_game_window)->progress_increment(value); break;
|
||||
case 2: ((gs_frame*)m_game_window)->progress_set_limit(value); break;
|
||||
case 0: static_cast<gs_frame*>(m_game_window)->progress_reset(value); break;
|
||||
case 1: static_cast<gs_frame*>(m_game_window)->progress_increment(value); break;
|
||||
case 2: static_cast<gs_frame*>(m_game_window)->progress_set_limit(value); break;
|
||||
default: LOG_FATAL(GENERAL, "Unknown type in handle_taskbar_progress(type=%d, value=%d)", type, value); break;
|
||||
}
|
||||
}
|
||||
|
@ -342,7 +342,7 @@ void gui_settings::SaveCurrentConfig(const QString& friendly_name)
|
||||
|
||||
logs::level gui_settings::GetLogLevel()
|
||||
{
|
||||
return (logs::level) GetValue(gui::l_level).toUInt();
|
||||
return logs::level{GetValue(gui::l_level).toUInt()};
|
||||
}
|
||||
|
||||
bool gui_settings::GetGamelistColVisibility(int col)
|
||||
@ -370,7 +370,7 @@ QStringList gui_settings::GetConfigEntries()
|
||||
}
|
||||
|
||||
void gui_settings::BackupSettingsToTarget(const QString& friendly_name)
|
||||
{
|
||||
{
|
||||
QSettings target(ComputeSettingsDir() + friendly_name + ".ini", QSettings::Format::IniFormat);
|
||||
|
||||
for (const QString& key : m_settings.allKeys())
|
||||
@ -420,12 +420,12 @@ QString gui_settings::GetCurrentStylesheetPath()
|
||||
|
||||
QSize gui_settings::SizeFromSlider(int pos)
|
||||
{
|
||||
return gui::gl_icon_size_min + (gui::gl_icon_size_max - gui::gl_icon_size_min) * (pos / (float)gui::gl_max_slider_pos);
|
||||
return gui::gl_icon_size_min + (gui::gl_icon_size_max - gui::gl_icon_size_min) * (1.f * pos / gui::gl_max_slider_pos);
|
||||
}
|
||||
|
||||
gui_save gui_settings::GetGuiSaveForColumn(int col)
|
||||
{
|
||||
// hide sound format, parental level, firmware version and path by default
|
||||
bool show = col != gui::column_sound && col != gui::column_parental && col != gui::column_firmware && col != gui::column_path;
|
||||
return gui_save{ gui::game_list, "visibility_" + gui::get_game_list_column_name((gui::game_list_columns)col), show };
|
||||
return gui_save{ gui::game_list, "visibility_" + gui::get_game_list_column_name(static_cast<gui::game_list_columns>(col)), show };
|
||||
}
|
||||
|
@ -185,8 +185,8 @@ namespace gui
|
||||
const gui_save gl_iconSizeGrid = gui_save(game_list, "iconSizeGrid", get_Index(gl_icon_size_small));
|
||||
const gui_save gl_iconColor = gui_save(game_list, "iconColor", gl_icon_color);
|
||||
const gui_save gl_listMode = gui_save(game_list, "listMode", true);
|
||||
const gui_save gl_textFactor = gui_save(game_list, "textFactor", (qreal) 2.0);
|
||||
const gui_save gl_marginFactor = gui_save(game_list, "marginFactor", (qreal) 0.09);
|
||||
const gui_save gl_textFactor = gui_save(game_list, "textFactor", qreal{2.0});
|
||||
const gui_save gl_marginFactor = gui_save(game_list, "marginFactor", qreal{0.09});
|
||||
const gui_save gl_show_hidden = gui_save(game_list, "show_hidden", false);
|
||||
const gui_save gl_hidden_list = gui_save(game_list, "hidden_list", QStringList());
|
||||
const gui_save gl_draw_compat = gui_save(game_list, "draw_compat", false);
|
||||
@ -198,7 +198,7 @@ namespace gui
|
||||
const gui_save fs_dev_usb000_list = gui_save(fs, "dev_usb000_list", QStringList());
|
||||
|
||||
const gui_save l_tty = gui_save(logger, "TTY", true);
|
||||
const gui_save l_level = gui_save(logger, "level", (uint)(logs::level::success));
|
||||
const gui_save l_level = gui_save(logger, "level", static_cast<uint>(logs::level::success));
|
||||
const gui_save l_stack = gui_save(logger, "stack", true);
|
||||
const gui_save l_stack_tty = gui_save(logger, "TTY stack", false);
|
||||
|
||||
|
@ -74,7 +74,7 @@ void kernel_explorer::Update()
|
||||
const u32 total_memory_usage = dct->used;
|
||||
|
||||
QTreeWidgetItem* root = new QTreeWidgetItem();
|
||||
root->setText(0, qstr(fmt::format("Process, ID = 0x00000001, Total Memory Usage = 0x%x (%0.2f MB)", total_memory_usage, (float)total_memory_usage / (1024 * 1024))));
|
||||
root->setText(0, qstr(fmt::format("Process, ID = 0x00000001, Total Memory Usage = 0x%x (%0.2f MB)", total_memory_usage, 1.f * total_memory_usage / (1024 * 1024))));
|
||||
m_tree->addTopLevelItem(root);
|
||||
|
||||
union name64
|
||||
|
@ -648,13 +648,13 @@ bool log_frame::eventFilter(QObject* object, QEvent* event)
|
||||
|
||||
if (event->type() == QEvent::KeyPress)
|
||||
{
|
||||
QKeyEvent* e = (QKeyEvent*)event;
|
||||
QKeyEvent* e = static_cast<QKeyEvent*>(event);
|
||||
if (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_F)
|
||||
{
|
||||
if (m_find_dialog && m_find_dialog->isVisible())
|
||||
m_find_dialog->close();
|
||||
|
||||
m_find_dialog = std::make_unique<find_dialog>((QTextEdit*)object, this);
|
||||
m_find_dialog = std::make_unique<find_dialog>(static_cast<QTextEdit*>(object), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
constexpr auto qstr = QString::fromStdString;
|
||||
|
||||
memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowTitle(tr("Memory Viewer"));
|
||||
@ -220,7 +220,7 @@ memory_viewer_panel::memory_viewer_panel(QWidget* parent)
|
||||
int sizey = sb_img_size_y->value();
|
||||
ShowImage(this, m_addr, mode, sizex, sizey, false);
|
||||
});
|
||||
|
||||
|
||||
//Fill the QTextEdits
|
||||
ShowMemory();
|
||||
setFixedSize(sizeHint());
|
||||
@ -240,7 +240,7 @@ void memory_viewer_panel::wheelEvent(QWheelEvent *event)
|
||||
|
||||
QPoint numSteps = event->angleDelta() / 8 / 15; // http://doc.qt.io/qt-5/qwheelevent.html#pixelDelta
|
||||
m_addr -= stepSize * m_colcount * numSteps.y();
|
||||
|
||||
|
||||
m_addr_line->setText(qstr(fmt::format("%08x", m_addr)));
|
||||
ShowMemory();
|
||||
}
|
||||
@ -261,7 +261,7 @@ void memory_viewer_panel::ShowMemory()
|
||||
{
|
||||
for (u32 col = 0; col < m_colcount; col++)
|
||||
{
|
||||
u32 addr = m_addr + row * m_colcount + col;
|
||||
u32 addr = m_addr + row * m_colcount + col;
|
||||
|
||||
if (vm::check_addr(addr))
|
||||
{
|
||||
@ -306,8 +306,9 @@ void memory_viewer_panel::SetPC(const uint pc)
|
||||
|
||||
void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 width, u32 height, bool flipv)
|
||||
{
|
||||
unsigned char* originalBuffer = (unsigned char*)vm::base(addr);
|
||||
unsigned char* convertedBuffer = (unsigned char*)malloc(width * height * 4);
|
||||
uchar* originalBuffer = static_cast<uchar*>(vm::base(addr));
|
||||
uchar* convertedBuffer = static_cast<uchar*>(std::malloc(width * height * 4));
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case(0): // RGB
|
||||
@ -322,7 +323,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case(1): // ARGB
|
||||
for (u32 y = 0; y < height; y++)
|
||||
{
|
||||
@ -335,7 +336,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case(2): // RGBA
|
||||
for (u32 y = 0; y < height; y++)
|
||||
{
|
||||
@ -348,7 +349,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case(3): // ABGR
|
||||
for (u32 y = 0; y < height; y++)
|
||||
{
|
||||
@ -362,7 +363,7 @@ void memory_viewer_panel::ShowImage(QWidget* parent, u32 addr, int mode, u32 wid
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Flip vertically
|
||||
if (flipv)
|
||||
{
|
||||
|
@ -240,12 +240,12 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||
|
||||
if (index == 0 && m_gauge1)
|
||||
{
|
||||
m_gauge1->setValue(std::min(m_gauge1->value() + (int)delta, m_gauge1->maximum()));
|
||||
m_gauge1->setValue(std::min(m_gauge1->value() + static_cast<int>(delta), m_gauge1->maximum()));
|
||||
}
|
||||
|
||||
if (index == 1 && m_gauge2)
|
||||
{
|
||||
m_gauge2->setValue(std::min(m_gauge2->value() + (int)delta, m_gauge2->maximum()));
|
||||
m_gauge2->setValue(std::min(m_gauge2->value() + static_cast<int>(delta), m_gauge2->maximum()));
|
||||
}
|
||||
|
||||
if (index == taskbar_index || taskbar_index == -1)
|
||||
@ -253,10 +253,10 @@ void msg_dialog_frame::ProgressBarInc(u32 index, u32 delta)
|
||||
#ifdef _WIN32
|
||||
if (m_tb_progress)
|
||||
{
|
||||
m_tb_progress->setValue(std::min(m_tb_progress->value() + (int)delta, m_tb_progress->maximum()));
|
||||
m_tb_progress->setValue(std::min(m_tb_progress->value() + static_cast<int>(delta), m_tb_progress->maximum()));
|
||||
}
|
||||
#elif HAVE_QTDBUS
|
||||
m_progress_value = std::min(m_progress_value + (int)delta, m_gauge_max);
|
||||
m_progress_value = std::min(m_progress_value + static_cast<int>(delta), m_gauge_max);
|
||||
UpdateProgress(m_progress_value);
|
||||
#endif
|
||||
}
|
||||
@ -315,7 +315,7 @@ void msg_dialog_frame::UpdateProgress(int progress, bool disable)
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
// Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), (double)progress/(double)m_gauge_max);
|
||||
properties.insert(QStringLiteral("progress"), 1.* progress / m_gauge_max);
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
||||
const int cursor_pos_old = cursor_pos_new + m_text_old.length() - text.length();
|
||||
|
||||
// Reset to old state if character limit was reached
|
||||
if ((u32)m_text_old.length() >= charlimit && (u32)text.length() > charlimit)
|
||||
if (m_text_old.length() >= static_cast<int>(charlimit) && text.length() > static_cast<int>(charlimit))
|
||||
{
|
||||
input->blockSignals(true);
|
||||
input->setPlainText(m_text_old);
|
||||
@ -180,7 +180,7 @@ void osk_dialog_frame::Create(const std::string& title, const std::u16string& me
|
||||
|
||||
void osk_dialog_frame::SetOskText(const QString& text)
|
||||
{
|
||||
std::memcpy(osk_text, reinterpret_cast<const char16_t*>(text.constData()), ((size_t)text.size() + 1) * sizeof(char16_t));
|
||||
std::memcpy(osk_text, reinterpret_cast<const char16_t*>(text.constData()), (text.size() + 1u) * sizeof(char16_t));
|
||||
}
|
||||
|
||||
void osk_dialog_frame::Close(bool accepted)
|
||||
|
@ -55,7 +55,7 @@ pad_settings_dialog::pad_settings_dialog(QWidget *parent, const GameInfo *game)
|
||||
|
||||
// load input config
|
||||
g_cfg_input.from_default();
|
||||
|
||||
|
||||
if (game)
|
||||
{
|
||||
m_title_id = game->serial;
|
||||
@ -508,9 +508,9 @@ void pad_settings_dialog::ReloadButtons()
|
||||
updateButton(button_ids::id_pad_rstick_right, ui->b_rstick_right, &m_handler_cfg.rs_right);
|
||||
updateButton(button_ids::id_pad_rstick_up, ui->b_rstick_up, &m_handler_cfg.rs_up);
|
||||
|
||||
ui->chb_vibration_large->setChecked((bool)m_handler_cfg.enable_vibration_motor_large);
|
||||
ui->chb_vibration_small->setChecked((bool)m_handler_cfg.enable_vibration_motor_small);
|
||||
ui->chb_vibration_switch->setChecked((bool)m_handler_cfg.switch_vibration_motors);
|
||||
ui->chb_vibration_large->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_large));
|
||||
ui->chb_vibration_small->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_small));
|
||||
ui->chb_vibration_switch->setChecked(static_cast<bool>(m_handler_cfg.switch_vibration_motors));
|
||||
|
||||
m_min_force = m_handler->vibration_min;
|
||||
m_max_force = m_handler->vibration_max;
|
||||
@ -529,20 +529,20 @@ void pad_settings_dialog::ReloadButtons()
|
||||
// Enable Mouse Acceleration
|
||||
std::vector<std::string> mouse_accel_range_x = m_handler_cfg.mouse_acceleration_x.to_list();
|
||||
ui->mouse_accel_x->setRange(std::stod(mouse_accel_range_x.front()) / 100.0, std::stod(mouse_accel_range_x.back()) / 100.0);
|
||||
ui->mouse_accel_x->setValue((double)m_handler_cfg.mouse_acceleration_x / 100.0);
|
||||
ui->mouse_accel_x->setValue(m_handler_cfg.mouse_acceleration_x / 100.0);
|
||||
|
||||
std::vector<std::string> mouse_accel_range_y = m_handler_cfg.mouse_acceleration_y.to_list();
|
||||
ui->mouse_accel_y->setRange(std::stod(mouse_accel_range_y.front()) / 100.0, std::stod(mouse_accel_range_y.back()) / 100.0);
|
||||
ui->mouse_accel_y->setValue((double)m_handler_cfg.mouse_acceleration_y / 100.0);
|
||||
ui->mouse_accel_y->setValue(m_handler_cfg.mouse_acceleration_y / 100.0);
|
||||
|
||||
// Enable Stick Lerp Factors
|
||||
std::vector<std::string> left_stick_lerp_range = m_handler_cfg.l_stick_lerp_factor.to_list();
|
||||
ui->left_stick_lerp->setRange(std::stod(left_stick_lerp_range.front()) / 100.0, std::stod(left_stick_lerp_range.back()) / 100.0);
|
||||
ui->left_stick_lerp->setValue((double)m_handler_cfg.l_stick_lerp_factor / 100.0);
|
||||
ui->left_stick_lerp->setValue(m_handler_cfg.l_stick_lerp_factor / 100.0);
|
||||
|
||||
std::vector<std::string> right_stick_lerp_range = m_handler_cfg.r_stick_lerp_factor.to_list();
|
||||
ui->right_stick_lerp->setRange(std::stod(right_stick_lerp_range.front()) / 100.0, std::stod(right_stick_lerp_range.back()) / 100.0);
|
||||
ui->right_stick_lerp->setValue((double)m_handler_cfg.r_stick_lerp_factor / 100.0);
|
||||
ui->right_stick_lerp->setValue(m_handler_cfg.r_stick_lerp_factor / 100.0);
|
||||
|
||||
// Enable Vibration Checkboxes
|
||||
m_enable_rumble = m_handler->has_rumble();
|
||||
@ -660,7 +660,7 @@ void pad_settings_dialog::keyPressEvent(QKeyEvent *keyEvent)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetKeyName(keyEvent);
|
||||
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetKeyName(keyEvent);
|
||||
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ void pad_settings_dialog::mouseReleaseEvent(QMouseEvent* event)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetMouseName(event);
|
||||
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetMouseName(event);
|
||||
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
|
||||
}
|
||||
|
||||
@ -735,7 +735,7 @@ void pad_settings_dialog::mouseMoveEvent(QMouseEvent* /*event*/)
|
||||
|
||||
if (key != 0)
|
||||
{
|
||||
m_cfg_entries[m_button_id].key = ((keyboard_pad_handler*)m_handler.get())->GetMouseName(key);
|
||||
m_cfg_entries[m_button_id].key = (static_cast<keyboard_pad_handler*>(m_handler.get()))->GetMouseName(key);
|
||||
m_cfg_entries[m_button_id].text = qstr(m_cfg_entries[m_button_id].key);
|
||||
ReactivateButtons();
|
||||
}
|
||||
@ -751,7 +751,7 @@ bool pad_settings_dialog::eventFilter(QObject* object, QEvent* event)
|
||||
}
|
||||
if (event->type() == QEvent::MouseMove)
|
||||
{
|
||||
mouseMoveEvent((QMouseEvent*)event);
|
||||
mouseMoveEvent(static_cast<QMouseEvent*>(event));
|
||||
}
|
||||
return QDialog::eventFilter(object, event);
|
||||
}
|
||||
@ -762,9 +762,9 @@ void pad_settings_dialog::UpdateLabel(bool is_reset)
|
||||
{
|
||||
if (m_handler->has_rumble())
|
||||
{
|
||||
ui->chb_vibration_large->setChecked((bool)m_handler_cfg.enable_vibration_motor_large);
|
||||
ui->chb_vibration_small->setChecked((bool)m_handler_cfg.enable_vibration_motor_small);
|
||||
ui->chb_vibration_switch->setChecked((bool)m_handler_cfg.switch_vibration_motors);
|
||||
ui->chb_vibration_large->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_large));
|
||||
ui->chb_vibration_small->setChecked(static_cast<bool>(m_handler_cfg.enable_vibration_motor_small));
|
||||
ui->chb_vibration_switch->setChecked(static_cast<bool>(m_handler_cfg.switch_vibration_motors));
|
||||
}
|
||||
|
||||
if (m_handler->has_deadzones())
|
||||
@ -1091,28 +1091,28 @@ void pad_settings_dialog::ChangeProfile()
|
||||
switch (m_handler->m_type)
|
||||
{
|
||||
case pad_handler::null:
|
||||
((NullPadHandler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<NullPadHandler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
case pad_handler::keyboard:
|
||||
((keyboard_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<keyboard_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
case pad_handler::ds3:
|
||||
((ds3_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<ds3_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
case pad_handler::ds4:
|
||||
((ds4_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<ds4_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
#ifdef _WIN32
|
||||
case pad_handler::xinput:
|
||||
((xinput_pad_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<xinput_pad_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
case pad_handler::mm:
|
||||
((mm_joystick_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<mm_joystick_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_LIBEVDEV
|
||||
case pad_handler::evdev:
|
||||
((evdev_joystick_handler*)m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
static_cast<evdev_joystick_handler*>(m_handler.get())->init_config(&m_handler_cfg, cfg_name);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
@ -57,7 +57,7 @@ void progress_dialog::UpdateProgress(int progress, bool disable)
|
||||
else
|
||||
properties.insert(QStringLiteral("progress-visible"), true);
|
||||
//Progress takes a value from 0.0 to 0.1
|
||||
properties.insert(QStringLiteral("progress"), (double)progress / (double)maximum());
|
||||
properties.insert(QStringLiteral("progress"), 1. * progress / maximum());
|
||||
message << QStringLiteral("application://rpcs3.desktop") << properties;
|
||||
QDBusConnection::sessionBus().send(message);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ namespace gui
|
||||
|
||||
for (int y = 0; y < image.height(); ++y)
|
||||
{
|
||||
QRgb *row = (QRgb*)image.scanLine(y);
|
||||
QRgb* row = reinterpret_cast<QRgb*>(image.scanLine(y));
|
||||
bool row_filled = false;
|
||||
|
||||
for (int x = 0; x < image.width(); ++x)
|
||||
|
@ -146,7 +146,7 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
|
||||
if (reg.compare(0, 3, "GPR") == 0 || reg.compare(0, 3, "FPR") == 0)
|
||||
{
|
||||
const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16);
|
||||
if (reg.compare(0, 3, "GPR") == 0) ppu.gpr[reg_index] = (u64)reg_value;
|
||||
if (reg.compare(0, 3, "GPR") == 0) ppu.gpr[reg_index] = static_cast<u64>(reg_value);
|
||||
if (reg.compare(0, 3, "FPR") == 0) ppu.fpr[reg_index] = std::bit_cast<f64>(reg_value);
|
||||
return;
|
||||
}
|
||||
@ -154,22 +154,22 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
|
||||
{
|
||||
const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
|
||||
const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
|
||||
ppu.vr[reg_index]._u64[0] = (u64)reg_value0;
|
||||
ppu.vr[reg_index]._u64[1] = (u64)reg_value1;
|
||||
ppu.vr[reg_index]._u64[0] = static_cast<u64>(reg_value0);
|
||||
ppu.vr[reg_index]._u64[1] = static_cast<u64>(reg_value1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (reg == "LR" || reg == "CTR")
|
||||
{
|
||||
const ullong reg_value = std::stoull(value.substr(16, 31), 0, 16);
|
||||
if (reg == "LR") ppu.lr = (u64)reg_value;
|
||||
if (reg == "CTR") ppu.ctr = (u64)reg_value;
|
||||
if (reg == "LR") ppu.lr = static_cast<u64>(reg_value);
|
||||
if (reg == "CTR") ppu.ctr = static_cast<u64>(reg_value);
|
||||
return;
|
||||
}
|
||||
if (reg == "CR")
|
||||
{
|
||||
const ullong reg_value = std::stoull(value.substr(24, 31), 0, 16);
|
||||
if (reg == "CR") ppu.cr.unpack((u32)reg_value);
|
||||
if (reg == "CR") ppu.cr.unpack(static_cast<u32>(reg_value));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -192,8 +192,8 @@ void register_editor_dialog::OnOkay(const std::shared_ptr<cpu_thread>& _cpu)
|
||||
{
|
||||
const ullong reg_value0 = std::stoull(value.substr(16, 31), 0, 16);
|
||||
const ullong reg_value1 = std::stoull(value.substr(0, 15), 0, 16);
|
||||
spu.gpr[reg_index]._u64[0] = (u64)reg_value0;
|
||||
spu.gpr[reg_index]._u64[1] = (u64)reg_value1;
|
||||
spu.gpr[reg_index]._u64[0] = static_cast<u64>(reg_value0);
|
||||
spu.gpr[reg_index]._u64[1] = static_cast<u64>(reg_value1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace
|
||||
template <typename T>
|
||||
gsl::span<T> as_const_span(gsl::span<const std::byte> unformated_span)
|
||||
{
|
||||
return{ (T*)unformated_span.data(), unformated_span.size_bytes() / sizeof(T) };
|
||||
return{ reinterpret_cast<T*>(unformated_span.data()), unformated_span.size_bytes() / sizeof(T) };
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
|
||||
// Restore header states
|
||||
QVariantMap states = m_gui_settings->GetValue(gui::rsx_states).toMap();
|
||||
for (int i = 0; i < m_tw_rsx->count(); i++)
|
||||
((QTableWidget*)m_tw_rsx->widget(i))->horizontalHeader()->restoreState(states[QString::number(i)].toByteArray());
|
||||
(static_cast<QTableWidget*>(m_tw_rsx->widget(i)))->horizontalHeader()->restoreState(states[QString::number(i)].toByteArray());
|
||||
|
||||
// Fill the frame
|
||||
for (u32 i = 0; i < frame_debug.command_queue.size(); i++)
|
||||
@ -261,7 +261,7 @@ void rsx_debugger::closeEvent(QCloseEvent* event)
|
||||
// Save header states and window geometry
|
||||
QVariantMap states;
|
||||
for (int i = 0; i < m_tw_rsx->count(); i++)
|
||||
states[QString::number(i)] = ((QTableWidget*)m_tw_rsx->widget(i))->horizontalHeader()->saveState();
|
||||
states[QString::number(i)] = (static_cast<QTableWidget*>(m_tw_rsx->widget(i)))->horizontalHeader()->saveState();
|
||||
|
||||
m_gui_settings->SetValue(gui::rsx_states, states);
|
||||
m_gui_settings->SetValue(gui::rsx_geometry, saveGeometry());
|
||||
@ -461,7 +461,7 @@ namespace
|
||||
*/
|
||||
u8* convert_to_QImage_buffer(rsx::surface_color_format format, gsl::span<const std::byte> orig_buffer, size_t width, size_t height) noexcept
|
||||
{
|
||||
unsigned char* buffer = (unsigned char*)malloc(width * height * 4);
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
for (u32 i = 0; i < width * height; i++)
|
||||
{
|
||||
// depending on original buffer, the colors may need to be reversed
|
||||
@ -497,7 +497,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
if (width && height && !draw_call.color_buffer[i].empty())
|
||||
{
|
||||
unsigned char* buffer = convert_to_QImage_buffer(draw_call.state.surface_color(), draw_call.color_buffer[i], width, height);
|
||||
buffers[i]->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32));
|
||||
buffers[i]->showImage(QImage(buffer, static_cast<int>(width), static_cast<int>(height), QImage::Format_RGB32));
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
if (width && height && !draw_call.depth_stencil[0].empty())
|
||||
{
|
||||
gsl::span<const std::byte> orig_buffer = draw_call.depth_stencil[0];
|
||||
unsigned char *buffer = (unsigned char *)malloc(width * height * 4);
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
|
||||
if (draw_call.state.surface_depth_fmt() == rsx::surface_depth_format::z24s8)
|
||||
{
|
||||
@ -538,7 +538,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
}
|
||||
}
|
||||
}
|
||||
m_buffer_depth->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32));
|
||||
m_buffer_depth->showImage(QImage(buffer, static_cast<int>(width), static_cast<int>(height), QImage::Format_RGB32));
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,7 +547,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
if (width && height && !draw_call.depth_stencil[1].empty())
|
||||
{
|
||||
gsl::span<const std::byte> orig_buffer = draw_call.depth_stencil[1];
|
||||
unsigned char *buffer = (unsigned char *)malloc(width * height * 4);
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
|
||||
for (u32 row = 0; row < height; row++)
|
||||
{
|
||||
@ -560,7 +560,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
buffer[4 * col + 3 + width * row * 4] = 255;
|
||||
}
|
||||
}
|
||||
m_buffer_stencil->showImage(QImage(buffer, (int)width, (int)height, QImage::Format_RGB32));
|
||||
m_buffer_stencil->showImage(QImage(buffer, static_cast<int>(width), static_cast<int>(height), QImage::Format_RGB32));
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,7 +574,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
//m_list_index_buffer->insertColumn(0, "Index", 0, 700);
|
||||
if (frame_debug.draw_calls[draw_id].state.index_type() == rsx::index_array_type::u16)
|
||||
{
|
||||
u16 *index_buffer = (u16*)frame_debug.draw_calls[draw_id].index.data();
|
||||
u16 *index_buffer = reinterpret_cast<u16*>(frame_debug.draw_calls[draw_id].index.data());
|
||||
for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i)
|
||||
{
|
||||
m_list_index_buffer->insertItem(i, qstr(std::to_string(index_buffer[i])));
|
||||
@ -582,7 +582,7 @@ void rsx_debugger::OnClickDrawCalls()
|
||||
}
|
||||
if (frame_debug.draw_calls[draw_id].state.index_type() == rsx::index_array_type::u32)
|
||||
{
|
||||
u32 *index_buffer = (u32*)frame_debug.draw_calls[draw_id].index.data();
|
||||
u32 *index_buffer = reinterpret_cast<u32*>(frame_debug.draw_calls[draw_id].index.data());
|
||||
for (u32 i = 0; i < frame_debug.draw_calls[draw_id].vertex_count; ++i)
|
||||
{
|
||||
m_list_index_buffer->insertItem(i, qstr(std::to_string(index_buffer[i])));
|
||||
@ -668,7 +668,7 @@ void rsx_debugger::GetBuffers()
|
||||
|
||||
u32 width = buffers[bufferId].width;
|
||||
u32 height = buffers[bufferId].height;
|
||||
unsigned char* buffer = (unsigned char*)malloc(width * height * 4);
|
||||
u8* buffer = static_cast<u8*>(std::malloc(width * height * 4));
|
||||
|
||||
// ABGR to ARGB and flip vertically
|
||||
for (u32 y=0; y<height; y++)
|
||||
@ -853,11 +853,11 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
||||
switch((cmd & 0x3ffff) >> 2)
|
||||
{
|
||||
case 0x3fead:
|
||||
DISASM("Flip and change current buffer: %d", (u32)args[0]);
|
||||
DISASM("Flip and change current buffer: %d", args[0]);
|
||||
break;
|
||||
|
||||
case_16(NV4097_SET_TEXTURE_OFFSET, 0x20):
|
||||
DISASM("Texture Offset[%d]: %07x", index, (u32)args[0]);
|
||||
DISASM("Texture Offset[%d]: %07x", index, args[0]);
|
||||
switch ((args[1] & 0x3) - 1)
|
||||
{
|
||||
case CELL_GCM_LOCATION_LOCAL: DISASM("(Local memory);"); break;
|
||||
@ -876,7 +876,7 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
||||
break;
|
||||
default:
|
||||
{
|
||||
std::string str = rsx::get_pretty_printing_function((cmd & 0x3ffff) >> 2)((u32)args[0]);
|
||||
std::string str = rsx::get_pretty_printing_function((cmd & 0x3ffff) >> 2)(args[0]);
|
||||
DISASM("%s", str.c_str());
|
||||
}
|
||||
}
|
||||
@ -891,7 +891,7 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
|
||||
for(uint i=0; i<count; ++i)
|
||||
{
|
||||
if(i != 0) disasm += ", ";
|
||||
disasm += fmt::format("0x%x", (u32)args[i]);
|
||||
disasm += fmt::format("0x%x", args[i]);
|
||||
}
|
||||
|
||||
disasm += ")";
|
||||
|
@ -73,7 +73,7 @@ void save_data_info_dialog::UpdateData()
|
||||
m_list->setItem(3, 1, new QTableWidgetItem(qstr(m_entry.details)));
|
||||
|
||||
QImage img;
|
||||
if (!m_entry.iconBuf.empty() && img.loadFromData((uchar*)&m_entry.iconBuf[0], static_cast<int>(m_entry.iconBuf.size()), "PNG"))
|
||||
if (!m_entry.iconBuf.empty() && img.loadFromData(m_entry.iconBuf.data(), static_cast<int>(m_entry.iconBuf.size()), "PNG"))
|
||||
{
|
||||
m_list->insertRow(0);
|
||||
QTableWidgetItem* img_item = new QTableWidgetItem();
|
||||
|
@ -179,7 +179,7 @@ void save_data_list_dialog::OnEntryInfo()
|
||||
void save_data_list_dialog::UpdateList()
|
||||
{
|
||||
m_list->clearContents();
|
||||
m_list->setRowCount((int)m_save_entries.size());
|
||||
m_list->setRowCount(::narrow<int>(m_save_entries.size()));
|
||||
|
||||
QVariantMap currNotes = m_gui_settings->GetValue(gui::m_saveNotes).toMap();
|
||||
|
||||
|
@ -240,9 +240,9 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||
SubscribeTooltip(ui->ppu_llvm, json_cpu_ppu["LLVM"].toString());
|
||||
|
||||
QButtonGroup *ppuBG = new QButtonGroup(this);
|
||||
ppuBG->addButton(ui->ppu_precise, (int)ppu_decoder_type::precise);
|
||||
ppuBG->addButton(ui->ppu_fast, (int)ppu_decoder_type::fast);
|
||||
ppuBG->addButton(ui->ppu_llvm, (int)ppu_decoder_type::llvm);
|
||||
ppuBG->addButton(ui->ppu_precise, static_cast<int>(ppu_decoder_type::precise));
|
||||
ppuBG->addButton(ui->ppu_fast, static_cast<int>(ppu_decoder_type::fast));
|
||||
ppuBG->addButton(ui->ppu_llvm, static_cast<int>(ppu_decoder_type::llvm));
|
||||
|
||||
{ // PPU Stuff
|
||||
QString selectedPPU = qstr(xemu_settings->GetSetting(emu_settings::PPUDecoder));
|
||||
@ -269,10 +269,10 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||
SubscribeTooltip(ui->spu_llvm, json_cpu_spu["LLVM"].toString());
|
||||
|
||||
QButtonGroup *spuBG = new QButtonGroup(this);
|
||||
spuBG->addButton(ui->spu_precise, (int)spu_decoder_type::precise);
|
||||
spuBG->addButton(ui->spu_fast, (int)spu_decoder_type::fast);
|
||||
spuBG->addButton(ui->spu_asmjit, (int)spu_decoder_type::asmjit);
|
||||
spuBG->addButton(ui->spu_llvm, (int)spu_decoder_type::llvm);
|
||||
spuBG->addButton(ui->spu_precise, static_cast<int>(spu_decoder_type::precise));
|
||||
spuBG->addButton(ui->spu_fast, static_cast<int>(spu_decoder_type::fast));
|
||||
spuBG->addButton(ui->spu_asmjit, static_cast<int>(spu_decoder_type::asmjit));
|
||||
spuBG->addButton(ui->spu_llvm, static_cast<int>(spu_decoder_type::llvm));
|
||||
|
||||
{ // Spu stuff
|
||||
QString selectedSPU = qstr(xemu_settings->GetSetting(emu_settings::SPUDecoder));
|
||||
@ -318,11 +318,11 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||
|
||||
// creating this in ui file keeps scrambling the order...
|
||||
QButtonGroup *libModeBG = new QButtonGroup(this);
|
||||
libModeBG->addButton(ui->lib_manu, (int)lib_loading_type::manual);
|
||||
libModeBG->addButton(ui->lib_both, (int)lib_loading_type::hybrid);
|
||||
libModeBG->addButton(ui->lib_lv2, (int)lib_loading_type::liblv2only);
|
||||
libModeBG->addButton(ui->lib_lv2b, (int)lib_loading_type::liblv2both);
|
||||
libModeBG->addButton(ui->lib_lv2l, (int)lib_loading_type::liblv2list);
|
||||
libModeBG->addButton(ui->lib_manu, static_cast<int>(lib_loading_type::manual));
|
||||
libModeBG->addButton(ui->lib_both, static_cast<int>(lib_loading_type::hybrid));
|
||||
libModeBG->addButton(ui->lib_lv2, static_cast<int>(lib_loading_type::liblv2only));
|
||||
libModeBG->addButton(ui->lib_lv2b, static_cast<int>(lib_loading_type::liblv2both));
|
||||
libModeBG->addButton(ui->lib_lv2l, static_cast<int>(lib_loading_type::liblv2list));
|
||||
|
||||
{// Handle lib loading options
|
||||
QString selectedLib = qstr(xemu_settings->GetSetting(emu_settings::LibLoadOptions));
|
||||
@ -394,7 +394,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
||||
|
||||
auto l_OnLibButtonClicked = [=](int ind)
|
||||
{
|
||||
if (ind != (int)lib_loading_type::liblv2only)
|
||||
if (ind != static_cast<int>(lib_loading_type::liblv2only))
|
||||
{
|
||||
ui->searchBox->setEnabled(true);
|
||||
ui->lleList->setEnabled(true);
|
||||
|
@ -189,7 +189,7 @@ skylander_dialog::skylander_dialog(QWidget* parent)
|
||||
combo_skylist = new QComboBox();
|
||||
for (auto& entry : list_skylanders)
|
||||
{
|
||||
combo_skylist->addItem(QString::fromStdString(entry.second), QVariant((int)entry.first));
|
||||
combo_skylist->addItem(QString::fromStdString(entry.second), QVariant(int{entry.first}));
|
||||
}
|
||||
|
||||
combo_skylist->addItem(tr("--Unknown--"), QVariant(0xFFFF));
|
||||
@ -236,9 +236,9 @@ skylander_dialog::skylander_dialog(QWidget* parent)
|
||||
u16 sky_id = combo_skylist->itemData(combo_skylist->currentIndex()).toInt();
|
||||
if (sky_id != 0xFFFF)
|
||||
{
|
||||
(le_t<u32>&)g_skylander.sky_dump[0] = (u16)combo_skylist->itemData(combo_skylist->currentIndex()).toInt();
|
||||
(le_t<u16>&)g_skylander.sky_dump[0x10] = (u16)combo_skylist->itemData(combo_skylist->currentIndex()).toInt();
|
||||
(le_t<u16>&)g_skylander.sky_dump[0x1E] = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
reinterpret_cast<le_t<u32>&>(g_skylander.sky_dump[0]) = combo_skylist->itemData(combo_skylist->currentIndex()).toInt() & 0xffff;
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x10]) = combo_skylist->itemData(combo_skylist->currentIndex()).toInt() & 0xffff;
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x1E]) = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
|
||||
std::array<u8, 16> zero_array = {};
|
||||
for (u32 index = 8; index < 0x40; index++)
|
||||
@ -379,26 +379,26 @@ void skylander_dialog::set_checksums()
|
||||
get_block(active + 9, sub_header);
|
||||
|
||||
// Type 4
|
||||
(le_t<u16>&)sub_header[0x0] = 0x0106;
|
||||
u16 res_crc = skylander_crc16(0xFFFF, sub_header.data(), 16);
|
||||
(le_t<u16>&)sub_header[0x0] = do_crc_blocks(res_crc, {10, 12, 13});
|
||||
reinterpret_cast<le_t<u16>&>(sub_header[0x0]) = 0x0106;
|
||||
u16 res_crc = skylander_crc16(0xFFFF, sub_header.data(), 16);
|
||||
reinterpret_cast<le_t<u16>&>(sub_header[0x0]) = do_crc_blocks(res_crc, {10, 12, 13});
|
||||
|
||||
// Type 3
|
||||
std::array<u8, 16> zero_block = {};
|
||||
res_crc = do_crc_blocks(0xFFFF, {5, 6, 8});
|
||||
std::array<u8, 16> zero_block{};
|
||||
res_crc = do_crc_blocks(0xFFFF, {5, 6, 8});
|
||||
for (u32 index = 0; index < 0x0E; index++)
|
||||
{
|
||||
res_crc = skylander_crc16(res_crc, zero_block.data(), 16);
|
||||
}
|
||||
(le_t<u16>&)decrypted_header[0xA] = res_crc;
|
||||
reinterpret_cast<le_t<u16>&>(decrypted_header[0xA]) = res_crc;
|
||||
|
||||
// Type 2
|
||||
res_crc = do_crc_blocks(0xFFFF, {1, 2, 4});
|
||||
(le_t<u16>&)decrypted_header[0xC] = res_crc;
|
||||
res_crc = do_crc_blocks(0xFFFF, {1, 2, 4});
|
||||
reinterpret_cast<le_t<u16>&>(decrypted_header[0xC]) = res_crc;
|
||||
|
||||
// Type 1
|
||||
(le_t<u16>&)decrypted_header[0xE] = 5;
|
||||
(le_t<u16>&)decrypted_header[0xE] = skylander_crc16(0xFFFF, decrypted_header.data(), 16);
|
||||
reinterpret_cast<le_t<u16>&>(decrypted_header[0xE]) = 5;
|
||||
reinterpret_cast<le_t<u16>&>(decrypted_header[0xE]) = skylander_crc16(0xFFFF, decrypted_header.data(), 16);
|
||||
|
||||
set_block(active, decrypted_header);
|
||||
set_block(active + 9, sub_header);
|
||||
@ -425,13 +425,13 @@ void skylander_dialog::new_skylander()
|
||||
memset(g_skylander.sky_dump, 0, 0x40 * 0x10);
|
||||
|
||||
// Set the block permissions
|
||||
(le_t<u32>&)g_skylander.sky_dump[0x36] = 0x690F0F0F;
|
||||
reinterpret_cast<le_t<u32>&>(g_skylander.sky_dump[0x36]) = 0x690F0F0F;
|
||||
for (u32 index = 1; index < 0x10; index++)
|
||||
{
|
||||
(le_t<u32>&)g_skylander.sky_dump[(index * 0x40) + 0x36] = 0x69080F7F;
|
||||
reinterpret_cast<le_t<u32>&>(g_skylander.sky_dump[(index * 0x40) + 0x36]) = 0x69080F7F;
|
||||
}
|
||||
|
||||
(le_t<u16>&)g_skylander.sky_dump[0x1E] = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x1E]) = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
|
||||
std::array<u8, 16> zero_array = {};
|
||||
for (u32 index = 8; index < 0x40; index++)
|
||||
@ -499,15 +499,15 @@ void skylander_dialog::update_edits()
|
||||
|
||||
{
|
||||
std::lock_guard lock(g_skylander.sky_mutex);
|
||||
edit_skyid->setText(QString::number((le_t<u16>&)g_skylander.sky_dump[0x10]));
|
||||
edit_skyid->setText(QString::number(reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x10])));
|
||||
|
||||
u8 active = get_active_block();
|
||||
|
||||
std::array<u8, 16> decrypted;
|
||||
get_block(active, decrypted);
|
||||
u32 xp = ((le_t<u32>&)decrypted.data()[0]) & 0xFFFFFF;
|
||||
u32 xp = reinterpret_cast<le_t<u32>&>(decrypted[0]) & 0xFFFFFF;
|
||||
edit_skyxp->setText(QString::number(xp));
|
||||
u16 money = (le_t<u16>&)decrypted[3];
|
||||
u16 money = reinterpret_cast<le_t<u16, 1>&>(decrypted[3]);
|
||||
edit_skymoney->setText(QString::number(money));
|
||||
}
|
||||
}
|
||||
@ -518,22 +518,22 @@ void skylander_dialog::process_edits()
|
||||
std::lock_guard lock(g_skylander.sky_mutex);
|
||||
|
||||
bool cast_success = false;
|
||||
u16 skyID = edit_skyid->text().toInt(&cast_success);
|
||||
u16 skyID = edit_skyid->text().toInt(&cast_success);
|
||||
if (cast_success)
|
||||
{
|
||||
(le_t<u16>&)g_skylander.sky_dump[0x10] = skyID;
|
||||
(le_t<u16>&)g_skylander.sky_dump[0] = skyID;
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x10]) = skyID;
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0]) = skyID;
|
||||
}
|
||||
|
||||
(le_t<u16>&)g_skylander.sky_dump[0x1E] = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
reinterpret_cast<le_t<u16>&>(g_skylander.sky_dump[0x1E]) = skylander_crc16(0xFFFF, g_skylander.sky_dump, 0x1E);
|
||||
|
||||
u8 active = get_active_block();
|
||||
|
||||
std::array<u8, 16> decrypted_header;
|
||||
get_block(active, decrypted_header);
|
||||
|
||||
u32 old_xp = ((le_t<u32>&)decrypted_header.data()[0]) & 0xFFFFFF;
|
||||
u16 old_money = (le_t<u16>&)decrypted_header[3];
|
||||
u32 old_xp = reinterpret_cast<le_t<u32>&>(decrypted_header[0]) & 0xFFFFFF;
|
||||
u16 old_money = reinterpret_cast<le_t<u16, 1>&>(decrypted_header[3]);
|
||||
|
||||
u32 xp = edit_skyxp->text().toInt(&cast_success);
|
||||
if (!cast_success)
|
||||
@ -543,7 +543,7 @@ void skylander_dialog::process_edits()
|
||||
money = old_money;
|
||||
|
||||
memcpy(decrypted_header.data(), &xp, 3);
|
||||
(le_t<u16>&)decrypted_header[3] = money;
|
||||
reinterpret_cast<le_t<u16>&>(decrypted_header[3]) = money;
|
||||
|
||||
set_block(active, decrypted_header);
|
||||
|
||||
|
@ -832,12 +832,12 @@ void trophy_manager_dialog::PopulateTrophyTable()
|
||||
if (n2->GetName() == "name")
|
||||
{
|
||||
std::string name = n2->GetNodeContent();
|
||||
memcpy(details.name, name.c_str(), std::min((size_t)SCE_NP_TROPHY_NAME_MAX_SIZE, name.length() + 1));
|
||||
strcpy_trunc(details.name, name);
|
||||
}
|
||||
if (n2->GetName() == "detail")
|
||||
{
|
||||
std::string detail = n2->GetNodeContent();
|
||||
memcpy(details.description, detail.c_str(), std::min((size_t)SCE_NP_TROPHY_DESCR_MAX_SIZE, detail.length() + 1));
|
||||
strcpy_trunc(details.description, detail);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& i
|
||||
trophyImgLabel->setPalette(black_background);
|
||||
|
||||
QImage trophyImg;
|
||||
if (!imgBuffer.empty() && trophyImg.loadFromData((uchar*)&imgBuffer[0], static_cast<int>(imgBuffer.size()), "PNG"))
|
||||
if (!imgBuffer.empty() && trophyImg.loadFromData(imgBuffer.data(), static_cast<int>(imgBuffer.size()), "PNG"))
|
||||
{
|
||||
trophyImg = trophyImg.scaledToHeight(height); // I might consider adding ability to change size since on hidpi this will be rather small.
|
||||
trophyImgLabel->setPixmap(QPixmap::fromImage(trophyImg));
|
||||
|
@ -227,7 +227,7 @@ bool update_manager::handle_json(const QByteArray& data, bool automatic)
|
||||
time_t cur_time = mktime(&cur_tm);
|
||||
time_t lts_time = mktime(<s_tm);
|
||||
|
||||
s64 u_timediff = (s64)std::difftime(lts_time, cur_time);
|
||||
s64 u_timediff = static_cast<s64>(std::difftime(lts_time, cur_time));
|
||||
timediff = tr("Your version is %1 day(s), %2 hour(s) and %3 minute(s) old.").arg(u_timediff / (60 * 60 * 24)).arg((u_timediff / (60 * 60)) % 24).arg((u_timediff / 60) % 60);
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
|
||||
mbedtls_sha256_context ctx;
|
||||
mbedtls_sha256_init(&ctx);
|
||||
mbedtls_sha256_starts_ret(&ctx, 0);
|
||||
mbedtls_sha256_update_ret(&ctx, (const unsigned char*)rpcs3_data.data(), rpcs3_data.size());
|
||||
mbedtls_sha256_update_ret(&ctx, reinterpret_cast<const unsigned char*>(rpcs3_data.data()), rpcs3_data.size());
|
||||
mbedtls_sha256_finish_ret(&ctx, res_hash);
|
||||
|
||||
std::string res_hash_string("0000000000000000000000000000000000000000000000000000000000000000");
|
||||
@ -432,7 +432,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
|
||||
case SZ_ERROR_UNSUPPORTED: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder doesn't support this archive"); break;
|
||||
case SZ_ERROR_MEM: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder failed to allocate memory"); break;
|
||||
case SZ_ERROR_CRC: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder CRC error"); break;
|
||||
default: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: %d", (u64)res); break;
|
||||
default: LOG_ERROR(GENERAL, "[Auto-updater] 7z decoder error: %d", static_cast<u64>(res)); break;
|
||||
}
|
||||
};
|
||||
|
||||
@ -484,7 +484,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
|
||||
return false;
|
||||
}
|
||||
|
||||
temp_u8[index] = (u8)temp_u16[index];
|
||||
temp_u8[index] = static_cast<u8>(temp_u16[index]);
|
||||
}
|
||||
temp_u8[len] = 0;
|
||||
std::string name((char*)temp_u8);
|
||||
|
Loading…
Reference in New Issue
Block a user