Better error messages, Dolphin will create save directories if not present.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@37 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-07-20 21:20:22 +00:00
parent 4175db3aa3
commit 36f8b9751a
9 changed files with 82 additions and 22 deletions

View File

@ -128,6 +128,7 @@ void CPUInfoStruct::Detect()
// Interpret CPU brand string and cache information. // Interpret CPU brand string and cache information.
if (i == 0x80000001) if (i == 0x80000001)
{ {
// This block seems bugged.
nFeatureInfo2 = CPUInfo[1]; // ECX nFeatureInfo2 = CPUInfo[1]; // ECX
bSSE5 = (nFeatureInfo2 & (1 << 11)) ? true : false; bSSE5 = (nFeatureInfo2 & (1 << 11)) ? true : false;
bLZCNT = (nFeatureInfo2 & (1 << 5)) ? true : false; bLZCNT = (nFeatureInfo2 & (1 << 5)) ? true : false;

View File

@ -51,3 +51,25 @@ void File::Explore(const std::string &path)
ShellExecuteEx(&shex); ShellExecuteEx(&shex);
#endif #endif
} }
// Returns true if successful, or path already exists.
bool File::CreateDir(const std::string &path)
{
#ifdef _WIN32
if (::CreateDirectory(path.c_str(), NULL))
{
return true;
}
else
{
DWORD error = GetLastError();
if (error == ERROR_ALREADY_EXISTS)
{
PanicAlert("%s already exists", path.c_str());
return true;
}
PanicAlert("Error creating directory: %i", error);
return false;
}
#endif
}

View File

@ -10,6 +10,7 @@ public:
static void Launch(const std::string &filename); static void Launch(const std::string &filename);
static void Explore(const std::string &path); static void Explore(const std::string &path);
static bool IsDirectory(const std::string &filename); static bool IsDirectory(const std::string &filename);
static bool CreateDir(const std::string &filename);
}; };
#endif #endif

View File

