diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index c5337c9304..d88c636a6e 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -69,7 +69,14 @@ CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress, u32 _Mode) { 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)); @@ -135,8 +142,8 @@ CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress) if (m_pFileHandle != NULL) { - fread(Memory::GetPointer(Address), Size, 1, m_pFileHandle); - ReturnValue = Size; + size_t readItems = fread(Memory::GetPointer(Address), 1, Size, m_pFileHandle); + ReturnValue = readItems; LOG(WII_IPC_FILEIO, "FileIO reads from %s (Addr=0x%08x Size=0x%x)", GetDeviceName().c_str(), Address, Size); } else @@ -190,7 +197,7 @@ CWII_IPC_HLE_Device_FileIO::IOCtl(u32 _CommandAddress) u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); 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(Position, BufferOut+4); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp index a357892ca8..7e79b83a3c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.cpp @@ -63,7 +63,7 @@ bool CWII_IPC_HLE_Device_fs::Open(u32 _CommandAddress, u32 _Mode) 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 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 u8 Attribs = Memory::Read_U8(Addr); + LOG(WII_IPC_FILEIO, "FS: CREATE_DIR %s", DirName.c_str()); + if (File::IsDirectory(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()); } @@ -202,12 +202,19 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B break; case GET_ATTR: - { - _dbg_assert_(WII_IPC_FILEIO, _BufferOutSize == 0); - int Offset = 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); - std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn+Offset), 64); - Offset += 64; + // first clear the whole output buffer + 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())) { @@ -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()); } + 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; diff --git a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp index baf1ec5c13..b669e3dc66 100644 --- a/Source/Core/DiscIO/Src/BannerLoaderWii.cpp +++ b/Source/Core/DiscIO/Src/BannerLoaderWii.cpp @@ -83,6 +83,7 @@ CBannerLoaderWii::GetBanner(u32* _pBannerImage) static u32 Buffer[192 * 64]; decode5A3image(Buffer, (u16*)pBanner->m_BannerTexture, 192, 64); + // ugly scaling :) for (int y=0; y<32; y++) { for (int x=0; x<96; x++) diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index ccbfce69cb..2fbb0bcde3 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -333,7 +333,7 @@ void Host_SetWiiMoteConnectionState(int _State) { case 0: event.SetString(wxString::FromAscii("not connected")); 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);