summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-04-02 15:21:20 +0200
committerGravatar Martin Szulecki2009-04-02 15:21:20 +0200
commit65e58e271e9ff9590c1eb3814a9e449e3c9d607a (patch)
tree2b1db89affda5faa523291a18a376a46b14899c3
parent9c1ded3b0ae8e540177ee0c0baa1f9c8fcf91989 (diff)
downloadwiiwadtools-65e58e271e9ff9590c1eb3814a9e449e3c9d607a.tar.gz
wiiwadtools-65e58e271e9ff9590c1eb3814a9e449e3c9d607a.tar.bz2
Use packed attribute for structs
-rw-r--r--types.h7
-rw-r--r--wii_imet.h4
-rw-r--r--wii_tik.h2
-rw-r--r--wii_tmd.h2
-rw-r--r--wii_wad.h2
5 files changed, 12 insertions, 5 deletions
diff --git a/types.h b/types.h
index d14f887..d07adad 100644
--- a/types.h
+++ b/types.h
@@ -5,6 +5,13 @@
#ifndef __WII_TYPES_H__
#define __WII_TYPES_H__
+#ifndef ATTRIBUTE_ALIGN
+# define ATTRIBUTE_ALIGN(v) __attribute__((aligned(v)))
+#endif
+#ifndef ATTRIBUTE_PACKED
+# define ATTRIBUTE_PACKED __attribute__((packed))
+#endif
+
enum sig_type {
RSA_4096 = 0x00010000,
RSA_2048 = 0x00010001
diff --git a/wii_imet.h b/wii_imet.h
index ba2d76a..0dfb5c3 100644
--- a/wii_imet.h
+++ b/wii_imet.h
@@ -31,7 +31,7 @@ typedef struct {
u32 ukn_size3;
u32 ukn_flags;
u16 name[IMET_NAME_COUNT][IMET_NAME_SIZE];
-} wii_imet;
+} ATTRIBUTE_PACKED wii_imet;
typedef struct {
char dirname[0x20];
@@ -39,6 +39,6 @@ typedef struct {
u16 unk_flag0;
u16 unk_flag1;
char host[0x10];
-} wii_build_info;
+} ATTRIBUTE_PACKED wii_build_info;
#endif
diff --git a/wii_tik.h b/wii_tik.h
index 962a256..729a8c2 100644
--- a/wii_tik.h
+++ b/wii_tik.h
@@ -35,7 +35,7 @@ typedef struct {
u32 has_time_limit;
u32 time_limit_sec; /* Seconds */
u8 unk8[0x58];
-} wii_tik;
+} ATTRIBUTE_PACKED wii_tik;
void tik_read(FILE *f, wii_tik *tik);
void print_tik(wii_tik *tik);
diff --git a/wii_tmd.h b/wii_tmd.h
index 4bd77af..498b96d 100644
--- a/wii_tmd.h
+++ b/wii_tmd.h
@@ -46,7 +46,7 @@ typedef struct {
u16 num_contents;
u16 boot_index;
u16 fill6;
-} tmd_header;
+} ATTRIBUTE_PACKED tmd_header;
void dump_tmd_raw(u8 *tmd);
void print_tmd(tmd_header *tmd);
diff --git a/wii_wad.h b/wii_wad.h
index 3407219..0985f7a 100644
--- a/wii_wad.h
+++ b/wii_wad.h
@@ -30,7 +30,7 @@ typedef struct {
u32 tmd_size;
u32 data_size;
u32 footer_size;
-} wad_header;
+} ATTRIBUTE_PACKED wad_header;
void print_wad(wad_header *wad);