code cleanup

This commit is contained in:
Crow-bar
2022-04-03 18:00:12 +03:00
parent 64020b2902
commit cd37d866c2
31 changed files with 172 additions and 128 deletions

View File

@@ -80,7 +80,6 @@ GNU General Public License for more details.
#if XASH_PSP
#include <unistd.h>
#include <pspiofilemgr.h>
#include "../engine/platform/psp/dll_psp.h"
#define PATH_MAX 1024
#define PATH_SPLITTER "/"
#define O_BINARY 0
@@ -90,9 +89,6 @@ GNU General Public License for more details.
#define LoadLibrary( x ) ( 0 )
#define GetProcAddress( x, y ) ( 0 )
#define FreeLibrary( x ) ( 0 )
// #define LoadLibrary( x ) dlopen( x, RTLD_NOW )
// #define GetProcAddress( x, y ) dlsym( x, y )
// #define FreeLibrary( x ) dlclose( x )
#endif
//#define MAKEWORD( a, b ) ((short int)(((unsigned char)(a))|(((short int)((unsigned char)(b)))<<8)))
@@ -164,6 +160,10 @@ GNU General Public License for more details.
#define XASH_LOW_MEMORY 0
#endif
#ifndef XASH_EXT_OPT
#define XASH_EXT_OPT 0
#endif
#include <stdlib.h>
#include <string.h>
#include <limits.h>

View File

