Bugger unicode support, we can just convert multibyte to widestring using google cloud services and a bunch of midgets running in spinwheels.
Also enables whole program optimisation (funnily i was only doing linker time optimisation so it wasn't as good as it could be.)
This commit is contained in:
parent
4b1db84145
commit
5f5ddb11a4
Binary file not shown.
|
@ -27,6 +27,7 @@
|
|||
<UseOfAtl>false</UseOfAtl>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
|
|
47
src/Util.cpp
47
src/Util.cpp
|
@ -435,9 +435,34 @@ static bool utilIsImage(const char *file)
|
|||
return utilIsGBAImage(file) || utilIsGBImage(file);
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
#include <Windows.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue