summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/progs/quake/common.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2019-07-20 20:40:51 -0400
committerFranklin Wei <git@fwei.tk>2019-07-21 15:13:35 -0400
commitef9ee8935f3ec95a636272cf6c19f55573f5ee6d (patch)
tree6e60715ec8a909004a87afc0839efaa22d27f50a /apps/plugins/sdl/progs/quake/common.h
parent2ca47176f9fffade0569a0c18f75536cd020a19c (diff)
downloadrockbox-ef9ee8935f3ec95a636272cf6c19f55573f5ee6d.tar.gz
rockbox-ef9ee8935f3ec95a636272cf6c19f55573f5ee6d.zip
quake: fix unaligned accesses in model.c
Allows playing registered episodes. Change-Id: I20e1ca2000776a19767a9c3caef790d4f62ca188
Diffstat (limited to 'apps/plugins/sdl/progs/quake/common.h')
-rw-r--r--apps/plugins/sdl/progs/quake/common.h29
1 files changed, 23 insertions, 6 deletions
diff --git a/apps/plugins/sdl/progs/quake/common.h b/apps/plugins/sdl/progs/quake/common.h
index a1ac227aff..8c6ab3a2dc 100644
--- a/apps/plugins/sdl/progs/quake/common.h
+++ b/apps/plugins/sdl/progs/quake/common.h
@@ -88,12 +88,29 @@ void InsertLinkAfter (link_t *l, link_t *after);
88 88
89extern qboolean bigendien; 89extern qboolean bigendien;
90 90
91extern short (*BigShort) (short l); 91// not safe on unaligned data
92extern short (*LittleShort) (short l); 92extern short (*BigShort) (short l);
93extern int (*BigLong) (int l); 93extern short (*LittleShort) (short l);
94extern int (*LittleLong) (int l); 94extern int (*BigLong) (int l);
95extern float (*BigFloat) (float l); 95extern int (*LittleLong) (int l);
96extern float (*LittleFloat) (float l); 96extern float (*BigFloat) (float l);
97extern float (*LittleFloat) (float l);
98
99#define LittleShortUnaligned(x) ReadLittleShort(((char*)(&(x))))
100#define BigShortUnaligned(x) ReadBigShort(((char*)&(x)))
101#define LittleLongUnaligned(x) ReadLittleLong(((char*)&(x)))
102#define BigLongUnaligned(x) ReadBigLong(((char*)&(x)))
103#define LittleFloatUnaligned(x) ReadLittleFloat(((char*)&(x)))
104#define BigFloatUnaligned(x) ReadBigFloat(((char*)&(x))
105
106
107// for unaligned
108short ReadBigShort (char *l);
109short ReadLittleShort (char *l);
110int ReadBigLong (char *l);
111int ReadLittleLong (char *l);
112float ReadBigFloat (char *l);
113float ReadLittleFloat (char *l);
97 114
98//============================================================================ 115//============================================================================
99 116