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

View File

@ -23,9 +23,9 @@ typedef unsigned short u16;
typedef unsigned int u32; 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) u16 __inline bswap16(u16 s)
{ {