summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Base/home/anon/.config/Snake.ini3
-rw-r--r--Games/Chess/main.cpp25
-rw-r--r--Games/Minesweeper/main.cpp17
-rw-r--r--Games/Snake/main.cpp18
-rw-r--r--Games/Solitaire/main.cpp10
5 files changed, 73 insertions, 0 deletions
diff --git a/Base/home/anon/.config/Snake.ini b/Base/home/anon/.config/Snake.ini
new file mode 100644
index 0000000000..46fa3bb686
--- /dev/null
+++ b/Base/home/anon/.config/Snake.ini
@@ -0,0 +1,3 @@
+[Snake]
+HighScore=0
+
diff --git a/Games/Chess/main.cpp b/Games/Chess/main.cpp
index 5f2d7c6f41..f660e16df5 100644
--- a/Games/Chess/main.cpp
+++ b/Games/Chess/main.cpp
@@ -45,6 +45,31 @@ int main(int argc, char** argv)
RefPtr<Core::ConfigFile> config = Core::ConfigFile::get_for_app("Chess");
+ if (pledge("stdio rpath accept wpath cpath shared_buffer proc exec", nullptr) < 0) {
+ perror("pledge");
+ return 1;
+ }
+
+ if (unveil("/res", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil(config->file_name().characters(), "crw") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil("/bin/ChessEngine", "x") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil(nullptr, nullptr) < 0) {
+ perror("unveil");
+ return 1;
+ }
+
auto size = config->read_num_entry("Display", "size", 512);
window->set_title("Chess");
window->resize(size, size);
diff --git a/Games/Minesweeper/main.cpp b/Games/Minesweeper/main.cpp
index 386e94c329..389d735ae1 100644
--- a/Games/Minesweeper/main.cpp
+++ b/Games/Minesweeper/main.cpp
@@ -53,6 +53,23 @@ int main(int argc, char** argv)
return 1;
}
+ if (unveil("/res", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ auto config = Core::ConfigFile::get_for_app("Minesweeper");
+
+ if (unveil(config->file_name().characters(), "crw") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil(nullptr, nullptr) < 0) {
+ perror("unveil");
+ return 1;
+ }
+
auto app_icon = GUI::Icon::default_icon("app-minesweeper");
auto window = GUI::Window::construct();
diff --git a/Games/Snake/main.cpp b/Games/Snake/main.cpp
index 26b01aab28..f59818af4a 100644
--- a/Games/Snake/main.cpp
+++ b/Games/Snake/main.cpp
@@ -25,6 +25,7 @@
*/
#include "SnakeGame.h"
+#include <LibCore/ConfigFile.h>
#include <LibGUI/AboutDialog.h>
#include <LibGUI/Action.h>
#include <LibGUI/Application.h>
@@ -50,6 +51,23 @@ int main(int argc, char** argv)
return 1;
}
+ if (unveil("/res", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ auto config = Core::ConfigFile::get_for_app("Snake");
+
+ if (unveil(config->file_name().characters(), "crw") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil(nullptr, nullptr) < 0) {
+ perror("unveil");
+ return 1;
+ }
+
auto app_icon = GUI::Icon::default_icon("app-snake");
auto window = GUI::Window::construct();
diff --git a/Games/Solitaire/main.cpp b/Games/Solitaire/main.cpp
index 9f809ed0b7..741c08aaae 100644
--- a/Games/Solitaire/main.cpp
+++ b/Games/Solitaire/main.cpp
@@ -45,6 +45,16 @@ int main(int argc, char** argv)
return 1;
}
+ if (unveil("/res", "r") < 0) {
+ perror("unveil");
+ return 1;
+ }
+
+ if (unveil(nullptr, nullptr) < 0) {
+ perror("unveil");
+ return 1;
+ }
+
auto window = GUI::Window::construct();
window->set_resizable(false);