@@ -103,7 +103,7 @@ CL_GetEntityByIndex
Render callback for studio models
====================
*/
#if XASH_OPT
#if XASH_EXT_OPT == 2
cl_entity_t *pfnCL_GetEntityByIndex( int index )
{
return CL_GetEntityByIndex( index );
@@ -130,7 +130,7 @@ CL_ModelHandle
get model handle by index
================
*/
#if XASH_OPT
#if XASH_EXT_OPT == 2
model_t *pfnCL_ModelHandle( int modelindex )
{
return CL_ModelHandle( modelindex );
@@ -3819,7 +3819,7 @@ static cl_enginefunc_t gEngfuncs =
pfnIsNoClipping,
CL_GetLocalPlayer,
CL_GetViewModel,
#if XASH_OPT
#if XASH_EXT_OPT == 2
pfnCL_GetEntityByIndex,
#else
CL_GetEntityByIndex,

View File

@@ -271,7 +271,7 @@ static render_api_t gRenderAPI =
pfnFileBufferCRC32,
COM_CompareFileTime,
Host_Error,
#if XASH_OPT
#if XASH_EXT_OPT == 2
(void*)pfnCL_ModelHandle,
#else
(void*)CL_ModelHandle,

View File

@@ -709,7 +709,7 @@ dlight_t *CL_GetEntityLight( int number );
//
// cl_cmds.c
//
#ifdef XASH_PSP
#if XASH_PSP
void CL_Quit_f( void );
#else
void CL_Quit_f( void ) NORETURN;
@@ -825,7 +825,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize );
client_textmessage_t *CL_TextMessageGet( const char *pName );
int pfnDecalIndexFromName( const char *szDecalName );
int pfnIndexFromTrace( struct pmtrace_s *pTrace );
#if XASH_OPT
#if XASH_EXT_OPT == 2
#define CL_ModelHandle( modelindex ) ( ( ( modelindex ) < 0 || ( modelindex ) >= MAX_MODELS ) ? NULL : cl.models[( modelindex )] )
model_t *pfnCL_ModelHandle( int modelindex );
#else

View File

@@ -268,7 +268,7 @@ static ref_api_t gEngfuncs =
CL_GetLocalPlayer,
CL_GetViewModel,
#if XASH_OPT
#if XASH_EXT_OPT == 2
pfnCL_GetEntityByIndex,
#else
CL_GetEntityByIndex,
@@ -299,7 +299,7 @@ static ref_api_t gEngfuncs =
Mod_ForName,
pfnMod_Extradata,
#if XASH_OPT
#if XASH_EXT_OPT == 2
pfnCL_ModelHandle,
#else
CL_ModelHandle,

View File

@@ -466,7 +466,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
// lookup actual string in g_Sentences,
// set pointer to string data
#ifdef XASH_PSP
#if XASH_PSP
if( pszin[0] == '#' )
psz = VOX_LookupString( pszin + 1, NULL );
else

View File

@@ -877,7 +877,7 @@ int R_CreateDecalList( struct decallist_s *pList );
void R_ClearAllDecals( void );
void CL_ClearStaticEntities( void );
qboolean S_StreamGetCurrentState( char *currentTrack, char *loopTrack, int *position );
#if XASH_OPT
#if XASH_EXT_OPT == 2
#define CL_GetEntityByIndex( index ) ( ( !clgame.entities ) ? NULL : ( ( ( index ) < 0 || ( index ) >= clgame.maxEntities ) ? NULL : ( ( ( index ) == 0 ) ? clgame.entities : ( clgame.entities + ( index ) ) ) ) )
struct cl_entity_s *pfnCL_GetEntityByIndex( int index );
#else

View File

@@ -101,19 +101,19 @@ static const loadpixformat_t load_null[] =
{
{ NULL, NULL, NULL, IL_HINT_NO }
};
#if XASH_PSP
#if XASH_EXT_OPT
static const loadpixformat_t load_game[] =
{
{ "%s%s.%s", "mip", Image_LoadMIP, IL_HINT_NO }, // hl textures from wad or buffer
//{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
{ "%s%s.%s", "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
{ "%s%s.%s", "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
//{ "%s%s.%s", "png", Image_LoadPNG, IL_HINT_NO }, // NightFire 007 menus
{ "%s%s.%s", "mdl", Image_LoadMDL, IL_HINT_HL }, // hl studio model skins
{ "%s%s.%s", "spr", Image_LoadSPR, IL_HINT_HL }, // hl sprite frames
{ "%s%s.%s", "lmp", Image_LoadLMP, IL_HINT_NO }, // hl menu images (cached.wad etc)
{ "%s%s.%s", "fnt", Image_LoadFNT, IL_HINT_HL }, // hl console font (fonts.wad etc)
{ "%s%s.%s", "pal", Image_LoadPAL, IL_HINT_NO }, // install studio\sprite palette
{ "%s%s.%s", "dds", Image_LoadDDS, IL_HINT_NO }, // dds for world and studio models
{ "%s%s.%s", "tga", Image_LoadTGA, IL_HINT_NO }, // hl vgui menus
{ "%s%s.%s", "bmp", Image_LoadBMP, IL_HINT_NO }, // WON menu images
{ "%s%s.%s", "png", Image_LoadPNG, IL_HINT_NO }, // NightFire 007 menus
{ NULL, NULL, NULL, IL_HINT_NO }
};
#else

View File

@@ -108,13 +108,14 @@ int main( int argc, char** argv )
#endif
#endif
#if XASH_PSP
g_iArgc = argc;
g_pszArgv = argv;
g_pszArgv = argv;
#if XASH_PSP
if(argc <= 1)
{
g_fArgc = 0;
g_fArgv[g_fArgc++] = argv[0]; // for get root directory path
g_fArgv[g_fArgc++] = argv[0]; // cwd path
Platform_ReadCmd( "start.cmd", &g_fArgc, g_fArgv );
if(g_fArgc > 1)
{
@@ -122,10 +123,8 @@ int main( int argc, char** argv )
g_pszArgv = g_fArgv;
}
}
#else
g_iArgc = argc;
g_pszArgv = argv;
#endif
#if XASH_IOS
{
void IOS_LaunchDialog( void );

View File

@@ -94,7 +94,7 @@ void MSG_Clear( sizebuf_t *sb )
sb->bOverflow = false;
}
#if !XASH_PSP
#if XASH_EXT_OPT != 2
static qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
{
if( sb->iCurBit + nBits > sb->nDataBits )
@@ -136,7 +136,7 @@ void MSG_SeekToByte( sizebuf_t *sb, int bytePos )
{
sb->iCurBit = bytePos << 3;
}
#if !XASH_PSP
#if XASH_EXT_OPT != 2
void MSG_WriteOneBit( sizebuf_t *sb, int nValue )
{
if( !MSG_Overflow( sb, 1 ))

View File

@@ -70,7 +70,7 @@ void MSG_StartWriting( sizebuf_t *sb, void *pData, int nBytes, int iStartBit, in
void MSG_Clear( sizebuf_t *sb );
// Bit-write functions
#if XASH_PSP
#if XASH_EXT_OPT == 2
_inline qboolean MSG_Overflow( sizebuf_t *sb, int nBits )
{
if( sb->iCurBit + nBits > sb->nDataBits )

View File

@@ -295,15 +295,18 @@ static const delta_field_t ent_fields[] =
{ NULL },
};
#if XASH_OPT /* Direct access */
#define D_event_t 0
#define D_movevars_t 1
#define D_usercmd_t 2
#define D_clientdata_t 3
#define D_weapon_data_t 4
#define D_entity_state_t 5
#define D_entity_state_player_t 6
#define D_custom_entity_state_t 7
#if XASH_EXT_OPT /* Direct access */
enum
{
E_EVENT = 0,
E_MOVEVARS,
E_USERCMD,
E_CLIENTDATA,
E_WEAPON_DATA,
E_ENTITY_STATE,
E_ENTITY_STATE_PLAYER,
E_CUSTOM_ENTITY_STATE
};
#endif
static delta_info_t dt_info[] =
@@ -810,8 +813,8 @@ void Delta_Init( void )
Delta_InitFields (); // initialize fields
delta_init = true;
#if XASH_OPT
dt = &dt_info[D_movevars_t];
#if XASH_EXT_OPT
dt = &dt_info[E_MOVEVARS];
#else
dt = Delta_FindStruct( "movevars_t" );
#endif
@@ -907,7 +910,7 @@ Delta_ClampIntegerField
prevent data to out of range
=====================
*/
#if XASH_OPT
#if XASH_EXT_OPT == 2
_inline int Delta_ClampIntegerField( delta_t *pField, int iValue, qboolean bSigned, int numbits )
#else
int Delta_ClampIntegerField( delta_t *pField, int iValue, qboolean bSigned, int numbits )
@@ -1081,13 +1084,12 @@ int Delta_TestBaseline( entity_state_t *from, entity_state_t *to, qboolean playe
if( from == NULL ) return 0;
return countBits;
}
#if XASH_OPT
dt = &dt_info[D_weapon_data_t];
#if XASH_EXT_OPT
if( FBitSet( to->entityType, ENTITY_BEAM ))
dt = &dt_info[D_custom_entity_state_t];
dt = &dt_info[E_CUSTOM_ENTITY_STATE];
else if( player )
dt = &dt_info[D_entity_state_player_t];
else dt = &dt_info[D_entity_state_t];
dt = &dt_info[E_ENTITY_STATE_PLAYER];
else dt = &dt_info[E_ENTITY_STATE];
#else
if( FBitSet( to->entityType, ENTITY_BEAM ))
dt = Delta_FindStruct( "custom_entity_state_t" );
@@ -1132,7 +1134,7 @@ write fields by offsets
assume from and to is valid
=====================
*/
#if XASH_OPT
#if XASH_EXT_OPT == 2
_inline qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
#else
qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
@@ -1359,8 +1361,8 @@ void MSG_WriteDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to )
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_usercmd_t];
#if XASH_EXT_OPT
dt = &dt_info[E_USERCMD];
#else
dt = Delta_FindStruct( "usercmd_t" );
#endif
@@ -1389,8 +1391,8 @@ void MSG_ReadDeltaUsercmd( sizebuf_t *msg, usercmd_t *from, usercmd_t *to )
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_usercmd_t];
#if XASH_EXT_OPT
dt = &dt_info[E_USERCMD];
#else
dt = Delta_FindStruct( "usercmd_t" );
#endif
@@ -1427,8 +1429,8 @@ void MSG_WriteDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to )
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_event_t];
#if XASH_EXT_OPT
dt = &dt_info[E_EVENT];
#else
dt = Delta_FindStruct( "event_t" );
#endif
@@ -1457,8 +1459,8 @@ void MSG_ReadDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to )
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_event_t];
#if XASH_EXT_OPT
dt = &dt_info[E_EVENT];
#else
dt = Delta_FindStruct( "event_t" );
#endif
@@ -1489,8 +1491,8 @@ qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *t
delta_info_t *dt;
int i, startBit;
int numChanges = 0;
#if XASH_OPT
dt = &dt_info[D_movevars_t];
#if XASH_EXT_OPT
dt = &dt_info[E_MOVEVARS];
#else
dt = Delta_FindStruct( "movevars_t" );
#endif
@@ -1527,8 +1529,8 @@ void MSG_ReadDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to )
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_movevars_t];
#if XASH_EXT_OPT
dt = &dt_info[E_MOVEVARS];
#else
dt = Delta_FindStruct( "movevars_t" );
#endif
@@ -1567,8 +1569,8 @@ void MSG_WriteClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to,
delta_info_t *dt;
int i, startBit;
int numChanges = 0;
#if XASH_OPT
dt = &dt_info[D_clientdata_t];
#if XASH_EXT_OPT
dt = &dt_info[E_CLIENTDATA];
#else
dt = Delta_FindStruct( "clientdata_t" );
#endif
@@ -1610,8 +1612,8 @@ void MSG_ReadClientData( sizebuf_t *msg, clientdata_t *from, clientdata_t *to, f
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_clientdata_t];
#if XASH_EXT_OPT
dt = &dt_info[E_CLIENTDATA];
#else
dt = Delta_FindStruct( "clientdata_t" );
#endif
@@ -1654,8 +1656,8 @@ void MSG_WriteWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to
delta_info_t *dt;
int i, startBit;
int numChanges = 0;
#if XASH_OPT
dt = &dt_info[D_weapon_data_t];
#if XASH_EXT_OPT
dt = &dt_info[E_WEAPON_DATA];
#else
dt = Delta_FindStruct( "weapon_data_t" );
#endif
@@ -1695,8 +1697,8 @@ void MSG_ReadWeaponData( sizebuf_t *msg, weapon_data_t *from, weapon_data_t *to,
delta_t *pField;
delta_info_t *dt;
int i;
#if XASH_OPT
dt = &dt_info[D_weapon_data_t];
#if XASH_EXT_OPT
dt = &dt_info[E_WEAPON_DATA];
#else
dt = Delta_FindStruct( "weapon_data_t" );
#endif
@@ -1781,18 +1783,18 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
numChanges++;
}
else MSG_WriteOneBit( msg, 0 );
#if XASH_OPT
#if XASH_EXT_OPT
if( FBitSet( to->entityType, ENTITY_BEAM ))
{
dt = &dt_info[D_custom_entity_state_t];
dt = &dt_info[E_CUSTOM_ENTITY_STATE];
}
else if( delta_type == DELTA_PLAYER )
{
dt = &dt_info[D_entity_state_player_t];
dt = &dt_info[E_ENTITY_STATE_PLAYER];
}
else
{
dt = &dt_info[D_entity_state_t];
dt = &dt_info[E_ENTITY_STATE];
}
#else
if( FBitSet( to->entityType, ENTITY_BEAM ))
@@ -1913,18 +1915,18 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
to->entityType = MSG_ReadUBitLong( msg, 2 );
to->number = number;
#if XASH_OPT
#if XASH_EXT_OPT
if( cls.legacymode ? ( to->entityType == ENTITY_BEAM ) : FBitSet( to->entityType, ENTITY_BEAM ))
{
dt = &dt_info[D_custom_entity_state_t];
dt = &dt_info[E_CUSTOM_ENTITY_STATE];
}
else if( delta_type == DELTA_PLAYER )
{
dt = &dt_info[D_entity_state_player_t];
dt = &dt_info[E_ENTITY_STATE_PLAYER];
}
else
{
dt = &dt_info[D_entity_state_t];
dt = &dt_info[E_ENTITY_STATE];
}
#else
if( cls.legacymode ? ( to->entityType == ENTITY_BEAM ) : FBitSet( to->entityType, ENTITY_BEAM ))

