msvc: resolve all warnings in Core.
Note: vs14 will support empty macro parameter as used by MMIO.
This commit is contained in:
parent
317e63e7ba
commit
043ea31f14
|
@ -172,7 +172,13 @@
|
|||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_es.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_FileIO.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_fs.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_hid.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_hid.cpp">
|
||||
<!--
|
||||
Disable "nonstandard extension used : zero-sized array in struct/union" warning,
|
||||
which is hit in libusb.h (and this is the only file which uses that header).
|
||||
-->
|
||||
<DisableSpecificWarnings>4200;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_net_ssl.cpp" />
|
||||
<ClCompile Include="IPC_HLE\WII_IPC_HLE_Device_sdio_slot0.cpp" />
|
||||
|
|
|
@ -195,7 +195,7 @@ FifoDataFile *FifoDataFile::Load(const std::string &filename, bool flagsOnly)
|
|||
return dataFile;
|
||||
}
|
||||
|
||||
void FifoDataFile::PadFile(u32 numBytes, File::IOFile& file)
|
||||
void FifoDataFile::PadFile(size_t numBytes, File::IOFile& file)
|
||||
{
|
||||
const u8 zero = 0;
|
||||
fwrite(&zero, sizeof(zero), numBytes, file.GetHandle());
|
||||
|
|
|
@ -66,8 +66,8 @@ public:
|
|||
u32 *GetXFRegs() { return m_XFRegs; }
|
||||
|
||||
void AddFrame(const FifoFrameInfo &frameInfo);
|
||||
const FifoFrameInfo &GetFrame(size_t frame) const { return m_Frames[frame]; }
|
||||
size_t GetFrameCount() { return m_Frames.size(); }
|
||||
const FifoFrameInfo &GetFrame(u32 frame) const { return m_Frames[frame]; }
|
||||
u32 GetFrameCount() { return static_cast<u32>(m_Frames.size()); }
|
||||
|
||||
bool Save(const std::string& filename);
|
||||
|
||||
|
@ -79,7 +79,7 @@ private:
|
|||
FLAG_IS_WII = 1
|
||||
};
|
||||
|
||||
void PadFile(u32 numBytes, File::IOFile &file);
|
||||
void PadFile(size_t numBytes, File::IOFile &file);
|
||||
|
||||
void SetFlag(u32 flag, bool set);
|
||||
bool GetFlag(u32 flag) const;
|
||||
|
|
|
@ -48,7 +48,7 @@ void FifoPlaybackAnalyzer::AnalyzeFrames(FifoDataFile *file, std::vector<Analyze
|
|||
frameInfo.clear();
|
||||
frameInfo.resize(file->GetFrameCount());
|
||||
|
||||
for (size_t frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
|
||||
for (u32 frameIdx = 0; frameIdx < file->GetFrameCount(); ++frameIdx)
|
||||
{
|
||||
const FifoFrameInfo& frame = file->GetFrame(frameIdx);
|
||||
AnalyzedFrameInfo& analyzed = frameInfo[frameIdx];
|
||||
|
|
|
@ -259,7 +259,7 @@ void FifoPlayer::WriteAllMemoryUpdates()
|
|||
{
|
||||
_assert_(m_File);
|
||||
|
||||
for (size_t frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
|
||||
for (u32 frameNum = 0; frameNum < m_File->GetFrameCount(); ++frameNum)
|
||||
{
|
||||
const FifoFrameInfo &frame = m_File->GetFrame(frameNum);
|
||||
for (auto& update : frame.memoryUpdates)
|
||||
|
|
|
@ -378,6 +378,8 @@ void WriteHandler<T>::ResetMethod(WriteHandlingMethod<T>* method)
|
|||
}
|
||||
|
||||
// Define all the public specializations that are exported in MMIOHandlers.h.
|
||||
MMIO_PUBLIC_SPECIALIZATIONS();
|
||||
#define MaybeExtern
|
||||
MMIO_PUBLIC_SPECIALIZATIONS()
|
||||
#undef MaybeExtern
|
||||
|
||||
}
|
||||
|
|
|
@ -216,12 +216,14 @@ private:
|
|||
MaybeExtern template ReadHandlingMethod<u8>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift); \
|
||||
MaybeExtern template ReadHandlingMethod<u16>* ReadToLarger(Mapping* mmio, u32 larger_addr, u32 shift)
|
||||
|
||||
#define MMIO_PUBLIC_SPECIALIZATIONS(MaybeExtern) \
|
||||
#define MMIO_PUBLIC_SPECIALIZATIONS() \
|
||||
MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u8); \
|
||||
MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u16); \
|
||||
MMIO_GENERIC_PUBLIC_SPECIALIZATIONS(MaybeExtern, u32); \
|
||||
MMIO_SPECIAL_PUBLIC_SPECIALIZATIONS(MaybeExtern);
|
||||
|
||||
MMIO_PUBLIC_SPECIALIZATIONS(extern)
|
||||
#define MaybeExtern extern
|
||||
MMIO_PUBLIC_SPECIALIZATIONS()
|
||||
#undef MaybeExtern
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <errno.h>
|
||||
#include <libusb.h>
|
||||
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Debugger/Debugger_SymbolMap.h"
|
||||
|
@ -25,7 +26,7 @@ void CWII_IPC_HLE_Device_hid::checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid)
|
|||
static u16 timeToFill = 0;
|
||||
if (timeToFill == 0)
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(hid->s_device_list_reply);
|
||||
std::lock_guard<std::mutex> lk(hid->m_device_list_reply_mutex);
|
||||
if (hid->deviceCommandAddress != 0){
|
||||
hid->FillOutDevices(Memory::Read_U32(hid->deviceCommandAddress + 0x18), Memory::Read_U32(hid->deviceCommandAddress + 0x1C));
|
||||
|
||||
|
@ -97,11 +98,11 @@ CWII_IPC_HLE_Device_hid::~CWII_IPC_HLE_Device_hid()
|
|||
deinit_libusb = true;
|
||||
}
|
||||
|
||||
for (const auto& device : open_devices)
|
||||
for (const auto& device : m_open_devices)
|
||||
{
|
||||
libusb_close(device.second);
|
||||
}
|
||||
open_devices.clear();
|
||||
m_open_devices.clear();
|
||||
|
||||
if (deinit_libusb)
|
||||
libusb_exit(nullptr);
|
||||
|
@ -238,7 +239,7 @@ bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
|
|||
}
|
||||
case IOCTL_HID_SHUTDOWN:
|
||||
{
|
||||
std::lock_guard<std::mutex> lk(s_device_list_reply);
|
||||
std::lock_guard<std::mutex> lk(m_device_list_reply_mutex);
|
||||
if (deviceCommandAddress != 0){
|
||||
Memory::Write_U32(0xFFFFFFFF, Memory::Read_U32(deviceCommandAddress + 0x18));
|
||||
|
||||
|
@ -479,12 +480,12 @@ void CWII_IPC_HLE_Device_hid::FillOutDevices(u32 BufferOut, u32 BufferOutSize)
|
|||
if (hidDeviceAliases[i] != 0 && check_cur != check)
|
||||
{
|
||||
DEBUG_LOG(WII_IPC_HID, "Removing: device %d %hX %hX", i, check, check_cur);
|
||||
std::lock_guard<std::mutex> lk(s_open_devices);
|
||||
if (open_devices.find(i) != open_devices.end())
|
||||
std::lock_guard<std::mutex> lk(m_open_devices_mutex);
|
||||
if (m_open_devices.find(i) != m_open_devices.end())
|
||||
{
|
||||
libusb_device_handle *handle = open_devices[i];
|
||||
libusb_device_handle *handle = m_open_devices[i];
|
||||
libusb_close(handle);
|
||||
open_devices.erase(i);
|
||||
m_open_devices.erase(i);
|
||||
}
|
||||
hidDeviceAliases[i] = 0;
|
||||
}
|
||||
|
@ -514,11 +515,11 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
|||
return nullptr;
|
||||
|
||||
|
||||
std::lock_guard<std::mutex> lk(s_open_devices);
|
||||
std::lock_guard<std::mutex> lk(m_open_devices_mutex);
|
||||
|
||||
if (open_devices.find(devNum) != open_devices.end())
|
||||
if (m_open_devices.find(devNum) != m_open_devices.end())
|
||||
{
|
||||
handle = open_devices[devNum];
|
||||
handle = m_open_devices[devNum];
|
||||
if (libusb_kernel_driver_active(handle, 0) != LIBUSB_ERROR_NO_DEVICE)
|
||||
{
|
||||
return handle;
|
||||
|
@ -526,7 +527,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
|||
else
|
||||
{
|
||||
libusb_close(handle);
|
||||
open_devices.erase(devNum);
|
||||
m_open_devices.erase(devNum);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -597,7 +598,7 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
|
|||
continue;
|
||||
}
|
||||
|
||||
open_devices[devNum] = handle;
|
||||
m_open_devices[devNum] = handle;
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -4,20 +4,31 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <libusb.h>
|
||||
#include <list>
|
||||
|
||||
#include "Common/Thread.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE.h"
|
||||
#include "Core/IPC_HLE/WII_IPC_HLE_Device.h"
|
||||
|
||||
// Forward declare things which we need from libusb header.
|
||||
// This prevents users of this file from indirectly pulling in libusb.
|
||||
#if defined(_WIN32)
|
||||
#define LIBUSB_CALL WINAPI
|
||||
#else
|
||||
#define LIBUSB_CALL
|
||||
#endif
|
||||
struct libusb_device_handle;
|
||||
struct libusb_device_descriptor;
|
||||
struct libusb_config_descriptor;
|
||||
struct libusb_interface_descriptor;
|
||||
struct libusb_endpoint_descriptor;
|
||||
struct libusb_transfer;
|
||||
|
||||
#define HID_ID_MASK 0x0000FFFFFFFFFFFF
|
||||
#define MAX_HID_INTERFACES 1
|
||||
|
||||
#define HIDERR_NO_DEVICE_FOUND -4
|
||||
|
||||
/* Connection timed out */
|
||||
|
||||
class CWII_IPC_HLE_Device_hid : public IWII_IPC_HLE_Device
|
||||
{
|
||||
public:
|
||||
|
@ -45,7 +56,6 @@ private:
|
|||
IOCTL_HID_CANCEL_INTERRUPT = 0x08,
|
||||
};
|
||||
|
||||
/* Device descriptor */
|
||||
struct WiiHIDDeviceDescriptor
|
||||
{
|
||||
u8 bLength;
|
||||
|
@ -108,32 +118,22 @@ private:
|
|||
u32 deviceCommandAddress;
|
||||
void FillOutDevices(u32 BufferOut, u32 BufferOutSize);
|
||||
int GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check);
|
||||
bool ClaimDevice(libusb_device_handle * dev);
|
||||
bool ClaimDevice(libusb_device_handle* dev);
|
||||
|
||||
void ConvertDeviceToWii(WiiHIDDeviceDescriptor *dest, const struct libusb_device_descriptor *src);
|
||||
void ConvertConfigToWii(WiiHIDConfigDescriptor *dest, const struct libusb_config_descriptor *src);
|
||||
void ConvertInterfaceToWii(WiiHIDInterfaceDescriptor *dest, const struct libusb_interface_descriptor *src);
|
||||
void ConvertEndpointToWii(WiiHIDEndpointDescriptor *dest, const struct libusb_endpoint_descriptor *src);
|
||||
void ConvertDeviceToWii(WiiHIDDeviceDescriptor* dest, const libusb_device_descriptor* src);
|
||||
void ConvertConfigToWii(WiiHIDConfigDescriptor* dest, const libusb_config_descriptor* src);
|
||||
void ConvertInterfaceToWii(WiiHIDInterfaceDescriptor* dest, const libusb_interface_descriptor* src);
|
||||
void ConvertEndpointToWii(WiiHIDEndpointDescriptor* dest, const libusb_endpoint_descriptor* src);
|
||||
|
||||
int Align(int num, int alignment);
|
||||
static void checkUsbUpdates(CWII_IPC_HLE_Device_hid* hid);
|
||||
static void LIBUSB_CALL handleUsbUpdates(struct libusb_transfer *transfer);
|
||||
static void LIBUSB_CALL handleUsbUpdates(libusb_transfer* transfer);
|
||||
|
||||
struct libusb_device_handle * GetDeviceByDevNum(u32 devNum);
|
||||
std::map<u32,libusb_device_handle*> open_devices;
|
||||
std::mutex s_open_devices;
|
||||
std::mutex s_device_list_reply;
|
||||
std::map<std::string,int> device_identifiers;
|
||||
libusb_device_handle* GetDeviceByDevNum(u32 devNum);
|
||||
std::map<u32, libusb_device_handle*> m_open_devices;
|
||||
std::mutex m_open_devices_mutex;
|
||||
std::mutex m_device_list_reply_mutex;
|
||||
|
||||
std::thread usb_thread;
|
||||
bool usb_thread_running;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u32 enq_address;
|
||||
u32 type;
|
||||
void * context;
|
||||
} _hidevent;
|
||||
|
||||
std::list<_hidevent> event_list;
|
||||
};
|
||||
|
|
|
@ -312,7 +312,7 @@ void Jit64::mtcrf(UGeckoInstruction inst)
|
|||
u64 newcrval = PPCCRToInternal(newcr);
|
||||
if ((s64)newcrval == (s32)newcrval)
|
||||
{
|
||||
MOV(64, M(&PowerPC::ppcState.cr_val[i]), Imm32(newcrval));
|
||||
MOV(64, M(&PowerPC::ppcState.cr_val[i]), Imm32((s32)newcrval));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1665,9 +1665,9 @@ static void DoWriteCode(IRBuilder* ibuild, JitIL* Jit, u32 exitAddress) {
|
|||
X64Reg reg = regFindFreeReg(RI);
|
||||
u64 val = ibuild->GetImmValue64(I);
|
||||
if ((u32)val == val)
|
||||
Jit->MOV(32, R(reg), Imm32(val));
|
||||
Jit->MOV(32, R(reg), Imm32((u32)val));
|
||||
else if ((s32)val == (s64)val)
|
||||
Jit->MOV(64, R(reg), Imm32(val));
|
||||
Jit->MOV(64, R(reg), Imm32((s32)val));
|
||||
else
|
||||
Jit->MOV(64, R(reg), Imm64(val));
|
||||
RI.regs[reg] = I;
|
||||
|
|
|
@ -266,7 +266,7 @@ const u8 *Jitx86Base::BackPatch(u8 *codePtr, u32 emAddress, void *ctx_void)
|
|||
XEmitter emitter(start);
|
||||
const u8 *trampoline = trampolines.GetWriteTrampoline(info, registersInUse, pc);
|
||||
emitter.CALL((void *)trampoline);
|
||||
int padding = codePtr + info.instructionSize - emitter.GetCodePtr();
|
||||
ptrdiff_t padding = (codePtr - emitter.GetCodePtr()) + info.instructionSize;
|
||||
if (padding > 0)
|
||||
{
|
||||
emitter.NOP(padding);
|
||||
|
|
|
@ -413,7 +413,7 @@ void EmuCodeBlock::SafeWriteRegToReg(X64Reg reg_value, X64Reg reg_addr, int acce
|
|||
{
|
||||
const u8* backpatchStart = GetCodePtr();
|
||||
u8* mov = UnsafeWriteRegToReg(reg_value, reg_addr, accessSize, offset, !(flags & SAFE_LOADSTORE_NO_SWAP));
|
||||
int padding = BACKPATCH_SIZE - (GetCodePtr() - backpatchStart);
|
||||
ptrdiff_t padding = BACKPATCH_SIZE - (GetCodePtr() - backpatchStart);
|
||||
if (padding > 0)
|
||||
{
|
||||
NOP(padding);
|
||||
|
|
Loading…
Reference in New Issue