diff options
author | Franklin Wei <git@fwei.tk> | 2019-07-20 20:40:51 -0400 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2019-07-21 15:13:35 -0400 |
commit | ef9ee8935f3ec95a636272cf6c19f55573f5ee6d (patch) | |
tree | 6e60715ec8a909004a87afc0839efaa22d27f50a /apps/plugins/sdl/progs/quake/common.h | |
parent | 2ca47176f9fffade0569a0c18f75536cd020a19c (diff) | |
download | rockbox-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.h | 29 |
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 | ||
89 | extern qboolean bigendien; | 89 | extern qboolean bigendien; |
90 | 90 | ||
91 | extern short (*BigShort) (short l); | 91 | // not safe on unaligned data |
92 | extern short (*LittleShort) (short l); | 92 | extern short (*BigShort) (short l); |
93 | extern int (*BigLong) (int l); | 93 | extern short (*LittleShort) (short l); |
94 | extern int (*LittleLong) (int l); | 94 | extern int (*BigLong) (int l); |
95 | extern float (*BigFloat) (float l); | 95 | extern int (*LittleLong) (int l); |
96 | extern float (*LittleFloat) (float l); | 96 | extern float (*BigFloat) (float l); |
97 | extern 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 | ||
108 | short ReadBigShort (char *l); | ||
109 | short ReadLittleShort (char *l); | ||
110 | int ReadBigLong (char *l); | ||
111 | int ReadLittleLong (char *l); | ||
112 | float ReadBigFloat (char *l); | ||
113 | float ReadLittleFloat (char *l); | ||
97 | 114 | ||
98 | //============================================================================ | 115 | //============================================================================ |
99 | 116 | ||