Changing the server-thread-priority if a game has problem with it.

Added retain variables for the callback workarround
This commit is contained in:
Maschell 2017-04-13 10:14:41 +02:00
parent bb6964cd6f
commit c46fcaff88
5 changed files with 39 additions and 4 deletions

View File

@ -78,6 +78,10 @@ void ControllerPatcher::ResetConfig(){
memset(gNetworkController,0,sizeof(gNetworkController)); // Init / Invalid everything
memset(gHID_Devices,0,sizeof(gHID_Devices)); // Init / Invalid everything
memset(gConnectCallback,0,sizeof(gConnectCallback));
memset(gExtensionCallback,0,sizeof(gExtensionCallback));
gCallbackCooldown = 0;
gHID_Mouse_Mode = HID_MOUSE_MODE_AIM;
gHID_LIST_GC = 0;
gHID_LIST_DS3 = 0;
@ -474,6 +478,10 @@ void ControllerPatcher::DeInit(){
memset(config_controller_hidmask,0,sizeof(config_controller_hidmask));
memset(gNetworkController,0,sizeof(gNetworkController));
memset(gConnectCallback,0,sizeof(gConnectCallback));
memset(gExtensionCallback,0,sizeof(gExtensionCallback));
gCallbackCooldown = 0;
gConfig_done = HID_INIT_NOT_DONE;
gButtonRemappingConfigDone = 0;
gHIDAttached = 0;

View File

@ -61,7 +61,16 @@ void TCPServer::CloseSockets(){
}
void TCPServer::StartTCPThread(TCPServer * server){
TCPServer::pThread = ControllerPatcherThread::create(TCPServer::DoTCPThread, (void*)server, ControllerPatcherThread::eAttributeAffCore2,28);
s32 priority = 28;
if(OSGetTitleID() == 0x00050000101c9300 || //The Legend of Zelda Breath of the Wild JPN
OSGetTitleID() == 0x00050000101c9400 || //The Legend of Zelda Breath of the Wild USA
OSGetTitleID() == 0x00050000101c9500 || //The Legend of Zelda Breath of the Wild EUR
OSGetTitleID() == 0x00050000101c9b00 || //The Binding of Isaac: Rebirth EUR
OSGetTitleID() == 0x00050000101a3c00){ //The Binding of Isaac: Rebirth USA
priority = 10;
log_printf("TCPServer::StartTCPThread(line %d): This game needs higher thread priority. We set it to %d\n",__LINE__,priority);
}
TCPServer::pThread = ControllerPatcherThread::create(TCPServer::DoTCPThread, (void*)server, ControllerPatcherThread::eAttributeAffCore2,priority);
TCPServer::pThread->resumeThread();
}

View File

@ -62,7 +62,16 @@ UDPServer::~UDPServer(){
}
void UDPServer::StartUDPThread(UDPServer * server){
UDPServer::pThread = ControllerPatcherThread::create(UDPServer::DoUDPThread, (void*)server, ControllerPatcherThread::eAttributeAffCore2,17);
s32 priority = 28;
if(OSGetTitleID() == 0x00050000101c9300 || //The Legend of Zelda Breath of the Wild JPN
OSGetTitleID() == 0x00050000101c9400 || //The Legend of Zelda Breath of the Wild USA
OSGetTitleID() == 0x00050000101c9500 || //The Legend of Zelda Breath of the Wild EUR
OSGetTitleID() == 0x00050000101c9b00 || //The Binding of Isaac: Rebirth EUR
OSGetTitleID() == 0x00050000101a3c00){ //The Binding of Isaac: Rebirth USA
priority = 10;
log_printf("UDPServer::StartUDPThread(line %d): This game needs higher thread priority. We set it to %d\n",__LINE__,priority);
}
UDPServer::pThread = ControllerPatcherThread::create(UDPServer::DoUDPThread, (void*)server, ControllerPatcherThread::eAttributeAffCore2,priority);
UDPServer::pThread->resumeThread();
}
@ -127,9 +136,8 @@ void UDPServer::DoUDPThreadInternal(){
continue;
}
//log_printf("UDPServer::DoUDPThreadInternal(): Got handle: %d slot %04X hid %04X pad %02X datasize %02X\n",handle,deviceSlot,hid,padslot,datasize);
if(!cpyIncrementBufferOffset((void *)databuffer, (void *)buffer,&bufferoffset,datasize, n))continue;
//log_printf("UDPServer::DoUDPThreadInternal(): Got handle: %d slot %04X hid %04X pad %02X datasize %02X\n",handle,deviceSlot,hid,padslot,datasize);
user.pad_slot = padslot;
user.slotdata.deviceslot = deviceSlot;

View File

@ -56,3 +56,7 @@ u8 gOriginalAPDState __attribute__((section(".data"))) = 0;
u16 gNetworkController[gHIDMaxDevices][HID_MAX_PADS_COUNT][4] __attribute__((section(".data")));
s32 gHIDNetworkClientID __attribute__((section(".data"))) = 0;
u8 gUsedProtocolVersion __attribute__((section(".data"))) = WIIU_CP_TCP_HANDSHAKE;
wpad_connect_callback_t gConnectCallback[4] __attribute__((section(".data")));
wpad_extension_callback_t gExtensionCallback[4] __attribute__((section(".data")));
u8 gCallbackCooldown __attribute__((section(".data"))) = 0;

View File

@ -18,6 +18,7 @@
#define CP_RETAINS_VARS_H_
#include "dynamic_libs/syshid_functions.h"
#include "dynamic_libs/padscore_functions.h"
#include "../patcher/ControllerPatcherDefs.h"
extern ControllerMapping gControllerMapping;
@ -58,4 +59,9 @@ extern s32 gHIDNetworkClientID;
extern u8 gUsedProtocolVersion;
extern wpad_connect_callback_t gConnectCallback[4];
extern wpad_extension_callback_t gExtensionCallback[4];
extern u8 gCallbackCooldown;
#endif // CP_RETAINS_VARS_H_