diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp index f4e3c3e6d5..4fb5a90df3 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp +++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.cpp @@ -471,12 +471,14 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const if (!m_valid || index >= DIRLEN) return ""; - int x = CurrentDir->m_dir_entries[index].m_animation_speed[0]; + std::array tmp; + memcpy(tmp.data(), &CurrentDir->m_dir_entries[index].m_animation_speed, 2); + int x = tmp[0]; std::string speed; for (int i = 0; i < 16; i++) { if (i == 8) - x = CurrentDir->m_dir_entries[index].m_animation_speed[1]; + x = tmp[1]; speed.push_back((x & 0x80) ? '1' : '0'); x = x << 1; } @@ -1053,7 +1055,10 @@ void GCMemcard::Gcs_SavConvert(DEntry& tempDEntry, int saveType, int length) ByteSwap(&tmp[0], &tmp[1]); memcpy(&tempDEntry.m_icon_format, tmp.data(), 2); - ArrayByteSwap((tempDEntry.m_animation_speed)); + memcpy(tmp.data(), &tempDEntry.m_animation_speed, 2); + ByteSwap(&tmp[0], &tmp[1]); + memcpy(&tempDEntry.m_animation_speed, tmp.data(), 2); + ByteSwap(&tempDEntry.m_file_permissions, &tempDEntry.m_copy_counter); ArrayByteSwap((tempDEntry.m_first_block)); ArrayByteSwap((tempDEntry.m_block_count)); @@ -1118,7 +1123,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const // int fmtCheck = 0; int formats = CurrentDir->m_dir_entries[index].m_icon_format; - int fdelays = BE16(CurrentDir->m_dir_entries[index].m_animation_speed); + int fdelays = CurrentDir->m_dir_entries[index].m_animation_speed; int flags = CurrentDir->m_dir_entries[index].m_banner_and_icon_flags; // Timesplitters 2 and 3 is the only game that I see this in diff --git a/Source/Core/Core/HW/GCMemcard/GCMemcard.h b/Source/Core/Core/HW/GCMemcard/GCMemcard.h index ad733733ae..be6317613e 100644 --- a/Source/Core/Core/HW/GCMemcard/GCMemcard.h +++ b/Source/Core/Core/HW/GCMemcard/GCMemcard.h @@ -198,7 +198,8 @@ struct DEntry // 10 RGB5A3 // 11 CI8 with a unique color palette after itself // - u8 m_animation_speed[2]; // 0x32 0x02 Animation speed (2bits per icon) (*1) + Common::BigEndianValue + m_animation_speed; // 0x32 0x02 Animation speed (2bits per icon) (*1) // Bits Description // 00 No icon // 01 Icon lasts for 4 frames diff --git a/Source/Core/DolphinQt/GCMemcardManager.cpp b/Source/Core/DolphinQt/GCMemcardManager.cpp index abec5f98a4..c3b4ce855a 100644 --- a/Source/Core/DolphinQt/GCMemcardManager.cpp +++ b/Source/Core/DolphinQt/GCMemcardManager.cpp @@ -202,7 +202,10 @@ void GCMemcardManager::UpdateSlotTable(int slot) DEntry d; memcard->GetDEntry(file_index, d); - const auto speed = ((d.m_animation_speed[0] & 1) << 2) + (d.m_animation_speed[1] & 1); + // TODO: This is wrong, the animation speed is not static and is already correctly calculated in + // GetIconFromSaveFile(), just not returned + const u16 animation_speed = d.m_animation_speed; + const auto speed = (((animation_speed >> 8) & 1) << 2) + (animation_speed & 1); m_slot_active_icons[slot].push_back({speed, frames});