sotn-decomp/include/memcard.h
Luciano Ciccariello e9bed91931
Extract memory card icons (#166)
Extract the memory card icons out of DRA.BIN and SEL.BIN.


![image](https://user-images.githubusercontent.com/6128729/227794798-4dd071f9-512b-4c72-8f5d-fcbf7a615519.png)

I also took the opportunity to extract `g_MemcardPortMask` into its own
source file `save_mgr_pre.c`. Unfortunately this is required to keep the
original data order. This suggests that most likely the icon palette and
bitmap were baked into the original `save_mgr.c` as byte arrays. I
decided to take a different approach and extracted them as PNGs for
better moddability.

I had to spin-off Splat into a new fork due to some breaking changes on
0.18.0.
2023-12-11 23:12:13 -08:00

34 lines
928 B
C

#ifndef MEMCARD_H
#define MEMCARD_H
// save manager
// port: 0 or 1, it is the physical port where you plug the memory card.
// port_s: 0-3, valid only in the context of multi tap, unused in this game.
// channel: the numerical combination of port and port_s
// block: 0-14, a memory card can store up to 15 blocks
#include "common.h"
#include <psxsdk/kernel.h>
#include <psxsdk/libapi.h>
#define PORT_COUNT (2)
#define BLOCK_PER_CARD (15)
#define CARD_BLOCK_SIZE (8192)
typedef struct {
/* 0x000 */ struct DIRENTRY entries[BLOCK_PER_CARD];
/* 0x258 */ u32 unk258;
/* 0x25C */ u32 unk25C;
/* 0x260 */ u32 nBlockUsed;
/* 0x264 */ s32 nFreeBlock;
/* 0x268 */ u8 blocks[BLOCK_PER_CARD];
} MemcardInfo; /* size=0x278 */
extern MemcardInfo g_MemcardInfo[2];
extern s32 g_MemcardBlockRead;
extern s32 g_MemcardPortMask[];
extern u16 g_saveIconPal0[0x10][0x10];
extern u8* g_saveIconTexture[0x10];
#endif