I'm having trouble with this still.
I looked in CoreParameter.cpp under the SCoreStartupParameter::AutoSetup() function.
The problem it's running into is related to File::Exists().
From there I went into FileUtil.cpp to dig around.
I made a simple modification to print the result of stat().
When you compile and first open Dolphin, it's going to pop up a bunch of dialogs as that function is called, just dismiss them all.
When I finally get to the main interface, I go to open and select the .gcz, and the result is simply "No error" (error code 0) yet the application still says the file does not exist.
The stat function returns -1, though, which indicates an error... so this really doesn't make much sense.
Alright, since Dolphin is written in C++, I just went ahead and replaced the existing function with something more C++, and it works.
It can now find and open all games that it couldn't before for me.
I looked in CoreParameter.cpp under the SCoreStartupParameter::AutoSetup() function.
The problem it's running into is related to File::Exists().
From there I went into FileUtil.cpp to dig around.
I made a simple modification to print the result of stat().
Code:
--- C:/Users/Dopefish/AppData/Local/Temp/FileUtil.cp-revBASE.svn001.tmp.cpp Wed Dec 9 23:54:26 2009
+++ C:/Users/Dopefish/Documents/Visual Studio 2010/Projects/dolphin-emu/Source/Core/Common/Src/FileUtil.cpp Wed Dec 9 23:52:45 2009
@@ -19,6 +19,9 @@
#include "FileUtil.h"
#include "StringUtil.h"
+#include <errno.h>
+extern int errno;
+
#ifdef _WIN32
#include <windows.h>
#include <shlobj.h> // for SHGetFolderPath
@@ -72,6 +75,7 @@
char *copy = StripTailDirSlashes(__strdup(filename));
int result = stat(copy, &file_info);
+ PanicAlert("File: %s\nResult: %d\nError: %s", copy, result, strerror(errno));
free(copy);
return (result == 0);When you compile and first open Dolphin, it's going to pop up a bunch of dialogs as that function is called, just dismiss them all.
When I finally get to the main interface, I go to open and select the .gcz, and the result is simply "No error" (error code 0) yet the application still says the file does not exist.
The stat function returns -1, though, which indicates an error... so this really doesn't make much sense.
Code:
57:58:061 E[*]: Warning: File: D:\Games\Dolphin\Games\game.gcz
Result: -1
Error: No error
58:01:172 E[*]: Warning: The file you specified (D:\Games\Dolphin\Games\game.gcz) does not existsAlright, since Dolphin is written in C++, I just went ahead and replaced the existing function with something more C++, and it works.
Code:
--- C:/Users/Dopefish/AppData/Local/Temp/FileUtil.c-revBASE.svn002.tmp.cpp Thu Dec 10 00:19:15 2009
+++ C:/Users/Dopefish/Documents/Visual Studio 2010/Projects/dolphin-emu/Source/Core/Common/Src/FileUtil.cpp Thu Dec 10 00:19:03 2009
@@ -68,13 +68,15 @@
// Returns true if file filename exists
bool Exists(const char *filename)
{
- struct stat file_info;
-
- char *copy = StripTailDirSlashes(__strdup(filename));
- int result = stat(copy, &file_info);
- free(copy);
+ std::ifstream ifsFile;
+ std::ofstream ofsFile;
- return (result == 0);
+ ifsFile.open(filename, std::ifstream::in);
+ ifsFile.close();
+ if (ifsFile.fail())
+ return 0;
+ else
+ return 1;
}
// Returns true if filename is a directoryIt can now find and open all games that it couldn't before for me.
