• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 97 98 99 100 101 ... 117 Next »

Problem opening games
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
Problem opening games
12-10-2009, 02:48 PM (This post was last modified: 12-10-2009, 03:20 PM by imk.)
#2
imk Offline
Junior Member
**
Posts: 9
Threads: 1
Joined: Dec 2009
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().

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 exists



















Alright, 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 directory

It can now find and open all games that it couldn't before for me.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Problem opening games - imk - 12-09-2009, 05:43 PM
RE: Problem opening games - imk - 12-10-2009, 02:48 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 1 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode