diff --git a/.gitignore b/.gitignore index 04acf7b..e0a43e9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,5 @@ OneShot .qmake.stash CMakeCache.txt CMakeFiles/ + +oclint/ diff --git a/CommonEvents.rxdata b/CommonEvents.rxdata new file mode 100644 index 0000000..417b2fc Binary files /dev/null and b/CommonEvents.rxdata differ diff --git a/README.md b/README.md index e4b9948..6976d00 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Thanks to [hunternet93](https://github.com/hunternet93) for starting the reimple > > It is licensed under the GNU General Public License v2+. -*OneShot* and *OneShot: Fragments of Providence* also make use of [steamshim](https://hg.icculus.org/icculus/steamshim/) for GPL compliance while making use of Steamworks features. See LICENSE.steamshim.txt for details. +*SyngleChance* also makes use of [steamshim](https://hg.icculus.org/icculus/steamshim/) for GPL compliance while making use of Steamworks features. See LICENSE.steamshim.txt for details. ## Dependencies / Building @@ -26,9 +26,8 @@ Thanks to [hunternet93](https://github.com/hunternet93) for starting the reimple * [Ancurio's SDL_sound fork](https://github.com/Ancurio/SDL_sound) * vorbisfile * pixman -* zlib (only ruby bindings) * OpenGL header (alternatively GLES2 with `DEFINES+=GLES2_HEADER`) -* Ruby (make sure to use 2.3 on macOS due to a save formatting bug in newer versions -- @Yummychickenblue reports this may not be an issue anymore) +* Ruby * Python 3 (journal reimplementation only) * PyQt5 for Python 3 (journal reimplementation only) diff --git a/binding-mri/journal-binding.cpp b/binding-mri/journal-binding.cpp index 2902f70..ed01539 100644 --- a/binding-mri/journal-binding.cpp +++ b/binding-mri/journal-binding.cpp @@ -72,12 +72,15 @@ int server_thread(void *data) } CloseHandle(pipe); #else - out_pipe = open(PIPE_PATH, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - active = true; - SDL_LockMutex(mutex); - if (message_len > 0) - write(out_pipe, (char*)message_buffer, message_len); - SDL_UnlockMutex(mutex); + 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); + SDL_LockMutex(mutex); + active = true; + if (message_len > 0) + write(out_pipe, (char*)message_buffer, message_len); + SDL_UnlockMutex(mutex); + } return 0; #endif } diff --git a/binding-mri/wallpaper-binding.cpp b/binding-mri/wallpaper-binding.cpp index b6327a7..d644a4d 100644 --- a/binding-mri/wallpaper-binding.cpp +++ b/binding-mri/wallpaper-binding.cpp @@ -1,3 +1,5 @@ +#include + #include "etc.h" #include "sharedstate.h" #include "binding-util.h" @@ -85,6 +87,7 @@ RB_METHOD(wallpaperSet) std::string path; #ifdef _WIN32 path = shState->config().gameFolder + "\\Wallpaper\\" + name + ".bmp"; + std::cout << "Setting wallpaper to " << path << std::endl; // Crapify the slashes size_t index = 0; for (;;) { @@ -159,6 +162,8 @@ end: } path = "/Wallpaper/" + nameFix + ".png"; + std::cout << "Setting wallpaper to " << path << std::endl; + #ifdef __APPLE__ if (!isCached) { MacDesktop::CacheCurrentBackground(); diff --git a/install.command b/install.command index 4f19c8b..2042d32 100755 --- a/install.command +++ b/install.command @@ -21,10 +21,13 @@ rm -f "$ONESHOT_PATH/Data/xScripts.rxdata" echo "-> ${cyan}Install OneShot apps to Steam directory...${color_reset}" cp -f "./xScripts.rxdata" "$ONESHOT_PATH/Data/xScripts.rxdata" +cp -f "./CommonEvents.rxdata" "$ONESHOT_PATH/Data/CommonEvents.rxdata" cp -rf "./OneShot.app" "$ONESHOT_PATH" cp -rf "./_______.app" "$ONESHOT_PATH" cp -R "./Graphics/" "$ONESHOT_PATH/Wallpaper" ln -sfh "$ONESHOT_PATH/OneShot.app" "$HOME/Applications/OneShot.app" +rm -f /tmp/oneshot-pipe # Important for pre-release version cleanup + echo "\n${green}Complete! ${white}Please report any issues to https://github.com/vinyldarkscratch/synglechance/issues${color_reset}" open "$ONESHOT_PATH" \ No newline at end of file diff --git a/journal/unix/journal.py b/journal/unix/journal.py index a9fd09b..8340c20 100644 --- a/journal/unix/journal.py +++ b/journal/unix/journal.py @@ -75,6 +75,7 @@ class Journal(QWidget): self.setMinimumSize(800, 600) self.setMaximumSize(800, 600) self.setGeometry(0, 0, 800, 600) + self.show() def mousePressEvent(self, event): @@ -162,12 +163,20 @@ if __name__ == '__main__': save.seek(-8, os.SEEK_END) lang = save.read().decode('utf-8') lang = lang[lang.find('[') + 1:lang.find(']')] - if lang == 'en_US': - lang = 'en' + if lang == 'en_US': lang = 'en' journal.change_image('save_' + lang) else: thread = WatchPipe() thread.change_image.connect(journal.change_image) thread.start() + pipe_file = open(pipe_path, "w+") + pipe_file.close() + app.exec_() + + try: + os.remove(pipe_path) + except: + # Most likely due to the file being in use. Ignore. + pass diff --git a/journal/unix/journal.spec b/journal/unix/journal.spec index 4210c18..d11bca3 100644 --- a/journal/unix/journal.spec +++ b/journal/unix/journal.spec @@ -22,7 +22,8 @@ exe = EXE(pyz, debug=False, strip=False, upx=True, - console=False ) + console=False, + icon='assets/icon_journal.ico') coll = COLLECT(exe, a.binaries, a.zipfiles, diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index f6b4ac1..749e565 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -4,7 +4,7 @@ set -e cd `dirname $0` # User-configurable variables -mac_version="0.8.0" +mac_version="1.0.0" make_threads=8 ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot @@ -19,7 +19,7 @@ echo "${white}Compiling ${bold}SyngleChance v${mac_version} ${white}engine for m # Generate makefile and build main + journal echo "-> ${cyan}Generate makefile...${color_reset}" -qmake MRIVERSION=2.3 +qmake MRIVERSION=2.5 echo "-> ${cyan}Compile engine...${color_reset}" make -j${make_threads} echo "-> ${cyan}Compile journal...${color_reset}" diff --git a/mkxp.pro b/mkxp.pro index ecb3513..e443981 100644 --- a/mkxp.pro +++ b/mkxp.pro @@ -33,7 +33,7 @@ contains(BINDING, NULL) { CONFIG += BINDING_NULL } -PKGCONFIG = sigc++-2.0 pixman-1 zlib sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile +PKGCONFIG = sigc++-2.0 pixman-1 zlib sdl2 SDL2_image SDL2_ttf openal SDL_sound vorbisfile unix { CONFIG += c++11 @@ -42,7 +42,7 @@ unix { macx: { INCLUDEPATH += $$QMAKE_MAC_SDK_PATH/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers LIBS += -framework OpenAL -framework AppKit - QMAKE_LFLAGS += -L/usr/local/opt/ruby@2.3/lib -L/usr/local/opt/openal-soft/lib + QMAKE_LFLAGS += -L/usr/local/opt/ruby/lib -L/usr/local/opt/openal-soft/lib HEADERS += src/mac-desktop.h SOURCES += src/mac-desktop.mm } diff --git a/oclint.sh b/oclint.sh new file mode 100755 index 0000000..895c463 --- /dev/null +++ b/oclint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +cd `dirname $0` +cd oclint + +oclint -report-type html -o report.html ../src/alstream.cpp ../src/audio.cpp ../src/audiostream.cpp ../src/autotiles.cpp ../src/bitmap.cpp ../src/config.cpp ../src/etc.cpp ../src/eventthread.cpp ../src/filesystem.cpp ../src/font.cpp ../src/gl-debug.cpp ../src/gl-fun.cpp ../src/gl-meta.cpp ../src/glstate.cpp ../src/graphics.cpp ../src/i18n.cpp ../src/input.cpp ../src/keybindings.cpp ../src/mac-desktop.mm ../src/main.cpp ../src/oneshot.cpp ../src/plane.cpp ../src/rgssad.cpp ../src/scene.cpp ../src/screen.cpp ../src/sdlsoundsource.cpp ../src/settingsmenu.cpp ../src/shader.cpp ../src/sharedstate.cpp ../src/soundemitter.cpp ../src/sprite.cpp ../src/steam.cpp ../src/table.cpp ../src/texpool.cpp ../src/tileatlas.cpp ../src/tilemap.cpp ../src/tilequad.cpp ../src/vertex.cpp ../src/viewport.cpp ../src/vorbissource.cpp ../src/window.cpp ../binding-mri/audio-binding.cpp ../binding-mri/binding-mri.cpp ../binding-mri/binding-util.cpp ../binding-mri/bitmap-binding.cpp ../binding-mri/chroma-binding.cpp ../binding-mri/etc-binding.cpp ../binding-mri/filesystem-binding.cpp ../binding-mri/font-binding.cpp ../binding-mri/graphics-binding.cpp ../binding-mri/input-binding.cpp ../binding-mri/journal-binding.cpp ../binding-mri/module_rpg.cpp ../binding-mri/niko-binding.cpp ../binding-mri/oneshot-binding.cpp ../binding-mri/plane-binding.cpp ../binding-mri/screen-binding.cpp ../binding-mri/sprite-binding.cpp ../binding-mri/steam-binding.cpp ../binding-mri/table-binding.cpp ../binding-mri/tilemap-binding.cpp ../binding-mri/viewport-binding.cpp ../binding-mri/wallpaper-binding.cpp ../binding-mri/window-binding.cpp -- -c -pipe -stdlib=libc++ -O2 -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DNDEBUG -DBINDING_MRI -D_THREAD_SAFE -I. -I. -Isrc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenAL.framework/Versions/A/Headers -I/usr/local/Cellar/libsigc++/2.10.0/include/sigc++-2.0 -I/usr/local/Cellar/libsigc++/2.10.0/lib/sigc++-2.0/include -I/usr/local/Cellar/pixman/0.34.0_1/include/pixman-1 -I/usr/local/include/SDL2 -I/usr/local/include -I/usr/local/include/AL -I/usr/local/Cellar/libvorbis/1.3.6/include -I/usr/local/Cellar/libogg/1.3.3/include -I/usr/local/Cellar/physfs/3.0.1/include -I/usr/local/Cellar/ruby/2.5.0_2/include/ruby-2.5.0/x86_64-darwin17 -I/usr/local/Cellar/ruby/2.5.0_2/include/ruby-2.5.0 -I/usr/local/Cellar/qt/5.10.1/mkspecs/macx-clang + diff --git a/scripts/Script.rb b/scripts/Script.rb index e9037b4..f3bbc5f 100644 --- a/scripts/Script.rb +++ b/scripts/Script.rb @@ -378,7 +378,7 @@ module Script begin if File.file?(Oneshot::JOURNAL) File.open(Oneshot::JOURNAL, "rb") do |input| - File.open(Oneshot::GAME_PATH + "/Oneshot/" + Oneshot::JOURNAL,"wb") do |output| + File.open(Oneshot::GAME_PATH + "/Oneshot/" + Oneshot::JOURNAL, "wb") do |output| while buff = input.read(4096) output.write(buff) end @@ -389,6 +389,8 @@ module Script end rescue Errno::EACCES => e #this probably means the clover.exe already exists and is running, so no need to create it again + rescue Errno::EEXIST => e + #this means that the journal file already exists, so no need to create it again end if File.exists?("README.txt") File.open("README.txt", "rb") do |input| @@ -448,6 +450,8 @@ module Script end rescue Errno::EACCES => e #this probably means the file already exists and is open, so no need to create it again + rescue Errno::EEXIST => e + #this probably means the file already exists, so no need to create it again end end diff --git a/src/oneshot.cpp b/src/oneshot.cpp index 2d2d347..ff4dd69 100644 --- a/src/oneshot.cpp +++ b/src/oneshot.cpp @@ -264,11 +264,11 @@ Oneshot::Oneshot(RGSSThreadData &threadData) : } // Get documents path - std::string path = std::string(getenv("HOME")) + std::string("/Documents"); //xdg_user_dir_lookup_with_fallback("Documents", getenv("HOME")); + std::string path = std::string(getenv("HOME")) + std::string("/Documents"); p->docsPath = path.c_str(); p->gamePath = path.c_str(); #ifdef OS_OSX - p->journal = "_______.app/Contents/MacOS/_______"; + p->journal = "_______.app"; #elif defined OS_LINUX p->journal = "_______"; #endif