restore --savepath and replace --datapath with --gamedir
This commit is contained in:
parent
dc29cb4081
commit
630b3a9fcf
|
@ -54,8 +54,8 @@ void parse_cli_opts(int argc, char* argv[]) {
|
|||
else if (strcmp(argv[i], "--configfile") == 0 && (i + 1) < argc)
|
||||
arg_string("--configfile", argv[++i], gCLIOpts.ConfigFile);
|
||||
|
||||
else if (strcmp(argv[i], "--datapath") == 0 && (i + 1) < argc)
|
||||
arg_string("--datapath", argv[++i], gCLIOpts.DataPath);
|
||||
else if (strcmp(argv[i], "--gamedir") == 0 && (i + 1) < argc)
|
||||
arg_string("--gamedir", argv[++i], gCLIOpts.GameDir);
|
||||
|
||||
else if (strcmp(argv[i], "--savepath") == 0 && (i + 1) < argc)
|
||||
arg_string("--savepath", argv[++i], gCLIOpts.SavePath);
|
||||
|
|
|
@ -8,7 +8,7 @@ struct PCCLIOptions {
|
|||
unsigned int FullScreen;
|
||||
char ConfigFile[SYS_MAX_PATH];
|
||||
char SavePath[SYS_MAX_PATH];
|
||||
char DataPath[SYS_MAX_PATH];
|
||||
char GameDir[SYS_MAX_PATH];
|
||||
};
|
||||
|
||||
extern struct PCCLIOptions gCLIOpts;
|
||||
|
|
|
@ -1748,18 +1748,18 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi) {
|
|||
0x05200200,
|
||||
0x03200200
|
||||
};
|
||||
for (size_t i = 0; i < sizeof(precomp_shaders) / sizeof(uint32_t); i++) {
|
||||
|
||||
for (size_t i = 0; i < sizeof(precomp_shaders) / sizeof(uint32_t); i++)
|
||||
gfx_lookup_or_create_shader_program(precomp_shaders[i]);
|
||||
}
|
||||
#ifdef EXTERNAL_DATA
|
||||
// preload all textures if needed
|
||||
if (configPrecacheRes) {
|
||||
printf("Precaching textures\n");
|
||||
fs_walk(FS_TEXTUREDIR, preload_texture, NULL, true);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef EXTERNAL_DATA
|
||||
void gfx_precache_textures(void) {
|
||||
// preload all textures
|
||||
fs_walk(FS_TEXTUREDIR, preload_texture, NULL, true);
|
||||
}
|
||||
#endif
|
||||
|
||||
void gfx_start_frame(void) {
|
||||
gfx_wapi->handle_events();
|
||||
gfx_wapi->get_dimensions(&gfx_current_dimensions.width, &gfx_current_dimensions.height);
|
||||
|
|
|
@ -15,6 +15,7 @@ void gfx_init(struct GfxWindowManagerAPI *wapi, struct GfxRenderingAPI *rapi);
|
|||
void gfx_start_frame(void);
|
||||
void gfx_run(Gfx *commands);
|
||||
void gfx_end_frame(void);
|
||||
void gfx_precache_textures(void);
|
||||
void gfx_shutdown(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
#include <emscripten.h>
|
||||
|
@ -24,6 +25,7 @@
|
|||
#include "controller/controller_api.h"
|
||||
#include "fs/fs.h"
|
||||
|
||||
#include "game/game_init.h"
|
||||
#include "game/main.h"
|
||||
#include "game/thread6.h"
|
||||
|
||||
|
@ -154,7 +156,9 @@ void main_func(void) {
|
|||
main_pool_init(pool, pool + sizeof(pool) / sizeof(pool[0]));
|
||||
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
|
||||
fs_init(sys_ropaths, FS_BASEDIR, sys_user_path());
|
||||
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);
|
||||
|
||||
configfile_load(configfile_name());
|
||||
|
||||
|
@ -173,9 +177,18 @@ void main_func(void) {
|
|||
sound_init();
|
||||
|
||||
thread5_game_loop(NULL);
|
||||
|
||||
|
||||
inited = true;
|
||||
|
||||
#ifdef EXTERNAL_DATA
|
||||
// precache data if needed
|
||||
if (configPrecacheRes) {
|
||||
printf("precaching data\n");
|
||||
fflush(stdout);
|
||||
gfx_precache_textures();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_WEB
|
||||
emscripten_set_main_loop(em_main_loop, 0, 0);
|
||||
request_anim_frame(on_anim_frame);
|
||||
|
|
Loading…
Reference in New Issue