Skip to content
Permalink
Browse files

WII_IPC_HLE_Device_FileIO: don't rebuild the filename on every operat…

…ion.
  • Loading branch information
jordan-woyak committed Feb 17, 2013
1 parent fa9aafe commit d0ea94a2aaa1909a4b53b158a4a8250ee7578ae4
@@ -118,17 +118,18 @@ bool CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode)
"Read and Write"
};

m_filepath = HLE_IPC_BuildFilename(m_Name, 64);

// The file must exist before we can open it
// It should be created by ISFS_CreateFile, not here
auto const filename = HLE_IPC_BuildFilename(m_Name, 64);
if (File::Exists(filename))
if (File::Exists(m_filepath))
{
INFO_LOG(WII_IPC_FILEIO, "FileIO: Open %s (%s == %08X)", m_Name.c_str(), Modes[_Mode], _Mode);
ReturnValue = m_DeviceID;
}
else
{
WARN_LOG(WII_IPC_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[_Mode], filename.c_str());
WARN_LOG(WII_IPC_FILEIO, "FileIO: Open (%s) failed - File doesn't exist %s", Modes[_Mode], m_filepath.c_str());
ReturnValue = FS_FILE_NOT_EXIST;
}

@@ -158,7 +159,7 @@ File::IOFile CWII_IPC_HLE_Device_FileIO::OpenFile()
break;
}

return File::IOFile(HLE_IPC_BuildFilename(m_Name, 64), open_mode);
return File::IOFile(m_filepath, open_mode);
}

bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
@@ -344,4 +345,6 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap &p)

p.Do(m_Mode);
p.Do(m_SeekPos);

m_filepath = HLE_IPC_BuildFilename(m_Name, 64);
}
@@ -77,6 +77,8 @@ class CWII_IPC_HLE_Device_FileIO : public IWII_IPC_HLE_Device

u32 m_Mode;
u32 m_SeekPos;

std::string m_filepath;
};

#endif

0 comments on commit d0ea94a

Please sign in to comment.
You can’t perform that action at this time.