Merge pull request #109 from lioncash/file-io-clarifications

Eliminate the magic constants in the switch statement in WII_IPC_HLE_Device_FileIO.cpp's Seek function.
This commit is contained in:
Matthew Parlane 2014-03-02 18:29:48 +13:00
commit 70b3749d4b
2 changed files with 14 additions and 4 deletions

View File

@ -162,7 +162,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
switch (Mode)
{
case 0:
case WII_SEEK_SET:
{
if ((SeekPosition >=0) && (SeekPosition <= fileSize))
{
@ -171,7 +171,8 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
break;
}
case 1:
case WII_SEEK_CUR:
{
s32 wantedPos = SeekPosition+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
@ -181,9 +182,10 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
break;
}
case 2:
case WII_SEEK_END:
{
s32 wantedPos = fileSize+m_SeekPos;
s32 wantedPos = SeekPosition+fileSize;
if (wantedPos >=0 && wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
@ -191,6 +193,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
break;
}
default:
{
PanicAlert("CWII_IPC_HLE_Device_FileIO Unsupported seek mode %i", Mode);

View File

@ -35,6 +35,13 @@ private:
ISFS_OPEN_RW = (ISFS_OPEN_READ | ISFS_OPEN_WRITE)
};
enum
{
WII_SEEK_SET = 0,
WII_SEEK_CUR = 1,
WII_SEEK_END = 2,
};
enum
{
ISFS_FUNCNULL = 0,