View File

@@ -93,7 +93,7 @@ static int ioctl_stub( int d, unsigned long r, ... )
#define SOCKET int
typedef int WSAsize_t;
#else
#include <errno.h> //GSA
#include <errno.h> // @Crow-bar
#include "platform/stub/net_stub.h"
#endif

View File

@@ -68,7 +68,7 @@ void Sys_Print( const char *pMsg );
void Sys_PrintLog( const char *pMsg );
void Sys_InitLog( void );
void Sys_CloseLog( void );
#ifdef XASH_PSP
#if XASH_PSP
void Sys_Quit( void );
#else
void Sys_Quit( void ) NORETURN;

View File

@@ -256,4 +256,4 @@ for_end:
return 1;
}
return 0;
}
}

View File

@@ -22,8 +22,8 @@ GNU General Public License for more details.
#define PSP_MAX_KEYS 12
extern convar_t *psp_deadzone_min;
extern convar_t *psp_deadzone_max;
convar_t *psp_deadzone_min;
convar_t *psp_deadzone_max;
static struct psp_keymap_s
{
@@ -108,7 +108,7 @@ void Platform_RunEvents( void )
for( i = 0; i < PSP_MAX_KEYS; i++ )
{
if( ( last_buttons ^ buf.Buttons ) & psp_keymap[i].srckey )
if( ( last_buttons ^ buf.Buttons ) & psp_keymap[i].srckey )
Key_Event( psp_keymap[i].dstkey, buf.Buttons & psp_keymap[i].srckey );
}
last_buttons = buf.Buttons;
@@ -156,6 +156,10 @@ void Platform_EnableTextInput( qboolean enable )
int Platform_JoyInit( int numjoy )
{
int i;
// set up cvars
psp_deadzone_min = Cvar_Get( "psp_deadzone_min", "20", FCVAR_ARCHIVE, "Joy deadzone min (0 - 127)" );
psp_deadzone_max = Cvar_Get( "psp_deadzone_max", "0", FCVAR_ARCHIVE, "Joy deadzone max (0 - 127)" );
// set up the controller.
sceCtrlSetSamplingCycle( 0 );
@@ -179,4 +183,4 @@ void Platform_PreCreateMove( void )
{
}
#endif /* XASH_INPUT */
#endif /* XASH_INPUT */

View File

@@ -20,7 +20,7 @@ GNU General Public License for more details.
#include "library.h"
#include "filesystem.h"
#include "server.h"
#include "platform/psp/lib_psp.h"
#include "platform/psp/dll_psp.h"
#ifdef XASH_NO_LIBDL
#ifndef XASH_DLL_LOADER

View File

@@ -13,9 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifndef XASH_DEDICATED
#include "common.h"
#include "platform/platform.h"
#if XASH_SOUND == SOUND_PSP
#include <pspaudiolib.h>
@@ -47,8 +45,6 @@ so it can unlock and free the data block after it has been played.
=======================================================================
*/
dma_t dma;
void S_Activate( qboolean active )
{
@@ -248,5 +244,4 @@ void SNDDMA_Shutdown( void )
dma.initialized = false;
}
#endif
#endif
#endif // XASH_SOUND == SOUND_PSP

View File

@@ -29,9 +29,6 @@ PSP_MAIN_THREAD_ATTR( PSP_THREAD_ATTR_USER | PSP_THREAD_ATTR_VFPU );
PSP_MAIN_THREAD_STACK_SIZE_KB( 512 );
PSP_HEAP_SIZE_KB( -3 * 1024 ); /* 3 MB for prx modules */
convar_t *psp_deadzone_min;
convar_t *psp_deadzone_max;
/* Exit callback */
static int exit_callback( int arg1, int arg2, void *common )
{
@@ -218,7 +215,7 @@ void Platform_ReadCmd( const char *fname, int *argc, char **argv )
else printf( "CMD FILE(%s) Read error!\n", fname );
free( cmd_buff );
sceIoClose(cmd_fd);
sceIoClose( cmd_fd );
}
}
@@ -264,13 +261,14 @@ int Platform_UnloadModule( SceUID modid, int *sce_code )
void Platform_Init( void )
{
// disable fpu exceptions (division by zero and etc...)
pspSdkDisableFPUExceptions();
// exit callback thread
SetupCallbacks();
scePowerSetClockFrequency( 333, 333, 166 );
psp_deadzone_min = Cvar_Get( "psp_deadzone_min", "20", FCVAR_ARCHIVE, "Joy deadzone min (0 - 127)" );
psp_deadzone_max = Cvar_Get( "psp_deadzone_max", "0", FCVAR_ARCHIVE, "Joy deadzone max (0 - 127)" );
// set max cpu/gpu frequency
scePowerSetClockFrequency( 333, 333, 166 );
}
void Platform_Shutdown( void )
@@ -278,4 +276,4 @@ void Platform_Shutdown( void )
#if XASH_PROFILING
gprof_cleanup();
#endif
}
}

