Implemented UI for controlling autosaving, fixed general config defaults not being applied correctly

This commit is contained in:
Mr-Wiseguy
2024-05-04 13:08:14 -04:00
parent 7034243ff6
commit 54b862599c
9 changed files with 98 additions and 23 deletions
+19 -5
View File
@@ -269,12 +269,14 @@ void recomp::open_quit_game_prompt() {
);
}
// These defaults values don't matter, as the config file handling overrides them.
struct ControlOptionsContext {
int rumble_strength = 50; // 0 to 100
int gyro_sensitivity = 50; // 0 to 100
int mouse_sensitivity = 50; // 0 to 100
recomp::TargetingMode targeting_mode = recomp::TargetingMode::Switch;
recomp::BackgroundInputMode background_input_mode = recomp::BackgroundInputMode::On;
int rumble_strength; // 0 to 100
int gyro_sensitivity; // 0 to 100
int mouse_sensitivity; // 0 to 100
recomp::TargetingMode targeting_mode;
recomp::BackgroundInputMode background_input_mode;
recomp::AutosaveMode autosave_mode;
};
ControlOptionsContext control_options_context;
@@ -340,6 +342,17 @@ void recomp::set_background_input_mode(recomp::BackgroundInputMode mode) {
);
}
recomp::AutosaveMode recomp::get_autosave_mode() {
return control_options_context.autosave_mode;
}
void recomp::set_autosave_mode(recomp::AutosaveMode mode) {
control_options_context.autosave_mode = mode;
if (general_model_handle) {
general_model_handle.DirtyVariable("autosave_mode");
}
}
struct SoundOptionsContext {
std::atomic<int> bgm_volume;
std::atomic<int> low_health_beeps_enabled; // RmlUi doesn't seem to like "true"/"false" strings for setting variants so an int is used here instead.
@@ -824,6 +837,7 @@ public:
constructor.Bind("mouse_sensitivity", &control_options_context.mouse_sensitivity);
bind_option(constructor, "targeting_mode", &control_options_context.targeting_mode);
bind_option(constructor, "background_input_mode", &control_options_context.background_input_mode);
bind_option(constructor, "autosave_mode", &control_options_context.autosave_mode);
general_model_handle = constructor.GetModelHandle();
}
+3 -3
View File
@@ -521,7 +521,7 @@ public:
if (row_byte_padding == 0) {
// Copy row-by-row if the image is flipped.
if (flip_y) {
for (uint32_t row = 0; row < source_dimensions.y; row++) {
for (int row = 0; row < source_dimensions.y; row++) {
memcpy(dst_data + row_byte_width * (source_dimensions.y - row - 1), source + row_byte_width * row, row_byte_width);
}
}
@@ -536,7 +536,7 @@ public:
uint32_t src_stride = flip_y ? -row_pitch : row_pitch;
size_t offset = 0;
for (uint32_t row = 0; row < source_dimensions.y; row++) { //(offset + increment) <= image_size_bytes) {
for (int row = 0; row < source_dimensions.y; row++) { //(offset + increment) <= image_size_bytes) {
memcpy(dst_data, src_data, row_pitch);
src_data += src_stride;
offset += row_pitch;
@@ -581,7 +581,7 @@ public:
mvp_ = projection_mtx_ * transform_;
}
void start(RT64::RenderCommandList* list, uint32_t image_width, uint32_t image_height) {
void start(RT64::RenderCommandList* list, int image_width, int image_height) {
list_ = list;
if (multisampling_.sampleCount > 1) {