-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
102 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
crates/cobalt/src/sequences/mainmenu/cobaltmenu/sequences/settings/render_scale_toggle.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
use unity::prelude::*; | ||
|
||
use engage::menu::{ | ||
config::{ConfigBasicMenuItem, ConfigBasicMenuItemSwitchMethods}, | ||
BasicMenuResult, | ||
}; | ||
|
||
pub static mut TOGGLE: bool = false; | ||
|
||
pub struct ToggleRenderScaleSetting; | ||
|
||
impl ConfigBasicMenuItemSwitchMethods for ToggleRenderScaleSetting { | ||
fn init_content(_this: &mut ConfigBasicMenuItem) { | ||
unsafe { TOGGLE = std::path::Path::new("sd:/engage/config/render_scale_enabled").exists() }; | ||
} | ||
|
||
extern "C" fn custom_call(this: &mut ConfigBasicMenuItem, _method_info: OptionalMethod) -> BasicMenuResult { | ||
let toggle = unsafe { TOGGLE }; | ||
let result = ConfigBasicMenuItem::change_key_value_b(toggle); | ||
|
||
if toggle != result { | ||
if result { | ||
std::fs::File::create("sd:/engage/config/render_scale_enabled").expect("Could not create the Render Scale Toggle configuration file"); | ||
} else { | ||
std::fs::remove_file("sd:/engage/config/render_scale_enabled").expect("Could not delete the Render Scale Toggle configuration file"); | ||
} | ||
|
||
unsafe { TOGGLE = result } | ||
|
||
Self::set_command_text(this, None); | ||
Self::set_help_text(this, None); | ||
this.update_text(); | ||
|
||
BasicMenuResult::se_cursor() | ||
} else { | ||
BasicMenuResult::new() | ||
} | ||
} | ||
|
||
extern "C" fn set_command_text(this: &mut ConfigBasicMenuItem, _method_info: OptionalMethod) { | ||
if unsafe { TOGGLE } { | ||
this.command_text = localize::mess::get("command_text_on").into(); | ||
} else { | ||
this.command_text = localize::mess::get("command_text_off").into(); | ||
} | ||
} | ||
|
||
extern "C" fn set_help_text(this: &mut ConfigBasicMenuItem, _method_info: OptionalMethod) { | ||
if unsafe { TOGGLE } { | ||
this.help_text = localize::mess::get("render_scale_toggle_enabled_helptext").into(); | ||
} else { | ||
this.help_text = localize::mess::get("render_scale_toggle_disabled_helptext").into(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters