Using defines for the sd card paths, added a "MusicActivated" option to the settings

This commit is contained in:
Maschell 2017-05-07 14:54:15 +02:00
parent f749160fd4
commit fbb584be6a
4 changed files with 16 additions and 6 deletions

View File

@ -226,7 +226,7 @@ void Application::executeThread(void){
void Application::loadLanguageFromConfig(){
if(!CSettings::getValueAsString(CSettings::AppLanguage).empty()){
std::string languagePath = "sd:/wiiu/apps/hidtovpad/languages/" + CSettings::getValueAsString(CSettings::AppLanguage) + ".lang";
std::string languagePath = std::string(DEFAULT_LANG_PATH) + "/" + CSettings::getValueAsString(CSettings::AppLanguage) + std::string(LANGUAGE_FILE_EXT);
gettextLoadLanguage(languagePath.c_str());
}
}

View File

@ -51,6 +51,10 @@ extern "C" {
#define EXIT_HBL_EXIT 0xFFFFFFFE
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD
#define DEFAULT_HID_TO_VPAD_PATH SD_PATH WIIU_PATH "/apps/hidtovpad"
#define DEFAULT_LANG_PATH DEFAULT_HID_TO_VPAD_PATH "/languages"
#define LANGUAGE_FILE_EXT ".lang"
#ifdef __cplusplus
}
#endif

View File

@ -27,7 +27,8 @@
#include "language/gettext.h"
#define VERSION_LINE "# HID to VPAD - Main settings file v"
#define VALID_VERSION 1
#define VALID_VERSION 2
#define CONFIG_FILENAME "/hidtovpad.cfg"
CSettings *CSettings::settingsInstance = NULL;
@ -36,7 +37,7 @@ CSettings::CSettings(){
memset(&nullValue, 0, sizeof(nullValue));
nullValue.strValue = new std::string();
configPath = SD_PATH WIIU_PATH "/apps/hidtovpad";
configPath = DEFAULT_HID_TO_VPAD_PATH;
this->SetDefault();
}
@ -65,8 +66,12 @@ void CSettings::SetDefault()
settingsValues[AppLanguage].strValue = new std::string();
settingsNames[RumbleActivated] = "RumbleActivated";
settingsValues[RumbleActivated].dataType = TypeU8;
settingsValues[RumbleActivated].dataType = TypeBool;
settingsValues[RumbleActivated].ucValue = SETTING_ON;
settingsNames[MusicActivated] = "MusicActivated";
settingsValues[MusicActivated].dataType = TypeBool;
settingsValues[MusicActivated].ucValue = SETTING_ON;
}
bool CSettings::Load(){
@ -74,7 +79,7 @@ bool CSettings::Load(){
SetDefault();
std::string filepath = configPath;
filepath += "/hidtovpad.cfg";
filepath += CONFIG_FILENAME;
CFile file(filepath, CFile::ReadOnly);
if (!file.isOpen())
@ -191,7 +196,7 @@ bool CSettings::Save(){
CreateSubfolder(configPath.c_str());
std::string filepath = configPath;
filepath += "/hidtovpad.cfg";
filepath += CONFIG_FILENAME;
CFile file(filepath, CFile::WriteOnly);
if (!file.isOpen())

View File

@ -69,6 +69,7 @@ public:
INVALID = -1,
AppLanguage,
RumbleActivated,
MusicActivated,
MAX_VALUE
};