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
|
||||
mohaa-re
|
||||
out
|
||||
Makefile.local
|
||||
*.swp
|
||||
*tags
|
||||
|
|
|
@ -29,9 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
|
||||
#include "cl_ui.h"
|
||||
|
||||
#if _MSC_VER
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#include <ctime>
|
||||
|
||||
typedef struct {
|
||||
float fadetime;
|
||||
|
@ -5443,7 +5441,7 @@ UI_BeginLoadResource
|
|||
====================
|
||||
*/
|
||||
void UI_BeginLoadResource( void ) {
|
||||
uint64_t time = __rdtsc();
|
||||
clock_t time = clock();
|
||||
|
||||
startCountHigh = time >> 32;
|
||||
startCountLow = time;
|
||||
|
|
|
@ -114,7 +114,7 @@ void Z_Free( void *ptr )
|
|||
block->prev = block;
|
||||
block->next = block;
|
||||
|
||||
#if !defined(_DEBUG) && !defined(WIN32)
|
||||
#if !defined(_DEBUG) || !defined(WIN32)
|
||||
// free the block
|
||||
free( block );
|
||||
#else
|
||||
|
@ -172,7 +172,7 @@ void *Z_TagMalloc( size_t size, int tag )
|
|||
#endif
|
||||
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 );
|
||||
#else
|
||||
block = HeapAlloc(GetProcessHeap(), 0, size);
|
||||
|
|
|
@ -346,6 +346,8 @@ short ShortSwapPtr(const void* l);
|
|||
int LongSwapPtr(const void* l);
|
||||
short ShortNoSwapPtr(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 )
|
||||
#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 CopyLittleLong(dest, src) CopyLongSwap(dest, src)
|
||||
|
||||
//
|
||||
// Those Little*Ptr are used to avoid alignment problems
|
||||
//
|
||||
|
||||
#define LittleShort(x) ShortSwap(x)
|
||||
#define LittleLong(x) LongSwap(x)
|
||||
#define LittleFloat(x) FloatSwap(&x)
|
||||
#define LittleShortPtr(x) ShortSwapPtr(&x)
|
||||
#define LittleLongPtr(x) LongSwapPtr(&x)
|
||||
#define LittleFloatPtr(x) FloatSwapPtr(&x)
|
||||
|
||||
#define BigShort
|
||||
#define BigLong
|
||||
|
@ -376,6 +383,7 @@ int LongNoSwapPtr(const void* l);
|
|||
#define LittleFloat
|
||||
#define LittleShortPtr(x) ShortNoSwapPtr(&x)
|
||||
#define LittleLongPtr(x) LongNoSwapPtr(&x)
|
||||
#define LittleFloatPtr(x) FloatNoSwapPtr(&x)
|
||||
|
||||
#define BigShort(x) ShortSwap(x)
|
||||
#define BigLong(x) LongSwap(x)
|
||||
|
|
|
@ -1552,6 +1552,20 @@ int LongNoSwapPtr(const void* l)
|
|||
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)
|
||||
{
|
||||
// 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(skeletorVertex_t);
|
||||
|
||||
skelVert->normal[0] = LittleFloat(pVert->normal[0]);
|
||||
skelVert->normal[1] = LittleFloat(pVert->normal[1]);
|
||||
skelVert->normal[2] = LittleFloat(pVert->normal[2]);
|
||||
skelVert->texCoords[0] = LittleFloat(pVert->texCoords[0]);
|
||||
skelVert->texCoords[1] = LittleFloat(pVert->texCoords[1]);
|
||||
skelVert->normal[0] = LittleFloatPtr(pVert->normal[0]);
|
||||
skelVert->normal[1] = LittleFloatPtr(pVert->normal[1]);
|
||||
skelVert->normal[2] = LittleFloatPtr(pVert->normal[2]);
|
||||
skelVert->texCoords[0] = LittleFloatPtr(pVert->texCoords[0]);
|
||||
skelVert->texCoords[1] = LittleFloatPtr(pVert->texCoords[1]);
|
||||
skelVert->numWeights = numWeights;
|
||||
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++)
|
||||
{
|
||||
skelMorph->morphIndex = pMorph->morphIndex;
|
||||
skelMorph->offset[0] = LittleFloat(pMorph->offset[0]);
|
||||
skelMorph->offset[1] = LittleFloat(pMorph->offset[1]);
|
||||
skelMorph->offset[2] = LittleFloat(pMorph->offset[2]);
|
||||
skelMorph->offset[0] = LittleFloatPtr(pMorph->offset[0]);
|
||||
skelMorph->offset[1] = LittleFloatPtr(pMorph->offset[1]);
|
||||
skelMorph->offset[2] = LittleFloatPtr(pMorph->offset[2]);
|
||||
}
|
||||
|
||||
skelWeight_t* pWeight = (skelWeight_t * )((byte*)pMorph);
|
||||
skelWeight_t* skelWeight = (skelWeight_t*)((byte*)skelMorph);
|
||||
for (k = 0; k < pVert->numWeights; k++, skelWeight++, pWeight++)
|
||||
{
|
||||
skelWeight->boneIndex = LittleLong(pWeight->boneIndex);
|
||||
skelWeight->boneWeight = LittleLong(pWeight->boneWeight);
|
||||
skelWeight->offset[0] = LittleFloat(pWeight->offset[0]);
|
||||
skelWeight->offset[1] = LittleFloat(pWeight->offset[1]);
|
||||
skelWeight->offset[2] = LittleFloat(pWeight->offset[2]);
|
||||
skelWeight->boneIndex = LittleLongPtr(pWeight->boneIndex);
|
||||
skelWeight->boneWeight = LittleLongPtr(pWeight->boneWeight);
|
||||
skelWeight->offset[0] = LittleFloatPtr(pWeight->offset[0]);
|
||||
skelWeight->offset[1] = LittleFloatPtr(pWeight->offset[1]);
|
||||
skelWeight->offset[2] = LittleFloatPtr(pWeight->offset[2]);
|
||||
}
|
||||
|
||||
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/xf86vmode.h>
|
||||
|
||||
#define WINDOW_CLASS_NAME "Quake III: Arena"
|
||||
#define WINDOW_CLASS_NAME PRODUCT_NAME_FULL
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -981,7 +981,7 @@ void* Sys_GetCGameAPI(void* parms)
|
|||
const char* gamedir;
|
||||
const char* homepath;
|
||||
const char* fn;
|
||||
const char* gamename = "cgame" ARCH_STRING DLL_EXT;
|
||||
const char* gamename = "cgame" ARCH_STRING DLL_SUFFIX DLL_EXT;
|
||||
|
||||
if (cgame_library)
|
||||
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);
|
||||
#elif defined __x86_64__
|
||||
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
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue