diff --git a/project/msvc/grafx2-sdl2.sln b/project/msvc/grafx2-sdl2.sln
new file mode 100644
index 00000000..d0c73380
--- /dev/null
+++ b/project/msvc/grafx2-sdl2.sln
@@ -0,0 +1,29 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "grafx2-sdl2", "grafx2-sdl2.vcxproj", "{2C23F950-9403-4871-848E-7E98BE9BD565}"
+ ProjectSection(ProjectDependencies) = postProject
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552} = {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "generateversion", "generateversion.vcxproj", "{056D84A3-08C5-4A2A-A24B-D2E6D00D9552}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {2C23F950-9403-4871-848E-7E98BE9BD565}.Debug|Win32.ActiveCfg = Debug|Win32
+ {2C23F950-9403-4871-848E-7E98BE9BD565}.Debug|Win32.Build.0 = Debug|Win32
+ {2C23F950-9403-4871-848E-7E98BE9BD565}.Release|Win32.ActiveCfg = Release|Win32
+ {2C23F950-9403-4871-848E-7E98BE9BD565}.Release|Win32.Build.0 = Release|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.ActiveCfg = Debug|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Debug|Win32.Build.0 = Debug|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.ActiveCfg = Release|Win32
+ {056D84A3-08C5-4A2A-A24B-D2E6D00D9552}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/project/msvc/grafx2-sdl2.vcxproj b/project/msvc/grafx2-sdl2.vcxproj
new file mode 100644
index 00000000..ef647e7c
--- /dev/null
+++ b/project/msvc/grafx2-sdl2.vcxproj
@@ -0,0 +1,217 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {2C23F950-9403-4871-848E-7E98BE9BD565}
+ Win32Proj
+ grafx2
+ grafx2-sdl2
+
+
+
+
+ Application
+ true
+ Unicode
+
+
+ Application
+ false
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+ $(SolutionDir)..\..\bin\
+ $(ProjectName)$(Configuration)
+ $(Configuration)-sdl2\
+
+
+ false
+ $(SolutionDir)..\..\bin\
+ $(Configuration)-sdl2\
+
+
+
+
+
+ Level3
+ Disabled
+ USE_SDL2;NOTTF;__ENABLE_LUA__;__no_pnglib__;__no_tifflib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ $(SDL2ImageIncDir);$(SDL2IncDir);$(LuaIncDir);%(AdditionalIncludeDirectories)
+ 4244;%(DisableSpecificWarnings)
+
+
+ Windows
+ true
+ SDL2.lib;SDL2main.lib;SDL2_image.lib;lua53.lib;%(AdditionalDependencies)
+ $(SDL2LibDir);$(SDL2ImageLibDir);$(LuaLibDir);%(AdditionalLibraryDirectories)
+
+
+
+
+ Level3
+
+
+ MaxSpeed
+ true
+ true
+ USE_SDL2;NOTTF;__ENABLE_LUA__;__no_pnglib__;__no_tifflib__;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
+ $(SDL2ImageIncDir);$(SDL2IncDir);$(LuaIncDir);;%(AdditionalIncludeDirectories)
+ 4244;%(DisableSpecificWarnings)
+
+
+ Windows
+ true
+ true
+ true
+ SDL2.lib;SDL2main.lib;SDL2_image.lib;lua53.lib;%(AdditionalDependencies)
+ $(SDL2LibDir);$(SDL2ImageLibDir);$(LuaLibDir);%(AdditionalLibraryDirectories)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/project/msvc/grafx2-sdl2.vcxproj.filters b/project/msvc/grafx2-sdl2.vcxproj.filters
new file mode 100644
index 00000000..235e2e2d
--- /dev/null
+++ b/project/msvc/grafx2-sdl2.vcxproj.filters
@@ -0,0 +1,374 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+ Fichiers d%27en-tête
+
+
+
+
+ Fichiers de ressources
+
+
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+ Fichiers sources
+
+
+
\ No newline at end of file
diff --git a/project/msvc/libraries.props b/project/msvc/libraries.props
index edb6632f..020e80ad 100644
--- a/project/msvc/libraries.props
+++ b/project/msvc/libraries.props
@@ -6,6 +6,10 @@
..\..\..\..\SDL-1.2.15\lib\x86
..\..\..\..\SDL_image-1.2.12\include
..\..\..\..\SDL_image-1.2.12\lib\x86
+ ..\..\..\..\SDL2-2.0.9\include
+ ..\..\..\..\SDL2-2.0.9\lib\x86
+ ..\..\..\..\SDL2_image-2.0.4\include
+ ..\..\..\..\SDL2_image-2.0.4\lib\x86
..\..\..\..\lua\include
..\..\..\..\lua
..\..\..\..\lpng1634
diff --git a/src/readline.c b/src/readline.c
index 45387360..9e29faec 100644
--- a/src/readline.c
+++ b/src/readline.c
@@ -972,8 +972,17 @@ byte Readline_ex_unicode(word x_pos, word y_pos, char * str, word * str_unicode,
Warning("Unicode conversion of input text failed");
unicode_text[0] = 0;
}
+#elif defined(WIN32)
+ // use MultiByteToWideChar(CP_UTF8, ...) under WIN32
+ // Note : For UTF-8, dwFlags must be set to either 0 or
+ // MB_ERR_INVALID_CHARS.
+ i = MultiByteToWideChar(CP_UTF8, 0, Key_Text, -1, (LPWSTR)unicode_text, sizeof(unicode_text)/sizeof(word));
+ if (i == 0)
+ {
+ GFX2_Log(GFX2_ERROR, "MultiByteToWideChar(CP_UTF8, \"%s\", ...) failed with error #%u\n", Key_Text, GetLastError());
+ unicode_text[0] = 0;
+ }
#else
- /// @todo use MultiByteToWideChar(CP_UTF8, ...) under WIN32
int j;
for (i = 0, j = 0; i < (int)sizeof(Key_Text) && j < (int)sizeof(unicode_text) && Key_Text[i] != '\0'; i++)
{
diff --git a/src/sdlscreen.c b/src/sdlscreen.c
index 32722e74..7d36d106 100644
--- a/src/sdlscreen.c
+++ b/src/sdlscreen.c
@@ -220,7 +220,7 @@ static void GFX2_UpdateRect(int x, int y, int width, int height)
SDL_LockTexture(Texture_SDL, &source_rect, (void **)(&pixels), &pitch );
for (line = 0; line < source_rect.h; line++)
{
- memcpy(pixels + line * pitch, RGBcopy->pixels + source_rect.x * 4 + (source_rect.y+line)* RGBcopy->pitch, source_rect.w * 4 );
+ memcpy(pixels + line * pitch, (const byte *)RGBcopy->pixels + source_rect.x * 4 + (source_rect.y+line)* RGBcopy->pitch, source_rect.w * 4 );
}
SDL_UnlockTexture(Texture_SDL);
//SDL_RenderCopy(Renderer_SDL, Texture_SDL, &source_rect, &source_rect);