From 5ea165cb367cd03bbfc9759fd0c63302f5682ca8 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:14:23 -0700 Subject: [PATCH 01/27] Convert Steamshim Makefile to CMake --- .gitignore | 2 ++ cleanup.sh | 2 +- make-oneshot-linux.sh | 7 +++-- make-oneshot-mac.command | 9 ++++-- steamshim_parent/CMakeLists.txt | 34 +++++++++++++++++++++ steamshim_parent/{Makefile => old.Makefile} | 0 6 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 steamshim_parent/CMakeLists.txt rename steamshim_parent/{Makefile => old.Makefile} (100%) diff --git a/.gitignore b/.gitignore index dd50cdb..d85ad8a 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,5 @@ conan_imports_manifest\.txt package/ oclint/ + +steamshim_parent/build/ diff --git a/cleanup.sh b/cleanup.sh index 162189c..ff743e3 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -1,7 +1,7 @@ #!/bin/sh rm -rf journal/mac/__pycache__ -rm -rf steamshim_parent/steamshim +rm -rf steamshim_parent/build rm -rf build rm -rf dist rm -rf _______.app diff --git a/make-oneshot-linux.sh b/make-oneshot-linux.sh index a6e8ce7..d4adede 100755 --- a/make-oneshot-linux.sh +++ b/make-oneshot-linux.sh @@ -7,6 +7,7 @@ cd `dirname $0` linux_version="0.1.0" make_threads=8 ONESHOT_PATH=$HOME/.steam/steam/steamapps/common/OneShot +STEAMWORKS_PATH=/usr/steamworks # Colors white="\033[0;37m" # White - Regular @@ -24,8 +25,10 @@ echo "-> ${cyan}Compile engine...${color_reset}" make -j${make_threads} echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent -HOST=linux64 make -j${make_threads} -cd .. +mkdir build && cd build +cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. +make -j${make_threads} +cd ../.. echo "-> ${cyan}Compile journal...${color_reset}" pyinstaller journal/unix/journal.spec --onefile --windowed diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index d98d1fc..9eecc45 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -7,6 +7,7 @@ cd `dirname $0` mac_version="1.1.0" make_threads=8 ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot +STEAMWORKS_PATH=$HOME/Developer/downloaded/steamworks # Colors white="\033[0;37m" # White - Regular @@ -28,8 +29,10 @@ if [[ $use_qmake == True ]] make -j${make_threads} echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent - HOST=osx make -j${make_threads} - cd .. + mkdir build && cd build + cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. + make -j${make_threads} + cd ../.. else echo "${bold}WARNING: Conan/CMake method not ready yet.${color_reset}" fi @@ -54,7 +57,7 @@ if [ ! -e $ResourcesDir ] mkdir -p "$ResourcesDir" fi -cp steamshim_parent/steamshim ./OneShot.app/Contents/Resources/steamshim +cp steamshim_parent/build/steamshim ./OneShot.app/Contents/Resources/steamshim cp patches/mac/libsteam_api.dylib ./OneShot.app/Contents/Libraries/libsteam_api.dylib cmake -P patches/mac/CompleteBundle.cmake cp assets/icon.icns ./OneShot.app/Contents/Resources/icon.icns diff --git a/steamshim_parent/CMakeLists.txt b/steamshim_parent/CMakeLists.txt new file mode 100644 index 0000000..cbc3a4e --- /dev/null +++ b/steamshim_parent/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8.11) + +set(STEAMWORKS_PATH "" CACHE PATH "Path to Steamworks folder") +set(GAME_LAUNCH_NAME "oneshot" CACHE STRING "Game launch name") +option(DEBUG "Debug mode" OFF) + +set(SOURCES + steamshim_parent.cpp +) + +include_directories(${STEAMWORKS_PATH}/public) + +add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + +IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) +ENDIF() + +IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) +ELSEIF(WIN32) + list(APPEND SOURCES resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") +ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +ENDIF() + +add_executable(steamshim + ${SOURCES} +) + +target_link_libraries(steamshim steam_api) diff --git a/steamshim_parent/Makefile b/steamshim_parent/old.Makefile similarity index 100% rename from steamshim_parent/Makefile rename to steamshim_parent/old.Makefile From 734f6349952bb2488cdfb77a015d3217b0e56a7e Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:18:33 -0700 Subject: [PATCH 02/27] Update macOS deployment target --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 018b32f..59a31db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) # SET(LINUX ON) # ENDIF() -# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12) # IF(LINUX) # if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT(FORCE32) ) From 31dcb7f904edd35d51b6ec36b4d8e72581a6e674 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:27:26 -0700 Subject: [PATCH 03/27] Add bundle fixup --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59a31db..7ca1ed9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,3 +303,7 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32 target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES}) target_include_directories(${PROJECT_NAME} PRIVATE src) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBRARIES}) + +IF(APPLE) + add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) +ENDIF() From a13dead8cfb1e3ddfb42402cd33a8c33230e9e8a Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:27:34 -0700 Subject: [PATCH 04/27] Add macOS desktop code --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ca1ed9..b86ae53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -154,6 +154,9 @@ if(WIN32) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/windows ) +elseif(APPLE) + list(APPEND MAIN_HEADERS src/mac-desktop.h) + list(APPEND MAIN_SOURCE src/mac-desktop.mm) endif() if (STEAM) From 03326cb96d26ebcb5335d8a90016d482652ff91a Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Fri, 5 Oct 2018 18:38:46 -0700 Subject: [PATCH 05/27] Cleanup XXD files --- cleanup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cleanup.sh b/cleanup.sh index ff743e3..7b8b122 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -13,6 +13,7 @@ rm -rf cmake_install.cmake rm -rf CMakeCache.txt rm -rf conanbuildinfo.txt rm -rf conaninfo.txt +rm -rf *.xxd if [ -f .qmake.stash ] then make distclean From e599cc1c541b6a18448dfdf3c6ca58f272e82c78 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:17:03 -0700 Subject: [PATCH 06/27] Merge Steamshim CMake into master CMake --- CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b86ae53..3f4319e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,8 @@ conan_basic_setup() ## Setup options ## option(STEAM "Build for Steam" ON) +set(STEAMWORKS_PATH "${CMAKE_BINARY_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") +option(DEBUG "Debug mode" OFF) ## Misc setup ## @@ -310,3 +312,34 @@ target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBRARIES}) IF(APPLE) add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) ENDIF() + +# Steamshim + +set(STEAMSHIM_SOURCES + steamshim_parent/steamshim_parent.cpp +) + +include_directories(${STEAMWORKS_PATH}/public) + +add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + +IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) +ENDIF() + +IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) +ELSEIF(WIN32) + list(APPEND STEAMSHIM_SOURCES resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") +ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") +ENDIF() + +add_executable(steamshim + ${STEAMSHIM_SOURCES} +) + +target_link_libraries(steamshim steam_api) From 8f473733e66bf954dd52079d342902ae5a4015b1 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:18:27 -0700 Subject: [PATCH 07/27] Ignore Steamworks folder --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d85ad8a..9db0bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,5 @@ package/ oclint/ steamshim_parent/build/ + +steamworks/ From a86b1d8d29f63d7e51311a2293f47ee66a3e017d Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:21:00 -0700 Subject: [PATCH 08/27] Fix Steamshim path --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3f4319e..6c54da5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,8 +330,8 @@ ENDIF() IF(APPLE) link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) ELSEIF(WIN32) - list(APPEND STEAMSHIM_SOURCES resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin) + list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") ELSEIF(LINUX) link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) @@ -342,4 +342,8 @@ add_executable(steamshim ${STEAMSHIM_SOURCES} ) -target_link_libraries(steamshim steam_api) +IF(WIN32) + target_link_libraries(steamshim steam_api64) +ELSE() + target_link_libraries(steamshim steam_api) +ENDIF() From bcb9b838f25f75d34465de82204fc33a7ebece7d Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:23:56 -0700 Subject: [PATCH 09/27] Temporarily disable CMake Steamshim on Windows --- CMakeLists.txt | 57 +++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c54da5..7dbe084 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,36 +314,37 @@ IF(APPLE) ENDIF() # Steamshim +IF(NOT WIN32) + set(STEAMSHIM_SOURCES + steamshim_parent/steamshim_parent.cpp + ) -set(STEAMSHIM_SOURCES - steamshim_parent/steamshim_parent.cpp -) + include_directories(${STEAMWORKS_PATH}/public) -include_directories(${STEAMWORKS_PATH}/public) + add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") -add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) + ENDIF() -IF(DEBUG) - add_definitions(-DSTEAMSHIM_DEBUG) -ENDIF() - -IF(APPLE) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) -ELSEIF(WIN32) - list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") -ELSEIF(LINUX) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") -ENDIF() - -add_executable(steamshim - ${STEAMSHIM_SOURCES} -) - -IF(WIN32) - target_link_libraries(steamshim steam_api64) -ELSE() - target_link_libraries(steamshim steam_api) + IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) + ELSEIF(WIN32) + list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") + ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") + ENDIF() + + add_executable(steamshim + ${STEAMSHIM_SOURCES} + ) + + IF(WIN32) + target_link_libraries(steamshim steam_api64) + ELSE() + target_link_libraries(steamshim steam_api) + ENDIF() ENDIF() From 183e1e8ecca1037c9a63703198a6c3330d0d2bba Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:24:56 -0700 Subject: [PATCH 10/27] Update .gitignore --- .gitignore | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9db0bfd..d0755b1 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,7 @@ bin/ lib/ -oneshot\.dir/ +*.dir/ x64/ Makefile* @@ -28,6 +28,7 @@ __pycache__ /dist /debug /release +steamshim_parent/build/ object_script.* rpgscript.bat @@ -54,6 +55,4 @@ package/ oclint/ -steamshim_parent/build/ - -steamworks/ +steamworks/ \ No newline at end of file From 86a9e1ece17694a8e2374022ac22b06ec92f8bbf Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:27:51 -0700 Subject: [PATCH 11/27] Remove Info.plist --- Info.plist | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 Info.plist diff --git a/Info.plist b/Info.plist deleted file mode 100644 index 6c19ba0..0000000 --- a/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - NSPrincipalClass - NSApplication - CFBundleIconFile - - CFBundlePackageType - APPL - CFBundleGetInfoString - Created by Qt/QMake - CFBundleSignature - ???? - CFBundleExecutable - OneShot - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} - NOTE - This file was generated by Qt/QMake. - - From 43254b7df6919371c93f5d74261f12bcd3959e25 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 18:28:14 -0700 Subject: [PATCH 12/27] Update Cleanup script for Windows --- Info.plist | 22 ---------------------- cleanup.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 22 deletions(-) delete mode 100644 Info.plist diff --git a/Info.plist b/Info.plist deleted file mode 100644 index 6c19ba0..0000000 --- a/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - NSPrincipalClass - NSApplication - CFBundleIconFile - - CFBundlePackageType - APPL - CFBundleGetInfoString - Created by Qt/QMake - CFBundleSignature - ???? - CFBundleExecutable - OneShot - CFBundleIdentifier - com.yourcompany.${PRODUCT_NAME:rfc1034identifier} - NOTE - This file was generated by Qt/QMake. - - diff --git a/cleanup.sh b/cleanup.sh index 7b8b122..cfe2c08 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -3,7 +3,14 @@ rm -rf journal/mac/__pycache__ rm -rf steamshim_parent/build rm -rf build +rm -rf bin +rm -rf lib rm -rf dist +rm -rf x64 +rm -rf *.sln +rm -rf *.vcxproj +rm -rf *.vcxproj.filters +rm -rf *.user rm -rf _______.app rm -rf OneShot.app rm -rf OneShot @@ -13,7 +20,9 @@ rm -rf cmake_install.cmake rm -rf CMakeCache.txt rm -rf conanbuildinfo.txt rm -rf conaninfo.txt +rm -rf conan_imports_manifest.txt rm -rf *.xxd +rm -rf *.dir if [ -f .qmake.stash ] then make distclean From 02c9c6f6e4b8b1f6894bb353bcc129fe9c32c9da Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sat, 6 Oct 2018 19:31:58 -0700 Subject: [PATCH 13/27] Disable redundant JPG support --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index bebb63d..c7af9b7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -252,7 +252,7 @@ int main(int argc, char *argv[]) if (conf.windowTitle.empty()) conf.windowTitle = conf.game.title; - int imgFlags = IMG_INIT_PNG | IMG_INIT_JPG; + int imgFlags = IMG_INIT_PNG; if (IMG_Init(imgFlags) != imgFlags) { showInitError(std::string("Error initializing SDL_image: ") + SDL_GetError()); From ba53c209723cdcfe2feaf884448a1435cb2fa5ad Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 10:09:50 -0700 Subject: [PATCH 14/27] Update CMakeLists for Steamshim --- CMakeLists.txt | 4 ++-- steamshim_parent/CMakeLists.txt | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dbe084..beab52f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,8 @@ conan_basic_setup() ## Setup options ## -option(STEAM "Build for Steam" ON) -set(STEAMWORKS_PATH "${CMAKE_BINARY_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") +option(STEAM "Build for Steam" OFF) +set(STEAMWORKS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/steamworks" CACHE PATH "Path to Steamworks folder") option(DEBUG "Debug mode" OFF) ## Misc setup ## diff --git a/steamshim_parent/CMakeLists.txt b/steamshim_parent/CMakeLists.txt index cbc3a4e..3c25ad2 100644 --- a/steamshim_parent/CMakeLists.txt +++ b/steamshim_parent/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8.11) -set(STEAMWORKS_PATH "" CACHE PATH "Path to Steamworks folder") +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) @@ -20,7 +20,7 @@ IF(APPLE) link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) ELSEIF(WIN32) list(APPEND SOURCES resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") ELSEIF(LINUX) link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) @@ -31,4 +31,8 @@ add_executable(steamshim ${SOURCES} ) -target_link_libraries(steamshim steam_api) +IF(WIN32) + target_link_libraries(steamshim steam_api64) +ELSE() + target_link_libraries(steamshim steam_api) +ENDIF() From 87d40559fdce6acbd6476fbda5f55c602976f827 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 10:09:58 -0700 Subject: [PATCH 15/27] Use normal Ruby --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 2aa3874..f0eace2 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,7 +16,7 @@ class MkxpConan(ConanFile): "openal/1.18.2@bincrafters/stable", "physfs/3.0.1@eliza/stable", "pixman/0.34.0@bincrafters/stable", - "ruby-mkxp/2.5.1@eliza/stable", + "ruby/2.5.1@eliza/stable", "sdl2/2.0.8@bincrafters/stable", "sdl2_image/2.0.3@bincrafters/stable", "sdl2_ttf/2.0.14@eliza/stable", From b0affd0b76ad8e49d39b9578b14962f4eca2752d Mon Sep 17 00:00:00 2001 From: Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> Date: Sun, 7 Oct 2018 17:45:45 +0000 Subject: [PATCH 16/27] Miscellaneous fixes --- CMakeLists.txt | 3 ++- conanfile.py | 8 +++++++- src/config.cpp | 18 +++++++++++++++--- src/main.cpp | 4 ---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beab52f..48c6728 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,7 +152,7 @@ set(MAIN_SOURCE if(WIN32) list(APPEND MAIN_SOURCE assets/resources.rc) list(APPEND DEFINES UNICODE) - list(APPEND PLATFORM_LIBRARIES Secur32) + list(APPEND PLATFORM_LIBRARIES Secur32 Shlwapi) include_directories( ${CMAKE_CURRENT_BINARY_DIR}/windows ) @@ -267,6 +267,7 @@ 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 diff --git a/conanfile.py b/conanfile.py index f0eace2..496e9ec 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,14 +16,18 @@ class MkxpConan(ConanFile): "openal/1.18.2@bincrafters/stable", "physfs/3.0.1@eliza/stable", "pixman/0.34.0@bincrafters/stable", - "ruby/2.5.1@eliza/stable", + "ruby/2.3.7@eliza/stable", "sdl2/2.0.8@bincrafters/stable", "sdl2_image/2.0.3@bincrafters/stable", "sdl2_ttf/2.0.14@eliza/stable", "sdl_sound-mkxp/1.0.1@eliza/stable", "sigc++/2.10.0@eliza/stable", ) + options = { + "platform": ["standalone", "steam"], + } default_options = ( + "platform=standalone", "boost:without_test=True", "cygwin_installer:packages=xxd", ) @@ -34,6 +38,8 @@ class MkxpConan(ConanFile): def build_configure(self): cmake = CMake(self) + if self.options.platform == "steam": + cmake.definitions["STEAM"] = "ON" cmake.configure() cmake.build() diff --git a/src/config.cpp b/src/config.cpp index ec6c8af..727ae11 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -35,6 +35,18 @@ #include "util.h" #include "sdl-util.h" +namespace std +{ + std::ostream& operator<<(std::ostream &os, const std::vector &vec) + { + for (auto item : vec) + { + os << item << " "; + } + return os; + } +} + static std::string prefPath(const char *org, const char *app) { char *path = SDL_GetPrefPath(org, app); @@ -117,9 +129,9 @@ void Config::read(int argc, char *argv[]) po::options_description podesc; podesc.add_options() PO_DESC_ALL - ("preloadScript", po::value()->composing()) - ("fontSub", po::value()->composing()) - ("rubyLoadpath", po::value()->composing()) + ("preloadScript", po::value()->composing()->default_value(StringVec())) + ("fontSub", po::value()->composing()->default_value(StringVec())) + ("rubyLoadpath", po::value()->composing()->default_value(StringVec())) ; po::variables_map vm; diff --git a/src/main.cpp b/src/main.cpp index c7af9b7..7edf507 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -46,10 +46,6 @@ #include "binding.h" -#ifdef __WINDOWS__ -#include "resource.h" -#endif - #include "icon.png.xxd" #ifdef STEAM From 8aa3f1dcfc378b465dc85621d10f32b909b4b34d Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 10:53:30 -0700 Subject: [PATCH 17/27] Look for Steamworks in local path --- README.md | 1 + make-oneshot-mac.command | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 434c663..232ee30 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Thanks to [hunternet93](https://github.com/hunternet93) for starting the reimple * Ruby * Python 3 (journal reimplementation only) * PyQt5 for Python 3 (journal reimplementation only) +* Steamworks SDK (optional, place contents of sdk folder in ZIP into "steamworks" folder in root) ### Building with Conan diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index 9eecc45..af333f5 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -7,8 +7,6 @@ cd `dirname $0` mac_version="1.1.0" make_threads=8 ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot -STEAMWORKS_PATH=$HOME/Developer/downloaded/steamworks - # Colors white="\033[0;37m" # White - Regular bold="\033[1;37m" # White - Bold @@ -30,7 +28,7 @@ if [[ $use_qmake == True ]] echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent mkdir build && cd build - cmake -DSTEAMWORKS_PATH=${STEAMWORKS_PATH} .. + cmake .. make -j${make_threads} cd ../.. else From 0deb8e67c234ebc6107fcd44be70ab9afc316f21 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 10:54:11 -0700 Subject: [PATCH 18/27] Only build Steamshim if building for Steam --- CMakeLists.txt | 54 ++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index beab52f..3549845 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,37 +314,39 @@ IF(APPLE) ENDIF() # Steamshim -IF(NOT WIN32) - set(STEAMSHIM_SOURCES - steamshim_parent/steamshim_parent.cpp - ) +IF(STEAM) + IF(NOT WIN32) + set(STEAMSHIM_SOURCES + steamshim_parent/steamshim_parent.cpp + ) - include_directories(${STEAMWORKS_PATH}/public) + include_directories(${STEAMWORKS_PATH}/public) - add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") + add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") - IF(DEBUG) - add_definitions(-DSTEAMSHIM_DEBUG) - ENDIF() + IF(DEBUG) + add_definitions(-DSTEAMSHIM_DEBUG) + ENDIF() - IF(APPLE) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) - ELSEIF(WIN32) - list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") - ELSEIF(LINUX) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") - ENDIF() + IF(APPLE) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) + ELSEIF(WIN32) + list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") + ELSEIF(LINUX) + link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") + ENDIF() - add_executable(steamshim - ${STEAMSHIM_SOURCES} - ) + add_executable(steamshim + ${STEAMSHIM_SOURCES} + ) - IF(WIN32) - target_link_libraries(steamshim steam_api64) - ELSE() - target_link_libraries(steamshim steam_api) + IF(WIN32) + target_link_libraries(steamshim steam_api64) + ELSE() + target_link_libraries(steamshim steam_api) + ENDIF() ENDIF() ENDIF() From eb995df65a91b6ea27cae1da5a6214362aca7bb8 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 11:12:33 -0700 Subject: [PATCH 19/27] Add case-insensitive search for fonts folder --- src/filesystem.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 8bf1cf8..4f4e970 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -465,7 +465,7 @@ struct FontSetsCBData }; static PHYSFS_EnumerateCallbackResult -findFontsFolderCB (void *data, const char *dir, const char *fname) +fontSetEnumCB (void *data, const char *dir, const char *fname) { FontSetsCBData *d = static_cast(data); @@ -503,11 +503,31 @@ findFontsFolderCB (void *data, const char *dir, const char *fname) return PHYSFS_ENUM_OK; } +/* Basically just a case-insensitive search + * for the folder "Fonts"... */ +static PHYSFS_EnumerateCallbackResult +findFontsFolderCB(void *data, const char *, const char *fname) +{ + size_t i = 0; + char buffer[512]; + const char *s = fname; + + while (s && i < sizeof(buffer)) + buffer[i++] = tolower(*s++); + + buffer[i] = '\0'; + + if (strcmp(buffer, "fonts") == 0) + PHYSFS_enumerate(fname, fontSetEnumCB, data); + + return PHYSFS_ENUM_OK; +} + void FileSystem::initFontSets(SharedFontState &sfs) { FontSetsCBData d = { p, &sfs }; - PHYSFS_enumerate("Fonts", findFontsFolderCB, &d); + PHYSFS_enumerate("", findFontsFolderCB, &d); } struct OpenReadEnumData From 65b9854d83e0d4926322fc1eb10a7fcd6c5d213b Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 11:13:20 -0700 Subject: [PATCH 20/27] Style fix --- src/filesystem.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 4f4e970..69b51dd 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -40,11 +40,8 @@ #include #ifdef __APPLE__ -#define OS_OSX -#endif - -#ifdef OS_OSX -#include + #define OS_OSX + #include #endif struct SDLRWIoContext From d24677129e1ddc66c5b406bb777d5983e8d2f3fd Mon Sep 17 00:00:00 2001 From: Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> Date: Sun, 7 Oct 2018 18:25:19 +0000 Subject: [PATCH 21/27] Use bincrafters' sigc++ --- conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conanfile.py b/conanfile.py index 496e9ec..255a1b5 100644 --- a/conanfile.py +++ b/conanfile.py @@ -21,7 +21,7 @@ class MkxpConan(ConanFile): "sdl2_image/2.0.3@bincrafters/stable", "sdl2_ttf/2.0.14@eliza/stable", "sdl_sound-mkxp/1.0.1@eliza/stable", - "sigc++/2.10.0@eliza/stable", + "sigc++/2.10.0@bincrafters/stable", ) options = { "platform": ["standalone", "steam"], From a7e40364e8fb6f10fa97bcdc95de0ba4fbbc78ef Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 14:26:43 -0700 Subject: [PATCH 22/27] Prevent index from going past array size --- src/filesystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 69b51dd..29acbc0 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -512,7 +512,7 @@ findFontsFolderCB(void *data, const char *, const char *fname) while (s && i < sizeof(buffer)) buffer[i++] = tolower(*s++); - buffer[i] = '\0'; + if(i < sizeof(buffer)) buffer[i] = '\0'; if (strcmp(buffer, "fonts") == 0) PHYSFS_enumerate(fname, fontSetEnumCB, data); From 6554a6e43f6e0b554d14bf84d737030ead90ed19 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Sun, 7 Oct 2018 14:27:07 -0700 Subject: [PATCH 23/27] Fix choice crash when Action+Cancel pressed simultaneously --- scripts/Window_Message.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/Window_Message.rb b/scripts/Window_Message.rb index 5a4af1b..ded48d9 100644 --- a/scripts/Window_Message.rb +++ b/scripts/Window_Message.rb @@ -401,10 +401,7 @@ class Window_Message < Window_Selectable $game_system.se_play($data_system.cancel_se) $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1) terminate_message - end - - # Confirm - if Input.trigger?(Input::ACTION) + elsif Input.trigger?(Input::ACTION) $game_system.se_play($data_system.decision_se) $game_temp.choice_proc.call(self.index) terminate_message From 4a0cb0b453326e107098a5cd72512ed533ffbe53 Mon Sep 17 00:00:00 2001 From: Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> Date: Thu, 11 Oct 2018 00:23:18 +0000 Subject: [PATCH 24/27] Fix physfs & ruby bugs and build for steam --- CMakeLists.txt | 87 ++++++++------------------------- conanfile.py | 8 ++- src/filesystem.cpp | 26 ++-------- steamshim_parent/CMakeLists.txt | 48 ++++++------------ steamshim_parent/old.Makefile | 45 ----------------- 5 files changed, 44 insertions(+), 170 deletions(-) delete mode 100644 steamshim_parent/old.Makefile diff --git a/CMakeLists.txt b/CMakeLists.txt index cf2305e..966ae5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8.11) Project(oneshot) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) ## Setup options ## @@ -14,34 +14,6 @@ option(DEBUG "Debug mode" OFF) set(CMAKE_INCLUDE_CURRENT_DIR ON) -# IF("${CMAKE_SYSTEM}" MATCHES "Linux") -# SET(LINUX ON) -# ENDIF() - -set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12) - -# IF(LINUX) -# if(CMAKE_SIZEOF_VOID_P MATCHES "8" AND NOT(FORCE32) ) -# set(CMAKE_EXECUTABLE_SUFFIX ".bin.x86_64") -# set(BIN_RPATH "\$ORIGIN/lib64") -# set(LIB_PATH "lib64") -# else() -# set(CMAKE_EXECUTABLE_SUFFIX ".bin.x86") -# set(BIN_RPATH "\$ORIGIN/lib") -# set(LIB_PATH "lib") -# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FILE_OFFSET_BITS=64") -# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FILE_OFFSET_BITS=64") -# endif() -# elseif(APPLE) -# SET(BIN_RPATH "@executable_path/../Frameworks") -# set(LIB_PATH "lib") -# endif() - -# set(CMAKE_SKIP_BUILD_RPATH TRUE) -# set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -# set(CMAKE_INSTALL_RPATH ${BIN_RPATH}) -# set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE) - ## Setup main source ## set(MAIN_HEADERS @@ -308,46 +280,29 @@ add_executable(${PROJECT_NAME} MACOSX_BUNDLE WIN32 target_compile_definitions(${PROJECT_NAME} PRIVATE ${DEFINES}) target_include_directories(${PROJECT_NAME} PRIVATE src) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} + CONAN_PKG::boost + CONAN_PKG::openal + CONAN_PKG::physfs + CONAN_PKG::pixman + CONAN_PKG::ruby + CONAN_PKG::sdl2 + CONAN_PKG::sdl2_image + CONAN_PKG::sdl2_ttf + CONAN_PKG::sdl_sound-mkxp + CONAN_PKG::sigc++ + ${PLATFORM_LIBRARIES}) IF(APPLE) add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) ENDIF() -# Steamshim -IF(STEAM) - IF(NOT WIN32) - set(STEAMSHIM_SOURCES - steamshim_parent/steamshim_parent.cpp - ) +if(STEAM) + add_subdirectory(steamshim_parent) - include_directories(${STEAMWORKS_PATH}/public) - - add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") - - IF(DEBUG) - add_definitions(-DSTEAMSHIM_DEBUG) - ENDIF() - - IF(APPLE) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) - ELSEIF(WIN32) - list(APPEND STEAMSHIM_SOURCES steamshim_parent/resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") - ELSEIF(LINUX) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") - ENDIF() - - add_executable(steamshim - ${STEAMSHIM_SOURCES} - ) - - IF(WIN32) - target_link_libraries(steamshim steam_api64) - ELSE() - target_link_libraries(steamshim steam_api) - ENDIF() - ENDIF() -ENDIF() + # steam_appid.txt + configure_file( + "${CMAKE_SOURCE_DIR}/steam_appid.txt" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/steam_appid.txt" + COPYONLY) +endif() diff --git a/conanfile.py b/conanfile.py index 255a1b5..2863e37 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,7 +3,7 @@ import os.path class MkxpConan(ConanFile): - name = "mkxp" + name = "oneshot" version = "0.0.0" license = "GPLv2" url = "https://github.com/elizagamedev/mkxp-oneshot" @@ -14,7 +14,7 @@ class MkxpConan(ConanFile): requires = ( "boost/1.68.0@conan/stable", "openal/1.18.2@bincrafters/stable", - "physfs/3.0.1@eliza/stable", + "physfs/stable-3.0@eliza/stable", "pixman/0.34.0@bincrafters/stable", "ruby/2.3.7@eliza/stable", "sdl2/2.0.8@bincrafters/stable", @@ -36,6 +36,10 @@ class MkxpConan(ConanFile): if tools.os_info.is_windows: self.build_requires("cygwin_installer/2.9.0@bincrafters/stable") + def requirements(self): + if self.options.platform == "steam": + self.requires("steamworks/1.42@eliza/stable") + def build_configure(self): cmake = CMake(self) if self.options.platform == "steam": diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 69b51dd..24ca592 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -470,7 +470,7 @@ fontSetEnumCB (void *data, const char *dir, const char *fname) const char *ext = findExt(fname); if (!ext) - return PHYSFS_ENUM_STOP; + return PHYSFS_ENUM_OK; char lowExt[8]; size_t i; @@ -480,7 +480,7 @@ fontSetEnumCB (void *data, const char *dir, const char *fname) lowExt[i] = '\0'; if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf") && strcmp(lowExt, "ttc")) - return PHYSFS_ENUM_STOP; + return PHYSFS_ENUM_OK; char filename[512]; snprintf(filename, sizeof(filename), "%s/%s", dir, fname); @@ -500,31 +500,11 @@ fontSetEnumCB (void *data, const char *dir, const char *fname) return PHYSFS_ENUM_OK; } -/* Basically just a case-insensitive search - * for the folder "Fonts"... */ -static PHYSFS_EnumerateCallbackResult -findFontsFolderCB(void *data, const char *, const char *fname) -{ - size_t i = 0; - char buffer[512]; - const char *s = fname; - - while (s && i < sizeof(buffer)) - buffer[i++] = tolower(*s++); - - buffer[i] = '\0'; - - if (strcmp(buffer, "fonts") == 0) - PHYSFS_enumerate(fname, fontSetEnumCB, data); - - return PHYSFS_ENUM_OK; -} - void FileSystem::initFontSets(SharedFontState &sfs) { FontSetsCBData d = { p, &sfs }; - PHYSFS_enumerate("", findFontsFolderCB, &d); + PHYSFS_enumerate("Fonts", fontSetEnumCB, &d); } struct OpenReadEnumData diff --git a/steamshim_parent/CMakeLists.txt b/steamshim_parent/CMakeLists.txt index 3c25ad2..59803e5 100644 --- a/steamshim_parent/CMakeLists.txt +++ b/steamshim_parent/CMakeLists.txt @@ -1,38 +1,18 @@ -cmake_minimum_required(VERSION 2.8.11) +add_executable(steamshim WIN32 + steamshim_parent.cpp) -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) +target_compile_definitions(steamshim PRIVATE + -DGAME_LAUNCH_NAME="oneshot") -set(SOURCES - steamshim_parent.cpp -) +if(DEBUG) + target_compile_definitions(steamshim PRIVATE + -DSTEAMSHIM_DEBUG) +endif() -include_directories(${STEAMWORKS_PATH}/public) +if(WIN32) + target_sources(steamshim PRIVATE + resources.rc) +endif() -add_definitions(-DGAME_LAUNCH_NAME="${GAME_LAUNCH_NAME}") - -IF(DEBUG) - add_definitions(-DSTEAMSHIM_DEBUG) -ENDIF() - -IF(APPLE) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/osx32) -ELSEIF(WIN32) - list(APPEND SOURCES resources.rc) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/win64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") -ELSEIF(LINUX) - link_directories(${STEAMWORKS_PATH}/redistributable_bin/linux64) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64") -ENDIF() - -add_executable(steamshim - ${SOURCES} -) - -IF(WIN32) - target_link_libraries(steamshim steam_api64) -ELSE() - target_link_libraries(steamshim steam_api) -ENDIF() +target_link_libraries(steamshim PRIVATE + CONAN_PKG::steamworks) diff --git a/steamshim_parent/old.Makefile b/steamshim_parent/old.Makefile deleted file mode 100644 index 7800230..0000000 --- a/steamshim_parent/old.Makefile +++ /dev/null @@ -1,45 +0,0 @@ -TARGET := steamshim -GAME_LAUNCH_NAME ?= oneshot - -CXX ?= clang++ -WINDRES ?= windres -HOST ?= linux64 -FLAGS := -I$(STEAMWORKS)/public -DGAME_LAUNCH_NAME=\"$(GAME_LAUNCH_NAME)\" -Wall -DEBUG ?= 0 - -ifeq ($(HOST),w32) - FLAGS += -L$(STEAMWORKS)/redistributable_bin -else ifeq ($(HOST),linux32) - FLAGS += -L$(STEAMWORKS)/redistributable_bin/linux32 -m32 -else ifeq ($(HOST),linux64) - FLAGS += -L$(STEAMWORKS)/redistributable_bin/linux64 -m64 -else ifeq ($(HOST),osx) - FLAGS += -L$(STEAMWORKS)/redistributable_bin/osx32 -endif - -FLAGS += -lsteam_api - -ifeq ($(DEBUG),1) - FLAGS += -DSTEAMSHIM_DEBUG -else ifeq ($(HOST),w32) - FLAGS += -mwindows -endif - -SRC := steamshim_parent.cpp -RES := resources.rc -RESOBJ := resources.o - -ifeq ($(HOST),w32) -$(TARGET).exe: $(SRC) $(RESOBJ) - $(CXX) $^ -o $@ $(FLAGS) -$(RESOBJ): $(RES) - $(WINDRES) $< $@ -else -$(TARGET): $(SRC) - $(CXX) $^ -o $@ $(FLAGS) -endif - -clean: - rm -f $(TARGET) $(TARGET).exe $(RESOBJ) - -.PHONY: clean From 9aacb5f13623bb60541446470097b917949f38ee Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Wed, 10 Oct 2018 18:46:10 -0700 Subject: [PATCH 25/27] Fix cleanup script and update Conan + CMakeLists to fix errors --- CMakeLists.txt | 2 +- cleanup.sh | 2 ++ conanfile.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 966ae5c..5ad1c31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -294,7 +294,7 @@ target_link_libraries(${PROJECT_NAME} ${PLATFORM_LIBRARIES}) IF(APPLE) - add_custom_command(TARGET ${target} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) + add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM) ENDIF() if(STEAM) diff --git a/cleanup.sh b/cleanup.sh index cfe2c08..61a250d 100755 --- a/cleanup.sh +++ b/cleanup.sh @@ -2,6 +2,8 @@ rm -rf journal/mac/__pycache__ rm -rf steamshim_parent/build +rm -rf steamshim_parent/CMakeFiles +rm -rf steamshim_parent/CMakeCache.txt rm -rf build rm -rf bin rm -rf lib diff --git a/conanfile.py b/conanfile.py index 2863e37..03c5c75 100644 --- a/conanfile.py +++ b/conanfile.py @@ -8,7 +8,7 @@ class MkxpConan(ConanFile): license = "GPLv2" url = "https://github.com/elizagamedev/mkxp-oneshot" description = "OneShot game runtime" - settings = "os", "compiler", "build_type", "arch" + settings = "os", "compiler", "build_type", "arch", "cppstd" generators = "cmake" exports_sources = "*" requires = ( From 95eec5e4822b1f15c5752d8ff4b58de10c65d9e9 Mon Sep 17 00:00:00 2001 From: Vinyl Darkscratch Date: Thu, 11 Oct 2018 04:46:48 -0700 Subject: [PATCH 26/27] Temporarily revert to Makefile for macOS --- make-oneshot-mac.command | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/make-oneshot-mac.command b/make-oneshot-mac.command index af333f5..fe72cd2 100755 --- a/make-oneshot-mac.command +++ b/make-oneshot-mac.command @@ -27,10 +27,9 @@ if [[ $use_qmake == True ]] make -j${make_threads} echo "-> ${cyan}Compile steamshim...${color_reset}" cd steamshim_parent - mkdir build && cd build - cmake .. - make -j${make_threads} - cd ../.. + # mkdir build && cd build + STEAMWORKS=./steamworks make -j${make_threads} + cd .. # cd ../.. else echo "${bold}WARNING: Conan/CMake method not ready yet.${color_reset}" fi @@ -55,7 +54,7 @@ if [ ! -e $ResourcesDir ] mkdir -p "$ResourcesDir" fi -cp steamshim_parent/build/steamshim ./OneShot.app/Contents/Resources/steamshim +cp steamshim_parent/steamshim ./OneShot.app/Contents/Resources/steamshim cp patches/mac/libsteam_api.dylib ./OneShot.app/Contents/Libraries/libsteam_api.dylib cmake -P patches/mac/CompleteBundle.cmake cp assets/icon.icns ./OneShot.app/Contents/Resources/icon.icns From c096f6f020eaf714f5f1bedf7befcd59d5c76ae9 Mon Sep 17 00:00:00 2001 From: Eliza Velasquez <4576666+elizagamedev@users.noreply.github.com> Date: Sat, 13 Oct 2018 18:28:54 +0000 Subject: [PATCH 27/27] Fix October bug --- CMakeLists.txt | 2 + conanfile.py | 14 ++++- rpgscript - solstice.bat | 2 - rpgscript.bat | 2 - rpgscript.rb | 4 +- scripts/CMakeLists.txt | 125 +++++++++++++++++++++++++++++++++++++++ src/config.cpp | 9 +-- src/filesystem.cpp | 2 - src/main.cpp | 4 ++ 9 files changed, 147 insertions(+), 17 deletions(-) delete mode 100644 rpgscript - solstice.bat delete mode 100644 rpgscript.bat create mode 100644 scripts/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ad1c31..2cb38bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,3 +306,5 @@ if(STEAM) "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/steam_appid.txt" COPYONLY) endif() + +add_subdirectory(scripts) diff --git a/conanfile.py b/conanfile.py index 03c5c75..d4d24d8 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,13 +16,16 @@ class MkxpConan(ConanFile): "openal/1.18.2@bincrafters/stable", "physfs/stable-3.0@eliza/stable", "pixman/0.34.0@bincrafters/stable", - "ruby/2.3.7@eliza/stable", + "ruby/trunk@eliza/stable", "sdl2/2.0.8@bincrafters/stable", "sdl2_image/2.0.3@bincrafters/stable", "sdl2_ttf/2.0.14@eliza/stable", "sdl_sound-mkxp/1.0.1@eliza/stable", "sigc++/2.10.0@bincrafters/stable", ) + build_requires = ( + "ruby_installer/2.3.3@bincrafters/stable", + ) options = { "platform": ["standalone", "steam"], } @@ -30,6 +33,7 @@ class MkxpConan(ConanFile): "platform=standalone", "boost:without_test=True", "cygwin_installer:packages=xxd", + "openal:shared=True", ) def build_requirements(self): @@ -67,7 +71,11 @@ class MkxpConan(ConanFile): self.do_copy_deps(self.copy_deps) def do_copy_deps(self, copy): - deps = set(self.deps_cpp_info.deps) - deps.discard("cygwin_installer") + deps = set(self.deps_cpp_info.deps) - set(( + "cygwin_installer", + "msys2_installer", + "ruby_installer")) for dep in deps: copy("*.dll", dst="bin", src="bin", root_package=dep, keep_path=False) + if self.settings.build_type == "Debug": + copy("*.pdb", dst="bin", root_package=dep, keep_path=False) diff --git a/rpgscript - solstice.bat b/rpgscript - solstice.bat deleted file mode 100644 index 44344f0..0000000 --- a/rpgscript - solstice.bat +++ /dev/null @@ -1,2 +0,0 @@ -"C:\Ruby23\bin\ruby.exe" rpgscript.rb "C:\Users\GIR\Documents\oneshot scripts and stuff\mkxp-oneshot\scripts" "C:\Users\GIR\Dropbox\Oneshot Project\Solstice\Game" -pause \ No newline at end of file diff --git a/rpgscript.bat b/rpgscript.bat deleted file mode 100644 index 718a041..0000000 --- a/rpgscript.bat +++ /dev/null @@ -1,2 +0,0 @@ -"C:\Ruby23\bin\ruby.exe" rpgscript.rb "C:\Users\GIR\Documents\oneshot scripts and stuff\mkxp-oneshot\scripts" "C:\Users\GIR\Dropbox\Oneshot Project\Game" -pause \ No newline at end of file diff --git a/rpgscript.rb b/rpgscript.rb index a9dd243..cb3ab46 100755 --- a/rpgscript.rb +++ b/rpgscript.rb @@ -33,8 +33,8 @@ Dir.entries(game_data_dir).each do |e| end unless target_path - STDERR.puts "error: could not determine game engine version" - exit 1 + STDERR.puts "warning: could not determine game engine version, assuming XP" + target_path = File.join(game_data_dir, 'xScripts.rxdata') end # Generate path of script list diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt new file mode 100644 index 0000000..717c6c1 --- /dev/null +++ b/scripts/CMakeLists.txt @@ -0,0 +1,125 @@ +set(scripts + Credits_Message.rb + Data_FastTravel.rb + Data_Footsteps.rb + Data_Item.rb + Data_SpecialEventData.rb + Data_TileText.rb + Demo.rb + Desktop_Message.rb + Doc_Message.rb + EdText.rb + Ed_Message.rb + FastTravel.rb + Game_Actor.rb + Game_Actors.rb + Game_BattleAction.rb + Game_Battler 1.rb + Game_Battler 2.rb + Game_Battler 3.rb + Game_Character 1.rb + Game_Character 2.rb + Game_Character 3.rb + Game_CommonEvent.rb + Game_Enemy.rb + Game_Event.rb + Game_FastTravel.rb + Game_Follower.rb + Game_Light.rb + Game_Map.rb + Game_Oneshot.rb + Game_Party.rb + Game_Picture.rb + Game_Player.rb + Game_Screen.rb + Game_SelfSwitches.rb + Game_Switches.rb + Game_System.rb + Game_Temp.rb + Game_Variables.rb + Interpreter 1.rb + Interpreter 2.rb + Interpreter 3.rb + Interpreter 4.rb + Interpreter 5.rb + Interpreter 6.rb + Interpreter 7.rb + Main.rb + Particles.rb + Persistent.rb + Puzzle_Film.rb + Puzzle_Pixel.rb + Puzzle_Safe.rb + Puzzle_Sokoban.rb + RPG.rb + SaveLoad.rb + Scene_Debug.rb + Scene_End.rb + Scene_Equip.rb + Scene_File.rb + Scene_Item.rb + Scene_Load.rb + Scene_Map.rb + Scene_Menu.rb + Scene_Name.rb + Scene_Save.rb + Scene_Skill.rb + Scene_Status.rb + Scene_Title.rb + Script.rb + Sprite_Battler.rb + Sprite_Character.rb + Sprite_Footprint.rb + Sprite_Footsplash.rb + Sprite_Light.rb + Sprite_MapText.rb + Sprite_Picture.rb + Sprite_Timer.rb + Spriteset_Map.rb + Window_Base.rb + Window_BattleResult.rb + Window_BattleStatus.rb + Window_Command.rb + Window_DebugLeft.rb + Window_DebugRight.rb + Window_EquipItem.rb + Window_EquipLeft.rb + Window_EquipRight.rb + Window_Gold.rb + Window_Help.rb + Window_InputNumber.rb + Window_Item.rb + Window_MainMenu.rb + Window_MenuStatus.rb + Window_Message.rb + Window_NameEdit.rb + Window_NameInput.rb + Window_PartyCommand.rb + Window_PlayTime.rb + Window_SaveFile.rb + Window_Selectable.rb + Window_Settings.rb + Window_ShopBuy.rb + Window_ShopCommand.rb + Window_ShopNumber.rb + Window_ShopSell.rb + Window_ShopStatus.rb + Window_Skill.rb + Window_SkillStatus.rb + Window_Status.rb + Window_Steps.rb + Window_Target.rb + i18n_English.rb + i18n_Japanese.rb + i18n_Language.rb) + +find_program(RUBY_EXE ruby + DOC "Location of the Ruby executable") +set(game_dir "${CMAKE_BINARY_DIR}/bin") +set(xscripts "${game_dir}/Data/xScripts.rxdata") +add_custom_command( + OUTPUT "${xscripts}" + COMMAND "${RUBY_EXE}" "${CMAKE_SOURCE_DIR}/rpgscript.rb" "${CMAKE_CURRENT_LIST_DIR}" "${game_dir}" + DEPENDS _scripts.txt ${scripts} + COMMENT "Bundling xScripts.rxdata") +add_custom_target(xScripts ALL DEPENDS "${xscripts}") diff --git a/src/config.cpp b/src/config.cpp index 727ae11..2a27175 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -49,15 +49,12 @@ namespace std static std::string prefPath(const char *org, const char *app) { - char *path = SDL_GetPrefPath(org, app); + const char *path = PHYSFS_getPrefDir(org, app); if (!path) return std::string(); - std::string str(path); - SDL_free(path); - - return str; + return path; } template diff --git a/src/filesystem.cpp b/src/filesystem.cpp index 24ca592..1b7e032 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -318,8 +318,6 @@ FileSystem::FileSystem(const char *argv0, p = new FileSystemPrivate; p->havePathCache = false; - PHYSFS_init(argv0); - PHYSFS_registerArchiver(&RGSS1_Archiver); PHYSFS_registerArchiver(&RGSS2_Archiver); PHYSFS_registerArchiver(&RGSS3_Archiver); diff --git a/src/main.cpp b/src/main.cpp index 7edf507..d3c51a8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef _MSC_VER #include @@ -230,6 +231,9 @@ int main(int argc, char *argv[]) } #endif + /* Initialize physfs here so that config can call PHYSFS_getPrefDir */ + PHYSFS_init(argv[0]); + /* now we load the config */ Config conf; conf.read(argc, argv);