mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-28 04:49:18 +00:00
clean up default config a bit
- HT Les Burrows for the suggestion/bug report I think there is a lot that could be changed around this, but I went for balance. Firstly it switches to a default path of "HOME", takes out the ifdef "MAC" (sorry, other devs can support older platforms better than I, this is old MAC, not the modern OSX version which is supported). It uses a dot file. A lot of these changes could be minorly controversial as they change the behavior somewhat. I think proper documentation, flags, and more cleanup around all of this would help.
This commit is contained in:
parent
cbb88d24ca
commit
1f061db96b
@ -140,7 +140,7 @@ int g_config_gsplus_auto_update = 1;
|
|||||||
int g_config_gsplus_update_needed = 0;
|
int g_config_gsplus_update_needed = 0;
|
||||||
|
|
||||||
const char *g_config_gsplus_name_list[] = {
|
const char *g_config_gsplus_name_list[] = {
|
||||||
"config.txt", "config.gsp",0
|
"config.txt", "config.gsp", ".config.gsp",0
|
||||||
};
|
};
|
||||||
|
|
||||||
int g_highest_smartport_unit = -1;
|
int g_highest_smartport_unit = -1;
|
||||||
@ -879,10 +879,10 @@ config_load_roms()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
glogf("Read: %d bytes of ROM", ret);
|
glogf("Read %d bytes (%dK) of ROM", ret, ret/1024);
|
||||||
if(ret != len) {
|
if(ret != len) {
|
||||||
fatal_printf("errno: %d\n", errno);
|
fatal_printf("errno: %d\n", errno);
|
||||||
g_config_control_panel = 1;
|
g_config_control_panel = 1; // THIS DOESN'T DO ANYTHING?
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
@ -1039,7 +1039,7 @@ config_parse_config_gsplus_file()
|
|||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
glog("Parsing configuration file");
|
glogf("Parsing configuration file '%s'", g_config_gsplus_name);
|
||||||
|
|
||||||
clk_bram_zero();
|
clk_bram_zero();
|
||||||
|
|
||||||
|
@ -53,14 +53,20 @@ int g_initialized = 0; // OG To know if the emulator has finalized its initializ
|
|||||||
int g_accept_events = 0; // OG To know if the emulator is ready to accept external events
|
int g_accept_events = 0; // OG To know if the emulator is ready to accept external events
|
||||||
char g_argv0_path[256] = "./";
|
char g_argv0_path[256] = "./";
|
||||||
|
|
||||||
const char *g_gsplus_default_paths[] = { "", "./", "${HOME}/","${PWD}/",
|
const char *g_gsplus_default_paths[] = { // probably overkill on the paths
|
||||||
#ifdef MAC
|
"",
|
||||||
"${0}/../",
|
"./",
|
||||||
#endif
|
"${HOME}/",
|
||||||
"${HOME}/Library/GSport/",
|
"${PWD}/",
|
||||||
"${0}/Contents/Resources/", "/usr/local/lib/",
|
"${HOME}/Library/GSplus/",
|
||||||
"/usr/local/gsport/", "/usr/local/lib/gsport/", "/usr/share/gsport/",
|
"/usr/local/lib/",
|
||||||
"/var/lib/", "/usr/lib/gsport/", "${0}/", 0 };
|
"/usr/lib/gsplus/",
|
||||||
|
"/usr/local/gsplus/",
|
||||||
|
"/usr/local/lib/gsplus/",
|
||||||
|
"/usr/share/gsplus/",
|
||||||
|
"/var/lib/",
|
||||||
|
"${0}/",
|
||||||
|
0 };
|
||||||
|
|
||||||
#define MAX_EVENTS 64
|
#define MAX_EVENTS 64
|
||||||
|
|
||||||
@ -738,7 +744,7 @@ void my_exit(int ret) {
|
|||||||
end_screen();
|
end_screen();
|
||||||
imagewriter_close();
|
imagewriter_close();
|
||||||
printer_close();
|
printer_close();
|
||||||
glogf("exiting (ret=%d)",ret);
|
glogf("Exiting (ret=%d)",ret);
|
||||||
fatalExit(ret);
|
fatalExit(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -878,7 +884,7 @@ void memory_ptr_init() {
|
|||||||
*/
|
*/
|
||||||
g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr);
|
g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr);
|
||||||
|
|
||||||
glogf("RAM size is 0 - %06x (%.2fMB)", mem_size, (double)mem_size/(1024.0*1024.0));
|
glogf("RAM size is %d bytes (%.2fMB)", mem_size, (double)mem_size/(1024.0*1024.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// OG Added memory_ptr_shut
|
// OG Added memory_ptr_shut
|
||||||
@ -1339,11 +1345,10 @@ void setup_gsplus_file(char *outname, int maxlen, int ok_if_missing, int can_cre
|
|||||||
strcpy(outname, &(local_path[0]));
|
strcpy(outname, &(local_path[0]));
|
||||||
strncat(outname, *cur_name_ptr, 255-strlen(outname));
|
strncat(outname, *cur_name_ptr, 255-strlen(outname));
|
||||||
if(!ok_if_missing) { // ??
|
if(!ok_if_missing) { // ??
|
||||||
glogf("Trying '%s'", outname);
|
glogf("Trying config file '%s'", outname);
|
||||||
}
|
}
|
||||||
ret = stat(outname, &stat_buf);
|
ret = stat(outname, &stat_buf);
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
/* got it! */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cur_name_ptr++;
|
cur_name_ptr++;
|
||||||
@ -1356,34 +1361,33 @@ void setup_gsplus_file(char *outname, int maxlen, int ok_if_missing, int can_cre
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* couldn't find it, print out all the attempts */
|
|
||||||
/*
|
|
||||||
path_ptr = save_path_ptr;
|
|
||||||
gloghead(); fatal_printf("Could not find required file \"%s\" in any of these "
|
|
||||||
"directories:\n", *name_ptr);
|
|
||||||
while(*path_ptr) {
|
|
||||||
fatal_printf(" %s\n", *path_ptr++);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
glogf("Could not find required file \"%s\" !!!", *name_ptr);
|
glogf("Could not find required file \"%s\" !!!", *name_ptr);
|
||||||
if (strcmp(*name_ptr, "ROM")) {
|
// this check is crap
|
||||||
|
if (strcmp(*name_ptr, "ROM") == 0) {
|
||||||
glog(" IIgs will likely hang now!");
|
glog(" IIgs will likely hang now!");
|
||||||
glog(" Get an Apple IIgs firmware ROM image from somewhere like:");
|
glog(" Get an Apple IIgs firmware ROM image from somewhere like:");
|
||||||
glog(" ftp://ftp.apple.asimov.net/pub/apple_II/emulators/rom_images/");
|
glog(" ftp://ftp.apple.asimov.net/pub/apple_II/emulators/rom_images/");
|
||||||
glog(" ... and rename the file to \"ROM\" and restart");
|
glog(" ... and rename the file to \"ROM\" and restart");
|
||||||
glog(" ... or hit <F4> and browse for a valid ROM image.");
|
glog(" ... or hit <F4> and browse for a valid ROM image.");
|
||||||
}
|
}
|
||||||
// if (strcmp(*name_ptr, "config.txt")) {
|
|
||||||
//}
|
|
||||||
|
|
||||||
if(can_create_file) {
|
if(can_create_file) {
|
||||||
// If we didn't find a file, pick a place to put it.
|
// If we didn't find a file, pick a place to put it.
|
||||||
// Default is the current working directory.
|
// Default is the current working directory.
|
||||||
#ifdef MAC
|
// This is often wrong in OS X. /Applications/GSplus.app is
|
||||||
gsport_expand_path(&(local_path[0]), "${0}/../config.txt", 250);
|
// probably not writable by the default user, and PWD is set
|
||||||
#else
|
// there when launched from an .app structure.
|
||||||
gsport_expand_path(&(local_path[0]), "${PWD}/config.txt", 250);
|
// Normally the HOME directory under a *NIX system is probably
|
||||||
#endif
|
// a better place for the config file. Ideally a "dotfile"
|
||||||
|
// like most applications, or something under "~/Library".
|
||||||
|
// However, GSplus is promoting a notion of Config-as-a-VM
|
||||||
|
// where we want to encourage many configs. (See DGB video
|
||||||
|
// on YT regarding the GSVision UI experiment.)
|
||||||
|
|
||||||
|
|
||||||
|
glogf("Trying to create config (%s)", "${HOME}/.config.gsp");
|
||||||
|
gsport_expand_path(&(local_path[0]), "${HOME}/.config.gsp", 250);
|
||||||
|
|
||||||
strcpy(outname, &(local_path[0]));
|
strcpy(outname, &(local_path[0]));
|
||||||
// Ask user if it's OK to create the file (or just create it)
|
// Ask user if it's OK to create the file (or just create it)
|
||||||
x_dialog_create_gsport_conf(*name_ptr);
|
x_dialog_create_gsport_conf(*name_ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user