mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Compilation fixes for ARM
This commit is contained in:
parent
e54f4a65f9
commit
d3870ccf45
8 changed files with 47 additions and 22 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,6 @@
|
||||||
build
|
build
|
||||||
|
mohaa-re
|
||||||
|
out
|
||||||
Makefile.local
|
Makefile.local
|
||||||
*.swp
|
*.swp
|
||||||
*tags
|
*tags
|
||||||
|
|
|
@ -29,9 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
#include "cl_ui.h"
|
#include "cl_ui.h"
|
||||||
|
|
||||||
#if _MSC_VER
|
#include <ctime>
|
||||||
#include <intrin.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float fadetime;
|
float fadetime;
|
||||||
|
@ -5443,7 +5441,7 @@ UI_BeginLoadResource
|
||||||
====================
|
====================
|
||||||
*/
|
*/
|
||||||
void UI_BeginLoadResource( void ) {
|
void UI_BeginLoadResource( void ) {
|
||||||
uint64_t time = __rdtsc();
|
clock_t time = clock();
|
||||||
|
|
||||||
startCountHigh = time >> 32;
|
startCountHigh = time >> 32;
|
||||||
startCountLow = time;
|
startCountLow = time;
|
||||||
|
|
|
@ -114,7 +114,7 @@ void Z_Free( void *ptr )
|
||||||
block->prev = block;
|
block->prev = block;
|
||||||
block->next = block;
|
block->next = block;
|
||||||
|
|
||||||
#if !defined(_DEBUG) && !defined(WIN32)
|
#if !defined(_DEBUG) || !defined(WIN32)
|
||||||
// free the block
|
// free the block
|
||||||
free( block );
|
free( block );
|
||||||
#else
|
#else
|
||||||
|
@ -172,7 +172,7 @@ void *Z_TagMalloc( size_t size, int tag )
|
||||||
#endif
|
#endif
|
||||||
size = PAD( size, sizeof( intptr_t ) ); // align to 32/64 bit boundary
|
size = PAD( size, sizeof( intptr_t ) ); // align to 32/64 bit boundary
|
||||||
|
|
||||||
#if !defined(_DEBUG) && !defined(WIN32)
|
#if !defined(_DEBUG) || !defined(WIN32)
|
||||||
block = ( memblock_t * )malloc( size );
|
block = ( memblock_t * )malloc( size );
|
||||||
#else
|
#else
|
||||||
block = HeapAlloc(GetProcessHeap(), 0, size);
|
block = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
|
|
@ -346,6 +346,8 @@ short ShortSwapPtr(const void* l);
|
||||||
int LongSwapPtr(const void* l);
|
int LongSwapPtr(const void* l);
|
||||||
short ShortNoSwapPtr(const void* l);
|
short ShortNoSwapPtr(const void* l);
|
||||||
int LongNoSwapPtr(const void* l);
|
int LongNoSwapPtr(const void* l);
|
||||||
|
float FloatSwapPtr(const void* l);
|
||||||
|
float FloatNoSwapPtr(const void* l);
|
||||||
|
|
||||||
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
|
#if defined( Q3_BIG_ENDIAN ) && defined( Q3_LITTLE_ENDIAN )
|
||||||
#error "Endianness defined as both big and little"
|
#error "Endianness defined as both big and little"
|
||||||
|
@ -354,11 +356,16 @@ int LongNoSwapPtr(const void* l);
|
||||||
#define CopyLittleShort(dest, src) CopyShortSwap(dest, src)
|
#define CopyLittleShort(dest, src) CopyShortSwap(dest, src)
|
||||||
#define CopyLittleLong(dest, src) CopyLongSwap(dest, src)
|
#define CopyLittleLong(dest, src) CopyLongSwap(dest, src)
|
||||||
|
|
||||||
|
//
|
||||||
|
// Those Little*Ptr are used to avoid alignment problems
|
||||||
|
//
|
||||||
|
|
||||||
#define LittleShort(x) ShortSwap(x)
|
#define LittleShort(x) ShortSwap(x)
|
||||||
#define LittleLong(x) LongSwap(x)
|
#define LittleLong(x) LongSwap(x)
|
||||||
#define LittleFloat(x) FloatSwap(&x)
|
#define LittleFloat(x) FloatSwap(&x)
|
||||||
#define LittleShortPtr(x) ShortSwapPtr(&x)
|
#define LittleShortPtr(x) ShortSwapPtr(&x)
|
||||||
#define LittleLongPtr(x) LongSwapPtr(&x)
|
#define LittleLongPtr(x) LongSwapPtr(&x)
|
||||||
|
#define LittleFloatPtr(x) FloatSwapPtr(&x)
|
||||||
|
|
||||||
#define BigShort
|
#define BigShort
|
||||||
#define BigLong
|
#define BigLong
|
||||||
|
@ -376,6 +383,7 @@ int LongNoSwapPtr(const void* l);
|
||||||
#define LittleFloat
|
#define LittleFloat
|
||||||
#define LittleShortPtr(x) ShortNoSwapPtr(&x)
|
#define LittleShortPtr(x) ShortNoSwapPtr(&x)
|
||||||
#define LittleLongPtr(x) LongNoSwapPtr(&x)
|
#define LittleLongPtr(x) LongNoSwapPtr(&x)
|
||||||
|
#define LittleFloatPtr(x) FloatNoSwapPtr(&x)
|
||||||
|
|
||||||
#define BigShort(x) ShortSwap(x)
|
#define BigShort(x) ShortSwap(x)
|
||||||
#define BigLong(x) LongSwap(x)
|
#define BigLong(x) LongSwap(x)
|
||||||
|
|
|
@ -1552,6 +1552,20 @@ int LongNoSwapPtr(const void* l)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float FloatSwapPtr(const void* l)
|
||||||
|
{
|
||||||
|
float out;
|
||||||
|
CopyLittleLong((int*)&out, l);
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
float FloatNoSwapPtr(const void* l)
|
||||||
|
{
|
||||||
|
float out;
|
||||||
|
Com_Memcpy(&out, l, sizeof(float));
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
void Swap_Init(void)
|
void Swap_Init(void)
|
||||||
{
|
{
|
||||||
// Endianness is now computed at compile time
|
// Endianness is now computed at compile time
|
||||||
|
|
|
@ -371,11 +371,11 @@ void TIKI_CacheFileSkel( skelHeader_t *pHeader, skelcache_t *cache, int length )
|
||||||
iOffset += sizeof(skelWeight_t) * numWeights;
|
iOffset += sizeof(skelWeight_t) * numWeights;
|
||||||
iOffset += sizeof(skeletorVertex_t);
|
iOffset += sizeof(skeletorVertex_t);
|
||||||
|
|
||||||
skelVert->normal[0] = LittleFloat(pVert->normal[0]);
|
skelVert->normal[0] = LittleFloatPtr(pVert->normal[0]);
|
||||||
skelVert->normal[1] = LittleFloat(pVert->normal[1]);
|
skelVert->normal[1] = LittleFloatPtr(pVert->normal[1]);
|
||||||
skelVert->normal[2] = LittleFloat(pVert->normal[2]);
|
skelVert->normal[2] = LittleFloatPtr(pVert->normal[2]);
|
||||||
skelVert->texCoords[0] = LittleFloat(pVert->texCoords[0]);
|
skelVert->texCoords[0] = LittleFloatPtr(pVert->texCoords[0]);
|
||||||
skelVert->texCoords[1] = LittleFloat(pVert->texCoords[1]);
|
skelVert->texCoords[1] = LittleFloatPtr(pVert->texCoords[1]);
|
||||||
skelVert->numWeights = numWeights;
|
skelVert->numWeights = numWeights;
|
||||||
skelVert->numMorphs = numMorphs;
|
skelVert->numMorphs = numMorphs;
|
||||||
|
|
||||||
|
@ -385,20 +385,20 @@ void TIKI_CacheFileSkel( skelHeader_t *pHeader, skelcache_t *cache, int length )
|
||||||
for (k = 0; k < pVert->numMorphs; k++, pMorph++, skelMorph++)
|
for (k = 0; k < pVert->numMorphs; k++, pMorph++, skelMorph++)
|
||||||
{
|
{
|
||||||
skelMorph->morphIndex = pMorph->morphIndex;
|
skelMorph->morphIndex = pMorph->morphIndex;
|
||||||
skelMorph->offset[0] = LittleFloat(pMorph->offset[0]);
|
skelMorph->offset[0] = LittleFloatPtr(pMorph->offset[0]);
|
||||||
skelMorph->offset[1] = LittleFloat(pMorph->offset[1]);
|
skelMorph->offset[1] = LittleFloatPtr(pMorph->offset[1]);
|
||||||
skelMorph->offset[2] = LittleFloat(pMorph->offset[2]);
|
skelMorph->offset[2] = LittleFloatPtr(pMorph->offset[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
skelWeight_t* pWeight = (skelWeight_t * )((byte*)pMorph);
|
skelWeight_t* pWeight = (skelWeight_t * )((byte*)pMorph);
|
||||||
skelWeight_t* skelWeight = (skelWeight_t*)((byte*)skelMorph);
|
skelWeight_t* skelWeight = (skelWeight_t*)((byte*)skelMorph);
|
||||||
for (k = 0; k < pVert->numWeights; k++, skelWeight++, pWeight++)
|
for (k = 0; k < pVert->numWeights; k++, skelWeight++, pWeight++)
|
||||||
{
|
{
|
||||||
skelWeight->boneIndex = LittleLong(pWeight->boneIndex);
|
skelWeight->boneIndex = LittleLongPtr(pWeight->boneIndex);
|
||||||
skelWeight->boneWeight = LittleLong(pWeight->boneWeight);
|
skelWeight->boneWeight = LittleLongPtr(pWeight->boneWeight);
|
||||||
skelWeight->offset[0] = LittleFloat(pWeight->offset[0]);
|
skelWeight->offset[0] = LittleFloatPtr(pWeight->offset[0]);
|
||||||
skelWeight->offset[1] = LittleFloat(pWeight->offset[1]);
|
skelWeight->offset[1] = LittleFloatPtr(pWeight->offset[1]);
|
||||||
skelWeight->offset[2] = LittleFloat(pWeight->offset[2]);
|
skelWeight->offset[2] = LittleFloatPtr(pWeight->offset[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
pVert = (skeletorVertex_t*)((byte*)pVert + iOffset);
|
pVert = (skeletorVertex_t*)((byte*)pVert + iOffset);
|
||||||
|
|
|
@ -69,7 +69,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
#include <X11/extensions/xf86dgaconst.h>
|
#include <X11/extensions/xf86dgaconst.h>
|
||||||
#include <X11/extensions/xf86vmode.h>
|
#include <X11/extensions/xf86vmode.h>
|
||||||
|
|
||||||
#define WINDOW_CLASS_NAME "Quake III: Arena"
|
#define WINDOW_CLASS_NAME PRODUCT_NAME_FULL
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
|
|
|
@ -981,7 +981,7 @@ void* Sys_GetCGameAPI(void* parms)
|
||||||
const char* gamedir;
|
const char* gamedir;
|
||||||
const char* homepath;
|
const char* homepath;
|
||||||
const char* fn;
|
const char* fn;
|
||||||
const char* gamename = "cgame" ARCH_STRING DLL_EXT;
|
const char* gamename = "cgame" ARCH_STRING DLL_SUFFIX DLL_EXT;
|
||||||
|
|
||||||
if (cgame_library)
|
if (cgame_library)
|
||||||
Com_Error(ERR_FATAL, "Sys_GetCGameAPI without calling Sys_UnloadCGame");
|
Com_Error(ERR_FATAL, "Sys_GetCGameAPI without calling Sys_UnloadCGame");
|
||||||
|
@ -1098,7 +1098,10 @@ void *Sys_LoadDll( const char *name, char *fqpath ,
|
||||||
snprintf (fname, sizeof(fname), "%smips.so", name);
|
snprintf (fname, sizeof(fname), "%smips.so", name);
|
||||||
#elif defined __x86_64__
|
#elif defined __x86_64__
|
||||||
snprintf(fname, sizeof(fname), "%sx86_64.so", name);
|
snprintf(fname, sizeof(fname), "%sx86_64.so", name);
|
||||||
#else
|
#elif defined __arm__
|
||||||
|
snprintf(fname, sizeof(fname), "%sarm.so", name);
|
||||||
|
#elif defined __aarch64__
|
||||||
|
snprintf(fname, sizeof(fname), "%saarch64.so", name);
|
||||||
#error Unknown arch
|
#error Unknown arch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue