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] 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);