From a988f6a27db39eac6de698a8d0ad31673c865d41 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Tue, 30 May 2023 22:06:09 -0400 Subject: core fading toggle --- bench/bench_window.cpp | 15 ++++++++++++++- bench/bench_window.hpp | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'bench') diff --git a/bench/bench_window.cpp b/bench/bench_window.cpp index 7393e9f..60d44f3 100644 --- a/bench/bench_window.cpp +++ b/bench/bench_window.cpp @@ -8,11 +8,13 @@ bench_window::bench_window() runner_stop_on_death(true), runner_stop_on_win(true), runner_hyperspeed(false), + core_fading(true), control_box(Gtk::Orientation::VERTICAL), new_round_button("new round"), single_step_button("single step"), start_button("start"), stop_button("stop"), + core_fading_toggle("core fading"), hyperspeed_toggle("hyperspeed"), pause_on_death_toggle("pause on death"), pause_on_win_toggle("pause on win"), @@ -47,6 +49,7 @@ bench_window::bench_window() update_ui(); + core_fading_toggle.activate(); pause_on_death_toggle.activate(); pause_on_win_toggle.activate(); @@ -57,6 +60,7 @@ bench_window::bench_window() add_warrior_button.signal_clicked().connect(sigc::mem_fun(*this, &bench_window::on_click_add_warrior)); remove_warrior_button.signal_clicked().connect(sigc::mem_fun(*this, &bench_window::on_click_remove_warrior)); + core_fading_toggle.signal_toggled().connect(sigc::mem_fun(*this, &bench_window::on_toggle_core_fading)); hyperspeed_toggle.signal_toggled().connect(sigc::mem_fun(*this, &bench_window::on_toggle_hyperspeed)); pause_on_death_toggle.signal_toggled().connect(sigc::mem_fun(*this, &bench_window::on_toggle_pause_on_death)); pause_on_win_toggle.signal_toggled().connect(sigc::mem_fun(*this, &bench_window::on_toggle_pause_on_win)); @@ -70,6 +74,7 @@ bench_window::bench_window() control_box.append(single_step_button); control_box.append(start_button); control_box.append(stop_button); + control_box.append(core_fading_toggle); control_box.append(hyperspeed_toggle); control_box.append(pause_on_death_toggle); control_box.append(pause_on_win_toggle); @@ -118,10 +123,14 @@ const lib94::warrior *bench_window::do_step() { const lib94::warrior *result = lib94::single_step(); core.mut.lock(); - core.age_all(); + + if (core_fading) + core.age_all(); + core.add_new_writes(lib94::get_written_addresses()); core.add_new_reads(lib94::get_read_addresses()); core.add_new_executions(lib94::get_executed_addresses()); + core.mut.unlock(); add_modified_for_instruction_view(lib94::get_written_addresses()); @@ -197,6 +206,10 @@ void bench_window::on_click_stop() { runner_stop_now = true; } +void bench_window::on_toggle_core_fading() { + core_fading = core_fading_toggle.get_active(); +} + void bench_window::on_toggle_hyperspeed() { runner_hyperspeed = hyperspeed_toggle.get_active(); } diff --git a/bench/bench_window.hpp b/bench/bench_window.hpp index bd15e4b..51e8fbe 100644 --- a/bench/bench_window.hpp +++ b/bench/bench_window.hpp @@ -17,6 +17,7 @@ public: bool runner_stop_on_death; bool runner_stop_on_win; bool runner_hyperspeed; + bool core_fading; core_widget core; @@ -71,6 +72,7 @@ private: Gtk::Button start_button; Gtk::Button stop_button; + Gtk::CheckButton core_fading_toggle; Gtk::CheckButton hyperspeed_toggle; Gtk::CheckButton pause_on_death_toggle; Gtk::CheckButton pause_on_win_toggle; @@ -94,6 +96,7 @@ private: void on_click_start(); void on_click_stop(); + void on_toggle_core_fading(); void on_toggle_hyperspeed(); void on_toggle_pause_on_death(); void on_toggle_pause_on_win(); -- cgit v1.2.3