mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-24 21:41:23 +00:00
Remove MWERKS stuff
This commit is contained in:
parent
01b5e365e8
commit
3dc6127529
4 changed files with 1 additions and 122 deletions
|
@ -134,16 +134,10 @@ static const char* fastEntityList[] = {
|
||||||
GetGameAPI
|
GetGameAPI
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
#if __MWERKS__
|
|
||||||
#pragma export on
|
|
||||||
#endif
|
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#pragma GCC visibility push(default)
|
#pragma GCC visibility push(default)
|
||||||
#endif
|
#endif
|
||||||
extern "C" gameExport_t *GetGameAPI( gameImport_t *import ) {
|
extern "C" gameExport_t *GetGameAPI( gameImport_t *import ) {
|
||||||
#if __MWERKS__
|
|
||||||
#pragma export off
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( import->version == GAME_API_VERSION ) {
|
if ( import->version == GAME_API_VERSION ) {
|
||||||
|
|
||||||
|
|
|
@ -98,16 +98,10 @@ const char *idGameLocal::sufaceTypeNames[ MAX_SURFACE_TYPES ] = {
|
||||||
GetGameAPI
|
GetGameAPI
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
#if __MWERKS__
|
|
||||||
#pragma export on
|
|
||||||
#endif
|
|
||||||
#if __GNUC__ >= 4
|
#if __GNUC__ >= 4
|
||||||
#pragma GCC visibility push(default)
|
#pragma GCC visibility push(default)
|
||||||
#endif
|
#endif
|
||||||
extern "C" gameExport_t *GetGameAPI( gameImport_t *import ) {
|
extern "C" gameExport_t *GetGameAPI( gameImport_t *import ) {
|
||||||
#if __MWERKS__
|
|
||||||
#pragma export off
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if ( import->version == GAME_API_VERSION ) {
|
if ( import->version == GAME_API_VERSION ) {
|
||||||
|
|
||||||
|
|
|
@ -181,116 +181,12 @@ double ticksPerNanosecond;
|
||||||
|
|
||||||
#define TIME_TYPE uint64_t
|
#define TIME_TYPE uint64_t
|
||||||
|
|
||||||
#ifdef __MWERKS__ //time_in_millisec is missing
|
|
||||||
/*
|
|
||||||
|
|
||||||
.text
|
|
||||||
.align 2
|
|
||||||
.globl _GetTB
|
|
||||||
_GetTB:
|
|
||||||
|
|
||||||
loop:
|
|
||||||
mftbu r4 ; load from TBU
|
|
||||||
mftb r5 ; load from TBL
|
|
||||||
mftbu r6 ; load from TBU
|
|
||||||
cmpw r6, r4 ; see if old == new
|
|
||||||
bne loop ; if not, carry occured, therefore loop
|
|
||||||
|
|
||||||
stw r4, 0(r3)
|
|
||||||
stw r5, 4(r3)
|
|
||||||
|
|
||||||
done:
|
|
||||||
blr ; return
|
|
||||||
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
unsigned int hi;
|
|
||||||
unsigned int lo;
|
|
||||||
} U64;
|
|
||||||
|
|
||||||
|
|
||||||
asm void GetTB(U64 *in)
|
|
||||||
{
|
|
||||||
nofralloc // suppress prolog
|
|
||||||
machine 603 // allows the use of mftb & mftbu functions
|
|
||||||
|
|
||||||
loop:
|
|
||||||
mftbu r5 // grab the upper time base register (TBU)
|
|
||||||
mftb r4 // grab the lower time base register (TBL)
|
|
||||||
mftbu r6 // grab the upper time base register (TBU) again
|
|
||||||
|
|
||||||
cmpw r6,r5 // see if old TBU == new TBU
|
|
||||||
bne- loop // loop if carry occurred (predict branch not taken)
|
|
||||||
|
|
||||||
stw r4,4(r3) // store TBL in the low 32 bits of the return value
|
|
||||||
stw r5,0(r3) // store TBU in the high 32 bits of the return value
|
|
||||||
|
|
||||||
blr
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
double TBToDoubleNano( U64 startTime, U64 stopTime, double ticksPerNanosecond );
|
|
||||||
|
|
||||||
#if __MWERKS__
|
|
||||||
asm void GetTB( U64 * );
|
|
||||||
#else
|
|
||||||
void GetTB( U64 * );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double TBToDoubleNano( U64 startTime, U64 stopTime, double ticksPerNanosecond ) {
|
|
||||||
#define K_2POWER32 4294967296.0
|
|
||||||
#define TICKS_PER_NANOSECOND 0.025
|
|
||||||
double nanoTime;
|
|
||||||
U64 diffTime;
|
|
||||||
|
|
||||||
// calc the difference in TB ticks
|
|
||||||
diffTime.hi = stopTime.hi - startTime.hi;
|
|
||||||
diffTime.lo = stopTime.lo - startTime.lo;
|
|
||||||
|
|
||||||
// convert TB ticks into time
|
|
||||||
nanoTime = (double)(diffTime.hi)*((double)K_2POWER32) + (double)(diffTime.lo);
|
|
||||||
nanoTime = nanoTime/ticksPerNanosecond;
|
|
||||||
return (nanoTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
TIME_TYPE time_in_millisec( void ) {
|
|
||||||
#define K_2POWER32 4294967296.0
|
|
||||||
#define TICKS_PER_NANOSECOND 0.025
|
|
||||||
|
|
||||||
U64 the_time;
|
|
||||||
double nanoTime, milliTime;
|
|
||||||
|
|
||||||
GetTB( &the_time );
|
|
||||||
|
|
||||||
// convert TB ticks into time
|
|
||||||
nanoTime = (double)(the_time.hi)*((double)K_2POWER32) + (double)(the_time.lo);
|
|
||||||
nanoTime = nanoTime/ticksPerNanosecond;
|
|
||||||
|
|
||||||
// nanoseconds are 1 billionth of a second. I want milliseconds
|
|
||||||
milliTime = nanoTime * 1000000.0;
|
|
||||||
|
|
||||||
printf( "ticks per nanosec -- %lf\n", ticksPerNanosecond );
|
|
||||||
printf( "nanoTime is %lf -- milliTime is %lf -- as int is %i\n", nanoTime, milliTime, (int)milliTime );
|
|
||||||
|
|
||||||
return (int)milliTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define StartRecordTime( start ) \
|
|
||||||
start = time_in_millisec();
|
|
||||||
|
|
||||||
#define StopRecordTime( end ) \
|
|
||||||
end = time_in_millisec();
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
#define StartRecordTime( start ) \
|
#define StartRecordTime( start ) \
|
||||||
start = mach_absolute_time();
|
start = mach_absolute_time();
|
||||||
|
|
||||||
#define StopRecordTime( end ) \
|
#define StopRecordTime( end ) \
|
||||||
end = mach_absolute_time();
|
end = mach_absolute_time();
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define TIME_TYPE int
|
#define TIME_TYPE int
|
||||||
|
|
|
@ -84,12 +84,7 @@ If you have questions concerning this license or the applicable additional terms
|
||||||
|
|
||||||
#define ALIGN16( x ) x __attribute__ ((aligned (16)))
|
#define ALIGN16( x ) x __attribute__ ((aligned (16)))
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
#define PACKED
|
|
||||||
#include <alloca.h>
|
|
||||||
#else
|
|
||||||
#define PACKED __attribute__((packed))
|
#define PACKED __attribute__((packed))
|
||||||
#endif
|
|
||||||
|
|
||||||
#define _alloca alloca
|
#define _alloca alloca
|
||||||
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
|
#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15))
|
||||||
|
|
Loading…
Reference in a new issue