add --poolsize arg for modifying main pool size
This commit is contained in:
parent
a8a97b7c4b
commit
655427f10f
|
@ -9,6 +9,7 @@
|
|||
#define MEMORY_POOL_RIGHT 1
|
||||
|
||||
#define GFX_POOL_SIZE (512 * 1024)
|
||||
#define DEFAULT_POOL_SIZE (0x165000 * 8)
|
||||
|
||||
struct AllocOnlyPool
|
||||
{
|
||||
|
|
|
@ -34,6 +34,12 @@ static inline int arg_string(const char *name, const char *value, char *target)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static inline int arg_uint(const char *name, const char *value, unsigned int *target) {
|
||||
const unsigned long int v = strtoul(value, NULL, 0);
|
||||
*target = v;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void parse_cli_opts(int argc, char* argv[]) {
|
||||
// Initialize options with false values.
|
||||
memset(&gCLIOpts, 0, sizeof(gCLIOpts));
|
||||
|
@ -51,6 +57,9 @@ void parse_cli_opts(int argc, char* argv[]) {
|
|||
else if (strcmp(argv[i], "--cheats") == 0) // Enable cheats menu
|
||||
Cheats.EnableCheats = true;
|
||||
|
||||
else if (strcmp(argv[i], "--poolsize") == 0) // Main pool size
|
||||
arg_uint("--poolsize", argv[++i], &gCLIOpts.PoolSize);
|
||||
|
||||
else if (strcmp(argv[i], "--configfile") == 0 && (i + 1) < argc)
|
||||
arg_string("--configfile", argv[++i], gCLIOpts.ConfigFile);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
struct PCCLIOptions {
|
||||
unsigned int SkipIntro;
|
||||
unsigned int FullScreen;
|
||||
unsigned int PoolSize;
|
||||
char ConfigFile[SYS_MAX_PATH];
|
||||
char SavePath[SYS_MAX_PATH];
|
||||
char GameDir[SYS_MAX_PATH];
|
||||
|
|
|
@ -172,10 +172,6 @@ static void on_anim_frame(double time) {
|
|||
#endif
|
||||
|
||||
void main_func(void) {
|
||||
static u64 pool[0x165000/8 / 4 * sizeof(void *)];
|
||||
main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
|
||||
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
|
||||
const char *gamedir = gCLIOpts.GameDir[0] ? gCLIOpts.GameDir : FS_BASEDIR;
|
||||
const char *userpath = gCLIOpts.SavePath[0] ? gCLIOpts.SavePath : sys_user_path();
|
||||
fs_init(sys_ropaths, gamedir, userpath);
|
||||
|
@ -187,6 +183,12 @@ void main_func(void) {
|
|||
else if (gCLIOpts.FullScreen == 2)
|
||||
configWindow.fullscreen = false;
|
||||
|
||||
const size_t poolsize = gCLIOpts.PoolSize ? gCLIOpts.PoolSize : DEFAULT_POOL_SIZE;
|
||||
u64 *pool = malloc(poolsize);
|
||||
if (!pool) sys_fatal("Could not alloc %u bytes for main pool.\n", poolsize);
|
||||
main_pool_init(pool, pool + poolsize / sizeof(pool[0]));
|
||||
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
|
||||
#if defined(WAPI_SDL1) || defined(WAPI_SDL2)
|
||||
wm_api = &gfx_sdl;
|
||||
#elif defined(WAPI_DXGI)
|
||||
|
|
Loading…
Reference in New Issue