diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..6eb3d3759 --- /dev/null +++ b/.gitignore @@ -0,0 +1,16 @@ +/bak/ +/bin/ +/build/ +/event/ +/freetype/ +/gframe/ygopro.ico +/gframe/ygopro.rc +/gframe/ygopro.aps +/gframe/__iob_func_fix.cpp +/irrlicht/ +/lua/ +/obj/ +/sqlite3/ +/irrklang/ +/ikpmp3/ +premake5.exe diff --git a/appveyor.yml b/appveyor.yml index fd3e1cd62..f31c355a7 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,11 @@ version: '{build}' +environment: + irrklang_pro: + secure: l0At/QtuW8XgdROZSAt4b3/pIssTVQ+EDpisjFzaaTUiWwBVDwE10C1bWuNqxk6O0Q54H0ZTBq0ZUXLNEx+59tRNe2F/KAbPjlFELry7gFI= + irrklang_pro_user: + secure: TOWMXao5dXWg9MVdlEYaGjIeT6McnHodbNSO7DIJCfU= + install: - git submodule update --init --recursive @@ -30,16 +36,25 @@ install: - 7z x sqlite-amalgamation-3200100.zip - move sqlite-amalgamation-3200100 sqlite3 + #- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://www.ambiera.at/downloads/irrKlang-32bit-1.5.0.zip ; exit 0" + #- 7z x irrKlang-32bit-1.5.0.zip + #- move irrKlang-1.5.0 irrklang + + - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name -u %irrklang_pro_user% %irrklang_pro% ; exit 0" + - 7z x irrKlang-pro-1.5.0.zip + - move irrKlang-pro-1.5.0 irrklang + - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://www.ambiera.at/downloads/irrKlang-32bit-1.5.0.zip ; exit 0" - 7z x irrKlang-32bit-1.5.0.zip - - move irrKlang-1.5.0 irrklang + - move irrKlang-1.5.0\plugins\ikpMP3 ikpmp3 # let premake happy - xcopy /E premake\* . # patch irrlicht - patch -p0 < irrlicht\irrlicht.patch - + - patch -p0 < ikpmp3\ikpmp3.patch + # premake - premake5 vs2015 @@ -52,8 +67,6 @@ build: after_build: - git checkout master - mv -f bin/release/ygopro.exe . - - mv -f irrklang\bin\win32-visualStudio\irrKlang.dll . - - mv -f irrklang\bin\win32-visualStudio\ikpMP3.dll . - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/purerosefallen/windbot/archive/master.zip ; exit 0" - 7z x windbot-master.zip @@ -91,7 +104,7 @@ after_build: - rm -rf pics/thumbnail pics/*.db - mkdir replay - - 7z a -mx9 -xr!.git* YGOPro-by-Koishi.7z ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound irrKlang.dll ikpMP3.dll WindBot Bot.exe bot.conf + - 7z a -mx9 -xr!.git* YGOPro-by-Koishi.7z ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay sound WindBot Bot.exe bot.conf test: off @@ -117,3 +130,7 @@ cache: - lua-5.2.4.tar.gz - sqlite-amalgamation-3200100.zip - irrKlang-32bit-1.5.0.zip + - irrKlang-pro-1.5.0.zip + - sqlite-amalgamation-3150200.zip + - premake-5.0.0-alpha10-windows.zip + - Redis-x64-3.2.100.zip diff --git a/gframe/config.h b/gframe/config.h index 9b5108f3a..3a13a53d2 100644 --- a/gframe/config.h +++ b/gframe/config.h @@ -49,6 +49,9 @@ inline int _wtoi(const wchar_t * s) { #include #include +#ifdef IRRKLANG_STATIC +#include "../ikpMP3/ikpMP3.h" +#endif #include #include #include "CGUITTFont.h" diff --git a/gframe/game.cpp b/gframe/game.cpp index e3f0e21b0..e3e0648af 100644 --- a/gframe/game.cpp +++ b/gframe/game.cpp @@ -664,6 +664,12 @@ bool Game::Initialize() { } engineSound = irrklang::createIrrKlangDevice(); engineMusic = irrklang::createIrrKlangDevice(); +#ifdef IRRKLANG_STATIC + if(engineMusic) { + irrklang::ikpMP3Init(engineSound); + irrklang::ikpMP3Init(engineMusic); + } +#endif if(!engineSound || !engineMusic) { chkEnableSound->setChecked(false); chkEnableSound->setEnabled(false); @@ -1085,6 +1091,8 @@ void Game::LoadConfig() { gameConf.separate_clear_button = 1; gameConf.auto_search_limit = 0; gameConf.chkIgnoreDeckChanges = 0; + gameConf.defaultOT = 1; + gameConf.enable_bot_mode = 1; gameConf.enable_sound = true; gameConf.sound_volume = 0.5; gameConf.enable_music = true; diff --git a/gframe/premake4.lua b/gframe/premake4.lua index 286597e68..b7c24ac4f 100644 --- a/gframe/premake4.lua +++ b/gframe/premake4.lua @@ -6,13 +6,23 @@ project "ygopro" files { "**.cpp", "**.cc", "**.c", "**.h" } excludes "lzma/**" includedirs { "../ocgcore" } - links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event", "irrKlang"} + links { "ocgcore", "clzma", "Irrlicht", "freetype", "sqlite3", "lua" , "event" } configuration "windows" files "ygopro.rc" excludes "CGUIButton.cpp" - includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3", "../irrklang/include" } - libdirs { "../irrklang/lib/Win32-visualStudio" } + includedirs { "../irrlicht/include", "../freetype/include", "../event/include", "../sqlite3" } + if USE_IRRKLANG then + defines { "YGOPRO_USE_IRRKLANG" } + links { "irrKlang", "ikpMP3" } + includedirs { "../irrklang/include" } + if IRRKLANG_PRO then + defines { "IRRKLANG_STATIC" } + libdirs { "../irrklang/bin/win32-visualstudio_lib" } + else + libdirs { "../irrklang/lib/Win32-visualStudio" } + end + end links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" } configuration {"windows", "not vs*"} includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" } diff --git a/premake/gframe/__iob_func_fix.cpp b/premake/gframe/__iob_func_fix.cpp new file mode 100644 index 000000000..59aadfcbc --- /dev/null +++ b/premake/gframe/__iob_func_fix.cpp @@ -0,0 +1,13 @@ +// fix irrklang static lib don't support VS2015 +// http://blog.csdn.net/10km/article/details/50528908 + +#if _MSC_VER >= 1900 +#include "stdio.h" +_ACRTIMP_ALT FILE* __cdecl __acrt_iob_func(unsigned); +#ifdef __cplusplus +extern "C" +#endif +FILE* __cdecl __iob_func(unsigned i) { + return __acrt_iob_func(i); +} +#endif // _MSC_VER >= 1900 diff --git a/premake/ikpmp3/ikpMP3.h b/premake/ikpmp3/ikpMP3.h new file mode 100644 index 000000000..c5c927e02 --- /dev/null +++ b/premake/ikpmp3/ikpMP3.h @@ -0,0 +1,12 @@ +#include + +namespace irrklang +{ +#ifdef WIN32 + // Windows version + extern "C" __declspec(dllexport) void ikpMP3Init(ISoundEngine* engine); +#else + // Linux version + extern "C" void ikpMP3Init(ISoundEngine* engine); +#endif +} \ No newline at end of file diff --git a/premake/ikpmp3/ikpmp3.patch b/premake/ikpmp3/ikpmp3.patch new file mode 100644 index 000000000..a1504fb7e --- /dev/null +++ b/premake/ikpmp3/ikpmp3.patch @@ -0,0 +1,47 @@ +diff -ur ikpmp3/CIrrKlangAudioStreamMP3.cpp ikpmp3-static/CIrrKlangAudioStreamMP3.cpp +--- ikpmp3/CIrrKlangAudioStreamMP3.cpp 2009-01-02 07:33:40.000000000 +0800 ++++ ikpmp3-static/CIrrKlangAudioStreamMP3.cpp 2017-11-27 19:18:34.295546800 +0800 +@@ -8,6 +8,7 @@ + #include + #include // free, malloc and realloc + #include ++#include + + namespace irrklang + { +diff -ur ikpmp3/ikpMP3.cpp ikpmp3-static/ikpMP3.cpp +--- ikpmp3/ikpMP3.cpp 2007-10-28 18:14:00.000000000 +0800 ++++ ikpmp3-static/ikpMP3.cpp 2017-11-27 19:49:02.119092400 +0800 +@@ -6,30 +6,14 @@ + + using namespace irrklang; + +-// this is the only function needed to be implemented for the plugin, it gets +-// called by irrKlang when loaded. +-// In this plugin, we create an audiostream loader class and register +-// it at the engine, but a plugin can do anything. +-// Be sure to name the function 'irrKlangPluginInit' and let the dll start with 'ikp'. +- + #ifdef WIN32 + // Windows version +-__declspec(dllexport) void __stdcall irrKlangPluginInit(ISoundEngine* engine, const char* version) ++extern "C" __declspec(dllexport) void ikpMP3Init(ISoundEngine* engine) + #else + // Linux version +-void irrKlangPluginInit(ISoundEngine* engine, const char* version) ++extern "C" void ikpMP3Init(ISoundEngine* engine) + #endif + { +- // do some version security check to be sure that this plugin isn't begin used +- // by some newer irrKlang version with changed interfaces which could possibily +- // cause crashes. +- +- if (strcmp(version, IRR_KLANG_VERSION)) +- { +- printf("This MP3 plugin only supports irrKlang version %s, mp3 playback disabled.\n", IRR_KLANG_VERSION); +- return; +- } +- + // create and register the loader + + CIrrKlangAudioStreamLoaderMP3* loader = new CIrrKlangAudioStreamLoaderMP3(); diff --git a/premake/ikpmp3/premake4.lua b/premake/ikpmp3/premake4.lua new file mode 100644 index 000000000..3ff23f4cf --- /dev/null +++ b/premake/ikpmp3/premake4.lua @@ -0,0 +1,5 @@ +project "ikpMP3" + kind "StaticLib" + + files { "*.cpp", "*.h", "decoder/*.c", "decoder/*.h" } + includedirs { "../irrklang/include" } diff --git a/premake5.lua b/premake5.lua index 9fd96debe..9c32f472a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -3,6 +3,12 @@ solution "ygo" language "C++" objdir "obj" + USE_IRRKLANG = true + if os.getenv("irrklang_pro") then + IRRKLANG_PRO = true + end + + configurations { "Debug", "Release" } configuration "windows" @@ -67,4 +73,7 @@ solution "ygo" include "irrlicht" include "lua" include "sqlite3" + if IRRKLANG_PRO then + include "ikpmp3" + end end