Linux changes (#62)

* Added RPATH to executable; lowercased name; fixed MRIVERSION option; made it look like an actual executable

* Silencing some compiler warnings

* Getting rid of journal binding header, fixing bugs with the Niko binding and synchronizing the two

* Journal update to fix several bugs

* Fix libpng warning by running mogrify on shrimp.png

* Improved automation of the Linux build

* Improved some aspects of wallpaper handling

* Bump default Ruby version to 2.5
This commit is contained in:
Pera Pisar 2019-04-21 12:50:20 +02:00 committed by Vinyl Darkscratch
parent d02a2162f4
commit 28face2167
21 changed files with 230 additions and 175 deletions

4
.gitignore vendored
View file

@ -29,6 +29,7 @@ __pycache__
/debug
/release
steamshim_parent/build/
*.out
object_script.*
rpgscript.bat
@ -41,7 +42,6 @@ oneshot_JA_2_ver3_checked.pot
oneshot_JA_Mariko1_WIP.pot
*.pot
xScripts.rxdata
OneShot
.qmake.stash
CMakeCache.txt
@ -55,4 +55,4 @@ package/
oclint/
steamworks/
steamworks/

View file

@ -239,7 +239,6 @@ set(BINDING_HEADERS
binding-mri/sceneelement-binding.h
binding-mri/viewportelement-binding.h
binding-mri/flashable-binding.h
binding-mri/journal-binding.h
)
set(BINDING_SOURCE
binding-mri/binding-mri.cpp

View file

@ -1,13 +1,20 @@
#include "journal-binding.h"
#include "binding-util.h"
#include "binding-types.h"
#include "pipe.h"
#include "debugwriter.h"
#include "i18n.h"
#include <SDL.h>
//OS-Specific code
#if defined _WIN32
#define OS_W32
#elif defined __APPLE__ || __linux__
#define LINUX
#ifdef __APPLE__
#define OS_OSX
#else
#define OS_LINUX
#endif
#ifdef LINUX
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
@ -15,12 +22,25 @@
#include <sys/inotify.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <cstdio>
#include <pwd.h>
#include <string>
#endif
std::string PIPE_PATH = std::string(getpwuid(getuid())->pw_dir) + "/.oneshot-pipe";
#include <SDL.h>
#define BUFFER_SIZE 256
static SDL_Thread *thread = NULL;
static SDL_mutex *mutex = NULL;
static volatile char lang_buffer[BUFFER_SIZE];
static volatile char message_buffer[BUFFER_SIZE];
static volatile bool active = false;
static volatile int message_len = 0;
#ifdef LINUX
static std::string PIPE_PATH = std::string(getpwuid(getuid())->pw_dir) + "/.oneshot-pipe";
static volatile int out_pipe = -1;
void cleanup_pipe()
{
unlink(PIPE_PATH.c_str());
@ -52,9 +72,8 @@ int server_thread(void *data)
}
CloseHandle(pipe);
#else
if (FILE *file = fopen(PIPE_PATH.c_str(), "r"))
if (access(PIPE_PATH.c_str(), F_OK) != -1)
{
fclose(file);
out_pipe = open(PIPE_PATH.c_str(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
SDL_LockMutex(mutex);
active = true;

View file

@ -1,48 +0,0 @@
#pragma once
#include "binding-util.h"
#include "binding-types.h"
#include "pipe.h"
#include "debugwriter.h"
#include "i18n.h"
#include <SDL.h>
//OS-Specific code
#if defined _WIN32
#define OS_W32
#elif defined __APPLE__ || __linux__
#define LINUX
#ifdef __APPLE__
#define OS_OSX
#else
#define OS_LINUX
#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef OS_LINUX
#include <sys/inotify.h>
#endif
#include <unistd.h>
#include <stdio.h>
#else
#error "Operating system not detected."
#endif
#define BUFFER_SIZE 256
static SDL_Thread *thread = NULL;
static SDL_mutex *mutex = NULL;
static volatile char lang_buffer[BUFFER_SIZE];
static volatile char message_buffer[BUFFER_SIZE];
static volatile bool active = false;
static volatile int message_len = 0;
#ifdef LINUX
static volatile int out_pipe = -1;
void cleanup_pipe();
#endif
int server_thread(void *data);

View file

@ -1,8 +1,8 @@
#include "binding-util.h"
#include "binding-types.h"
#include "sharedstate.h"
#include "eventthread.h"
#include "debugwriter.h"
#include "eventthread.h"
#if defined _WIN32
#define OS_W32
@ -22,7 +22,10 @@
#include <sys/inotify.h>
#endif
#include <unistd.h>
#include <stdio.h>
#include <cstdio>
#include <pwd.h>
#include <string>
#include <errno.h>
#endif
#include <SDL.h>
@ -42,12 +45,12 @@ static volatile bool active = false;
static volatile int message_len = 0;
#ifdef LINUX
#define PIPE_PATH "/tmp/oneshot-pipe"
static std::string NIKO_PIPE_PATH = std::string(getpwuid(getuid())->pw_dir) + "/.oneshot-niko-pipe";
static volatile int out_pipe = -1;
void niko_cleanup_pipe()
{
unlink(PIPE_PATH);
remove(PIPE_PATH);
unlink(NIKO_PIPE_PATH.c_str());
remove(NIKO_PIPE_PATH.c_str());
}
#endif
@ -75,9 +78,8 @@ int niko_server_thread(void *data)
}
CloseHandle(pipe);
#else
if (FILE *file = fopen(PIPE_PATH, "r")) {
fclose(file);
out_pipe = open(PIPE_PATH, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
if (access(NIKO_PIPE_PATH.c_str(), F_OK) != -1) {
out_pipe = open(NIKO_PIPE_PATH.c_str(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
SDL_LockMutex(mutex);
active = true;
if (message_len > 0)
@ -114,10 +116,10 @@ RB_METHOD(nikoPrepare)
#ifdef OS_OSX
journal = std::string(path) + "/_______.app/Contents/MacOS/_______";
#else
journal = std::string(path) + "_______";
journal = std::string(path) + "/_______";
#endif
// Run the binary
// Run the binary.
pid_t pid = fork();
if (pid == 0) {
execl(journal.c_str(), journal.c_str(), (char*)"niko", (char*)0);
@ -194,7 +196,7 @@ void nikoBindingInit()
{
mutex = SDL_CreateMutex();
#if defined __linux
mkfifo(PIPE_PATH, 0666);
mkfifo(NIKO_PIPE_PATH.c_str(), 0666);
atexit(niko_cleanup_pipe);
#endif

View file

@ -161,7 +161,7 @@
desktop = "kde_error";
}
} else {
fallbackPath = std::string(getenv("HOME")) + "/Desktop/hint.png";
fallbackPath = std::string(getenv("HOME")) + "/Desktop/ONESHOT_hint.png";
}
}
#endif
@ -353,6 +353,8 @@ end:
std::ifstream srcHint(gameDirStr + path);
std::ofstream dstHint(fallbackPath);
dstHint << srcHint.rdbuf();
srcHint.close();
dstHint.close();
}
#endif
#endif
@ -429,7 +431,7 @@ RB_METHOD(wallpaperReset)
"var data = {";
// Plugin, picture, color, mode, blur
for (auto const& x : defPlugins) {
command << "\"" + x.first + "\": {"
command << "\"" << x.first << "\": {"
<< "plugin: \"" << x.second << "\"";
if (defPictures.find(x.first) != defPictures.end()) {
std::string picture = defPictures[x.first];
@ -474,7 +476,7 @@ RB_METHOD(wallpaperReset)
Debug() << "Reset result:" << result;
} else {
if (remove(fallbackPath.c_str()) != 0) {
Debug() << "Failed to delete hint.png!";
Debug() << "Failed to delete:" << fallbackPath;
}
}
#endif
@ -494,8 +496,7 @@ void wallpaperBindingInit()
#ifdef __linux__
void wallpaperBindingTerminate()
{
// Clean up
// We assume Gio::Settings destructor will be automatically called
// Clean up.
if (desktop == "xfce") {
xfconf_shutdown();
}

View file

@ -15,7 +15,7 @@ rm -rf *.vcxproj.filters
rm -rf *.user
rm -rf _______.app
rm -rf OneShot.app
rm -rf OneShot
rm -rf oneshot
rm -rf conanbuildinfo.cmake
rm -rf CMakeFiles
rm -rf cmake_install.cmake
@ -30,4 +30,4 @@ then
make distclean
else
echo ""
fi
fi

View file

@ -6,63 +6,82 @@ from PyQt5.QtCore import Qt, QEvent, QThread, pyqtSignal, QRect, QRectF, QTimer,
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget, QLabel
from PyQt5.QtGui import QIcon, QPixmap, QPainter
if sys.platform == "win32":
pipe_path = '\\\\.\\pipe\\oneshot-journal-to-game'
import ctypes.wintypes
buff = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, buf)
documents_path = os.path.join(buf.value, 'My Games')
else:
pipe_path = os.path.expanduser('~/.oneshot-pipe')
documents_path = os.path.expanduser('~/Documents')
def get_documents_path():
if sys.platform == 'win32':
import ctypes.wintypes
buff = ctypes.create_unicode_buffer(ctypes.wintypes.MAX_PATH)
ctypes.windll.shell32.SHGetFolderPathW(None, CSIDL_PERSONAL, None, SHGFP_TYPE_CURRENT, buf)
return os.path.join(buf.value, 'My Games')
else:
return os.path.expanduser('~/Documents')
def get_pipe_path(mode='journal'):
if sys.platform == 'win32':
return '\\\\.\\pipe\\oneshot-journal-to-game'
else:
if mode == 'niko':
return os.path.expanduser('~/.oneshot-niko-pipe')
return os.path.expanduser('~/.oneshot-pipe')
left_close = False
if sys.platform == "darwin": left_close = True
if sys.platform == 'darwin': left_close = True
try: base_path = sys._MEIPASS
except AttributeError: base_path = os.path.abspath('.')
class WatchPipe(QThread):
class PipeThread(QThread):
def __init__(self, *args, **kwargs):
self.pipe = kwargs['pipe']
del kwargs['pipe']
super().__init__(*args, **kwargs)
class WatchPipe(PipeThread):
change_image = pyqtSignal(str)
def run(self):
while True:
while not os.path.exists(pipe_path): time.sleep(0.1)
self.change_image.emit('default_en')
while not os.path.exists(self.pipe): time.sleep(0.1)
pipe = open(pipe_path, 'r')
pipe = open(self.pipe, 'r')
pipe.flush()
was_nonzero = False
was_nondefault = False
while os.path.exists(pipe_path): # Make sure the file still exists and wasn't cleaned up by SyngleChance
while os.path.exists(self.pipe): # Make sure the file still exists and wasn't cleaned up by SyngleChance
message = os.read(pipe.fileno(), 256)
if len(message) > 0:
was_nonzero = True
self.change_image.emit(message.decode())
m = message.decode()
if m != 'default_en':
was_nondefault = True
self.change_image.emit(m)
else:
st = os.stat(pipe_path)
if st.st_size == 0 and was_nonzero:
self.change_image.emit("CLOSE")
try:
st = os.stat(self.pipe)
if st.st_size == 0 and was_nondefault:
self.change_image.emit('CLOSE')
except FileNotFoundError:
pass
time.sleep(0.05)
class AnimationTimer(QThread):
class AnimationTimer(PipeThread):
next_frame = pyqtSignal()
start_animation = pyqtSignal(int, int)
def run(self):
while True:
while not os.path.exists(pipe_path): time.sleep(0.1)
while not os.path.exists(self.pipe): time.sleep(0.1)
pipe = open(pipe_path, 'r')
pipe = open(self.pipe, 'r')
pipe.flush()
while os.path.exists(pipe_path): # Make sure the file still exists and wasn't cleaned up by SyngleChance
while os.path.exists(self.pipe): # Make sure the file still exists and wasn't cleaned up by SyngleChance
message = os.read(pipe.fileno(), 256)
if len(message) > 0:
m = message.decode()
if not "," in m: pass
x, y = m.split(",")
if not ',' in m: pass
x, y = m.split(',')
self.start_animation.emit(int(x), int(y))
while True:
@ -82,7 +101,6 @@ class Journal(QWidget):
self.mousedownpos = QPoint(0, 0)
self.label = QLabel(self)
self.change_image('default_en')
self.close_label = QLabel(self)
self.close_label.setPixmap(QPixmap(os.path.join(base_path, 'images', 'close.png')))
@ -90,7 +108,9 @@ class Journal(QWidget):
self.close_button = True
if "linux" in sys.platform: self.setWindowFlags(Qt.FramelessWindowHint)
self.change_image('default_en')
if 'linux' in sys.platform: self.setWindowFlags(Qt.FramelessWindowHint)
else: self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setMouseTracking(True)
@ -118,21 +138,24 @@ class Journal(QWidget):
self.setGeometry(frameGm.x() + pos.x() - self.mousedownpos.x(), frameGm.y() + pos.y() - self.mousedownpos.y(), 800, 600)
def change_image(self, image):
if image == "CLOSE":
if image == 'CLOSE':
self.app.quit()
return
if not "_" in image: return
if not '_' in image: return
name, lang = image.split('_', 1)
if name != "default":
if name == 'default' or name == 'save' or name == 'final':
self.close_label.show()
self.close_button = True
else:
self.close_label.hide()
self.close_button = False
if lang == 'en': img = os.path.join(base_path, 'images', '{}.png'.format(name))
else: img = os.path.join(base_path, 'images', lang.upper(), '{}.png'.format(name))
if not os.path.exists(img): return
self.pixmap = QPixmap(img)
self.label.setPixmap(self.pixmap)
@ -179,9 +202,10 @@ class Niko(QWidget):
if __name__ == '__main__':
app = QApplication(sys.argv)
if len(sys.argv) == 2 and sys.argv[1] == "niko":
# "Niko-leaves-the-screen" mode
thread = AnimationTimer()
default_pipe_path = get_pipe_path()
if len(sys.argv) == 2 and sys.argv[1] == 'niko':
# "Niko-leaves-the-screen" mode.
thread = AnimationTimer(pipe = get_pipe_path('niko'))
niko = Niko(screen_height = app.primaryScreen().size().height(), app = app, thread = thread)
@ -190,9 +214,9 @@ if __name__ == '__main__':
thread.start()
else:
# Author's Journal mode
# Author's Journal mode.
journal = Journal(app = app)
save_path = os.path.join(documents_path, 'Oneshot', 'save_progress.oneshot')
save_path = os.path.join(get_documents_path(), 'Oneshot', 'save_progress.oneshot')
if os.path.exists(save_path):
with open(save_path, 'rb') as save:
save.seek(-8, os.SEEK_END)
@ -201,17 +225,18 @@ if __name__ == '__main__':
if lang == 'en_US': lang = 'en'
journal.change_image('save_' + lang)
else:
thread = WatchPipe()
thread = WatchPipe(pipe = default_pipe_path)
thread.change_image.connect(journal.change_image)
thread.start()
pipe_file = open(pipe_path, "w+")
pipe_file.close()
if not os.path.exists(default_pipe_path):
pipe_file = open(default_pipe_path, 'w+')
pipe_file.close()
app.exec_()
try:
os.remove(pipe_path)
os.remove(default_pipe_path)
except:
# Most likely due to the file being in use. Ignore.
# Most likely due to the file being in use, ignore.
pass

13
libraries.rb Normal file
View file

@ -0,0 +1,13 @@
#!/usr/bin/ruby
#encoding: utf-8
require 'fileutils'
line = gets
files = []
while line
if line =~ / => (\/.*) \(/
files << $1
end
line = gets
end
FileUtils.cp(files, 'libs')

View file

@ -3,50 +3,75 @@ set -e
cd `dirname $0`
# User-configurable variables
# User-configurable variables.
linux_version="0.1.0"
make_threads=8
ONESHOT_PATH=$HOME/.steam/steam/steamapps/common/OneShot
STEAMWORKS_PATH=/usr/steamworks
oneshot_id=420530
ONESHOT_PATH=$HOME/.local/share/Steam/steamapps/common/OneShot
STEAMWORKS_PATH=$(realpath ..)/steamworks
# Colors
# Colors.
white="\033[0;37m" # White - Regular
bold="\033[1;37m" # White - Bold
cyan="\033[1;36m" # Cyan - Bold
green="\033[1;32m" # Green - Bold
color_reset="\033[0m" # Reset Colors
echo "${white}Compiling ${bold}SyngleChance v${linux_version} ${white}engine for Linux...${color_reset}\n"
echo -e "${white}Compiling ${bold}SyngleChance v${linux_version} ${white}engine for Linux...${color_reset}\n"
# Generate makefile and build main + journal
echo "-> ${cyan}Generate makefile...${color_reset}"
qmake -qt=5
echo "-> ${cyan}Compile engine...${color_reset}"
make -j${make_threads}
echo "-> ${cyan}Compile steamshim...${color_reset}"
# Generate makefile.
echo -e "-> ${cyan}Generate makefile...${color_reset}"
export MRIVERSION=$(echo "puts RUBY_VERSION.split('.').slice(0, 2).join('.')" | ruby)
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
qmake mkxp.pro > oneshot.qmake.out
# Compile OneShot.
echo -e "-> ${cyan}Compile engine...${color_reset}"
make -j${make_threads} > oneshot.make.out
# Compile steamshim.
echo -e "-> ${cyan}Compile steamshim...${color_reset}"
cd steamshim_parent
mkdir build && cd build
cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} ..
make -j${make_threads}
mkdir build
cd build
cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. > steamshim.cmake.out
cp "$STEAMWORKS_PATH/redistributable_bin/linux64/libsteam_api.so" .
make -j${make_threads} > steamshim.make.out
cd ../..
echo "-> ${cyan}Compile journal...${color_reset}"
pyinstaller journal/unix/journal.spec --onefile --windowed
# Set version number
echo "-> ${cyan}Set version number...${color_reset}"
# Compile Journal.
echo -e "-> ${cyan}Compile journal...${color_reset}"
pyinstaller journal/unix/journal.spec --windowed
# Compile scripts
echo "-> ${cyan}Compile xScripts.rxdata...${color_reset}"
ruby rpgscript.rb ./scripts "$ONESHOT_PATH"
# Compile scripts.
echo -e "-> ${cyan}Compile xScripts.rxdata...${color_reset}"
ruby rpgscript.rb ./scripts "$ONESHOT_PATH" > rpgscript.out
echo "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}"
cp -rf "./OneShot" "$ONESHOT_PATH"
cp -rf "./dist/_______" "$ONESHOT_PATH"
# Copy results.
echo -e "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}"
yes | cp -r dist/_______/* "$ONESHOT_PATH"
yes | cp oneshot "$ONESHOT_PATH"
yes | cp steamshim_parent/build/steamshim "$ONESHOT_PATH"
echo "$oneshot_id" > "$ONESHOT_PATH/steam_appid.txt"
# Cleanup
echo "-> ${cyan}Cleanup files...${color_reset}"
# Copy libraries.
echo -e "-> ${cyan}Install OneShot libraries to Steam directory...${color_reset}"
mkdir libs
ldd oneshot | ruby libraries.rb
ldd steamshim_parent/build/steamshim | ruby libraries.rb
yes | cp libs/* "$ONESHOT_PATH"
# Cleanup.
echo -e "-> ${cyan}Cleanup files...${color_reset}"
rm -rf journal/unix/__pycache__
rm -rf build
rm -rf dist
rm -rf steamshim_parent/build
rm -rf libs
make clean > clean.out
rm -f *.out
rm Makefile
rm oneshot
rm .qmake.stash
echo "\n${green}Complete! ${white}Please report any issues to https://github.com/GooborgStudios/synglechance/issues${color_reset}"
echo -e "\n${green}Complete! ${white}Please report any issues to https://github.com/GooborgStudios/synglechance/issues${color_reset}"

View file

@ -2,7 +2,7 @@
TEMPLATE = app
QT =
TARGET = OneShot
TARGET = oneshot
DEPENDPATH += src shader assets
INCLUDEPATH += . src
@ -47,10 +47,14 @@ unix {
SOURCES += src/mac-desktop.mm
}
!macx: {
QMAKE_CXXFLAGS += -g
CONFIG(debug, debug|release) {
QMAKE_CXXFLAGS += -g
}
PKGCONFIG += gtk+-3.0 gdk-3.0 libxfconf-0
INCLUDEPATH += /usr/include/AL /usr/local/include/AL
LIBS += -lX11
QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN\'"
QMAKE_LFLAGS += -no-pie
}
}
@ -245,8 +249,9 @@ BINDING_NULL {
}
BINDING_MRI {
MRIVERSION = $$(MRIVERSION)
isEmpty(MRIVERSION) {
MRIVERSION = 2.3
MRIVERSION = 2.5
}
PKGCONFIG += ruby-$$MRIVERSION
@ -267,8 +272,7 @@ BINDING_MRI {
binding-mri/disposable-binding.h \
binding-mri/sceneelement-binding.h \
binding-mri/viewportelement-binding.h \
binding-mri/flashable-binding.h \
binding-mri/journal-binding.h
binding-mri/flashable-binding.h
SOURCES += \
binding-mri/binding-mri.cpp \

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View file

@ -223,6 +223,7 @@ inline ALenum chooseALFormat(int sampleSize, int channelCount)
case 1 : return AL_FORMAT_MONO8;
case 2 : return AL_FORMAT_STEREO8;
}
/* falls through */
case 2 :
switch (channelCount)
{

View file

@ -253,8 +253,6 @@ struct RGSSThreadData
UnidirMessage<BDescVec> bindingUpdateMsg;
SyncPoint syncPoint;
const char *argv0;
SDL_Window *window;
ALCdevice *alcDev;
@ -269,14 +267,12 @@ struct RGSSThreadData
int inputTextLimit;
RGSSThreadData(EventThread *ethread,
const char *argv0,
SDL_Window *window,
ALCdevice *alcDev,
int refreshRate,
const Config& newconf)
: allowExit(true),
ethread(ethread),
argv0(argv0),
window(window),
alcDev(alcDev),
sizeResoRatio(1, 1),

View file

@ -312,8 +312,7 @@ struct FileSystemPrivate
bool havePathCache;
};
FileSystem::FileSystem(const char *argv0,
bool allowSymlinks)
FileSystem::FileSystem(bool allowSymlinks)
{
p = new FileSystemPrivate;
p->havePathCache = false;

View file

@ -30,8 +30,7 @@ class SharedFontState;
class FileSystem
{
public:
FileSystem(const char *argv0,
bool allowSymlinks);
FileSystem(bool allowSymlinks);
~FileSystem();
void addPath(const char *path);

View file

@ -231,7 +231,7 @@ int main(int argc, char *argv[])
}
#endif
/* Initialize physfs here so that config can call PHYSFS_getPrefDir */
/* Initialize physfs here so that config can call PHYSFS_getPrefDir */
PHYSFS_init(argv[0]);
/* now we load the config */
@ -329,7 +329,7 @@ int main(int argc, char *argv[])
conf.syncToRefreshrate = false;
EventThread eventThread;
RGSSThreadData rtData(&eventThread, argv[0], win,
RGSSThreadData rtData(&eventThread, win,
alcDev, mode.refresh_rate, conf);
#ifndef STEAM

View file

@ -310,6 +310,8 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
desktopEnv = "deepin";
}
}
Debug() << "Desktop env :" << desktopEnv;
#endif
/********

View file

@ -1255,6 +1255,7 @@ bool SettingsMenu::onEvent(const SDL_Event &event,
default:
break;
}
break;
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERAXISMOTION:

View file

@ -96,7 +96,7 @@ struct SharedStatePrivate
SharedStatePrivate(RGSSThreadData *threadData)
: bindingData(0),
sdlWindow(threadData->window),
fileSystem(threadData->argv0, threadData->config.allowSymlinks),
fileSystem(threadData->config.allowSymlinks),
eThread(*threadData->ethread),
rtData(*threadData),
config(threadData->config),

View file

@ -1,18 +1,35 @@
add_executable(steamshim WIN32
steamshim_parent.cpp)
cmake_minimum_required(VERSION 2.8.11)
target_compile_definitions(steamshim PRIVATE
-DGAME_LAUNCH_NAME="oneshot")
set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../steamworks" CACHE PATH "Path to Steamworks folder")
set(GAME_LAUNCH_NAME "oneshot" CACHE STRING "Game launch name")
option(DEBUG "Debug mode" OFF)
if(DEBUG)
target_compile_definitions(steamshim PRIVATE
-DSTEAMSHIM_DEBUG)
endif()
set(SOURCES
steamshim_parent.cpp
)
if(WIN32)
target_sources(steamshim PRIVATE
resources.rc)
endif()
include_directories(${STEAMWORKS_PATH}/public)
target_link_libraries(steamshim PRIVATE
CONAN_PKG::steamworks)
add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}")
IF(DEBUG)
add_definitions(-DSTEAMSHIM_DEBUG)
ENDIF()
IF(APPLE)
find_library(steamworks NAMES steam_api steam_api64 PATHS ${STEAMWORKS_PATH}/redistributable_bin/osx32)
ELSEIF(WIN32)
list(APPEND SOURCES resources.rc)
find_library(steamworks NAMES steam_api steam_api64 PATHS ${STEAMWORKS_PATH}/redistributable_bin/win64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows")
ELSEIF(UNIX AND NOT APPLE)
find_library(steamworks NAMES steam_api steam_api64 PATHS ${STEAMWORKS_PATH}/redistributable_bin/linux64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64")
ENDIF()
add_executable(steamshim
${SOURCES}
)
set_target_properties(steamshim PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN -no-pie")
target_link_libraries(steamshim ${steamworks})