2016-06-27 04:28:48 +00:00
|
|
|
#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"};
|
2016-06-27 04:28:48 +00:00
|
|
|
if (!mc)
|
2016-12-28 08:50:25 +00:00
|
|
|
mc.format(kabufuda::ECardSlot::SlotA, kabufuda::ECardSize::Card2043Mb);
|
2016-12-23 09:48:32 +00:00
|
|
|
uint64_t a = 0;
|
|
|
|
mc.getSerial(a);
|
|
|
|
|
2016-06-30 09:53:13 +00:00
|
|
|
kabufuda::Card mc2{_S("test2.USA.raw"), "GM8E", "01"};
|
|
|
|
if (!mc2)
|
2016-12-28 08:50:25 +00:00
|
|
|
mc2.format(kabufuda::ECardSlot::SlotA, kabufuda::ECardSize::Card2043Mb);
|
2016-06-30 09:53:13 +00:00
|
|
|
|
2016-12-28 21:39:10 +00:00
|
|
|
std::unique_ptr<kabufuda::IFileHandle> f;
|
|
|
|
mc.openFile("MetroidPrime A", f);
|
2016-06-26 10:33:47 +00:00
|
|
|
if (!f)
|
2016-06-30 09:53:13 +00:00
|
|
|
{
|
2016-12-28 08:50:25 +00:00
|
|
|
mc.createFile("MetroidPrime A", kabufuda::BlockSize, f);
|
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-12-23 09:48:32 +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);
|
|
|
|
|
2016-06-30 16:15:05 +00:00
|
|
|
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-06-30 17:36:04 +00:00
|
|
|
|
|
|
|
std::unique_ptr<kabufuda::IFileHandle> it = mc.firstFile();
|
|
|
|
while (it)
|
|
|
|
{
|
|
|
|
printf("%.4s%.2s-%s\n", mc.gameId(it), mc.maker(it), mc.getFilename(it));
|
|
|
|
it = mc.nextFile(it);
|
|
|
|
}
|
2016-03-27 03:46:52 +00:00
|
|
|
}
|
2016-03-26 04:26:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|