XorTroll / Goldleaf

🍂 Multipurpose homebrew tool for Nintendo Switch
GNU General Public License v3.0
2.58k stars 350 forks source link

Bug in color if color setting is adding manualy #712

Open Manu68350 opened 4 days ago

Manu68350 commented 4 days ago

in the files cfg_Settings.cpp any line is missing, if you define background manualy... The load is not a problem only save make problem. when you chnage setting. the backrounf color is deleted

See my src mod for make it work (I canot compile myself, If you can remake a version for this bug.

the missing line in save procedure : json["ui"]["background"] = ColorToHex(this->custom_scheme.bg); // Need this line if Manual setting of Background Color....

this is the Corrected good parts :

   void Settings::Save() {
        auto json = JSON::object();

        if(this->has_custom_lang) {
            json["general"]["customLanguage"] = GetLanguageCode(this->custom_lang);
        }
        if(this->has_external_romfs) {
            json["general"]["externalRomFs"] = this->external_romfs;
        }
        json["general"]["use12hTime"] = this->use_12h_time;
        json["general"]["ignoreHiddenFiles"] = this->ignore_hidden_files;

        if(this->has_custom_scheme) {

        json["ui"]["background"] = ColorToHex(this->custom_scheme.bg);      // Need this line if Manual setting of Color.... 

            json["ui"]["base"] = ColorToHex(this->custom_scheme.base);
            json["ui"]["baseFocus"] = ColorToHex(this->custom_scheme.base_focus);
            json["ui"]["text"] = ColorToHex(this->custom_scheme.text);
        }
        json["ui"]["menuItemSize"] = this->menu_item_size;
        if(this->has_scrollbar_color) {
            json["ui"]["scrollBar"] = ColorToHex(this->scrollbar_color);
        }
        if(this->has_progressbar_color) {
            json["ui"]["progressBar"] = ColorToHex(this->progressbar_color);
        }

        json["installs"]["ignoreRequiredFwVersion"] = this->ignore_required_fw_ver;
        json["installs"]["showDeletionPromptAfterInstall"] = this->show_deletion_prompt_after_install;
        json["installs"]["copyBufferMaxSize"] = this->copy_buffer_max_size;

        json["export"]["decryptBufferMaxSize"] = this->decrypt_buffer_max_size;

        for(u32 i = 0; i < this->bookmarks.size(); i++) {
            const auto &bmk = this->bookmarks[i];
            json["web"]["bookmarks"][i]["name"] = bmk.name;
            json["web"]["bookmarks"][i]["url"] = bmk.url;
        }

        auto sd_exp = fs::GetSdCardExplorer();
        sd_exp->DeleteFile(GLEAF_PATH_SETTINGS_FILE);
        sd_exp->WriteJSON(GLEAF_PATH_SETTINGS_FILE, json);
    }
Manu68350 commented 4 days ago

Ps: I not have necesary program for make the compialtion myself.... Can you , or another peaple remake the Nro , please ?

Thanks a lot...