diff --git a/project/vs2010_mfc/VBA2010.suo b/project/vs2010_mfc/VBA2010.suo
index 17fad8f8..9fa6140a 100644
Binary files a/project/vs2010_mfc/VBA2010.suo and b/project/vs2010_mfc/VBA2010.suo differ
diff --git a/project/vs2010_mfc/VBA2010.vcxproj b/project/vs2010_mfc/VBA2010.vcxproj
index 67aab602..8f34f2e6 100644
--- a/project/vs2010_mfc/VBA2010.vcxproj
+++ b/project/vs2010_mfc/VBA2010.vcxproj
@@ -27,6 +27,7 @@
false
NotSet
false
+ true
Application
diff --git a/src/Util.cpp b/src/Util.cpp
index aed4d895..5ca4d0f3 100644
--- a/src/Util.cpp
+++ b/src/Util.cpp
@@ -435,9 +435,34 @@ static bool utilIsImage(const char *file)
return utilIsGBAImage(file) || utilIsGBImage(file);
}
+#ifdef WIN32
+#include
+#endif
+
IMAGE_TYPE utilFindType(const char *file)
{
char buffer [2048];
+#ifdef WIN32
+ DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, file, -1, NULL, 0);
+ wchar_t *pwText;
+ pwText = new wchar_t[dwNum];
+ if(!pwText)
+ {
+ delete []pwText;
+ }
+ MultiByteToWideChar (CP_ACP, 0, file, -1, pwText, dwNum );
+ char* file_conv = fex_wide_to_path( pwText);
+ delete []pwText;
+ if ( !utilIsImage( file_conv ) ) // TODO: utilIsArchive() instead?
+ {
+ fex_t* fe = scan_arc(file_conv,utilIsImage,buffer);
+ if(!fe)
+ return IMAGE_UNKNOWN;
+ fex_close(fe);
+ file = buffer;
+ }
+ free(file_conv);
+#else
if ( !utilIsImage( file ) ) // TODO: utilIsArchive() instead?
{
fex_t* fe = scan_arc(file,utilIsImage,buffer);
@@ -446,7 +471,7 @@ IMAGE_TYPE utilFindType(const char *file)
fex_close(fe);
file = buffer;
}
-
+#endif
return utilIsGBAImage(file) ? IMAGE_GBA : IMAGE_GB;
}
@@ -465,10 +490,26 @@ u8 *utilLoad(const char *file,
{
// find image file
char buffer [2048];
+#ifdef WIN32
+ DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, file, -1, NULL, 0);
+ wchar_t *pwText;
+ pwText = new wchar_t[dwNum];
+ if(!pwText)
+ {
+ delete []pwText;
+ }
+ MultiByteToWideChar (CP_ACP, 0, file, -1, pwText, dwNum );
+ char* file_conv = fex_wide_to_path( pwText);
+ delete []pwText;
+ fex_t *fe = scan_arc(file_conv,accept,buffer);
+ if(!fe)
+ return NULL;
+ free(file_conv);
+#else
fex_t *fe = scan_arc(file,accept,buffer);
if(!fe)
return NULL;
-
+#endif
// Allocate space for image
fex_err_t err = fex_stat(fe);
int fileSize = fex_size(fe);
@@ -671,4 +712,4 @@ bool utilFileExists( const char *filename )
fclose( f );
return true;
}
-}
+}
\ No newline at end of file