mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp
synced 2026-05-23 23:05:46 -04:00
Add special config option id to control texture pack state for code mods
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "ui_mod_menu.h"
|
||||
#include "recomp_ui.h"
|
||||
#include "zelda_support.h"
|
||||
#include "zelda_render.h"
|
||||
|
||||
#include "librecomp/mods.hpp"
|
||||
|
||||
@@ -384,6 +385,22 @@ ContextId get_config_sub_menu_context_id() {
|
||||
return sub_menu_context;
|
||||
}
|
||||
|
||||
bool ModMenu::handle_special_config_options(const recomp::mods::ConfigOption& option, const recomp::mods::ConfigValueVariant& config_value) {
|
||||
if (zelda64::renderer::is_texture_pack_enable_config_option(option, true)) {
|
||||
const recomp::mods::ConfigOptionEnum &option_enum = std::get<recomp::mods::ConfigOptionEnum>(option.variant);
|
||||
|
||||
config_sub_menu->add_radio_option(option.id, option.name, option.description, std::get<uint32_t>(config_value), option_enum.options,
|
||||
[this](const std::string &id, uint32_t value) {
|
||||
mod_enum_option_changed(id, value);
|
||||
mod_hd_textures_enabled_changed(value);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ModMenu::mod_configure_requested() {
|
||||
if (active_mod_index >= 0) {
|
||||
// Record the context that was open when this function was called and close it.
|
||||
@@ -401,6 +418,10 @@ void ModMenu::mod_configure_requested() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (handle_special_config_options(option, config_value)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (option.type) {
|
||||
case recomp::mods::ConfigOptionType::Enum: {
|
||||
const recomp::mods::ConfigOptionEnum &option_enum = std::get<recomp::mods::ConfigOptionEnum>(option.variant);
|
||||
@@ -455,6 +476,17 @@ void ModMenu::mod_number_option_changed(const std::string &id, double value) {
|
||||
}
|
||||
}
|
||||
|
||||
void ModMenu::mod_hd_textures_enabled_changed(uint32_t value) {
|
||||
if (active_mod_index >= 0) {
|
||||
if (value) {
|
||||
zelda64::renderer::secondary_enable_texture_pack(mod_details[active_mod_index].mod_id);
|
||||
}
|
||||
else {
|
||||
zelda64::renderer::secondary_disable_texture_pack(mod_details[active_mod_index].mod_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModMenu::create_mod_list() {
|
||||
ContextId context = get_current_context();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user