GTK3: Support RAM size in megabytes

If ramsize is 1000 or less, it is interpreted as a megabyte value.
This commit is contained in:
robxnano 2024-08-26 23:30:59 +01:00
parent bcc06d8d33
commit 94b687a626
No known key found for this signature in database
GPG Key ID: 9FB6B03B782D1E42

View File

@ -348,7 +348,8 @@ void cb_screen_mode(GtkWidget *widget)
static void set_ramsize_combo_box(void)
{
const char *name = "ramsize";
int size_mb = PrefsFindInt32(name) >> 20;
int ramsize = PrefsFindInt32(name);
int size_mb = (ramsize <= 1000) ? ramsize : ramsize >> 20;
GtkComboBoxText *combo = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, name));
char *id = g_strdup_printf("%d MB", size_mb);
if (!gtk_combo_box_set_active_id(GTK_COMBO_BOX(combo), id))