mirror of
https://github.com/Maschell/controller_patcher.git
synced 2024-11-25 05:26:53 +01:00
Now the lib tries to mount the SD Card on each start until it actually works.
This should fix the config reading problems some people have. Also fixing some compiler warnings
This commit is contained in:
parent
7292edb8ce
commit
5a3aa0d0aa
@ -29,12 +29,6 @@ ConfigReader *ConfigReader::instance = NULL;
|
|||||||
ConfigReader::ConfigReader(){
|
ConfigReader::ConfigReader(){
|
||||||
InitOSFunctionPointers();
|
InitOSFunctionPointers();
|
||||||
InitFSFunctionPointers();
|
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(){
|
void ConfigReader::ReadAllConfigs(){
|
||||||
|
@ -66,7 +66,6 @@ class ConfigReader{
|
|||||||
//!Destructor
|
//!Destructor
|
||||||
~ConfigReader();
|
~ConfigReader();
|
||||||
|
|
||||||
|
|
||||||
int InitSDCard();
|
int InitSDCard();
|
||||||
void freeFSHandles();
|
void freeFSHandles();
|
||||||
|
|
||||||
|
@ -419,16 +419,25 @@ bool ControllerPatcher::Init(){
|
|||||||
if(HID_DEBUG) log_printf("First time calling the Init\n");
|
if(HID_DEBUG) log_printf("First time calling the Init\n");
|
||||||
gConfig_done = HID_INIT_DONE;
|
gConfig_done = HID_INIT_DONE;
|
||||||
ControllerPatcher::ResetConfig();
|
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{
|
}else{
|
||||||
if(HID_DEBUG) log_print("Config already done!\n");
|
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");
|
log_print("Initializing the data for button remapping\n");
|
||||||
InitButtonMapping();
|
InitButtonMapping();
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ int ControllerPatcherNet::recvwait(int sock, void *buffer, int len) {
|
|||||||
ret = recv(sock, buffer, len, 0);
|
ret = recv(sock, buffer, len, 0);
|
||||||
if(ret < 0) return ret;
|
if(ret < 0) return ret;
|
||||||
len -= ret;
|
len -= ret;
|
||||||
buffer += ret;
|
buffer = (void *)(((char *) buffer) + ret);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -38,7 +38,7 @@ int ControllerPatcherNet::sendwait(int sock, const void *buffer, int len) {
|
|||||||
ret = send(sock, buffer, len, 0);
|
ret = send(sock, buffer, len, 0);
|
||||||
if(ret < 0) return ret;
|
if(ret < 0) return ret;
|
||||||
len -= ret;
|
len -= ret;
|
||||||
buffer += ret;
|
buffer = (void *)(((char *) buffer) + ret);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ void UDPServer::DoUDPThreadInternal(){
|
|||||||
|
|
||||||
my_cb_user user;
|
my_cb_user user;
|
||||||
while(1){
|
while(1){
|
||||||
int usingVar = exitThread;
|
//int usingVar = exitThread;
|
||||||
if(exitThread)break;
|
if(exitThread)break;
|
||||||
memset(buffer,0,MAX_UDP_SIZE);
|
memset(buffer,0,MAX_UDP_SIZE);
|
||||||
n = recv(sockfd,buffer,MAX_UDP_SIZE,0);
|
n = recv(sockfd,buffer,MAX_UDP_SIZE,0);
|
||||||
|
Loading…
Reference in New Issue
Block a user