Commit 5bdc11f3 authored by Rinnegatamante's avatar Rinnegatamante
Browse files

Fixed shared library loading for UI libraries.

parent ce0b62ff
TARGET := qagame
SOURCES := .
CPPSOURCES :=
INCLUDES := ../renderer ../qcommon ../botlib ../client ../server ../psp2 ../sys ../game
INCLUDES := ../renderercommon ../renderergl1 ../qcommon ../botlib ../client ../server ../psp2 ../sys ../game
SOURCE_EXTRA := ../psp2/psp2_dll_hacks.c
LIBS = -lc -lm -lSceNet_stub_weak -lSceNetCtl_stub_weak \
......
......@@ -2,6 +2,7 @@ TARGET := ui
SOURCES := .
CPPSOURCES :=
INCLUDES := ../renderercommon ../renderergl1 ../qcommon ../botlib ../client ../server ../psp2 ../sys ../game
SOURCE_EXTRA := ../psp2/psp2_dll_hacks.c
LIBS = -lSceCommonDialog_stub -lSceAudio_stub -lSceLibKernel_stub \
-lSceNet_stub -lSceNetCtl_stub -lSceDisplay_stub -lSceGxm_stub \
......@@ -23,7 +24,7 @@ CFLAGS = $(INCLUDE) -D__PSP2__ -D__FLOAT_WORD_ORDER=1 -D__GNU__ -DRELEASE \
-DDEFAULT_BASEDIR=\"ux0:/data/iortcw\" -fno-lto \
-DPRODUCT_VERSION=\"1.36_GIT_ba68b99c-2018-01-23\" -DHAVE_VM_COMPILED=true \
-mfpu=neon -mcpu=cortex-a9 -fsigned-char -nostartfiles \
-Wl,-q -O3 -g -ffast-math -fno-short-enums
-Wl,-q -O3 -g -ffast-math -fno-short-enums -include "../psp2/psp2_dll_defs.h"
CXXFLAGS = $(CFLAGS) -fno-exceptions -std=gnu++11 -fpermissive
ASFLAGS = $(CFLAGS)
......
#include <stdint.h>
#include <vitasdk.h>
#include <stdio.h>
#include <stdlib.h>
void* __dso_handle = (void*) &__dso_handle;
extern void _init_vita_reent( void );
extern void _free_vita_reent( void );
extern void _init_vita_heap( void );
extern void _free_vita_heap( void );
typedef struct sysfuncs_s
{
// mem
void* (*pfnSysMalloc)(size_t);
void* (*pfnSysCalloc)(size_t, size_t);
void* (*pfnSysRealloc)(void*, size_t);
void (*pfnSysFree)(void*);
// i/o
FILE* (*pfnSysFopen)(const char*, const char*);
int (*pfnSysFclose)(FILE*);
int (*pfnSysFseek)(FILE*, long int, int);
long int (*pfnSysFtell)(FILE*);
int (*pfnSysFprintf)(FILE*, const char*, ...);
size_t (*pfnSysFread)(void*, size_t, size_t, FILE*);
size_t (*pfnSysFwrite)(const void*, size_t, size_t, FILE*);
int (*pfnSprintf)(char*,const char*,...);
size_t (*pfnSysSnprintf)(char*,size_t,const char*,...);
} sysfuncs_t;
extern void __libc_init_array( void );
extern void __libc_fini_array( void );
void _init_vita_newlib( void )
{
_init_vita_heap( );
_init_vita_reent( );
}
void _free_vita_newlib( void )
{
_free_vita_reent( );
_free_vita_heap( );
}
void _fini( void ) { }
void _init( void ) { }
// small heap for internal libc use
unsigned int _newlib_heap_size_user = 2 * 1024 * 1024;
//////////////////////////////////////
typedef struct dllexport_s
{
const char *name;
void *func;
} dllexport_t;
typedef struct modarg_s
{
sysfuncs_t imports;
dllexport_t *exports;
} modarg_t;
extern void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) );
extern intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9, intptr_t arg10, intptr_t arg11 );
static dllexport_t psp2_exports[] =
{
{ "dllEntry", (void*)dllEntry },
{ "vmMain", (void*)vmMain },
{ NULL, NULL },
};
int module_stop( SceSize argc, const void *args )
{
__libc_fini_array( );
_free_vita_newlib( );
return SCE_KERNEL_STOP_SUCCESS;
}
int module_exit( )
{
__libc_fini_array( );
_free_vita_newlib( );
return SCE_KERNEL_STOP_SUCCESS;
}
void _start() __attribute__ ((weak, alias ("module_start")));
int module_start( SceSize argc, void *args )
{
_init_vita_newlib( );
__libc_init_array( );
modarg_t *arg = *(modarg_t **)args;
arg->exports = psp2_exports;
return SCE_KERNEL_START_SUCCESS;
}
......@@ -193,7 +193,17 @@ static void Main_MenuDraw( void ) {
origin[2] = -32;
trap_R_ClearScene();
if (strlen(s_errorMessage.errorMessage))
{
UI_DrawProportionalString_AutoWrapped( 320, 192, 600, 20, s_errorMessage.errorMessage, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );
}
else
{
// standard menu drawing
Menu_Draw( &s_main.menu );
}
// add the model
memset( &ent, 0, sizeof(ent) );
......@@ -210,21 +220,13 @@ static void Main_MenuDraw( void ) {
trap_R_AddRefEntityToScene( &ent );
trap_R_RenderScene( &refdef );
if (strlen(s_errorMessage.errorMessage))
{
UI_DrawProportionalString_AutoWrapped( 320, 192, 600, 20, s_errorMessage.errorMessage, UI_CENTER|UI_SMALLFONT|UI_DROPSHADOW, menu_text_color );
}
else
{
// standard menu drawing
Menu_Draw( &s_main.menu );
}
if (uis.demoversion) {
UI_DrawProportionalString( 320, 372, "DEMO FOR MATURE AUDIENCES DEMO", UI_CENTER|UI_SMALLFONT, color );
UI_DrawString( 320, 400, "Quake III Arena(c) 1999-2000, Id Software, Inc. All Rights Reserved", UI_CENTER|UI_SMALLFONT, color );
UI_DrawString( 320, 430, "Thanks to XandridFire, Styde Pregny and Billy McLaughlin II for their support on Patreon", UI_CENTER|UI_SMALLFONT, color );
} else {
UI_DrawString( 320, 420, "Thanks to XandridFire, Styde Pregny and Billy McLaughlin II for their support on Patreon", UI_CENTER|UI_SMALLFONT, color );
UI_DrawString( 320, 450, "Quake III Arena(c) 1999-2000, Id Software, Inc. All Rights Reserved", UI_CENTER|UI_SMALLFONT, color );
}
}
......@@ -361,7 +363,7 @@ void UI_MainMenu( void ) {
s_main.cinematics.generic.y = y;
s_main.cinematics.generic.id = ID_CINEMATICS;
s_main.cinematics.generic.callback = Main_MenuEvent;
s_main.cinematics.string = "CINEMATICS";
s_main.cinematics.string = "CINEMATICS";
s_main.cinematics.color = color_red;
s_main.cinematics.style = style;
......
......@@ -2,6 +2,7 @@ TARGET := ui
SOURCES := .
CPPSOURCES :=
INCLUDES := ../renderercommon ../renderergl1 ../qcommon ../botlib ../client ../server ../psp2 ../sys ../game
SOURCE_EXTRA := ../psp2/psp2_dll_hacks.c
LIBS = -lSceCommonDialog_stub -lSceAudio_stub -lSceLibKernel_stub \
-lSceNet_stub -lSceNetCtl_stub -lSceDisplay_stub -lSceGxm_stub \
......@@ -23,7 +24,7 @@ CFLAGS = $(INCLUDE) -D__PSP2__ -D__FLOAT_WORD_ORDER=1 -D__GNU__ -DRELEASE \
-DDEFAULT_BASEDIR=\"ux0:/data/iortcw\" -fno-lto -DMISSIONPACK \
-DPRODUCT_VERSION=\"1.36_GIT_ba68b99c-2018-01-23\" -DHAVE_VM_COMPILED=true \
-mfpu=neon -mcpu=cortex-a9 -fsigned-char -nostartfiles \
-Wl,-q -O3 -g -ffast-math -fno-short-enums
-Wl,-q -O3 -g -ffast-math -fno-short-enums -include "../psp2/psp2_dll_defs.h"
CXXFLAGS = $(CFLAGS) -fno-exceptions -std=gnu++11 -fpermissive
ASFLAGS = $(CFLAGS)
......
#include <stdint.h>
#include <vitasdk.h>
#include <stdio.h>
#include <stdlib.h>
void* __dso_handle = (void*) &__dso_handle;
extern void _init_vita_reent( void );
extern void _free_vita_reent( void );
extern void _init_vita_heap( void );
extern void _free_vita_heap( void );
typedef struct sysfuncs_s
{
// mem
void* (*pfnSysMalloc)(size_t);
void* (*pfnSysCalloc)(size_t, size_t);
void* (*pfnSysRealloc)(void*, size_t);
void (*pfnSysFree)(void*);
// i/o
FILE* (*pfnSysFopen)(const char*, const char*);
int (*pfnSysFclose)(FILE*);
int (*pfnSysFseek)(FILE*, long int, int);
long int (*pfnSysFtell)(FILE*);
int (*pfnSysFprintf)(FILE*, const char*, ...);
size_t (*pfnSysFread)(void*, size_t, size_t, FILE*);
size_t (*pfnSysFwrite)(const void*, size_t, size_t, FILE*);
int (*pfnSprintf)(char*,const char*,...);
size_t (*pfnSysSnprintf)(char*,size_t,const char*,...);
} sysfuncs_t;
extern void __libc_init_array( void );
extern void __libc_fini_array( void );
void _init_vita_newlib( void )
{
_init_vita_heap( );
_init_vita_reent( );
}
void _free_vita_newlib( void )
{
_free_vita_reent( );
_free_vita_heap( );
}
void _fini( void ) { }
void _init( void ) { }
// small heap for internal libc use
unsigned int _newlib_heap_size_user = 2 * 1024 * 1024;
//////////////////////////////////////
typedef struct dllexport_s
{
const char *name;
void *func;
} dllexport_t;
typedef struct modarg_s
{
sysfuncs_t imports;
dllexport_t *exports;
} modarg_t;
extern void dllEntry( intptr_t (*syscallptr)( intptr_t arg,... ) );
extern intptr_t vmMain( intptr_t command, intptr_t arg0, intptr_t arg1, intptr_t arg2, intptr_t arg3, intptr_t arg4, intptr_t arg5, intptr_t arg6, intptr_t arg7, intptr_t arg8, intptr_t arg9, intptr_t arg10, intptr_t arg11 );
static dllexport_t psp2_exports[] =
{
{ "dllEntry", (void*)dllEntry },
{ "vmMain", (void*)vmMain },
{ NULL, NULL },
};
int module_stop( SceSize argc, const void *args )
{
__libc_fini_array( );
_free_vita_newlib( );
return SCE_KERNEL_STOP_SUCCESS;
}
int module_exit( )
{
__libc_fini_array( );
_free_vita_newlib( );
return SCE_KERNEL_STOP_SUCCESS;
}
void _start() __attribute__ ((weak, alias ("module_start")));
int module_start( SceSize argc, void *args )
{
_init_vita_newlib( );
__libc_init_array( );
modarg_t *arg = *(modarg_t **)args;
arg->exports = psp2_exports;
return SCE_KERNEL_START_SUCCESS;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment