Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSP #1585

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open

PSP #1585

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
64020b2
PSP Port initial
Crow-bar Mar 29, 2022
cd37d86
code cleanup
Crow-bar Apr 3, 2022
f5aaa58
readme: update
Crow-bar Apr 3, 2022
190279c
system user name
Crow-bar Apr 5, 2022
32e1753
mainui update
Crow-bar Apr 7, 2022
cab1876
FCVAR_GLCONFIG permission update
Crow-bar Apr 9, 2022
eea17a4
Matrix_CreateFromEntity ASM BUG
Crow-bar Apr 9, 2022
a308ce2
ref_gu: texture loader update
Crow-bar Apr 9, 2022
e7e10ac
filesystem: hold mode fix
Crow-bar Apr 10, 2022
5c244b4
filesystem: Stream_OpenWAV hold mode fix
Crow-bar Apr 11, 2022
dc22f5c
vox: MAX_SENTENCES changed to 2048
Crow-bar Apr 14, 2022
7be87a9
filesystem: small changes
Crow-bar Apr 14, 2022
2eef2ce
sound: psp sound output rewritten
Crow-bar Apr 16, 2022
13a9c41
added .vscode/ to .gitignore
Crow-bar Apr 16, 2022
5eb19c1
ref_gu: viewport bug fixed
Crow-bar Apr 24, 2022
4dfdbdd
ref_gu: unnecessary operations
Crow-bar Apr 25, 2022
2885d44
platform: 60 fps cap fix
Crow-bar May 4, 2022
90faeb2
optimization: aligned memory access, vfpu math
Crow-bar May 5, 2022
2ab8bce
ref_gu: texture min size fixed
Crow-bar May 5, 2022
fe8fea7
filesystem: added XASH_NO_ZIP define, 64 byte alignment for file buffer
Crow-bar May 13, 2022
89ec712
ref_gu: cleanup, added texture wrap mode in GL_Bind
Crow-bar May 17, 2022
07e2977
ref_gu: refactoring
Crow-bar May 24, 2022
1d71767
ref_gu: pixel converter update
Crow-bar May 25, 2022
8e8a0e4
ref_gu: optimized sprites and particles
Crow-bar May 26, 2022
6073e35
vid_psp.c: CRLF -> LF
Crow-bar May 27, 2022
8071355
ref_soft: framebuffer width fix
Crow-bar May 27, 2022
c07c135
platform: buttons layout update
Crow-bar May 27, 2022
d35330c
psp: enabled console background image
Crow-bar Jun 1, 2022
1e132bf
ref_gu: added rgb 332 format; changeable output format in R_BuildLigh…
Crow-bar Jun 1, 2022
3a3b8e2
ref_gu: triapi update
Crow-bar Jun 8, 2022
f2d59eb
ref_gu: studio model optimization
Crow-bar Jun 9, 2022
1288949
ref_gu: reducing the number of calls to CL_GetEntityLight and CL_GetD…
Crow-bar Jun 10, 2022
db9e82c
engine: CL_IsPlayerIndex macro
Crow-bar Jun 10, 2022
cbfb43f
engine: NORETURN macro disabled for PSP
Crow-bar Jun 10, 2022
1b4bc7f
platform: module loader refactoring
Crow-bar Jun 16, 2022
da695b7
engine: using MSGBOX in developer mode (Sys_Error)
Crow-bar Jun 16, 2022
da68591
ref_gu: .bss size reduction
Crow-bar Jun 16, 2022
0277700
gitignore: fix waf ignores
a1batross Jan 7, 2021
b8ff41e
psp: removed dll_psp.h
Crow-bar Aug 10, 2022
91d6fdd
psp: using the maximum amount of VRAM
Crow-bar Aug 10, 2022
bcf838c
engine: .bss size reduction for PSP
Crow-bar Aug 30, 2022
3afc713
ref_gu: efx optimization
Crow-bar Sep 5, 2022
9c61941
ref_gu: code cleanup, fix spaces and tabs, asm Matrix_FromOriginQuat
Crow-bar Sep 9, 2022
b567531
platform: PSP volatile(P5) memory allocator
Crow-bar Sep 21, 2022
b517019
platform: p5 allocator fix; ref_gu: using vram for palettes
Crow-bar Sep 21, 2022
21ed285
engine: psp filetime fix
Crow-bar Sep 21, 2022
d98330a
psp: asm code optimization
Crow-bar Sep 30, 2022
57ddff5
engine: R_BreakModel limit reduction for psp
Crow-bar Oct 2, 2022
f4ae5cf
platform: using sceKernelGetSystemTimeWide instead of sceRtcGetCurren…
Crow-bar Oct 3, 2022
1abec26
psp: fixed bug in asm code, returned vsqrt+vrcp in TransformPositiveP…
Crow-bar Oct 4, 2022
ed2ba1f
psp: additional buttons, when pressed HOME
Crow-bar Oct 4, 2022
01affdc
psp: lower sound thread priority
Crow-bar Oct 4, 2022
e66400c
engine: net_encode.c, net_buffer.c inline functions optimization
Crow-bar Oct 4, 2022
8850d2a
waf: updated build rules for psp
Crow-bar Oct 5, 2022
ef117ff
readme: psp profiling
Crow-bar Oct 5, 2022
5ad4f43
waf: self.onlypsp fixed
Crow-bar Oct 5, 2022
3b50fde
ref_gu: menu freeze fix
Crow-bar Oct 6, 2022
f8452b8
ref_gu: R_TextureList_f total size fix
Crow-bar Oct 6, 2022
40dca1e
ref_gu: vsync fix
Crow-bar Oct 6, 2022
f70938d
ref_gl: ref_soft: ref_gu: engine: TriAPI update
Crow-bar Oct 10, 2022
122a110
imagelib: hardware palette support for tga
Crow-bar Oct 10, 2022
a375adb
ref_gu: skybox_ext reordering
Crow-bar Oct 10, 2022
bdc2009
server: minor fix for inline functions
Crow-bar Oct 12, 2022
53d44f4
paltform: psp filesystem helper
Crow-bar Oct 13, 2022
3889ed8
engine: using sceIoRemove() instead of remove() for psp
Crow-bar Oct 14, 2022
a440d1f
paltform: psp filesystem helper update
Crow-bar Oct 18, 2022
c6520b8
server: sv_save.c: checking P5Ram_Alloc results; memory leak fix
Crow-bar Oct 18, 2022
4e78898
Merge branch 'psp-cachedfs' into psp
Crow-bar Oct 18, 2022
5832d01
Merge branch 'psp-triapi' into psp
Crow-bar Oct 18, 2022
238687a
Merge branch 'psp-tgapal' into psp
Crow-bar Oct 18, 2022
5559f72
waf: psp profiling flags for c++
Crow-bar Oct 19, 2022
f5ca017
engine: DSP optimization
Crow-bar Oct 20, 2022
89ee68d
ref_gu: depth bug fixed, sort code removed
Crow-bar Oct 20, 2022
d6d8ee3
ref_gu: updated initial GU settings
Crow-bar Oct 20, 2022
da16110
ref_gu: correct ONE/ZERO modifier for sceGuBlendFunc
Crow-bar Oct 20, 2022
e3e5fe8
platform: psp filesystem helper strip_path
Crow-bar Oct 31, 2022
0b50016
ref_gu: gl_nosort cvar removed
Crow-bar Oct 31, 2022
066d87f
ref_gu: depth mask returned
Crow-bar Oct 31, 2022
1704712
platform: psp fixed issues with libc
Crow-bar Nov 2, 2022
0dc1c13
engine: psp Adrenaline bug
Crow-bar Nov 2, 2022
28723b0
platform: psp PATH_MAX fix
Crow-bar Nov 2, 2022
e6a9724
platform: psp joystick curve support
Crow-bar Nov 2, 2022
15ea61e
psp: mainui update
Crow-bar Nov 11, 2022
3ccb156
platform: using hw psp mp3 decoder for streams
Crow-bar Nov 21, 2022
d419921
engine: psp filesystem fix
Crow-bar Dec 6, 2022
9812a91
ref_gu: clipping code update
Crow-bar Dec 7, 2022
cae351f
engine: psp math optimization, QuaternionSlerp, BoundsIntersect, Mod_…
Crow-bar Dec 20, 2022
8044646
First merge attempt (many PSP tunings are missing, as they are outdat…
a1batross Jan 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ This repository contains our fork of HLSDK and restored source code for some of
* Clone this repostory:
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`

#### PSP
* Build pspsdk(GCC 9.3) from https://github.com/pspdev
* Clone this repository: `git clone --recursive https://github.com/Crow-bar/xash3d-fwgs`.

### Building
#### Windows (Visual Studio)
0) Open command line
Expand All @@ -90,3 +94,20 @@ If compiling 32-bit on amd64, you may need to supply `export PKG_CONFIG_PATH=/us
(You need to pass `-8` to compile 64-bit engine on 64-bit x86 processor)
2) Compile: `./waf build`
3) Install(optional): `./waf install --destdir=/path/to/any/output/directory`

#### PSP
0) Navigate to `xash3d-fwgs` directory.
1) Examine which build options are available: `./waf --help`
2) Configure build:
Normal: `./waf configure -T fast --psp=prx,660,HW --prefix=/path/to/any/output/directory`
Profiling: `./waf configure -T debug --psp=elf,660,HW --enable-profiling --prefix=/path/to/any/output/directory`
3) Compile: `./waf build`
4) Install(optional): `./waf install`


## Running
0) Copy libraries and main executable somewhere, if you're skipped installation stage.
1) Copy game files to same directory
2) Run `xash3d.exe`/`xash3d.sh`/`xash3d` depending on which platform you're using.

For additional info, run Xash3D with `-help` command line key.
12 changes: 9 additions & 3 deletions common/backends.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,40 @@ GNU General Public License for more details.
#define VIDEO_SDL 1
#define VIDEO_FBDEV 3
#define VIDEO_DOS 4
#define VIDEO_PSP 5

// audio backends (XASH_SOUND)
#define SOUND_NULL 0
#define SOUND_SDL 1
#define SOUND_ALSA 3
#define SOUND_PSP 4

// input (XASH_INPUT)
#define INPUT_NULL 0
#define INPUT_SDL 1
#define INPUT_EVDEV 3
#define INPUT_PSP 4

// timer (XASH_TIMER)
#define TIMER_NULL 0 // not used
#define TIMER_SDL 1
#define TIMER_POSIX 2
#define TIMER_WIN32 3
#define TIMER_DOS 4
#define TIMER_PSP 5

// messageboxes (XASH_MESSAGEBOX)
#define MSGBOX_STDERR 0
#define MSGBOX_SDL 1
#define MSGBOX_WIN32 3
#define MSGBOX_NSWITCH 4
#define MSGBOX_PSP 5

// library loading (XASH_LIB)
#define LIB_NULL 0
#define LIB_POSIX 1
#define LIB_WIN32 2
#define LIB_NULL 0
#define LIB_POSIX 1
#define LIB_WIN32 2
#define LIB_STATIC 3
#define LIB_PSP 4

#endif /* BACKENDS_H */
5 changes: 5 additions & 0 deletions common/com_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ NOTE: number at end of pixelformat name it's a total bitscount e.g. PF_RGB_24 ==
|| type == PF_BC7_UNORM \
|| type == PF_BC7_SRGB \
|| type == PF_KTX2_RAW )
#define ImageIND( type ) (type == PF_INDEXED_32 || type == PF_INDEXED_24)

typedef enum
{
Expand All @@ -33,6 +34,10 @@ typedef enum
PF_BGRA_32, // big endian RGBA (MacOS)
PF_RGB_24, // uncompressed dds or another 24-bit image
PF_BGR_24, // big-endian RGB (MacOS)
PF_RGB_332, // 8-bit R3 G3 B2
PF_RGB_5650, // 16-bit R5 G6 B5
PF_RGBA_5551, // 16-bit R5 G5 B5 A1
PF_RGBA_4444, // 16-bit R4 G4 B4 A4
PF_LUMINANCE,
PF_DXT1, // s3tc DXT1/BC1 format
PF_DXT3, // s3tc DXT3/BC2 format
Expand Down
17 changes: 16 additions & 1 deletion common/com_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,21 @@ typedef struct
int flags; // sky or slime, no lightmap or 256 subdivision
} mtexinfo_t;

#if XASH_PSP
typedef struct
{
float uv[2];
float xyz[3];
}gu_vert_t;
typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER
gu_vert_t verts[1]; // variable sized (xyz s1t1 + lm(xyz s2t2))
} glpoly_t;
#else
typedef struct glpoly_s
{
struct glpoly_s *next;
Expand All @@ -135,7 +150,7 @@ typedef struct glpoly_s
int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;

#endif
typedef struct mnode_s
{
// common with leaf
Expand Down
44 changes: 43 additions & 1 deletion common/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ SETUP BACKENDS DEFINITIONS

// usually only 10-20 fds availiable
#define XASH_REDUCE_FD
#elif XASH_PSP
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_PSP
#endif

#ifndef XASH_TIMER
#define XASH_TIMER TIMER_PSP
#endif

#ifndef XASH_INPUT
#define XASH_INPUT INPUT_PSP
#endif

#ifndef XASH_SOUND
#define XASH_SOUND SOUND_PSP
#endif // XASH_SOUND

#ifndef XASH_MESSAGEBOX
#define XASH_MESSAGEBOX MSGBOX_PSP
#endif // XASH_MESSAGEBOX

#define XASH_REDUCE_FD
#define XASH_NO_TOUCH
#define XASH_NO_ZIP
#endif

#endif // XASH_DEDICATED
Expand Down Expand Up @@ -105,14 +129,16 @@ SETUP BACKENDS DEFINITIONS
#endif // !XASH_WIN32
#endif

#ifdef XASH_STATIC_LIBS
#if defined(XASH_STATIC_LIBS) && !XASH_PSP
#define XASH_LIB LIB_STATIC
#define XASH_INTERNAL_GAMELIBS
#define XASH_ALLOW_SAVERESTORE_OFFSETS
#elif XASH_WIN32
#define XASH_LIB LIB_WIN32
#elif XASH_POSIX
#define XASH_LIB LIB_POSIX
#elif XASH_PSP
#define XASH_LIB LIB_PSP
#endif

//
Expand Down Expand Up @@ -193,4 +219,20 @@ Default build-depended cvar and constant values
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
#endif // DEFAULT_MAX_EDICTS

#ifndef DEFAULT_ACCELERATED_RENDERER
#ifdef XASH_PSP
#define DEFAULT_ACCELERATED_RENDERER "gu"
#else
#if XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gles1"
#else // !XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gl"
#endif // !XASH_MOBILE_PLATFORM
#endif
#endif // DEFAULT_ACCELERATED_RENDERER

#ifndef DEFAULT_SOFTWARE_RENDERER
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
#endif // DEFAULT_SOFTWARE_RENDERER

#endif // DEFAULTS_H
14 changes: 13 additions & 1 deletion common/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ GNU General Public License for more details.
#include <sys/syslimits.h>
#define OS_LIB_EXT "dylib"
#define OPEN_COMMAND "open"
#else
#elif XASH_PSP
#define OS_LIB_EXT "prx"
#else
#define OS_LIB_EXT "so"
#define OPEN_COMMAND "xdg-open"
#endif
Expand Down Expand Up @@ -55,6 +57,16 @@ GNU General Public License for more details.
#define _mkdir( x ) mkdir( x, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH )
#endif

#if XASH_PSP
#include <unistd.h>
#include <pspiofilemgr.h>

#define O_BINARY 0
#define O_TEXT 0

#define _mkdir( x ) sceIoMkdir( x, FIO_S_IRWXU | FIO_S_IRWXG | FIO_S_IROTH | FIO_S_IXOTH )
#endif

typedef void* HANDLE;
typedef void* HINSTANCE;

Expand Down
5 changes: 5 additions & 0 deletions common/render_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ typedef enum
TF_TEXTURE_3D = (1<<20), // this is GL_TEXTURE_3D
TF_ATLAS_PAGE = (1<<21), // bit who indicate lightmap page or deluxemap page
TF_ALPHACONTRAST = (1<<22), // special texture mode for A2C
#if XASH_PSP
TF_IMG_SWIZZLED = (1<<23),
TF_IMG_INVRAM = (1<<24),
#else
// reserved
// reserved
#endif
TF_IMG_UPLOADED = (1<<25), // this is set for first time when called glTexImage, otherwise it will be call glTexSubImage
TF_ARB_FLOAT = (1<<26), // float textures
TF_NOCOMPARE = (1<<27), // disable comparing for depth textures
Expand Down
14 changes: 14 additions & 0 deletions common/xash3d_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,22 @@ typedef int sound_t;
typedef float vec_t;
typedef vec_t vec2_t[2];
typedef vec_t vec3_t[3];
#if XASH_PSP
typedef vec_t vec4_t[4] __attribute__( ( aligned( 16 ) ) );
typedef vec_t quat_t[4] __attribute__( ( aligned( 16 ) ) );
#else
typedef vec_t vec4_t[4];
typedef vec_t quat_t[4];
#endif
typedef byte rgba_t[4]; // unsigned byte colorpack
typedef byte rgb_t[3]; // unsigned byte colorpack
#if XASH_PSP
typedef vec_t matrix3x4[3][4] __attribute__( ( aligned( 16 ) ) );
typedef vec_t matrix4x4[4][4] __attribute__( ( aligned( 16 ) ) );
#else
typedef vec_t matrix3x4[3][4];
typedef vec_t matrix4x4[4][4];
#endif

#if XASH_64BIT
typedef uint32_t poolhandle_t;
Expand Down Expand Up @@ -194,13 +204,17 @@ typedef void *(*pfnCreateInterface_t)( const char *, int * );
// config strings are a general means of communication from
// the server to all connected clients.
// each config string can be at most CS_SIZE characters.
#if XASH_PSP
#define MAX_QPATH 48
#else
#if XASH_LOW_MEMORY == 0
#define MAX_QPATH 64 // max length of a game pathname
#elif XASH_LOW_MEMORY == 2
#define MAX_QPATH 32 // should be enough for singleplayer
#elif XASH_LOW_MEMORY == 1
#define MAX_QPATH 48
#endif
#endif
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define CS_SIZE 64 // size of one config string
#define CS_TIME 16 // size of time string
Expand Down
12 changes: 0 additions & 12 deletions engine/client/cl_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ GNU General Public License for more details.

// #define STUDIO_INTERPOLATION_FIX

/*
==================
CL_IsPlayerIndex

detect player entity
==================
*/
qboolean CL_IsPlayerIndex( int idx )
{
return ( idx >= 1 && idx <= cl.maxclients );
}

/*
=========================================================================

Expand Down
38 changes: 1 addition & 37 deletions engine/client/cl_game.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,6 @@ static dllfunc_t cdll_new_exports[] = // allowed only in SDK 2.3 and higher

static void pfnSPR_DrawHoles( int frame, int x, int y, const wrect_t *prc );

/*
====================
CL_GetEntityByIndex

Render callback for studio models
====================
*/
cl_entity_t *CL_GetEntityByIndex( int index )
{
if( !clgame.entities ) // not in game yet
return NULL;

if( index < 0 || index >= clgame.maxEntities )
return NULL;

if( index == 0 )
return clgame.entities;

return CL_EDICT_NUM( index );
}

/*
================
CL_ModelHandle

get model handle by index
================
*/
model_t *CL_ModelHandle( int modelindex )
{
if( modelindex < 0 || modelindex >= MAX_MODELS )
return NULL;
return cl.models[modelindex];
}

/*
====================
CL_IsThirdPerson
Expand Down Expand Up @@ -939,7 +904,7 @@ void CL_DrawCrosshair( void )
VectorAdd( refState.viewangles, cl.crosshairangle, angles );
AngleVectors( angles, forward, NULL, NULL );
VectorAdd( refState.vieworg, forward, point );
ref.dllFuncs.WorldToScreen( point, screen );
gTriApi.WorldToScreen( point, screen );

x += ( clgame.viewport[2] >> 1 ) * screen[0] + 0.5f;
y += ( clgame.viewport[3] >> 1 ) * screen[1] + 0.5f;
Expand Down Expand Up @@ -1084,7 +1049,6 @@ void CL_ClearWorld( void )

world.max_recursion = 0;

clgame.ds.cullMode = TRI_FRONT;
clgame.numStatics = 0;
}

Expand Down
12 changes: 6 additions & 6 deletions engine/client/cl_netgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ NetGraph_FillRGBA shortcut
*/
static void NetGraph_DrawRect( wrect_t *rect, byte colors[4] )
{
ref.dllFuncs.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad
gTriApi.Color4ub( colors[0], colors[1], colors[2], colors[3] ); // color for this quad

ref.dllFuncs.Vertex3f( rect->left, rect->top, 0 );
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top, 0 );
ref.dllFuncs.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
ref.dllFuncs.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
gTriApi.Vertex3f( rect->left, rect->top, 0 );
gTriApi.Vertex3f( rect->left + rect->right, rect->top, 0 );
gTriApi.Vertex3f( rect->left + rect->right, rect->top + rect->bottom, 0 );
gTriApi.Vertex3f( rect->left, rect->top + rect->bottom, 0 );
}

/*
Expand Down Expand Up @@ -691,7 +691,7 @@ void SCR_DrawNetGraph( void )

ref.dllFuncs.End();
ref.dllFuncs.Color4ub( 255, 255, 255, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderNormal );
ref.dllFuncs.RenderMode( kRenderNormal );
}
}

Expand Down
Loading
Loading