Implement system.GetSaveFolderName()

This commit is contained in:
Nunuhara Cabbage
2019-11-15 21:39:43 -08:00
parent 89cee10c51
commit 0eefcaab36
4 changed files with 10 additions and 6 deletions
-6
View File
@@ -114,32 +114,26 @@ struct cg *cg_load(int no)
// size is only pixel data size
switch(type) {
case ALCG_VSP:
sys_message("extracting VSP");
cg = vsp_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS8:
sys_message("extracting PMS8");
cg = pms256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_PMS16:
sys_message("extracting PMS16");
cg = pms64k_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(uint16_t);
break;
case ALCG_BMP8:
sys_message("extracting BMP8");
cg = bmp256_extract(dfile->data);
size = cg->width * cg->height;
break;
case ALCG_BMP24:
sys_message("extracting BMP24");
cg = bmp16m_extract(dfile->data);
size = (cg->width * cg->height) * sizeof(uint16_t);
break;
case ALCG_QNT:
sys_message("extracting QNT");
cg = qnt_extract(dfile->data);
size = (cg->width * cg->height) * 3;
break;
+3
View File
@@ -28,6 +28,7 @@
struct config config = {
.game_name = NULL,
.ain_filename = NULL,
.save_dir = NULL,
.view_width = 800,
.view_height = 600
};
@@ -52,6 +53,8 @@ static int config_handler(void *user, possibly_unused const char *section, const
config->game_name = config_strdup(value);
} else if (!strcmp(name, "CodeName")) {
config->ain_filename = config_strdup(value);
} else if (!strcmp(name, "SaveFolder")) {
config->save_dir = config_strdup(value);
} else if (!strcmp(name, "ViewWidth")) {
config->view_width = atoi(value);
} else if (!strcmp(name, "ViewHeight")) {
+1
View File
@@ -72,6 +72,7 @@ mem_alloc char *_xstrdup(const char *in, const char *func);
struct config {
char *game_name;
char *ain_filename;
char *save_dir;
int view_width;
int view_height;
};
+6
View File
@@ -362,6 +362,12 @@ static void system_call(int32_t code)
free(utf);
// XXX: caller S_POPs
break;
case 0xC:
if (config.save_dir)
stack_push_string(make_string(config.save_dir, strlen(config.save_dir)));
else
stack_push_string(string_ref(&EMPTY_STRING));
break;
case 0xD:
stack_push(vm_time());
break;