View File

@@ -54,13 +54,13 @@ extern int SV_UPDATE_BACKUP;
#define GROUP_OP_AND 0
#define GROUP_OP_NAND 1
#if defined( NDEBUG ) || XASH_OPT
#if defined( NDEBUG )
#define SV_IsValidEdict( e ) ( e && !e->free )
#else
#define SV_IsValidEdict( e ) SV_CheckEdict( e, __FILE__, __LINE__ )
#endif
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts))
#if XASH_OPT
#if XASH_EXT_OPT == 2
#define EDICT_NUM( num ) ( ( ( ( num ) >= 0 ) && ( ( num ) < GI->max_edicts) ) ? svgame.edicts + ( num ) : NULL )
#else
#define EDICT_NUM( num ) SV_EdictNum( num )
@@ -480,7 +480,7 @@ void Master_Packet( void );
//
void SV_ActivateServer( int runPhysics );
qboolean SV_SpawnServer( const char *server, const char *startspot, qboolean background );
#if XASH_OPT
#if XASH_EXT_OPT == 2
#define SV_ModelHandle( modelindex ) ( ( modelindex < 0 || modelindex >= MAX_MODELS ) ? NULL : sv.models[( modelindex )] )
model_t *pfnSV_ModelHandle( int modelindex );
#else
@@ -499,7 +499,7 @@ qboolean SV_RunThink( edict_t *ent );
qboolean SV_PlayerRunThink( edict_t *ent, float frametime, double time );
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker );
void SV_Impact( edict_t *e1, edict_t *e2, trace_t *trace );
#if XASH_OPT
#if XASH_EXT_OPT == 2
// filter movetypes to collide with
#define SV_CanPushed( ent ) ( ( ent )->v.movetype == MOVETYPE_NONE || \
( ent )->v.movetype == MOVETYPE_PUSH || \
@@ -652,7 +652,7 @@ void SV_RestartAmbientSounds( void );
void SV_RestartDecals( void );
void SV_RestartStaticEnts( void );
int pfnGetCurrentPlayer( void );
#if !XASH_OPT
#if XASH_EXT_OPT != 2
edict_t *SV_EdictNum( int n );
#endif
char *SV_Localinfo( void );

