common: add PSP platform definitions

This commit is contained in:
Alibek Omarov
2025-10-11 05:44:31 +05:00
parent 654d7013c6
commit 6c3ae914fa
4 changed files with 83 additions and 67 deletions

View File

@@ -18,17 +18,20 @@ GNU General Public License for more details.
// video backends (XASH_VIDEO)
#define VIDEO_NULL 0
#define VIDEO_SDL 1
#define VIDEO_PSP 2
#define VIDEO_FBDEV 3
#define VIDEO_DOS 4
// audio backends (XASH_SOUND)
#define SOUND_NULL 0
#define SOUND_SDL 1
#define SOUND_PSP 2
#define SOUND_ALSA 3
// input (XASH_INPUT)
#define INPUT_NULL 0
#define INPUT_SDL 1
#define INPUT_PSP 2
#define INPUT_EVDEV 3
// timer (XASH_TIMER)
@@ -37,10 +40,12 @@ GNU General Public License for more details.
#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_PSP 2
#define MSGBOX_WIN32 3
#define MSGBOX_NSWITCH 4
@@ -49,6 +54,7 @@ GNU General Public License for more details.
#define LIB_POSIX 1
#define LIB_WIN32 2
#define LIB_STATIC 3
#define LIB_PSP 4
// movies (XASH_AVI)
#define AVI_NULL 0

View File

@@ -26,68 +26,44 @@ SETUP BACKENDS DEFINITIONS
===================================================================
*/
#if !XASH_DEDICATED
#if XASH_SDL
// we are building using libSDL
#ifndef XASH_VIDEO
//
// when compiling client, we need to pick video, audio and input implementations
//
#if !XASH_DEDICATED // when compiling client, we need to pick video, audio and input implementations
#if XASH_SDL // we are building with SDL
#define XASH_VIDEO VIDEO_SDL
#endif // XASH_VIDEO
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_SDL
#endif // XASH_INPUT
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_SDL
#endif // XASH_SOUND
#if XASH_SDL == 2
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_SDL
#endif // XASH_TIMER
#ifndef XASH_MESSAGEBOX
#if !XASH_NSWITCH // SDL2 messageboxes not available
#define XASH_MESSAGEBOX MSGBOX_SDL
#endif
#endif // XASH_MESSAGEBOX
#endif
#elif XASH_LINUX
// we are building for Linux without SDL2, can draw only to framebuffer yet
#ifndef XASH_VIDEO
#elif XASH_LINUX // we are building for Linux without SDL, only framebuffer is supported for now
#define XASH_VIDEO VIDEO_FBDEV
#endif // XASH_VIDEO
#ifndef XASH_INPUT
#define XASH_INPUT INPUT_EVDEV
#endif // XASH_INPUT
#ifndef XASH_SOUND
#define XASH_SOUND SOUND_ALSA
#endif // XASH_SOUND
#define XASH_USE_EVDEV 1
#elif XASH_DOS4GW
#ifndef XASH_VIDEO
#define XASH_VIDEO VIDEO_DOS
#define XASH_REDUCE_FD 1 // usually only 10-20 fds available
#elif XASH_PSP
#define XASH_VIDEO VIDEO_PSP
#define XASH_INPUT INPUT_PSP
#define XASH_SOUND SOUND_PSP
#define XASH_REDUCE_FD 1
#define XASH_NO_TOUCH 1
#define XASH_NO_ZIP 1
#endif
#ifndef XASH_TIMER
#define XASH_TIMER TIMER_DOS
#endif
// usually only 10-20 fds availiable
#define XASH_REDUCE_FD
#endif
#endif // XASH_DEDICATED
#endif // !XASH_DEDICATED
//
// select messagebox implementation
//
#ifndef XASH_MESSAGEBOX
#if XASH_WIN32
#if XASH_SDL == 2 && !XASH_NSWITCH // SDL2 messageboxes are not available on NSW
#define XASH_MESSAGEBOX MSGBOX_SDL
#elif XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_WIN32
#elif XASH_NSWITCH
#define XASH_MESSAGEBOX MSGBOX_NSWITCH
#elif XASH_PSP
#define XASH_MESSAGEBOX MSGBOX_PSP
#else // !XASH_WIN32
#define XASH_MESSAGEBOX MSGBOX_STDERR
#endif // !XASH_WIN32
@@ -97,8 +73,14 @@ SETUP BACKENDS DEFINITIONS
// no timer - no xash
//
#ifndef XASH_TIMER
#if XASH_WIN32
#if XASH_SDL == 2
#define XASH_TIMER TIMER_SDL
#elif XASH_WIN32
#define XASH_TIMER TIMER_WIN32
#elif XASH_DOS4GW
#define XASH_TIMER TIMER_DOS
#elif XASH_PSP
#define XASH_TIMER TIMER_PSP
#else // !XASH_WIN32
#define XASH_TIMER TIMER_POSIX
#endif // !XASH_WIN32
@@ -115,7 +97,9 @@ SETUP BACKENDS DEFINITIONS
#endif
#endif
#ifdef XASH_STATIC_LIBS
#if XASH_PSP
#define XASH_PSP LIB_PSP
#elif defined( XASH_STATIC_LIBS )
#define XASH_LIB LIB_STATIC
#define XASH_INTERNAL_GAMELIBS
#define XASH_ALLOW_SAVERESTORE_OFFSETS
@@ -203,4 +187,19 @@ Default build-depended cvar and constant values
#define DEFAULT_MAX_EDICTS 1200 // was 900 before HL25
#endif // DEFAULT_MAX_EDICTS
#ifndef DEFAULT_ACCELERATED_RENDERER
#if XASH_PSP
#define DEFAULT_ACCELERATED_RENDERER "gu"
#elif XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gles1"
#else // !XASH_MOBILE_PLATFORM
#define DEFAULT_ACCELERATED_RENDERER "gl"
#endif // !XASH_MOBILE_PLATFORM
#endif // DEFAULT_ACCELERATED_RENDERER
#ifndef DEFAULT_SOFTWARE_RENDERER
#define DEFAULT_SOFTWARE_RENDERER "soft" // mittorn's ref_soft
#endif // DEFAULT_SOFTWARE_RENDERER
#endif // DEFAULTS_H

