diff --git a/include/kabufuda/Card.hpp b/include/kabufuda/Card.hpp index 2dcc05d..6eea1c0 100644 --- a/include/kabufuda/Card.hpp +++ b/include/kabufuda/Card.hpp @@ -169,8 +169,8 @@ public: EImageFormat iconFormat(const std::unique_ptr& fh, uint32_t idx) const; void setIconSpeed(const std::unique_ptr& fh, uint32_t idx, EAnimationSpeed speed); EAnimationSpeed iconSpeed(const std::unique_ptr& fh, uint32_t idx) const; - void setIconAddress(const std::unique_ptr& fh, uint32_t addr); - int32_t iconAddress(const std::unique_ptr& fh) const; + void setImageAddress(const std::unique_ptr& fh, uint32_t addr); + int32_t imageAddress(const std::unique_ptr& fh) const; void setCommentAddress(const std::unique_ptr& fh, uint32_t addr); int32_t commentAddress(const std::unique_ptr& fh) const; diff --git a/lib/kabufuda/Card.cpp b/lib/kabufuda/Card.cpp index e3e95d1..e0c5eaa 100644 --- a/lib/kabufuda/Card.cpp +++ b/lib/kabufuda/Card.cpp @@ -435,7 +435,7 @@ EAnimationType Card::iconAnimationType(const std::unique_ptr &fh) c { File* file = _fileFromHandle(fh); if (!file) - return EAnimationType::Loop; + return EAnimationType::Loop; return EAnimationType(file->m_bannerFlags & 4); } @@ -476,7 +476,7 @@ EAnimationSpeed Card::iconSpeed(const std::unique_ptr &fh, uint32_t return EAnimationSpeed((file->m_animSpeed >> (2 * (idx))) & 3); } -void Card::setIconAddress(const std::unique_ptr &fh, uint32_t addr) +void Card::setImageAddress(const std::unique_ptr &fh, uint32_t addr) { File* file = _fileFromHandle(fh); if (!file) @@ -484,7 +484,7 @@ void Card::setIconAddress(const std::unique_ptr &fh, uint32_t addr) file->m_iconAddress = addr; } -int32_t Card::iconAddress(const std::unique_ptr &fh) const +int32_t Card::imageAddress(const std::unique_ptr &fh) const { File* file = _fileFromHandle(fh); if (!file) diff --git a/test/main.cpp b/test/main.cpp index 44671d0..55da2c8 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -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