diff --git a/common/defaults.h b/common/defaults.h index bd76b244..25dfec79 100644 --- a/common/defaults.h +++ b/common/defaults.h @@ -171,6 +171,7 @@ Default build-depended cvar and constant values #define DEFAULT_MODE_WIDTH 960 #define DEFAULT_MODE_HEIGHT 544 #define DEFAULT_ALLOWCONSOLE 1 + #define DEFAULT_DEV 255 #elif XASH_MOBILE_PLATFORM #define DEFAULT_TOUCH_ENABLE "1" #define DEFAULT_M_IGNORE "1" diff --git a/engine/platform/psvita/sys_psvita.c b/engine/platform/psvita/sys_psvita.c index 296ee64f..772c53de 100644 --- a/engine/platform/psvita/sys_psvita.c +++ b/engine/platform/psvita/sys_psvita.c @@ -20,15 +20,34 @@ GNU General Public License for more details. #include #include #include +#include #include #define DATA_PATH "data/xash3d" +// 200MB libc heap, 512K main thread stack, 32MB for loading game DLLs, 8MB vertex pool +// the rest goes to vitaGL +SceUInt32 sceUserMainThreadStackSize = 512 * 1024; +unsigned int _pthread_stack_default_user = 512 * 1024; +unsigned int _newlib_heap_size_user = 200 * 1024 * 1024; +#define VGL_MEM_THRESHOLD ( 32 * 1024 * 1024 ) +#define VGL_VERTEX_POOL_SIZE ( 8 * 1024 * 1024 ) + +/* HACK: stubs for GL functions that are missing from vitaGL */ + +static void glDrawBuffer( GLenum which ) +{ + /* nada */ +} + +/* end of GL stubs*/ + /* HACKHACK: force-export stuff required by the dynamic libs */ extern void *__aeabi_idiv; extern void *__aeabi_uidiv; extern void *__aeabi_idivmod; +extern void *__aeabi_uidivmod; extern void *__aeabi_d2ulz; extern void *__aeabi_ul2d; @@ -37,19 +56,27 @@ static const vrtld_export_t aux_exports[] = VRTLD_EXPORT_SYMBOL( __aeabi_d2ulz ), VRTLD_EXPORT_SYMBOL( __aeabi_idiv ), VRTLD_EXPORT_SYMBOL( __aeabi_idivmod ), + VRTLD_EXPORT_SYMBOL( __aeabi_uidivmod ), VRTLD_EXPORT_SYMBOL( __aeabi_uidiv ), VRTLD_EXPORT_SYMBOL( __aeabi_ul2d ), VRTLD_EXPORT_SYMBOL( ctime ), VRTLD_EXPORT_SYMBOL( vasprintf ), + VRTLD_EXPORT_SYMBOL( vsprintf ), VRTLD_EXPORT_SYMBOL( vprintf ), VRTLD_EXPORT_SYMBOL( printf ), VRTLD_EXPORT_SYMBOL( putchar ), VRTLD_EXPORT_SYMBOL( puts ), VRTLD_EXPORT_SYMBOL( tolower ), VRTLD_EXPORT_SYMBOL( toupper ), + VRTLD_EXPORT_SYMBOL( isalnum ), + VRTLD_EXPORT_SYMBOL( isalpha ), VRTLD_EXPORT_SYMBOL( strchrnul ), VRTLD_EXPORT_SYMBOL( rand ), VRTLD_EXPORT_SYMBOL( srand ), + VRTLD_EXPORT_SYMBOL( glDrawBuffer ), + VRTLD_EXPORT( "dlopen", vrtld_dlopen ), + VRTLD_EXPORT( "dlclose", vrtld_dlclose ), + VRTLD_EXPORT( "dlsym", vrtld_dlsym ), }; const vrtld_export_t *__vrtld_exports = aux_exports; @@ -57,9 +84,6 @@ const size_t __vrtld_num_exports = sizeof( aux_exports ) / sizeof( *aux_exports /* end of export crap */ -SceUInt32 sceUserMainThreadStackSize = 1 * 1024 * 1024; -unsigned int _newlib_heap_size_user = 128 * 1024 * 1024; - void Platform_ShellExecute( const char *path, const char *parms ) { Con_Reportf( S_WARN "Tried to shell execute ;%s; -- not supported\n", path ); @@ -87,6 +111,12 @@ void PSVita_Init( void ) { Sys_Error( "Could not init vrtld: %s\n", vrtld_dlerror( ) ); } + + // init vitaGL with some memory budget for immediate mode vertices + // TODO: we don't need to do this for ref_soft + vglUseVram( GL_TRUE ); + vglUseExtraMem( GL_TRUE ); + vglInitExtended( VGL_VERTEX_POOL_SIZE, 960, 544, VGL_MEM_THRESHOLD, 0 ); } void PSVita_Shutdown( void ) diff --git a/engine/platform/sdl/vid_sdl.c b/engine/platform/sdl/vid_sdl.c index 3383fe56..f2412854 100644 --- a/engine/platform/sdl/vid_sdl.c +++ b/engine/platform/sdl/vid_sdl.c @@ -424,6 +424,14 @@ void *GL_GetProcAddress( const char *name ) { void *func = SDL_GL_GetProcAddress( name ); +#if XASH_PSVITA + // try to find in main module + if( !func ) + { + func = dlsym( NULL, name ); + } +#endif + if( !func ) { Con_Reportf( S_ERROR "GL_GetProcAddress failed for %s\n", name ); diff --git a/engine/wscript b/engine/wscript index 7878f0f1..23490ac0 100644 --- a/engine/wscript +++ b/engine/wscript @@ -199,7 +199,7 @@ def build(bld): libs += [ 'VRTLD' ] source += bld.path.ant_glob(['platform/posix/*.c']) source += bld.path.ant_glob(['platform/psvita/*.c']) - # HACK: link in the entirety of libstdc++ and -lm so that dynamic libs could use all of them without manual exporting + # HACK: link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting # also link in all the funky dependencies that aren't in SDL2's LDFLAGS bld.env.LDFLAGS += [ '-Wl,--whole-archive', @@ -207,10 +207,10 @@ def build(bld): '-lpthread', '-Wl,--no-whole-archive', '-lm', - '-lkubridge_stub', '-lSceShaccCgExt', - '-lSceShaccCg_stub', + '-lkubridge_stub', '-ltaihen_stub', + '-lSceShaccCg_stub', '-lSceKernelModulemgr_stub', '-lSceSblSsMgr_stub', '-lSceVshBridge_stub', diff --git a/scripts/waifulib/xcompile.py b/scripts/waifulib/xcompile.py index 8cd9d1a9..483ef2b3 100644 --- a/scripts/waifulib/xcompile.py +++ b/scripts/waifulib/xcompile.py @@ -480,7 +480,7 @@ class PSVita: # this optimization is broken in vitasdk cflags += ['-fno-optimize-sibling-calls'] # disable some ARM bullshit - cflags += ['-fsigned-char', '-Wno-attributes'] + cflags += ['-fsigned-char', '-fno-short-enums', '-Wno-attributes'] # base include dir cflags += ['-isystem %s/arm-vita-eabi/include' % self.vitasdk_dir] # SDL include dir @@ -495,6 +495,8 @@ class PSVita: # they go before object list def linkflags(self): linkflags = ['-Wl,--hash-style=sysv', '-Wl,-q', '-Wl,-z,nocopyreloc', '-mtune=cortex-a9', '-mfpu=neon'] + # enforce no-short-enums again + linkflags += ['-Wl,-no-enum-size-warning', '-fno-short-enums'] return linkflags def ldflags(self):