Commit 7d9c4138 authored by mercury233's avatar mercury233

update ci

parent 4ca5bd93
......@@ -56,8 +56,11 @@ before_deploy:
- mkdir pics
- curl --location --retry 5 --output 'ygopro-images-zh-CN.zip' https://github.com/mycard/ygopro-images/releases/download/latest/ygopro-images-zh-CN.zip
- unzip -q -d pics ygopro-images-zh-CN.zip
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -zcf ygopro-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz --exclude='.git*' ygopro.app LICENSE README.md lflist.conf script strings.conf system.conf textures deck cards.cdb pics replay; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -zcf ygopro-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz --exclude='.git*' ygopro LICENSE README.md lflist.conf script strings.conf system.conf textures deck cards.cdb pics replay; fi
- curl --location --retry 5 --output 'ygopro-starter-pack-master.zip' https://github.com/mycard/ygopro-starter-pack/archive/master.zip
- unzip -q ygopro-starter-pack-master.zip
- cp ygopro-starter-pack-master/* .
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tar -zcf ygopro-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz --exclude='.git*' ygopro.app LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tar -zcf ygopro-$TRAVIS_TAG-$TRAVIS_OS_NAME.tar.gz --exclude='.git*' ygopro LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay; fi
deploy:
provider: releases
file:
......
version: '{build}'
install:
# fix tar xz
- set PATH=%PATH%;C:\MinGW\msys\1.0\bin
......@@ -7,42 +8,47 @@ install:
- git submodule update --init --recursive
# environment and system dependency
- curl --location --retry 5 --output 'premake-5.0.0-alpha9-windows.zip' 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha9/premake-5.0.0-alpha9-windows.zip'
- 7z x premake-5.0.0-alpha9-windows.zip
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-windows.zip ; exit 0"
- 7z x premake-5.0.0-alpha10-windows.zip
- curl --location --retry 5 'https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz' | tar zxf -
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz ; exit 0"
- tar xf libevent-2.0.22-stable.tar.gz
- move libevent-2.0.22-stable event
- xcopy /E event\WIN32-Code event\include
- curl --location --retry 5 'http://downloads.sourceforge.net/freetype/freetype-2.7.tar.bz2' | tar jxf -
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://downloads.sourceforge.net/freetype/freetype-2.7.tar.bz2 ; exit 0"
- tar xf freetype-2.7.tar.bz2
- move freetype-2.7 freetype
- curl --location --retry 5 --output 'irrlicht-1.8.4.zip' 'http://downloads.sourceforge.net/irrlicht/irrlicht-1.8.4.zip'
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name http://downloads.sourceforge.net/irrlicht/irrlicht-1.8.4.zip ; exit 0"
- 7z x irrlicht-1.8.4.zip
- md irrlicht
- move irrlicht-1.8.4\source\Irrlicht irrlicht\src
- move irrlicht-1.8.4\include irrlicht\include
- curl --location --retry 5 'https://www.lua.org/ftp/lua-5.2.4.tar.gz' | tar zxf -
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.2.4.tar.gz ; exit 0"
- tar xf lua-5.2.4.tar.gz
- move lua-5.2.4\src lua
- curl --location --retry 5 --output 'sqlite-amalgamation-3140200.zip' 'https://www.sqlite.org/2016/sqlite-amalgamation-3140200.zip'
- 7z x sqlite-amalgamation-3140200.zip
- move sqlite-amalgamation-3140200 sqlite3
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip ; exit 0"
- 7z x sqlite-amalgamation-3150200.zip
- move sqlite-amalgamation-3150200 sqlite3
# let premake happy
- xcopy /E premake\* .
# patch irrlicht
- patch -p0 < irrlicht\irrlicht.patch
- patch -p1 < irrlicht\irrlicht.patch
# premake
- premake5 vs2015
configuration: Release
build:
build:
project: build/ygo.sln
parallel: true
after_build:
- mv bin\release\ygopro.exe .
- curl --location --retry 5 'https://github.com/mycard/ygopro-database/archive/master.tar.gz' | tar --strip-components=1 -zxf - ygopro-database-master/locales
......@@ -51,7 +57,10 @@ after_build:
- mkdir pics
- curl --location --retry 5 --output 'ygopro-images-zh-CN.zip' https://github.com/mycard/ygopro-images/releases/download/latest/ygopro-images-zh-CN.zip
- unzip -q -d pics ygopro-images-zh-CN.zip
- tar -zcf ygopro-%APPVEYOR_REPO_TAG_NAME%-win32.tar.gz --exclude='.git*' ygopro.exe LICENSE README.md lflist.conf script strings.conf system.conf textures deck cards.cdb pics replay
- curl --location --retry 5 --output 'ygopro-starter-pack-master.zip' https://github.com/mycard/ygopro-starter-pack/archive/master.zip
- unzip -q ygopro-starter-pack-master.zip
- xcopy /E ygopro-starter-pack-master\* .
- tar -zcf ygopro-%APPVEYOR_REPO_TAG_NAME%-win32.tar.gz --exclude='.git*' ygopro.exe LICENSE README.md lflist.conf strings.conf system.conf cards.cdb script textures deck single pics replay
# 语言包
- cd locales/en-US
- mkdir pics # 下载那个语言的卡图
......@@ -65,6 +74,9 @@ after_build:
- unzip -q -d pics ygopro-images-ja-JP.zip
- tar -zcf ../../ygopro-lang-ja-JP-%APPVEYOR_REPO_TAG_NAME%.tar.gz --exclude='.git*' cards.cdb strings.conf pics
- cd ../..
test: off
artifacts:
- path: ygopro-$(APPVEYOR_REPO_TAG_NAME)-win32.tar.gz
name: ygopro
......@@ -72,6 +84,7 @@ artifacts:
name: ygopro-lang-en-US
- path: ygopro-lang-ja-JP-$(APPVEYOR_REPO_TAG_NAME).tar.gz
name: ygopro-lang-ja-JP
deploy:
description: 'Automatic build'
provider: GitHub
......@@ -79,7 +92,16 @@ deploy:
secure: itZ9Z1dxEpfPJLdTs/PiY98pVZ3GCLNWfid7eAu7SL88Jl9AIrf/3rviKFEbsnoY # your encrypted token from GitHub
on:
appveyor_repo_tag: true # deploy on tag push only
branches:
only:
- master
- /\d+\..+/
cache:
- premake-5.0.0-alpha10-windows.zip
- libevent-2.0.22-stable.tar.gz
- freetype-2.7.tar.bz2
- irrlicht-1.8.4.zip
- lua-5.2.4.tar.gz
- sqlite-amalgamation-3150200.zip
#created by ...
#main
89631139
89631139
89631139
38517737
38517737
38517737
45467446
8240199
8240199
8240199
45644898
45644898
71039903
71039903
71039903
79814787
97268402
97268402
23434538
23434538
48800175
48800175
48800175
41620959
41620959
41620959
6853254
6853254
6853254
39701395
39701395
39701395
38120068
38120068
38120068
43898403
43898403
54447022
63356631
63356631
5851097
84749824
#extra
59822133
59822133
40908371
40908371
50954680
83994433
33698022
58820923
39030163
31801517
63767246
2978414
10406322
64332231
10443957
!side
8233522
8233522
56399890
25789292
25789292
43898403
53129443
43455065
43455065
11109820
11109820
11109820
29549364
29549364
29549364
......@@ -16,8 +16,8 @@ VALUE "InternalName", "YGOPro"
VALUE "LegalCopyright", "Copyright (C) 2016 Fluorohydride"
VALUE "OriginalFilename", "ygopro.exe"
VALUE "ProductName", "YGOPro"
VALUE "FileVersion", "1.033.C.8"
VALUE "ProductVersion", "1.033.C.8"
VALUE "FileVersion", "1.033.C"
VALUE "ProductVersion", "1.033.C"
END
END
BLOCK "VarFileInfo"
......
diff -ur --strip-trailing-cr irrlicht/include/IOSOperator.h irrlicht-fixed/include/IOSOperator.h
--- irrlicht/include/IOSOperator.h 2012-11-03 10:08:34.000000000 +0000
+++ irrlicht-fixed/include/IOSOperator.h 2015-06-14 17:32:58.000000000 +0000
@@ -26,11 +26,11 @@
diff --git a/irrlicht/include/IOSOperator.h b/irrlicht/include/IOSOperator.h
index b5c6236..b2e864a 100644
--- a/irrlicht/include/IOSOperator.h
+++ b/irrlicht/include/IOSOperator.h
@@ -26,11 +26,11 @@ public:
}
//! Copies text to the clipboard
......@@ -15,24 +16,26 @@ diff -ur --strip-trailing-cr irrlicht/include/IOSOperator.h irrlicht-fixed/inclu
//! Get the processor speed in megahertz
/** \param MHz The integer variable to store the speed in.
diff -ur --strip-trailing-cr irrlicht/include/irrTypes.h irrlicht-fixed/include/irrTypes.h
--- irrlicht/include/irrTypes.h 2012-11-03 10:08:34.000000000 +0000
+++ irrlicht-fixed/include/irrTypes.h 2015-06-14 17:32:58.000000000 +0000
@@ -48,7 +48,9 @@
typedef signed short s16;
diff --git a/irrlicht/include/IrrCompileConfig.h b/irrlicht/include/IrrCompileConfig.h
index c2c5d12..7c44f0c 100644
--- a/irrlicht/include/IrrCompileConfig.h
+++ b/irrlicht/include/IrrCompileConfig.h
@@ -233,7 +233,9 @@ you will not be able to use anything provided by the GUI Environment, including
disable this feature, the engine behave as before (ansi). This is currently only supported
for Windows based systems. You also have to set #define UNICODE for this to compile.
*/
-//#define _IRR_WCHAR_FILESYSTEM
+#if defined(_IRR_WINDOWS_) && (defined(_UNICODE) || defined(UNICODE))
+#define _IRR_WCHAR_FILESYSTEM
+#endif
#ifdef NO_IRR_WCHAR_FILESYSTEM
#undef _IRR_WCHAR_FILESYSTEM
#endif
-
+//! 16 bit character variable.
+/** This is a typedef for wchar_t, it ensures portability of the engine. */
+typedef wchar_t c16;
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
diff -ur --strip-trailing-cr irrlicht/include/Keycodes.h irrlicht-fixed/include/Keycodes.h
--- irrlicht/include/Keycodes.h 2012-11-03 10:08:32.000000000 +0000
+++ irrlicht-fixed/include/Keycodes.h 2015-06-14 17:32:58.000000000 +0000
@@ -89,7 +89,7 @@
diff --git a/irrlicht/include/Keycodes.h b/irrlicht/include/Keycodes.h
index e56eca1..57ab312 100644
--- a/irrlicht/include/Keycodes.h
+++ b/irrlicht/include/Keycodes.h
@@ -89,7 +89,7 @@ namespace irr
KEY_KEY_X = 0x58, // X key
KEY_KEY_Y = 0x59, // Y key
KEY_KEY_Z = 0x5A, // Z key
......@@ -41,49 +44,26 @@ diff -ur --strip-trailing-cr irrlicht/include/Keycodes.h irrlicht-fixed/include/
KEY_RWIN = 0x5C, // Right Windows key (Natural keyboard)
KEY_APPS = 0x5D, // Applications key (Natural keyboard)
KEY_SLEEP = 0x5F, // Computer Sleep key
diff -ur --strip-trailing-cr irrlicht/src/CD3D9ShaderMaterialRenderer.cpp irrlicht-fixed/src/CD3D9ShaderMaterialRenderer.cpp
--- irrlicht/src/CD3D9ShaderMaterialRenderer.cpp 2012-11-03 10:08:10.000000000 +0000
+++ irrlicht-fixed/src/CD3D9ShaderMaterialRenderer.cpp 2015-06-14 17:32:58.000000000 +0000
@@ -329,7 +329,7 @@
strDllName += (int)D3DX_SDK_VERSION;
strDllName += ".dll";
- HMODULE hMod = LoadLibrary(strDllName.c_str());
+ HMODULE hMod = LoadLibraryA(strDllName.c_str());
if (hMod)
pFn = (AssembleShaderFunction)GetProcAddress(hMod, "D3DXAssembleShader");
@@ -389,7 +389,7 @@
strDllName += (int)D3DX_SDK_VERSION;
strDllName += ".dll";
- HMODULE hMod = LoadLibrary(strDllName.c_str());
+ HMODULE hMod = LoadLibraryA(strDllName.c_str());
if (hMod)
pFn = (AssembleShaderFromFileFunction)GetProcAddress(hMod, "D3DXAssembleShaderFromFileA");
@@ -450,7 +450,7 @@
strDllName += (int)D3DX_SDK_VERSION;
strDllName += ".dll";
- HMODULE hMod = LoadLibrary(strDllName.c_str());
+ HMODULE hMod = LoadLibraryA(strDllName.c_str());
if (hMod)
pFn = (D3DXCompileShaderFunction)GetProcAddress(hMod, "D3DXCompileShader");
@@ -510,7 +510,7 @@
strDllName += (int)D3DX_SDK_VERSION;
strDllName += ".dll";
diff --git a/irrlicht/include/irrTypes.h b/irrlicht/include/irrTypes.h
index cfeaf84..a656631 100644
--- a/irrlicht/include/irrTypes.h
+++ b/irrlicht/include/irrTypes.h
@@ -48,7 +48,9 @@ typedef __int16 s16;
typedef signed short s16;
#endif
- HMODULE hMod = LoadLibrary(strDllName.c_str());
+ HMODULE hMod = LoadLibraryA(strDllName.c_str());
if (hMod)
pFn = (D3DXCompileShaderFromFileFunction)GetProcAddress(hMod, "D3DXCompileShaderFromFileA");
-
+//! 16 bit character variable.
+/** This is a typedef for wchar_t, it ensures portability of the engine. */
+typedef wchar_t c16;
diff -ur --strip-trailing-cr irrlicht/src/CGUIEditBox.cpp irrlicht-fixed/src/CGUIEditBox.cpp
--- irrlicht/src/CGUIEditBox.cpp 2012-11-03 10:08:16.000000000 +0000
+++ irrlicht-fixed/src/CGUIEditBox.cpp 2015-06-14 17:32:58.000000000 +0000
@@ -286,7 +286,7 @@
//! 32 bit unsigned variable.
/** This is a typedef for unsigned int, it ensures portability of the engine. */
diff --git a/irrlicht/src/CGUIEditBox.cpp b/irrlicht/src/CGUIEditBox.cpp
index f33b5a2..8375444 100644
--- a/irrlicht/src/CGUIEditBox.cpp
+++ b/irrlicht/src/CGUIEditBox.cpp
@@ -287,7 +287,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmbgn = MarkBegin < MarkEnd ? MarkBegin : MarkEnd;
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
......@@ -92,7 +72,7 @@ diff -ur --strip-trailing-cr irrlicht/src/CGUIEditBox.cpp irrlicht-fixed/src/CGU
s = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(s.c_str());
}
@@ -299,7 +299,7 @@
@@ -300,7 +300,7 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// copy
......@@ -101,7 +81,7 @@ diff -ur --strip-trailing-cr irrlicht/src/CGUIEditBox.cpp irrlicht-fixed/src/CGU
sc = Text.subString(realmbgn, realmend - realmbgn).c_str();
Operator->copyToClipboard(sc.c_str());
@@ -329,7 +329,7 @@
@@ -330,16 +330,10 @@ bool CGUIEditBox::processKey(const SEvent& event)
const s32 realmend = MarkBegin < MarkEnd ? MarkEnd : MarkBegin;
// add new character
......@@ -109,11 +89,22 @@ diff -ur --strip-trailing-cr irrlicht/src/CGUIEditBox.cpp irrlicht-fixed/src/CGU
+ const c16* p = Operator->getTextFromClipboard();
if (p)
{
- // TODO: we should have such a function in core::string
- size_t lenOld = strlen(p);
- wchar_t *ws = new wchar_t[lenOld + 1];
- size_t len = mbstowcs(ws,p,lenOld);
- ws[len] = 0;
- irr::core::stringw widep(ws);
- delete[] ws;
+ irr::core::stringw widep(p);
if (MarkBegin == MarkEnd)
diff -ur --strip-trailing-cr irrlicht/src/CIrrDeviceWin32.cpp irrlicht-fixed/src/CIrrDeviceWin32.cpp
--- irrlicht/src/CIrrDeviceWin32.cpp 2012-11-05 07:14:12.000000000 +0000
+++ irrlicht-fixed/src/CIrrDeviceWin32.cpp 2015-06-14 17:32:58.000000000 +0000
@@ -16,14 +16,16 @@
{
diff --git a/irrlicht/src/CIrrDeviceWin32.cpp b/irrlicht/src/CIrrDeviceWin32.cpp
index f96c178..2e7a9ee 100644
--- a/irrlicht/src/CIrrDeviceWin32.cpp
+++ b/irrlicht/src/CIrrDeviceWin32.cpp
@@ -20,6 +20,8 @@
#include "COSOperator.h"
#include "dimension2d.h"
#include "IGUISpriteBank.h"
......@@ -122,16 +113,60 @@ diff -ur --strip-trailing-cr irrlicht/src/CIrrDeviceWin32.cpp irrlicht-fixed/src
#include <winuser.h>
#if defined(_IRR_COMPILE_WITH_JOYSTICK_EVENTS_)
#ifdef _IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_
#define DIRECTINPUT_VERSION 0x0800
+#define INITGUID
#include <dinput.h>
#ifdef _MSC_VER
#pragma comment(lib, "dinput8.lib")
-#pragma comment(lib, "dxguid.lib")
#endif
#else
#ifdef _MSC_VER
@@ -900,8 +902,36 @@
@@ -749,6 +751,26 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
return 0;
}
+ {
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ {
+ irr::gui::IGUIElement* ele = dev->getGUIEnvironment()->getFocus();
+ if (!ele || (ele->getType() != irr::gui::EGUIET_EDIT_BOX) || !ele->isEnabled())
+ {
+ HIMC hIMC = ImmGetContext(hWnd);
+ if (hIMC)
+ {
+ ImmNotifyIME(hIMC, NI_COMPOSITIONSTR, CPS_COMPLETE, 0);
+ ImmReleaseContext(hWnd, hIMC);
+ }
+ ImmAssociateContextEx(hWnd, NULL, 0);
+ }
+ else
+ ImmAssociateContextEx(hWnd, NULL, IACE_DEFAULT);
+ }
+ }
+
switch (message)
{
case WM_PAINT:
@@ -773,22 +795,21 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
event.KeyInput.Key = (irr::EKEY_CODE)wParam;
event.KeyInput.PressedDown = (message==WM_KEYDOWN || message == WM_SYSKEYDOWN);
- const UINT MY_MAPVK_VSC_TO_VK_EX = 3; // MAPVK_VSC_TO_VK_EX should be in SDK according to MSDN, but isn't in mine.
if ( event.KeyInput.Key == irr::KEY_SHIFT )
{
// this will fail on systems before windows NT/2000/XP, not sure _what_ will return there instead.
- event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
+ event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
}
if ( event.KeyInput.Key == irr::KEY_CONTROL )
{
- event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
+ event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
// some keyboards will just return LEFT for both - left and right keys. So also check extend bit.
if (lParam & 0x1000000)
event.KeyInput.Key = irr::KEY_RCONTROL;
}
if ( event.KeyInput.Key == irr::KEY_MENU )
{
- event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MY_MAPVK_VSC_TO_VK_EX );
+ event.KeyInput.Key = (irr::EKEY_CODE)MapVirtualKey( ((lParam>>16) & 255), MAPVK_VSC_TO_VK_EX );
if (lParam & 0x1000000)
event.KeyInput.Key = irr::KEY_RMENU;
}
@@ -904,6 +925,53 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
KEYBOARD_INPUT_HKL = GetKeyboardLayout(0);
KEYBOARD_INPUT_CODEPAGE = LocaleIdToCodepage( LOWORD(KEYBOARD_INPUT_HKL) );
return 0;
......@@ -140,342 +175,67 @@ diff -ur --strip-trailing-cr irrlicht/src/CIrrDeviceWin32.cpp irrlicht-fixed/src
+ {
+ dev = getDeviceFromHWnd(hWnd);
+ irr::gui::IGUIElement* ele = dev->getGUIEnvironment()->getFocus();
+ if(!ele)
+ if (!ele)
+ break;
+ irr::core::position2di pos = ele->getAbsolutePosition().UpperLeftCorner;
+ HIMC hIMC = ::ImmGetContext(hWnd);
+ COMPOSITIONFORM CompForm;
+ CompForm.dwStyle = CFS_CANDIDATEPOS;
+ CompForm.ptCurrentPos.x = pos.X;
+ CompForm.ptCurrentPos.y = pos.Y + ele->getAbsolutePosition().getHeight();
+ ::ImmSetCompositionWindow(hIMC, &CompForm);
+ ::ImmReleaseContext(hWnd, hIMC);
+ COMPOSITIONFORM CompForm = { CFS_POINT, { pos.X, pos.Y + ele->getAbsolutePosition().getHeight() } };
+ HIMC hIMC = ImmGetContext(hWnd);
+ ImmSetCompositionWindow(hIMC, &CompForm);
+ ImmReleaseContext(hWnd, hIMC);
+ }
+ break;
+
+ case WM_IME_CHAR:
+ event.EventType = irr::EET_KEY_INPUT_EVENT;
+ event.KeyInput.PressedDown = true;
+ dev = getDeviceFromHWnd(hWnd);
+#ifdef _UNICODE
+ event.KeyInput.Char = wParam;
+#else
+ BYTE ch[3];
+ if(wParam >> 8) {
+ ch[0] = wParam >> 8;
+ ch[1] = wParam & 0xff;
+ ch[2] = 0;
+ } else {
+ ch[0] = wParam;
+ ch[1] = 0;
+ }
+ WORD unicodeChar;
+ MultiByteToWideChar(
+ KEYBOARD_INPUT_CODEPAGE,
+ MB_PRECOMPOSED, // default
+ (LPCSTR)ch,
+ sizeof(wParam),
+ (WCHAR*)&unicodeChar,
+ 1);
+ event.KeyInput.Char = unicodeChar;
+#endif
+ event.KeyInput.Key = irr::KEY_ACCEPT;
+ event.KeyInput.Shift = 0;
+ event.KeyInput.Control = 0;
+ dev = getDeviceFromHWnd(hWnd);
+ if (dev)
+ dev->postEventFromUser(event);
+ return 0;
}
- return DefWindowProc(hWnd, message, wParam, lParam);
+ return DefWindowProcW(hWnd, message, wParam, lParam);
return DefWindowProc(hWnd, message, wParam, lParam);
}
@@ -1797,8 +1865,8 @@ void CIrrDeviceWin32::handleSystemMessages()
@@ -931,15 +961,15 @@
memset(&DesktopMode, 0, sizeof(DesktopMode));
DesktopMode.dmSize = sizeof(DesktopMode);
- EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DesktopMode);
+ EnumDisplaySettingsW(NULL, ENUM_CURRENT_SETTINGS, &DesktopMode);
// create the window if we need to and we do not use the null device
if (!CreationParams.WindowId && CreationParams.DriverType != video::EDT_NULL)
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
- const fschar_t* ClassName = __TEXT("CIrrDeviceWin32");
+ const wchar_t* ClassName = L"CIrrDeviceWin32";
// Register Class
- WNDCLASSEX wcex;
+ WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = WndProc;
@@ -954,9 +984,9 @@
wcex.hIconSm = 0;
// if there is an icon, load it
- wcex.hIcon = (HICON)LoadImage(hInstance, __TEXT("irrlicht.ico"), IMAGE_ICON, 0,0, LR_LOADFROMFILE);
+ wcex.hIcon = (HICON)LoadImageW(hInstance, L"irrlicht.ico", IMAGE_ICON, 0,0, LR_LOADFROMFILE);
- RegisterClassEx(&wcex);
+ RegisterClassExW(&wcex);
// calculate client size
@@ -992,7 +1022,7 @@
// create window
- HWnd = CreateWindow( ClassName, __TEXT(""), style, windowLeft, windowTop,
+ HWnd = CreateWindowW( ClassName, L"", style, windowLeft, windowTop,
realWidth, realHeight, NULL, NULL, hInstance, NULL);
CreationParams.WindowId = HWnd;
// CreationParams.WindowSize.Width = realWidth;
@@ -1297,15 +1327,15 @@
void CIrrDeviceWin32::closeDevice()
{
MSG msg;
- PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
+ PeekMessageW(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
PostQuitMessage(0);
- PeekMessage(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
+ PeekMessageW(&msg, NULL, WM_QUIT, WM_QUIT, PM_REMOVE);
if (!ExternalWindow)
{
DestroyWindow(HWnd);
- const fschar_t* ClassName = __TEXT("CIrrDeviceWin32");
+ const wchar_t* ClassName = L"CIrrDeviceWin32";
HINSTANCE hInstance = GetModuleHandle(0);
- UnregisterClass(ClassName, hInstance);
+ UnregisterClassW(ClassName, hInstance);
}
Close=true;
}
@@ -1351,7 +1381,7 @@
{
if (ChangedToFullScreen)
{
- return (ChangeDisplaySettings(&DesktopMode,0)==DISP_CHANGE_SUCCESSFUL);
+ return (ChangeDisplaySettingsW(&DesktopMode,0)==DISP_CHANGE_SUCCESSFUL);
}
else
return true;
@@ -1478,18 +1508,18 @@
void CIrrDeviceWin32::getWindowsVersion(core::stringc& out)
{
- OSVERSIONINFOEX osvi;
+ OSVERSIONINFOEXW osvi;
PGPI pGPI;
BOOL bOsVersionInfoEx;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXW));
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXW);
- bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO*) &osvi);
+ bOsVersionInfoEx = GetVersionExW((OSVERSIONINFOW*) &osvi);
if (!bOsVersionInfoEx)
{
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- if (! GetVersionEx((OSVERSIONINFO *) &osvi))
+ osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
+ if (! GetVersionExW((OSVERSIONINFOW *) &osvi))
return;
}
@@ -1528,7 +1558,7 @@
if (osvi.dwMajorVersion == 6)
{
DWORD dwType;
- pGPI = (PGPI)GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetProductInfo");
+ pGPI = (PGPI)GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "GetProductInfo");
pGPI(osvi.dwMajorVersion, osvi.dwMinorVersion, 0, 0, &dwType);
switch (dwType)
@@ -1594,21 +1624,21 @@
else
{
HKEY hKey;
- char szProductType[80];
+ wchar_t szProductType[80];
DWORD dwBufLen;
- RegOpenKeyEx( HKEY_LOCAL_MACHINE,
- __TEXT("SYSTEM\\CurrentControlSet\\Control\\ProductOptions"),
+ RegOpenKeyExW( HKEY_LOCAL_MACHINE,
+ L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
0, KEY_QUERY_VALUE, &hKey );
- RegQueryValueEx( hKey, __TEXT("ProductType"), NULL, NULL,
+ RegQueryValueExW( hKey, L"ProductType", NULL, NULL,
(LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );
- if (_strcmpi( "WINNT", szProductType) == 0 )
+ if (lstrcmpiW( L"WINNT", szProductType) == 0 )
out.append("Professional ");
- if (_strcmpi( "LANMANNT", szProductType) == 0)
+ if (lstrcmpiW( L"LANMANNT", szProductType) == 0)
out.append("Server ");
- if (_strcmpi( "SERVERNT", szProductType) == 0)
+ if (lstrcmpiW( L"SERVERNT", szProductType) == 0)
out.append("Advanced Server ");
}
@@ -1679,7 +1709,7 @@
else
style = WS_THICKFRAME | WS_SYSMENU | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
- if (!SetWindowLongPtr(HWnd, GWL_STYLE, style))
+ if (!SetWindowLongPtrW(HWnd, GWL_STYLE, style))
os::Printer::log("Could not change window style.");
RECT clientSize;
@@ -1791,15 +1821,15 @@
{
MSG msg;
- while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
+ while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE))
{
// No message translation because we don't use WM_CHAR and it would conflict with our
// deadkey handling.
-
- // No message translation because we don't use WM_CHAR and it would conflict with our
- // deadkey handling.
+ // conflict with deadkey handling.
+ TranslateMessage(&msg);
if (ExternalWindow && msg.hwnd == HWnd)
WndProc(HWnd, msg.message, msg.wParam, msg.lParam);
else
- DispatchMessage(&msg);
+ DispatchMessageW(&msg);
if (msg.message == WM_QUIT)
Close = true;
@@ -1811,9 +1841,9 @@
void CIrrDeviceWin32::clearSystemMessages()
{
MSG msg;
- while (PeekMessage(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
+ while (PeekMessageW(&msg, NULL, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE))
{}
- while (PeekMessage(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
+ while (PeekMessageW(&msg, NULL, WM_MOUSEFIRST, WM_MOUSELAST, PM_REMOVE))
{}
}
@@ -1821,12 +1851,12 @@
void CIrrDeviceWin32::ReportLastWinApiError()
{
// (based on code from ovidiucucu from http://www.codeguru.com/forum/showthread.php?t=318721)
- LPCTSTR pszCaption = __TEXT("Windows SDK Error Report");
+ LPCWSTR pszCaption = L"Windows SDK Error Report";
DWORD dwError = GetLastError();
if(NOERROR == dwError)
{
- MessageBox(NULL, __TEXT("No error"), pszCaption, MB_OK);
+ MessageBoxW(NULL, L"No error", pszCaption, MB_OK);
}
else
{
@@ -1835,21 +1865,21 @@
FORMAT_MESSAGE_FROM_SYSTEM;
LPVOID pTextBuffer = NULL;
- DWORD dwCount = FormatMessage(dwFormatControl,
+ DWORD dwCount = FormatMessageW(dwFormatControl,
NULL,
dwError,
0,
- (LPTSTR) &pTextBuffer,
+ (LPWSTR)&pTextBuffer,
0,
NULL);
if(0 != dwCount)
{
- MessageBox(NULL, (LPCTSTR)pTextBuffer, pszCaption, MB_OK|MB_ICONERROR);
+ MessageBoxW(NULL, (LPCWSTR)pTextBuffer, pszCaption, MB_OK|MB_ICONERROR);
LocalFree(pTextBuffer);
}
else
{
- MessageBox(NULL, __TEXT("Unknown error"), pszCaption, MB_OK|MB_ICONERROR);
+ MessageBoxW(NULL, L"Unknown error", pszCaption, MB_OK|MB_ICONERROR);
}
}
}
diff -ur --strip-trailing-cr irrlicht/src/CIrrDeviceWin32.h irrlicht-fixed/src/CIrrDeviceWin32.h
--- irrlicht/src/CIrrDeviceWin32.h 2012-11-05 07:14:12.000000000 +0000
+++ irrlicht-fixed/src/CIrrDeviceWin32.h 2015-06-14 17:32:58.000000000 +0000
@@ -395,7 +395,7 @@
bool Resized;
bool ExternalWindow;
CCursorControl* Win32CursorControl;
- DEVMODE DesktopMode;
+ DEVMODEW DesktopMode;
SJoystickWin32Control* JoyControl;
};
diff -ur --strip-trailing-cr irrlicht/src/COpenGLDriver.cpp irrlicht-fixed/src/COpenGLDriver.cpp
--- irrlicht/src/COpenGLDriver.cpp 2012-11-03 10:08:08.000000000 +0000
+++ irrlicht-fixed/src/COpenGLDriver.cpp 2015-06-14 17:32:58.000000000 +0000
@@ -85,11 +85,11 @@
bool COpenGLDriver::initDriver(CIrrDeviceWin32* device)
{
// Create a window to test antialiasing support
- const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32");
+ const wchar_t* ClassName = L"GLCIrrDeviceWin32";
HINSTANCE lhInstance = GetModuleHandle(0);
// Register Class
- WNDCLASSEX wcex;
+ WNDCLASSEXW wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)DefWindowProc;
@@ -103,7 +103,7 @@
wcex.lpszClassName = ClassName;
wcex.hIconSm = 0;
wcex.hIcon = 0;
- RegisterClassEx(&wcex);
+ RegisterClassExW(&wcex);
RECT clientSize;
clientSize.top = 0;
@@ -123,13 +123,13 @@
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
- HWND temporary_wnd=CreateWindow(ClassName, __TEXT(""), style, windowLeft,
+ HWND temporary_wnd=CreateWindowW(ClassName, L"", style, windowLeft,
windowTop, realWidth, realHeight, NULL, NULL, lhInstance, NULL);
if (!temporary_wnd)
{
os::Printer::log("Cannot create a temporary window.", ELL_ERROR);
- UnregisterClass(ClassName, lhInstance);
+ UnregisterClassW(ClassName, lhInstance);
return false;
}
@@ -201,7 +201,7 @@
os::Printer::log("Cannot create a GL device context", "No suitable format for temporary window.", ELL_ERROR);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
- UnregisterClass(ClassName, lhInstance);
+ UnregisterClassW(ClassName, lhInstance);
return false;
}
@@ -218,7 +218,7 @@
os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
- UnregisterClass(ClassName, lhInstance);
+ UnregisterClassW(ClassName, lhInstance);
return false;
}
@@ -234,7 +234,7 @@
wglDeleteContext(hrc);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
- UnregisterClass(ClassName, lhInstance);
+ UnregisterClassW(ClassName, lhInstance);
return false;
}
@@ -340,7 +340,7 @@
wglDeleteContext(hrc);
ReleaseDC(temporary_wnd, HDc);
DestroyWindow(temporary_wnd);
- UnregisterClass(ClassName, lhInstance);
+ UnregisterClassW(ClassName, lhInstance);
// get hdc
HDc=GetDC(Window);
diff -ur --strip-trailing-cr irrlicht/src/COSOperator.cpp irrlicht-fixed/src/COSOperator.cpp
--- irrlicht/src/COSOperator.cpp 2012-11-03 10:07:52.000000000 +0000
+++ irrlicht-fixed/src/COSOperator.cpp 2015-06-14 17:32:58.000000000 +0000
@@ -52,11 +52,8 @@
diff --git a/irrlicht/src/COSOperator.cpp b/irrlicht/src/COSOperator.cpp
index 90e644d..1856c04 100644
--- a/irrlicht/src/COSOperator.cpp
+++ b/irrlicht/src/COSOperator.cpp
@@ -52,9 +52,9 @@ const core::stringc& COSOperator::getOperatingSystemVersion() const
//! copies text to the clipboard
......@@ -483,41 +243,32 @@ diff -ur --strip-trailing-cr irrlicht/src/COSOperator.cpp irrlicht-fixed/src/COS
+void COSOperator::copyToClipboard(const c16* text) const
{
- if (strlen(text)==0)
- return;
-
+ if (wcslen(text)==0)
return;
// Windows version
#if defined(_IRR_XBOX_PLATFORM_)
#elif defined(_IRR_WINDOWS_API_)
@@ -66,6 +63,19 @@
@@ -66,15 +66,15 @@ void COSOperator::copyToClipboard(const c8* text) const
EmptyClipboard();
HGLOBAL clipbuffer;
+
+#if defined(_UNICODE)
+ wchar_t * utext = (wchar_t *)text;
- char * buffer;
+ wchar_t * buffer;
+
+ clipbuffer = GlobalAlloc(GMEM_DDESHARE, sizeof(wchar_t) * (wcslen(utext)+1));
- clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
- buffer = (char*)GlobalLock(clipbuffer);
+ clipbuffer = GlobalAlloc(GMEM_DDESHARE, sizeof(wchar_t) * (wcslen(text) + 1));
+ buffer = (wchar_t*)GlobalLock(clipbuffer);
+
+ wcscpy(buffer, utext);
+
+ GlobalUnlock(clipbuffer);
+ SetClipboardData(CF_UNICODETEXT, clipbuffer);
+#else
char * buffer;
clipbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
@@ -75,6 +85,8 @@
- strcpy(buffer, text);
+ wcscpy(buffer, text);
GlobalUnlock(clipbuffer);
SetClipboardData(CF_TEXT, clipbuffer);
+#endif
+
- SetClipboardData(CF_TEXT, clipbuffer);
+ SetClipboardData(CF_UNICODETEXT, clipbuffer);
CloseClipboard();
// MacOSX version
@@ -93,7 +105,7 @@
@@ -93,7 +93,7 @@ void COSOperator::copyToClipboard(const c8* text) const
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
......@@ -526,27 +277,25 @@ diff -ur --strip-trailing-cr irrlicht/src/COSOperator.cpp irrlicht-fixed/src/COS
{
#if defined(_IRR_XBOX_PLATFORM_)
return 0;
@@ -101,10 +113,14 @@
@@ -101,10 +101,10 @@ const c8* COSOperator::getTextFromClipboard() const
if (!OpenClipboard(NULL))
return 0;
- char * buffer = 0;
+ wchar_t * buffer = 0;
+#ifdef _UNICODE
+ HANDLE hData = GetClipboardData( CF_UNICODETEXT );
+#else
HANDLE hData = GetClipboardData( CF_TEXT );
- HANDLE hData = GetClipboardData( CF_TEXT );
- buffer = (char*)GlobalLock( hData );
+#endif
+ HANDLE hData = GetClipboardData( CF_UNICODETEXT );
+ buffer = (wchar_t*)GlobalLock( hData );
GlobalUnlock( hData );
CloseClipboard();
return buffer;
diff -ur --strip-trailing-cr irrlicht/src/COSOperator.h irrlicht-fixed/src/COSOperator.h
--- irrlicht/src/COSOperator.h 2012-11-03 10:08:00.000000000 +0000
+++ irrlicht-fixed/src/COSOperator.h 2015-06-14 17:32:58.000000000 +0000
@@ -27,11 +27,11 @@
diff --git a/irrlicht/src/COSOperator.h b/irrlicht/src/COSOperator.h
index 3f633da..c0712df 100644
--- a/irrlicht/src/COSOperator.h
+++ b/irrlicht/src/COSOperator.h
@@ -27,11 +27,11 @@ public:
virtual const core::stringc& getOperatingSystemVersion() const;
//! copies text to the clipboard
......@@ -560,21 +309,3 @@ diff -ur --strip-trailing-cr irrlicht/src/COSOperator.h irrlicht-fixed/src/COSOp
//! gets the processor speed in megahertz
//! \param Mhz:
diff -ur --strip-trailing-cr irrlicht/src/CGUIEditBox.cpp irrlicht-fixed/src/CGUIEditBox.cpp
--- irrlicht/src/CGUIEditBox.cpp 2016-09-15 18:12:49.532839000 +0000
+++ irrlicht-fixed/src/CGUIEditBox.cpp 2016-09-15 18:13:37.101559800 +0000
@@ -333,13 +333,7 @@
const c16* p = Operator->getTextFromClipboard();
if (p)
{
- // TODO: we should have such a function in core::string
- size_t lenOld = strlen(p);
- wchar_t *ws = new wchar_t[lenOld + 1];
- size_t len = mbstowcs(ws,p,lenOld);
- ws[len] = 0;
- irr::core::stringw widep(ws);
- delete[] ws;
+ irr::core::stringw widep(p);
if (MarkBegin == MarkEnd)
{
......@@ -317,7 +317,6 @@ project "Irrlicht"
"src/CGUIWindow.cpp" }
configuration { "vs*" }
defines { "UNICODE", "_UNICODE" }
includedirs { "$(DXSDK_DIR)include" }
libdirs { "$(DXSDK_DIR)Lib/x86" }
......
......@@ -2,3 +2,4 @@ project "lua"
kind "StaticLib"
files { "*.c", "*.h" }
removefiles { "luac.c" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment