Merge branch 'master' into linux

This commit is contained in:
Vinyl Darkscratch 2018-10-15 00:05:25 -07:00
commit 6d23c773aa
18 changed files with 263 additions and 148 deletions

5
.gitignore vendored
View file

@ -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
@ -53,3 +54,5 @@ conan_imports_manifest\.txt
package/
oclint/
steamworks/

View file

@ -2,44 +2,18 @@ cmake_minimum_required(VERSION 2.8.11)
Project(oneshot)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)
## Setup options ##
option(STEAM "Build for Steam" ON)
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 ##
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# IF("${CMAKE_SYSTEM}" MATCHES "Linux")
# SET(LINUX ON)
# ENDIF()
# set(CMAKE_OSX_DEPLOYMENT_TARGET 10.6)
# 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
@ -150,10 +124,13 @@ 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
)
elseif(APPLE)
list(APPEND MAIN_HEADERS src/mac-desktop.h)
list(APPEND MAIN_SOURCE src/mac-desktop.mm)
endif()
if (STEAM)
@ -262,6 +239,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
@ -302,4 +280,31 @@ 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 ${PROJECT_NAME} POST_BUILD COMMAND cmake -P "${CMAKE_SOURCE_DIR}/patches/mac/CompleteBundle.cmake" VERBATIM)
ENDIF()
if(STEAM)
add_subdirectory(steamshim_parent)
# steam_appid.txt
configure_file(
"${CMAKE_SOURCE_DIR}/steam_appid.txt"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/steam_appid.txt"
COPYONLY)
endif()
add_subdirectory(scripts)

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>Created by Qt/QMake</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>
<string>OneShot</string>
<key>CFBundleIdentifier</key>
<string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string>
<key>NOTE</key>
<string>This file was generated by Qt/QMake.</string>
</dict>
</plist>

View file

@ -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

View file

@ -1,9 +1,18 @@
#!/bin/sh
rm -rf journal/mac/__pycache__
rm -rf steamshim_parent/steamshim
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
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,6 +22,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

View file

@ -3,37 +3,51 @@ import os.path
class MkxpConan(ConanFile):
name = "mkxp"
name = "oneshot"
version = "0.0.0"
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 = (
"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-mkxp/2.5.1@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@eliza/stable",
"sigc++/2.10.0@bincrafters/stable",
)
build_requires = (
"ruby_installer/2.3.3@bincrafters/stable",
)
options = {
"platform": ["standalone", "steam"],
}
default_options = (
"platform=standalone",
"boost:without_test=True",
"cygwin_installer:packages=xxd",
"openal:shared=True",
)
def build_requirements(self):
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":
cmake.definitions["STEAM"] = "ON"
cmake.configure()
cmake.build()
@ -57,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)

View file

@ -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

View file

@ -7,7 +7,6 @@ cd `dirname $0`
mac_version="1.1.0"
make_threads=8
ONESHOT_PATH=$HOME/Library/Application\ Support/Steam/steamapps/common/OneShot
# Colors
white="\033[0;37m" # White - Regular
bold="\033[1;37m" # White - Bold
@ -28,8 +27,9 @@ 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
STEAMWORKS=./steamworks make -j${make_threads}
cd .. # cd ../..
else
echo "${bold}WARNING: Conan/CMake method not ready yet.${color_reset}"
fi

View file

@ -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

View file

@ -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

View file

@ -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

125
scripts/CMakeLists.txt Normal file
View file

@ -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}")

View file

@ -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

View file

@ -25,7 +25,7 @@
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>
#include <SDL_filesystem.h>
#include <physfs.h>
#include <fstream>
#include <stdint.h>
@ -35,17 +35,26 @@
#include "util.h"
#include "sdl-util.h"
namespace std
{
std::ostream& operator<<(std::ostream &os, const std::vector<std::string> &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);
const char *path = PHYSFS_getPrefDir(org, app);
if (!path)
return std::string();
std::string str(path);
SDL_free(path);
return str;
return path;
}
template<typename T>
@ -117,9 +126,9 @@ void Config::read(int argc, char *argv[])
po::options_description podesc;
podesc.add_options()
PO_DESC_ALL
("preloadScript", po::value<StringVec>()->composing())
("fontSub", po::value<StringVec>()->composing())
("rubyLoadpath", po::value<StringVec>()->composing())
("preloadScript", po::value<StringVec>()->composing()->default_value(StringVec()))
("fontSub", po::value<StringVec>()->composing()->default_value(StringVec()))
("rubyLoadpath", po::value<StringVec>()->composing()->default_value(StringVec()))
;
po::variables_map vm;

View file

@ -40,11 +40,8 @@
#include <stack>
#ifdef __APPLE__
#define OS_OSX
#endif
#ifdef OS_OSX
#include <iconv.h>
#define OS_OSX
#include <iconv.h>
#endif
struct SDLRWIoContext
@ -321,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);
@ -465,7 +460,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<FontSetsCBData*>(data);
@ -473,7 +468,7 @@ findFontsFolderCB (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;
@ -483,7 +478,7 @@ findFontsFolderCB (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);
@ -507,7 +502,7 @@ void FileSystem::initFontSets(SharedFontState &sfs)
{
FontSetsCBData d = { p, &sfs };
PHYSFS_enumerate("Fonts", findFontsFolderCB, &d);
PHYSFS_enumerate("Fonts", fontSetEnumCB, &d);
}
struct OpenReadEnumData

View file

@ -25,6 +25,7 @@
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_sound.h>
#include <physfs.h>
#ifdef _MSC_VER
#include <direct.h>
@ -46,10 +47,6 @@
#include "binding.h"
#ifdef __WINDOWS__
#include "resource.h"
#endif
#include "icon.png.xxd"
#ifdef STEAM
@ -234,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);
@ -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());

View file

@ -0,0 +1,18 @@
add_executable(steamshim WIN32
steamshim_parent.cpp)
target_compile_definitions(steamshim PRIVATE
-DGAME_LAUNCH_NAME="oneshot")
if(DEBUG)
target_compile_definitions(steamshim PRIVATE
-DSTEAMSHIM_DEBUG)
endif()
if(WIN32)
target_sources(steamshim PRIVATE
resources.rc)
endif()
target_link_libraries(steamshim PRIVATE
CONAN_PKG::steamworks)

View file

@ -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