kabufuda/test/main.cpp

46 lines
1.4 KiB
C++
Raw Normal View History

#include "kabufuda/Card.hpp"
2016-03-26 04:26:51 +00:00
#include <iostream>
int main()
{
2016-03-26 20:16:30 +00:00
kabufuda::Card mc{_S("test.USA.raw"), "GM8E", "01"};
if (!mc)
2016-06-26 20:37:50 +00:00
mc.format(kabufuda::EDeviceId::SlotA, kabufuda::ECardSize::Card2043Mb);
2016-06-30 09:53:13 +00:00
kabufuda::Card mc2{_S("test2.USA.raw"), "GM8E", "01"};
if (!mc2)
mc2.format(kabufuda::EDeviceId::SlotA, kabufuda::ECardSize::Card2043Mb);
2016-06-27 08:15:02 +00:00
std::unique_ptr<kabufuda::IFileHandle> f = mc.openFile("MetroidPrime B");
2016-06-26 10:33:47 +00:00
if (!f)
2016-06-30 09:53:13 +00:00
{
2016-06-27 08:15:02 +00:00
f = mc.createFile("MetroidPrime B", kabufuda::BlockSize);
2016-06-30 09:53:13 +00:00
mc.setPublic(f, true);
mc.setCanCopy(f, true);
mc.setCanMove(f, true);
}
2016-06-26 10:33:47 +00:00
2016-03-27 03:46:52 +00:00
if (f)
{
2016-06-30 09:53:13 +00:00
mc.setBannerFormat(f, kabufuda::EImageFormat::C8);
mc.setIconFormat(f, 0, kabufuda::EImageFormat::C8);
mc.setIconSpeed(f, 0, kabufuda::EAnimationSpeed::Middle);
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));
2016-06-30 09:53:13 +00:00
if (mc.copyFileTo(f, mc2))
printf("Copy succeeded!\n");
else
printf("Copy failed...\n");
2016-03-27 03:46:52 +00:00
}
2016-03-26 04:26:51 +00:00
return 0;
}