diff --git a/ConfigReader.cpp b/ConfigReader.cpp index a9ada37..3b519c1 100644 --- a/ConfigReader.cpp +++ b/ConfigReader.cpp @@ -29,12 +29,6 @@ ConfigReader *ConfigReader::instance = NULL; ConfigReader::ConfigReader(){ InitOSFunctionPointers(); InitFSFunctionPointers(); - int status = 0; - if((status = InitSDCard()) == 0){ - if(HID_DEBUG) log_printf("ConfigReader::ConfigReader(): SD Card mounted for controller config!\n"); - }else{ - log_printf("ConfigReader::ConfigReader() error: SD mounting failed! %d\n",status); - } } void ConfigReader::ReadAllConfigs(){ diff --git a/ConfigReader.hpp b/ConfigReader.hpp index a94f60e..feecca4 100644 --- a/ConfigReader.hpp +++ b/ConfigReader.hpp @@ -66,7 +66,6 @@ class ConfigReader{ //!Destructor ~ConfigReader(); - int InitSDCard(); void freeFSHandles(); diff --git a/ControllerPatcher.cpp b/ControllerPatcher.cpp index f22b114..001500f 100644 --- a/ControllerPatcher.cpp +++ b/ControllerPatcher.cpp @@ -419,16 +419,25 @@ bool ControllerPatcher::Init(){ if(HID_DEBUG) log_printf("First time calling the Init\n"); gConfig_done = HID_INIT_DONE; ControllerPatcher::ResetConfig(); - log_print("Reading config files from SD Card\n"); - ConfigReader* reader = ConfigReader::getInstance(); - reader->ReadAllConfigs(); - log_print("Done with reading config files from SD Card\n"); - ConfigReader::destroyInstance(); - gConfig_done = HID_SDCARD_READ; }else{ if(HID_DEBUG) log_print("Config already done!\n"); } + if(gConfig_done != HID_SDCARD_READ){ + log_print("Reading config files from SD Card\n"); + ConfigReader* reader = ConfigReader::getInstance(); + int status = 0; + if((status = reader->InitSDCard()) == 0){ + if(HID_DEBUG) log_printf("ConfigReader::ConfigReader(): SD Card mounted for controller config!\n"); + reader->ReadAllConfigs(); + log_print("Done with reading config files from SD Card\n"); + gConfig_done = HID_SDCARD_READ; + }else{ + log_printf("ConfigReader::ConfigReader() error: SD mounting failed! %d\n",status); + } + ConfigReader::destroyInstance(); + } + log_print("Initializing the data for button remapping\n"); InitButtonMapping(); diff --git a/network/ControllerPatcherNet.cpp b/network/ControllerPatcherNet.cpp index 663c497..9fa01bd 100644 --- a/network/ControllerPatcherNet.cpp +++ b/network/ControllerPatcherNet.cpp @@ -8,7 +8,7 @@ int ControllerPatcherNet::recvwait(int sock, void *buffer, int len) { ret = recv(sock, buffer, len, 0); if(ret < 0) return ret; len -= ret; - buffer += ret; + buffer = (void *)(((char *) buffer) + ret); } return 0; } @@ -38,7 +38,7 @@ int ControllerPatcherNet::sendwait(int sock, const void *buffer, int len) { ret = send(sock, buffer, len, 0); if(ret < 0) return ret; len -= ret; - buffer += ret; + buffer = (void *)(((char *) buffer) + ret); } return 0; } diff --git a/network/UDPServer.cpp b/network/UDPServer.cpp index eeb1315..527f48e 100644 --- a/network/UDPServer.cpp +++ b/network/UDPServer.cpp @@ -88,7 +88,7 @@ void UDPServer::DoUDPThreadInternal(){ my_cb_user user; while(1){ - int usingVar = exitThread; + //int usingVar = exitThread; if(exitThread)break; memset(buffer,0,MAX_UDP_SIZE); n = recv(sockfd,buffer,MAX_UDP_SIZE,0);