termux-packages/x11-packages/the-powder-toy/03-saves-dir-path.patch

125 lines
4.7 KiB
Diff
Raw Normal View History

2020-03-08 19:43:50 +01:00
diff -uNr The-Powder-Toy-95.0/src/client/Client.cpp The-Powder-Toy-95.0.mod/src/client/Client.cpp
--- The-Powder-Toy-95.0/src/client/Client.cpp 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/client/Client.cpp 2020-03-08 20:36:18.935572466 +0200
@@ -67,7 +67,8 @@
2019-05-19 19:52:39 +02:00
{
//Read config
std::ifstream configFile;
- configFile.open("powder.pref", std::ios::binary);
+ MakeDirectory("@TERMUX_HOME@/.powdertoy");
+ configFile.open("@TERMUX_HOME@/.powdertoy/powder.pref", std::ios::binary);
if (configFile)
{
try
2020-03-08 19:43:50 +01:00
@@ -888,7 +889,8 @@
2019-05-19 19:52:39 +02:00
void Client::WritePrefs()
{
std::ofstream configFile;
- configFile.open("powder.pref", std::ios::trunc);
+ MakeDirectory("@TERMUX_HOME@/.powdertoy");
+ configFile.open("@TERMUX_HOME@/.powdertoy/powder.pref", std::ios::trunc);
if (configFile)
{
2020-03-08 19:43:50 +01:00
@@ -1066,6 +1068,7 @@
2019-05-19 19:52:39 +02:00
ByteString saveID = ByteString::Build(Format::Hex(Format::Width(lastStampTime, 8)), Format::Hex(Format::Width(lastStampName, 2)));
ByteString filename = STAMPS_DIR PATH_SEP + saveID + ".stm";
+ MakeDirectory("@TERMUX_HOME@/.powdertoy");
MakeDirectory(STAMPS_DIR);
Json::Value stampInfo;
2020-03-08 19:43:50 +01:00
@@ -1101,6 +1104,7 @@
2019-05-19 19:52:39 +02:00
void Client::updateStamps()
{
+ MakeDirectory("@TERMUX_HOME@/.powdertoy");
MakeDirectory(STAMPS_DIR);
std::ofstream stampsStream;
2020-03-08 19:43:50 +01:00
diff -uNr The-Powder-Toy-95.0/src/Config.h The-Powder-Toy-95.0.mod/src/Config.h
--- The-Powder-Toy-95.0/src/Config.h 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/Config.h 2020-03-08 20:36:18.935572466 +0200
2019-05-19 19:52:39 +02:00
@@ -61,11 +61,7 @@
#define IDENT_PLATFORM "WIN32"
#endif
#elif defined(LIN)
-#if defined(_64BIT)
-#define IDENT_PLATFORM "LIN64"
-#else
-#define IDENT_PLATFORM "LIN32"
-#endif
+#define IDENT_PLATFORM "TERMUX"
#elif defined(MACOSX)
#define IDENT_PLATFORM "MACOSX"
#else
2020-03-08 19:43:50 +01:00
@@ -91,11 +87,11 @@
2019-05-19 19:52:39 +02:00
#define STATICSERVER "static.powdertoy.co.uk"
2020-03-08 19:43:50 +01:00
#define ENFORCE_HTTPS
2019-05-19 19:52:39 +02:00
-#define LOCAL_SAVE_DIR "Saves"
+#define LOCAL_SAVE_DIR "@TERMUX_HOME@/.powdertoy/saves"
-#define STAMPS_DIR "stamps"
+#define STAMPS_DIR "@TERMUX_HOME@/.powdertoy/stamps"
-#define BRUSH_DIR "Brushes"
+#define BRUSH_DIR "@TERMUX_HOME@/.powdertoy/brushes"
2020-03-08 19:43:50 +01:00
#ifndef M_GRAV
#define M_GRAV 6.67300e-1
diff -uNr The-Powder-Toy-95.0/src/gui/game/GameController.cpp The-Powder-Toy-95.0.mod/src/gui/game/GameController.cpp
--- The-Powder-Toy-95.0/src/gui/game/GameController.cpp 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/gui/game/GameController.cpp 2020-03-08 20:37:59.986378271 +0200
@@ -774,7 +774,7 @@
2019-05-19 19:52:39 +02:00
#if !defined(MACOSX) && !defined(NO_INSTALL_CHECK)
if (Client::Ref().IsFirstRun())
{
- Install();
+ //Install();
}
#endif
firstTick = false;
2020-03-08 19:43:50 +01:00
@@ -1210,6 +1210,7 @@
2019-05-19 19:52:39 +02:00
gameSave->authors = localSaveInfo;
2020-03-08 19:43:50 +01:00
gameModel->SetSaveFile(&tempSave, gameView->ShiftBehaviour());
2019-05-19 19:52:39 +02:00
+ Client::Ref().MakeDirectory("@TERMUX_HOME@/.powdertoy");
Client::Ref().MakeDirectory(LOCAL_SAVE_DIR);
std::vector<char> saveData = gameSave->Serialise();
if (saveData.size() == 0)
2020-03-08 19:43:50 +01:00
diff -uNr The-Powder-Toy-95.0/src/gui/game/GameModel.cpp The-Powder-Toy-95.0.mod/src/gui/game/GameModel.cpp
--- The-Powder-Toy-95.0/src/gui/game/GameModel.cpp 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/gui/game/GameModel.cpp 2020-03-08 20:36:18.936572474 +0200
@@ -423,6 +423,7 @@
2019-05-19 19:52:39 +02:00
brushList.push_back(new TriangleBrush(ui::Point(4, 4)));
//Load more from brushes folder
+ Client::Ref().MakeDirectory("@TERMUX_HOME@/.powdertoy");
std::vector<ByteString> brushFiles = Client::Ref().DirectorySearch(BRUSH_DIR, "", ".ptb");
for (size_t i = 0; i < brushFiles.size(); i++)
{
2020-03-08 19:43:50 +01:00
diff -uNr The-Powder-Toy-95.0/src/gui/options/OptionsView.cpp The-Powder-Toy-95.0.mod/src/gui/options/OptionsView.cpp
--- The-Powder-Toy-95.0/src/gui/options/OptionsView.cpp 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/gui/options/OptionsView.cpp 2020-03-08 20:38:45.213738818 +0200
@@ -300,7 +300,7 @@
const char* openCommand = "xdg-open ";
2019-05-19 19:52:39 +02:00
#endif
2020-03-08 19:43:50 +01:00
char* workingDirectory = new char[FILENAME_MAX+strlen(openCommand)];
- sprintf(workingDirectory, "%s\"%s\"", openCommand, getcwd(NULL, 0));
+ sprintf(workingDirectory, "%s\"%s\"", openCommand, "@TERMUX_HOME@/.powdertoy");
system(workingDirectory);
delete[] workingDirectory;
} });
diff -uNr The-Powder-Toy-95.0/src/gui/save/LocalSaveActivity.cpp The-Powder-Toy-95.0.mod/src/gui/save/LocalSaveActivity.cpp
--- The-Powder-Toy-95.0/src/gui/save/LocalSaveActivity.cpp 2020-02-27 05:38:53.000000000 +0200
+++ The-Powder-Toy-95.0.mod/src/gui/save/LocalSaveActivity.cpp 2020-03-08 20:36:18.937572482 +0200
@@ -104,6 +104,7 @@
2019-05-19 19:52:39 +02:00
void LocalSaveActivity::saveWrite(ByteString finalFilename)
{
+ Client::Ref().MakeDirectory("@TERMUX_HOME@/.powdertoy");
Client::Ref().MakeDirectory(LOCAL_SAVE_DIR);
GameSave *gameSave = save.GetGameSave();
Json::Value localSaveInfo;