GCMemcard: Use BigEndianValue for DEntry.m_animation_speed.
This commit is contained in:
parent
c3e9f53480
commit
929fd2b41d
|
@ -471,12 +471,14 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const
|
||||||
if (!m_valid || index >= DIRLEN)
|
if (!m_valid || index >= DIRLEN)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
int x = CurrentDir->m_dir_entries[index].m_animation_speed[0];
|
std::array<u8, 2> tmp;
|
||||||
|
memcpy(tmp.data(), &CurrentDir->m_dir_entries[index].m_animation_speed, 2);
|
||||||
|
int x = tmp[0];
|
||||||
std::string speed;
|
std::string speed;
|
||||||
for (int i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (i == 8)
|
if (i == 8)
|
||||||
x = CurrentDir->m_dir_entries[index].m_animation_speed[1];
|
x = tmp[1];
|
||||||
speed.push_back((x & 0x80) ? '1' : '0');
|
speed.push_back((x & 0x80) ? '1' : '0');
|
||||||
x = x << 1;
|
x = x << 1;
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1055,10 @@ void GCMemcard::Gcs_SavConvert(DEntry& tempDEntry, int saveType, int length)
|
||||||
ByteSwap(&tmp[0], &tmp[1]);
|
ByteSwap(&tmp[0], &tmp[1]);
|
||||||
memcpy(&tempDEntry.m_icon_format, tmp.data(), 2);
|
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);
|
ByteSwap(&tempDEntry.m_file_permissions, &tempDEntry.m_copy_counter);
|
||||||
ArrayByteSwap((tempDEntry.m_first_block));
|
ArrayByteSwap((tempDEntry.m_first_block));
|
||||||
ArrayByteSwap((tempDEntry.m_block_count));
|
ArrayByteSwap((tempDEntry.m_block_count));
|
||||||
|
@ -1118,7 +1123,7 @@ u32 GCMemcard::ReadAnimRGBA8(u8 index, u32* buffer, u8* delays) const
|
||||||
// int fmtCheck = 0;
|
// int fmtCheck = 0;
|
||||||
|
|
||||||
int formats = CurrentDir->m_dir_entries[index].m_icon_format;
|
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;
|
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
|
// Timesplitters 2 and 3 is the only game that I see this in
|
||||||
|
|
|
@ -198,7 +198,8 @@ struct DEntry
|
||||||
// 10 RGB5A3
|
// 10 RGB5A3
|
||||||
// 11 CI8 with a unique color palette after itself
|
// 11 CI8 with a unique color palette after itself
|
||||||
//
|
//
|
||||||
u8 m_animation_speed[2]; // 0x32 0x02 Animation speed (2bits per icon) (*1)
|
Common::BigEndianValue<u16>
|
||||||
|
m_animation_speed; // 0x32 0x02 Animation speed (2bits per icon) (*1)
|
||||||
// Bits Description
|
// Bits Description
|
||||||
// 00 No icon
|
// 00 No icon
|
||||||
// 01 Icon lasts for 4 frames
|
// 01 Icon lasts for 4 frames
|
||||||
|
|
|
@ -202,7 +202,10 @@ void GCMemcardManager::UpdateSlotTable(int slot)
|
||||||
DEntry d;
|
DEntry d;
|
||||||
memcard->GetDEntry(file_index, 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});
|
m_slot_active_icons[slot].push_back({speed, frames});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue