diff --git a/srcpkgs/pioneer/patches/4503.patch b/srcpkgs/pioneer/patches/4503.patch new file mode 100644 index 00000000000..7b6d8cd1990 --- /dev/null +++ b/srcpkgs/pioneer/patches/4503.patch @@ -0,0 +1,258 @@ +From 1fdea8fe6fd1caf7b37de3e0ad423121b73672e4 Mon Sep 17 00:00:00 2001 +From: Andrew Copland +Date: Wed, 26 Dec 2018 21:58:54 +0000 +Subject: [PATCH] Queue requests in response to UI events, never process them + immediately. + +--- + src/LuaEngine.cpp | 4 +-- + src/Pi.cpp | 57 +++++++++++++++++++++++++++++-------------- + src/Pi.h | 15 +++++++++--- + src/galaxy/Galaxy.cpp | 6 ++--- + src/main.cpp | 1 - + 5 files changed, 54 insertions(+), 29 deletions(-) + +diff --git src/LuaEngine.cpp src/LuaEngine.cpp +index ebfe2b5eb1..858dcbf75f 100644 +--- src/LuaEngine.cpp ++++ src/LuaEngine.cpp +@@ -152,9 +152,7 @@ static int l_engine_attr_version(lua_State *l) + */ + static int l_engine_quit(lua_State *l) + { +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + return 0; + } + +diff --git src/Pi.cpp src/Pi.cpp +index db4b6721b4..4066e44e7b 100644 +--- src/Pi.cpp ++++ src/Pi.cpp +@@ -152,7 +152,7 @@ Graphics::RenderTarget *Pi::renderTarget; + RefCountedPtr Pi::renderTexture; + std::unique_ptr Pi::renderQuad; + Graphics::RenderState *Pi::quadRenderState = nullptr; +-bool Pi::bRequestEndGame = false; ++std::vector Pi::internalRequests; + bool Pi::isRecordingVideo = false; + FILE *Pi::ffmpegFile = nullptr; + +@@ -774,6 +774,9 @@ bool Pi::IsConsoleActive() + + void Pi::Quit() + { ++ if (Pi::game) { // always end the game if there is one before quitting ++ Pi::EndGame(); ++ } + if (Pi::ffmpegFile != nullptr) { + _pclose(Pi::ffmpegFile); + } +@@ -837,9 +840,7 @@ void Pi::HandleKeyDown(SDL_Keysym *key) + if (CTRL) { + switch (key->sym) { + case SDLK_q: // Quit +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + break; + case SDLK_PRINTSCREEN: // print + case SDLK_KP_MULTIPLY: // screen +@@ -1039,9 +1040,7 @@ void Pi::HandleEvents() + Pi::input.mouseMotion[0] = Pi::input.mouseMotion[1] = 0; + while (SDL_PollEvent(&event)) { + if (event.type == SDL_QUIT) { +- if (Pi::game) +- Pi::EndGame(); +- Pi::Quit(); ++ Pi::RequestQuit(); + } + + Pi::pigui->ProcessEvent(&event); +@@ -1095,6 +1094,26 @@ void Pi::HandleEvents() + } + } + ++void Pi::HandleRequests() ++{ ++ for (auto request : internalRequests) ++ { ++ switch (request) ++ { ++ case END_GAME: ++ EndGame(); ++ break; ++ case QUIT_GAME: ++ Quit(); ++ break; ++ default: ++ Output("Pi::HandleRequests, unhandled request type processed.\n"); ++ break; ++ } ++ } ++ internalRequests.clear(); ++} ++ + void Pi::TombStoneLoop() + { + std::unique_ptr tombstone(new Tombstone(Pi::renderer, Graphics::GetScreenWidth(), Graphics::GetScreenHeight())); +@@ -1115,6 +1134,8 @@ void Pi::TombStoneLoop() + Pi::DrawRenderTarget(); + Pi::renderer->SwapBuffers(); + ++ Pi::HandleRequests(); ++ + Pi::frameTime = 0.001f * (SDL_GetTicks() - last_time); + _time += Pi::frameTime; + last_time = SDL_GetTicks(); +@@ -1162,8 +1183,6 @@ void Pi::StartGame() + + void Pi::Start(const SystemPath &startPath) + { +- Pi::bRequestEndGame = false; +- + Pi::intro = new Intro(Pi::renderer, Graphics::GetScreenWidth(), Graphics::GetScreenHeight()); + if (startPath != SystemPath(0, 0, 0, 0, 0)) { + Pi::game = new Game(startPath, 0.0); +@@ -1179,7 +1198,7 @@ void Pi::Start(const SystemPath &startPath) + SDL_Event event; + while (SDL_PollEvent(&event)) { + if (event.type == SDL_QUIT) +- Pi::Quit(); ++ Pi::RequestQuit(); + else { + Pi::pigui->ProcessEvent(&event); + +@@ -1260,6 +1279,8 @@ void Pi::Start(const SystemPath &startPath) + _time += Pi::frameTime; + last_time = SDL_GetTicks(); + ++ Pi::HandleRequests(); ++ + #ifdef ENABLE_SERVER_AGENT + Pi::serverAgent->ProcessResponses(); + #endif +@@ -1276,14 +1297,16 @@ void Pi::Start(const SystemPath &startPath) + // request that the game is ended as soon as safely possible + void Pi::RequestEndGame() + { +- Pi::bRequestEndGame = true; ++ internalRequests.push_back(END_GAME); + } + +-void Pi::EndGame() ++void Pi::RequestQuit() + { +- // always reset this, otherwise we can never play again +- Pi::bRequestEndGame = false; ++ internalRequests.push_back(QUIT_GAME); ++} + ++void Pi::EndGame() ++{ + Pi::SetMouseGrab(false); + + Pi::musicPlayer.Stop(); +@@ -1423,10 +1446,6 @@ void Pi::MainLoop() + Pi::luaConsole->HandleTCPDebugConnections(); + #endif + +- if (Pi::bRequestEndGame) { +- Pi::EndGame(); +- } +- + Pi::renderer->EndFrame(); + + Pi::renderer->ClearDepthBuffer(); +@@ -1510,6 +1529,8 @@ void Pi::MainLoop() + asyncJobQueue->FinishJobs(); + syncJobQueue->FinishJobs(); + ++ HandleRequests(); ++ + #if WITH_DEVKEYS + if (Pi::showDebugInfo && SDL_GetTicks() - last_stats > 1000) { + size_t lua_mem = Lua::manager->GetMemoryUsage(); +diff --git src/Pi.h src/Pi.h +index e7dfa78877..8924536e4e 100644 +--- src/Pi.h ++++ src/Pi.h +@@ -65,10 +65,10 @@ class Pi { + static void RequestEndGame(); // request that the game is ended as soon as safely possible + static void EndGame(); + static void Start(const SystemPath &startPath); ++ static void RequestQuit(); + static void MainLoop(); + static void TombStoneLoop(); + static void OnChangeDetailLevel(); +- static void Quit() __attribute((noreturn)); + static float GetFrameTime() { return frameTime; } + static float GetGameTickAlpha() { return gameTickAlpha; } + +@@ -160,10 +160,20 @@ class Pi { + static bool DrawGUI; + + private: ++ // msgs/requests that can be posted which the game processes at the end of a game loop in HandleRequests ++ enum InternalRequests ++ { ++ END_GAME = 0, ++ QUIT_GAME, ++ }; ++ static void Quit() __attribute((noreturn)); + static void HandleKeyDown(SDL_Keysym *key); + static void HandleEvents(); +- // Handler for ESC key press ++ static void HandleRequests(); + static void HandleEscKey(); ++ ++ // private members ++ static std::vector internalRequests; + static const Uint32 SYNC_JOBS_PER_LOOP = 1; + static std::unique_ptr asyncJobQueue; + static std::unique_ptr syncJobQueue; +@@ -193,7 +203,6 @@ class Pi { + static Graphics::RenderState *quadRenderState; + + static bool doingMouseGrab; +- static bool bRequestEndGame; + + static bool isRecordingVideo; + static FILE *ffmpegFile; +diff --git src/galaxy/Galaxy.cpp src/galaxy/Galaxy.cpp +index d19d615f3b..312fec6ded 100644 +--- src/galaxy/Galaxy.cpp ++++ src/galaxy/Galaxy.cpp +@@ -113,15 +113,13 @@ DensityMapGalaxy::DensityMapGalaxy(RefCountedPtr galaxyGenerato + { + RefCountedPtr filedata = FileSystem::gameDataFiles.ReadFile(mapfile); + if (!filedata) { +- Output("Galaxy: couldn't load '%s'\n", mapfile.c_str()); +- Pi::Quit(); ++ Error("Galaxy: couldn't load '%s'\n", mapfile.c_str()); + } + + SDL_RWops *datastream = SDL_RWFromConstMem(filedata->GetData(), filedata->GetSize()); + SDL_Surface *galaxyImg = SDL_LoadBMP_RW(datastream, 1); + if (!galaxyImg) { +- Output("Galaxy: couldn't load: %s (%s)\n", mapfile.c_str(), SDL_GetError()); +- Pi::Quit(); ++ Error("Galaxy: couldn't load: %s (%s)\n", mapfile.c_str(), SDL_GetError()); + } + + // now that we have our raw image loaded +diff --git src/main.cpp src/main.cpp +index 864ae2a737..f59ca02336 100644 +--- src/main.cpp ++++ src/main.cpp +@@ -197,7 +197,6 @@ int main(int argc, char** argv) + if (filename != "-" && fclose(file) != 0) { + Output("pioneer: writing to \"%s\" failed: %s\n", filename.c_str(), strerror(errno)); + } +- Pi::Quit(); + } + break; + } diff --git a/srcpkgs/pioneer/template b/srcpkgs/pioneer/template index 4894dbd442c..c32700b9837 100644 --- a/srcpkgs/pioneer/template +++ b/srcpkgs/pioneer/template @@ -1,18 +1,18 @@ # Template file for 'pioneer' pkgname=pioneer -version=20180203 -revision=2 +version=20181223 +revision=1 build_style=gnu-configure hostmakedepends="automake pkg-config" makedepends="freetype-devel libassimp-devel libsigc++-devel libvorbis-devel SDL2_image-devel" depends="pioneer-data>=${version}_${revision}" -maintainer="Orphaned " short_desc="Space adventure game set in our galaxy at the turn of the 31st century" +maintainer="John " +license="GPL-3.0-or-later" homepage="https://pioneerspacesim.net" -license="GPL-3" distfiles="https://github.com/pioneerspacesim/pioneer/archive/${version}.tar.gz" -checksum=19aa89e8ec0221b937b9279e0d4897b3016e0ce80858d03600d3e80cd7daa907 +checksum=e40cb6a33e519c78c0747638e0503ba7b5a4aadf73a04e33ee5246210b549540 pre_configure() { export PIONEER_DATA_DIR=/usr/share/pioneer