- more updates to handle unicode (most of the focus was getting tools working in windows using non ascii file paths)
This commit is contained in:
parent
737c577099
commit
1085f24c6f
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";..\..\source\glest_game\graphics;..\..\source\shared_lib\include\xml;"../../source/win32_deps/xerces-c-3.0.1/src";..\..\source\glest_game\global;..\..\source\glest_game\sound;..\..\source\shared_lib\include\sound;..\..\source\glest_game\game;../../source/shared_lib/include/map;../../source/win32_deps/lpng141;..\..\source\glest_game\facilities"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;CURL_STATICLIB;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -64,7 +64,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28d_adv.lib wxmsw28d_aui.lib wxmsw28d_core.lib wxmsw28d_gl.lib wxmsw28d_html.lib wxmsw28d_media.lib wxmsw28d_qa.lib wxmsw28d_richtext.lib wxmsw28d_xrc.lib wxregexd.lib wxtiffd.lib wxzlibd.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib Dbghelp.lib sdl.lib sdlmain.lib dxguid.lib libstreflop.lib libcurl.lib ws2_32.lib xerces-c_3d.lib libpng.lib jpeg.lib"
|
||||
AdditionalDependencies="wxbase28ud.lib wxbase28ud_net.lib wxbase28ud_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib wxmsw28ud_core.lib wxmsw28ud_gl.lib wxmsw28ud_html.lib wxmsw28ud_media.lib wxmsw28ud_qa.lib wxmsw28ud_richtext.lib wxmsw28ud_xrc.lib wxregexd.lib wxtiffd.lib wxzlibd.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib Dbghelp.lib sdl.lib sdlmain.lib dxguid.lib libstreflop.lib libcurl.lib ws2_32.lib xerces-c_3d.lib libpng.lib jpeg.lib"
|
||||
OutputFile="$(OutDir)\megaglest_g3dviewer.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../source/win32_deps/lib;"../../build/$(ConfigurationName)/libglest";../../source/shared_lib/sources/streflop/libstreflop"
|
||||
|
@ -119,7 +119,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/arch:SSE2"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";..\..\source\glest_game\graphics;..\..\source\shared_lib\include\xml;"../../source/win32_deps/xerces-c-3.0.1/src";..\..\source\glest_game\global;..\..\source\glest_game\sound;..\..\source\shared_lib\include\sound;..\..\source\glest_game\game;../../source/shared_lib/include/map;../../source/win32_deps/lpng141;..\..\source\glest_game\facilities"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;CURL_STATICLIB;UNICODE"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -142,7 +142,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxexpat.lib wxjpeg.lib wxmsw28_adv.lib wxmsw28_aui.lib wxmsw28_core.lib wxmsw28_gl.lib wxmsw28_html.lib wxmsw28_media.lib wxmsw28_qa.lib wxmsw28_richtext.lib wxmsw28_xrc.lib wxregex.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib Dbghelp.lib sdl.lib sdlmain.lib dxguid.lib libstreflop.lib libcurl.lib ws2_32.lib xerces-c_3.lib libpng.lib jpeg.lib"
|
||||
AdditionalDependencies="wxbase28u.lib wxbase28u_net.lib wxbase28u_xml.lib wxexpat.lib wxjpeg.lib wxmsw28u_adv.lib wxmsw28u_aui.lib wxmsw28u_core.lib wxmsw28u_gl.lib wxmsw28u_html.lib wxmsw28u_media.lib wxmsw28u_qa.lib wxmsw28u_richtext.lib wxmsw28u_xrc.lib wxregex.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib Dbghelp.lib sdl.lib sdlmain.lib dxguid.lib libstreflop.lib libcurl.lib ws2_32.lib xerces-c_3.lib libpng.lib jpeg.lib"
|
||||
OutputFile="$(OutDir)\megaglest_g3dviewer.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../source/win32_deps/lib;"../../build/$(ConfigurationName)/libglest";../../source/shared_lib/sources/streflop/libstreflop"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\xml;"../../source/win32_deps/xerces-c-3.0.1/src";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";..\..\source\glest_game\global;..\..\source\glest_game\facilities;..\..\source\glest_game\game"
|
||||
PreprocessorDefinitions="MWIN;__WXMSW__;__WXDEBUG__;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="MWIN;__WXMSW__;__WXDEBUG__;CURL_STATICLIB;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -118,7 +118,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/arch:SSE2"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\xml;"../../source/win32_deps/xerces-c-3.0.1/src";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";..\..\source\glest_game\global;..\..\source\glest_game\facilities;..\..\source\glest_game\game"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;CURL_STATICLIB;UNICODE"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -140,7 +140,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxexpat.lib wxjpeg.lib wxmsw28_adv.lib wxmsw28_aui.lib wxmsw28_core.lib wxmsw28_gl.lib wxmsw28_html.lib wxmsw28_media.lib wxmsw28_qa.lib wxmsw28_richtext.lib wxmsw28_xrc.lib wxpng.lib wxregex.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib xerces-c_3.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
AdditionalDependencies="wxbase28u.lib wxbase28u_net.lib wxbase28u_xml.lib wxexpat.lib wxjpeg.lib wxmsw28u_adv.lib wxmsw28u_aui.lib wxmsw28u_core.lib wxmsw28u_gl.lib wxmsw28u_html.lib wxmsw28u_media.lib wxmsw28u_qa.lib wxmsw28u_richtext.lib wxmsw28u_xrc.lib wxpng.lib wxregex.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib xerces-c_3.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)\megaglest_configurator.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories=""../../build/$(ConfigurationName)/libglest";../../source/win32_deps/lib"
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";../../source/shared_lib/include/map;..\..\source\glest_game\global;..\..\source\glest_game\game;..\..\source\glest_game\facilities"
|
||||
PreprocessorDefinitions="WIN32;MWIN;__WXMSW__;__WXDEBUG__;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="WIN32;MWIN;__WXMSW__;__WXDEBUG__;CURL_STATICLIB;UNICODE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
|
@ -64,7 +64,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxbase28d.lib wxbase28d_net.lib wxbase28d_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28d_adv.lib wxmsw28d_aui.lib wxmsw28d_core.lib wxmsw28d_gl.lib wxmsw28d_html.lib wxmsw28d_media.lib wxmsw28d_qa.lib wxmsw28d_richtext.lib wxmsw28d_xrc.lib wxpngd.lib wxregexd.lib wxtiffd.lib wxzlibd.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
AdditionalDependencies="wxbase28ud.lib wxbase28ud_net.lib wxbase28ud_xml.lib wxexpatd.lib wxjpegd.lib wxmsw28ud_adv.lib wxmsw28ud_aui.lib wxmsw28ud_core.lib wxmsw28ud_gl.lib wxmsw28ud_html.lib wxmsw28ud_media.lib wxmsw28ud_qa.lib wxmsw28ud_richtext.lib wxmsw28ud_xrc.lib wxpngd.lib wxregexd.lib wxtiff.lib wxzlibd.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)\megaglest_editor.exe"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories="../../source/win32_deps/lib;"../../build/$(ConfigurationName)/libglest""
|
||||
|
@ -119,7 +119,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/arch:SSE2"
|
||||
AdditionalIncludeDirectories=""..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\msw";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";../../source/shared_lib/include/map;..\..\source\glest_game\global;..\..\source\glest_game\game;..\..\source\glest_game\facilities"
|
||||
PreprocessorDefinitions="WIN32;MWIN;__WXMSW__;CURL_STATICLIB"
|
||||
PreprocessorDefinitions="WIN32;MWIN;__WXMSW__;CURL_STATICLIB;UNICODE"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -142,7 +142,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="wxbase28.lib wxbase28_net.lib wxbase28_xml.lib wxexpat.lib wxjpeg.lib wxmsw28_adv.lib wxmsw28_aui.lib wxmsw28_core.lib wxmsw28_gl.lib wxmsw28_html.lib wxmsw28_media.lib wxmsw28_qa.lib wxmsw28_richtext.lib wxmsw28_xrc.lib wxpng.lib wxregex.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
AdditionalDependencies="wxbase28u.lib wxbase28u_net.lib wxbase28u_xml.lib wxexpat.lib wxjpeg.lib wxmsw28u_adv.lib wxmsw28u_aui.lib wxmsw28u_core.lib wxmsw28u_gl.lib wxmsw28u_html.lib wxmsw28u_media.lib wxmsw28u_qa.lib wxmsw28u_richtext.lib wxmsw28u_xrc.lib wxpng.lib wxregexu.lib wxtiff.lib wxzlib.lib winmm.lib rpcrt4.lib kernel32.lib user32.lib gdi32.lib ole32.lib oleaut32.lib comctl32.lib comdlg32.lib uuid.lib advapi32.lib shell32.lib libglest.lib sdl.lib sdlmain.lib dsound.lib dxguid.lib Dbghelp.lib libcurl.lib ws2_32.lib"
|
||||
OutputFile="$(OutDir)\megaglest_editor.exe"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="../../source/win32_deps/lib;"../../build/$(ConfigurationName)/libglest""
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
#include "xml_parser.h"
|
||||
#include "util.h"
|
||||
#include "conversion.h"
|
||||
#include"platform_util.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Shared::Xml;
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace Configurator{
|
||||
|
||||
|
@ -232,12 +234,18 @@ void IntField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
}
|
||||
|
||||
void IntField::updateValue(){
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
//value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
//#endif
|
||||
}
|
||||
|
||||
void IntField::updateControl(){
|
||||
|
@ -265,12 +273,17 @@ void FloatField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
|
||||
void FloatField::updateValue(){
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
//#endif
|
||||
}
|
||||
|
||||
void FloatField::updateControl(){
|
||||
|
@ -299,12 +312,17 @@ void StringField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
|
||||
void StringField::updateValue(){
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
//#endif
|
||||
}
|
||||
|
||||
void StringField::updateControl(){
|
||||
|
@ -329,12 +347,18 @@ void EnumField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
}
|
||||
|
||||
void EnumField::updateValue(){
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(comboBox->GetValue()));
|
||||
value = tmp_buf;
|
||||
#else
|
||||
value= (const char*)wxFNCONV(comboBox->GetValue());
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(comboBox->GetValue());
|
||||
//#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -403,12 +427,18 @@ void FloatRangeField::createControl(wxWindow *parent, wxSizer *sizer){
|
|||
}
|
||||
|
||||
void FloatRangeField::updateValue(){
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(textCtrl->GetValue()));
|
||||
value = tmp_buf;
|
||||
#else
|
||||
value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// value= (const char*)wxFNCONV(textCtrl->GetValue());
|
||||
//#endif
|
||||
}
|
||||
|
||||
void FloatRangeField::updateControl(){
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "game_constants.h"
|
||||
#include "util.h"
|
||||
#include <wx/stdpaths.h>
|
||||
#include <platform_util.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace Shared::PlatformCommon;
|
||||
|
@ -212,12 +213,19 @@ bool App::OnInit(){
|
|||
string appPath = "";
|
||||
wxString exe_path = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#if defined(__MINGW32__)
|
||||
// const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
// appPath = tmp_buf;
|
||||
//#else
|
||||
// appPath = wxFNCONV(exe_path);
|
||||
//#endif
|
||||
|
||||
mainWindow= new MainWindow(appPath);
|
||||
mainWindow->Show();
|
||||
|
|
|
@ -327,7 +327,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
#if defined(__MINGW32__)
|
||||
wxIcon icon(ToUnicode("IDI_ICON1"));
|
||||
#else
|
||||
wxIcon icon("IDI_ICON1");
|
||||
wxIcon icon(L"IDI_ICON1");
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
@ -367,20 +367,22 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
//@="blergcorp.blergapp.v1"
|
||||
|
||||
//Open the registry key.
|
||||
string subKey = "Software\\Classes\\megaglest.g3d\\shell\\open\\command";
|
||||
wstring subKey = L"Software\\Classes\\megaglest.g3d\\shell\\open\\command";
|
||||
HKEY keyHandle;
|
||||
DWORD dwDisposition;
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
||||
//Set the value.
|
||||
string launchApp = appPath + " \"%1\"";
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
|
||||
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
|
||||
DWORD len = launchApp.length() + 1;
|
||||
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
||||
RegCloseKey(keyHandle);
|
||||
|
||||
subKey = "Software\\Classes\\.g3d";
|
||||
subKey = L"Software\\Classes\\.g3d";
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
|
||||
//Set the value.
|
||||
launchApp = "megaglest.g3d";
|
||||
launchApp = L"megaglest.g3d";
|
||||
len = launchApp.length() + 1;
|
||||
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
|
||||
RegCloseKey(keyHandle);
|
||||
|
@ -668,7 +670,15 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event){
|
|||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
modelPathList.clear();
|
||||
loadModel((const char*)wxFNCONV(fileDialog->GetPath().c_str()));
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//loadModel((const char*)wxFNCONV(fileDialog->GetPath().c_str()));
|
||||
loadModel(file);
|
||||
}
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
@ -691,8 +701,15 @@ void MainWindow::onMenuFileLoadParticleXML(wxCommandEvent &event){
|
|||
}
|
||||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
loadParticle(path);
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
loadParticle(file);
|
||||
}
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
@ -715,8 +732,15 @@ void MainWindow::onMenuFileLoadProjectileParticleXML(wxCommandEvent &event){
|
|||
}
|
||||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
loadProjectileParticle(path);
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
loadProjectileParticle(file);
|
||||
}
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
@ -739,8 +763,15 @@ void MainWindow::onMenuFileLoadSplashParticleXML(wxCommandEvent &event){
|
|||
}
|
||||
|
||||
if(fileDialog->ShowModal()==wxID_OK){
|
||||
string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
loadSplashParticle(path);
|
||||
//string path = (const char*)wxFNCONV(fileDialog->GetPath().c_str());
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(fileDialog->GetPath());
|
||||
string file = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(file.c_str()));
|
||||
file = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
loadSplashParticle(file);
|
||||
}
|
||||
isControlKeyPressed = false;
|
||||
}
|
||||
|
@ -809,7 +840,9 @@ void MainWindow::saveScreenshot() {
|
|||
renderer->saveScreen(saveAsFilename.c_str());
|
||||
}
|
||||
else {
|
||||
fclose(f);
|
||||
if(f) {
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -844,7 +877,9 @@ void MainWindow::saveScreenshot() {
|
|||
break;
|
||||
}
|
||||
else {
|
||||
fclose(f);
|
||||
if(f) {
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1856,6 +1891,14 @@ bool App::OnInit() {
|
|||
|
||||
autoScreenShotParams.clear();
|
||||
Tokenize(optionsValue,autoScreenShotParams,",");
|
||||
|
||||
#ifdef WIN32
|
||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
||||
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1880,8 +1923,19 @@ bool App::OnInit() {
|
|||
|
||||
if(delimitedList.size() >= 2) {
|
||||
unitToLoad.first = delimitedList[0];
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(unitToLoad.first.c_str()));
|
||||
unitToLoad.first = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
for(unsigned int i = 1; i < delimitedList.size(); ++i) {
|
||||
unitToLoad.second.push_back(delimitedList[i]);
|
||||
string value = delimitedList[i];
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(value.c_str()));
|
||||
value = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
unitToLoad.second.push_back(value);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -1915,6 +1969,11 @@ bool App::OnInit() {
|
|||
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||
string customPathValue = paramPartTokens[1];
|
||||
modelPath = customPathValue;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
||||
modelPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
}
|
||||
else {
|
||||
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||
|
@ -1940,6 +1999,10 @@ bool App::OnInit() {
|
|||
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||
string customPathValue = paramPartTokens[1];
|
||||
particlePath = customPathValue;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(particlePath.c_str()));
|
||||
particlePath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||
|
@ -1964,6 +2027,10 @@ bool App::OnInit() {
|
|||
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||
string customPathValue = paramPartTokens[1];
|
||||
projectileParticlePath = customPathValue;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(projectileParticlePath.c_str()));
|
||||
projectileParticlePath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||
|
@ -1988,6 +2055,10 @@ bool App::OnInit() {
|
|||
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||
string customPathValue = paramPartTokens[1];
|
||||
splashParticlePath = customPathValue;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(splashParticlePath.c_str()));
|
||||
splashParticlePath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||
|
@ -2118,12 +2189,17 @@ bool App::OnInit() {
|
|||
|
||||
if(argc == 2 && argv[1][0] != '-') {
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
|
||||
modelPath = tmp_buf;
|
||||
#else
|
||||
modelPath = wxFNCONV(argv[1]);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(modelPath.c_str()));
|
||||
modelPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// modelPath = wxFNCONV(argv[1]);
|
||||
//#endif
|
||||
|
||||
}
|
||||
|
||||
|
@ -2142,12 +2218,17 @@ bool App::OnInit() {
|
|||
//exe_path = exe_path.BeforeLast(path_separator[0]);
|
||||
//exe_path += path_separator;
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// appPath = wxFNCONV(exe_path);
|
||||
//#endif
|
||||
|
||||
// printf("#2 appPath [%s]\n",appPath.c_str());
|
||||
|
||||
|
|
|
@ -195,7 +195,8 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
|
|||
if(SystemFlags::VERBOSE_MODE_ENABLED) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] attempting to auto-create cfgFile.second = [%s]\n",__FILE__,__FUNCTION__,__LINE__,fileName.second.c_str());
|
||||
|
||||
#ifdef WIN32
|
||||
FILE *fp = _wfopen(utf8_decode(fileName.second).c_str(), L"w");
|
||||
wstring wstr = utf8_decode(fileName.second);
|
||||
FILE *fp = _wfopen(wstr.c_str(), L"w");
|
||||
std::ofstream userFile(fp);
|
||||
#else
|
||||
std::ofstream userFile;
|
||||
|
@ -203,7 +204,9 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
|
|||
#endif
|
||||
userFile.close();
|
||||
#ifdef WIN32
|
||||
fclose(fp);
|
||||
if(fp) {
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
fileLoaded.second = true;
|
||||
properties.second.load(fileName.second);
|
||||
|
|
|
@ -1709,7 +1709,9 @@ std::string World::DumpWorldToLog(bool consoleBasicInfoOnly) const {
|
|||
|
||||
logFile.close();
|
||||
#ifdef WIN32
|
||||
fclose(fp);
|
||||
if(fp) {
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return debugWorldLogFile;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "platform_common.h"
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include"platform_util.h"
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
using namespace Shared::Util;
|
||||
|
@ -349,11 +350,11 @@ void MainWindow::init(string fname) {
|
|||
wxInitAllImageHandlers();
|
||||
#ifdef WIN32
|
||||
//std::cout << "B" << std::endl;
|
||||
#if defined(__MINGW32__)
|
||||
// #if defined(__MINGW32__)
|
||||
wxIcon icon(ToUnicode("IDI_ICON1"));
|
||||
#else
|
||||
wxIcon icon("IDI_ICON1");
|
||||
#endif
|
||||
// #else
|
||||
// wxIcon icon("IDI_ICON1");
|
||||
// #endif
|
||||
|
||||
#else
|
||||
//std::cout << "B" << std::endl;
|
||||
|
@ -575,16 +576,31 @@ void MainWindow::onMenuFileLoad(wxCommandEvent &event) {
|
|||
return;
|
||||
}
|
||||
|
||||
fileDialog->SetMessage(wxT("Select Glestmap to load"));
|
||||
fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm)|*.gbm;*.mgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm"));
|
||||
if (fileDialog->ShowModal() == wxID_OK) {
|
||||
currentFile = fileDialog->GetPath().ToAscii();
|
||||
program->loadMap(currentFile);
|
||||
fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str()));
|
||||
setDirty(false);
|
||||
setExtension();
|
||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
||||
try {
|
||||
fileDialog->SetMessage(wxT("Select Glestmap to load"));
|
||||
fileDialog->SetWildcard(wxT("Glest&Mega Map (*.gbm *.mgm)|*.gbm;*.mgm|Glest Map (*.gbm)|*.gbm|Mega Map (*.mgm)|*.mgm"));
|
||||
if (fileDialog->ShowModal() == wxID_OK) {
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fileDialog->GetPath()));
|
||||
currentFile = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||
currentFile = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
program->loadMap(currentFile);
|
||||
fileName = cutLastExt(extractFileFromDirectoryPath(currentFile.c_str()));
|
||||
setDirty(false);
|
||||
setExtension();
|
||||
SetTitle(ToUnicode(winHeader + "; " + currentFile));
|
||||
}
|
||||
}
|
||||
catch (const string &e) {
|
||||
MsgDialog(this, ToUnicode(e), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
catch (const exception &e) {
|
||||
MsgDialog(this, ToUnicode(e.what()), wxT("Exception"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::onMenuFileSave(wxCommandEvent &event) {
|
||||
|
@ -597,6 +613,7 @@ void MainWindow::onMenuFileSave(wxCommandEvent &event) {
|
|||
onMenuFileSaveAs(ev);
|
||||
} else {
|
||||
setExtension();
|
||||
|
||||
program->saveMap(currentFile);
|
||||
setDirty(false);
|
||||
}
|
||||
|
@ -628,7 +645,13 @@ void MainWindow::onMenuFileSaveAs(wxCommandEvent &event) {
|
|||
|
||||
fd.SetWildcard(wxT("Glest Map (*.gbm)|*.gbm|MegaGlest Map (*.mgm)|*.mgm"));
|
||||
if (fd.ShowModal() == wxID_OK) {
|
||||
currentFile = fd.GetPath().ToAscii();
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(fd.GetPath()));
|
||||
currentFile = tmp_buf;
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(currentFile.c_str()));
|
||||
currentFile = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
fileDialog->SetPath(fd.GetPath());
|
||||
setExtension();
|
||||
program->saveMap(currentFile);
|
||||
|
@ -1379,7 +1402,8 @@ bool SimpleDialog::show(const string &title, bool wide) {
|
|||
if(m_returnCode==wxID_CANCEL) return false; // don't change values if canceled
|
||||
|
||||
for (unsigned int i = 0; i < texts.size(); ++i) {
|
||||
values[i].second = texts[i]->GetValue().ToAscii();
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(texts[i]->GetValue()));
|
||||
values[i].second = tmp_buf;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1407,12 +1431,18 @@ bool App::OnInit() {
|
|||
exit (0);
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(argv[1]));
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(argv[1]);
|
||||
fileparam = tmp_buf;
|
||||
#else
|
||||
fileparam = wxFNCONV(argv[1]);
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(fileparam.c_str()));
|
||||
fileparam = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// fileparam = wxFNCONV(argv[1]);
|
||||
//#endif
|
||||
}
|
||||
|
||||
wxString exe_path = wxStandardPaths::Get().GetExecutablePath();
|
||||
|
@ -1421,13 +1451,20 @@ bool App::OnInit() {
|
|||
//exe_path += path_separator;
|
||||
|
||||
string appPath = "";
|
||||
#if defined(__MINGW32__)
|
||||
//#if defined(__MINGW32__)
|
||||
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
appPath = tmp_buf;
|
||||
#else
|
||||
appPath = wxFNCONV(exe_path);
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
|
||||
appPath = utf8_encode(wstr.get());
|
||||
#endif
|
||||
|
||||
//#else
|
||||
// const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(wxFNCONV(exe_path));
|
||||
// appPath = tmp_buf;
|
||||
//#endif
|
||||
|
||||
mainWindow = new MainWindow(appPath);
|
||||
mainWindow->Show();
|
||||
mainWindow->init(fileparam);
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
|
||||
#include "program.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
#include <iostream>
|
||||
#include "platform_util.h"
|
||||
|
||||
using namespace Shared::Util;
|
||||
|
||||
namespace MapEditor {
|
||||
|
@ -612,11 +612,25 @@ void Program::setMapAdvanced(int altFactor, int waterLevel, int cliffLevel , int
|
|||
void Program::loadMap(const string &path) {
|
||||
undoStack.clear();
|
||||
redoStack.clear();
|
||||
map->loadFromFile(path);
|
||||
|
||||
std::string encodedPath = path;
|
||||
//#ifdef WIN32
|
||||
// std::auto_ptr<wchar_t> wstr(Ansi2WideString(path.c_str()));
|
||||
// encodedPath = utf8_encode(wstr.get());
|
||||
//#endif
|
||||
map->loadFromFile(encodedPath);
|
||||
}
|
||||
|
||||
void Program::saveMap(const string &path) {
|
||||
if(map) map->saveToFile(path);
|
||||
if(map) {
|
||||
std::string encodedPath = path;
|
||||
//#ifdef WIN32
|
||||
// std::auto_ptr<wchar_t> wstr(Ansi2WideString(path.c_str()));
|
||||
// encodedPath = utf8_encode(wstr.get());
|
||||
//#endif
|
||||
|
||||
map->saveToFile(encodedPath);
|
||||
}
|
||||
}
|
||||
|
||||
}// end namespace
|
||||
|
|
|
@ -24,14 +24,14 @@ using std::exception;
|
|||
|
||||
namespace Shared{ namespace Platform{
|
||||
|
||||
LPWSTR Ansi2WideString(LPCSTR lpaszString);
|
||||
std::string utf8_encode(const std::wstring wstr);
|
||||
std::wstring utf8_decode(const std::string str);
|
||||
|
||||
// =====================================================
|
||||
// class PlatformExceptionHandler
|
||||
// =====================================================
|
||||
|
||||
LPWSTR Ansi2WideString(LPCSTR lpaszString);
|
||||
std::string utf8_encode(const std::wstring &wstr);
|
||||
std::wstring utf8_decode(const std::string &str);
|
||||
|
||||
LONG WINAPI UnhandledExceptionFilter2(struct _EXCEPTION_POINTERS *ExceptionInfo);
|
||||
|
||||
class PlatformExceptionHandler{
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <cstdlib>
|
||||
#include <stdexcept>
|
||||
#include "platform_util.h"
|
||||
#include "conversion.h"
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace std;
|
||||
|
@ -683,11 +684,15 @@ void MapPreview::switchSurfaces(MapSurfaceType surf1, MapSurfaceType surf2) {
|
|||
|
||||
void MapPreview::loadFromFile(const string &path) {
|
||||
|
||||
// "Could not open file, result: 3 - 2 No such file or directory [C:\Documents and Settings\人間五\Application Data\megaglest\maps\clearings_in_the_woods.gbm]
|
||||
|
||||
#ifdef WIN32
|
||||
FILE* f1= _wfopen(utf8_decode(path).c_str(), L"rb");
|
||||
wstring wstr = utf8_decode(path);
|
||||
FILE* f1= _wfopen(wstr.c_str(), L"rb");
|
||||
#else
|
||||
FILE *f1 = fopen(path.c_str(), "rb");
|
||||
#endif
|
||||
int fileErrno = errno;
|
||||
if (f1 != NULL) {
|
||||
|
||||
//read header
|
||||
|
@ -750,7 +755,13 @@ void MapPreview::loadFromFile(const string &path) {
|
|||
mapFileLoaded = path;
|
||||
}
|
||||
else {
|
||||
#ifdef WIN32
|
||||
DWORD error = GetLastError();
|
||||
string strError = "Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
|
||||
throw strError;
|
||||
#else
|
||||
throw runtime_error("error opening map file: " + path);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1832,6 +1832,13 @@ bool searchAndReplaceTextInFile(string fileName, string findText, string replace
|
|||
fp2 = fopen(tempfileName.c_str(),"w");
|
||||
#endif
|
||||
|
||||
if(fp1 == NULL) {
|
||||
throw runtime_error("cannot open input file [" + fileName + "]");
|
||||
}
|
||||
if(fp2 == NULL) {
|
||||
throw runtime_error("cannot open output file [" + tempfileName + "]");
|
||||
}
|
||||
|
||||
while(fgets(buffer,MAX_LEN_SINGLE_LINE + 2,fp1)) {
|
||||
buff_ptr = buffer;
|
||||
if(findText != "") {
|
||||
|
@ -1881,14 +1888,24 @@ void copyFileTo(string fromFileName, string toFileName) {
|
|||
out.put(in.get());
|
||||
}
|
||||
}
|
||||
else if(in.is_open() == false) {
|
||||
throw runtime_error("cannot open input file [" + fromFileName + "]");
|
||||
}
|
||||
else if(out.is_open() == false) {
|
||||
throw runtime_error("cannot open input file [" + toFileName + "]");
|
||||
}
|
||||
|
||||
//Close both files
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
#ifdef WIN32
|
||||
fclose(fp1);
|
||||
fclose(fp2);
|
||||
if(fp1) {
|
||||
fclose(fp1);
|
||||
}
|
||||
if(fp2) {
|
||||
fclose(fp2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Shared { namespace PlatformCommon {
|
|||
const int IRC_SERVER_PORT = 6667;
|
||||
|
||||
void addlog (const char * fmt, ...) {
|
||||
FILE * fp;
|
||||
//FILE * fp;
|
||||
char buf[1024];
|
||||
va_list va_alist;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ LPWSTR Ansi2WideString(LPCSTR lpaszString) {
|
|||
}
|
||||
|
||||
// Convert a wide Unicode string to an UTF8 string
|
||||
std::string utf8_encode(const std::wstring &wstr) {
|
||||
std::string utf8_encode(const std::wstring wstr) {
|
||||
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
|
||||
std::string strTo( size_needed, 0 );
|
||||
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
|
||||
|
@ -64,7 +64,7 @@ std::string utf8_encode(const std::wstring &wstr) {
|
|||
}
|
||||
|
||||
// Convert an UTF8 string to a wide Unicode String
|
||||
std::wstring utf8_decode(const std::string &str) {
|
||||
std::wstring utf8_decode(const std::string str) {
|
||||
string friendly_path = str;
|
||||
replaceAll(friendly_path, "/", "\\");
|
||||
replaceAll(friendly_path, "\\\\", "\\");
|
||||
|
|
|
@ -650,7 +650,7 @@ string ext(const string &s) {
|
|||
|
||||
i=s.find_last_of('.')+1;
|
||||
|
||||
if (i != string::npos) {
|
||||
if (i == string::npos) {
|
||||
throw runtime_error(string(__FILE__) + " line: " + intToStr(__LINE__) + " i==string::npos for [" + s + "]");
|
||||
//}
|
||||
return (s.substr(i, s.size()-i));
|
||||
|
@ -723,16 +723,24 @@ int round(float f){
|
|||
|
||||
// ==================== misc ====================
|
||||
|
||||
bool fileExists(const string &path){
|
||||
bool fileExists(const string &path) {
|
||||
#ifdef WIN32
|
||||
FILE* file= _wfopen(utf8_decode(path).c_str(), L"rb");
|
||||
wstring wstr = utf8_decode(path);
|
||||
FILE* file= _wfopen(wstr.c_str(), L"rb");
|
||||
#else
|
||||
FILE* file= fopen(path.c_str(), "rb");
|
||||
#endif
|
||||
if(file!=NULL){
|
||||
if(file != NULL) {
|
||||
fclose(file);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
int fileErrno = errno;
|
||||
#ifdef WIN32
|
||||
DWORD error = GetLastError();
|
||||
string strError = "Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]";
|
||||
#endif
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "types.h"
|
||||
#include "properties.h"
|
||||
#include "platform_common.h"
|
||||
#include "platform_util.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
|
||||
|
@ -106,8 +107,12 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
|
|||
config->setParameter(XMLUni::fgDOMValidate, true);
|
||||
#endif
|
||||
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= parser->parseURI(path.c_str());
|
||||
|
||||
if(document==NULL){
|
||||
#ifdef WIN32
|
||||
if(document == NULL) {
|
||||
document= parser->parseURI(utf8_decode(path).c_str());
|
||||
}
|
||||
#endif
|
||||
if(document == NULL) {
|
||||
throw runtime_error("Can not parse URL: " + path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue