Decompile card.c
Also start cleaning up saveload.c
This commit is contained in:
parent
f96afa27da
commit
b987603688
4 changed files with 294 additions and 103 deletions
|
|
@ -268,7 +268,7 @@ config.libs = [
|
||||||
Object(Matching, "game/wipe.c"),
|
Object(Matching, "game/wipe.c"),
|
||||||
Object(Matching, "game/window.c"),
|
Object(Matching, "game/window.c"),
|
||||||
Object(Matching, "game/messdata.c"),
|
Object(Matching, "game/messdata.c"),
|
||||||
Object(NonMatching, "game/card.c"),
|
Object(Matching, "game/card.c"),
|
||||||
Object(Matching, "game/armem.c"),
|
Object(Matching, "game/armem.c"),
|
||||||
Object(NonMatching, "game/code_800498F0.c"),
|
Object(NonMatching, "game/code_800498F0.c"),
|
||||||
Object(NonMatching, "game/mapspace.c"),
|
Object(NonMatching, "game/mapspace.c"),
|
||||||
|
|
|
||||||
23
include/game/card.h
Normal file
23
include/game/card.h
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _GAME_CARD_H
|
||||||
|
#define _GAME_CARD_H
|
||||||
|
|
||||||
|
#include "dolphin.h"
|
||||||
|
|
||||||
|
extern u8 UnMountCnt;
|
||||||
|
|
||||||
|
void HuCardInit(void);
|
||||||
|
s32 HuCardCheck(void);
|
||||||
|
s32 HuCardSlotCheck(s16 slot);
|
||||||
|
s32 HuCardMount(s16 slot);
|
||||||
|
void HuCardUnMount(s16 slot);
|
||||||
|
s32 HuCardFormat(s16 slot);
|
||||||
|
s32 HuCardOpen(s16 slot, const char *fileName, CARDFileInfo *fileInfo);
|
||||||
|
s32 HuCardRead(CARDFileInfo *fileInfo, void *addr, s32 length, s32 offset);
|
||||||
|
s32 HuCardCreate(s16 slot, const char *fileName, s32 size, CARDFileInfo *fileInfo);
|
||||||
|
s32 HuCardClose(CARDFileInfo *fileInfo);
|
||||||
|
s32 HuCardWrite(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 offset);
|
||||||
|
s32 HuCardDelete(s16 slot, const char *fileName);
|
||||||
|
s32 HuCardSectorSizeGet(s16 slot);
|
||||||
|
s32 HuCardFreeSpaceGet(s16 slot, u32 *byteNotUsed, u32 *filesNotUsed);
|
||||||
|
|
||||||
|
#endif
|
||||||
181
src/game/card.c
Normal file
181
src/game/card.c
Normal file
|
|
@ -0,0 +1,181 @@
|
||||||
|
#include "dolphin.h"
|
||||||
|
#include "game/memory.h"
|
||||||
|
#include "game/card.h"
|
||||||
|
|
||||||
|
static void *cardWork;
|
||||||
|
u8 UnMountCnt;
|
||||||
|
|
||||||
|
static void MountCallBack(s32 chan, s32 result);
|
||||||
|
|
||||||
|
void HuCardInit(void)
|
||||||
|
{
|
||||||
|
CARDInit();
|
||||||
|
cardWork = HuMemDirectMalloc(HEAP_SYSTEM, CARD_WORKAREA_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardCheck(void)
|
||||||
|
{
|
||||||
|
s32 ret = 0;
|
||||||
|
s32 memSize, sectorSize;
|
||||||
|
s32 result;
|
||||||
|
do {
|
||||||
|
result = CARDProbeEx(0, &memSize, §orSize);
|
||||||
|
} while(result == CARD_RESULT_BUSY);
|
||||||
|
if(result == CARD_RESULT_READY) {
|
||||||
|
ret |= 1;
|
||||||
|
OSReport("SlotA Card MemSize %x,Sector Size %x\n", memSize, sectorSize);
|
||||||
|
HuCardMount(0);
|
||||||
|
}
|
||||||
|
do {
|
||||||
|
result = CARDProbeEx(1, &memSize, §orSize);
|
||||||
|
} while(result == CARD_RESULT_BUSY);
|
||||||
|
if(result == CARD_RESULT_READY) {
|
||||||
|
ret |= 2;
|
||||||
|
OSReport("SlotB Card MemSize %x,Sector Size %x\n", memSize, sectorSize);
|
||||||
|
HuCardMount(1);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardSlotCheck(s16 slot)
|
||||||
|
{
|
||||||
|
s32 memSize, sectorSize;
|
||||||
|
s32 result;
|
||||||
|
do {
|
||||||
|
result = CARDProbeEx(slot, &memSize, §orSize);
|
||||||
|
} while(result == CARD_RESULT_BUSY);
|
||||||
|
if(result < 0) {
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return sectorSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardMount(s16 slot)
|
||||||
|
{
|
||||||
|
s32 memSize, sectorSize;
|
||||||
|
s32 result;
|
||||||
|
do {
|
||||||
|
result = CARDProbeEx(slot, &memSize, §orSize);
|
||||||
|
} while(result == CARD_RESULT_BUSY);
|
||||||
|
if(result < 0) {
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
result = CARDMount(slot, cardWork, MountCallBack);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_IOERROR) {
|
||||||
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
if(result == CARD_RESULT_ENCODING) {
|
||||||
|
return CARD_RESULT_BROKEN;
|
||||||
|
}
|
||||||
|
if(result < 0 && result != CARD_RESULT_BROKEN) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
result = CARDCheck(slot);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_IOERROR) {
|
||||||
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
if(result == CARD_RESULT_ENCODING) {
|
||||||
|
return CARD_RESULT_BROKEN;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HuCardUnMount(s16 slot)
|
||||||
|
{
|
||||||
|
CARDUnmount(slot);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardFormat(s16 slot)
|
||||||
|
{
|
||||||
|
s32 result = CARDFormat(slot);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_IOERROR) {
|
||||||
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MountCallBack(s32 chan, s32 result)
|
||||||
|
{
|
||||||
|
UnMountCnt = (1 << chan);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardOpen(s16 slot, const char *fileName, CARDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
s32 result = CARDOpen(slot, fileName, fileInfo);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_IOERROR) {
|
||||||
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
if(result == CARD_RESULT_ENCODING) {
|
||||||
|
return CARD_RESULT_BROKEN;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardRead(CARDFileInfo *fileInfo, void *addr, s32 length, s32 offset)
|
||||||
|
{
|
||||||
|
s32 result = CARDRead(fileInfo, addr, length, offset);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_IOERROR) {
|
||||||
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardCreate(s16 slot, const char *fileName, s32 size, CARDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
s32 sectorSize;
|
||||||
|
s32 byteNotUsed, filesNotUsed;
|
||||||
|
s32 result;
|
||||||
|
result = CARDGetSectorSize(slot, (u32 *)§orSize);
|
||||||
|
if(result == CARD_RESULT_FATAL_ERROR || result == CARD_RESULT_NOCARD) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if(size % sectorSize) {
|
||||||
|
size = sectorSize*(size+((sectorSize-1)/sectorSize));
|
||||||
|
}
|
||||||
|
result = CARDFreeBlocks(slot, &byteNotUsed, &filesNotUsed);
|
||||||
|
if(result != 0) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
if(filesNotUsed <= 0 || byteNotUsed < size) {
|
||||||
|
return CARD_RESULT_INSSPACE;
|
||||||
|
}
|
||||||
|
result = CARDCreate(slot, fileName, size, fileInfo);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardClose(CARDFileInfo *fileInfo)
|
||||||
|
{
|
||||||
|
s32 result = CARDClose(fileInfo);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardWrite(CARDFileInfo *fileInfo, const void *addr, s32 length, s32 offset)
|
||||||
|
{
|
||||||
|
s32 result = CARDWrite(fileInfo, addr, length, offset);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardDelete(s16 slot, const char *fileName)
|
||||||
|
{
|
||||||
|
s32 result = CARDDelete(slot, fileName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardSectorSizeGet(s16 slot)
|
||||||
|
{
|
||||||
|
u32 sectorSize;
|
||||||
|
s32 result = CARDGetSectorSize(slot, §orSize);
|
||||||
|
if(result < 0) {
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
return sectorSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s32 HuCardFreeSpaceGet(s16 slot, u32 *byteNotUsed, u32 *filesNotUsed)
|
||||||
|
{
|
||||||
|
s32 result = CARDFreeBlocks(slot, (s32 *)byteNotUsed, (s32 *)filesNotUsed);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
@ -3,27 +3,17 @@
|
||||||
#include "game/pad.h"
|
#include "game/pad.h"
|
||||||
#include "game/window.h"
|
#include "game/window.h"
|
||||||
#include "game/flag.h"
|
#include "game/flag.h"
|
||||||
|
#include "game/card.h"
|
||||||
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
static s16 SLCreateSaveWin(void);
|
static s16 SLCreateSaveWin(void);
|
||||||
static void SLKillSaveWin(void);
|
static void SLKillSaveWin(void);
|
||||||
|
|
||||||
s32 HuCardOpen(s16, char*, void*);
|
|
||||||
s32 HuCardSectorSizeGet(s16);
|
|
||||||
s32 HuCardCreate(s16, char*, u32, void*);
|
|
||||||
s32 HuCardFreeSpaceGet(s16, void*, void*);
|
|
||||||
s32 HuCardMount(s16);
|
|
||||||
void HuCardUnMount(s16);
|
|
||||||
s32 HuCardFormat(s16);
|
|
||||||
s32 HuCardWrite(void*, void*, u32, s32);
|
|
||||||
s32 HuCardRead(void*, void*, s32, s32);
|
|
||||||
s32 HuCardClose(void*);
|
|
||||||
|
|
||||||
|
|
||||||
extern u8 UnMountCnt;
|
extern u8 UnMountCnt;
|
||||||
|
|
||||||
s32 curFileInfo[8];
|
CARDFileInfo curFileInfo;
|
||||||
u8 ATTRIBUTE_ALIGN(32) saveBuf[0x4000];
|
u8 ATTRIBUTE_ALIGN(32) saveBuf[0x4000];
|
||||||
|
|
||||||
u64 SLSerialNo;
|
u64 SLSerialNo;
|
||||||
|
|
@ -62,27 +52,27 @@ s32 SLFileOpen(char *arg0) {
|
||||||
if (temp_r3 < 0) {
|
if (temp_r3 < 0) {
|
||||||
return temp_r3;
|
return temp_r3;
|
||||||
}
|
}
|
||||||
temp_r3 = HuCardOpen(curSlotNo, arg0, curFileInfo);
|
temp_r3 = HuCardOpen(curSlotNo, arg0, &curFileInfo);
|
||||||
if (temp_r3 == -4) {
|
if (temp_r3 == CARD_RESULT_NOFILE) {
|
||||||
return -4;
|
return CARD_RESULT_NOFILE;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -2) {
|
if (temp_r3 == CARD_RESULT_WRONGDEVICE) {
|
||||||
SLMessOut(7);
|
SLMessOut(7);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -128) {
|
if (temp_r3 == CARD_RESULT_FATAL_ERROR) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -3) {
|
if (temp_r3 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -6) {
|
if (temp_r3 == CARD_RESULT_BROKEN) {
|
||||||
temp_r3 = HuCardSectorSizeGet(curSlotNo);
|
temp_r3 = HuCardSectorSizeGet(curSlotNo);
|
||||||
if (temp_r3 > 0 && temp_r3 != 0x2000) {
|
if (temp_r3 > 0 && temp_r3 != 0x2000) {
|
||||||
SLMessOut(8);
|
SLMessOut(8);
|
||||||
return -2;
|
return CARD_RESULT_WRONGDEVICE;
|
||||||
}
|
}
|
||||||
UnMountCnt = 0;
|
UnMountCnt = 0;
|
||||||
temp_r3 = SLMessOut(5);
|
temp_r3 = SLMessOut(5);
|
||||||
|
|
@ -92,10 +82,10 @@ s32 SLFileOpen(char *arg0) {
|
||||||
return temp_r3;
|
return temp_r3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return -4;
|
return CARD_RESULT_NOFILE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return CARD_RESULT_READY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -117,20 +107,20 @@ s32 SLFileCreate(char *arg0, u32 arg1, void *arg2) {
|
||||||
temp_r31 = HuCardSectorSizeGet(curSlotNo);
|
temp_r31 = HuCardSectorSizeGet(curSlotNo);
|
||||||
if (temp_r31 < 0 && temp_r31 != 0x2000) {
|
if (temp_r31 < 0 && temp_r31 != 0x2000) {
|
||||||
SLMessOut(8);
|
SLMessOut(8);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
temp_r31 = HuCardFreeSpaceGet(curSlotNo, &sp14, &sp10);
|
temp_r31 = HuCardFreeSpaceGet(curSlotNo, &sp14, &sp10);
|
||||||
if (sp10 == 0 && arg1 > sp14) {
|
if (sp10 == 0 && arg1 > sp14) {
|
||||||
SLMessOut(4);
|
SLMessOut(4);
|
||||||
return -9;
|
return CARD_RESULT_INSSPACE;
|
||||||
}
|
}
|
||||||
if (sp10 == 0) {
|
if (sp10 == 0) {
|
||||||
SLMessOut(2);
|
SLMessOut(2);
|
||||||
return -9;
|
return CARD_RESULT_INSSPACE;
|
||||||
}
|
}
|
||||||
if (arg1 > sp14) {
|
if (arg1 > sp14) {
|
||||||
SLMessOut(3);
|
SLMessOut(3);
|
||||||
return -9;
|
return CARD_RESULT_INSSPACE;
|
||||||
}
|
}
|
||||||
HuWinInit(1);
|
HuWinInit(1);
|
||||||
HuWinMesMaxSizeGet(1, sp18, 0x10000B);
|
HuWinMesMaxSizeGet(1, sp18, 0x10000B);
|
||||||
|
|
@ -139,34 +129,34 @@ s32 SLFileCreate(char *arg0, u32 arg1, void *arg2) {
|
||||||
HuWinMesSet(temp_r30, 0x10000B);
|
HuWinMesSet(temp_r30, 0x10000B);
|
||||||
HuWinMesWait(temp_r30);
|
HuWinMesWait(temp_r30);
|
||||||
_SetFlag(FLAG_ID_MAKE(3, 0));
|
_SetFlag(FLAG_ID_MAKE(3, 0));
|
||||||
temp_r31 = HuCardCreate(curSlotNo, arg0, arg1, curFileInfo);
|
temp_r31 = HuCardCreate(curSlotNo, arg0, arg1, &curFileInfo);
|
||||||
_ClearFlag(0x30000);
|
_ClearFlag(0x30000);
|
||||||
if (temp_r31 < 0) {
|
if (temp_r31 < 0) {
|
||||||
HuWinExAnimOut(temp_r30);
|
HuWinExAnimOut(temp_r30);
|
||||||
HuWinExCleanup(temp_r30);
|
HuWinExCleanup(temp_r30);
|
||||||
}
|
}
|
||||||
if (temp_r31 == -3) {
|
if (temp_r31 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r31 < 0) {
|
if (temp_r31 < 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
_SetFlag(FLAG_ID_MAKE(3, 0));
|
_SetFlag(FLAG_ID_MAKE(3, 0));
|
||||||
temp_r31 = HuCardWrite(curFileInfo, arg2, arg1, 0);
|
temp_r31 = HuCardWrite(&curFileInfo, arg2, arg1, 0);
|
||||||
_ClearFlag(FLAG_ID_MAKE(3, 0));
|
_ClearFlag(FLAG_ID_MAKE(3, 0));
|
||||||
if (temp_r31 < 0) {
|
if (temp_r31 < 0) {
|
||||||
HuWinExAnimOut(temp_r30);
|
HuWinExAnimOut(temp_r30);
|
||||||
HuWinExCleanup(temp_r30);
|
HuWinExCleanup(temp_r30);
|
||||||
}
|
}
|
||||||
if (temp_r31 == -3) {
|
if (temp_r31 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r31 < 0) {
|
if (temp_r31 < 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
_SetFlag(FLAG_ID_MAKE(3, 0));
|
_SetFlag(FLAG_ID_MAKE(3, 0));
|
||||||
temp_r31 = SLStatSet(1);
|
temp_r31 = SLStatSet(1);
|
||||||
|
|
@ -195,7 +185,7 @@ s32 SLFileWrite(s32 arg0, void *arg1) {
|
||||||
HuWinMesWait(temp_r31);
|
HuWinMesWait(temp_r31);
|
||||||
HuPrcSleep(0x3C);
|
HuPrcSleep(0x3C);
|
||||||
_SetFlag(FLAG_ID_MAKE(3, 0));
|
_SetFlag(FLAG_ID_MAKE(3, 0));
|
||||||
var_r30 = HuCardWrite(curFileInfo, arg1, arg0, 0);
|
var_r30 = HuCardWrite(&curFileInfo, arg1, arg0, 0);
|
||||||
if (var_r30 == 0) {
|
if (var_r30 == 0) {
|
||||||
var_r30 = SLStatSet(1);
|
var_r30 = SLStatSet(1);
|
||||||
}
|
}
|
||||||
|
|
@ -211,8 +201,8 @@ s32 SLFileRead(s32 arg0, void *arg1) {
|
||||||
if (SaveEnableF == 0) {
|
if (SaveEnableF == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
temp_r3 = HuCardRead(curFileInfo, arg1, arg0, 0);
|
temp_r3 = HuCardRead(&curFileInfo, arg1, arg0, 0);
|
||||||
if (temp_r3 == -3) {
|
if (temp_r3 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
} else if (temp_r3 < 0) {
|
} else if (temp_r3 < 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
|
|
@ -226,7 +216,7 @@ s32 SLFileClose(void) {
|
||||||
if (SaveEnableF == 0) {
|
if (SaveEnableF == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
temp_r31 = HuCardClose(curFileInfo);
|
temp_r31 = HuCardClose(&curFileInfo);
|
||||||
return temp_r31;
|
return temp_r31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,7 +327,7 @@ s32 SLSave(void) {
|
||||||
while (1) {
|
while (1) {
|
||||||
SLCheckSumSet();
|
SLCheckSumSet();
|
||||||
var_r31 = SLFileOpen(SaveFileNameTbl[curBoxNo]);
|
var_r31 = SLFileOpen(SaveFileNameTbl[curBoxNo]);
|
||||||
if (var_r31 == -4) {
|
if (var_r31 == CARD_RESULT_NOFILE) {
|
||||||
if (!SLSerialNoCheck()) {
|
if (!SLSerialNoCheck()) {
|
||||||
SLMessOut(9);
|
SLMessOut(9);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -350,7 +340,7 @@ s32 SLSave(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (var_r31 == -3) {
|
if (var_r31 == CARD_RESULT_NOCARD) {
|
||||||
var_r31 = SLMessOut(0xA);
|
var_r31 = SLMessOut(0xA);
|
||||||
if (var_r31 != 0) {
|
if (var_r31 != 0) {
|
||||||
SLMessOut(0xB);
|
SLMessOut(0xB);
|
||||||
|
|
@ -366,11 +356,11 @@ s32 SLSave(void) {
|
||||||
SLCreateSaveWin();
|
SLCreateSaveWin();
|
||||||
var_r31 = SLFileWrite(0x4000, saveBuf);
|
var_r31 = SLFileWrite(0x4000, saveBuf);
|
||||||
SLKillSaveWin();
|
SLKillSaveWin();
|
||||||
if (var_r31 == -3) {
|
if (var_r31 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
} else if (var_r31 == -2) {
|
} else if (var_r31 == CARD_RESULT_WRONGDEVICE) {
|
||||||
SLMessOut(7);
|
SLMessOut(7);
|
||||||
} else if (var_r31 == -6) {
|
} else if (var_r31 == CARD_RESULT_BROKEN) {
|
||||||
var_r31 = HuCardSectorSizeGet(curSlotNo);
|
var_r31 = HuCardSectorSizeGet(curSlotNo);
|
||||||
if (var_r31 > 0 && var_r31 != 0x2000) {
|
if (var_r31 > 0 && var_r31 != 0x2000) {
|
||||||
SLMessOut(8);
|
SLMessOut(8);
|
||||||
|
|
@ -385,7 +375,7 @@ s32 SLSave(void) {
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
var_r31 = -6;
|
var_r31 = CARD_RESULT_BROKEN;
|
||||||
}
|
}
|
||||||
} else if (var_r31 < 0) {
|
} else if (var_r31 < 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
|
|
@ -541,7 +531,7 @@ s32 SLStatSet(s32 arg0) {
|
||||||
s32 temp_r29;
|
s32 temp_r29;
|
||||||
s32 temp_r3;
|
s32 temp_r3;
|
||||||
|
|
||||||
temp_r29 = curFileInfo[1];
|
temp_r29 = curFileInfo.fileNo;
|
||||||
temp_r3 = CARDGetStatus(curSlotNo, temp_r29, &sp8);
|
temp_r3 = CARDGetStatus(curSlotNo, temp_r29, &sp8);
|
||||||
if (temp_r3 == -3) {
|
if (temp_r3 == -3) {
|
||||||
if (arg0 != 0) {
|
if (arg0 != 0) {
|
||||||
|
|
@ -553,33 +543,34 @@ s32 SLStatSet(s32 arg0) {
|
||||||
if (arg0 != 0) {
|
if (arg0 != 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
}
|
}
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
sp8.commentAddr = 0;
|
sp8.commentAddr = 0;
|
||||||
sp8.iconAddr = 0x40;
|
sp8.iconAddr = 0x40;
|
||||||
sp8.bannerFormat = (sp8.bannerFormat & ~3) | 1;
|
CARDSetBannerFormat(&sp8, CARD_STAT_BANNER_C8);
|
||||||
sp8.iconFormat = (sp8.iconFormat & ~3) | 1;
|
CARDSetIconFormat(&sp8, 0, CARD_STAT_ICON_C8);
|
||||||
sp8.iconFormat = (sp8.iconFormat & ~0xC) | 4;
|
CARDSetIconFormat(&sp8, 1, CARD_STAT_ICON_C8);
|
||||||
sp8.iconFormat = (sp8.iconFormat & ~0x30) | 0x10;
|
CARDSetIconFormat(&sp8, 2, CARD_STAT_ICON_C8);
|
||||||
sp8.iconFormat = (sp8.iconFormat & ~0xC0) | 0x40;
|
CARDSetIconFormat(&sp8, 3, CARD_STAT_ICON_C8);
|
||||||
sp8.iconSpeed = (sp8.iconSpeed & ~3) | 2;
|
CARDSetIconSpeed(&sp8, 0, CARD_STAT_SPEED_MIDDLE);
|
||||||
sp8.iconSpeed = (sp8.iconSpeed & ~0xC) | 8;
|
CARDSetIconSpeed(&sp8, 1, CARD_STAT_SPEED_MIDDLE);
|
||||||
sp8.iconSpeed = (sp8.iconSpeed & ~0x30) | 0x20;
|
CARDSetIconSpeed(&sp8, 2, CARD_STAT_SPEED_MIDDLE);
|
||||||
sp8.iconSpeed = (sp8.iconSpeed & ~0xC0) | 0x80;
|
CARDSetIconSpeed(&sp8, 3, CARD_STAT_SPEED_MIDDLE);
|
||||||
sp8.iconSpeed = (sp8.iconSpeed & ~0x300);
|
CARDSetIconSpeed(&sp8, 4, CARD_STAT_SPEED_END);
|
||||||
sp8.bannerFormat = (sp8.bannerFormat & ~4);
|
CARDSetIconAnim(&sp8, CARD_STAT_ANIM_LOOP);
|
||||||
|
|
||||||
temp_r3 = CARDSetStatus(curSlotNo, temp_r29, &sp8);
|
temp_r3 = CARDSetStatus(curSlotNo, temp_r29, &sp8);
|
||||||
if (temp_r3 == -3) {
|
if (temp_r3 == CARD_RESULT_NOCARD) {
|
||||||
if (arg0 != 0) {
|
if (arg0 != 0) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
}
|
}
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r3 < 0) {
|
if (temp_r3 < 0) {
|
||||||
if (arg0 != 0) {
|
if (arg0 != 0) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
}
|
}
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
return temp_r3;
|
return temp_r3;
|
||||||
}
|
}
|
||||||
|
|
@ -589,23 +580,23 @@ s32 SLCardMount(s16 arg0) {
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
temp_r3 = HuCardMount(curSlotNo);
|
temp_r3 = HuCardMount(curSlotNo);
|
||||||
if (temp_r3 == -2) {
|
if (temp_r3 == CARD_RESULT_WRONGDEVICE) {
|
||||||
SLMessOut(7);
|
SLMessOut(7);
|
||||||
return temp_r3;
|
return temp_r3;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -128) {
|
if (temp_r3 == CARD_RESULT_FATAL_ERROR) {
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -3) {
|
if (temp_r3 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r3 == -6) {
|
if (temp_r3 == CARD_RESULT_BROKEN) {
|
||||||
temp_r3 = HuCardSectorSizeGet(curSlotNo);
|
temp_r3 = HuCardSectorSizeGet(curSlotNo);
|
||||||
if (temp_r3 > 0 && temp_r3 != 0x2000) {
|
if (temp_r3 > 0 && temp_r3 != 0x2000) {
|
||||||
SLMessOut(8);
|
SLMessOut(8);
|
||||||
return -2;
|
return CARD_RESULT_WRONGDEVICE;
|
||||||
}
|
}
|
||||||
UnMountCnt = 0;
|
UnMountCnt = 0;
|
||||||
temp_r3 = SLMessOut(5);
|
temp_r3 = SLMessOut(5);
|
||||||
|
|
@ -615,7 +606,7 @@ s32 SLCardMount(s16 arg0) {
|
||||||
return temp_r3;
|
return temp_r3;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
|
|
@ -628,7 +619,7 @@ s32 SLCardMount(s16 arg0) {
|
||||||
}
|
}
|
||||||
if (temp_r3 != 0x2000) {
|
if (temp_r3 != 0x2000) {
|
||||||
SLMessOut(8);
|
SLMessOut(8);
|
||||||
return -2;
|
return CARD_RESULT_WRONGDEVICE;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -642,15 +633,15 @@ s32 SLFormat(s16 arg0) {
|
||||||
|
|
||||||
HuWinInit(1);
|
HuWinInit(1);
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
HuWinMesMaxSizeGet(1, sp8, 0x100038);
|
HuWinMesMaxSizeGet(1, sp8, MAKE_MESSID(16, 56));
|
||||||
temp_r3 = HuWinExCreateStyled(-10000.0f, 150.0f, sp8[0], sp8[1], -1, 2);
|
temp_r3 = HuWinExCreateStyled(-10000.0f, 150.0f, sp8[0], sp8[1], -1, 2);
|
||||||
HuWinExAnimIn(temp_r3);
|
HuWinExAnimIn(temp_r3);
|
||||||
HuWinInsertMesSet(temp_r3, MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSet(temp_r3, MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
HuWinMesSet(temp_r3, 0x100038);
|
HuWinMesSet(temp_r3, MAKE_MESSID(16, 56));
|
||||||
HuWinMesMaxSizeGet(1, sp8, 0x10000B);
|
HuWinMesMaxSizeGet(1, sp8, MAKE_MESSID(16, 11));
|
||||||
temp_r3_2 = HuWinExCreateStyled(-10000.0f, 200.0f, sp8[0], sp8[1], -1, 2);
|
temp_r3_2 = HuWinExCreateStyled(-10000.0f, 200.0f, sp8[0], sp8[1], -1, 2);
|
||||||
HuWinExAnimIn(temp_r3_2);
|
HuWinExAnimIn(temp_r3_2);
|
||||||
HuWinMesSet(temp_r3_2, 0x10000B);
|
HuWinMesSet(temp_r3_2, MAKE_MESSID(16, 11));
|
||||||
HuWinMesWait(temp_r3_2);
|
HuWinMesWait(temp_r3_2);
|
||||||
HuPrcSleep(0x1E);
|
HuPrcSleep(0x1E);
|
||||||
if (UnMountCnt & (1 << curSlotNo)) {
|
if (UnMountCnt & (1 << curSlotNo)) {
|
||||||
|
|
@ -670,16 +661,16 @@ s32 SLFormat(s16 arg0) {
|
||||||
HuWinExAnimOut(temp_r3_2);
|
HuWinExAnimOut(temp_r3_2);
|
||||||
HuWinExCleanup(temp_r3_2);
|
HuWinExCleanup(temp_r3_2);
|
||||||
}
|
}
|
||||||
if (temp_r24 == -128) {
|
if (temp_r24 == CARD_RESULT_FATAL_ERROR) {
|
||||||
SLMessOut(6);
|
SLMessOut(6);
|
||||||
SLMessOut(1);
|
SLMessOut(1);
|
||||||
return -0x80;
|
return CARD_RESULT_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
if (temp_r24 == -3) {
|
if (temp_r24 == CARD_RESULT_NOCARD) {
|
||||||
SLMessOut(0);
|
SLMessOut(0);
|
||||||
return -3;
|
return CARD_RESULT_NOCARD;
|
||||||
}
|
}
|
||||||
if (temp_r24 == -2) {
|
if (temp_r24 == CARD_RESULT_WRONGDEVICE) {
|
||||||
SLMessOut(7);
|
SLMessOut(7);
|
||||||
return temp_r24;
|
return temp_r24;
|
||||||
}
|
}
|
||||||
|
|
@ -708,74 +699,70 @@ s16 SLMessOut(s16 arg0) {
|
||||||
var_r29 = 0;
|
var_r29 = 0;
|
||||||
var_r27 = 0;
|
var_r27 = 0;
|
||||||
HuWinInit(1);
|
HuWinInit(1);
|
||||||
if (saveMessWin != -1) {
|
SLKillSaveWin();
|
||||||
HuWinExAnimOut(saveMessWin);
|
|
||||||
HuWinExCleanup(saveMessWin);
|
|
||||||
saveMessWin = -1;
|
|
||||||
}
|
|
||||||
switch (arg0) {
|
switch (arg0) {
|
||||||
case 0:
|
case 0:
|
||||||
var_r31 = 0x100002;
|
var_r31 = MAKE_MESSID(16, 2);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var_r31 = 0x100053;
|
var_r31 = MAKE_MESSID(16, 83);
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x10004A;
|
var_r31 = MAKE_MESSID(16, 74);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
var_r31 = 0x10004A;
|
var_r31 = MAKE_MESSID(16, 74);
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
var_r31 = 0x10004A;
|
var_r31 = MAKE_MESSID(16, 74);
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x100004;
|
var_r31 = MAKE_MESSID(16, 4);
|
||||||
var_r27 = 1;
|
var_r27 = 1;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
var_r31 = 0x100036;
|
var_r31 = MAKE_MESSID(16, 54);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x100037;
|
var_r31 = MAKE_MESSID(16, 55);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x100039;
|
var_r31 = MAKE_MESSID(16, 57);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x100045;
|
var_r31 = MAKE_MESSID(16, 69);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
var_r31 = 0x100046;
|
var_r31 = MAKE_MESSID(16, 70);
|
||||||
var_r27 = 1;
|
var_r27 = 1;
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
HuWinInsertMesSizeGet(MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]), 0);
|
||||||
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
var_r29 = MAKE_MESSID_PTR(SlotNameTbl[curSlotNo]);
|
||||||
var_r31 = 0x100048;
|
var_r31 = MAKE_MESSID(16, 72);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
var_r31 = 0x100050;
|
var_r31 = MAKE_MESSID(16, 80);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (var_r31 == 0x100004) {
|
if (var_r31 == MAKE_MESSID(16, 4)) {
|
||||||
HuWinMesMaxSizeGet(1, sp8, 0x10004E);
|
HuWinMesMaxSizeGet(1, sp8, MAKE_MESSID(16, 78));
|
||||||
} else {
|
} else {
|
||||||
HuWinMesMaxSizeGet(1, sp8, var_r31);
|
HuWinMesMaxSizeGet(1, sp8, var_r31);
|
||||||
}
|
}
|
||||||
|
|
@ -792,7 +779,7 @@ s16 SLMessOut(s16 arg0) {
|
||||||
if (var_r27 != 0) {
|
if (var_r27 != 0) {
|
||||||
var_r28 = HuWinChoiceGet(temp_r3, 1);
|
var_r28 = HuWinChoiceGet(temp_r3, 1);
|
||||||
if (arg0 == 5 && var_r28 == 0) {
|
if (arg0 == 5 && var_r28 == 0) {
|
||||||
HuWinMesSet(temp_r3, 0x10004E);
|
HuWinMesSet(temp_r3, MAKE_MESSID(16, 78));
|
||||||
HuWinMesWait(temp_r3);
|
HuWinMesWait(temp_r3);
|
||||||
var_r28 = HuWinChoiceGet(temp_r3, 1);
|
var_r28 = HuWinChoiceGet(temp_r3, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue