Confirm application exits in German and English (by Codex)
Route window-close events, animation polls, Escape and desktop exit through a native confirmation with Cancel selected by default. Preserve the current owner when cancelled. Refs #11.
This commit is contained in:
1 parent
17ac426039
commit
dcfb724ebe
7 files changed
+206
-50
No files matched your search
+59
-50
@@ -25,6 +25,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "app/controller.hpp"
|
||||
#include "app/quit_confirmation.hpp"
|
||||
#include "launch/archive.hpp"
|
||||
#include "launch/file_dialog.hpp"
|
||||
#include "launch/game_data.hpp"
|
||||
@@ -219,6 +220,8 @@ int main(int argc, char** argv) {
|
||||
ui::SportschauTeamInfo sportschau_team_info(data);
|
||||
ui::CompetitionWinnerScreen competition_winner(data);
|
||||
const auto season_exe = load_le(ui::asset_path(data, "BMH.exe"));
|
||||
english_game = english_game || season_exe.u8(layout::LeagueSizes) == 20;
|
||||
app::QuitConfirmation quit_confirmation(window, english_game);
|
||||
try {
|
||||
if (!playback.initialize_original(app::original_audio_assets(data, season_exe), audio_error))
|
||||
std::fprintf(stderr, "audio: %s\n", audio_error.c_str());
|
||||
@@ -358,7 +361,7 @@ int main(int argc, char** argv) {
|
||||
if (screen.close_requested()) return renewed_expired_player ? 1 : 0;
|
||||
SDL_Event event;
|
||||
bool changed = false;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
running = false;
|
||||
staged = before;
|
||||
@@ -460,7 +463,7 @@ int main(int argc, char** argv) {
|
||||
SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP);
|
||||
while (running) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) return;
|
||||
@@ -474,7 +477,7 @@ int main(int argc, char** argv) {
|
||||
SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP);
|
||||
while (running) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) return;
|
||||
@@ -487,7 +490,7 @@ int main(int argc, char** argv) {
|
||||
SDL_Delay(20); // Source timer unit used by the traced intro path.
|
||||
SDL_PumpEvents();
|
||||
SDL_Event close;
|
||||
while (SDL_PeepEvents(&close, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0)
|
||||
while (quit_confirmation.peep(&close, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0)
|
||||
running = false; // platform close is the only intro-loop escape
|
||||
}
|
||||
};
|
||||
@@ -501,7 +504,7 @@ int main(int argc, char** argv) {
|
||||
while (running && SDL_GetPerformanceCounter() - started < ticks_per_wait) {
|
||||
SDL_PumpEvents();
|
||||
SDL_Event close;
|
||||
while (SDL_PeepEvents(&close, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0)
|
||||
while (quit_confirmation.peep(&close, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0)
|
||||
running = false; // platform close is the only animation-loop escape
|
||||
if (running) SDL_Delay(1);
|
||||
}
|
||||
@@ -551,7 +554,7 @@ int main(int argc, char** argv) {
|
||||
bool skipped = false;
|
||||
while (running && !skipped && SDL_GetTicks() - start < duration) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) running = false;
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN && input.button.button == SDL_BUTTON_LEFT)
|
||||
skipped = true;
|
||||
@@ -574,14 +577,14 @@ int main(int argc, char** argv) {
|
||||
bool skip = false;
|
||||
SDL_Event input;
|
||||
if (step.minute_wait) {
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) running = false;
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN && input.button.button == SDL_BUTTON_LEFT)
|
||||
skip = true;
|
||||
}
|
||||
} else {
|
||||
SDL_PumpEvents();
|
||||
while (SDL_PeepEvents(&input, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) running = false;
|
||||
while (quit_confirmation.peep(&input, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) running = false;
|
||||
}
|
||||
if (!running) return true;
|
||||
const std::string title = "OpenBMH - sportschau_replay_" + std::to_string(fixture.group) +
|
||||
@@ -696,7 +699,7 @@ int main(int argc, char** argv) {
|
||||
auto pressed = ui::GameEndTaxDialog::Button::none;
|
||||
while (running) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return false; }
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN) {
|
||||
if (event.kind != SeasonTaxEventKind::question &&
|
||||
@@ -735,7 +738,7 @@ int main(int argc, char** argv) {
|
||||
const auto started = SDL_GetTicks();
|
||||
while (running && Uint32(SDL_GetTicks() - started) < animation.wait_milliseconds()) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) if (input.type == SDL_QUIT) running = false;
|
||||
while (quit_confirmation.poll(&input)) if (input.type == SDL_QUIT) running = false;
|
||||
// Source param4=0: clicks/keys cannot change this script or RNG.
|
||||
SDL_Delay(10);
|
||||
}
|
||||
@@ -752,7 +755,7 @@ int main(int argc, char** argv) {
|
||||
// events for the next Original input boundary; only handle SDL exit.
|
||||
SDL_PumpEvents();
|
||||
SDL_Event quit;
|
||||
if (SDL_PeepEvents(&quit, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) running = false;
|
||||
if (quit_confirmation.peep(&quit, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) running = false;
|
||||
if (running) SDL_Delay(10);
|
||||
}
|
||||
};
|
||||
@@ -807,7 +810,7 @@ int main(int argc, char** argv) {
|
||||
if (timed && Uint32(SDL_GetTicks() - started) >= 70 * 3 * 20)
|
||||
return complete(PendingOfferAnswer::yes);
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return PendingOfferAnswer::unsupported; }
|
||||
const bool question_deadline = question && poll_process_timer(true,true);
|
||||
if (question_deadline && pressed == ui::GameEndTaxDialog::Button::none)
|
||||
@@ -877,7 +880,7 @@ int main(int argc, char** argv) {
|
||||
SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP); // DecodeTaxAnimationScript/SDLFlushEvents redraw boundary
|
||||
while (running) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return PendingOfferTransferChoice{}; }
|
||||
std::optional<int> bid;
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN &&
|
||||
@@ -906,7 +909,7 @@ int main(int argc, char** argv) {
|
||||
bool acknowledged=false;
|
||||
while(running && !acknowledged) {
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event)) {
|
||||
while(quit_confirmation.poll(&event)) {
|
||||
if(event.type==SDL_QUIT){running=false;break;}
|
||||
if(event.type==SDL_MOUSEBUTTONDOWN &&
|
||||
(event.button.button==SDL_BUTTON_LEFT || event.button.button==SDL_BUTTON_RIGHT)) {
|
||||
@@ -969,7 +972,7 @@ int main(int argc, char** argv) {
|
||||
draw();
|
||||
while (running) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return -1; }
|
||||
ui::OutgoingTransferRequest action;
|
||||
if (event.type == SDL_MOUSEMOTION) continue;
|
||||
@@ -1086,7 +1089,7 @@ int main(int argc, char** argv) {
|
||||
while (running) {
|
||||
if (deadline_expired()) return true; //ClubInfoFromGame event8 returns to its owning caller.
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return false; }
|
||||
if (deadline_expired()) return true;
|
||||
ui::ClubInfoRequest request;
|
||||
@@ -1187,7 +1190,7 @@ int main(int argc, char** argv) {
|
||||
SDL_PumpEvents();
|
||||
while (running && (SDL_GetMouseState(nullptr, nullptr) & SDL_BUTTON_LMASK)) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input))
|
||||
while (quit_confirmation.poll(&input))
|
||||
if (input.type == SDL_QUIT) { running = false; return; }
|
||||
SDL_PumpEvents();
|
||||
if (running) SDL_Delay(10);
|
||||
@@ -1255,7 +1258,7 @@ int main(int argc, char** argv) {
|
||||
while (running) {
|
||||
if (const auto complete = expire_card()) return *complete;
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return std::nullopt; }
|
||||
if (const auto complete = expire_card()) return *complete;
|
||||
bool changed = false;
|
||||
@@ -1317,7 +1320,7 @@ int main(int argc, char** argv) {
|
||||
while (running) {
|
||||
if (deadline_expired()) return; //LeagueCalculations frees its child before4f548 polls again.
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return; }
|
||||
if (deadline_expired()) return;
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN && input.button.button == SDL_BUTTON_RIGHT)
|
||||
@@ -1401,7 +1404,7 @@ int main(int argc, char** argv) {
|
||||
while(running&&!outcome) {
|
||||
if(expire_range())break;
|
||||
SDL_Event input;
|
||||
while(SDL_PollEvent(&input)) {
|
||||
while(quit_confirmation.poll(&input)) {
|
||||
if(input.type==SDL_QUIT){running=false;break;}
|
||||
if(expire_range())break;
|
||||
bool changed=false;
|
||||
@@ -1457,7 +1460,7 @@ int main(int argc, char** argv) {
|
||||
while(running) {
|
||||
if(deadline_expired())return std::nullopt;
|
||||
SDL_Event input;
|
||||
while(SDL_PollEvent(&input)) {
|
||||
while(quit_confirmation.poll(&input)) {
|
||||
if(input.type==SDL_QUIT){running=false;break;}
|
||||
if(deadline_expired())return std::nullopt;
|
||||
bool changed=false;
|
||||
@@ -1551,7 +1554,7 @@ int main(int argc, char** argv) {
|
||||
// Source ignores the first OriginalMouseSound poll's gameplay result, then
|
||||
// presents the starting scene before its ten option-delay polls.
|
||||
SDL_Event initial;
|
||||
if (SDL_PollEvent(&initial) && initial.type == SDL_QUIT) { running = false; return; }
|
||||
if (quit_confirmation.poll(&initial) && initial.type == SDL_QUIT) { running = false; return; }
|
||||
show_draw();
|
||||
while (running && screen.advance_step()) {
|
||||
if (screen.present_needed()) show_draw();
|
||||
@@ -1559,7 +1562,7 @@ int main(int argc, char** argv) {
|
||||
if (!running) return;
|
||||
if (screen.input_poll_needed()) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return; }
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(input.button.button == SDL_BUTTON_LEFT || input.button.button == SDL_BUTTON_RIGHT)) {
|
||||
@@ -1594,7 +1597,7 @@ int main(int argc, char** argv) {
|
||||
SDL_FlushEvents(SDL_MOUSEMOTION, SDL_MOUSEBUTTONUP);
|
||||
while (running) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; return; }
|
||||
if (input.type != SDL_MOUSEBUTTONDOWN) continue;
|
||||
if (input.button.button == SDL_BUTTON_RIGHT) return;
|
||||
@@ -1631,7 +1634,7 @@ int main(int argc, char** argv) {
|
||||
while (running && screen.phase() == ui::AlternateScorePhase::Calculator) {
|
||||
SDL_Event event;
|
||||
bool changed = false;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN && event.button.button == SDL_BUTTON_RIGHT) {
|
||||
right_cancel = true;
|
||||
@@ -1696,6 +1699,11 @@ int main(int argc, char** argv) {
|
||||
std::optional<Uint64> timed_notice_presented_at;
|
||||
std::optional<Uint8> timed_notice_release;
|
||||
auto handle = [&](const ui::FlowResult& r) {
|
||||
if (r.request == ui::FlowRequest::end_session && !quit_confirmation.confirm()) {
|
||||
flow.reject_desk_action(english_game ? "Quit cancelled." : "Beenden abgebrochen.");
|
||||
dirty = true;
|
||||
return;
|
||||
}
|
||||
if (const auto* desk = flow.desktop())
|
||||
for (const auto id : desk->take_sound_ids()) app::original_audio_command(playback, id);
|
||||
if (r.request == ui::FlowRequest::kickoff || r.request == ui::FlowRequest::end_session) {
|
||||
@@ -1818,7 +1826,7 @@ int main(int argc, char** argv) {
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_Event modal;
|
||||
bool redrawn = false;
|
||||
while (SDL_PollEvent(&modal)) {
|
||||
while (quit_confirmation.poll(&modal)) {
|
||||
if (modal.type == SDL_QUIT) { running = false; closed = true; break; }
|
||||
if (modal.type == SDL_KEYDOWN && modal.key.keysym.sym == SDLK_ESCAPE) {
|
||||
screen.key("ESC"); closed = true; break;
|
||||
@@ -1988,7 +1996,7 @@ int main(int argc, char** argv) {
|
||||
show_dialog();
|
||||
while (running && !outcome) {
|
||||
SDL_Event input;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; break; }
|
||||
bool changed = false;
|
||||
if (input.type == SDL_TEXTINPUT) {
|
||||
@@ -2088,7 +2096,7 @@ int main(int argc, char** argv) {
|
||||
while (running && !closed) {
|
||||
SDL_Event input;
|
||||
bool redrawn = false;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; break; }
|
||||
if (input.type == SDL_MOUSEMOTION) {
|
||||
const bool changed = table_screen ? table_screen->move(input.motion.x, input.motion.y)
|
||||
@@ -2198,7 +2206,7 @@ int main(int argc, char** argv) {
|
||||
offer_dirty = false;
|
||||
}
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return -1; }
|
||||
std::optional<int> answer;
|
||||
if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
@@ -2267,7 +2275,7 @@ int main(int argc, char** argv) {
|
||||
rendered_phase = phase;
|
||||
}
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT))
|
||||
@@ -2295,7 +2303,7 @@ int main(int argc, char** argv) {
|
||||
bool dismissed = false;
|
||||
while (running && !dismissed) {
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { running = false; return; }
|
||||
if (event.type == SDL_MOUSEBUTTONUP &&
|
||||
(event.button.button == SDL_BUTTON_LEFT || event.button.button == SDL_BUTTON_RIGHT)) {
|
||||
@@ -2449,7 +2457,7 @@ int main(int argc, char** argv) {
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_Event modal;
|
||||
bool redrawn = false;
|
||||
while (SDL_PollEvent(&modal)) {
|
||||
while (quit_confirmation.poll(&modal)) {
|
||||
if (modal.type == SDL_QUIT) { running = false; closed = true; break; }
|
||||
if (modal.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(modal.button.button == SDL_BUTTON_LEFT || modal.button.button == SDL_BUTTON_RIGHT))
|
||||
@@ -2514,7 +2522,7 @@ int main(int argc, char** argv) {
|
||||
bool resumed = false;
|
||||
while (running && !resumed) {
|
||||
SDL_Event paused_event;
|
||||
while (SDL_PollEvent(&paused_event)) {
|
||||
while (quit_confirmation.poll(&paused_event)) {
|
||||
if (paused_event.type == SDL_QUIT) {
|
||||
quit = true;
|
||||
live_skipped = true;
|
||||
@@ -2632,7 +2640,7 @@ int main(int argc, char** argv) {
|
||||
while (running && !finished) {
|
||||
SDL_Event file_input;
|
||||
bool file_changed = false;
|
||||
while (SDL_PollEvent(&file_input)) {
|
||||
while (quit_confirmation.poll(&file_input)) {
|
||||
if (file_input.type == SDL_QUIT) { running = false; break; }
|
||||
if (file_input.type == SDL_MOUSEBUTTONUP &&
|
||||
(file_input.button.button == SDL_BUTTON_LEFT ||
|
||||
@@ -2692,7 +2700,7 @@ int main(int argc, char** argv) {
|
||||
while (running && !closed) {
|
||||
SDL_Event input;
|
||||
bool changed = false;
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; break; }
|
||||
if (readme) {
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN &&
|
||||
@@ -2806,7 +2814,7 @@ int main(int argc, char** argv) {
|
||||
const bool source_phase_start = minute == 1 ||
|
||||
(state.indoor ? minute == 21 : (minute == 46 || minute == 91 || minute == 106));
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event)) {
|
||||
while (quit_confirmation.poll(&event)) {
|
||||
if (event.type == SDL_QUIT) { quit = true; live_skipped = true; }
|
||||
else if (event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE)
|
||||
live_skipped = true;
|
||||
@@ -2927,7 +2935,7 @@ int main(int argc, char** argv) {
|
||||
present(live_screen.render_ball(frame, event.displacement, index, chance));
|
||||
SDL_PumpEvents();
|
||||
SDL_Event quit_event;
|
||||
if (SDL_PeepEvents(&quit_event, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
if (quit_confirmation.peep(&quit_event, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
running = false;
|
||||
break;
|
||||
}
|
||||
@@ -2964,7 +2972,7 @@ int main(int argc, char** argv) {
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_PumpEvents();
|
||||
SDL_Event quit_event;
|
||||
if (SDL_PeepEvents(&quit_event, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
if (quit_confirmation.peep(&quit_event, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
running = false;
|
||||
live_chance_context.reset();
|
||||
return;
|
||||
@@ -2996,7 +3004,7 @@ int main(int argc, char** argv) {
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_PumpEvents();
|
||||
SDL_Event input;
|
||||
if (SDL_PeepEvents(&input, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
if (quit_confirmation.peep(&input, 1, SDL_GETEVENT, SDL_QUIT, SDL_QUIT) > 0) {
|
||||
running = false;
|
||||
return;
|
||||
}
|
||||
@@ -3018,7 +3026,7 @@ int main(int argc, char** argv) {
|
||||
SDL_Event input;
|
||||
bool acknowledged = false;
|
||||
while (running && !acknowledged) {
|
||||
while (SDL_PollEvent(&input)) {
|
||||
while (quit_confirmation.poll(&input)) {
|
||||
if (input.type == SDL_QUIT) { running = false; break; }
|
||||
if (input.type == SDL_MOUSEBUTTONDOWN &&
|
||||
(input.button.button == SDL_BUTTON_LEFT || input.button.button == SDL_BUTTON_RIGHT)) {
|
||||
@@ -3053,7 +3061,7 @@ int main(int argc, char** argv) {
|
||||
SDL_UpdateTexture(texture,nullptr,pixels.data(),320*4);
|
||||
SDL_RenderClear(renderer);SDL_RenderCopy(renderer,texture,nullptr,nullptr);SDL_RenderPresent(renderer);
|
||||
SDL_PumpEvents();SDL_Event input;
|
||||
if (SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
if (quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
// FirstThen holds the first frame for 40 retraces; later frames
|
||||
// use saved Main_FormatError_RuntimeField2. Keyboard/mouse input remains for the minute hook.
|
||||
const int retraces=index==0?40:(state.memory.has(::bmh::layout::Main_FormatError_RuntimeField2)?state.memory.u8(::bmh::layout::Main_FormatError_RuntimeField2):0);
|
||||
@@ -3079,7 +3087,7 @@ int main(int argc, char** argv) {
|
||||
if (event.kind != 2 && app::match_sound_enabled(state))
|
||||
app::original_audio_command(playback, 17); // EventImpl/SDLPumpEvents, no injury whistle.
|
||||
SDL_PumpEvents();SDL_Event input;
|
||||
if (SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
if (quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
const int pause=event.kind==0?3:4;
|
||||
const uint32_t address=::bmh::layout::Main_FormatError_ExecutableFieldUnsigned+uint32_t(pause*9);
|
||||
const int saved=state.memory.has(address)?state.memory.u8(address):0;
|
||||
@@ -3103,7 +3111,7 @@ int main(int argc, char** argv) {
|
||||
SDL_UpdateTexture(texture,nullptr,pixels.data(),320*4);
|
||||
SDL_RenderClear(renderer);SDL_RenderCopy(renderer,texture,nullptr,nullptr);SDL_RenderPresent(renderer);
|
||||
SDL_PumpEvents();SDL_Event input;
|
||||
if (SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
if (quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) { running=false;return; }
|
||||
const int repeats=event.stage==LiveShootoutStage::preview?4:2;
|
||||
const int saved=state.memory.has(::bmh::layout::Main_FormatError_RuntimeField6)?state.memory.u8(::bmh::layout::Main_FormatError_RuntimeField6):0;
|
||||
const int delay=live_frame_ms_explicit?live_frame_ms:(saved<6?saved/2:saved)*20;
|
||||
@@ -3167,16 +3175,16 @@ int main(int argc, char** argv) {
|
||||
present(reality_surface,reality_colors,"OpenBMH - live_reality_report_"+round_identity);
|
||||
}
|
||||
SDL_PumpEvents();SDL_Event input;
|
||||
if (SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) {running=false;return true;}
|
||||
if (quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_QUIT,SDL_QUIT)>0) {running=false;return true;}
|
||||
// Consume only the Source exit for this scene. Other input remains
|
||||
// queued for the existing live-minute/manager intervention boundary.
|
||||
if (SDL_PeepEvents(&input,1,SDL_PEEKEVENT,SDL_KEYDOWN,SDL_KEYDOWN)>0 &&
|
||||
if (quit_confirmation.peep(&input,1,SDL_PEEKEVENT,SDL_KEYDOWN,SDL_KEYDOWN)>0 &&
|
||||
input.key.keysym.sym==SDLK_ESCAPE) {
|
||||
SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_KEYDOWN,SDL_KEYDOWN);return true;
|
||||
quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_KEYDOWN,SDL_KEYDOWN);return true;
|
||||
}
|
||||
if (SDL_PeepEvents(&input,1,SDL_PEEKEVENT,SDL_MOUSEBUTTONDOWN,SDL_MOUSEBUTTONDOWN)>0 &&
|
||||
if (quit_confirmation.peep(&input,1,SDL_PEEKEVENT,SDL_MOUSEBUTTONDOWN,SDL_MOUSEBUTTONDOWN)>0 &&
|
||||
input.button.button==SDL_BUTTON_RIGHT) {
|
||||
SDL_PeepEvents(&input,1,SDL_GETEVENT,SDL_MOUSEBUTTONDOWN,SDL_MOUSEBUTTONDOWN);return true;
|
||||
quit_confirmation.peep(&input,1,SDL_GETEVENT,SDL_MOUSEBUTTONDOWN,SDL_MOUSEBUTTONDOWN);return true;
|
||||
}
|
||||
return false;
|
||||
}, [&](const PhaseResultRequest& request, const std::vector<MatchGroup>& groups,
|
||||
@@ -3601,7 +3609,7 @@ int main(int argc, char** argv) {
|
||||
service_process_timer();
|
||||
if (!running) break;
|
||||
SDL_Event e;
|
||||
while (SDL_PollEvent(&e)) {
|
||||
while (quit_confirmation.poll(&e)) {
|
||||
if (e.type == SDL_QUIT) {
|
||||
running = false;
|
||||
break;
|
||||
@@ -3680,7 +3688,8 @@ int main(int argc, char** argv) {
|
||||
continue;
|
||||
}
|
||||
if (e.type == SDL_KEYDOWN && e.key.keysym.sym == SDLK_ESCAPE &&
|
||||
!flow.in_preparation_menu() && !flow.in_results_view() && !flow.in_readonly_view())
|
||||
!flow.in_preparation_menu() && !flow.in_results_view() && !flow.in_readonly_view() &&
|
||||
quit_confirmation.confirm())
|
||||
running = false;
|
||||
if (e.type == SDL_MOUSEBUTTONDOWN && e.button.button == SDL_BUTTON_LEFT)
|
||||
press = Press{e.button.x, e.button.y, SDL_GetTicks(), flow.screen_name(),
|
||||
|
||||
Reference in new issue
Block a user