uilogic.h 2.25 KB
#ifndef __uilogic_h__
#define __uilogic_h__

#define BB_SYSAPP_SERIAL_HEAP_SIZE (16*1024*8)
#define BB_SYSAPP_RDBUF_SIZE (16*1024)

#define MAX_CONT_PAK   12
#define MAX_GPAK_DATA_SIZE (128*1024)
#define MAX_CPAK_DATA_SIZE (32*1024)
#define MAX_FS_GPAK_SIZE (1024*1024)
#define MAX_GPAK_CNT   12

extern int gPersonalizeCnt;
extern int gPersonalizeTotal;

typedef struct {
    u32 cid;
    int dirty;
} SaGpak;

typedef struct {
    u8  data[MAX_GPAK_DATA_SIZE]; // do not move: this has to be aligned to 16 byte
    u32 cid;
    BbEccSig sig;
    u32 size;
} SaGpakCopy;

typedef struct {
    u32 cid;
    u32 cont_id;
    int dirty;
} SaCpak;
extern SaCpak gCpakList[MAX_CONT_PAK];

typedef struct {
    u8  data[MAX_CPAK_DATA_SIZE]; // do not move: this has to be aligned to 16byte
    u32 cid;
    BbEccSig sig;
} SaCpakCopy;

extern int uiBbidCheck(void);
extern int uiParseTickets(void);
extern int uiGetTicketIdx(u32 cid);
extern int uiGetTicketRow(u32 cid);
extern int uiPreLaunchGame();
extern int uiPersonalizeGame();
extern int uiLaunchGame();

extern int uiCheckBirthday();

extern int uiGpakFull(void);
extern int uiGetGpaks(SaGpak* pGpaks);  //return # of gpaks on card
extern int uiDeleteGpak(u32 cid);
extern int uiGetGpakCopy(u32 cid, SaGpakCopy* pGpak);
extern int uiGpakSrcCardOkay();
extern int uiGpakDstCardOkay(SaGpakCopy* pGpak);
extern int uiCopyGpak(SaGpakCopy* pGpak);

extern int uiGetCpakCnt(u32 cid);  //return # of cpaks supported by cid
extern int uiGetCpak(u32 cid, SaCpak* pCpaks); //return # of cells found for cid

extern void uiCpakRead(SaCpak* pCpaks);
extern int uiGetCpakBindings(u32 cid, u32 bindings[4]);
extern int uiSaveCpakBindings(SaCpak* pCpaks); // save cell bindings

extern int uiEmptyCpak(int idx);
extern int uiGetCpakCopy(int i, SaCpakCopy* pCpak);
extern int uiCpakSrcCardOkay();
extern int uiCpakDstCardOkay(SaCpakCopy* pCpak);
extern int uiCopyCpak(int i, SaCpakCopy* pCpak);
/*
extern int uiCopyFromCpak(int i, u8* pData, int *sign);
extern int uiCopyToCpak(int i, u32 cid, u8* pData, int sign);
*/

extern int  uiInitContVal(u8* contVal, const u8* lower, const u8* upper);
extern int  uiSaveContSettings(u8* contVal);
extern int  uiCheckExpiration(u16 tid);
extern int  uiUpdateTimer(u16 tid, int reset_gtime);
extern void uiResetGtime();
#endif