mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge pull request #3798 from phire/goto_dino
Fix handling of Wii NAND's /tmp directory during savestate loads.
This commit is contained in:
@ -530,6 +530,8 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
|
|||||||
bool DeleteDirRecursively(const std::string& directory)
|
bool DeleteDirRecursively(const std::string& directory)
|
||||||
{
|
{
|
||||||
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
|
INFO_LOG(COMMON, "DeleteDirRecursively: %s", directory.c_str());
|
||||||
|
bool success = true;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
// Find the first file in the directory.
|
// Find the first file in the directory.
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
@ -568,22 +570,16 @@ bool DeleteDirRecursively(const std::string& directory)
|
|||||||
{
|
{
|
||||||
if (!DeleteDirRecursively(newPath))
|
if (!DeleteDirRecursively(newPath))
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
success = false;
|
||||||
closedir(dirp);
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!File::Delete(newPath))
|
if (!File::Delete(newPath))
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
success = false;
|
||||||
closedir(dirp);
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,9 +590,10 @@ bool DeleteDirRecursively(const std::string& directory)
|
|||||||
}
|
}
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
#endif
|
#endif
|
||||||
File::DeleteDir(directory);
|
if (success)
|
||||||
|
File::DeleteDir(directory);
|
||||||
|
|
||||||
return true;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create directory and copy contents (does not overwrite existing files)
|
// Create directory and copy contents (does not overwrite existing files)
|
||||||
|
@ -270,6 +270,13 @@ void DoState(PointerWrap &p)
|
|||||||
p.Do(reply_queue);
|
p.Do(reply_queue);
|
||||||
p.Do(last_reply_time);
|
p.Do(last_reply_time);
|
||||||
|
|
||||||
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||||
|
{
|
||||||
|
// We need to make sure all file handles are closed so WII_IPC_Devices_fs::DoState can successfully re-create /tmp
|
||||||
|
for (u32 i = 0; i < IPC_MAX_FDS; i++)
|
||||||
|
g_FdMap[i].reset();
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& entry : g_DeviceMap)
|
for (const auto& entry : g_DeviceMap)
|
||||||
{
|
{
|
||||||
if (entry.second->IsHardware())
|
if (entry.second->IsHardware())
|
||||||
@ -280,7 +287,7 @@ void DoState(PointerWrap &p)
|
|||||||
|
|
||||||
if (p.GetMode() == PointerWrap::MODE_READ)
|
if (p.GetMode() == PointerWrap::MODE_READ)
|
||||||
{
|
{
|
||||||
for (u32 i=0; i<IPC_MAX_FDS; i++)
|
for (u32 i=0; i < IPC_MAX_FDS; i++)
|
||||||
{
|
{
|
||||||
u32 exists = 0;
|
u32 exists = 0;
|
||||||
p.Do(exists);
|
p.Do(exists);
|
||||||
@ -300,13 +307,9 @@ void DoState(PointerWrap &p)
|
|||||||
g_FdMap[i]->DoState(p);
|
g_FdMap[i]->DoState(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
g_FdMap[i].reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i=0; i<ES_MAX_COUNT; i++)
|
for (u32 i=0; i < ES_MAX_COUNT; i++)
|
||||||
{
|
{
|
||||||
p.Do(es_inuse[i]);
|
p.Do(es_inuse[i]);
|
||||||
u32 handleID = es_handles[i]->GetDeviceID();
|
u32 handleID = es_handles[i]->GetDeviceID();
|
||||||
@ -337,7 +340,7 @@ void DoState(PointerWrap &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (u32 i=0; i<ES_MAX_COUNT; i++)
|
for (u32 i=0; i < ES_MAX_COUNT; i++)
|
||||||
{
|
{
|
||||||
p.Do(es_inuse[i]);
|
p.Do(es_inuse[i]);
|
||||||
u32 handleID = es_handles[i]->GetDeviceID();
|
u32 handleID = es_handles[i]->GetDeviceID();
|
||||||
|
Reference in New Issue
Block a user