mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Add alignment macros for asset definition that make use of parameter values
This commit is contained in:
parent
5f3aa2a460
commit
3c9a9c038d
@ -3,24 +3,7 @@
|
|||||||
#ifndef __IW4_ASSETS_H
|
#ifndef __IW4_ASSETS_H
|
||||||
#define __IW4_ASSETS_H
|
#define __IW4_ASSETS_H
|
||||||
|
|
||||||
#ifdef type_align
|
#include "../../Utils/TypeAlignment.h"
|
||||||
#undef type_align
|
|
||||||
#endif
|
|
||||||
#ifdef tdef_align
|
|
||||||
#undef tdef_align
|
|
||||||
#endif
|
|
||||||
#ifdef __zonecodegenerator
|
|
||||||
#define type_align alignas
|
|
||||||
#define tdef_align alignas
|
|
||||||
#else
|
|
||||||
#ifdef _MSVC_LANG
|
|
||||||
#define type_align(x) __declspec(align(x))
|
|
||||||
#define tdef_align(x) __declspec(align(x))
|
|
||||||
#else
|
|
||||||
#define type_align(x) __attribute__((__aligned__(x)))
|
|
||||||
#define tdef_align(x) /*__attribute__((__aligned__(x)))*/
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __zonecodegenerator
|
#ifndef __zonecodegenerator
|
||||||
namespace IW4
|
namespace IW4
|
||||||
|
@ -3,24 +3,7 @@
|
|||||||
#ifndef __T6_ASSETS_H
|
#ifndef __T6_ASSETS_H
|
||||||
#define __T6_ASSETS_H
|
#define __T6_ASSETS_H
|
||||||
|
|
||||||
#ifdef type_align
|
#include "../../Utils/TypeAlignment.h"
|
||||||
#undef type_align
|
|
||||||
#endif
|
|
||||||
#ifdef tdef_align
|
|
||||||
#undef tdef_align
|
|
||||||
#endif
|
|
||||||
#ifdef __zonecodegenerator
|
|
||||||
#define type_align alignas
|
|
||||||
#define tdef_align alignas
|
|
||||||
#else
|
|
||||||
#ifdef _MSVC_LANG
|
|
||||||
#define type_align(x) __declspec(align(x))
|
|
||||||
#define tdef_align(x) __declspec(align(x))
|
|
||||||
#else
|
|
||||||
#define type_align(x) __attribute__((__aligned__(x)))
|
|
||||||
#define tdef_align(x) /*__attribute__((__aligned__(x)))*/
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef __zonecodegenerator
|
#ifndef __zonecodegenerator
|
||||||
namespace T6
|
namespace T6
|
||||||
@ -790,7 +773,6 @@ namespace T6
|
|||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct SndAssetBankHeader
|
struct SndAssetBankHeader
|
||||||
{
|
{
|
||||||
unsigned int magic;
|
unsigned int magic;
|
||||||
@ -801,9 +783,9 @@ namespace T6
|
|||||||
unsigned int entryCount;
|
unsigned int entryCount;
|
||||||
unsigned int dependencyCount;
|
unsigned int dependencyCount;
|
||||||
unsigned int pad32;
|
unsigned int pad32;
|
||||||
int64_t fileSize;
|
gcc_align(8) int64_t fileSize;
|
||||||
int64_t entryOffset;
|
gcc_align(8) int64_t entryOffset;
|
||||||
int64_t checksumOffset;
|
gcc_align(8) int64_t checksumOffset;
|
||||||
char checksumChecksum[16];
|
char checksumChecksum[16];
|
||||||
char dependencies[512];
|
char dependencies[512];
|
||||||
char padding[1464];
|
char padding[1464];
|
||||||
|
31
src/Common/Utils/TypeAlignment.h
Normal file
31
src/Common/Utils/TypeAlignment.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Undefine any previously defined utilities
|
||||||
|
#ifdef type_align
|
||||||
|
#undef type_align
|
||||||
|
#endif
|
||||||
|
#ifdef tdef_align
|
||||||
|
#undef tdef_align
|
||||||
|
#endif
|
||||||
|
#ifdef memb_align
|
||||||
|
#undef memb_align
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __zonecodegenerator
|
||||||
|
#define type_align(x) alignas(x)
|
||||||
|
#define tdef_align(x) alignas(x)
|
||||||
|
#define memb_align(x) alignas(x)
|
||||||
|
#define gcc_align(x)
|
||||||
|
#else
|
||||||
|
#ifdef _MSVC_LANG
|
||||||
|
#define type_align(x) __declspec(align(x))
|
||||||
|
#define tdef_align(x) __declspec(align(x))
|
||||||
|
#define memb_align(x) __declspec(align(x))
|
||||||
|
#define gcc_align(x)
|
||||||
|
#else
|
||||||
|
#define type_align(x) __attribute__((__aligned__(x)))
|
||||||
|
#define tdef_align(x) __attribute__((__aligned__(x)))
|
||||||
|
#define memb_align(x) __attribute__((__aligned__(x)))
|
||||||
|
#define gcc_align(x) __attribute__((__aligned__(x)))
|
||||||
|
#endif
|
||||||
|
#endif
|
Loading…
x
Reference in New Issue
Block a user