View File

@@ -35,14 +35,14 @@ static vec3_t viewPoint[MAX_CLIENTS];
// exports
typedef void (__cdecl *LINK_ENTITY_FUNC)( entvars_t *pev );
typedef void (__stdcall *GIVEFNPTRSTODLL)( enginefuncs_t* engfuncs, globalvars_t *pGlobals );
#if !XASH_OPT
#if XASH_EXT_OPT != 2
edict_t *SV_EdictNum( int n )
{
if(( n >= 0 ) && ( n < GI->max_edicts ))
return svgame.edicts + n;
return NULL;
}
#endif
#ifndef NDEBUG
qboolean SV_CheckEdict( const edict_t *e, const char *file, const int line )
{
@@ -59,7 +59,7 @@ qboolean SV_CheckEdict( const edict_t *e, const char *file, const int line )
return false;
}
#endif
#endif
/*
=============
EntvarsDescription

View File

@@ -266,7 +266,7 @@ SV_ModelHandle
get model by handle
================
*/
#if XASH_OPT
#if XASH_EXT_OPT > 1
model_t *pfnSV_ModelHandle( int modelindex )
{
return SV_ModelHandle( modelindex );

View File

@@ -842,7 +842,7 @@ SV_CanPushed
filter entities for push
============
*/
#if XASH_OPT
#if XASH_EXT_OPT > 1
qboolean pfnSV_CanPushed( edict_t *ent )
{
return SV_CanPushed( ent );
@@ -947,7 +947,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
// filter movetypes to collide with
if( !SV_CanPushed( check ))
continue;
#if !XASH_OPT
#if !XASH_EXT_OPT
pusher->v.solid = SOLID_NOT;
block = SV_TestEntityPosition( check, pusher );
pusher->v.solid = oldsolid;
@@ -968,7 +968,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime )
if( !SV_TestEntityPosition( check, NULL ))
continue;
}
#if XASH_OPT
#if XASH_EXT_OPT
pusher->v.solid = SOLID_NOT;
block = SV_TestEntityPosition( check, pusher );
pusher->v.solid = oldsolid;
@@ -1072,7 +1072,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
// filter movetypes to collide with
if( !SV_CanPushed( check ))
continue;
#if !XASH_OPT
#if !XASH_EXT_OPT
pusher->v.solid = SOLID_NOT;
block = SV_TestEntityPosition( check, pusher );
pusher->v.solid = oldsolid;
@@ -1093,7 +1093,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime )
if( !SV_TestEntityPosition( check, NULL ))
continue;
}
#if XASH_OPT
#if XASH_EXT_OPT
pusher->v.solid = SOLID_NOT;
block = SV_TestEntityPosition( check, pusher );
pusher->v.solid = oldsolid;
@@ -2039,7 +2039,7 @@ static server_physics_api_t gPhysicsAPI =
SV_LinkEdict,
SV_GetServerTime,
SV_GetFrameTime,
#if XASH_OPT
#if XASH_EXT_OPT > 1
(void*)pfnSV_ModelHandle,
#else
(void*)SV_ModelHandle,

View File

@@ -32,7 +32,7 @@ half-life implementation of saverestore system
#define SAVEGAME_HEADER (('V'<<24)+('A'<<16)+('S'<<8)+'J') // little-endian "JSAV"
#define SAVEGAME_VERSION 0x0071 // Version 0.71 GoldSrc compatible
#define CLIENT_SAVEGAME_VERSION 0x0067 // Version 0.67
#ifdef XASH_PSP
#if XASH_PSP
#define SAVE_HEAPSIZE 0x200000 // reserve 2Mb for now
#else
#define SAVE_HEAPSIZE 0x400000 // reserve 4Mb for now

View File

@@ -15,7 +15,7 @@
#ifndef SPRITE_H
#define SPRITE_H
#ifdef __psp__ // GSA
#if XASH_PSP
#pragma pack(push, 1)
#endif
@@ -128,7 +128,7 @@ typedef struct
frametype_t type;
} dframetype_t;
#ifdef __psp__ // GSA
#if XASH_PSP
#pragma pack(pop)
#endif
#endif//SPRITE_H

View File

@@ -71,7 +71,6 @@ For more information, please refer to <http://unlicense.org/>
#undef XASH_WIN64
#undef XASH_X86
#undef XASH_PSP
#undef XASH_OPT
//================================================================
//
@@ -120,7 +119,6 @@ For more information, please refer to <http://unlicense.org/>
#elif defined __psp__
#define XASH_PSP 1
#define XASH_LITTLE_ENDIAN
#define XASH_OPT 1
#else
#error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug"
#endif

