An attempt to fix my coding style to match wiki page

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@858 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
LPFaint99 2008-10-14 05:19:31 +00:00
parent d84fa6195c
commit 6b4169e5b1
3 changed files with 74 additions and 70 deletions

View File

@ -639,7 +639,8 @@ u32 GCMemcard::ImportGci(const char *fileName, int endFile, const char *fileNam
offset = GCS;
else
{
//TODO error message, file has gsc extension but does not have a correct header
// TODO: Add error message
// file has gsc extension but does not have a correct header
return 0;
}
}
@ -650,13 +651,14 @@ u32 GCMemcard::ImportGci(const char *fileName, int endFile, const char *fileNam
offset = SAV;
else
{
//TODO error message, file has sav extension but does not have a correct header
// TODO: Add error message
//file has sav extension but does not have a correct header
return 0;
}
}
else
{
//TODO error message, file has invalid extension
// TODO: Add error message, file has invalid extension
return 0;
}
}
@ -668,13 +670,14 @@ u32 GCMemcard::ImportGci(const char *fileName, int endFile, const char *fileNam
switch(offset){
case GCS:
//field containing the Block count as displayed within the GameSaves software
//is not stored in the GCS file.
// field containing the Block count as displayed within
// the GameSaves software is not stored in the GCS file.
// It is stored only within the corresponding GSV file.
// If the GCS file is added without using the GameSaves software,
// the value stored is always "1"
tmpU16 = (((int)gci.Length() - offset - 0x40) / 0x2000);
if(tmpU16<0x100){
if (tmpU16<0x100)
{
d->BlockCount[1] = (u8)tmpU16;
}
else{
@ -684,23 +687,24 @@ u32 GCMemcard::ImportGci(const char *fileName, int endFile, const char *fileNam
break;
case SAV:
// swap byte pairs
//0x2C and 0x2D,0x2E and 0x2F,0x30 and 0x31,0x32 and 0x33,0x34 and 0x35,
//0x36 and 0x37,0x38 and 0x39,0x3A and 0x3B,0x3C and 0x3D,0x3E and 0x3F.
SWAP((d->ImageOffset));
SWAP(&(d->ImageOffset[2]));
SWAP((d->IconFmt));
SWAP((d->AnimSpeed));
varSwap(&d->Permissions,&d->CopyCounter);
SWAP((d->FirstBlock));
SWAP((d->BlockCount));
SWAP((d->Unused2));
SWAP((d->CommentsAddr));
SWAP(&(d->CommentsAddr[2]));
// 0x2C and 0x2D, 0x2E and 0x2F, 0x30 and 0x31, 0x32 and 0x33,
// 0x34 and 0x35, 0x36 and 0x37, 0x38 and 0x39, 0x3A and 0x3B,
// 0x3C and 0x3D,0x3E and 0x3F.
ArrayByteSwap((d->ImageOffset));
ArrayByteSwap(&(d->ImageOffset[2]));
ArrayByteSwap((d->IconFmt));
ArrayByteSwap((d->AnimSpeed));
ByteSwap(&d->Permissions, &d->CopyCounter);
ArrayByteSwap((d->FirstBlock));
ArrayByteSwap((d->BlockCount));
ArrayByteSwap((d->Unused2));
ArrayByteSwap((d->CommentsAddr));
ArrayByteSwap(&(d->CommentsAddr[2]));
break;
default:
break;
}
//TODO verify file length
// TODO: verify file length
assert(((int)gci.Length() - offset) == ((BE16(d->BlockCount) * 0x2000) + 0x40));

View File

@ -23,9 +23,9 @@ typedef unsigned short u16;
typedef unsigned int u32;
#define SWAP(a) (varSwap(a,a+sizeof(u8)));
#define ArrayByteSwap(a) (ByteSwap(a, a+sizeof(u8)));
void varSwap(u8 *valueA,u8 *valueB);
void ByteSwap(u8 *valueA, u8 *valueB);
u16 __inline bswap16(u16 s)
{