pioneer: update to 20190203.
This commit is contained in:
parent
00a0a4ad94
commit
dc0c6a9260
6 changed files with 50 additions and 300 deletions
1
srcpkgs/pioneer-modelcompiler
Symbolic link
1
srcpkgs/pioneer-modelcompiler
Symbolic link
|
@ -0,0 +1 @@
|
|||
pioneer
|
|
@ -1,10 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Name=Pioneer
|
||||
Comment=Space adventure game set in our galaxy at the turn of the 31st century.
|
||||
Path=/usr/share/pioneer/
|
||||
Exec=pioneer
|
||||
Icon=pioneer
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Game;StrategyGame;
|
||||
|
|
@ -1,258 +0,0 @@
|
|||
From 1fdea8fe6fd1caf7b37de3e0ad423121b73672e4 Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Copland <fluffyfreak@users.noreply.github.com>
|
||||
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<Graphics::Texture> Pi::renderTexture;
|
||||
std::unique_ptr<Graphics::Drawables::TexturedQuad> Pi::renderQuad;
|
||||
Graphics::RenderState *Pi::quadRenderState = nullptr;
|
||||
-bool Pi::bRequestEndGame = false;
|
||||
+std::vector<Pi::InternalRequests> 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> 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> internalRequests;
|
||||
static const Uint32 SYNC_JOBS_PER_LOOP = 1;
|
||||
static std::unique_ptr<AsyncJobQueue> asyncJobQueue;
|
||||
static std::unique_ptr<SyncJobQueue> 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<GalaxyGenerator> galaxyGenerato
|
||||
{
|
||||
RefCountedPtr<FileSystem::FileData> 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;
|
||||
}
|
22
srcpkgs/pioneer/patches/cross.patch
Normal file
22
srcpkgs/pioneer/patches/cross.patch
Normal file
|
@ -0,0 +1,22 @@
|
|||
--- CMakeLists.txt 2019-02-03 11:56:16.000000000 +0100
|
||||
+++ - 2019-02-03 19:12:47.221852468 +0100
|
||||
@@ -241,11 +241,19 @@
|
||||
|
||||
# Optimize the models after the modelcompiler is built.
|
||||
# This really shouldn't be done inside the source tree...
|
||||
+if(CMAKE_CROSSCOMPILING)
|
||||
+add_custom_command(TARGET modelcompiler POST_BUILD
|
||||
+ COMMAND ${CMAKE_COMMAND} -E env SDL_VIDEODRIVER=dummy modelcompiler -b inplace
|
||||
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
+ COMMENT "Optimizing models" VERBATIM
|
||||
+)
|
||||
+else()
|
||||
add_custom_command(TARGET modelcompiler POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E env SDL_VIDEODRIVER=dummy $<TARGET_FILE:modelcompiler> -b inplace
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Optimizing models" VERBATIM
|
||||
)
|
||||
+endif()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME} modelcompiler savegamedump
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
@ -1,20 +1,20 @@
|
|||
--- src/posix/OSPosix.cpp.orig 2017-08-19 20:00:23.645790781 +0200
|
||||
+++ src/posix/OSPosix.cpp 2017-08-19 20:00:44.153855997 +0200
|
||||
--- src/posix/OSPosix.cpp 2019-02-03 11:56:16.000000000 +0100
|
||||
+++ - 2019-02-03 17:32:45.957535773 +0100
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
void EnableFPE()
|
||||
{
|
||||
|
||||
void EnableFPE()
|
||||
{
|
||||
-#if defined(_GNU_SOURCE) && !defined(__APPLE__)
|
||||
+#if defined(_GNU_SOURCE) && !defined(__APPLE__) && defined(__GLIBC__)
|
||||
// clear any outstanding exceptions before enabling, otherwise they'll
|
||||
// trip immediately
|
||||
feclearexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
|
||||
// clear any outstanding exceptions before enabling, otherwise they'll
|
||||
// trip immediately
|
||||
feclearexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
|
||||
@@ -58,7 +58,7 @@
|
||||
|
||||
void DisableFPE()
|
||||
{
|
||||
|
||||
void DisableFPE()
|
||||
{
|
||||
-#if defined(_GNU_SOURCE) && !defined(__APPLE__)
|
||||
+#if defined(_GNU_SOURCE) && !defined(__APPLE__) && defined(__GLIBC__)
|
||||
fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
|
||||
fedisableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,35 +1,30 @@
|
|||
# Template file for 'pioneer'
|
||||
pkgname=pioneer
|
||||
version=20181223
|
||||
version=20190203
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
build_style=cmake
|
||||
configure_args="-DPIONEER_DATA_DIR=/usr/share/pioneer
|
||||
-DUSE_SYSTEM_LIBLUA=ON -DUSE_SYSTEM_LIBGLEW=ON"
|
||||
hostmakedepends="automake pkg-config"
|
||||
makedepends="freetype-devel libassimp-devel libsigc++-devel
|
||||
libvorbis-devel SDL2_image-devel"
|
||||
libvorbis-devel SDL2_image-devel glew-devel lua52-devel"
|
||||
depends="pioneer-data>=${version}_${revision}"
|
||||
short_desc="Space adventure game set in our galaxy at the turn of the 31st century"
|
||||
maintainer="John <johnz@posteo.net>"
|
||||
license="GPL-3.0-or-later"
|
||||
homepage="https://pioneerspacesim.net"
|
||||
distfiles="https://github.com/pioneerspacesim/pioneer/archive/${version}.tar.gz"
|
||||
checksum=e40cb6a33e519c78c0747638e0503ba7b5a4aadf73a04e33ee5246210b549540
|
||||
checksum=e526f1659ae321f45b997c0245acecbf9c4cf2122b025ab8db1090f1b9804f5e
|
||||
|
||||
pre_configure() {
|
||||
export PIONEER_DATA_DIR=/usr/share/pioneer
|
||||
./bootstrap
|
||||
}
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
hostmakedepends+=" pioneer-modelcompiler"
|
||||
fi
|
||||
|
||||
post_install() {
|
||||
vinstall ${FILESDIR}/pioneer.desktop 644 usr/share/applications
|
||||
|
||||
for icon in application-icon/pngs/*
|
||||
do
|
||||
if [[ $icon =~ pioneer-([0-9]+x[0-9]+).png ]]; then
|
||||
vinstall $icon 644 usr/share/icons/hicolor/${BASH_REMATCH[1]}/apps pioneer.png
|
||||
fi
|
||||
done
|
||||
|
||||
vinstall application-icon/badge-enlarged-text.svg 644 usr/share/icons/hicolor/scalable/apps pioneer.svg
|
||||
pioneer-modelcompiler_package() {
|
||||
short_desc+=" -modelcompiler"
|
||||
pkg_install() {
|
||||
vmove usr/bin/modelcompiler
|
||||
}
|
||||
}
|
||||
|
||||
pioneer-data_package() {
|
||||
|
|
Loading…
Reference in a new issue