View File

@@ -353,7 +353,7 @@ void SinCos( float radians, float *sine, float *cosine )
"lv.s S000, %2\n" // S000 = radians
"vcst.s S001, VFPU_2_PI\n" // S001 = VFPU_2_PI = 2 / PI
"vmul.s S000, S000, S001\n" // S000 = S000 * S001
"vrot.p C002, S000, [S, C]\n" // S002 = sin( radians ), S003 = cos( radians )
"vrot.p C002, S000, [s, c]\n" // S002 = sin( radians ), S003 = cos( radians )
"sv.s S002, %0\n" // sine = S002
"sv.s S003, %1\n" // cosine = S003
".set pop\n" // restore assembler option

View File

@@ -202,6 +202,19 @@ void R_SetupDecalTextureSpaceBasis( decal_t *pDecal, msurface_t *surf, int textu
// Build the initial list of vertices from the surface verts into the global array, 'verts'.
void R_SetupDecalVertsForMSurface( decal_t *pDecal, msurface_t *surf, vec3_t textureSpaceBasis[3], float *verts )
{
#if XASH_PSP
int i;
if( !surf->polys )
return;
for( i = 0; i < surf->polys->numverts; i++, verts += VERTEXSIZE )
{
VectorCopy( surf->polys->verts[i].xyz, verts ); // copy model space coordinates
verts[3] = DotProduct( verts, textureSpaceBasis[0] ) - pDecal->dx + 0.5f;
verts[4] = DotProduct( verts, textureSpaceBasis[1] ) - pDecal->dy + 0.5f;
verts[5] = verts[6] = 0.0f;
}
#else
float *v;
int i;
@@ -214,6 +227,7 @@ void R_SetupDecalVertsForMSurface( decal_t *pDecal, msurface_t *surf, vec3_t tex
verts[4] = DotProduct( verts, textureSpaceBasis[1] ) - pDecal->dy + 0.5f;
verts[5] = verts[6] = 0.0f;
}
#endif
}
// Figure out where the decal maps onto the surface.
@@ -525,7 +539,26 @@ glpoly_t *R_DecalCreatePoly( decalinfo_t *decalinfo, decal_t *pdecal, msurface_t
v = R_DecalSetupVerts( pdecal, surf, pdecal->texture, &lnumverts );
if( !lnumverts ) return NULL; // probably this never happens
#if XASH_PSP
// allocate glpoly
// REFTODO: com_studiocache pool!
poly = Mem_Calloc( r_temppool, sizeof( glpoly_t ) + ( lnumverts * 2 - 1 ) * sizeof( gu_vert_t ));
poly->next = pdecal->polys;
poly->flags = surf->flags;
pdecal->polys = poly;
poly->numverts = lnumverts;
for( i = 0; i < lnumverts; i++, v += VERTEXSIZE )
{
poly->verts[i].uv[0] = v[3];
poly->verts[i].uv[1] = v[4];
VectorCopy( v, poly->verts[i].xyz );
poly->verts[i + lnumverts].uv[0] = v[5];
poly->verts[i + lnumverts].uv[1] = v[6];
VectorCopy( v, poly->verts[i + lnumverts].xyz );
}
#else
// allocate glpoly
// REFTODO: com_studiocache pool!
poly = Mem_Calloc( r_temppool, sizeof( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof( float ));
@@ -542,7 +575,7 @@ glpoly_t *R_DecalCreatePoly( decalinfo_t *decalinfo, decal_t *pdecal, msurface_t
poly->verts[i][5] = v[5];
poly->verts[i][6] = v[6];
}
#endif
return poly;
}
@@ -862,8 +895,18 @@ float * GAME_EXPORT R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int te
{
v = g_DecalClipVerts[0];
count = p->numverts;
#if XASH_PSP
// if we have mesh so skip clipping and just copy vertexes out (perf)
for( i = 0; i < count; i++, v += VERTEXSIZE )
{
VectorCopy( p->verts[i].xyz, v );
v[3] = p->verts[i].uv[0];
v[4] = p->verts[i].uv[1];
v[5] = p->verts[i + count].uv[0];
v[6] = p->verts[i + count].uv[1];
}
#else
v2 = p->verts[0];
// if we have mesh so skip clipping and just copy vertexes out (perf)
for( i = 0; i < count; i++, v += VERTEXSIZE, v2 += VERTEXSIZE )
{
@@ -873,7 +916,7 @@ float * GAME_EXPORT R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int te
v[5] = v2[5];
v[6] = v2[6];
}
#endif
// restore pointer
v = g_DecalClipVerts[0];
}

View File

@@ -355,9 +355,8 @@ class PSP:
def cflags(self, cxx = False):
cflags = []
cflags += ['-I%s' % (os.path.join(self.pspsdk_path, 'include'))]
# cflags += ['-I%s' % (os.path.join(self.psptoolchain_path, 'include'))]
cflags += ['-I.']
cflags += ['-D_PSP_FW_VERSION=%s' % self.fw_version, '-G0']
cflags += ['-DNDEBUG', '-D_PSP_FW_VERSION=%s' % self.fw_version, '-G0']
return cflags
# they go before object list
def linkflags(self):
@@ -374,17 +373,16 @@ class PSP:
ldflags += ['-specs=%s' % os.path.join(self.pspsdk_path, 'lib/prxspecs')]
ldflags += ['-Wl,-q,-T%s' % os.path.join(self.pspsdk_path, 'lib/linkfile.prx')]
ldflags += ['-L%s' % os.path.join(self.pspsdk_path, 'lib')]
# ldflags += ['-L%s' % os.path.join(self.psptoolchain_path, 'lib')]
ldflags += ['-L.']
# ldflags += ['-lgcc', '-no-canonical-prefixes']
return ldflags
def stdlibs(self):
stdlibs = []
stdlibs += ['-lpspdisplay', '-lpspgum_vfpu', '-lpspgu','-lpspge', '-lpspvfpu']
stdlibs += ['-lpspaudiolib', '-lpspaudio']
stdlibs += ['-lstdc++', '-lc', '-lm', '-lpspdebug', '-lpspctrl', '-lpspsdk', '-lpsprtc']
stdlibs += ['-lpspnet', '-lpspnet_inet', '-lpspnet_apctl', '-lpspnet_resolver', '-lpsputility', '-lpspuser', '-lpspkernel', '-lpsppower']
stdlibs += ['-lpspaudiolib', '-lpspaudio']
stdlibs += ['-lstdc++', '-lc', '-lm']
stdlibs += ['-lpspctrl', '-lpspdebug', '-lpsppower', '-lpspsdk', '-lpsprtc']
stdlibs += ['-lpspuser', '-lpspkernel']
return stdlibs
def options(opt):

View File

@@ -92,6 +92,9 @@ def options(opt):
grp.add_option('--low-memory-mode', action = 'store', dest = 'LOW_MEMORY', default = 0, type = 'int',
help = 'enable low memory mode (only for devices have <128 ram)')
grp.add_option('--ext-opt-mode', action = 'store', dest = 'EXT_OPT', default = 0, type = 'int',
help = 'enable extended optimization mode (only for weak devices)')
grp.add_option('--enable-magx', action = 'store_true', dest = 'MAGX', default = False,
help = 'enable targeting for MotoMAGX phones [default: %default]')
@@ -163,6 +166,7 @@ def configure(conf):
conf.options.SINGLE_BINARY = True
conf.options.NO_ASYNC_RESOLVE = True
conf.options.LOW_MEMORY = 2
conf.options.EXT_OPT = 2
conf.options.GL = True
conf.options.GL_STATIC = True
conf.options.STATIC = True
@@ -472,6 +476,9 @@ def configure(conf):
if conf.options.LOW_MEMORY:
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
if conf.options.EXT_OPT:
conf.define('XASH_EXT_OPT', conf.options.EXT_OPT)
if conf.options.PROFILING:
conf.define('XASH_PROFILING', 1)