Merge branch 'master' into linux
This commit is contained in:
commit
75a235e080
13
README.md
13
README.md
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
This is a specialized fork of [mkxp by Ancurio](https://github.com/Ancurio/mkxp) designed for [*OneShot*](http://oneshot-game.com/).
|
This is a specialized fork of [mkxp by Ancurio](https://github.com/Ancurio/mkxp) designed for [*OneShot*](http://oneshot-game.com/).
|
||||||
|
|
||||||
Thanks to [hunternet93](https://github.com/hunternet93) for the macOS and Linux [reimplementation of the journal program](https://github.com/hunternet93/OneShot-Journal)!
|
Thanks to [hunternet93](https://github.com/hunternet93) for starting the reimplementation of the journal program!
|
||||||
|
|
||||||
> mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
|
> mkxp is a project that seeks to provide a fully open source implementation of the Ruby Game Scripting System (RGSS) interface used in the popular game creation software "RPG Maker XP", "RPG Maker VX" and "RPG Maker VX Ace" (trademark by Enterbrain, Inc.), with focus on Linux. The goal is to be able to run games created with the above software natively without changing a single file.
|
||||||
>
|
>
|
||||||
|
|
@ -13,6 +13,7 @@ Thanks to [hunternet93](https://github.com/hunternet93) for the macOS and Linux
|
||||||
## Dependencies / Building
|
## Dependencies / Building
|
||||||
|
|
||||||
* Qt5
|
* Qt5
|
||||||
|
* CMake (macOS only)
|
||||||
* Boost.Unordered (headers only)
|
* Boost.Unordered (headers only)
|
||||||
* Boost.Program_options
|
* Boost.Program_options
|
||||||
* Boost.CRC
|
* Boost.CRC
|
||||||
|
|
@ -27,9 +28,9 @@ Thanks to [hunternet93](https://github.com/hunternet93) for the macOS and Linux
|
||||||
* pixman
|
* pixman
|
||||||
* zlib (only ruby bindings)
|
* zlib (only ruby bindings)
|
||||||
* OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`)
|
* OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`)
|
||||||
* Ruby (make sure to use 2.3 on macOS and Linux(?) due to a save formatting bug)
|
* Ruby (make sure to use 2.3 on macOS and Linux(?) due to a save formatting bug in newer versions)
|
||||||
* Python 3 (macOS/Linux journal reimplementation only)
|
* Python 3 (journal reimplementation only)
|
||||||
* PyQt5 (macOS/Linux journal reimplementation only)
|
* PyQt5 for Python 3 (journal reimplementation only)
|
||||||
|
|
||||||
*SyngleChance* employs Qt's qmake build system, so you'll need to install that beforehand. (The cmake build hasn't been maintained since the fork.)
|
*SyngleChance* employs Qt's qmake build system, so you'll need to install that beforehand. (The cmake build hasn't been maintained since the fork.)
|
||||||
|
|
||||||
|
|
@ -39,10 +40,10 @@ The exception is boost, which is weird in that it still hasn't managed to pull o
|
||||||
|
|
||||||
By default, *SyngleChance* switches into the directory where its binary is contained and then starts reading the configuration and resolving relative paths. In case this is undesired (eg. when the binary is to be installed to a system global, read-only location), it can be turned off by adding `DEFINES+=WORKDIR_CURRENT` to qmake's arguments.
|
By default, *SyngleChance* switches into the directory where its binary is contained and then starts reading the configuration and resolving relative paths. In case this is undesired (eg. when the binary is to be installed to a system global, read-only location), it can be turned off by adding `DEFINES+=WORKDIR_CURRENT` to qmake's arguments.
|
||||||
|
|
||||||
pkg-config will look for `ruby-2.2.pc`, but you can override the version with `MRIVERSION=2.3` ('2.3' being an example). This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit).
|
pkg-config will look for `ruby-2.3.pc`, but you can override the version with `MRIVERSION=2.5` ('2.5' being an example). This is the default binding, so no arguments to qmake needed (`BINDING=MRI` to be explicit).
|
||||||
|
|
||||||
### Supported image/audio formats
|
### Supported image/audio formats
|
||||||
These depend on the SDL auxiliary libraries. *SyngleChance* only makes use of png for images and oggvorbis/wav for audio.
|
These depend on the SDL auxiliary libraries. *SyngleChance* only makes use of bmp/png for images and oggvorbis/wav for audio.
|
||||||
|
|
||||||
To run *SyngleChance*, you should have a graphics card capable of at least **OpenGL (ES) 2.0** with an up-to-date driver installed.
|
To run *SyngleChance*, you should have a graphics card capable of at least **OpenGL (ES) 2.0** with an up-to-date driver installed.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
#else
|
#else
|
||||||
#define OS_LINUX
|
#define OS_LINUX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
@ -32,7 +34,7 @@ RB_METHOD(nikoStart)
|
||||||
SDL_VERSION(&syswindow.version);
|
SDL_VERSION(&syswindow.version);
|
||||||
SDL_GetWindowWMInfo(shState->rtData().window, &syswindow);
|
SDL_GetWindowWMInfo(shState->rtData().window, &syswindow);
|
||||||
|
|
||||||
#if defined _WIN32
|
#ifdef _WIN32
|
||||||
// Calculate where to stick the window
|
// Calculate where to stick the window
|
||||||
POINT pos;
|
POINT pos;
|
||||||
pos.x = NIKO_X;
|
pos.x = NIKO_X;
|
||||||
|
|
@ -50,36 +52,53 @@ RB_METHOD(nikoStart)
|
||||||
si.cb = sizeof(si);
|
si.cb = sizeof(si);
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
CreateProcessW(path, args, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
|
||||||
#elif defined LINUX
|
#else
|
||||||
// Calculate where to stick the window
|
// Calculate where to stick the window
|
||||||
int x, y; // Top-left area of client (hopefully)
|
int x, y; // Top-left area of client (hopefully)
|
||||||
SDL_GetWindowPosition(shState->rtData().window, &x, &y);
|
SDL_GetWindowPosition(shState->rtData().window, &x, &y);
|
||||||
x += NIKO_X;
|
x += NIKO_X;
|
||||||
y += NIKO_Y;
|
y += NIKO_Y;
|
||||||
char path[PATH_MAX];
|
|
||||||
ssize_t len = readlink("/proc/self/exe", path, PATH_MAX);
|
|
||||||
if (len > 0) {
|
|
||||||
// Replace filename
|
|
||||||
for (size_t i = len; i > 0; --i) {
|
|
||||||
if (path[i-1] == '/') {
|
|
||||||
strcpy(path + i, "_______");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// X and Y string arguments
|
|
||||||
char x_str[16];
|
char x_str[16];
|
||||||
char y_str[16];
|
char y_str[16];
|
||||||
sprintf(x_str, "%d", x);
|
sprintf(x_str, "%d", x);
|
||||||
sprintf(y_str, "%d", y);
|
sprintf(y_str, "%d", y);
|
||||||
// Assume that was a success and run the binary
|
|
||||||
|
char path[PATH_MAX];
|
||||||
|
std::string journal;
|
||||||
|
|
||||||
|
// Get current path
|
||||||
|
getcwd(path, sizeof(path));
|
||||||
|
|
||||||
|
#ifdef OS_OSX
|
||||||
|
journal = std::string(path) + std::string("/_______.app/Contents/MacOS/_______");
|
||||||
|
#else
|
||||||
|
journal = std::string(path) + std::string("_______");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Run the binary
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
execl(path, "_______", x_str, y_str, NULL);
|
execl(journal.c_str(), journal.c_str(), x_str, y_str, (char*)0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else
|
// ssize_t len = readlink("/proc/self/exe", path, PATH_MAX);
|
||||||
#error "not yet implemented"
|
// if (len > 0) {
|
||||||
|
// // Replace filename
|
||||||
|
// for (size_t i = len; i > 0; --i) {
|
||||||
|
// if (path[i-1] == '/') {
|
||||||
|
// strcpy(path + i, "_______");
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// // Run the binary
|
||||||
|
// pid_t pid = fork();
|
||||||
|
// if (pid == 0) {
|
||||||
|
// execl(path, "_______", x_str, y_str, (char*)0);
|
||||||
|
|
||||||
|
// exit(1);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
#endif
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os, sys, time
|
||||||
import sys
|
|
||||||
import time
|
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QEvent, QThread, pyqtSignal, QRect, QRectF, QTimer, QPoint
|
from PyQt5.QtCore import Qt, QEvent, QThread, pyqtSignal, QRect, QRectF, QTimer, QPoint
|
||||||
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget, QLabel
|
from PyQt5.QtWidgets import QApplication, QWidget, QDesktopWidget, QLabel
|
||||||
|
|
@ -34,6 +32,14 @@ class WatchPipe(QThread):
|
||||||
|
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
|
|
||||||
|
class AnimationTimer(QThread):
|
||||||
|
next_frame = pyqtSignal()
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
while True:
|
||||||
|
self.next_frame.emit()
|
||||||
|
time.sleep(1.0/60)
|
||||||
|
|
||||||
class Journal(QWidget):
|
class Journal(QWidget):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
@ -77,24 +83,37 @@ class Journal(QWidget):
|
||||||
|
|
||||||
class Niko(QWidget):
|
class Niko(QWidget):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.start_x, self.start_y = kwargs['start_x'], kwargs['start_y']
|
self.x, self.y, self.start_y, self.app, self.thread = kwargs['x'], kwargs['y'], kwargs['y'], kwargs['app'], kwargs['thread']
|
||||||
self.screen_width, self.screen_height = kwargs['screen_width'], kwargs['screen_height']
|
self.screen_width, self.screen_height = kwargs['screen_width'], kwargs['screen_height']
|
||||||
del kwargs['start_x'], kwargs['start_y'], kwargs['screen_width'], kwargs['screen_height']
|
del kwargs['x'], kwargs['y'], kwargs['screen_width'], kwargs['screen_height'], kwargs['app'], kwargs['thread']
|
||||||
|
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
|
self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
|
||||||
self.setAttribute(Qt.WA_TranslucentBackground)
|
self.setAttribute(Qt.WA_TranslucentBackground)
|
||||||
self.setMouseTracking(True)
|
|
||||||
self.setWindowTitle('')
|
self.setWindowTitle('')
|
||||||
self.setMinimumSize(self.screen_width, self.screen_height)
|
self.setMinimumSize(self.screen_width, self.screen_height)
|
||||||
self.setMaximumSize(self.screen_width, self.screen_height)
|
self.setMaximumSize(self.screen_width, self.screen_height)
|
||||||
self.setGeometry(0, 0, self.screen_width, self.screen_height)
|
self.setGeometry(self.x, self.y, self.x+48, self.y+64)
|
||||||
|
|
||||||
|
self.label = QLabel(self)
|
||||||
self.frames = [QPixmap(os.path.join(base_path, 'images', 'niko{}.png'.format(n))) for n in range(1,4)]
|
self.frames = [QPixmap(os.path.join(base_path, 'images', 'niko{}.png'.format(n))) for n in range(1,4)]
|
||||||
|
self.label.setPixmap(self.frames[1])
|
||||||
|
|
||||||
self.setBackgroundRole(QPalette.Base)
|
self.show()
|
||||||
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
|
||||||
|
self.thread.start()
|
||||||
|
|
||||||
|
def getFrame(self):
|
||||||
|
if ((self.y - self.start_y) % 32 >= 16): return 1
|
||||||
|
if ((self.y - self.start_y) % 64 >= 32): return 0
|
||||||
|
else: return 2
|
||||||
|
|
||||||
|
def update(self):
|
||||||
|
self.label.setPixmap(self.frames[self.getFrame()])
|
||||||
|
self.y += 2
|
||||||
|
self.setGeometry(self.x, self.y, self.x+48, self.y+64)
|
||||||
|
if self.y > self.screen_height: self.app.quit()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
@ -104,7 +123,11 @@ if __name__ == '__main__':
|
||||||
x, y = int(sys.argv[1]), int(sys.argv[2])
|
x, y = int(sys.argv[1]), int(sys.argv[2])
|
||||||
screensize = app.primaryScreen().size()
|
screensize = app.primaryScreen().size()
|
||||||
|
|
||||||
niko = Niko(start_x = x, start_y = y, screen_width = screensize.width(), screen_height = screensize.height())
|
thread = AnimationTimer()
|
||||||
|
|
||||||
|
niko = Niko(x = x, y = y, screen_width = screensize.width(), screen_height = screensize.height(), app = app, thread = thread)
|
||||||
|
|
||||||
|
thread.next_frame.connect(niko.update)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Author's Journal mode
|
# Author's Journal mode
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ set -e
|
||||||
cd `dirname $0`
|
cd `dirname $0`
|
||||||
|
|
||||||
# User-configurable variables
|
# User-configurable variables
|
||||||
mac_version="0.7.1"
|
mac_version="0.8.0"
|
||||||
make_threads=8
|
make_threads=8
|
||||||
ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot
|
ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,7 @@ Oneshot::Oneshot(RGSSThreadData &threadData) :
|
||||||
p->docsPath = path.c_str();
|
p->docsPath = path.c_str();
|
||||||
p->gamePath = path.c_str();
|
p->gamePath = path.c_str();
|
||||||
#ifdef OS_OSX
|
#ifdef OS_OSX
|
||||||
p->journal = "_______.app";
|
p->journal = "_______.app/Contents/MacOS/_______";
|
||||||
#elif defined OS_LINUX
|
#elif defined OS_LINUX
|
||||||
p->journal = "_______";
|
p->journal = "_______";
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue