Skip to content

Commit

Permalink
Signal to the frontend that the config was saved
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Sep 7, 2023
1 parent 0d76183 commit 8ee4b84
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Framework.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,9 @@ void Framework::on_frontend_command(UEVRSharedMemory::Command command) {
m_mods->reload_config();
});

break;
case UEVRSharedMemory::Command::CONFIG_SETUP_ACKNOWLEDGED:
m_uevr_shared_memory->data().signal_frontend_config_setup = false;
break;
default:
spdlog::error("Unknown frontend command received: {}", (int)command);
Expand Down Expand Up @@ -947,6 +950,11 @@ void Framework::save_config() {
}

spdlog::info("Saved config");

if (auto& sm = g_framework->get_shared_memory(); sm) {
sm->data().signal_frontend_config_setup = true;
spdlog::info("Signaled frontend config setup");
}
}

void Framework::reset_config() try {
Expand Down
6 changes: 6 additions & 0 deletions src/Framework.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UEVRSharedMemory {

enum Command {
RELOAD_CONFIG = 0,
CONFIG_SETUP_ACKNOWLEDGED = 1,
};

public:
Expand All @@ -43,6 +44,7 @@ class UEVRSharedMemory {
uint32_t pid{}; // Process ID of the game
uint32_t main_thread_id{}; // Main thread ID of the game
uint32_t command_thread_id{}; // Thread ID commands are sent to (via PostThreadMessage)
bool signal_frontend_config_setup{false};
};
#pragma pack(pop)

Expand Down Expand Up @@ -174,6 +176,10 @@ class Framework {
return m_frame_worker;
}

auto& get_shared_memory() {
return m_uevr_shared_memory;
}

private:
void consume_input();
void update_fonts();
Expand Down

0 comments on commit 8ee4b84

Please sign in to comment.