From 37afa4b154864ee3403cb65b74a3d35ffc63f871 Mon Sep 17 00:00:00 2001 From: Tim Dickson Date: Thu, 3 Sep 2020 20:56:46 +0100 Subject: games/0ad: Updated for version 0.0.23b. Signed-off-by: Dave Woodfall Signed-off-by: Willy Sudiarto Raharjo --- games/0ad/0ad.SlackBuild | 6 +- games/0ad/0ad.info | 12 +-- games/0ad/D1852.diff | 213 +++++++++++++++++++++++++++++++++++++++++++++++ games/0ad/README | 3 +- 4 files changed, 226 insertions(+), 8 deletions(-) create mode 100644 games/0ad/D1852.diff diff --git a/games/0ad/0ad.SlackBuild b/games/0ad/0ad.SlackBuild index 524b16e406..533b79f656 100644 --- a/games/0ad/0ad.SlackBuild +++ b/games/0ad/0ad.SlackBuild @@ -2,6 +2,7 @@ # # Slackware build script for 0.A.D. # +# Copyright 2020 Tim Dickson, Scotland # Copyright 2016-2017 Reedych # Copyright 2010-2016 Erik W. Hanson, Minneapolis, MN, USA # All rights reserved. @@ -24,7 +25,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=0ad -VERSION=${VERSION:-0.0.21} +VERSION=${VERSION:-0.0.23b} RELEASE=${RELEASE:-alpha} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -83,6 +84,9 @@ sed -i 's/-mt//g' build/premake/extern_libs4.lua # build/workspaces/update-workspaces.sh # have a root check, let's disable it. patch -p1 < $CWD/disable-root-check.patch +#apply a segfault fixing patch +#sourced from https://code.wildfiregames.com/file/data/nryu3qhun4v6uroyiqoc/PHID-FILE-osgvknec7zmfuja5xqq4/D1852.diff +patch -p2 < $CWD/D1852.diff build/workspaces/update-workspaces.sh \ --bindir=/usr/games \ diff --git a/games/0ad/0ad.info b/games/0ad/0ad.info index 97bc6ce2ac..848b05848e 100644 --- a/games/0ad/0ad.info +++ b/games/0ad/0ad.info @@ -1,10 +1,10 @@ PRGNAM="0ad" -VERSION="0.0.21" +VERSION="0.0.23b" HOMEPAGE="https://play0ad.com/" -DOWNLOAD="http://releases.wildfiregames.com/0ad-0.0.21-alpha-unix-build.tar.xz" -MD5SUM="095eade8c9b3deaf25d0d7fa423ff860" +DOWNLOAD="http://releases.wildfiregames.com/0ad-0.0.23b-alpha-unix-build.tar.xz" +MD5SUM="4fa111410ea55de7a013406ac1013668" DOWNLOAD_x86_64="" MD5SUM_x86_64="" -REQUIRES="0ad-data OpenAL enet gloox miniupnpc SDL2" -MAINTAINER="Reedych" -EMAIL="reedych@ya.ru" +REQUIRES="0ad-data OpenAL enet gloox miniupnpc SDL2 libsodium" +MAINTAINER="Tim Dickson" +EMAIL="dickson.tim@googlemail.com" diff --git a/games/0ad/D1852.diff b/games/0ad/D1852.diff new file mode 100644 index 0000000000..131c8210a0 --- /dev/null +++ b/games/0ad/D1852.diff @@ -0,0 +1,213 @@ +Index: ps/trunk/source/ps/Replay.cpp +=================================================================== +--- ps/trunk/source/ps/Replay.cpp ++++ ps/trunk/source/ps/Replay.cpp +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2018 Wildfire Games. ++/* Copyright (C) 2019 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify +@@ -72,7 +72,7 @@ + JS::RootedValue mods(cx, Mod::GetLoadedModsWithVersions(m_ScriptInterface)); + m_ScriptInterface.SetProperty(attribs, "mods", mods); + +- m_Directory = createDateIndexSubdirectory(VisualReplay::GetDirectoryName()); ++ m_Directory = createDateIndexSubdirectory(VisualReplay::GetDirectoryPath()); + debug_printf("Writing replay to %s\n", m_Directory.string8().c_str()); + + m_Stream = new std::ofstream(OsString(m_Directory / L"commands.txt").c_str(), std::ofstream::out | std::ofstream::trunc); +Index: ps/trunk/source/ps/VisualReplay.h +=================================================================== +--- ps/trunk/source/ps/VisualReplay.h ++++ ps/trunk/source/ps/VisualReplay.h +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2017 Wildfire Games. ++/* Copyright (C) 2019 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify +@@ -29,12 +29,20 @@ + { + + /** +- * Returns the path to the sim-log directory (that contains the directories with the replay files. +- * +- * @param scriptInterface - the ScriptInterface in which to create the return data. +- * @return OsPath the absolute file path ++ * Returns the absolute path to the sim-log directory (that contains the directories with the replay files. ++ */ ++OsPath GetDirectoryPath(); ++ ++/** ++ * Returns the absolute path to the replay cache file. ++ */ ++OsPath GetCacheFilePath(); ++ ++/** ++ * Returns the absolute path to the temporary replay cache file used to ++ * always have a valid cache file in place even if bad things happen. + */ +-OsPath GetDirectoryName(); ++OsPath GetTempCacheFilePath(); + + /** + * Replays the commands.txt file in the given subdirectory visually. +Index: ps/trunk/source/ps/VisualReplay.cpp +=================================================================== +--- ps/trunk/source/ps/VisualReplay.cpp ++++ ps/trunk/source/ps/VisualReplay.cpp +@@ -40,13 +40,19 @@ + */ + const u8 minimumReplayDuration = 3; + +-static const OsPath tempCacheFileName = VisualReplay::GetDirectoryName() / L"replayCache_temp.json"; +-static const OsPath cacheFileName = VisualReplay::GetDirectoryName() / L"replayCache.json"; ++OsPath VisualReplay::GetDirectoryPath() ++{ ++ return Paths(g_args).UserData() / "replays" / engine_version; ++} ++ ++OsPath VisualReplay::GetCacheFilePath() ++{ ++ return GetDirectoryPath() / L"replayCache.json"; ++} + +-OsPath VisualReplay::GetDirectoryName() ++OsPath VisualReplay::GetTempCacheFilePath() + { +- const Paths paths(g_args); +- return OsPath(paths.UserData() / "replays" / engine_version); ++ return GetDirectoryPath() / L"replayCache_temp.json"; + } + + bool VisualReplay::StartVisualReplay(const OsPath& directory) +@@ -55,7 +61,7 @@ + ENSURE(!g_NetClient); + ENSURE(!g_Game); + +- const OsPath replayFile = VisualReplay::GetDirectoryName() / directory / L"commands.txt"; ++ const OsPath replayFile = VisualReplay::GetDirectoryPath() / directory / L"commands.txt"; + + if (!FileExists(replayFile)) + return false; +@@ -69,10 +75,10 @@ + JSContext* cx = scriptInterface.GetContext(); + JSAutoRequest rq(cx); + +- if (!FileExists(cacheFileName)) ++ if (!FileExists(GetCacheFilePath())) + return false; + +- std::ifstream cacheStream(OsString(cacheFileName).c_str()); ++ std::ifstream cacheStream(OsString(GetCacheFilePath()).c_str()); + CStr cacheStr((std::istreambuf_iterator(cacheStream)), std::istreambuf_iterator()); + cacheStream.close(); + +@@ -85,7 +91,7 @@ + } + + LOGWARNING("The replay cache file is corrupted, it will be deleted"); +- wunlink(cacheFileName); ++ wunlink(GetCacheFilePath()); + return false; + } + +@@ -95,12 +101,12 @@ + JSAutoRequest rq(cx); + + JS::RootedValue replaysRooted(cx, JS::ObjectValue(*replays)); +- std::ofstream cacheStream(OsString(tempCacheFileName).c_str(), std::ofstream::out | std::ofstream::trunc); ++ std::ofstream cacheStream(OsString(GetTempCacheFilePath()).c_str(), std::ofstream::out | std::ofstream::trunc); + cacheStream << scriptInterface.StringifyJSON(&replaysRooted); + cacheStream.close(); + +- wunlink(cacheFileName); +- if (wrename(tempCacheFileName, cacheFileName)) ++ wunlink(GetCacheFilePath()); ++ if (wrename(GetTempCacheFilePath(), GetCacheFilePath())) + LOGERROR("Could not store the replay cache"); + } + +@@ -139,7 +145,7 @@ + JS::RootedObject replays(cx, JS_NewArrayObject(cx, 0)); + DirectoryNames directories; + +- if (GetDirectoryEntries(GetDirectoryName(), nullptr, &directories) != INFO::OK) ++ if (GetDirectoryEntries(GetDirectoryPath(), nullptr, &directories) != INFO::OK) + return replays; + + bool newReplays = false; +@@ -155,7 +161,7 @@ + // Don't return, because we want to save our progress + break; + +- const OsPath replayFile = GetDirectoryName() / directory / L"commands.txt"; ++ const OsPath replayFile = GetDirectoryPath() / directory / L"commands.txt"; + + bool isNew = true; + replayCacheMap::iterator it = fileList.find(directory); +@@ -325,7 +331,7 @@ + JS::Value VisualReplay::LoadReplayData(const ScriptInterface& scriptInterface, const OsPath& directory) + { + // The directory argument must not be constant, otherwise concatenating will fail +- const OsPath replayFile = GetDirectoryName() / directory / L"commands.txt"; ++ const OsPath replayFile = GetDirectoryPath() / directory / L"commands.txt"; + + if (!FileExists(replayFile)) + return JS::NullValue(); +@@ -407,7 +413,7 @@ + if (replayDirectory.empty()) + return false; + +- const OsPath directory = GetDirectoryName() / replayDirectory; ++ const OsPath directory = GetDirectoryPath() / replayDirectory; + return DirectoryExists(directory) && DeleteDirectory(directory) == INFO::OK; + } + +@@ -420,7 +426,7 @@ + pCxPrivate->pScriptInterface->Eval("({})", &attribs); + + // Return empty object if file doesn't exist +- const OsPath replayFile = GetDirectoryName() / directoryName / L"commands.txt"; ++ const OsPath replayFile = GetDirectoryPath() / directoryName / L"commands.txt"; + if (!FileExists(replayFile)) + return attribs; + +@@ -483,7 +489,7 @@ + + bool VisualReplay::HasReplayMetadata(const OsPath& directoryName) + { +- const OsPath filePath(GetDirectoryName() / directoryName / L"metadata.json"); ++ const OsPath filePath(GetDirectoryPath() / directoryName / L"metadata.json"); + + if (!FileExists(filePath)) + return false; +@@ -503,7 +509,7 @@ + JSAutoRequest rq(cx); + JS::RootedValue metadata(cx); + +- std::ifstream* stream = new std::ifstream(OsString(GetDirectoryName() / directoryName / L"metadata.json").c_str()); ++ std::ifstream* stream = new std::ifstream(OsString(GetDirectoryPath() / directoryName / L"metadata.json").c_str()); + ENSURE(stream->good()); + CStr line; + std::getline(*stream, line); +Index: ps/trunk/source/ps/scripting/JSInterface_VisualReplay.cpp +=================================================================== +--- ps/trunk/source/ps/scripting/JSInterface_VisualReplay.cpp ++++ ps/trunk/source/ps/scripting/JSInterface_VisualReplay.cpp +@@ -1,4 +1,4 @@ +-/* Copyright (C) 2018 Wildfire Games. ++/* Copyright (C) 2019 Wildfire Games. + * This file is part of 0 A.D. + * + * 0 A.D. is free software: you can redistribute it and/or modify +@@ -61,7 +61,7 @@ + + CStrW JSI_VisualReplay::GetReplayDirectoryName(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const CStrW& directoryName) + { +- return wstring_from_utf8(OsPath(VisualReplay::GetDirectoryName() / directoryName).string8()); ++ return wstring_from_utf8(OsPath(VisualReplay::GetDirectoryPath() / directoryName).string8()); + } + + void JSI_VisualReplay::RegisterScriptFunctions(const ScriptInterface& scriptInterface) diff --git a/games/0ad/README b/games/0ad/README index 1f7344ab01..a88264f9aa 100644 --- a/games/0ad/README +++ b/games/0ad/README @@ -1,5 +1,6 @@ 0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform real-time strategy (RTS) game of ancient warfare. -To include the Atlas editor, which requires wxPython: +To include the Atlas editor, which requires wxGTK3 as wxPython is too +old: ATLAS=enable ./0ad.SlackBuild -- cgit v1.2.3