View File

@@ -48,6 +48,8 @@ GNU General Public License for more details.
#define OS_LIB_PREFIX ""
#define OS_LIB_EXT "dll"
#define OPEN_COMMAND "open"
#elif XASH_PSP
#define OS_LIB_EXT "prx"
#endif
#if !defined( _MSC_VER )

View File

@@ -16,18 +16,27 @@
#define CS_SIZE 64 // size of one config string
#define CS_TIME 16 // size of time string
// platform-specific alignment for types, to not break ABI
#if XASH_PSP
#define MAYBE_ALIGNED( x ) __attribute__(( aligned( 16 )))
#endif
#if !defined( MAYBE_ALIGNED )
#define MAYBE_ALIGNED( x )
#endif // !defined( MAYBE_ALIGNED )
typedef uint8_t byte;
typedef float vec_t;
typedef vec_t vec2_t[2];
#ifndef vec3_t // SDK renames it to Vector
typedef vec_t vec3_t[3];
#endif
typedef vec_t vec4_t[4];
typedef vec_t quat_t[4];
typedef vec_t vec4_t[4] MAYBE_ALIGNED( 16 );
typedef vec_t quat_t[4] MAYBE_ALIGNED( 16 );
typedef byte rgba_t[4]; // unsigned byte colorpack
typedef byte rgb_t[3]; // unsigned byte colorpack
typedef vec_t matrix3x4[3][4];
typedef vec_t matrix4x4[4][4];
typedef vec_t matrix3x4[3][4] MAYBE_ALIGNED( 16 );
typedef vec_t matrix4x4[4][4] MAYBE_ALIGNED( 16 );
typedef uint32_t poolhandle_t;
typedef uint32_t dword;
typedef char string[MAX_STRING];
@@ -49,7 +58,7 @@ enum { false, true };
#endif
typedef int qboolean;
#if XASH_LOW_MEMORY == 1
#if XASH_LOW_MEMORY == 1 || XASH_PSP
#define MAX_QPATH 48
#define MAX_MODS 16
#elif XASH_LOW_MEMORY == 2