Launcher now has the ability to show/hide folders without an info file as well as loading a custom external splash. Please remove your .ngunixrc before launching

This commit is contained in:
eukos 2016-01-10 16:24:17 +01:00
parent c2ef1fed75
commit b7493c0601

View file

@ -14,6 +14,7 @@ static int engine_memory;
static int engine_vid_width;
static int engine_vid_height;
static byte engine_vid_border;
static byte engine_hidden;
static char engine_cfg_path[80];
static int iGameCnt;
@ -26,6 +27,7 @@ void launcher_settings_save()
fprintf(fFile, "%d\n", engine_vid_width);
fprintf(fFile, "%d\n", engine_vid_height);
fprintf(fFile, "%d\n", engine_vid_border);
fprintf(fFile, "%d\n", engine_hidden);
fclose(fFile);
printf("[LAUNCHER] Saved settings...\n");
}
@ -40,16 +42,17 @@ void launcher_settings_load()
if(access(engine_cfg_path, R_OK) != -1 )
{
fFile = fopen(engine_cfg_path, "r");
fscanf(fFile,"%d %d %d", &engine_memory, &engine_vid_width, &engine_vid_height, &engine_vid_border);
fscanf(fFile,"%d %d %d", &engine_memory, &engine_vid_width, &engine_vid_height, &engine_vid_border, &engine_hidden);
fclose(fFile);
printf("[LAUNCHER] Loaded settings... %dx%d @ %dMB memory\n", engine_vid_width, engine_vid_height, engine_memory);
}
else
{
engine_memory = 60;
engine_vid_width = 640;
engine_vid_height = 480;
engine_vid_border = 1;
engine_memory = 60;
engine_vid_width = 640;
engine_vid_height = 480;
engine_vid_border = 1;
engine_hidden = 1;
launcher_settings_save();
}
}
@ -116,7 +119,6 @@ void launcher_cachefolders(GtkWidget *list)
DIR *d;
FILE *f;
struct dirent *dir;
char fname[32];
char cFile[80];
d = opendir(".");
@ -132,14 +134,15 @@ void launcher_cachefolders(GtkWidget *list)
if(access(cFile, R_OK) != -1 )
{
f = fopen(cFile, "r");
char cTemp[32];
fscanf(f, "%35[^\n]", cTemp);
char cTemp[64];
fscanf(f, "%63[^\n]", cTemp);
fclose(f);
printf(" Found %s (%s)\n", cTemp, dir->d_name);
sprintf(fname, "%s", dir->d_name);
launcher_add_to_list(list, cTemp, fname);
launcher_add_to_list(list, cTemp, dir->d_name);
iGameCnt++;
}
else if(engine_hidden == 0)
launcher_add_to_list(list, dir->d_name, dir->d_name);
}
}
closedir(d);
@ -150,10 +153,21 @@ void launcher_start()
{
char cmd[128];
if(strlen(cmd_args) > 0)
{
if(engine_vid_border == 1)
sprintf(cmd, "./ngunix.x11 -data id1 -game %s -winsize %d %d -mem %d\n", cmd_args, engine_vid_width, engine_vid_height, engine_memory);
else
sprintf(cmd, "./ngunix.x11 -data id1 -game %s -winsize %d %d -mem %d -noborder\n", cmd_args, engine_vid_width, engine_vid_height, engine_memory);
}
else
{
if(engine_vid_border)
sprintf(cmd, "./ngunix.x11 -data id1 -winsize %d %d -mem %d\n", engine_vid_width, engine_vid_height, engine_memory);
else
sprintf(cmd, "./ngunix.x11 -data id1 -winsize %d %d -mem %d -noborder\n", engine_vid_width, engine_vid_height, engine_memory);
}
printf(cmd);
system(cmd);
@ -213,8 +227,14 @@ int main(int argc, char *argv[])
ltable1 = gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window), ltable1);
splash_image = gdk_pixmap_create_from_xpm_d(window->window, &splash_mask, NULL, (gchar **)splash_xpm );
x_splash_image = gtk_image_new_from_pixmap(splash_image, splash_mask);
if(!access("./splash.xpm", R_OK))
x_splash_image = gtk_image_new_from_file("./splash.xpm");
else
x_splash_image = gtk_image_new_from_pixmap(splash_image, splash_mask);
gtk_fixed_put(GTK_FIXED(ltable1), x_splash_image, 0, 0);
btnplay = gtk_button_new_from_stock(GTK_STOCK_MEDIA_PLAY);