Skip to content

Instantly share code, notes, and snippets.

@schamp

schamp/instructions.txt

Last active Aug 8, 2020
Embed
What would you like to do?
Patch solarus-quest-editor for retropie
# from scratch on retropi raspberry pi 4:
sudo apt-get install aptitude
sudo aptitude install build-essential cmake pkg-config libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libluajit-5.1-dev libphysfs-dev libopenal-dev libvorbis-dev libmodplug-dev qtbase5-dev qttools5-dev qttools5-dev-tools libglm-dev
# when it complains about dbus dependencies or something, choose to upgrade the package
wget (solarus-dev.zip) && unzip
wget (solarus-quest-editor-dev.zip) && unzip
cd solarus-dev && mkdir build && cd build
export SOLARUS=/home/pi/solarus
cmake .. -DCMAKE_INSTALL_PREFIX=$SOLARUS
make
make install
cd ../../solarus-quest-editor-dev && mkdir build && cd build
# apply all above patches
cmake .. -DSOLARUS_INCLUDE_DIR=$SOLARUS/include -DSOLARUS_LIBRARY=$SOLARUS/lib/arm-linux-gnueabihf/libsolarus.so -DSOLARUS_GUI_INCLUDE_DIR=$SOLARUS/gui/include -DSOLARUS_GUI_LIBRARY=$SOLARUS/lib/arm-linux-gnueabihf/libsolarus-gui.so -DCMAKE_INSTALL_PREFIX=/home/pi/solarus-quest-editor
make
make install
diff --git a/cmake/AddDefines.cmake b/cmake/AddDefines.cmake
index dd5db949..ac4239c7 100644
--- a/cmake/AddDefines.cmake
+++ b/cmake/AddDefines.cmake
@@ -3,4 +3,6 @@
add_definitions(-DSOLARUSEDITOR_SOURCE_PATH="${CMAKE_SOURCE_DIR}")
add_definitions(-DSOLARUSEDITOR_BINDIR_PATH="${CMAKE_INSTALL_PREFIX}/${SOLARUS_INSTALL_BINDIR}")
add_definitions(-DSOLARUSEDITOR_DATADIR_PATH="${CMAKE_INSTALL_PREFIX}/${SOLARUS_INSTALL_DATADIR}")
+add_definitions(-DSOLARUS_GL_ES=ON)
+add_definitions(-DANDROID=ON)
diff --git a/cmake/AddDependencies.cmake b/cmake/AddDependencies.cmake
index 51dc2006..fe862859 100644
--- a/cmake/AddDependencies.cmake
+++ b/cmake/AddDependencies.cmake
@@ -10,6 +10,8 @@ find_package(Qt5LinguistTools "5.7" REQUIRED)
find_package(SDL2 "2.0.6" REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
+find_package(OpenGL REQUIRED)
# SEEMS UNNECESSARY +find_package(GLM REQUIRED)
find_package(OpenAL REQUIRED)
find_package(VorbisFile REQUIRED)
find_package(Ogg REQUIRED)
diff --git a/cmake/AddEditorExecutable.cmake b/cmake/AddEditorExecutable.cmake
index d46f2b35..938fa9f9 100644
--- a/cmake/AddEditorExecutable.cmake
+++ b/cmake/AddEditorExecutable.cmake
@@ -13,6 +13,8 @@ target_link_libraries(solarus-quest-editor
"${SDL2_LIBRARY}"
"${SDL2_IMAGE_LIBRARY}"
"${SDL2_TTF_LIBRARY}"
# SEEMS UNNECESSARY + "${GLM_LIBRARIES}"
+ "${OPENGL_LIBRARIES}"
"${OPENAL_LIBRARY}"
"${LUA_LIBRARY}"
"${DL_LIBRARY}"
diff --git a/src/main.cpp b/src/main.cpp
index ec72d140..9e5ad043 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -28,6 +28,9 @@
// SDLmain is required in some platforms, i.e. Windows, for proper initialization.
// For instance, in Windows, SDLmain encodes argv in main() using UTF-8 by default.
+// schamp
+#define SDL_MAIN_HANDLED
+// /schamp
#include <SDL.h>
namespace SolarusEditor {
@@ -170,6 +173,8 @@ int run_quest(int argc, char* argv[]) {
*/
int main(int argc, char* argv[]) {
+ SDL_SetMainReady();
+ SDL_Init(SDL_INIT_VIDEO);
if (argc > 1 && QString(argv[1]) == "-run") {
// Quest run mode.
return SolarusEditor::run_quest(argc, argv);
@@ -178,4 +183,6 @@ int main(int argc, char* argv[]) {
// Editor GUI mode.
return SolarusEditor::run_editor_gui(argc, argv);
}
+ SDL_Quit();
+ return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.