Skip to content
Permalink
Browse files

GCMemcard: Rewrite DEntry_IconFmt() and DEntry_AnimSpeed() to make mo…

…re sense.
  • Loading branch information...
AdmiralCurtiss committed Dec 9, 2018
1 parent 2351a60 commit ca2c7679df4f8a1db0b2a1baf578ae605306afc2
Showing with 7 additions and 16 deletions.
  1. +7 −16 Source/Core/Core/HW/GCMemcard/GCMemcard.cpp
@@ -9,6 +9,7 @@
#include <cstring>
#include <vector>

#include "Common/BitUtils.h"
#include "Common/ColorUtil.h"
#include "Common/CommonFuncs.h"
#include "Common/CommonPaths.h"
@@ -480,16 +481,11 @@ std::string GCMemcard::DEntry_IconFmt(u8 index) const
if (!m_valid || index >= DIRLEN)
return "";

std::array<u8, 2> tmp;
memcpy(tmp.data(), &GetActiveDirectory().m_dir_entries[index].m_icon_format, 2);
int x = tmp[0];
u16 x = GetActiveDirectory().m_dir_entries[index].m_icon_format;
std::string format;
for (int i = 0; i < 16; i++)
for (size_t i = 0; i < 16; ++i)
{
if (i == 8)
x = tmp[1];
format.push_back((x & 0x80) ? '1' : '0');
x = x << 1;
format.push_back(Common::ExtractBit(x, 15 - i) ? '1' : '0');
}
return format;
}
@@ -499,16 +495,11 @@ std::string GCMemcard::DEntry_AnimSpeed(u8 index) const
if (!m_valid || index >= DIRLEN)
return "";

std::array<u8, 2> tmp;
memcpy(tmp.data(), &GetActiveDirectory().m_dir_entries[index].m_animation_speed, 2);
int x = tmp[0];
u16 x = GetActiveDirectory().m_dir_entries[index].m_animation_speed;
std::string speed;
for (int i = 0; i < 16; i++)
for (size_t i = 0; i < 16; ++i)
{
if (i == 8)
x = tmp[1];
speed.push_back((x & 0x80) ? '1' : '0');
x = x << 1;
speed.push_back(Common::ExtractBit(x, 15 - i) ? '1' : '0');
}
return speed;
}

0 comments on commit ca2c767

Please sign in to comment.
You can’t perform that action at this time.