1 |
commit: 6fea813162aac21d7794396946e56e33475981bd |
2 |
Author: Nicola Smaniotto <smaniotto.nicola <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Nov 8 12:07:43 2021 +0000 |
4 |
Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Nov 8 12:08:18 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=6fea8131 |
7 |
|
8 |
games-arcade/SpaceCadetPinball: new package (2.0) |
9 |
|
10 |
The patch enables loading files from user-writeable directories. |
11 |
|
12 |
Package-Manager: Portage-3.0.28, Repoman-3.0.3 |
13 |
Signed-off-by: Nicola Smaniotto <smaniotto.nicola <AT> gmail.com> |
14 |
|
15 |
games-arcade/SpaceCadetPinball/Manifest | 1 + |
16 |
.../SpaceCadetPinball/SpaceCadetPinball-2.0.ebuild | 37 ++++++++ |
17 |
...aceCadetPinball-2.0-respect-XDG_DATA_HOME.patch | 98 ++++++++++++++++++++++ |
18 |
games-arcade/SpaceCadetPinball/metadata.xml | 8 ++ |
19 |
4 files changed, 144 insertions(+) |
20 |
|
21 |
diff --git a/games-arcade/SpaceCadetPinball/Manifest b/games-arcade/SpaceCadetPinball/Manifest |
22 |
new file mode 100644 |
23 |
index 000000000..ae7dcfd5f |
24 |
--- /dev/null |
25 |
+++ b/games-arcade/SpaceCadetPinball/Manifest |
26 |
@@ -0,0 +1 @@ |
27 |
+DIST SpaceCadetPinball-2.0.tar.gz 933826 BLAKE2B b4a079ca856ebf315202eaae59a825d4c7022acfff7f38907ffd750f0e146da6d7c4f03286ef5c59ee5e3c725d938e30c2aad2f7269d9f18e8ae8f6807af80e1 SHA512 29b3f886d6ec6507c12a59b0c2877cbb51c54eee0163d0537588bb1e0fa0eb08b530d5684e8753598a823430559d5b3b9490be40ca9a3310043dac71912994c7 |
28 |
|
29 |
diff --git a/games-arcade/SpaceCadetPinball/SpaceCadetPinball-2.0.ebuild b/games-arcade/SpaceCadetPinball/SpaceCadetPinball-2.0.ebuild |
30 |
new file mode 100644 |
31 |
index 000000000..af9bc3d8d |
32 |
--- /dev/null |
33 |
+++ b/games-arcade/SpaceCadetPinball/SpaceCadetPinball-2.0.ebuild |
34 |
@@ -0,0 +1,37 @@ |
35 |
+# Copyright 1999-2021 Gentoo Authors |
36 |
+# Distributed under the terms of the GNU General Public License v2 |
37 |
+ |
38 |
+EAPI=8 |
39 |
+ |
40 |
+inherit cmake |
41 |
+ |
42 |
+DESCRIPTION="Decompilation of 3D Pinball for Windows - Space Cadet" |
43 |
+HOMEPAGE="https://github.com/k4zmu2a/SpaceCadetPinball" |
44 |
+SRC_URI="https://github.com/k4zmu2a/${PN}/archive/refs/tags/Release_${PV}.tar.gz -> ${P}.tar.gz" |
45 |
+ |
46 |
+LICENSE="MIT" |
47 |
+SLOT="0" |
48 |
+KEYWORDS="~amd64" |
49 |
+ |
50 |
+DEPEND=" |
51 |
+ media-libs/libsdl2 |
52 |
+ media-libs/sdl2-mixer[midi] |
53 |
+" |
54 |
+RDEPEND="${DEPEND}" |
55 |
+ |
56 |
+PATCHES=( |
57 |
+ "${FILESDIR}"/"${P}"-respect-XDG_DATA_HOME.patch |
58 |
+) |
59 |
+ |
60 |
+S="${WORKDIR}/${PN}-Release_${PV}" |
61 |
+ |
62 |
+src_install(){ |
63 |
+ dobin "${S}/bin/${PN}" |
64 |
+} |
65 |
+ |
66 |
+pkg_postinst(){ |
67 |
+ ewarn "This game is distributed without the data files." |
68 |
+ ewarn "To play, copy the original DAT and SOUND files from a Windows or" |
69 |
+ ewarn 'Full Tilt! installation and place them in $XDG_DATA_HOME/'"${PN}/" |
70 |
+ ewarn "(usually: ~/.local/share/${PN}/)" |
71 |
+} |
72 |
|
73 |
diff --git a/games-arcade/SpaceCadetPinball/files/SpaceCadetPinball-2.0-respect-XDG_DATA_HOME.patch b/games-arcade/SpaceCadetPinball/files/SpaceCadetPinball-2.0-respect-XDG_DATA_HOME.patch |
74 |
new file mode 100644 |
75 |
index 000000000..eed02d4c3 |
76 |
--- /dev/null |
77 |
+++ b/games-arcade/SpaceCadetPinball/files/SpaceCadetPinball-2.0-respect-XDG_DATA_HOME.patch |
78 |
@@ -0,0 +1,98 @@ |
79 |
+Enables support for loading the data files from outside the executable folder, |
80 |
+respecting the user $XDG_DATA_HOME variable if set. |
81 |
+Backport of commit ecdf802d68f9852150ac92f9737426c340fb64a3 by k4zmu2a. |
82 |
+Patch by Nicola Smaniotto. |
83 |
+ |
84 |
+diff --git a/SpaceCadetPinball/pb.cpp b/SpaceCadetPinball/pb.cpp |
85 |
+index 284ef7e..9fa7fb2 100644 |
86 |
+--- a/SpaceCadetPinball/pb.cpp |
87 |
++++ b/SpaceCadetPinball/pb.cpp |
88 |
+@@ -39,6 +39,8 @@ int pb::init() |
89 |
+ { |
90 |
+ float projMat[12], zMin = 0, zScaler = 0; |
91 |
+ |
92 |
++ if (winmain::DatFileName.empty()) |
93 |
++ return 1; |
94 |
+ auto dataFilePath = pinball::make_path_name(winmain::DatFileName); |
95 |
+ record_table = partman::load_records(dataFilePath.c_str(), FullTiltMode); |
96 |
+ |
97 |
+diff --git a/SpaceCadetPinball/winmain.cpp b/SpaceCadetPinball/winmain.cpp |
98 |
+index 1b9a4c6..5e4fa9c 100644 |
99 |
+--- a/SpaceCadetPinball/winmain.cpp |
100 |
++++ b/SpaceCadetPinball/winmain.cpp |
101 |
+@@ -36,7 +36,7 @@ bool winmain::ShowSpriteViewer = false; |
102 |
+ bool winmain::LaunchBallEnabled = true; |
103 |
+ bool winmain::HighScoresEnabled = true; |
104 |
+ bool winmain::DemoActive = false; |
105 |
+-char* winmain::BasePath; |
106 |
++std::string winmain::BasePath; |
107 |
+ int winmain::MainMenuHeight = 0; |
108 |
+ std::string winmain::FpsDetails; |
109 |
+ double winmain::UpdateToFrameRatio; |
110 |
+@@ -58,19 +58,44 @@ int winmain::WinMain(LPCSTR lpCmdLine) |
111 |
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Could not initialize SDL2", SDL_GetError(), nullptr); |
112 |
+ return 1; |
113 |
+ } |
114 |
+- BasePath = SDL_GetBasePath(); |
115 |
+ |
116 |
+ pinball::quickFlag = strstr(lpCmdLine, "-quick") != nullptr; |
117 |
+- DatFileName = options::get_string("Pinball Data", pinball::get_rc_string(168, 0)); |
118 |
+ |
119 |
+- /*Check for full tilt .dat file and switch to it automatically*/ |
120 |
+- auto cadetFilePath = pinball::make_path_name("CADET.DAT"); |
121 |
+- auto cadetDat = fopen(cadetFilePath.c_str(), "r"); |
122 |
+- if (cadetDat) |
123 |
++ // Search for game data in: game folder, user folder |
124 |
++ // Game data test order: CADET.DAT, PINBALL.DAT |
125 |
++ char* dataSearchPaths[2] |
126 |
+ { |
127 |
+- fclose(cadetDat); |
128 |
+- DatFileName = "CADET.DAT"; |
129 |
+- pb::FullTiltMode = true; |
130 |
++ SDL_GetBasePath(), |
131 |
++ SDL_GetPrefPath(nullptr, "SpaceCadetPinball") |
132 |
++ }; |
133 |
++ std::string datFileNames[2] |
134 |
++ { |
135 |
++ "CADET.DAT", |
136 |
++ options::get_string("Pinball Data", pinball::get_rc_string(168, 0)) |
137 |
++ }; |
138 |
++ for (auto path : dataSearchPaths) |
139 |
++ { |
140 |
++ if (DatFileName.empty() && path) |
141 |
++ { |
142 |
++ BasePath = path; |
143 |
++ for (int i = 0; i < 2; i++) |
144 |
++ { |
145 |
++ auto datFileName = datFileNames[i]; |
146 |
++ auto datFilePath = pinball::make_path_name(datFileName); |
147 |
++ auto datFile = fopen(datFilePath.c_str(), "r"); |
148 |
++ if (datFile) |
149 |
++ { |
150 |
++ fclose(datFile); |
151 |
++ DatFileName = datFileName; |
152 |
++ if (i == 0) |
153 |
++ pb::FullTiltMode = true; |
154 |
++ printf("Loading game from: %s\n", datFilePath.c_str()); |
155 |
++ break; |
156 |
++ } |
157 |
++ } |
158 |
++ } |
159 |
++ |
160 |
++ SDL_free(path); |
161 |
+ } |
162 |
+ |
163 |
+ // SDL window |
164 |
+diff --git a/SpaceCadetPinball/winmain.h b/SpaceCadetPinball/winmain.h |
165 |
+index eb32410..485232f 100644 |
166 |
+--- a/SpaceCadetPinball/winmain.h |
167 |
++++ b/SpaceCadetPinball/winmain.h |
168 |
+@@ -48,7 +48,7 @@ public: |
169 |
+ static bool LaunchBallEnabled; |
170 |
+ static bool HighScoresEnabled; |
171 |
+ static bool DemoActive; |
172 |
+- static char* BasePath; |
173 |
++ static std::string BasePath; |
174 |
+ static int MainMenuHeight; |
175 |
+ |
176 |
+ static int WinMain(LPCSTR lpCmdLine); |
177 |
|
178 |
diff --git a/games-arcade/SpaceCadetPinball/metadata.xml b/games-arcade/SpaceCadetPinball/metadata.xml |
179 |
new file mode 100644 |
180 |
index 000000000..cbe3c6a53 |
181 |
--- /dev/null |
182 |
+++ b/games-arcade/SpaceCadetPinball/metadata.xml |
183 |
@@ -0,0 +1,8 @@ |
184 |
+<?xml version="1.0" encoding="UTF-8"?> |
185 |
+<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'> |
186 |
+<pkgmetadata> |
187 |
+ <maintainer type="person"> |
188 |
+ <email>smaniotto.nicola@×××××.com</email> |
189 |
+ <name>Nicola Smaniotto</name> |
190 |
+ </maintainer> |
191 |
+</pkgmetadata> |