mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-08-24 17:44:37 -05:00
Simplify poweroff behaviour
This commit is contained in:
@@ -131,9 +131,6 @@ private:
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_draw_time;
|
||||
FPSArray poll_fps;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_poll_time;
|
||||
bool triggered_poweroff;
|
||||
std::chrono::time_point<std::chrono::high_resolution_clock> last_poweroff_time;
|
||||
const float poweroff_timeout = 30.0;
|
||||
|
||||
sf::Texture in_tex;
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ WindowScreen::WindowScreen(ScreenType stype, CaptureStatus* capture_status, Disp
|
||||
FPSArrayInit(&this->in_fps);
|
||||
FPSArrayInit(&this->draw_fps);
|
||||
FPSArrayInit(&this->poll_fps);
|
||||
this->triggered_poweroff = false;
|
||||
this->in_tex.create(IN_VIDEO_WIDTH, IN_VIDEO_HEIGHT);
|
||||
this->m_in_rect_top.setTexture(&this->in_tex);
|
||||
this->m_in_rect_bot.setTexture(&this->in_tex);
|
||||
@@ -211,8 +210,6 @@ void WindowScreen::update_connection() {
|
||||
}
|
||||
|
||||
void WindowScreen::print_notification(std::string text, TextKind kind) {
|
||||
if(this->triggered_poweroff)
|
||||
return;
|
||||
this->notification->setText(text);
|
||||
this->notification->setRectangleKind(kind);
|
||||
this->notification->startTimer(true);
|
||||
|
||||
@@ -800,20 +800,11 @@ void WindowScreen::poll() {
|
||||
if(done)
|
||||
break;
|
||||
SFEvent event_data = events_queue.front();
|
||||
if(this->triggered_poweroff) {
|
||||
// Stop accepting inputs... Not needed, since we're technically powering down...
|
||||
auto curr_time = std::chrono::high_resolution_clock::now();
|
||||
const std::chrono::duration<double> diff = curr_time - this->last_poweroff_time;
|
||||
if(diff.count() < this->poweroff_timeout)
|
||||
break;
|
||||
this->triggered_poweroff = false;
|
||||
}
|
||||
events_queue.pop();
|
||||
if((event_data.type == sf::Event::KeyPressed) && event_data.poweroff_cmd) {
|
||||
this->m_prepare_save = STARTUP_FILE_INDEX;
|
||||
this->print_notification("Saving and shutting\ndown...Please wait");
|
||||
this->triggered_poweroff = true;
|
||||
this->last_poweroff_time = std::chrono::high_resolution_clock::now();
|
||||
break;
|
||||
this->m_prepare_quit = true;
|
||||
done = true;
|
||||
continue;
|
||||
}
|
||||
if(this->query_reset_request()) {
|
||||
this->reset_held_times();
|
||||
@@ -821,7 +812,6 @@ void WindowScreen::poll() {
|
||||
done = true;
|
||||
continue;
|
||||
}
|
||||
events_queue.pop();
|
||||
if(this->common_poll(event_data)) {
|
||||
if(this->close_capture())
|
||||
done = true;
|
||||
|
||||
@@ -183,7 +183,7 @@ void reset_screen_info(ScreenInfo &info) {
|
||||
info.bot_rotation = 0;
|
||||
info.show_mouse = true;
|
||||
info.v_sync_enabled = false;
|
||||
info.async = false;
|
||||
info.async = true;
|
||||
info.top_scaling = -1;
|
||||
info.bot_scaling = -1;
|
||||
info.bfi = false;
|
||||
|
||||
Reference in New Issue
Block a user