diff --git a/.gitignore b/.gitignore index 552e6f4..419cfea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ +profile/choice +profile/firefox-10.0esr.tar +profile/firefox-17.0esr.tar + obj/ flips flips.exe diff --git a/flips-gtk.cpp b/flips-gtk.cpp index 4e39eef..a047073 100644 --- a/flips-gtk.cpp +++ b/flips-gtk.cpp @@ -683,7 +683,7 @@ static void a_ApplyRun(GtkButton* widget, gpointer user_data) GPid pid; GError* error=NULL; - if (!g_spawn_async(patchname, (gchar**)argv, NULL, G_SPAWN_DEFAULT, NULL, NULL, &pid, &error)) + if (!g_spawn_async(*patchname ? patchname : NULL, (gchar**)argv, NULL, G_SPAWN_DEFAULT, NULL, NULL, &pid, &error)) { //g_unlink(tempname);//apparently this one isn't in the headers. ShowMessage((struct errorinfo){ el_broken, error->message }); @@ -775,7 +775,8 @@ static void a_SetEmulatorFor(GtkButton* widget, gpointer user_data) gtk_file_filter_add_custom(filter, GTK_FILE_FILTER_URI, filterExecOnly, NULL, NULL); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filter); - char* emu_uri = g_filename_to_uri(GetEmuFor((const char*)user_data), NULL, NULL); + const char * emu_path = GetEmuFor((const char*)user_data); + char* emu_uri = emu_path ? g_filename_to_uri(emu_path, NULL, NULL) : NULL; setoutpath(GTK_FILE_CHOOSER(dialog), emu_uri, false); g_free(emu_uri); diff --git a/flips.cpp b/flips.cpp index 3617682..43a9bef 100644 --- a/flips.cpp +++ b/flips.cpp @@ -337,6 +337,11 @@ void config::init_raw(LPWSTR contents) contents = nextline+1; while (contents && iswspace(*contents)) contents++; } + + for (size_t i=0;inumentries;i++) @@ -497,6 +502,9 @@ enum { ch_crc32, ch_last }; +static LPCWSTR checkmap_typenames[] = { TEXT("rom.crc32.") }; +// sizeof rather than strlen to ensure compile-time evaluation; -1 for NUL +static const int checkmap_typenames_maxlen = sizeof("rom.crc32.")-1; struct checkmap { uint8_t* sum; LPWSTR name; @@ -506,6 +514,43 @@ static uint32_t checkmap_len[ch_last]={0}; static const uint8_t checkmap_sum_size[]={ 4 }; static const uint8_t checkmap_sum_size_max = 4; +static const int CfgSumNameMaxLen = checkmap_typenames_maxlen + checkmap_sum_size_max*2 + 1; +static void CfgSumName(WCHAR* out, int type, const void* sum) +{ + const uint8_t* sum8 = (uint8_t*)sum; + wcscpy(out, checkmap_typenames[type]); + WCHAR* end = out + wcslen(checkmap_typenames[type]); + for (int i=0;isum=(uint8_t*)malloc(checkmap_sum_size[type]); memcpy(item->sum, sum, checkmap_sum_size[type]); item->name=wcsdup(filename); + + WCHAR cfgname[CfgSumNameMaxLen]; + CfgSumName(cfgname, type, sum); + cfg.set(cfgname, filename); } struct mem GetRomList() @@ -648,6 +697,14 @@ void AddToRomList(file* patch, LPCWSTR path) } } +void AddConfigToRomList(LPCWSTR key, LPCWSTR value) +{ + int type; + uint8_t sum[checkmap_sum_size_max]; + if (CfgSumParseName(&type, sum, key)) + AddRomForSum(type, sum, value); +} + void DeleteRomFromList(LPCWSTR path) { for (unsigned int type=0;type