several FS/FileIO fixes/improvements
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1045 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b88098cc17
commit
ef943ed065
|
@ -69,7 +69,14 @@ CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode)
|
||||||
{
|
{
|
||||||
u32 ReturnValue = 0;
|
u32 ReturnValue = 0;
|
||||||
|
|
||||||
LOG(WII_IPC_FILEIO, "FileIO: Open (Device=%s)", GetDeviceName().c_str());
|
const char Modes[][128] =
|
||||||
|
{
|
||||||
|
{ "Read only" },
|
||||||
|
{ "Write only" },
|
||||||
|
{ "Read and Write" }
|
||||||
|
};
|
||||||
|
|
||||||
|
LOG(WII_IPC_FILEIO, "FileIO: Open %s (%s)", GetDeviceName().c_str(), Modes[_Mode]);
|
||||||
|
|
||||||
m_Filename = std::string(HLE_IPC_BuildFilename(GetDeviceName().c_str(), 64));
|
m_Filename = std::string(HLE_IPC_BuildFilename(GetDeviceName().c_str(), 64));
|
||||||
|
|
||||||
|
@ -135,8 +142,8 @@ CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress)
|
||||||
|
|
||||||
if (m_pFileHandle != NULL)
|
if (m_pFileHandle != NULL)
|
||||||
{
|
{
|
||||||
fread(Memory::GetPointer(Address), Size, 1, m_pFileHandle);
|
size_t readItems = fread(Memory::GetPointer(Address), 1, Size, m_pFileHandle);
|
||||||
ReturnValue = Size;
|
ReturnValue = readItems;
|
||||||
LOG(WII_IPC_FILEIO, "FileIO reads from %s (Addr=0x%08x Size=0x%x)", GetDeviceName().c_str(), Address, Size);
|
LOG(WII_IPC_FILEIO, "FileIO reads from %s (Addr=0x%08x Size=0x%x)", GetDeviceName().c_str(), Address, Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -190,7 +197,7 @@ CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress)
|
||||||
|
|
||||||
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
|
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
|
||||||
LOG(WII_IPC_FILEIO, "FileIO: ISFS_IOCTL_GETFILESTATS");
|
LOG(WII_IPC_FILEIO, "FileIO: ISFS_IOCTL_GETFILESTATS");
|
||||||
LOG(WII_IPC_FILEIO, "Length: %i Seek: %i", m_FileLength, Position);
|
LOG(WII_IPC_FILEIO, " Length: %i Seek: %i", m_FileLength, Position);
|
||||||
|
|
||||||
Memory::Write_U32(m_FileLength, BufferOut);
|
Memory::Write_U32(m_FileLength, BufferOut);
|
||||||
Memory::Write_U32(Position, BufferOut+4);
|
Memory::Write_U32(Position, BufferOut+4);
|
||||||
|
|
|
@ -63,7 +63,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode)
|
||||||
|
|
||||||
bool CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress)
|
bool CWII_IPC_HLE_Device_fs::IOCtl(u32 _CommandAddress)
|
||||||
{
|
{
|
||||||
LOG(WII_IPC_FILEIO, "FileIO: IOCtl (Device=%s)", GetDeviceName().c_str());
|
LOG(WII_IPC_FILEIO, "FS: IOCtl (Device=%s)", GetDeviceName().c_str());
|
||||||
|
|
||||||
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
|
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
|
||||||
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
|
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
|
||||||
|
@ -189,11 +189,11 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||||
Addr += 9; // owner attribs, permission
|
Addr += 9; // owner attribs, permission
|
||||||
u8 Attribs = Memory::Read_U8(Addr);
|
u8 Attribs = Memory::Read_U8(Addr);
|
||||||
|
|
||||||
|
LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s", DirName.c_str());
|
||||||
|
|
||||||
if (File::IsDirectory(DirName.c_str()))
|
if (File::IsDirectory(DirName.c_str()))
|
||||||
{
|
{
|
||||||
bool Result = File::CreateDir(DirName.c_str());
|
bool Result = File::CreateDir(DirName.c_str());
|
||||||
LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s (%s)", DirName.c_str(), Result ? "success" : "failed");
|
|
||||||
|
|
||||||
_dbg_assert_msg_(WII_IPC_FILEIO, Result, "FS: CREATE_DIR %s failed", DirName.c_str());
|
_dbg_assert_msg_(WII_IPC_FILEIO, Result, "FS: CREATE_DIR %s failed", DirName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,12 +202,19 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GET_ATTR:
|
case GET_ATTR:
|
||||||
{
|
{
|
||||||
_dbg_assert_(WII_IPC_FILEIO, _BufferOutSize == 0);
|
_dbg_assert_msg_(WII_IPC_FILEIO, _BufferOutSize == 76, " GET_ATTR needs an 76 bytes large output buffer but it is %i bytes large", _BufferOutSize);
|
||||||
int Offset = 0;
|
|
||||||
|
|
||||||
std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn+Offset), 64);
|
// first clear the whole output buffer
|
||||||
Offset += 64;
|
memset(Memory::GetPointer(_BufferOut), 0, _BufferOutSize);
|
||||||
|
|
||||||
|
u32 OwnerID = 0;
|
||||||
|
u16 GroupID = 0;
|
||||||
|
std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn), 64);
|
||||||
|
u8 OwnerPerm = 0;
|
||||||
|
u8 GroupPerm = 0;
|
||||||
|
u8 OtherPerm = 0;
|
||||||
|
u8 Attributes = 0;
|
||||||
|
|
||||||
if (File::IsDirectory(Filename.c_str()))
|
if (File::IsDirectory(Filename.c_str()))
|
||||||
{
|
{
|
||||||
|
@ -219,7 +226,24 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
|
||||||
{
|
{
|
||||||
LOG(WII_IPC_FILEIO, "FS: GET_ATTR %s - ni", Filename.c_str());
|
LOG(WII_IPC_FILEIO, "FS: GET_ATTR %s - ni", Filename.c_str());
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(WII_IPC_FILEIO, "FS: GET_ATTR unknown %s", Filename.c_str());
|
||||||
|
return FS_FILE_NOT_EXIST;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// write answer to buffer
|
||||||
|
if (_BufferOutSize == 76)
|
||||||
|
{
|
||||||
|
u32 Addr = _BufferOut;
|
||||||
|
Memory::Write_U32(OwnerID, Addr); Addr += 4;
|
||||||
|
Memory::Write_U16(GroupID, Addr); Addr += 2;
|
||||||
|
memcpy(Memory::GetPointer(Addr), Filename.c_str(), Filename.size()); Addr += 64;
|
||||||
|
Memory::Write_U8(OwnerPerm, Addr); Addr += 1;
|
||||||
|
Memory::Write_U8(GroupPerm, Addr); Addr += 1;
|
||||||
|
Memory::Write_U8(OtherPerm, Addr); Addr += 1;
|
||||||
|
Memory::Write_U8(Attributes, Addr); Addr += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FS_RESULT_OK;
|
return FS_RESULT_OK;
|
||||||
|
|
|
@ -83,6 +83,7 @@ CBannerLoaderWii::GetBanner(u32* _pBannerImage)
|
||||||
static u32 Buffer[192 * 64];
|
static u32 Buffer[192 * 64];
|
||||||
decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
|
decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64);
|
||||||
|
|
||||||
|
// ugly scaling :)
|
||||||
for (int y=0; y<32; y++)
|
for (int y=0; y<32; y++)
|
||||||
{
|
{
|
||||||
for (int x=0; x<96; x++)
|
for (int x=0; x<96; x++)
|
||||||
|
|
|
@ -333,7 +333,7 @@ void Host_SetWiiMoteConnectionState(int _State)
|
||||||
{
|
{
|
||||||
case 0: event.SetString(wxString::FromAscii("not connected")); break;
|
case 0: event.SetString(wxString::FromAscii("not connected")); break;
|
||||||
case 1: event.SetString(wxString::FromAscii("connecting...")); break;
|
case 1: event.SetString(wxString::FromAscii("connecting...")); break;
|
||||||
case 2: event.SetString(wxString::FromAscii("conected!")); break;
|
case 2: event.SetString(wxString::FromAscii("connected!")); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.SetInt(1);
|
event.SetInt(1);
|
||||||
|
|
Loading…
Reference in New Issue