mirror of https://github.com/AxioDL/boo.git
General: Make use of nullptr where applicable
This commit is contained in:
parent
386ec8e6cc
commit
78ce16aa9f
|
@ -18,12 +18,13 @@ class DeviceBase;
|
||||||
struct DeviceSignature {
|
struct DeviceSignature {
|
||||||
typedef std::vector<const DeviceSignature*> TDeviceSignatureSet;
|
typedef std::vector<const DeviceSignature*> TDeviceSignatureSet;
|
||||||
typedef std::function<std::shared_ptr<DeviceBase>(DeviceToken*)> TFactoryLambda;
|
typedef std::function<std::shared_ptr<DeviceBase>(DeviceToken*)> TFactoryLambda;
|
||||||
const char* m_name;
|
const char* m_name = nullptr;
|
||||||
uint64_t m_typeHash;
|
uint64_t m_typeHash = 0;
|
||||||
unsigned m_vid, m_pid;
|
unsigned m_vid = 0;
|
||||||
|
unsigned m_pid = 0;
|
||||||
TFactoryLambda m_factory;
|
TFactoryLambda m_factory;
|
||||||
DeviceType m_type;
|
DeviceType m_type{};
|
||||||
DeviceSignature() : m_name(NULL), m_typeHash(dev_typeid(DeviceSignature)) {} /* Sentinel constructor */
|
DeviceSignature() : m_typeHash(dev_typeid(DeviceSignature)) {} /* Sentinel constructor */
|
||||||
DeviceSignature(const char* name, uint64_t typeHash, unsigned vid, unsigned pid, TFactoryLambda&& factory,
|
DeviceSignature(const char* name, uint64_t typeHash, unsigned vid, unsigned pid, TFactoryLambda&& factory,
|
||||||
DeviceType type = DeviceType::None)
|
DeviceType type = DeviceType::None)
|
||||||
: m_name(name), m_typeHash(typeHash), m_vid(vid), m_pid(pid), m_factory(factory), m_type(type) {}
|
: m_name(name), m_typeHash(typeHash), m_vid(vid), m_pid(pid), m_factory(factory), m_type(type) {}
|
||||||
|
|
|
@ -78,11 +78,11 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
CFStringGetCStringPtr(devName, kCFStringEncodingUTF8));
|
CFStringGetCStringPtr(devName, kCFStringEncodingUTF8));
|
||||||
argSize = sizeof(devId);
|
argSize = sizeof(devId);
|
||||||
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &argSize, &devId) == noErr) {
|
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &argSize, &devId) == noErr) {
|
||||||
argSize = sizeof(CFStringRef);
|
argSize = sizeof(CFStringRef);
|
||||||
AudioObjectPropertyAddress deviceAddress;
|
AudioObjectPropertyAddress deviceAddress;
|
||||||
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||||
AudioObjectGetPropertyData(devId, &deviceAddress, 0, NULL, &argSize, &m_devName);
|
AudioObjectGetPropertyData(devId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
||||||
return {AudioChannelSet::Unknown, 48000.0};
|
return {AudioChannelSet::Unknown, 48000.0};
|
||||||
|
@ -90,21 +90,21 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
propertyAddress.mSelector = kAudioDevicePropertyStreams;
|
propertyAddress.mSelector = kAudioDevicePropertyStreams;
|
||||||
if (AudioObjectGetPropertyDataSize(devId, &propertyAddress, 0, NULL, &argSize) == noErr) {
|
if (AudioObjectGetPropertyDataSize(devId, &propertyAddress, 0, nullptr, &argSize) == noErr) {
|
||||||
numStreams = argSize / sizeof(AudioStreamID);
|
numStreams = argSize / sizeof(AudioStreamID);
|
||||||
streamIDs.resize(numStreams);
|
streamIDs.resize(numStreams);
|
||||||
|
|
||||||
if (AudioObjectGetPropertyData(devId, &propertyAddress, 0, NULL, &argSize, &streamIDs[0]) == noErr) {
|
if (AudioObjectGetPropertyData(devId, &propertyAddress, 0, nullptr, &argSize, &streamIDs[0]) == noErr) {
|
||||||
propertyAddress.mSelector = kAudioStreamPropertyDirection;
|
propertyAddress.mSelector = kAudioStreamPropertyDirection;
|
||||||
for (int stm = 0; stm < numStreams; stm++) {
|
for (int stm = 0; stm < numStreams; stm++) {
|
||||||
UInt32 streamDir;
|
UInt32 streamDir;
|
||||||
argSize = sizeof(streamDir);
|
argSize = sizeof(streamDir);
|
||||||
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &argSize, &streamDir) == noErr) {
|
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &argSize, &streamDir) == noErr) {
|
||||||
if (streamDir == 0) {
|
if (streamDir == 0) {
|
||||||
propertyAddress.mSelector = kAudioStreamPropertyPhysicalFormat;
|
propertyAddress.mSelector = kAudioStreamPropertyPhysicalFormat;
|
||||||
AudioStreamBasicDescription asbd;
|
AudioStreamBasicDescription asbd;
|
||||||
argSize = sizeof(asbd);
|
argSize = sizeof(asbd);
|
||||||
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &argSize, &asbd) == noErr) {
|
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &argSize, &asbd) == noErr) {
|
||||||
switch (asbd.mChannelsPerFrame) {
|
switch (asbd.mChannelsPerFrame) {
|
||||||
case 2:
|
case 2:
|
||||||
return {AudioChannelSet::Stereo, asbd.mSampleRate};
|
return {AudioChannelSet::Stereo, asbd.mSampleRate};
|
||||||
|
@ -155,29 +155,29 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
propertyAddress.mSelector = kAudioHardwarePropertyDevices;
|
propertyAddress.mSelector = kAudioHardwarePropertyDevices;
|
||||||
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
|
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
|
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
|
||||||
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propertySize) == noErr) {
|
if (AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &propertySize) == noErr) {
|
||||||
numDevices = propertySize / sizeof(AudioDeviceID);
|
numDevices = propertySize / sizeof(AudioDeviceID);
|
||||||
ret.reserve(numDevices);
|
ret.reserve(numDevices);
|
||||||
deviceIDs.resize(numDevices);
|
deviceIDs.resize(numDevices);
|
||||||
|
|
||||||
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propertySize,
|
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &propertySize,
|
||||||
&deviceIDs[0]) == noErr) {
|
&deviceIDs[0]) == noErr) {
|
||||||
char deviceName[64];
|
char deviceName[64];
|
||||||
|
|
||||||
for (int idx = 0; idx < numDevices; idx++) {
|
for (int idx = 0; idx < numDevices; idx++) {
|
||||||
propertyAddress.mSelector = kAudioDevicePropertyStreams;
|
propertyAddress.mSelector = kAudioDevicePropertyStreams;
|
||||||
if (AudioObjectGetPropertyDataSize(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize) == noErr) {
|
if (AudioObjectGetPropertyDataSize(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize) == noErr) {
|
||||||
numStreams = propertySize / sizeof(AudioStreamID);
|
numStreams = propertySize / sizeof(AudioStreamID);
|
||||||
streamIDs.resize(numStreams);
|
streamIDs.resize(numStreams);
|
||||||
|
|
||||||
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, &streamIDs[0]) ==
|
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, &streamIDs[0]) ==
|
||||||
noErr) {
|
noErr) {
|
||||||
propertyAddress.mSelector = kAudioStreamPropertyDirection;
|
propertyAddress.mSelector = kAudioStreamPropertyDirection;
|
||||||
bool foundOutput = false;
|
bool foundOutput = false;
|
||||||
for (int stm = 0; stm < numStreams; stm++) {
|
for (int stm = 0; stm < numStreams; stm++) {
|
||||||
UInt32 streamDir;
|
UInt32 streamDir;
|
||||||
propertySize = sizeof(streamDir);
|
propertySize = sizeof(streamDir);
|
||||||
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, NULL, &propertySize, &streamDir) ==
|
if (AudioObjectGetPropertyData(streamIDs[stm], &propertyAddress, 0, nullptr, &propertySize, &streamDir) ==
|
||||||
noErr) {
|
noErr) {
|
||||||
if (streamDir == 0) {
|
if (streamDir == 0) {
|
||||||
foundOutput = true;
|
foundOutput = true;
|
||||||
|
@ -192,13 +192,13 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
|
|
||||||
propertySize = sizeof(deviceName);
|
propertySize = sizeof(deviceName);
|
||||||
propertyAddress.mSelector = kAudioDevicePropertyDeviceName;
|
propertyAddress.mSelector = kAudioDevicePropertyDeviceName;
|
||||||
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, deviceName) ==
|
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, deviceName) ==
|
||||||
noErr) {
|
noErr) {
|
||||||
CFPointer<CFStringRef> uidString;
|
CFPointer<CFStringRef> uidString;
|
||||||
|
|
||||||
propertySize = sizeof(CFStringRef);
|
propertySize = sizeof(CFStringRef);
|
||||||
propertyAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
propertyAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||||
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, NULL, &propertySize, &uidString) ==
|
if (AudioObjectGetPropertyData(deviceIDs[idx], &propertyAddress, 0, nullptr, &propertySize, &uidString) ==
|
||||||
noErr) {
|
noErr) {
|
||||||
ret.emplace_back(CFStringGetCStringPtr(uidString.get(), kCFStringEncodingUTF8), deviceName);
|
ret.emplace_back(CFStringGetCStringPtr(uidString.get(), kCFStringEncodingUTF8), deviceName);
|
||||||
}
|
}
|
||||||
|
@ -800,11 +800,11 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
const AudioObjectPropertyAddress* inAddresses, AQSAudioVoiceEngine* engine) {
|
const AudioObjectPropertyAddress* inAddresses, AQSAudioVoiceEngine* engine) {
|
||||||
AudioObjectID defaultDeviceId;
|
AudioObjectID defaultDeviceId;
|
||||||
UInt32 argSize = sizeof(defaultDeviceId);
|
UInt32 argSize = sizeof(defaultDeviceId);
|
||||||
if (AudioObjectGetPropertyData(inObjectID, inAddresses, 0, NULL, &argSize, &defaultDeviceId) == noErr) {
|
if (AudioObjectGetPropertyData(inObjectID, inAddresses, 0, nullptr, &argSize, &defaultDeviceId) == noErr) {
|
||||||
argSize = sizeof(CFStringRef);
|
argSize = sizeof(CFStringRef);
|
||||||
AudioObjectPropertyAddress deviceAddress;
|
AudioObjectPropertyAddress deviceAddress;
|
||||||
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||||
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, NULL, &argSize, &engine->m_devName);
|
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &engine->m_devName);
|
||||||
}
|
}
|
||||||
engine->m_needsRebuild = true;
|
engine->m_needsRebuild = true;
|
||||||
return noErr;
|
return noErr;
|
||||||
|
@ -820,12 +820,12 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
AudioObjectID defaultDeviceId;
|
AudioObjectID defaultDeviceId;
|
||||||
UInt32 argSize = sizeof(defaultDeviceId);
|
UInt32 argSize = sizeof(defaultDeviceId);
|
||||||
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||||
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &argSize, &defaultDeviceId) ==
|
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, nullptr, &argSize, &defaultDeviceId) ==
|
||||||
noErr) {
|
noErr) {
|
||||||
argSize = sizeof(CFStringRef);
|
argSize = sizeof(CFStringRef);
|
||||||
AudioObjectPropertyAddress deviceAddress;
|
AudioObjectPropertyAddress deviceAddress;
|
||||||
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||||
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, NULL, &argSize, &m_devName);
|
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
|
||||||
} else {
|
} else {
|
||||||
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,9 +38,9 @@ namespace boo {
|
||||||
static logvisor::Module Log("boo::WASAPI");
|
static logvisor::Module Log("boo::WASAPI");
|
||||||
|
|
||||||
#define SAFE_RELEASE(punk) \
|
#define SAFE_RELEASE(punk) \
|
||||||
if ((punk) != NULL) { \
|
if ((punk) != nullptr) { \
|
||||||
(punk)->Release(); \
|
(punk)->Release(); \
|
||||||
(punk) = NULL; \
|
(punk) = nullptr; \
|
||||||
}
|
}
|
||||||
|
|
||||||
struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
|
@ -90,7 +90,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
AddRef();
|
AddRef();
|
||||||
*ppvInterface = (IMMNotificationClient*)this;
|
*ppvInterface = (IMMNotificationClient*)this;
|
||||||
} else {
|
} else {
|
||||||
*ppvInterface = NULL;
|
*ppvInterface = nullptr;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -303,7 +303,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
AddRef();
|
AddRef();
|
||||||
*ppvInterface = (IActivateAudioInterfaceCompletionHandler*)this;
|
*ppvInterface = (IActivateAudioInterfaceCompletionHandler*)this;
|
||||||
} else {
|
} else {
|
||||||
*ppvInterface = NULL;
|
*ppvInterface = nullptr;
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -663,7 +663,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
m_hdr.dwBufferLength = 512;
|
m_hdr.dwBufferLength = 512;
|
||||||
m_hdr.dwFlags = MHDR_ISSTRM;
|
m_hdr.dwFlags = MHDR_ISSTRM;
|
||||||
midiOutPrepareHeader(m_midi, &m_hdr, sizeof(m_hdr));
|
midiOutPrepareHeader(m_midi, &m_hdr, sizeof(m_hdr));
|
||||||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
midiStreamOpen(&m_strm, &id, 1, 0, 0, CALLBACK_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MIDIOut() override {
|
~MIDIOut() override {
|
||||||
|
@ -712,7 +712,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
m_hdr.dwBufferLength = 512;
|
m_hdr.dwBufferLength = 512;
|
||||||
m_hdr.dwFlags = MHDR_ISSTRM;
|
m_hdr.dwFlags = MHDR_ISSTRM;
|
||||||
midiOutPrepareHeader(m_midiOut, &m_hdr, sizeof(m_hdr));
|
midiOutPrepareHeader(m_midiOut, &m_hdr, sizeof(m_hdr));
|
||||||
midiStreamOpen(&m_strm, &id, 1, NULL, NULL, CALLBACK_NULL);
|
midiStreamOpen(&m_strm, &id, 1, 0, 0, CALLBACK_NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
~MIDIInOut() override {
|
~MIDIInOut() override {
|
||||||
|
@ -835,7 +835,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
if (FAILED(midiOutOpen(&static_cast<MIDIOut&>(*ret).m_midi, id, NULL, NULL, CALLBACK_NULL)))
|
if (FAILED(midiOutOpen(&static_cast<MIDIOut&>(*ret).m_midi, id, 0, 0, CALLBACK_NULL)))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
static_cast<MIDIOut&>(*ret).prepare();
|
static_cast<MIDIOut&>(*ret).prepare();
|
||||||
|
@ -861,7 +861,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||||
return {};
|
return {};
|
||||||
midiInStart(static_cast<MIDIInOut&>(*ret).m_midiIn);
|
midiInStart(static_cast<MIDIInOut&>(*ret).m_midiIn);
|
||||||
|
|
||||||
if (FAILED(midiOutOpen(&static_cast<MIDIInOut&>(*ret).m_midiOut, outId, NULL, NULL, CALLBACK_NULL)))
|
if (FAILED(midiOutOpen(&static_cast<MIDIInOut&>(*ret).m_midiOut, outId, 0, 0, CALLBACK_NULL)))
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
static_cast<MIDIInOut&>(*ret).prepare();
|
static_cast<MIDIInOut&>(*ret).prepare();
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void SetImageLayout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlag
|
||||||
uint32_t layerCount, uint32_t baseMipLevel = 0) {
|
uint32_t layerCount, uint32_t baseMipLevel = 0) {
|
||||||
VkImageMemoryBarrier imageMemoryBarrier = {};
|
VkImageMemoryBarrier imageMemoryBarrier = {};
|
||||||
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||||
imageMemoryBarrier.pNext = NULL;
|
imageMemoryBarrier.pNext = nullptr;
|
||||||
imageMemoryBarrier.srcAccessMask = 0;
|
imageMemoryBarrier.srcAccessMask = 0;
|
||||||
imageMemoryBarrier.dstAccessMask = 0;
|
imageMemoryBarrier.dstAccessMask = 0;
|
||||||
imageMemoryBarrier.oldLayout = old_image_layout;
|
imageMemoryBarrier.oldLayout = old_image_layout;
|
||||||
|
@ -261,7 +261,7 @@ static void SetImageLayout(VkCommandBuffer cmd, VkImage image, VkImageAspectFlag
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::CmdPipelineBarrier(cmd, src_stages, dest_stages, 0, 0, NULL, 0, NULL, 1, &imageMemoryBarrier);
|
vk::CmdPipelineBarrier(cmd, src_stages, dest_stages, 0, 0, nullptr, 0, nullptr, 1, &imageMemoryBarrier);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkResult InitGlobalExtensionProperties(VulkanContext::LayerProperties& layerProps) {
|
static VkResult InitGlobalExtensionProperties(VulkanContext::LayerProperties& layerProps) {
|
||||||
|
|
|
@ -1801,7 +1801,7 @@ bool NXContext::initialize() {
|
||||||
|
|
||||||
gfxInitDefault();
|
gfxInitDefault();
|
||||||
gfxSetMode(GfxMode_TiledDouble);
|
gfxSetMode(GfxMode_TiledDouble);
|
||||||
consoleInit(NULL);
|
consoleInit(nullptr);
|
||||||
printf("Activated console\n\n");
|
printf("Activated console\n\n");
|
||||||
m_screen = nouveau_switch_screen_create();
|
m_screen = nouveau_switch_screen_create();
|
||||||
if (!m_screen) {
|
if (!m_screen) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ class HIDDeviceUdev final : public IHIDDevice {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Request that kernel disconnects existing driver */
|
/* Request that kernel disconnects existing driver */
|
||||||
usbdevfs_ioctl disconnectReq = {0, USBDEVFS_DISCONNECT, NULL};
|
usbdevfs_ioctl disconnectReq = {0, USBDEVFS_DISCONNECT, nullptr};
|
||||||
ioctl(fd, USBDEVFS_IOCTL, &disconnectReq);
|
ioctl(fd, USBDEVFS_IOCTL, &disconnectReq);
|
||||||
|
|
||||||
/* Return control to main thread */
|
/* Return control to main thread */
|
||||||
|
|
|
@ -27,8 +27,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
||||||
DeviceToken& m_token;
|
DeviceToken& m_token;
|
||||||
std::shared_ptr<DeviceBase> m_devImp;
|
std::shared_ptr<DeviceBase> m_devImp;
|
||||||
|
|
||||||
HANDLE m_devHandle = 0;
|
HANDLE m_devHandle = nullptr;
|
||||||
HANDLE m_hidHandle = 0;
|
HANDLE m_hidHandle = nullptr;
|
||||||
WINUSB_INTERFACE_HANDLE m_usbHandle = nullptr;
|
WINUSB_INTERFACE_HANDLE m_usbHandle = nullptr;
|
||||||
unsigned m_usbIntfInPipe = 0;
|
unsigned m_usbIntfInPipe = 0;
|
||||||
unsigned m_usbIntfOutPipe = 0;
|
unsigned m_usbIntfOutPipe = 0;
|
||||||
|
@ -42,9 +42,10 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
||||||
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
|
bool _sendUSBInterruptTransfer(const uint8_t* data, size_t length) override {
|
||||||
if (m_usbHandle) {
|
if (m_usbHandle) {
|
||||||
ULONG lengthTransferred = 0;
|
ULONG lengthTransferred = 0;
|
||||||
if (!WinUsb_WritePipe(m_usbHandle, m_usbIntfOutPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL) ||
|
if (!WinUsb_WritePipe(m_usbHandle, m_usbIntfOutPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, nullptr) ||
|
||||||
lengthTransferred != length)
|
lengthTransferred != length) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -53,7 +54,7 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
||||||
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
|
size_t _receiveUSBInterruptTransfer(uint8_t* data, size_t length) override {
|
||||||
if (m_usbHandle) {
|
if (m_usbHandle) {
|
||||||
ULONG lengthTransferred = 0;
|
ULONG lengthTransferred = 0;
|
||||||
if (!WinUsb_ReadPipe(m_usbHandle, m_usbIntfInPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, NULL))
|
if (!WinUsb_ReadPipe(m_usbHandle, m_usbIntfInPipe, (PUCHAR)data, (ULONG)length, &lengthTransferred, nullptr))
|
||||||
return 0;
|
return 0;
|
||||||
return lengthTransferred;
|
return lengthTransferred;
|
||||||
}
|
}
|
||||||
|
@ -66,8 +67,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
||||||
|
|
||||||
/* POSIX.. who needs it?? -MS */
|
/* POSIX.. who needs it?? -MS */
|
||||||
device->m_devHandle =
|
device->m_devHandle =
|
||||||
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,
|
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
|
||||||
if (INVALID_HANDLE_VALUE == device->m_devHandle) {
|
if (INVALID_HANDLE_VALUE == device->m_devHandle) {
|
||||||
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
|
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
|
||||||
device->m_token.getProductName(), device->m_devPath, GetLastError());
|
device->m_token.getProductName(), device->m_devPath, GetLastError());
|
||||||
|
@ -150,8 +151,8 @@ class HIDDeviceWinUSB final : public IHIDDevice {
|
||||||
/* POSIX.. who needs it?? -MS */
|
/* POSIX.. who needs it?? -MS */
|
||||||
device->m_overlapped.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
|
device->m_overlapped.hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr);
|
||||||
device->m_hidHandle =
|
device->m_hidHandle =
|
||||||
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, NULL,
|
CreateFileA(device->m_devPath.data(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr,
|
||||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
|
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
|
||||||
if (INVALID_HANDLE_VALUE == device->m_hidHandle) {
|
if (INVALID_HANDLE_VALUE == device->m_hidHandle) {
|
||||||
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
|
device->m_devImp->deviceError(fmt("Unable to open {}@{}: {}\n"),
|
||||||
device->m_token.getProductName(), device->m_devPath, GetLastError());
|
device->m_token.getProductName(), device->m_devPath, GetLastError());
|
||||||
|
|
|
@ -51,17 +51,17 @@ class HIDListenerWinUSB final : public IHIDListener {
|
||||||
CHAR szVid[MAX_DEVICE_ID_LEN], szPid[MAX_DEVICE_ID_LEN], szMi[MAX_DEVICE_ID_LEN];
|
CHAR szVid[MAX_DEVICE_ID_LEN], szPid[MAX_DEVICE_ID_LEN], szMi[MAX_DEVICE_ID_LEN];
|
||||||
|
|
||||||
/* List all connected HID devices */
|
/* List all connected HID devices */
|
||||||
hDevInfo = SetupDiGetClassDevs(NULL, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_DEVICEINTERFACE);
|
hDevInfo = SetupDiGetClassDevs(nullptr, 0, 0, DIGCF_PRESENT | DIGCF_ALLCLASSES | DIGCF_DEVICEINTERFACE);
|
||||||
if (hDevInfo == INVALID_HANDLE_VALUE)
|
if (hDevInfo == INVALID_HANDLE_VALUE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0;; ++i) {
|
for (i = 0;; ++i) {
|
||||||
if (!SetupDiEnumDeviceInterfaces(hDevInfo, NULL, TypeGUID, i, &DeviceInterfaceData))
|
if (!SetupDiEnumDeviceInterfaces(hDevInfo, nullptr, TypeGUID, i, &DeviceInterfaceData))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
DeviceInterfaceDetailData.wtf.cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
DeviceInterfaceDetailData.wtf.cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
||||||
if (!SetupDiGetDeviceInterfaceDetailA(hDevInfo, &DeviceInterfaceData, &DeviceInterfaceDetailData.wtf,
|
if (!SetupDiGetDeviceInterfaceDetailA(hDevInfo, &DeviceInterfaceData, &DeviceInterfaceDetailData.wtf,
|
||||||
sizeof(DeviceInterfaceDetailData), NULL, &DeviceInfoData))
|
sizeof(DeviceInterfaceDetailData), nullptr, &DeviceInfoData))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r = CM_Get_Device_IDA(DeviceInfoData.DevInst, szDeviceInstanceID, MAX_PATH, 0);
|
r = CM_Get_Device_IDA(DeviceInfoData.DevInst, szDeviceInstanceID, MAX_PATH, 0);
|
||||||
|
@ -73,7 +73,7 @@ class HIDListenerWinUSB final : public IHIDListener {
|
||||||
szVid[0] = '\0';
|
szVid[0] = '\0';
|
||||||
szPid[0] = '\0';
|
szPid[0] = '\0';
|
||||||
szMi[0] = '\0';
|
szMi[0] = '\0';
|
||||||
while (pszToken != NULL) {
|
while (pszToken != nullptr) {
|
||||||
for (j = 0; j < 3; ++j) {
|
for (j = 0; j < 3; ++j) {
|
||||||
if (strncmp(pszToken, arPrefix[j], 4) == 0) {
|
if (strncmp(pszToken, arPrefix[j], 4) == 0) {
|
||||||
switch (j) {
|
switch (j) {
|
||||||
|
@ -91,14 +91,14 @@ class HIDListenerWinUSB final : public IHIDListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pszToken = strtok_s(NULL, "\\#&", &pszNextToken);
|
pszToken = strtok_s(nullptr, "\\#&", &pszNextToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!szVid[0] || !szPid[0])
|
if (!szVid[0] || !szPid[0])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
unsigned vid = strtol(szVid + 4, NULL, 16);
|
unsigned vid = strtol(szVid + 4, nullptr, 16);
|
||||||
unsigned pid = strtol(szPid + 4, NULL, 16);
|
unsigned pid = strtol(szPid + 4, nullptr, 16);
|
||||||
|
|
||||||
CHAR productW[1024] = {0};
|
CHAR productW[1024] = {0};
|
||||||
// CHAR product[1024] = {0};
|
// CHAR product[1024] = {0};
|
||||||
|
@ -121,8 +121,8 @@ class HIDListenerWinUSB final : public IHIDListener {
|
||||||
|
|
||||||
if (type == DeviceType::HID) {
|
if (type == DeviceType::HID) {
|
||||||
HANDLE devHnd = CreateFileA(DeviceInterfaceDetailData.wtf.DevicePath, GENERIC_WRITE | GENERIC_READ,
|
HANDLE devHnd = CreateFileA(DeviceInterfaceDetailData.wtf.DevicePath, GENERIC_WRITE | GENERIC_READ,
|
||||||
FILE_SHARE_WRITE | FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
FILE_SHARE_WRITE | FILE_SHARE_READ, nullptr, OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, NULL);
|
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED, nullptr);
|
||||||
if (INVALID_HANDLE_VALUE == devHnd)
|
if (INVALID_HANDLE_VALUE == devHnd)
|
||||||
continue;
|
continue;
|
||||||
PHIDP_PREPARSED_DATA preparsedData;
|
PHIDP_PREPARSED_DATA preparsedData;
|
||||||
|
|
|
@ -93,7 +93,7 @@ static const NSOpenGLPixelFormatAttribute PF_RGBAF32_Z24_ATTRS[] =
|
||||||
|
|
||||||
static const NSOpenGLPixelFormatAttribute* PF_TABLE[] =
|
static const NSOpenGLPixelFormatAttribute* PF_TABLE[] =
|
||||||
{
|
{
|
||||||
NULL,
|
nullptr,
|
||||||
PF_RGBA8_ATTRS,
|
PF_RGBA8_ATTRS,
|
||||||
PF_RGBA16_ATTRS,
|
PF_RGBA16_ATTRS,
|
||||||
PF_RGBA8_Z24_ATTRS,
|
PF_RGBA8_Z24_ATTRS,
|
||||||
|
@ -330,15 +330,15 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api,
|
||||||
GLContext* glCtx)
|
GLContext* glCtx)
|
||||||
{
|
{
|
||||||
if (api != IGraphicsContext::EGraphicsAPI::OpenGL3_3 && api != IGraphicsContext::EGraphicsAPI::OpenGL4_2)
|
if (api != IGraphicsContext::EGraphicsAPI::OpenGL3_3 && api != IGraphicsContext::EGraphicsAPI::OpenGL4_2)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* Create temporary context to query GL version */
|
/* Create temporary context to query GL version */
|
||||||
NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_RGBA8_ATTRS];
|
NSOpenGLPixelFormat* nspf = [[NSOpenGLPixelFormat alloc] initWithAttributes:PF_RGBA8_ATTRS];
|
||||||
if (!nspf)
|
if (!nspf)
|
||||||
return NULL;
|
return nullptr;
|
||||||
NSOpenGLContext* nsctx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:nil];
|
NSOpenGLContext* nsctx = [[NSOpenGLContext alloc] initWithFormat:nspf shareContext:nil];
|
||||||
if (!nsctx)
|
if (!nsctx)
|
||||||
return NULL;
|
return nullptr;
|
||||||
[nsctx makeCurrentContext];
|
[nsctx makeCurrentContext];
|
||||||
const char* glVersion = (char*)glGetString(GL_VERSION);
|
const char* glVersion = (char*)glGetString(GL_VERSION);
|
||||||
unsigned major = 0;
|
unsigned major = 0;
|
||||||
|
@ -352,13 +352,13 @@ IGraphicsContext* _GraphicsContextCocoaGLNew(IGraphicsContext::EGraphicsAPI api,
|
||||||
Log.report(logvisor::Fatal, fmt("glewInit failed"));
|
Log.report(logvisor::Fatal, fmt("glewInit failed"));
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
if (!glVersion)
|
if (!glVersion)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if (major > 4 || (major == 4 && minor >= 2))
|
if (major > 4 || (major == 4 && minor >= 2))
|
||||||
api = IGraphicsContext::EGraphicsAPI::OpenGL4_2;
|
api = IGraphicsContext::EGraphicsAPI::OpenGL4_2;
|
||||||
else if (major == 3 && minor >= 3)
|
else if (major == 3 && minor >= 3)
|
||||||
if (api == IGraphicsContext::EGraphicsAPI::OpenGL4_2)
|
if (api == IGraphicsContext::EGraphicsAPI::OpenGL4_2)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
return new GraphicsContextCocoaGL(api, parentWindow, lastGLCtx, glCtx);
|
return new GraphicsContextCocoaGL(api, parentWindow, lastGLCtx, glCtx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,7 +222,7 @@ public:
|
||||||
void _setWindow(CoreWindow ^ window) { m_window = _WindowUWPNew(m_friendlyName, m_3dCtx); }
|
void _setWindow(CoreWindow ^ window) { m_window = _WindowUWPNew(m_friendlyName, m_3dCtx); }
|
||||||
};
|
};
|
||||||
|
|
||||||
IApplication* APP = NULL;
|
IApplication* APP = nullptr;
|
||||||
ref class AppView sealed : public IFrameworkView {
|
ref class AppView sealed : public IFrameworkView {
|
||||||
ApplicationUWP m_app;
|
ApplicationUWP m_app;
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ public:
|
||||||
MONITORINFO monitor_info;
|
MONITORINFO monitor_info;
|
||||||
monitor_info.cbSize = sizeof(monitor_info);
|
monitor_info.cbSize = sizeof(monitor_info);
|
||||||
GetMonitorInfo(MonitorFromWindow(win.m_hwnd, MONITOR_DEFAULTTONEAREST), &monitor_info);
|
GetMonitorInfo(MonitorFromWindow(win.m_hwnd, MONITOR_DEFAULTTONEAREST), &monitor_info);
|
||||||
SetWindowPos(win.m_hwnd, NULL, monitor_info.rcMonitor.left, monitor_info.rcMonitor.top,
|
SetWindowPos(win.m_hwnd, nullptr, monitor_info.rcMonitor.left, monitor_info.rcMonitor.top,
|
||||||
monitor_info.rcMonitor.right - monitor_info.rcMonitor.left,
|
monitor_info.rcMonitor.right - monitor_info.rcMonitor.left,
|
||||||
monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top,
|
monitor_info.rcMonitor.bottom - monitor_info.rcMonitor.top,
|
||||||
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||||
|
@ -350,7 +350,7 @@ public:
|
||||||
SetWindowLong(win.m_hwnd, GWL_STYLE, win.m_fsStyle);
|
SetWindowLong(win.m_hwnd, GWL_STYLE, win.m_fsStyle);
|
||||||
SetWindowLong(win.m_hwnd, GWL_EXSTYLE, win.m_fsExStyle);
|
SetWindowLong(win.m_hwnd, GWL_EXSTYLE, win.m_fsExStyle);
|
||||||
|
|
||||||
SetWindowPos(win.m_hwnd, NULL, win.m_fsRect.left, win.m_fsRect.top, win.m_fsRect.right - win.m_fsRect.left,
|
SetWindowPos(win.m_hwnd, nullptr, win.m_fsRect.left, win.m_fsRect.top, win.m_fsRect.right - win.m_fsRect.left,
|
||||||
win.m_fsRect.bottom - win.m_fsRect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
win.m_fsRect.bottom - win.m_fsRect.top, SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED);
|
||||||
|
|
||||||
win.m_fs = false;
|
win.m_fs = false;
|
||||||
|
@ -372,8 +372,8 @@ public:
|
||||||
});
|
});
|
||||||
|
|
||||||
/* Pump messages */
|
/* Pump messages */
|
||||||
MSG msg = {0};
|
MSG msg = {};
|
||||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
while (GetMessage(&msg, nullptr, 0, 0)) {
|
||||||
if (!msg.hwnd) {
|
if (!msg.hwnd) {
|
||||||
/* PostThreadMessage events */
|
/* PostThreadMessage events */
|
||||||
switch (msg.message) {
|
switch (msg.message) {
|
||||||
|
@ -457,7 +457,7 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
IApplication* APP = NULL;
|
IApplication* APP = nullptr;
|
||||||
int ApplicationRun(IApplication::EPlatformType platform, IApplicationCallback& cb, SystemStringView uniqueName,
|
int ApplicationRun(IApplication::EPlatformType platform, IApplicationCallback& cb, SystemStringView uniqueName,
|
||||||
SystemStringView friendlyName, SystemStringView pname, const std::vector<SystemString>& args,
|
SystemStringView friendlyName, SystemStringView pname, const std::vector<SystemString>& args,
|
||||||
std::string_view gfxApi, uint32_t samples, uint32_t anisotropy, bool deepColor,
|
std::string_view gfxApi, uint32_t samples, uint32_t anisotropy, bool deepColor,
|
||||||
|
@ -484,7 +484,7 @@ int ApplicationRun(IApplication::EPlatformType platform, IApplicationCallback& c
|
||||||
WIN32_CURSORS.m_wait = LoadCursor(nullptr, IDC_WAIT);
|
WIN32_CURSORS.m_wait = LoadCursor(nullptr, IDC_WAIT);
|
||||||
|
|
||||||
/* One class for *all* boo windows */
|
/* One class for *all* boo windows */
|
||||||
WNDCLASS wndClass = {0, WindowProc, 0, 0, GetModuleHandle(nullptr), 0, 0, 0, 0, L"BooWindow"};
|
WNDCLASS wndClass = {0, WindowProc, 0, 0, GetModuleHandle(nullptr), nullptr, nullptr, nullptr, nullptr, L"BooWindow"};
|
||||||
wndClass.hIcon = LoadIconW(wndClass.hInstance, MAKEINTRESOURCEW(101));
|
wndClass.hIcon = LoadIconW(wndClass.hInstance, MAKEINTRESOURCEW(101));
|
||||||
wndClass.hCursor = WIN32_CURSORS.m_arrow;
|
wndClass.hCursor = WIN32_CURSORS.m_arrow;
|
||||||
RegisterClassW(&wndClass);
|
RegisterClassW(&wndClass);
|
||||||
|
|
|
@ -26,7 +26,7 @@ extern PFN_GetScaleFactorForMonitor MyGetScaleFactorForMonitor;
|
||||||
|
|
||||||
struct OGLContext {
|
struct OGLContext {
|
||||||
ComPtr<IDXGIFactory1> m_dxFactory;
|
ComPtr<IDXGIFactory1> m_dxFactory;
|
||||||
HGLRC m_lastContext = 0;
|
HGLRC m_lastContext = nullptr;
|
||||||
struct Window {
|
struct Window {
|
||||||
HWND m_hwnd;
|
HWND m_hwnd;
|
||||||
HDC m_deviceContext;
|
HDC m_deviceContext;
|
||||||
|
|
|
@ -198,7 +198,7 @@ public:
|
||||||
Log.report(logvisor::Fatal, fmt("glewInit failed"));
|
Log.report(logvisor::Fatal, fmt("glewInit failed"));
|
||||||
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||||
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||||
wglMakeCurrent(w.m_deviceContext, 0);
|
wglMakeCurrent(w.m_deviceContext, nullptr);
|
||||||
wglDeleteContext(tmpCtx);
|
wglDeleteContext(tmpCtx);
|
||||||
|
|
||||||
if (b3dCtx.m_ctxOgl.m_glCtx.m_deepColor) {
|
if (b3dCtx.m_ctxOgl.m_glCtx.m_deepColor) {
|
||||||
|
@ -303,7 +303,7 @@ public:
|
||||||
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
IGraphicsDataFactory* getDataFactory() override { return m_dataFactory.get(); }
|
||||||
|
|
||||||
/* Creates a new context on current thread!! Call from client loading thread */
|
/* Creates a new context on current thread!! Call from client loading thread */
|
||||||
HGLRC m_mainCtx = 0;
|
HGLRC m_mainCtx = nullptr;
|
||||||
IGraphicsDataFactory* getMainContextDataFactory() override {
|
IGraphicsDataFactory* getMainContextDataFactory() override {
|
||||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||||
if (!m_mainCtx) {
|
if (!m_mainCtx) {
|
||||||
|
@ -317,7 +317,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates a new context on current thread!! Call from client loading thread */
|
/* Creates a new context on current thread!! Call from client loading thread */
|
||||||
HGLRC m_loadCtx = 0;
|
HGLRC m_loadCtx = nullptr;
|
||||||
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
IGraphicsDataFactory* getLoadContextDataFactory() override {
|
||||||
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
OGLContext::Window& w = m_3dCtx.m_ctxOgl.m_windows[m_parentWindow];
|
||||||
if (!m_loadCtx) {
|
if (!m_loadCtx) {
|
||||||
|
@ -852,7 +852,7 @@ public:
|
||||||
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW, FALSE);
|
||||||
|
|
||||||
m_hwnd = CreateWindowW(L"BooWindow", title.data(), WS_OVERLAPPEDWINDOW, r.left, r.top, r.right - r.left,
|
m_hwnd = CreateWindowW(L"BooWindow", title.data(), WS_OVERLAPPEDWINDOW, r.left, r.top, r.right - r.left,
|
||||||
r.bottom - r.top, NULL, NULL, NULL, NULL);
|
r.bottom - r.top, nullptr, nullptr, nullptr, nullptr);
|
||||||
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
|
HINSTANCE wndInstance = HINSTANCE(GetWindowLongPtr(m_hwnd, GWLP_HINSTANCE));
|
||||||
m_imc = ImmGetContext(m_hwnd);
|
m_imc = ImmGetContext(m_hwnd);
|
||||||
|
|
||||||
|
|
|
@ -99,8 +99,8 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst) {
|
||||||
fmt::print(stderr, fmt("DBus Connection Error ({})\n"), err.message);
|
fmt::print(stderr, fmt("DBus Connection Error ({})\n"), err.message);
|
||||||
dbus_error_free(&err);
|
dbus_error_free(&err);
|
||||||
}
|
}
|
||||||
if (NULL == conn)
|
if (conn == nullptr)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
/* request our name on the bus and check for errors */
|
/* request our name on the bus and check for errors */
|
||||||
int ret = dbus_bus_request_name(conn, fmt::format(fmt("boo.{}.unique"), appName).c_str(),
|
int ret = dbus_bus_request_name(conn, fmt::format(fmt("boo.{}.unique"), appName).c_str(),
|
||||||
|
@ -109,7 +109,7 @@ DBusConnection* RegisterDBus(const char* appName, bool& isFirst) {
|
||||||
fmt::print(stderr, fmt("DBus Name Error ({})\n"), err.message);
|
fmt::print(stderr, fmt("DBus Name Error ({})\n"), err.message);
|
||||||
dbus_error_free(&err);
|
dbus_error_free(&err);
|
||||||
dbus_connection_close(conn);
|
dbus_connection_close(conn);
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
|
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret)
|
||||||
isFirst = false;
|
isFirst = false;
|
||||||
|
|
|
@ -459,7 +459,7 @@ public:
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(m_x11Fd, &fds);
|
FD_SET(m_x11Fd, &fds);
|
||||||
FD_SET(m_dbusFd, &fds);
|
FD_SET(m_dbusFd, &fds);
|
||||||
if (pselect(m_maxFd + 1, &fds, NULL, NULL, NULL, &origmask) < 0) {
|
if (pselect(m_maxFd + 1, &fds, nullptr, nullptr, nullptr, &origmask) < 0) {
|
||||||
/* SIGINT/SIGUSR2 handled here */
|
/* SIGINT/SIGUSR2 handled here */
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -227,7 +227,7 @@ struct XlibAtoms {
|
||||||
m_imagePng = XInternAtom(disp, "image/png", false);
|
m_imagePng = XInternAtom(disp, "image/png", false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
static XlibAtoms* S_ATOMS = NULL;
|
static XlibAtoms* S_ATOMS = nullptr;
|
||||||
|
|
||||||
static Atom GetClipboardTypeAtom(EClipboardType t) {
|
static Atom GetClipboardTypeAtom(EClipboardType t) {
|
||||||
switch (t) {
|
switch (t) {
|
||||||
|
|
Loading…
Reference in New Issue