diff --git a/bbruntime_dll/bbruntime_dll.cpp b/bbruntime_dll/bbruntime_dll.cpp
index e0d8450d..a08c845f 100644
--- a/bbruntime_dll/bbruntime_dll.cpp
+++ b/bbruntime_dll/bbruntime_dll.cpp
@@ -16,6 +16,8 @@ using namespace std;
#include "../bbruntime/bbruntime.h"
+#include "../gxruntime/gxutf8.h"
+
class DummyDebugger : public Debugger{
public:
virtual void debugRun(){}
@@ -25,7 +27,7 @@ class DummyDebugger : public Debugger{
virtual void debugLeave(){}
virtual void debugLog( const char *msg ){}
virtual void debugMsg( const char *e,bool serious ){
- if( serious ) MessageBox( 0,e,"Error!",MB_OK|MB_TOPMOST|MB_SETFOREGROUND );
+ if( serious ) MessageBoxW( 0,UTF8::convertToUtf16(e).c_str(),L"Error!",MB_OK|MB_TOPMOST|MB_SETFOREGROUND );
}
virtual void debugSys( void *msg ){}
};
@@ -110,8 +112,10 @@ void Runtime::execute( void (*pc)(),const char *args,Debugger *dbg ){
trackmem( true );
+#ifndef _DEBUG
_se_translator_function old_trans=_set_se_translator( seTranslator );
_control87( _RC_NEAR|_PC_24|_EM_INVALID|_EM_ZERODIVIDE|_EM_OVERFLOW|_EM_UNDERFLOW|_EM_INEXACT|_EM_DENORMAL,0xfffff );
+#endif
//strip spaces from ends of args...
string params=args;
@@ -130,8 +134,10 @@ void Runtime::execute( void (*pc)(),const char *args,Debugger *dbg ){
gxRuntime::closeRuntime( t );
}
+#ifndef _DEBUG
_control87( _CW_DEFAULT,0xfffff );
_set_se_translator( old_trans );
+#endif
}
void Runtime::asyncStop(){
diff --git a/blitz/blitz.vcxproj b/blitz/blitz.vcxproj
index e9a44820..6bbf3ab3 100644
--- a/blitz/blitz.vcxproj
+++ b/blitz/blitz.vcxproj
@@ -15,6 +15,7 @@
{2023B196-BA03-41D1-A771-EC49D27E48AD}
10.0
+ blitz
diff --git a/blitz/blitz.vcxproj.user b/blitz/blitz.vcxproj.user
index 88a55094..a7995d1b 100644
--- a/blitz/blitz.vcxproj.user
+++ b/blitz/blitz.vcxproj.user
@@ -1,4 +1,7 @@
-
+
+ $(TargetDir)
+ WindowsLocalDebugger
+
\ No newline at end of file
diff --git a/blitz/libs.cpp b/blitz/libs.cpp
index 7e5701ba..dafde284 100644
--- a/blitz/libs.cpp
+++ b/blitz/libs.cpp
@@ -249,8 +249,17 @@ static const char *linkUserLibs(){
const char *openLibs(){
char *p=getenv( "blitzpath" );
+#ifndef _DEBUG
if( !p ) return "Can't find blitzpath environment variable";
home=string(p);
+#else
+ {
+ char workingDir[128];
+ GetCurrentDirectory(128, workingDir);
+ home = workingDir; home+="\\\\..";
+ putenv( (string("blitzpath=")+home).c_str() );
+ }
+#endif
linkerHMOD=LoadLibrary( (home+"/bin/linker.dll").c_str() );
if( !linkerHMOD ) return "Unable to open linker.dll";
diff --git a/blitz/main.cpp b/blitz/main.cpp
index d11f94aa..dbaf2466 100644
--- a/blitz/main.cpp
+++ b/blitz/main.cpp
@@ -184,6 +184,18 @@ int _cdecl main( int argc,char *argv[] ){
}
}
+ ifstream debugFile; debugFile.open("debug.txt", ios_base::in);
+ if (debugFile.good())
+ {
+ char* tmpBuf = new char[1024];
+ debugFile.getline(tmpBuf, 1024);
+ in_file = tmpBuf;
+ out_file = "";
+ delete[] tmpBuf;
+ debugFile.close();
+ debug = true;
+ }
+
if( out_file.size() && !in_file.size() ) usageErr();
if( const char *er=openLibs() ) err( er );
@@ -194,7 +206,11 @@ int _cdecl main( int argc,char *argv[] ){
if( dumpkeys ) dumpKeys( true,true,dumphelp );
if( versinfo ) versInfo();
- if( !in_file.size() ) return 0;
+ if( !in_file.size() ){
+ versInfo();
+ showHelp();
+ return 0;
+ }
if( in_file[0]=='\"' ){
if( in_file.size()<3 || in_file[in_file.size()-1]!='\"' ) usageErr();
diff --git a/blitz3d.sln b/blitz3d.sln
index a079f7ae..e7885fb1 100644
--- a/blitz3d.sln
+++ b/blitz3d.sln
@@ -23,6 +23,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bbruntime_dll", "bbruntime_
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blitz", "blitz\blitz.vcxproj", "{2023B196-BA03-41D1-A771-EC49D27E48AD}"
+ ProjectSection(ProjectDependencies) = postProject
+ {41785D5A-2FD3-43A2-9469-F5D9CF927E1D} = {41785D5A-2FD3-43A2-9469-F5D9CF927E1D}
+ {4963165F-BF83-42DF-8F0D-D09164F4D6C0} = {4963165F-BF83-42DF-8F0D-D09164F4D6C0}
+ {57C1D7A8-8B56-474A-94D9-06684015BB6B} = {57C1D7A8-8B56-474A-94D9-06684015BB6B}
+ EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "blitz3d", "blitz3d\blitz3d.vcxproj", "{60BB991F-8721-4A17-9F70-79D0EE5507FA}"
EndProject
diff --git a/debugger/debugger.vcxproj b/debugger/debugger.vcxproj
index 5659776f..bf91c231 100644
--- a/debugger/debugger.vcxproj
+++ b/debugger/debugger.vcxproj
@@ -182,6 +182,11 @@
+
+
+ {a124d746-4a3b-401d-ae99-6a838595bc8c}
+
+
diff --git a/debugger/mainframe.cpp b/debugger/mainframe.cpp
index 2ac58934..49c6f261 100644
--- a/debugger/mainframe.cpp
+++ b/debugger/mainframe.cpp
@@ -5,6 +5,8 @@
#include "debuggerapp.h"
#include "prefs.h"
+#include "../gxruntime/gxutf8.h"
+
#define WM_IDLEUPDATECMDUI 0x0363 // wParam == bDisableIfNoHandler
enum{
@@ -204,9 +206,9 @@ void MainFrame::debugLeave(){
void MainFrame::debugMsg( const char *msg,bool serious ){
if( serious ){
- ::MessageBox( 0,msg,"Runtime Error",MB_OK|MB_ICONWARNING|MB_TOPMOST|MB_SETFOREGROUND );
+ ::MessageBoxW( 0,UTF8::convertToUtf16(msg).c_str(),L"Runtime Error",MB_OK|MB_ICONWARNING|MB_TOPMOST|MB_SETFOREGROUND );
}else{
- ::MessageBox( 0,msg,"Runtime Message",MB_OK|MB_ICONINFORMATION|MB_TOPMOST|MB_SETFOREGROUND );
+ ::MessageBoxW( 0,UTF8::convertToUtf16(msg).c_str(),L"Runtime Message",MB_OK|MB_ICONINFORMATION|MB_TOPMOST|MB_SETFOREGROUND );
}
}
diff --git a/debugger/prefs.cpp b/debugger/prefs.cpp
index 74d985ff..f91f6024 100644
--- a/debugger/prefs.cpp
+++ b/debugger/prefs.cpp
@@ -9,7 +9,6 @@
Prefs prefs;
void Prefs::open(){
-
homeDir=getenv( "blitzpath" );
AddFontResource( (homeDir+"/cfg/blitz.fon").c_str() );
diff --git a/gxruntime/gxfont.cpp b/gxruntime/gxfont.cpp
index 7ff2151c..e783278d 100644
--- a/gxruntime/gxfont.cpp
+++ b/gxruntime/gxfont.cpp
@@ -217,7 +217,7 @@ int gxFont::charAdvance(int chr) {
renderAtlas(chr);
it = glyphData.find(chr);
}
- return it->second.horizontalAdvance;
+ return it != glyphData.end() ? it->second.horizontalAdvance : 0;
}
int gxFont::stringWidth(const std::string& text) {
@@ -232,7 +232,9 @@ int gxFont::stringWidth(const std::string& text) {
it = glyphData.find(chr);
}
- width += it->second.horizontalAdvance;
+ if (it != glyphData.end()) {
+ width += it->second.horizontalAdvance;
+ }
i+=codepointLen;
}
diff --git a/gxruntime/gxruntime.cpp b/gxruntime/gxruntime.cpp
index eac279c1..00d6a25e 100644
--- a/gxruntime/gxruntime.cpp
+++ b/gxruntime/gxruntime.cpp
@@ -3,6 +3,8 @@
#include "gxruntime.h"
#include "zmouse.h"
+#include "../gxruntime/gxutf8.h"
+
struct gxRuntime::GfxMode{
DDSURFACEDESC2 desc;
};
@@ -649,7 +651,7 @@ bool gxRuntime::execute( const string &cmd_line ){
void gxRuntime::setTitle( const string &t,const string &e ){
app_title=t;
app_close=e;
- SetWindowText( hwnd,app_title.c_str() );
+ SetWindowTextW( hwnd,UTF8::convertToUtf16(app_title).c_str() );
}
//////////////////
diff --git a/gxruntime/gxutf8.cpp b/gxruntime/gxutf8.cpp
index 75222b39..308eb06f 100644
--- a/gxruntime/gxutf8.cpp
+++ b/gxruntime/gxutf8.cpp
@@ -1,3 +1,4 @@
+#include "std.h"
#include "gxutf8.h"
int UTF8::measureCodepoint(char chr) {
@@ -82,4 +83,13 @@ std::string UTF8::substr(const std::string& str, int start, int length) {
return str.substr(bytesStart, bytesLength);
}
+std::wstring UTF8::convertToUtf16(const std::string& str) {
+ std::wstring result = L"";
+ for (int i=0;i
class UTF8 {
private:
@@ -13,6 +13,7 @@ class UTF8 {
static int length(const std::string& str);
static int find(const std::string& str, const std::string& sstr, int from);
static std::string substr(const std::string& str, int start, int length);
+ static std::wstring convertToUtf16(const std::string& str);
};
#endif