mirror of https://github.com/sm64pc/sm64pc.git
Save CC to configfile
This commit is contained in:
parent
e79cc1ea49
commit
8584303d4e
|
@ -170,6 +170,8 @@ namespace MoonInternal {
|
|||
static ImVec4 uiHairColor = ImVec4(115.0f / 255.0f, 6.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
|
||||
static ImVec4 uiHairShadeColor = ImVec4(57.0f / 255.0f, 3.0f / 255.0f, 0.0f / 255.0f, 255.0f / 255.0f);
|
||||
|
||||
string cc_name;
|
||||
static char cc_gameshark[1024 * 16] = "";
|
||||
static char bufname[128] = "Sample";
|
||||
|
||||
bool hasChangedFullscreen;
|
||||
|
@ -252,6 +254,31 @@ namespace MoonInternal {
|
|||
defaultColorHairBDark = (int)(uiHairShadeColor.z * 255);
|
||||
}
|
||||
|
||||
void apply_editor_from_cc() {
|
||||
uiHatColor = ImVec4(float(defaultColorHatRLight) / 255.0f, float(defaultColorHatGLight) / 255.0f, float(defaultColorHatBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiHatShadeColor = ImVec4(float(defaultColorHatRDark) / 255.0f, float(defaultColorHatGDark) / 255.0f, float(defaultColorHatBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiOverallsColor = ImVec4(float(defaultColorOverallsRLight) / 255.0f, float(defaultColorOverallsGLight) / 255.0f, float(defaultColorOverallsBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiOverallsShadeColor = ImVec4(float(defaultColorOverallsRDark) / 255.0f, float(defaultColorOverallsGDark) / 255.0f, float(defaultColorOverallsBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiGlovesColor = ImVec4(float(defaultColorGlovesRLight) / 255.0f, float(defaultColorGlovesGLight) / 255.0f, float(defaultColorGlovesBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiGlovesShadeColor = ImVec4(float(defaultColorGlovesRDark) / 255.0f, float(defaultColorGlovesGDark) / 255.0f, float(defaultColorGlovesBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiShoesColor = ImVec4(float(defaultColorShoesRLight) / 255.0f, float(defaultColorShoesGLight) / 255.0f, float(defaultColorShoesBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiShoesShadeColor = ImVec4(float(defaultColorShoesRDark) / 255.0f, float(defaultColorShoesGDark) / 255.0f, float(defaultColorShoesBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiSkinColor = ImVec4(float(defaultColorSkinRLight) / 255.0f, float(defaultColorSkinGLight) / 255.0f, float(defaultColorSkinBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiSkinShadeColor = ImVec4(float(defaultColorSkinRDark) / 255.0f, float(defaultColorSkinGDark) / 255.0f, float(defaultColorSkinBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiHairColor = ImVec4(float(defaultColorHairRLight) / 255.0f, float(defaultColorHairGLight) / 255.0f, float(defaultColorHairBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiHairShadeColor = ImVec4(float(defaultColorHairRDark) / 255.0f, float(defaultColorHairGDark) / 255.0f, float(defaultColorHairBDark) / 255.0f, 255.0f / 255.0f);
|
||||
|
||||
cc_name = MoonInternal::cc_array[configColorCode].substr(0, MoonInternal::cc_array[configColorCode].size() - 3);
|
||||
strcpy(cc_gameshark, global_color_to_cc().c_str());
|
||||
|
||||
// We never want to use the name "Mario" when saving/loading a CC, as it will cause file issues.
|
||||
if (cc_name == "Mario") {
|
||||
strcpy(bufname, "Sample");
|
||||
} else {
|
||||
strcpy(bufname, cc_name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void setupImGuiModule(string status) {
|
||||
MoonInternal::setupWindowHook(status);
|
||||
if(status == "PreStartup"){
|
||||
|
@ -285,7 +312,6 @@ namespace MoonInternal {
|
|||
MoonNX::handleVirtualKeyboard("Init");
|
||||
#endif
|
||||
|
||||
static char cc_gameshark[1024 * 16] = "";
|
||||
apply_cc_from_editor();
|
||||
strcpy(cc_gameshark, global_color_to_cc().c_str());
|
||||
}});
|
||||
|
@ -472,7 +498,7 @@ namespace MoonInternal {
|
|||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
static char cc_gameshark[1024 * 16] = "";
|
||||
//static char cc_gameshark[1024 * 16] = "";
|
||||
|
||||
if (configImGui.s_machinima && show_menu_bar) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0));
|
||||
|
@ -486,16 +512,16 @@ namespace MoonInternal {
|
|||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
||||
ImGui::Text("Select Color Code");
|
||||
static int current_cc_id = 0;
|
||||
string cc_name = MoonInternal::cc_array[current_cc_id].substr(0, MoonInternal::cc_array[current_cc_id].size() - 3);
|
||||
//static int current_cc_id = 0;
|
||||
cc_name = MoonInternal::cc_array[configColorCode].substr(0, MoonInternal::cc_array[configColorCode].size() - 3);
|
||||
if (ImGui::BeginCombo(".gs", cc_name.c_str()))
|
||||
{
|
||||
for (int n = 0; n < MoonInternal::cc_array.size(); n++)
|
||||
{
|
||||
const bool is_selected = (current_cc_id == n);
|
||||
const bool is_selected = (configColorCode == n);
|
||||
cc_name = MoonInternal::cc_array[n].substr(0, MoonInternal::cc_array[n].size() - 3);
|
||||
if (ImGui::Selectable(cc_name.c_str(), is_selected)) {
|
||||
current_cc_id = n;
|
||||
configColorCode = n;
|
||||
}
|
||||
|
||||
// Set the initial focus when opening the combo (scrolling + keyboard navigation focus)
|
||||
|
@ -505,29 +531,8 @@ namespace MoonInternal {
|
|||
ImGui::EndCombo();
|
||||
}
|
||||
if (ImGui::Button("Load CC")) {
|
||||
load_cc_file(cc_array[current_cc_id]);
|
||||
|
||||
uiHatColor = ImVec4(float(defaultColorHatRLight) / 255.0f, float(defaultColorHatGLight) / 255.0f, float(defaultColorHatBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiHatShadeColor = ImVec4(float(defaultColorHatRDark) / 255.0f, float(defaultColorHatGDark) / 255.0f, float(defaultColorHatBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiOverallsColor = ImVec4(float(defaultColorOverallsRLight) / 255.0f, float(defaultColorOverallsGLight) / 255.0f, float(defaultColorOverallsBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiOverallsShadeColor = ImVec4(float(defaultColorOverallsRDark) / 255.0f, float(defaultColorOverallsGDark) / 255.0f, float(defaultColorOverallsBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiGlovesColor = ImVec4(float(defaultColorGlovesRLight) / 255.0f, float(defaultColorGlovesGLight) / 255.0f, float(defaultColorGlovesBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiGlovesShadeColor = ImVec4(float(defaultColorGlovesRDark) / 255.0f, float(defaultColorGlovesGDark) / 255.0f, float(defaultColorGlovesBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiShoesColor = ImVec4(float(defaultColorShoesRLight) / 255.0f, float(defaultColorShoesGLight) / 255.0f, float(defaultColorShoesBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiShoesShadeColor = ImVec4(float(defaultColorShoesRDark) / 255.0f, float(defaultColorShoesGDark) / 255.0f, float(defaultColorShoesBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiSkinColor = ImVec4(float(defaultColorSkinRLight) / 255.0f, float(defaultColorSkinGLight) / 255.0f, float(defaultColorSkinBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiSkinShadeColor = ImVec4(float(defaultColorSkinRDark) / 255.0f, float(defaultColorSkinGDark) / 255.0f, float(defaultColorSkinBDark) / 255.0f, 255.0f / 255.0f);
|
||||
uiHairColor = ImVec4(float(defaultColorHairRLight) / 255.0f, float(defaultColorHairGLight) / 255.0f, float(defaultColorHairBLight) / 255.0f, 255.0f / 255.0f);
|
||||
uiHairShadeColor = ImVec4(float(defaultColorHairRDark) / 255.0f, float(defaultColorHairGDark) / 255.0f, float(defaultColorHairBDark) / 255.0f, 255.0f / 255.0f);
|
||||
|
||||
// We never want to use the name "Mario" when saving/loading a CC, as it will cause file issues.
|
||||
if (cc_name == "Mario") {
|
||||
strcpy(bufname, "Sample");
|
||||
} else {
|
||||
strcpy(bufname, cc_name.c_str());
|
||||
}
|
||||
|
||||
strcpy(cc_gameshark, global_color_to_cc().c_str());
|
||||
load_cc_file(cc_array[configColorCode]);
|
||||
apply_editor_from_cc();
|
||||
}
|
||||
|
||||
ImGui::Dummy(ImVec2(0, 10));
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
namespace MoonInternal {
|
||||
void setupImGuiModule(std::string status);
|
||||
void apply_editor_from_cc(void);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -5,6 +5,7 @@
|
|||
#include "moon/fs/moonfs.h"
|
||||
#include "moon/ui/screens/addons/addons-view.h"
|
||||
#include "moon/mod-engine/engine.h"
|
||||
#include "moon/imgui/imgui_impl.h"
|
||||
#include "pc/configfile.h"
|
||||
#include "pc/controller/controller_keyboard.h"
|
||||
|
||||
|
@ -72,6 +73,8 @@ namespace MoonInternal {
|
|||
enable_yoshi = false;
|
||||
|
||||
MoonInternal::load_cc_directory();
|
||||
MoonInternal::load_cc_file(cc_array[configColorCode]);
|
||||
apply_editor_from_cc();
|
||||
|
||||
// custom textures
|
||||
current_eye_state = 0;
|
||||
|
@ -82,10 +85,12 @@ namespace MoonInternal {
|
|||
saturn_load_emblem_array();
|
||||
custom_emblem_name = "saturn/blank";
|
||||
saturn_emblem_swap();
|
||||
|
||||
saturn_load_stache_array();
|
||||
saturn_load_button_array();
|
||||
saturn_load_sideburn_array();
|
||||
|
||||
// addons
|
||||
if(texturePackList.empty()){
|
||||
texturePackList.clear();
|
||||
copy(Moon::addons.begin(), Moon::addons.end(), back_inserter(texturePackList));
|
||||
|
|
|
@ -73,6 +73,8 @@ bool configPrecacheRes = false;
|
|||
bool configPrecacheRes = true;
|
||||
#endif
|
||||
|
||||
unsigned int configColorCode = 0;
|
||||
|
||||
unsigned int configFiltering = 1; // 0=force nearest, 1=linear, (TODO) 2=three-point
|
||||
unsigned int configMasterVolume = MAX_VOLUME; // 0 - MAX_VOLUME
|
||||
unsigned int configMusicVolume = 0;
|
||||
|
@ -125,18 +127,21 @@ bool configDiscordRPC = true;
|
|||
unsigned int configLODMode = 2;
|
||||
|
||||
static const struct ConfigOption options[] = {
|
||||
{.name = "color_code", .type = CONFIG_TYPE_UINT, .uintValue = &configColorCode},
|
||||
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
|
||||
{.name = "window_x", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.x},
|
||||
{.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y},
|
||||
{.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w},
|
||||
{.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h},
|
||||
{.name = "internal_w", .type = CONFIG_TYPE_FLOAT, .uintValue = &configWindow.internal_w},
|
||||
{.name = "internal_h", .type = CONFIG_TYPE_FLOAT, .uintValue = &configWindow.internal_h},
|
||||
//{.name = "internal_w", .type = CONFIG_TYPE_FLOAT, .uintValue = &configWindow.internal_w},
|
||||
//{.name = "internal_h", .type = CONFIG_TYPE_FLOAT, .uintValue = &configWindow.internal_h},
|
||||
{.name = "multiplier", .type = CONFIG_TYPE_FLOAT, .uintValue = &configWindow.multiplier},
|
||||
{.name = "aa_level", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.antialias_level},
|
||||
{.name = "aa_enabled", .type = CONFIG_TYPE_BOOL, .uintValue = &configWindow.enable_antialias},
|
||||
//{.name = "aa_level", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.antialias_level},
|
||||
//{.name = "aa_enabled", .type = CONFIG_TYPE_BOOL, .uintValue = &configWindow.enable_antialias},
|
||||
{.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync},
|
||||
{.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering},
|
||||
{.name = "jaboMode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.jaboMode},
|
||||
{.name = "lodMode", .type = CONFIG_TYPE_UINT, .uintValue = &configLODMode},
|
||||
{.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume},
|
||||
{.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume},
|
||||
{.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume},
|
||||
|
@ -158,8 +163,6 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "key_stickright", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStickRight},
|
||||
{.name = "stick_deadzone", .type = CONFIG_TYPE_UINT, .uintValue = &configStickDeadzone},
|
||||
{.name = "rumble_strength", .type = CONFIG_TYPE_UINT, .uintValue = &configRumbleStrength},
|
||||
{.name = "precache", .type = CONFIG_TYPE_BOOL, .boolValue = &configPrecacheRes},
|
||||
{.name = "language", .type = CONFIG_TYPE_UINT, .boolValue = &configLanguage},
|
||||
#ifdef TARGET_SWITCH
|
||||
{.name = "nx_hud", .type = CONFIG_TYPE_BOOL, .boolValue = &configSwitchHud},
|
||||
#endif
|
||||
|
@ -176,18 +179,18 @@ static const struct ConfigOption options[] = {
|
|||
{.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade},
|
||||
#endif
|
||||
{.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro},
|
||||
{.name = "precache", .type = CONFIG_TYPE_BOOL, .boolValue = &configPrecacheRes},
|
||||
{.name = "language", .type = CONFIG_TYPE_UINT, .boolValue = &configLanguage},
|
||||
#ifdef DISCORDRPC
|
||||
{.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC},
|
||||
#endif
|
||||
{.name = "lodMode", .type = CONFIG_TYPE_UINT, .uintValue = &configLODMode},
|
||||
|
||||
{.name = "s_stats_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_stats},
|
||||
{.name = "texture_debug_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.texture_debug},
|
||||
//{.name = "texture_debug_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.texture_debug},
|
||||
{.name = "s_toggles_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_toggles},
|
||||
{.name = "s_machinima", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_machinima},
|
||||
{.name = "s_appearance_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_appearance},
|
||||
{.name = "s_options_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_options},
|
||||
{.name = "jaboMode", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.jaboMode}
|
||||
{.name = "s_options_win", .type = CONFIG_TYPE_BOOL, .boolValue = &configImGui.s_options}
|
||||
};
|
||||
|
||||
// Reads an entire line from a file (excluding the newline character) and returns an allocated string
|
||||
|
|
|
@ -37,6 +37,7 @@ extern unsigned int configLanguage;
|
|||
#ifdef TARGET_SWITCH
|
||||
extern bool configSwitchHud;
|
||||
#endif
|
||||
extern unsigned int configColorCode;
|
||||
extern unsigned int configFiltering;
|
||||
extern unsigned int configMasterVolume;
|
||||
extern unsigned int configMusicVolume;
|
||||
|
|
Loading…
Reference in New Issue