Skip to content
This repository has been archived by the owner on Apr 6, 2018. It is now read-only.

Commit

Permalink
Merge branch 'koishibuild' of https://github.com/purerosefallen/ygopr…
Browse files Browse the repository at this point in the history
…o-7210srv into koishibuild
  • Loading branch information
Smile-DK committed Nov 27, 2017
2 parents 61a03de + 09d6b3f commit 6b00efd
Show file tree
Hide file tree
Showing 10 changed files with 148 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
27 changes: 22 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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
3 changes: 3 additions & 0 deletions gframe/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ inline int _wtoi(const wchar_t * s) {

#include <irrlicht.h>
#include <irrKlang.h>
#ifdef IRRKLANG_STATIC
#include "../ikpMP3/ikpMP3.h"
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#include "CGUITTFont.h"
Expand Down
8 changes: 8 additions & 0 deletions gframe/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
16 changes: 13 additions & 3 deletions gframe/premake4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
13 changes: 13 additions & 0 deletions premake/gframe/__iob_func_fix.cpp
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions premake/ikpmp3/ikpMP3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <irrKlang.h>

namespace irrklang
{
#ifdef WIN32
// Windows version
extern "C" __declspec(dllexport) void ikpMP3Init(ISoundEngine* engine);
#else
// Linux version
extern "C" void ikpMP3Init(ISoundEngine* engine);
#endif
}
47 changes: 47 additions & 0 deletions premake/ikpmp3/ikpmp3.patch
Original file line number Diff line number Diff line change
@@ -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 <memory.h>
#include <stdlib.h> // free, malloc and realloc
#include <string.h>
+#include <algorithm>

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();
5 changes: 5 additions & 0 deletions premake/ikpmp3/premake4.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project "ikpMP3"
kind "StaticLib"

files { "*.cpp", "*.h", "decoder/*.c", "decoder/*.h" }
includedirs { "../irrklang/include" }
9 changes: 9 additions & 0 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -67,4 +73,7 @@ solution "ygo"
include "irrlicht"
include "lua"
include "sqlite3"
if IRRKLANG_PRO then
include "ikpmp3"
end
end

0 comments on commit 6b00efd

Please sign in to comment.