@ -432,11 +432,9 @@ void Callback_VideoCopiedToXFB()
idleTicks = newIdleTicks; idleTicks = newIdleTicks;
float t = (float)(Timer.GetTimeDifference()) / 1000.f; float t = (float)(Timer.GetTimeDifference()) / 1000.f;
char isoName[64];
isoName[0] = 0x00;
char temp[256]; char temp[256];
sprintf(temp, "%s - FPS: %8.2f - %s - %i MHz (%i real, %i idle skipped) out of %i MHz", sprintf(temp, "FPS: %8.2f - %s - %i MHz (%i real, %i idle skipped) out of %i MHz",
isoName, (float)frames / t, (float)frames / t,
g_CoreStartupParameter.bUseDynarec ? "JIT" : "Interpreter", g_CoreStartupParameter.bUseDynarec ? "JIT" : "Interpreter",
(int)(diff), (int)(diff),
(int)(diff-idleDiff), (int)(diff-idleDiff),

View File

@ -45,9 +45,13 @@ const unsigned char sram_dump_german[64] ={
0x00, 0x00, 0x84, 0xFF, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x84, 0xFF, 0x00, 0x00, 0x00, 0x00
}; };
static const char iplver[0x100] = "(C) 1999-2001 Nintendo. All rights reserved."
"(C) 1999 ArtX Inc. All rights reserved." // We should provide an option to choose from the above, or figure out the checksum (the algo in yagcd seems wrong)
"PAL Revision 1.0 "; // so that people can change default language.
static const char iplver[0x100] = "(C) 1999-2001 Nintendo. All rights reserved."
"(C) 1999 ArtX Inc. All rights reserved."
"PAL Revision 1.0 ";
CEXIIPL::CEXIIPL() : CEXIIPL::CEXIIPL() :
m_uPosition(0), m_uPosition(0),

View File

@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "Common.h"
#include "FileUtil.h"
#include "StringUtil.h"
#include "../Core.h" #include "../Core.h"
#include "../CoreTiming.h" #include "../CoreTiming.h"
@ -52,7 +55,7 @@ CEXIMemoryCard::CEXIMemoryCard(const std::string& _rName, const std::string& _rF
else else
{ {
LOG(EXPANSIONINTERFACE, "No memory card found. Will create new."); LOG(EXPANSIONINTERFACE, "No memory card found. Will create new.");
//MessageBox(0, "Could not read memory card file - starting with corrupt", m_strFilename.c_str(),0); Flush();
} }
formatDelay = 0; formatDelay = 0;
@ -66,16 +69,21 @@ void CEXIMemoryCard::Flush()
{ {
FILE* pFile = NULL; FILE* pFile = NULL;
pFile = fopen(m_strFilename.c_str(), "wb"); pFile = fopen(m_strFilename.c_str(), "wb");
if (pFile) if (!pFile)
{ {
fwrite(memory_card_content, memory_card_size, 1, pFile); std::string dir;
fclose(pFile); SplitPath(m_strFilename, &dir, 0, 0);
File::CreateDir(dir);
pFile = fopen(m_strFilename.c_str(), "wb");
} }
else if (!pFile) //Note - pFile changed inside above if
{ {
PanicAlert("Could not write memory card file %s.\n\n" PanicAlert("Could not write memory card file %s.\n\n"
"Are you running Dolphin from a CD/DVD, or is the save file maybe write protected?", m_strFilename.c_str()); "Are you running Dolphin from a CD/DVD, or is the save file maybe write protected?", m_strFilename.c_str());
return;
} }
fwrite(memory_card_content, memory_card_size, 1, pFile);
fclose(pFile);
} }
void CEXIMemoryCard::FlushCallback(u64 userdata, int cyclesLate) void CEXIMemoryCard::FlushCallback(u64 userdata, int cyclesLate)

View File

@ -28,6 +28,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -135,6 +136,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -243,6 +245,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -348,6 +351,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -453,6 +457,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
@ -560,6 +565,7 @@
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
CommandLine="$(ProjectDir)..\Common\SubWCRev.exe $(SolutionDir) $(ProjectDir)..\Common\src\svnrev_template.h $(ProjectDir)..\Common\src\svnrev.h"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"

View File

@ -42,20 +42,27 @@ bool DolphinApp::OnInit()
// RegisterPanicAlertHandler(&wxPanicAlert); // RegisterPanicAlertHandler(&wxPanicAlert);
#endif #endif
#if 0
#ifdef _WIN32 #ifdef _WIN32
// TODO: if First Boot // TODO: if First Boot
if (!cpu_info.bSSE2Extensions)
{
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
return false;
}
/*
#ifdef _M_IX86 #ifdef _M_IX86
if (cpu_info.CPU64Bit && !cpu_info.OS64Bit) if (cpu_info.CPU64bit && cpu_info.OS64bit)
{ {
MessageBox(0, _T("This is the 32-bit version of Dolphin. This computer is running a 64-bit OS.\n" MessageBox(0, _T("This is the 32-bit version of Dolphin. This computer is running a 64-bit OS.\n"
"Thus, this computer is capable of running Dolphin 64-bit, which is considerably " "Thus, this computer is capable of running Dolphin 64-bit, which is considerably "
"faster than Dolphin 32-bit. So, why are you running Dolphin 32-bit? :-)")); "faster than Dolphin 32-bit. So, why are you running Dolphin 32-bit? :-)"), "Dolphin", MB_ICONINFORMATION);
} }
// missing check // missing check
#endif #endif
#endif */
#endif #endif
bool UseDebugger = false; bool UseDebugger = false;
@ -79,7 +86,7 @@ bool DolphinApp::OnInit()
if (parser.Parse() != 0) if (parser.Parse() != 0)
{ {
return(false); return(false);
} }
UseDebugger = parser.Found(_T("debugger")); UseDebugger = parser.Found(_T("debugger"));
#endif #endif

View File

@ -212,10 +212,24 @@ namespace D3D
&d3dpp, &dev ) ) ) &d3dpp, &dev ) ) )
{ {
MessageBox(wnd, MessageBox(wnd,
"Direct3D Device creation failed!\n" "Sorry, but it looks like your 3D accelerator is too old,\n"
"Your device does not support the desired settings.", "or doesn't support features that Dolphin requires.\n"
"D3D error", MB_OK|MB_ICONERROR); "Falling back to software vertex processing.\n",
return E_FAIL; "Dolphin Direct3D plugin", MB_OK | MB_ICONERROR);
if( FAILED( D3D->CreateDevice(
adapter,
D3DDEVTYPE_HAL,
wnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_MULTITHREADED,
// |D3DCREATE_MULTITHREADED /* | D3DCREATE_PUREDEVICE*/,
//D3DCREATE_SOFTWARE_VERTEXPROCESSING ,
&d3dpp, &dev ) ) )
{
MessageBox(wnd,
"Software VP failed too. Upgrade your graphics card.",
"Dolphin Direct3D plugin", MB_OK | MB_ICONERROR);
return E_FAIL;
}
} }
dev->GetDeviceCaps(&caps); dev->GetDeviceCaps(&caps);
dev->GetRenderTarget(0,&backBuffer); dev->GetRenderTarget(0,&backBuffer);
@ -225,7 +239,6 @@ namespace D3D
vsMajor = (D3D::caps.VertexShaderVersion >>8) & 0xFF; vsMajor = (D3D::caps.VertexShaderVersion >>8) & 0xFF;
vsMinor = (D3D::caps.VertexShaderVersion) & 0xFF; vsMinor = (D3D::caps.VertexShaderVersion) & 0xFF;
// Device state would normally be set here // Device state would normally be set here
return S_OK; return S_OK;
} }