win32: rollback filename parsing patch. it can't handle filenames with spaces. i know that was the point, but it doesnt even work with quoted paths.
This commit is contained in:
parent
7c386f0310
commit
642baafe9d
|
@ -17,4 +17,7 @@ Global
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
AMDCaProjectFile = C:\svn\desmume\trunk\desmume\src\windows\CodeAnalyst\DeSmuME_2005.caw
|
||||||
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -53,7 +53,8 @@
|
||||||
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig"
|
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib;.\winpcap;userconfig;defaultconfig"
|
||||||
PreprocessorDefinitions="DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;EXPERIMENTAL_WIFI"
|
PreprocessorDefinitions="DEBUG;_CRT_SECURE_NO_DEPRECATE;WIN32;SPU_INTERPOLATE;HAVE_LIBZ;HAVE_LIBZZIP;NOMINMAX;DEBUG;EXPERIMENTAL_WIFI"
|
||||||
ExceptionHandling="1"
|
ExceptionHandling="1"
|
||||||
BufferSecurityCheck="false"
|
BasicRuntimeChecks="2"
|
||||||
|
BufferSecurityCheck="true"
|
||||||
EnableEnhancedInstructionSet="2"
|
EnableEnhancedInstructionSet="2"
|
||||||
FloatingPointModel="2"
|
FloatingPointModel="2"
|
||||||
WarningLevel="1"
|
WarningLevel="1"
|
||||||
|
@ -145,6 +146,7 @@
|
||||||
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE;EXPERIMENTAL_WIFI"
|
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SPU_INTERPOLATE;NOMINMAX;NDEBUG;RELEASE;EXPERIMENTAL_WIFI"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
ExceptionHandling="1"
|
ExceptionHandling="1"
|
||||||
|
BasicRuntimeChecks="0"
|
||||||
StructMemberAlignment="0"
|
StructMemberAlignment="0"
|
||||||
BufferSecurityCheck="false"
|
BufferSecurityCheck="false"
|
||||||
EnableFunctionLevelLinking="false"
|
EnableFunctionLevelLinking="false"
|
||||||
|
@ -680,6 +682,10 @@
|
||||||
RelativePath="..\debug.h"
|
RelativePath="..\debug.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\VTune\DeSmuME_VS2005.vpj"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\Disassembler.cpp"
|
RelativePath="..\Disassembler.cpp"
|
||||||
>
|
>
|
||||||
|
|
|
@ -1855,77 +1855,17 @@ int WINAPI WinMain (HINSTANCE hThisInstance,
|
||||||
if (lpszArgument[0] == '\"')
|
if (lpszArgument[0] == '\"')
|
||||||
sscanf(lpszArgument, "\"%[^\"]\"", lpszArgument);
|
sscanf(lpszArgument, "\"%[^\"]\"", lpszArgument);
|
||||||
|
|
||||||
// Reparse arguments to isolate the ROM filename in the command line
|
|
||||||
// This should allow for both a filename and a '--xyz' option to be present on the command line.
|
|
||||||
// If this is not done, loading the ROM fails as all supplied options are considered part of the filename.
|
|
||||||
if (lpszArgument[0])
|
if (lpszArgument[0])
|
||||||
{
|
{
|
||||||
BOOL filename_found = FALSE;
|
|
||||||
const char *delimiters = " ";
|
|
||||||
char *context = NULL;
|
|
||||||
char *arg_token = NULL;
|
|
||||||
char *dup_arglist = strdup(lpszArgument);
|
|
||||||
|
|
||||||
arg_token = strtok_s(dup_arglist, delimiters, &context);
|
|
||||||
while ( (filename_found == FALSE) & (arg_token != NULL) )
|
|
||||||
{
|
|
||||||
// A token was found. Its extension will be compared to the known extensions.
|
|
||||||
// We first must search for a dot, starting from the end of the token.
|
|
||||||
char *dot_position = NULL;
|
|
||||||
if ( (dot_position = strrchr(arg_token, '.')) != NULL )
|
|
||||||
{
|
|
||||||
// Look for a known extension
|
|
||||||
if ( !stricmp(dot_position, ".nds") )
|
|
||||||
{
|
|
||||||
filename_found = TRUE;
|
|
||||||
}
|
|
||||||
if ( !stricmp(dot_position, ".gba") )
|
|
||||||
{
|
|
||||||
// The name ends with ".gba", check if it actually ends with ".ds.gba"
|
|
||||||
if ( strlen(arg_token) > 7 )
|
|
||||||
{
|
|
||||||
if ( !stricmp(dot_position-3, ".ds.gba") )
|
|
||||||
{
|
|
||||||
filename_found = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( filename_found == TRUE )
|
|
||||||
{
|
|
||||||
// Try to open the file in read-only mode
|
|
||||||
HANDLE test_file_open = CreateFile(arg_token, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if ( test_file_open == INVALID_HANDLE_VALUE )
|
|
||||||
{
|
|
||||||
// Cannot open the file, reset filename_found to continue iterating
|
|
||||||
filename_found = FALSE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// The file can be opened and it ends with a plausible extension.
|
|
||||||
// This is probably the one that should be opened.
|
|
||||||
CloseHandle(test_file_open);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Find the next token in the argument list
|
|
||||||
arg_token = strtok_s(NULL, delimiters, &context);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( filename_found == TRUE )
|
|
||||||
{
|
|
||||||
#ifdef EXPERIMENTAL_GBASLOT
|
#ifdef EXPERIMENTAL_GBASLOT
|
||||||
if(LoadROM(arg_token))
|
if(LoadROM(lpszArgument))
|
||||||
#else
|
#else
|
||||||
if(LoadROM(arg_token, bad_glob_cflash_disk_image_file))
|
if(LoadROM(lpszArgument, bad_glob_cflash_disk_image_file))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
romloaded = TRUE;
|
romloaded = TRUE;
|
||||||
NDS_UnPause();
|
NDS_UnPause();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(dup_arglist);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow->Show(SW_NORMAL);
|
MainWindow->Show(SW_NORMAL);
|
||||||
|
|
Loading…
Reference in New Issue