| 1672 | } |
| 1673 | |
| 1674 | void FolderMemoryCard::SetSizeInClusters(u32 clusters) |
| 1675 | { |
| 1676 | superBlockUnion newSuperBlock; |
| 1677 | memcpy(&newSuperBlock.raw[0], &m_superBlock.raw[0], sizeof(newSuperBlock.raw)); |
| 1678 | |
| 1679 | newSuperBlock.data.clusters_per_card = clusters; |
| 1680 | |
| 1681 | const u32 alloc_offset = clusters / 0x100 + 9; |
| 1682 | newSuperBlock.data.alloc_offset = alloc_offset; |
| 1683 | newSuperBlock.data.alloc_end = clusters - 0x10 - alloc_offset; |
| 1684 | |
| 1685 | const u32 blocks = clusters / 8; |
| 1686 | newSuperBlock.data.backup_block1 = blocks - 1; |
| 1687 | newSuperBlock.data.backup_block2 = blocks - 2; |
| 1688 | |
| 1689 | for (size_t i = 0; i < sizeof(newSuperBlock.raw) / PageSize; ++i) |
| 1690 | { |
| 1691 | Save(&newSuperBlock.raw[i * PageSize], i * PageSizeRaw, PageSize); |
| 1692 | } |
| 1693 | } |
| 1694 | |
| 1695 | void FolderMemoryCard::SetSizeInMB(u32 megaBytes) |
| 1696 | { |