diff --git a/desmume/src/fat.h b/desmume/src/fat.h index d34455c63..65696d375 100644 --- a/desmume/src/fat.h +++ b/desmume/src/fat.h @@ -15,6 +15,61 @@ #define FILE_FREE 0xE5 // Boot Sector - must be packed +#ifdef _MSC_VER +#pragma pack(push, 1) +typedef struct +{ + u8 jmpBoot[3]; + u8 OEMName[8]; + // BIOS Parameter Block + u16 bytesPerSector; + u8 sectorsPerCluster; + u16 reservedSectors; + u8 numFATs; + u16 rootEntries; + u16 numSectorsSmall; + u8 mediaDesc; + u16 sectorsPerFAT; + u16 sectorsPerTrk; + u16 numHeads; + u32 numHiddenSectors; + u32 numSectors; + struct + { + // Ext BIOS Parameter Block for FAT16 + u8 driveNumber; + u8 reserved1; + u8 extBootSig; + u32 volumeID; + u8 volumeLabel[11]; + u8 fileSysType[8]; + // Bootcode + u8 bootCode[448]; + u16 signature; + } fat16; +} BOOT_RECORD; +#pragma pack(pop) + +// Directory entry - must be packed +#pragma pack(push, 1) +typedef struct +{ + u8 name[8]; + u8 ext[3]; + u8 attrib; + u8 reserved; + u8 cTime_ms; + u16 cTime; + u16 cDate; + u16 aDate; + u16 startClusterHigh; + u16 mTime; + u16 mDate; + u16 startCluster; + u32 fileSize; +} DIR_ENT; +#pragma pack(pop) +#else typedef struct { u8 jmpBoot[3] __PACKED; @@ -47,7 +102,6 @@ typedef struct } fat16; } BOOT_RECORD; - // Directory entry - must be packed typedef struct { @@ -65,5 +119,6 @@ typedef struct u16 startCluster __PACKED; u32 fileSize __PACKED; } DIR_ENT; +#endif #endif