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(){ void Application::loadLanguageFromConfig(){
if(!CSettings::getValueAsString(CSettings::AppLanguage).empty()){ 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()); gettextLoadLanguage(languagePath.c_str());
} }
} }

View File

@ -51,6 +51,10 @@ extern "C" {
#define EXIT_HBL_EXIT 0xFFFFFFFE #define EXIT_HBL_EXIT 0xFFFFFFFE
#define EXIT_RELAUNCH_ON_LOAD 0xFFFFFFFD #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 #ifdef __cplusplus
} }
#endif #endif

View File

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

View File

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