aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/asm/q3asm.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/tools/asm/q3asm.c')
-rw-r--r--code/tools/asm/q3asm.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/code/tools/asm/q3asm.c b/code/tools/asm/q3asm.c
index 93af582..8926699 100644
--- a/code/tools/asm/q3asm.c
+++ b/code/tools/asm/q3asm.c
@@ -20,6 +20,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
+#include "../../qcommon/q_platform.h"
#include "cmdlib.h"
#include "mathlib.h"
#include "../../qcommon/qfiles.h"
@@ -1356,6 +1357,7 @@ void WriteVmFile( void ) {
vmHeader_t header;
FILE *f;
int headerSize;
+ int i;
report( "%i total errors\n", errorCount );
@@ -1400,6 +1402,13 @@ void WriteVmFile( void ) {
report( "Writing to %s\n", imageName );
+#ifdef Q3_BIG_ENDIAN
+ // byte swap the header
+ for ( i = 0 ; i < sizeof( vmHeader_t ) / 4 ; i++ ) {
+ ((int *)&header)[i] = LittleLong( ((int *)&header)[i] );
+ }
+#endif
+
CreatePath( imageName );
f = SafeOpenWrite( imageName );
SafeWrite( f, &header, headerSize );