Browse Source

psvita: fno-short-enums, make ref_gl function somewhat

pull/2/head
fgsfds 2 years ago committed by Alibek Omarov
parent
commit
6304b51f32
  1. 1
      common/defaults.h
  2. 36
      engine/platform/psvita/sys_psvita.c
  3. 8
      engine/platform/sdl/vid_sdl.c
  4. 6
      engine/wscript
  5. 4
      scripts/waifulib/xcompile.py

1
common/defaults.h

@ -171,6 +171,7 @@ Default build-depended cvar and constant values @@ -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"

36
engine/platform/psvita/sys_psvita.c

@ -20,15 +20,34 @@ GNU General Public License for more details. @@ -20,15 +20,34 @@ GNU General Public License for more details.
#include <time.h>
#include <ctype.h>
#include <vitasdk.h>
#include <vitaGL.h>
#include <vrtld.h>
#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[] = @@ -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 @@ -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 ) @@ -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 )

8
engine/platform/sdl/vid_sdl.c

@ -424,6 +424,14 @@ void *GL_GetProcAddress( const char *name ) @@ -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 );

6
engine/wscript

@ -199,7 +199,7 @@ def build(bld): @@ -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): @@ -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',

4
scripts/waifulib/xcompile.py

@ -480,7 +480,7 @@ class PSVita: @@ -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: @@ -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):

Loading…
Cancel
Save