Clarify API usage

IconAddress makes no sense, points to the start of the banner, with the icon directly following,
This commit is contained in:
Phillip Stephens 2016-06-30 09:15:05 -07:00
parent 4d9bb795b9
commit 369d2cc23f
3 changed files with 16 additions and 16 deletions

View File

@ -169,8 +169,8 @@ public:
EImageFormat iconFormat(const std::unique_ptr<IFileHandle>& fh, uint32_t idx) const;
void setIconSpeed(const std::unique_ptr<IFileHandle>& fh, uint32_t idx, EAnimationSpeed speed);
EAnimationSpeed iconSpeed(const std::unique_ptr<IFileHandle>& fh, uint32_t idx) const;
void setIconAddress(const std::unique_ptr<IFileHandle>& fh, uint32_t addr);
int32_t iconAddress(const std::unique_ptr<IFileHandle>& fh) const;
void setImageAddress(const std::unique_ptr<IFileHandle>& fh, uint32_t addr);
int32_t imageAddress(const std::unique_ptr<IFileHandle>& fh) const;
void setCommentAddress(const std::unique_ptr<IFileHandle>& fh, uint32_t addr);
int32_t commentAddress(const std::unique_ptr<IFileHandle>& fh) const;

View File

@ -476,7 +476,7 @@ EAnimationSpeed Card::iconSpeed(const std::unique_ptr<IFileHandle> &fh, uint32_t
return EAnimationSpeed((file->m_animSpeed >> (2 * (idx))) & 3);
}
void Card::setIconAddress(const std::unique_ptr<IFileHandle> &fh, uint32_t addr)
void Card::setImageAddress(const std::unique_ptr<IFileHandle> &fh, uint32_t addr)
{
File* file = _fileFromHandle(fh);
if (!file)
@ -484,7 +484,7 @@ void Card::setIconAddress(const std::unique_ptr<IFileHandle> &fh, uint32_t addr)
file->m_iconAddress = addr;
}
int32_t Card::iconAddress(const std::unique_ptr<IFileHandle> &fh) const
int32_t Card::imageAddress(const std::unique_ptr<IFileHandle> &fh) const
{
File* file = _fileFromHandle(fh);
if (!file)

View File

@ -17,7 +17,6 @@ int main()
mc.setPublic(f, true);
mc.setCanCopy(f, true);
mc.setCanMove(f, true);
mc.setIconAddress(f, mc.commentAddress(f) + 64);
}
if (f)
@ -26,16 +25,17 @@ int main()
mc.setIconFormat(f, 0, kabufuda::EImageFormat::C8);
mc.setIconSpeed(f, 0, kabufuda::EAnimationSpeed::Middle);
const char* test = "Metroid Prime B is Cool";
size_t len = strlen(test);
mc.seek(f, 0, kabufuda::SeekOrigin::Begin);
mc.write(f, test, len + 1);
uint16_t derp = 1234;
mc.seek(f, 1, kabufuda::SeekOrigin::End);
mc.write(f, &derp, 2);
mc.seek(f, -2, kabufuda::SeekOrigin::Current);
mc.read(f, &derp, 2);
std::cout << derp << std::endl;
mc.seek(f, 4, kabufuda::SeekOrigin::Begin);
mc.setCommentAddress(f, 4);
std::string comment("Metroid Prime PC Edition");
mc.write(f, comment.c_str(), comment.length());
mc.seek(f, 32 - comment.length(), kabufuda::SeekOrigin::Current);
comment = "Metroid Prime PC Is Cool";
mc.write(f, comment.c_str(), comment.length());
mc.seek(f, 32 - comment.length(), kabufuda::SeekOrigin::Current);
mc.setImageAddress(f, mc.tell(f));
if (mc.copyFileTo(f, mc2))
printf("Copy succeeded!\n");
else