Merge pull request #5572 from shuffle2/msvc-w4

msvc: use /W4 (and fixes to make it work)
This commit is contained in:
shuffle2 2017-06-07 20:33:54 -07:00 committed by GitHub
commit b11d722eed
64 changed files with 254 additions and 173 deletions

View File

@ -61,6 +61,7 @@
<ImportGroup Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\Source\VSProps\Base.props" />
<Import Project="..\..\Source\VSProps\ClDisableAllWarnings.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />

View File

@ -25,8 +25,7 @@ private:
public:
StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
~StreamingVoiceContext();
virtual ~StreamingVoiceContext();
void Stop();
void Play();

View File

@ -25,8 +25,7 @@ private:
public:
StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
~StreamingVoiceContext2_7();
virtual ~StreamingVoiceContext2_7();
void Stop();
void Play();

View File

@ -27,6 +27,7 @@ class Section
public:
Section(LayerType layer, System system, const std::string& name);
virtual ~Section() = default;
virtual bool Exists(const std::string& key) const;
bool Delete(const std::string& key);

View File

@ -15,6 +15,11 @@
#include "Common/Crypto/bn.h"
#include "Common/Crypto/ec.h"
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4505)
#endif
// y**2 + x*y = x**3 + x + b
UNUSED static const u8 ec_b[30] = {0x00, 0x66, 0x64, 0x7e, 0xde, 0x6c, 0x33, 0x2c, 0x7f, 0x8c,
0x09, 0x23, 0xbb, 0x58, 0x21, 0x3b, 0x33, 0x3b, 0x20, 0xe9,
@ -404,3 +409,7 @@ void ec_priv_to_pub(const u8* k, u8* Q)
{
point_mul(Q, k, ec_G);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View File

@ -631,9 +631,9 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
// Returns the current directory
std::string GetCurrentDir()
{
char* dir;
// Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(nullptr, 0)))
char* dir = __getcwd(nullptr, 0);
if (!dir)
{
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str());
return nullptr;
@ -986,7 +986,7 @@ u64 IOFile::Tell() const
if (IsOpen())
return ftello(m_file);
else
return -1;
return UINT64_MAX;
}
bool IOFile::Flush()

View File

@ -248,8 +248,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
return false;
}
int pixel_format;
if (!(pixel_format = ChoosePixelFormat(m_dc, &pfd)))
int pixel_format = ChoosePixelFormat(m_dc, &pfd);
if (!pixel_format)
{
PanicAlert("(2) Can't find a suitable PixelFormat.");
return false;
@ -261,7 +261,8 @@ bool cInterfaceWGL::Create(void* window_handle, bool core)
return false;
}
if (!(m_rc = wglCreateContext(m_dc)))
m_rc = wglCreateContext(m_dc);
if (!m_rc)
{
PanicAlert("(4) Can't create an OpenGL rendering context.");
return false;

View File

@ -198,7 +198,7 @@ inline int IntLog2(u64 val)
return 63 - __builtin_clzll(val);
#elif defined(_MSC_VER)
unsigned long result = -1;
unsigned long result = ULONG_MAX;
_BitScanReverse64(&result, val);
return result;

View File

@ -29,8 +29,8 @@ std::string Profiler::s_lazy_result = "";
int Profiler::s_lazy_delay = 0;
Profiler::Profiler(const std::string& name)
: m_name(name), m_usecs(0), m_usecs_min(-1), m_usecs_max(0), m_usecs_quad(0), m_calls(0),
m_depth(0)
: m_name(name), m_usecs(0), m_usecs_min(UINT64_MAX), m_usecs_max(0), m_usecs_quad(0),
m_calls(0), m_depth(0)
{
m_time = Common::Timer::GetTimeUs();
s_max_length = std::max<u32>(s_max_length, u32(m_name.length()));
@ -154,7 +154,7 @@ std::string Profiler::Read()
buffer << std::setw(PROFILER_FIELD_LENGTH) << std::right << m_usecs_max;
m_usecs = 0;
m_usecs_min = -1;
m_usecs_min = UINT64_MAX;
m_usecs_max = 0;
m_usecs_quad = 0;
m_calls = 0;

View File

@ -49,6 +49,11 @@
#include <unistd.h> // for unlink()
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4310)
#endif
/* Believe me, you *don't* want to change these constants !! */
#define BYTES_PER_SECTOR 512
#define RESERVED_SECTORS 32
@ -289,3 +294,7 @@ FailWrite:
ERROR_LOG(COMMON, "unlink(%s) failed: %s", filename.c_str(), GetLastErrorMsg().c_str());
return false;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View File

@ -62,11 +62,8 @@ void SwitchCurrentThread()
}
// Sets the debugger-visible name of the current thread.
// Uses undocumented (actually, it is now documented) trick.
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp
// This is implemented much nicer in upcoming msvc++, see:
// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx
// Uses trick documented in:
// https://docs.microsoft.com/en-us/visualstudio/debugger/how-to-set-a-thread-name-in-native-code
void SetCurrentThreadName(const char* szThreadName)
{
static const DWORD MS_VC_EXCEPTION = 0x406D1388;
@ -83,7 +80,7 @@ void SetCurrentThreadName(const char* szThreadName)
info.dwType = 0x1000;
info.szName = szThreadName;
info.dwThreadID = -1; // dwThreadID;
info.dwThreadID = static_cast<DWORD>(-1);
info.dwFlags = 0;
__try

View File

@ -471,7 +471,8 @@ void DecryptARCode(std::vector<std::string> vCodes, std::vector<AREntry>* ops)
std::transform(s.begin(), s.end(), s.begin(), toupper);
}
if ((ret = alphatobin(uCodes, vCodes, (int)vCodes.size())))
ret = alphatobin(uCodes, vCodes, (int)vCodes.size());
if (ret)
{
// Return value is index + 1, 0 being the success flag value.
PanicAlertT("Action Replay Code Decryption Error:\nParity Check Failed\n\nCulprit Code:\n%s",

View File

@ -57,7 +57,7 @@ const ConfigInfo<bool> GFX_ENABLE_GPU_TEXTURE_DECODING{
const ConfigInfo<bool> GFX_ENABLE_PIXEL_LIGHTING{{System::GFX, "Settings", "EnablePixelLighting"},
false};
const ConfigInfo<bool> GFX_FAST_DEPTH_CALC{{System::GFX, "Settings", "FastDepthCalc"}, true};
const ConfigInfo<int> GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1};
const ConfigInfo<u32> GFX_MSAA{{System::GFX, "Settings", "MSAA"}, 1};
const ConfigInfo<bool> GFX_SSAA{{System::GFX, "Settings", "SSAA"}, false};
const ConfigInfo<int> GFX_EFB_SCALE{{System::GFX, "Settings", "EFBScale"},
static_cast<int>(SCALE_1X)};

View File

@ -47,7 +47,7 @@ extern const ConfigInfo<bool> GFX_INTERNAL_RESOLUTION_FRAME_DUMPS;
extern const ConfigInfo<bool> GFX_ENABLE_GPU_TEXTURE_DECODING;
extern const ConfigInfo<bool> GFX_ENABLE_PIXEL_LIGHTING;
extern const ConfigInfo<bool> GFX_FAST_DEPTH_CALC;
extern const ConfigInfo<int> GFX_MSAA;
extern const ConfigInfo<u32> GFX_MSAA;
extern const ConfigInfo<bool> GFX_SSAA;
extern const ConfigInfo<int> GFX_EFB_SCALE;
extern const ConfigInfo<bool> GFX_TEXFMT_OVERLAY_ENABLE;

View File

@ -42,7 +42,7 @@ u32 CDump::GetGPR(int _step, int _gpr)
u32 offset = _step * STRUCTUR_SIZE;
if (offset >= m_size)
return -1;
return UINT32_MAX;
return Read32(offset + OFFSET_GPR + (_gpr * 4));
}
@ -52,7 +52,7 @@ u32 CDump::GetPC(int _step)
u32 offset = _step * STRUCTUR_SIZE;
if (offset >= m_size)
return -1;
return UINT32_MAX;
return Read32(offset + OFFSET_PC);
}

View File

@ -247,8 +247,10 @@ u32 UnPatch(const std::string& patch_name)
return addr;
}
for (const auto& symbol : g_symbolDB.GetSymbolsFromName(patch_name))
const auto& symbols = g_symbolDB.GetSymbolsFromName(patch_name);
if (symbols.size())
{
const auto& symbol = symbols[0];
for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
{
s_original_instructions.erase(addr);

View File

@ -63,7 +63,7 @@ protected:
CMailHandler& m_mail_handler;
enum EDSP_Codes
enum EDSP_Codes : u32
{
DSP_INIT = 0xDCD10000,
DSP_RESUME = 0xDCD10001,

View File

@ -349,8 +349,8 @@ static void DTKStreamingCallback(const std::vector<u8>& audio_data, s64 cycles_l
// Determine which audio data to read next.
static const int MAXIMUM_SAMPLES = 48000 / 2000 * 7; // 3.5ms of 48kHz samples
u64 read_offset;
u32 read_length;
u64 read_offset = 0;
u32 read_length = 0;
if (s_stream && AudioInterface::IsPlaying())
{
read_offset = s_audio_position;

View File

@ -157,7 +157,7 @@ bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
if (adapter == INVALID_HANDLE_VALUE)
{
INFO_LOG(SP1, "Failed to open TAP at %s", device_path);
INFO_LOG(SP1, "Failed to open TAP at %s", device_path.c_str());
return false;
}
return true;

View File

@ -20,14 +20,14 @@ template <typename T>
class ReadHandlingMethod
{
public:
virtual ~ReadHandlingMethod() {}
virtual ~ReadHandlingMethod() = default;
virtual void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const = 0;
};
template <typename T>
class WriteHandlingMethod
{
public:
virtual ~WriteHandlingMethod() {}
virtual ~WriteHandlingMethod() = default;
virtual void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const = 0;
};
@ -39,7 +39,7 @@ class ConstantHandlingMethod : public ReadHandlingMethod<T>
{
public:
explicit ConstantHandlingMethod(T value) : value_(value) {}
virtual ~ConstantHandlingMethod() {}
virtual ~ConstantHandlingMethod() = default;
void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const override
{
v.VisitConstant(value_);
@ -62,7 +62,7 @@ class NopHandlingMethod : public WriteHandlingMethod<T>
{
public:
NopHandlingMethod() {}
virtual ~NopHandlingMethod() {}
virtual ~NopHandlingMethod() = default;
void AcceptWriteVisitor(WriteHandlingMethodVisitor<T>& v) const override { v.VisitNop(); }
};
template <typename T>
@ -79,7 +79,7 @@ class DirectHandlingMethod : public ReadHandlingMethod<T>, public WriteHandlingM
{
public:
DirectHandlingMethod(T* addr, u32 mask) : addr_(addr), mask_(mask) {}
virtual ~DirectHandlingMethod() {}
virtual ~DirectHandlingMethod() = default;
void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const override
{
v.VisitDirect(addr_, mask_);
@ -132,7 +132,7 @@ public:
{
}
virtual ~ComplexHandlingMethod() {}
virtual ~ComplexHandlingMethod() = default;
void AcceptReadVisitor(ReadHandlingMethodVisitor<T>& v) const override
{
v.VisitComplex(&read_lambda_);
@ -304,6 +304,8 @@ void ReadHandler<T>::ResetMethod(ReadHandlingMethod<T>* method)
struct FuncCreatorVisitor : public ReadHandlingMethodVisitor<T>
{
virtual ~FuncCreatorVisitor() = default;
std::function<T(u32)> ret;
void VisitConstant(T value) override
@ -356,6 +358,8 @@ void WriteHandler<T>::ResetMethod(WriteHandlingMethod<T>* method)
struct FuncCreatorVisitor : public WriteHandlingMethodVisitor<T>
{
virtual ~FuncCreatorVisitor() = default;
std::function<void(u32, T)> ret;
void VisitNop() override

View File

@ -99,7 +99,7 @@ struct PhysicalMemoryRegion
u8** out_pointer;
u32 physical_address;
u32 size;
enum
enum : u32
{
ALWAYS = 0,
FAKE_VMEM = 1,

View File

@ -328,7 +328,7 @@ void ES::DoState(PointerWrap& p)
}
}
ES::ContextArray::iterator ES::FindActiveContext(u32 fd)
ES::ContextArray::iterator ES::FindActiveContext(s32 fd)
{
return std::find_if(m_contexts.begin(), m_contexts.end(),
[fd](const auto& context) { return context.ipc_fd == fd && context.active; });

View File

@ -94,7 +94,7 @@ public:
TitleExportContext title_export;
bool active = false;
// We use this to associate an IPC fd with an ES context.
u32 ipc_fd = -1;
s32 ipc_fd = -1;
};
// Title management
@ -277,7 +277,7 @@ private:
IPCCommandResult DIGetTMDSize(const IOCtlVRequest& request);
IPCCommandResult DIGetTMD(const IOCtlVRequest& request);
ContextArray::iterator FindActiveContext(u32 fd);
ContextArray::iterator FindActiveContext(s32 fd);
ContextArray::iterator FindInactiveContext();
bool LaunchIOS(u64 ios_title_id);

View File

@ -14,6 +14,7 @@
#include "Common/CommonTypes.h"
#include "Core/CoreTiming.h"
#include "Core/HW/Memmap.h"
#include "Core/HW/SystemTimers.h"
#include "Core/IOS/IOSC.h"
@ -82,6 +83,12 @@ enum ProcessId : u32
PID_UNKNOWN = 19,
};
template <typename T>
void WriteReturnValue(T value, u32 address)
{
Memory::Write_U32(static_cast<u32>(value), address);
}
// HLE for the IOS kernel: IPC, device management, syscalls, and Dolphin-specific, IOS-wide calls.
class Kernel
{

View File

@ -76,6 +76,11 @@ NetIPTop::~NetIPTop()
#endif
}
static constexpr u32 inet_addr(u8 a, u8 b, u8 c, u8 d)
{
return (static_cast<u32>(a) << 24) | (static_cast<u32>(b) << 16) | (static_cast<u32>(c) << 8) | d;
}
static int inet_pton(const char* src, unsigned char* dst)
{
int saw_digit, octets;
@ -431,7 +436,7 @@ IPCCommandResult NetIPTop::HandleGetHostIDRequest(const IOCtlRequest& request)
#ifdef _WIN32
DWORD forwardTableSize, ipTableSize, result;
DWORD ifIndex = -1;
NET_IFINDEX ifIndex = NET_IFINDEX_UNSPECIFIED;
std::unique_ptr<MIB_IPFORWARDTABLE> forwardTable;
std::unique_ptr<MIB_IPADDRTABLE> ipTable;
@ -462,13 +467,14 @@ IPCCommandResult NetIPTop::HandleGetHostIDRequest(const IOCtlRequest& request)
}
}
if (result == NO_ERROR || ifIndex != -1)
if (result == NO_ERROR || ifIndex != NET_IFINDEX_UNSPECIFIED)
break;
result = GetIpForwardTable(forwardTable.get(), &forwardTableSize, FALSE);
}
if (ifIndex != -1 && GetIpAddrTable(ipTable.get(), &ipTableSize, FALSE) == NO_ERROR)
if (ifIndex != NET_IFINDEX_UNSPECIFIED &&
GetIpAddrTable(ipTable.get(), &ipTableSize, FALSE) == NO_ERROR)
{
for (DWORD i = 0; i < ipTable->dwNumEntries; ++i)
{
@ -817,9 +823,9 @@ IPCCommandResult NetIPTop::HandleGetInterfaceOptRequest(const IOCtlVRequest& req
case 0x4003: // ip addr table
Memory::Write_U32(0xC, request.io_vectors[1].address);
Memory::Write_U32(10 << 24 | 1 << 8 | 30, request.io_vectors[0].address);
Memory::Write_U32(255 << 24 | 255 << 16 | 255 << 8 | 0, request.io_vectors[0].address + 4);
Memory::Write_U32(10 << 24 | 0 << 16 | 255 << 8 | 255, request.io_vectors[0].address + 8);
Memory::Write_U32(inet_addr(10, 0, 1, 30), request.io_vectors[0].address);
Memory::Write_U32(inet_addr(255, 255, 255, 0), request.io_vectors[0].address + 4);
Memory::Write_U32(inet_addr(10, 0, 255, 255), request.io_vectors[0].address + 8);
break;
case 0x4005: // hardcoded value

View File

@ -13,7 +13,7 @@ namespace HLE
{
namespace NWC24
{
enum ErrorCode : int
enum ErrorCode : s32
{
WC24_OK = 0,
WC24_ERR_FATAL = -1,

View File

@ -41,7 +41,7 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
case IOCTL_NWC24_SUSPEND_SCHEDULAR:
// NWC24iResumeForCloseLib from NWC24SuspendScheduler (Input: none, Output: 32 bytes)
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_SUSPEND_SCHEDULAR - NI");
Memory::Write_U32(0, request.buffer_out); // no error
WriteReturnValue(0, request.buffer_out); // no error
break;
case IOCTL_NWC24_EXEC_TRY_SUSPEND_SCHEDULAR: // NWC24iResumeForCloseLib
@ -50,11 +50,11 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
case IOCTL_NWC24_EXEC_RESUME_SCHEDULAR: // NWC24iResumeForCloseLib
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_EXEC_RESUME_SCHEDULAR - NI");
Memory::Write_U32(0, request.buffer_out); // no error
WriteReturnValue(0, request.buffer_out); // no error
break;
case IOCTL_NWC24_STARTUP_SOCKET: // NWC24iStartupSocket
Memory::Write_U32(0, request.buffer_out);
WriteReturnValue(0, request.buffer_out);
Memory::Write_U32(0, request.buffer_out + 4);
return_value = 0;
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_STARTUP_SOCKET - NI");
@ -74,7 +74,7 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
case IOCTL_NWC24_REQUEST_REGISTER_USER_ID:
INFO_LOG(IOS_WC24, "NET_KD_REQ: IOCTL_NWC24_REQUEST_REGISTER_USER_ID");
Memory::Write_U32(0, request.buffer_out);
WriteReturnValue(0, request.buffer_out);
Memory::Write_U32(0, request.buffer_out + 4);
break;
@ -110,20 +110,20 @@ IPCCommandResult NetKDRequest::IOCtl(const IOCtlRequest& request)
config.SetCreationStage(NWC24::NWC24Config::NWC24_IDCS_GENERATED);
config.WriteConfig();
Memory::Write_U32(ret, request.buffer_out);
WriteReturnValue(ret, request.buffer_out);
}
else
{
Memory::Write_U32(NWC24::WC24_ERR_FATAL, request.buffer_out);
WriteReturnValue(NWC24::WC24_ERR_FATAL, request.buffer_out);
}
}
else if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_GENERATED)
{
Memory::Write_U32(NWC24::WC24_ERR_ID_GENERATED, request.buffer_out);
WriteReturnValue(NWC24::WC24_ERR_ID_GENERATED, request.buffer_out);
}
else if (config.CreationStage() == NWC24::NWC24Config::NWC24_IDCS_REGISTERED)
{
Memory::Write_U32(NWC24::WC24_ERR_ID_REGISTERED, request.buffer_out);
WriteReturnValue(NWC24::WC24_ERR_ID_REGISTERED, request.buffer_out);
}
Memory::Write_U64(config.Id(), request.buffer_out + 4);
Memory::Write_U32(config.CreationStage(), request.buffer_out + 0xC);

View File

@ -221,12 +221,12 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
mbedtls_ssl_set_hostname(&ssl->ctx, ssl->hostname.c_str());
ssl->active = true;
Memory::Write_U32(freeSSL, BufferIn);
WriteReturnValue(freeSSL, BufferIn);
}
else
{
_SSL_NEW_ERROR:
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_NEW (%d, %s) "
@ -260,11 +260,11 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
ssl->active = false;
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SHUTDOWN "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
@ -298,19 +298,19 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
if (ret)
{
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
}
else
{
mbedtls_ssl_conf_ca_chain(&ssl->config, &ssl->cacert, nullptr);
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETROOTCA = %d", ret);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
break;
}
@ -339,19 +339,19 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
{
mbedtls_x509_crt_free(&ssl->clicert);
mbedtls_pk_free(&ssl->pk);
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
}
else
{
mbedtls_ssl_conf_own_cert(&ssl->config, &ssl->clicert, &ssl->pk);
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT = (%d, %d)", ret, pk_ret);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
}
break;
@ -373,11 +373,11 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
mbedtls_pk_free(&ssl->pk);
mbedtls_ssl_conf_own_cert(&ssl->config, nullptr, nullptr);
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINCLIENTCERT invalid sslID = %d", sslID);
}
break;
@ -395,18 +395,18 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
if (ret)
{
mbedtls_x509_crt_free(&ssl->clicert);
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
}
else
{
mbedtls_ssl_conf_ca_chain(&ssl->config, &ssl->cacert, nullptr);
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA = %d", ret);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETBUILTINROOTCA "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
@ -428,11 +428,11 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
ssl->hostfd = sm.GetHostSocket(ssl->sockfd);
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_CONNECT socket = %d", ssl->sockfd);
mbedtls_ssl_set_bio(&ssl->ctx, &ssl->hostfd, mbedtls_net_send, mbedtls_net_recv, nullptr);
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_CONNECT "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
@ -453,7 +453,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
break;
}
@ -468,7 +468,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_WRITE "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
@ -491,7 +491,7 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_READ(%d)"
@ -507,11 +507,11 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
{
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
INFO_LOG(IOS_SSL, "IOCTLV_NET_SSL_SETROOTCADEFAULT "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
@ -533,11 +533,11 @@ IPCCommandResult NetSSL::IOCtlV(const IOCtlVRequest& request)
int sslID = Memory::Read_U32(BufferOut) - 1;
if (SSLID_VALID(sslID))
{
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
break;
}

View File

@ -32,7 +32,7 @@ namespace HLE
#define SSLID_VALID(x) \
(x >= 0 && x < NET_SSL_MAXINSTANCES && ::IOS::HLE::Device::NetSSL::_SSL[x].active)
enum ssl_err_t
enum ssl_err_t : s32
{
SSL_OK = 0,
SSL_ERR_FAILED = -1,

View File

@ -335,15 +335,15 @@ void WiiSocket::Update(bool read, bool write, bool except)
switch (ret)
{
case 0:
Memory::Write_U32(SSL_OK, BufferIn);
WriteReturnValue(SSL_OK, BufferIn);
break;
case MBEDTLS_ERR_SSL_WANT_READ:
Memory::Write_U32(SSL_ERR_RAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_RAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_RAGAIN;
break;
case MBEDTLS_ERR_SSL_WANT_WRITE:
Memory::Write_U32(SSL_ERR_WAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_WAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_WAGAIN;
break;
@ -366,13 +366,13 @@ void WiiSocket::Update(bool read, bool write, bool except)
else
res = SSL_ERR_FAILED;
Memory::Write_U32(res, BufferIn);
WriteReturnValue(res, BufferIn);
if (!nonBlock)
ReturnValue = res;
break;
}
default:
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
break;
}
@ -412,24 +412,24 @@ void WiiSocket::Update(bool read, bool write, bool except)
if (ret >= 0)
{
// Return bytes written or SSL_ERR_ZERO if none
Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, BufferIn);
WriteReturnValue((ret == 0) ? SSL_ERR_ZERO : ret, BufferIn);
}
else
{
switch (ret)
{
case MBEDTLS_ERR_SSL_WANT_READ:
Memory::Write_U32(SSL_ERR_RAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_RAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_RAGAIN;
break;
case MBEDTLS_ERR_SSL_WANT_WRITE:
Memory::Write_U32(SSL_ERR_WAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_WAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_WAGAIN;
break;
default:
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
break;
}
}
@ -450,24 +450,24 @@ void WiiSocket::Update(bool read, bool write, bool except)
if (ret >= 0)
{
// Return bytes read or SSL_ERR_ZERO if none
Memory::Write_U32((ret == 0) ? SSL_ERR_ZERO : ret, BufferIn);
WriteReturnValue((ret == 0) ? SSL_ERR_ZERO : ret, BufferIn);
}
else
{
switch (ret)
{
case MBEDTLS_ERR_SSL_WANT_READ:
Memory::Write_U32(SSL_ERR_RAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_RAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_RAGAIN;
break;
case MBEDTLS_ERR_SSL_WANT_WRITE:
Memory::Write_U32(SSL_ERR_WAGAIN, BufferIn);
WriteReturnValue(SSL_ERR_WAGAIN, BufferIn);
if (!nonBlock)
ReturnValue = SSL_ERR_WAGAIN;
break;
default:
Memory::Write_U32(SSL_ERR_FAILED, BufferIn);
WriteReturnValue(SSL_ERR_FAILED, BufferIn);
break;
}
}
@ -479,7 +479,7 @@ void WiiSocket::Update(bool read, bool write, bool except)
}
else
{
Memory::Write_U32(SSL_ERR_ID, BufferIn);
WriteReturnValue(SSL_ERR_ID, BufferIn);
}
}
else

View File

@ -134,7 +134,7 @@ IPCCommandResult SDIOSlot0::IOCtlV(const IOCtlVRequest& request)
return GetDefaultReply(IPC_SUCCESS);
}
u32 SDIOSlot0::ExecuteCommand(const Request& request, u32 _BufferIn, u32 _BufferInSize,
s32 SDIOSlot0::ExecuteCommand(const Request& request, u32 _BufferIn, u32 _BufferInSize,
u32 _rwBuffer, u32 _rwBufferSize, u32 _BufferOut, u32 _BufferOutSize)
{
// The game will send us a SendCMD with this information. To be able to read and write
@ -164,7 +164,7 @@ u32 SDIOSlot0::ExecuteCommand(const Request& request, u32 _BufferIn, u32 _Buffer
// Note: req.addr is the virtual address of _rwBuffer
u32 ret = RET_OK;
s32 ret = RET_OK;
switch (req.command)
{

View File

@ -128,7 +128,7 @@ private:
IPCCommandResult SendCommand(const IOCtlVRequest& request);
u32 ExecuteCommand(const Request& request, u32 BufferIn, u32 BufferInSize, u32 BufferIn2,
s32 ExecuteCommand(const Request& request, u32 BufferIn, u32 BufferInSize, u32 BufferIn2,
u32 BufferInSize2, u32 _BufferOut, u32 BufferOutSize);
void OpenInternal();

View File

@ -533,7 +533,7 @@ void BluetoothReal::LoadLinkKeys()
std::reverse(address.begin(), address.end());
const std::string& key_string = pair.substr(index + 1);
linkkey_t key;
linkkey_t key{};
size_t pos = 0;
for (size_t i = 0; i < key_string.length(); i = i + 2)
{

View File

@ -49,7 +49,7 @@ struct HIDRequest
};
#pragma pack(pop)
V4CtrlMessage::V4CtrlMessage(Kernel& ios, const IOCtlRequest& ioctl) : CtrlMessage(ios, ioctl, -1)
V4CtrlMessage::V4CtrlMessage(Kernel& ios, const IOCtlRequest& ioctl) : CtrlMessage(ios, ioctl, 0)
{
HIDRequest hid_request;
Memory::CopyFromEmu(&hid_request, ioctl.buffer_in, sizeof(hid_request));
@ -65,7 +65,7 @@ V4CtrlMessage::V4CtrlMessage(Kernel& ios, const IOCtlRequest& ioctl) : CtrlMessa
// (US for the language and replacing non-ASCII characters with '?'),
// we can simply submit it as a usual control request.
V4GetUSStringMessage::V4GetUSStringMessage(Kernel& ios, const IOCtlRequest& ioctl)
: CtrlMessage(ios, ioctl, -1)
: CtrlMessage(ios, ioctl, 0)
{
HIDRequest hid_request;
Memory::CopyFromEmu(&hid_request, ioctl.buffer_in, sizeof(hid_request));
@ -87,7 +87,7 @@ void V4GetUSStringMessage::OnTransferComplete(s32 return_value) const
TransferCommand::OnTransferComplete(return_value);
}
V4IntrMessage::V4IntrMessage(Kernel& ios, const IOCtlRequest& ioctl) : IntrMessage(ios, ioctl, -1)
V4IntrMessage::V4IntrMessage(Kernel& ios, const IOCtlRequest& ioctl) : IntrMessage(ios, ioctl, 0)
{
HIDRequest hid_request;
Memory::CopyFromEmu(&hid_request, ioctl.buffer_in, sizeof(hid_request));

View File

@ -86,7 +86,7 @@ WFSI::WFSI(Kernel& ios, const std::string& device_name) : Device(ios, device_nam
IPCCommandResult WFSI::IOCtl(const IOCtlRequest& request)
{
u32 return_error_code = IPC_SUCCESS;
s32 return_error_code = IPC_SUCCESS;
switch (request.request)
{

View File

@ -367,7 +367,7 @@ unsigned int NetPlayServer::OnDisconnect(const Client& player)
sf::Packet spac;
spac << (MessageId)NP_MSG_DISABLE_GAME;
// this thread doesn't need players lock
SendToClients(spac, -1);
SendToClients(spac, static_cast<PlayerId>(-1));
break;
}
}

View File

@ -495,7 +495,7 @@ void Interpreter::divwx(UGeckoInstruction inst)
}
if (((u32)a & 0x80000000) && b == 0)
rGPR[inst.RD] = -1;
rGPR[inst.RD] = UINT32_MAX;
else
rGPR[inst.RD] = 0;
}

View File

@ -87,7 +87,7 @@ public:
// Use to extract bytes from a register using the regcache. offset is in bytes.
Gen::OpArg ExtractFromReg(int reg, int offset);
void AndWithMask(Gen::X64Reg reg, u32 mask);
bool CheckMergedBranch(int crf);
bool CheckMergedBranch(u32 crf);
void DoMergedBranch();
void DoMergedBranchCondition();
void DoMergedBranchImmediate(s64 val);

View File

@ -30,7 +30,7 @@ void RegCache::Start()
xreg.free = true;
xreg.dirty = false;
xreg.locked = false;
xreg.ppcReg = INVALID_REG;
xreg.ppcReg = static_cast<size_t>(INVALID_REG);
}
for (size_t i = 0; i < m_regs.size(); i++)
{
@ -63,7 +63,7 @@ void RegCache::DiscardRegContentsIfCached(size_t preg)
X64Reg xr = m_regs[preg].location.GetSimpleReg();
m_xregs[xr].free = true;
m_xregs[xr].dirty = false;
m_xregs[xr].ppcReg = INVALID_REG;
m_xregs[xr].ppcReg = static_cast<size_t>(INVALID_REG);
m_regs[preg].away = false;
m_regs[preg].location = GetDefaultLocation(preg);
}
@ -216,7 +216,7 @@ void RegCache::StoreFromRegister(size_t i, FlushMode mode)
if (mode == FlushMode::All)
{
m_xregs[xr].free = true;
m_xregs[xr].ppcReg = INVALID_REG;
m_xregs[xr].ppcReg = static_cast<size_t>(INVALID_REG);
m_xregs[xr].dirty = false;
}
}

View File

@ -486,7 +486,7 @@ void Jit64::FloatCompare(UGeckoInstruction inst, bool upper)
// bool ordered = !!(inst.SUBOP10 & 32);
int a = inst.FA;
int b = inst.FB;
int crf = inst.CRFD;
u32 crf = inst.CRFD;
int output[4] = {CR_SO, CR_EQ, CR_GT, CR_LT};
// Merge neighboring fcmp and cror (the primary use of cror).

View File

@ -339,7 +339,7 @@ void Jit64::reg_imm(UGeckoInstruction inst)
}
}
bool Jit64::CheckMergedBranch(int crf)
bool Jit64::CheckMergedBranch(u32 crf)
{
if (!analyzer.HasOption(PPCAnalyst::PPCAnalyzer::OPTION_BRANCH_MERGE))
return false;
@ -473,7 +473,7 @@ void Jit64::cmpXX(UGeckoInstruction inst)
JITDISABLE(bJITIntegerOff);
int a = inst.RA;
int b = inst.RB;
int crf = inst.CRFD;
u32 crf = inst.CRFD;
bool merge_branch = CheckMergedBranch(crf);
OpArg comparand;

View File

@ -202,7 +202,7 @@ void Jit64::lXXx(UGeckoInstruction inst)
// If we're using reg+reg mode and b is an immediate, pretend we're using constant offset mode
bool use_constant_offset = inst.OPCD != 31 || gpr.R(b).IsImm();
s32 offset;
s32 offset = 0;
if (use_constant_offset)
offset = inst.OPCD == 31 ? gpr.R(b).SImm32() : (s32)inst.SIMM_16;
// Depending on whether we have an immediate and/or update, find the optimum way to calculate

View File

@ -730,8 +730,8 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, u32
code[i].opinfo = opinfo;
code[i].address = address;
code[i].inst = inst;
code[i].branchTo = -1;
code[i].branchToIndex = -1;
code[i].branchTo = UINT32_MAX;
code[i].branchToIndex = UINT32_MAX;
code[i].skip = false;
block->m_stats->numCycles += opinfo->numCycles;
block->m_physical_addresses.insert(result.physical_address);

View File

@ -296,7 +296,7 @@ constexpr int BAT_INDEX_SHIFT = 17;
constexpr u32 BAT_PAGE_SIZE = 1 << BAT_INDEX_SHIFT;
constexpr u32 BAT_MAPPED_BIT = 0x1;
constexpr u32 BAT_PHYSICAL_BIT = 0x2;
constexpr u32 BAT_RESULT_MASK = ~0x3;
constexpr u32 BAT_RESULT_MASK = UINT32_C(~0x3);
using BatTable = std::array<u32, 1 << (32 - BAT_INDEX_SHIFT)>; // 128 KB
extern BatTable ibat_table;
extern BatTable dbat_table;

View File

@ -48,7 +48,7 @@ private:
CISOFileReader(File::IOFile file);
typedef u16 MapType;
static const MapType UNUSED_BLOCK_ID = -1;
static const MapType UNUSED_BLOCK_ID = UINT16_MAX;
File::IOFile m_file;
u64 m_size;

View File

@ -35,7 +35,7 @@ const size_t VolumeDirectory::MAX_ID_LENGTH;
VolumeDirectory::VolumeDirectory(const std::string& directory, bool is_wii,
const std::string& apploader, const std::string& dol)
: m_data_start_address(-1), m_disk_header(DISKHEADERINFO_ADDRESS),
: m_data_start_address(UINT64_MAX), m_disk_header(DISKHEADERINFO_ADDRESS),
m_disk_header_info(std::make_unique<SDiskHeaderInfo>()), m_fst_address(0), m_dol_address(0)
{
m_root_directory = ExtractDirectoryName(directory);

View File

@ -32,7 +32,8 @@ namespace DiscIO
constexpr u64 PARTITION_DATA_OFFSET = 0x20000;
VolumeWii::VolumeWii(std::unique_ptr<BlobReader> reader)
: m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE), m_last_decrypted_block(-1)
: m_pReader(std::move(reader)), m_game_partition(PARTITION_NONE),
m_last_decrypted_block(UINT64_MAX)
{
_assert_(m_pReader);

View File

@ -146,11 +146,12 @@ void CCodeWindow::OnProfilerMenu(wxCommandEvent& event)
File::CreateFullPath(filename);
Profiler::WriteProfileResults(filename);
wxFileType* filetype = nullptr;
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromExtension("txt")))
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension("txt");
if (!filetype)
{
// From extension failed, trying with MIME type now
if (!(filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain")))
filetype = wxTheMimeTypesManager->GetFileTypeFromMimeType("text/plain");
if (!filetype)
// MIME type failed, aborting mission
break;
}

View File

@ -32,7 +32,7 @@ static DSPDebuggerLLE* m_DebuggerFrame = nullptr;
DSPDebuggerLLE::DSPDebuggerLLE(wxWindow* parent, wxWindowID id)
: wxPanel(parent, id, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _("DSP LLE Debugger")),
m_CachedStepCounter(-1), m_toolbar_item_size(FromDIP(wxSize(16, 16)))
m_CachedStepCounter(UINT64_MAX), m_toolbar_item_size(FromDIP(wxSize(16, 16)))
{
Bind(wxEVT_MENU, &DSPDebuggerLLE::OnChangeState, this, ID_RUNTOOL, ID_SHOWPCTOOL);

View File

@ -154,7 +154,7 @@ void MemoryCheckDlg::OnOK(wxCommandEvent& event)
bool Log = m_radioLog->GetValue() || m_radioBreakLog->GetValue();
bool Break = m_radioBreak->GetValue() || m_radioBreakLog->GetValue();
u32 StartAddress, EndAddress;
u32 StartAddress = UINT32_MAX, EndAddress = 0;
bool EndAddressOK =
EndAddressString.Len() && AsciiToHex(WxStrToStr(EndAddressString), EndAddress);

View File

@ -1322,11 +1322,11 @@ void VideoConfigDiag::PopulatePostProcessingShaders()
void VideoConfigDiag::PopulateAAList()
{
const std::vector<int>& aa_modes = vconfig.backend_info.AAModes;
const auto& aa_modes = vconfig.backend_info.AAModes;
const bool supports_ssaa = vconfig.backend_info.bSupportsSSAA;
m_msaa_modes = 0;
for (int mode : aa_modes)
for (auto mode : aa_modes)
{
if (mode == 1)
{
@ -1342,7 +1342,7 @@ void VideoConfigDiag::PopulateAAList()
if (supports_ssaa)
{
for (int mode : aa_modes)
for (auto mode : aa_modes)
{
if (mode != 1)
choice_aamode->AppendString(std::to_string(mode) + "x SSAA");

View File

@ -266,28 +266,27 @@ static bool CheckDeviceAccess(libusb_device* device)
}
return false;
}
else if ((ret = libusb_kernel_driver_active(s_handle, 0)) == 1)
else
{
if ((ret = libusb_detach_kernel_driver(s_handle, 0)) && ret != LIBUSB_ERROR_NOT_SUPPORTED)
ret = libusb_kernel_driver_active(s_handle, 0);
if (ret == 1)
{
ret = libusb_detach_kernel_driver(s_handle, 0);
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
ERROR_LOG(SERIALINTERFACE, "libusb_detach_kernel_driver failed with error: %d", ret);
}
}
// this split is needed so that we don't avoid claiming the interface when
// detaching the kernel driver is successful
if (ret != 0 && ret != LIBUSB_ERROR_NOT_SUPPORTED)
{
return false;
}
else if ((ret = libusb_claim_interface(s_handle, 0)))
{
ret = libusb_claim_interface(s_handle, 0);
if (ret)
ERROR_LOG(SERIALINTERFACE, "libusb_claim_interface failed with error: %d", ret);
}
else
{
return true;
}
}
return false;
}

View File

@ -240,12 +240,12 @@ D3D_FEATURE_LEVEL GetFeatureLevel(IDXGIAdapter* adapter)
return feat_level;
}
static bool SupportsS3TCTextures(ID3D11Device* device)
static bool SupportsS3TCTextures(ID3D11Device* dev)
{
UINT bc1_support, bc2_support, bc3_support;
if (FAILED(device->CheckFormatSupport(DXGI_FORMAT_BC1_UNORM, &bc1_support)) ||
FAILED(device->CheckFormatSupport(DXGI_FORMAT_BC2_UNORM, &bc2_support)) ||
FAILED(device->CheckFormatSupport(DXGI_FORMAT_BC3_UNORM, &bc3_support)))
if (FAILED(dev->CheckFormatSupport(DXGI_FORMAT_BC1_UNORM, &bc1_support)) ||
FAILED(dev->CheckFormatSupport(DXGI_FORMAT_BC2_UNORM, &bc2_support)) ||
FAILED(dev->CheckFormatSupport(DXGI_FORMAT_BC3_UNORM, &bc3_support)))
{
return false;
}
@ -320,7 +320,7 @@ HRESULT Create(HWND wnd)
return desc.Count == g_Config.iMultisamples;
}) == aa_modes.end())
{
Config::SetCurrent(Config::GFX_MSAA, 1);
Config::SetCurrent(Config::GFX_MSAA, UINT32_C(1));
UpdateActiveConfig();
}

View File

@ -63,7 +63,7 @@ static std::unique_ptr<RasterFont> s_raster_font;
// 1 for no MSAA. Use s_MSAASamples > 1 to check for MSAA.
static int s_MSAASamples = 1;
static int s_last_multisamples = 1;
static u32 s_last_multisamples = 1;
static bool s_last_stereo_mode = false;
static bool s_last_xfb_mode = false;
@ -519,7 +519,7 @@ Renderer::Renderer()
{
// GLES 3.1 can't support stereo rendering and MSAA
OSD::AddMessage("MSAA Stereo rendering isn't supported by your GPU.", 10000);
Config::SetCurrent(Config::GFX_MSAA, 1);
Config::SetCurrent(Config::GFX_MSAA, UINT32_C(1));
}
}
else

View File

@ -370,9 +370,9 @@ TextureCache::TextureCache()
{
CompileShaders();
s_ActiveTexture = -1;
s_ActiveTexture = UINT32_MAX;
for (auto& gtex : s_Textures)
gtex = -1;
gtex = UINT32_MAX;
if (g_ActiveConfig.backend_info.bSupportsPaletteConversion)
{
@ -519,8 +519,8 @@ bool TextureCache::CompileShaders()
s_ColorMatrixUniform = glGetUniformLocation(s_ColorMatrixProgram.glprogid, "colmat");
s_DepthMatrixUniform = glGetUniformLocation(s_DepthMatrixProgram.glprogid, "colmat");
s_ColorCbufid = -1;
s_DepthCbufid = -1;
s_ColorCbufid = UINT32_MAX;
s_DepthCbufid = UINT32_MAX;
s_ColorCopyPositionUniform = glGetUniformLocation(s_ColorCopyProgram.glprogid, "copy_position");
s_ColorMatrixPositionUniform =

View File

@ -1106,7 +1106,7 @@ void Renderer::CheckForSurfaceChange()
void Renderer::CheckForConfigChanges()
{
// Save the video config so we can compare against to determine which settings have changed.
int old_multisamples = g_ActiveConfig.iMultisamples;
u32 old_multisamples = g_ActiveConfig.iMultisamples;
int old_anisotropy = g_ActiveConfig.iMaxAnisotropy;
int old_stereo_mode = g_ActiveConfig.iStereoMode;
int old_aspect_ratio = g_ActiveConfig.iAspectRatio;

View File

@ -159,8 +159,9 @@ bool AVIDump::CreateVideoFile()
const AVCodec* codec = nullptr;
if (!(codec = avcodec_find_encoder(codec_id)) ||
!(s_codec_context = avcodec_alloc_context3(codec)))
codec = avcodec_find_encoder(codec_id);
s_codec_context = avcodec_alloc_context3(codec);
if (!codec || !s_codec_context)
{
ERROR_LOG(VIDEO, "Could not find encoder or allocate codec context");
return false;
@ -203,8 +204,8 @@ bool AVIDump::CreateVideoFile()
return false;
#endif
if (!(s_stream = avformat_new_stream(s_format_context, codec)) ||
!AVStreamCopyContext(s_stream, s_codec_context))
s_stream = avformat_new_stream(s_format_context, codec);
if (!s_stream || !AVStreamCopyContext(s_stream, s_codec_context))
{
ERROR_LOG(VIDEO, "Could not create stream");
return false;
@ -299,9 +300,10 @@ void AVIDump::AddFrame(const u8* data, int width, int height, int stride, const
s_src_frame->height = s_height;
// Convert image from {BGR24, RGBA} to desired pixel format
if ((s_sws_context =
s_sws_context =
sws_getCachedContext(s_sws_context, width, height, s_pix_fmt, s_width, s_height,
s_codec_context->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr)))
s_codec_context->pix_fmt, SWS_BICUBIC, nullptr, nullptr, nullptr);
if (s_sws_context)
{
sws_scale(s_sws_context, s_src_frame->data, s_src_frame->linesize, 0, height,
s_scaled_frame->data, s_scaled_frame->linesize);

View File

@ -353,7 +353,7 @@ void RunGpuLoop()
DataReader(s_video_buffer_read_ptr, write_ptr), &cyclesExecuted, false);
Common::AtomicStore(fifo.CPReadPointer, readPtr);
Common::AtomicAdd(fifo.CPReadWriteDistance, -32);
Common::AtomicAdd(fifo.CPReadWriteDistance, static_cast<u32>(-32));
if ((write_ptr - s_video_buffer_read_ptr) == 0)
Common::AtomicStore(fifo.SafeCPReadPointer, fifo.CPReadPointer);

View File

@ -21,6 +21,11 @@ bool SaveData(const std::string& filename, const std::string& data)
return true;
}
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4611)
#endif
/*
TextureToPng
@ -31,20 +36,16 @@ row_stride: Determines the amount of bytes per row of pixels.
bool TextureToPng(const u8* data, int row_stride, const std::string& filename, int width,
int height, bool saveAlpha)
{
bool success = false;
if (!data)
return false;
bool success = false;
char title[] = "Dolphin Screenshot";
char title_key[] = "Title";
png_structp png_ptr = nullptr;
png_infop info_ptr = nullptr;
std::vector<u8> buffer;
if (!saveAlpha)
buffer.resize(width * 4);
// Open file for writing (binary mode)
File::IOFile fp(filename, "wb");
if (!fp.IsOpen())
@ -70,13 +71,22 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
goto finalise;
}
// Setup Exception handling
// Classical libpng error handling uses longjmp to do C-style unwind.
// Modern libpng does support a user callback, but it's required to operate
// in the same way (just gives a chance to do stuff before the longjmp).
// Instead of futzing with it, we use gotos specifically so the compiler
// will still generate proper destructor calls for us (hopefully).
// We also do not use any local variables outside the region longjmp may
// have been called from if they were modified inside that region (they
// would need to be volatile).
if (setjmp(png_jmpbuf(png_ptr)))
{
PanicAlert("Screenshot failed: Error during PNG creation");
goto finalise;
}
// Begin region which may call longjmp
png_init_io(png_ptr, fp.GetHandle());
// Write header (8 bit color depth)
@ -91,6 +101,9 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
png_write_info(png_ptr, info_ptr);
if (!saveAlpha)
buffer.resize(width * 4);
// Write image data
for (auto y = 0; y < height; ++y)
{
@ -114,6 +127,8 @@ bool TextureToPng(const u8* data, int row_stride, const std::string& filename, i
// End write
png_write_end(png_ptr, nullptr);
// End region which may call longjmp
success = true;
finalise:
@ -124,3 +139,7 @@ finalise:
return success;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View File

@ -16,7 +16,7 @@ u16* IndexGenerator::index_buffer_current;
u16* IndexGenerator::BASEIptr;
u32 IndexGenerator::base_index;
static const u16 s_primitive_restart = -1;
static const u16 s_primitive_restart = UINT16_MAX;
static u16* (*primitive_table[8])(u16*, u32, u32);

View File

@ -994,7 +994,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFo
float* const ColorMask = colmat + 20;
ColorMask[0] = ColorMask[1] = ColorMask[2] = ColorMask[3] = 255.0f;
ColorMask[4] = ColorMask[5] = ColorMask[6] = ColorMask[7] = 1.0f / 255.0f;
unsigned int cbufid = -1;
unsigned int cbufid = UINT_MAX;
u32 srcFormat = bpmem.zcontrol.pixel_format;
bool efbHasAlpha = srcFormat == PEControl::RGBA6_Z24;

View File

@ -36,7 +36,7 @@ public:
private:
size_t CalculateHash() const
{
size_t h = -1;
size_t h = SIZE_MAX;
for (auto word : vid)
{

View File

@ -70,7 +70,7 @@ struct VideoConfig final
bool bShaderCache;
// Enhancements
int iMultisamples;
u32 iMultisamples;
bool bSSAA;
int iEFBScale;
bool bForceFiltering;
@ -167,7 +167,7 @@ struct VideoConfig final
APIType api_type;
std::vector<std::string> Adapters; // for D3D
std::vector<int> AAModes;
std::vector<u32> AAModes;
// TODO: merge AdapterName and Adapters array
std::string AdapterName; // for OpenGL

View File

@ -76,7 +76,7 @@
higher declaration can be contained to just the XAudio2/XInput related code.
-->
<PreprocessorDefinitions>_WIN32_WINNT=0x0602;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level3</WarningLevel>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeTypeInfo>false</RuntimeTypeInfo>
@ -95,13 +95,36 @@
<DebugInformationFormat>OldStyle</DebugInformationFormat>
<DiagnosticsFormat>Caret</DiagnosticsFormat>
<!--
4996 is for GetVersionEx being marked as depreciated - which is idiotic and there's
not much else we can do since many externals use it. The bad part is that there doesn't
4996 is for GetVersionEx being marked as deprecated - which is idiotic and there's not much
else we can do since many externals use it. The bad part is that there doesn't
seem to be a way to only ignore the specific instance we don't care about...
4351 squashes a warning telling us the compiler is behaving as expected (instead of old,
broken behavior).
4351 new behavior: elements of array 'array' will be default initialized
-->
<DisableSpecificWarnings>4996;4351</DisableSpecificWarnings>
<!-- Warnings one may want to ignore when using Level4.
4201 nonstandard extension used : nameless struct/union
4127 conditional expression is constant
4100 'identifier' : unreferenced formal parameter
4244 'conversion' conversion from 'type1' to 'type2', possible loss of data
Level4 warns if type1==int and there is narrowing
4121 'symbol' : alignment of a member was sensitive to packing
4324 Padding was added at the end of a structure because you specified a __declspec(align) value.
4714 function 'function' marked as __forceinline not inlined
-->
<DisableSpecificWarnings>4201;4127;4100;4244;4121;4324;4714;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<!-- Level4 warnings which should eventually be enabled
4245 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
Currently jits use some annoying code patterns which makes this common
-->
<DisableSpecificWarnings>4245;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<!-- Enable some off-by-default warnings
4263 Non-virtual member function hides base class virtual function
4265 Class has virtual functions, but destructor is not virtual
4946 Reinterpret cast between related types
-->
<!-- Externals are currently not compatible with this. Can still uncomment locally.
<AdditionalOptions>/we4263 /we4265 /we4946 %(AdditionalOptions)</AdditionalOptions>
-->
</ClCompile>
<!--ClCompile Debug-->
<ClCompile Condition="'$(Configuration)'=='Debug'">