Rollback of ui_syscalls.c

This commit is contained in:
Walter Julius Hennecke 2013-08-25 03:01:46 +02:00
parent ac31908cfc
commit d8b4ac7c7b

View file

@ -6,7 +6,7 @@
// syscalls.asm is included instead when building a qvm
//TiM | Hack coz VC 6 can't understand Thilo's defnitions :S
//typedef int32_t intptr_t;
//typedef int intptr_t;
static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
@ -14,16 +14,16 @@ Q_EXPORT void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) ) {
syscall = syscallptr;
}
/*static int32_t (QDECL *syscall)( int32_t arg, ... ) = (int32_t (QDECL *)( int32_t, ...))-1;
/*static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
void dllEntry( int32_t (QDECL *syscallptr)( int32_t arg,... ) ) {
void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
syscall = syscallptr;
}*/
int32_t PASSFLOAT( float x ) {
int32_t floatTemp;
int PASSFLOAT( float x ) {
float floatTemp;
floatTemp = x;
return floatTemp;
return *(int *)&floatTemp;
}
void trap_Print( const char *string ) {
@ -34,11 +34,11 @@ void trap_Error( const char *string ) {
syscall( UI_ERROR, string );
}
int32_t trap_Milliseconds( void ) {
int trap_Milliseconds( void ) {
return syscall( UI_MILLISECONDS );
}
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int32_t flags ) {
void trap_Cvar_Register( vmCvar_t *cvar, const char *var_name, const char *value, int flags ) {
syscall( UI_CVAR_REGISTER, cvar, var_name, value, flags );
}
@ -51,12 +51,12 @@ void trap_Cvar_Set( const char *var_name, const char *value ) {
}
float trap_Cvar_VariableValue( const char *var_name ) {
float temp;
int temp;
temp = syscall( UI_CVAR_VARIABLEVALUE, var_name );
return temp;
return (*(float*)&temp);
}
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int32_t bufsize ) {
void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize ) {
syscall( UI_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
}
@ -68,35 +68,35 @@ void trap_Cvar_Reset( const char *name ) {
syscall( UI_CVAR_RESET, name );
}
void trap_Cvar_Create( const char *var_name, const char *var_value, int32_t flags ) {
void trap_Cvar_Create( const char *var_name, const char *var_value, int flags ) {
syscall( UI_CVAR_CREATE, var_name, var_value, flags );
}
void trap_Cvar_InfoStringBuffer( int32_t bit, char *buffer, int32_t bufsize ) {
void trap_Cvar_InfoStringBuffer( int bit, char *buffer, int bufsize ) {
syscall( UI_CVAR_INFOSTRINGBUFFER, bit, buffer, bufsize );
}
int32_t trap_Argc( void ) {
int trap_Argc( void ) {
return syscall( UI_ARGC );
}
void trap_Argv( int32_t n, char *buffer, int32_t bufferLength ) {
void trap_Argv( int n, char *buffer, int bufferLength ) {
syscall( UI_ARGV, n, buffer, bufferLength );
}
void trap_Cmd_ExecuteText( int32_t exec_when, const char *text ) {
void trap_Cmd_ExecuteText( int exec_when, const char *text ) {
syscall( UI_CMD_EXECUTETEXT, exec_when, text );
}
int32_t trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode ) {
return syscall( UI_FS_FOPENFILE, qpath, f, mode );
}
void trap_FS_Read( void *buffer, int32_t len, fileHandle_t f ) {
void trap_FS_Read( void *buffer, int len, fileHandle_t f ) {
syscall( UI_FS_READ, buffer, len, f );
}
void trap_FS_Write( const void *buffer, int32_t len, fileHandle_t f ) {
void trap_FS_Write( const void *buffer, int len, fileHandle_t f ) {
syscall( UI_FS_WRITE, buffer, len, f );
}
@ -104,7 +104,7 @@ void trap_FS_FCloseFile( fileHandle_t f ) {
syscall( UI_FS_FCLOSEFILE, f );
}
int32_t trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int32_t bufsize ) {
int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) {
return syscall( UI_FS_GETFILELIST, path, extension, listbuf, bufsize );
}
@ -128,7 +128,7 @@ void trap_R_AddRefEntityToScene( const refEntity_t *re ) {
syscall( UI_R_ADDREFENTITYTOSCENE, re );
}
void trap_R_AddPolyToScene( qhandle_t hShader , int32_t numVerts, const polyVert_t *verts ) {
void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts ) {
syscall( UI_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
}
@ -152,11 +152,11 @@ void trap_UpdateScreen( void ) {
syscall( UI_UPDATESCREEN );
}
void trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int32_t startFrame, int32_t endFrame, float frac, const char *tagName ) {
void trap_CM_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame, float frac, const char *tagName ) {
syscall( UI_CM_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
}
void trap_S_StartLocalSound( sfxHandle_t sfx, int32_t channelNum ) {
void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum ) {
syscall( UI_S_STARTLOCALSOUND, sfx, channelNum );
}
@ -164,19 +164,19 @@ sfxHandle_t trap_S_RegisterSound( const char *sample ) {
return syscall( UI_S_REGISTERSOUND, sample );
}
void trap_Key_KeynumToStringBuf( int32_t keynum, char *buf, int32_t buflen ) {
void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
syscall( UI_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
}
void trap_Key_GetBindingBuf( int32_t keynum, char *buf, int32_t buflen ) {
void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
syscall( UI_KEY_GETBINDINGBUF, keynum, buf, buflen );
}
void trap_Key_SetBinding( int32_t keynum, const char *binding ) {
void trap_Key_SetBinding( int keynum, const char *binding ) {
syscall( UI_KEY_SETBINDING, keynum, binding );
}
qboolean trap_Key_IsDown( int32_t keynum ) {
qboolean trap_Key_IsDown( int keynum ) {
return syscall( UI_KEY_ISDOWN, keynum );
}
@ -192,15 +192,15 @@ void trap_Key_ClearStates( void ) {
syscall( UI_KEY_CLEARSTATES );
}
int32_t trap_Key_GetCatcher( void ) {
int trap_Key_GetCatcher( void ) {
return syscall( UI_KEY_GETCATCHER );
}
void trap_Key_SetCatcher( int32_t catcher ) {
void trap_Key_SetCatcher( int catcher ) {
syscall( UI_KEY_SETCATCHER, catcher );
}
void trap_GetClipboardData( char *buf, int32_t bufsize ) {
void trap_GetClipboardData( char *buf, int bufsize ) {
syscall( UI_GETCLIPBOARDDATA, buf, bufsize );
}
@ -212,43 +212,43 @@ void trap_GetGlconfig( glconfig_t *glconfig ) {
syscall( UI_GETGLCONFIG, glconfig );
}
int32_t trap_GetConfigString( int32_t index, char* buff, int32_t buffsize ) {
int trap_GetConfigString( int index, char* buff, int buffsize ) {
return syscall( UI_GETCONFIGSTRING, index, buff, buffsize );
}
int32_t trap_LAN_GetLocalServerCount( void ) {
int trap_LAN_GetLocalServerCount( void ) {
return syscall( UI_LAN_GETLOCALSERVERCOUNT );
}
void trap_LAN_GetLocalServerAddressString( int32_t n, char *buf, int32_t buflen ) {
void trap_LAN_GetLocalServerAddressString( int n, char *buf, int buflen ) {
syscall( UI_LAN_GETLOCALSERVERADDRESSSTRING, n, buf, buflen );
}
int32_t trap_LAN_GetGlobalServerCount( void ) {
int trap_LAN_GetGlobalServerCount( void ) {
return syscall( UI_LAN_GETGLOBALSERVERCOUNT );
}
void trap_LAN_GetGlobalServerAddressString( int32_t n, char *buf, int32_t buflen ) {
void trap_LAN_GetGlobalServerAddressString( int n, char *buf, int buflen ) {
syscall( UI_LAN_GETGLOBALSERVERADDRESSSTRING, n, buf, buflen );
}
int32_t trap_LAN_GetPingQueueCount( void ) {
int trap_LAN_GetPingQueueCount( void ) {
return syscall( UI_LAN_GETPINGQUEUECOUNT );
}
void trap_LAN_ClearPing( int32_t n ) {
void trap_LAN_ClearPing( int n ) {
syscall( UI_LAN_CLEARPING, n );
}
void trap_LAN_GetPing( int32_t n, char *buf, int32_t buflen, int32_t *pingtime ) {
void trap_LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
syscall( UI_LAN_GETPING, n, buf, buflen, pingtime );
}
void trap_LAN_GetPingInfo( int32_t n, char *buf, int32_t buflen ) {
void trap_LAN_GetPingInfo( int n, char *buf, int buflen ) {
syscall( UI_LAN_GETPINGINFO, n, buf, buflen );
}
int32_t trap_MemoryRemaining( void ) {
int trap_MemoryRemaining( void ) {
return syscall( UI_MEMORY_REMAINING );
}