Eliminate the magic constants in the switch statement in WII_IPC_HLE_Device_FileIO.cpp's Seek function.

This commit is contained in:
Lioncash 2014-02-24 14:43:43 -05:00
parent 6959a93599
commit d5fd68e4a4
2 changed files with 13 additions and 3 deletions

View File

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