mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-06-08 09:29:31 +00:00
- removed the INT16 prefs item type; use INT32 instead
- AmigaOS/Unix: it's now possible to specify preferences items on the command line - Unix: command line options now take "--"-prefix, e.g. "--rominfo"
This commit is contained in:
parent
29768a331f
commit
6b92e785c7
|
@ -10,16 +10,19 @@ V0.8 (snapshot) - <date>
|
|||
(activated through the "--enable-vosf" configure option)
|
||||
- Unix: added IRIX audio driver [Brian J. Johnson]
|
||||
- Unix: improved timing of periodic threads
|
||||
- Unix: command line options now use '--'-prefix, e.g. "--rominfo"
|
||||
- AmigaOS: enabled floppy support, fixed floppy bugs [Jürgen Lachmann]
|
||||
- AmigaOS: Amiga mouse pointer is hidden inside windowed Mac displays
|
||||
- AmigaOS/sys_amiga.cpp: workaround for 2060scsi.device bug when
|
||||
when reading from CD-ROM [Jürgen Lachmann]
|
||||
- AmigaOS/prefs_editor_amiga.cpp: fixed bug when adding volumes
|
||||
[Jürgen Lachmann]
|
||||
- AmigaOS/Unix/extfs_*.cpp: .finf helper file now stores complete
|
||||
FInfo/FXInfo, replaced get/set_finder_*() functions by get/set_finfo()
|
||||
- AmigaOS: added MacsBug support (tested with MacsBug6.6.1),
|
||||
fixed <move sr,(sp)> bug [Jürgen Lachmann]
|
||||
- AmigaOS/Unix/extfs_*.cpp: .finf helper file now stores complete
|
||||
FInfo/FXInfo, replaced get/set_finder_*() functions by get/set_finfo()
|
||||
- AmigaOS/Unix: it's possible to specify preferences items on the
|
||||
command line
|
||||
- include/macos_util.h: defines FOURCC() macro to make MacOS-like
|
||||
four-character-codes, replaced most instances of multi-character
|
||||
constants in the sources by this macro to avoid compiler warnings
|
||||
|
|
|
@ -138,7 +138,7 @@ static void tick_func(void);
|
|||
* Main program
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
// Initialize variables
|
||||
RAMBaseHost = NULL;
|
||||
|
@ -188,7 +188,7 @@ int main(void)
|
|||
CyberGfxBase = OpenLibrary((UBYTE *)"cybergraphics.library", 2);
|
||||
|
||||
// Read preferences
|
||||
PrefsInit();
|
||||
PrefsInit(argc, argv);
|
||||
|
||||
// Open AHI
|
||||
ahi_port = CreateMsgPort();
|
||||
|
|
|
@ -354,10 +354,10 @@ bool PrefsEditor(void)
|
|||
case GAD_BOOTDRIVER:
|
||||
switch (code) {
|
||||
case 0:
|
||||
PrefsReplaceInt16("bootdriver", 0);
|
||||
PrefsReplaceInt32("bootdriver", 0);
|
||||
break;
|
||||
case 1:
|
||||
PrefsReplaceInt16("bootdriver", CDROMRefNum);
|
||||
PrefsReplaceInt32("bootdriver", CDROMRefNum);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -574,7 +574,7 @@ static void parse_volumes_prefs(void)
|
|||
|
||||
bootdriver_num = 0;
|
||||
|
||||
int bootdriver = PrefsFindInt16("bootdriver");
|
||||
int bootdriver = PrefsFindInt32("bootdriver");
|
||||
switch (bootdriver) {
|
||||
case 0:
|
||||
bootdriver_num = 0;
|
||||
|
|
|
@ -176,7 +176,7 @@ void BasiliskII::ReadyToRun(void)
|
|||
delete_area(old_rom_area);
|
||||
|
||||
// Read preferences
|
||||
PrefsInit();
|
||||
PrefsInit(0, NULL);
|
||||
|
||||
// Init system routines
|
||||
SysInit();
|
||||
|
|
|
@ -425,12 +425,12 @@ BView *PrefsWindow::create_volumes_pane(void)
|
|||
menu->AddItem(new BMenuItem(GetString(STR_BOOT_ANY_LAB), new BMessage(MSG_BOOT_ANY)));
|
||||
menu->AddItem(new BMenuItem(GetString(STR_BOOT_CDROM_LAB), new BMessage(MSG_BOOT_CDROM)));
|
||||
pane->AddChild(menu_field);
|
||||
int16 i16 = PrefsFindInt16("bootdriver");
|
||||
int32 i32 = PrefsFindInt32("bootdriver");
|
||||
BMenuItem *item;
|
||||
if (i16 == 0) {
|
||||
if (i32 == 0) {
|
||||
if ((item = menu->FindItem(GetString(STR_BOOT_ANY_LAB))) != NULL)
|
||||
item->SetMarked(true);
|
||||
} else if (i16 == CDROMRefNum) {
|
||||
} else if (i32 == CDROMRefNum) {
|
||||
if ((item = menu->FindItem(GetString(STR_BOOT_CDROM_LAB))) != NULL)
|
||||
item->SetMarked(true);
|
||||
}
|
||||
|
@ -875,11 +875,11 @@ void PrefsWindow::MessageReceived(BMessage *msg)
|
|||
}
|
||||
|
||||
case MSG_BOOT_ANY:
|
||||
PrefsReplaceInt16("bootdriver", 0);
|
||||
PrefsReplaceInt32("bootdriver", 0);
|
||||
break;
|
||||
|
||||
case MSG_BOOT_CDROM:
|
||||
PrefsReplaceInt16("bootdriver", CDROMRefNum);
|
||||
PrefsReplaceInt32("bootdriver", CDROMRefNum);
|
||||
break;
|
||||
|
||||
case MSG_NOCDROM:
|
||||
|
|
|
@ -3,25 +3,25 @@
|
|||
Basilisk II \- a free, portable Mac II emulator
|
||||
.SH SYNOPSIS
|
||||
.B BasiliskII
|
||||
[\-display
|
||||
[\-\-display
|
||||
.IR display-name ]
|
||||
[\-break
|
||||
[\-\-break
|
||||
.IR offset ]
|
||||
[\-rominfo]
|
||||
[\-\-rominfo]
|
||||
.SH DESCRIPTION
|
||||
.B Basilisk II
|
||||
is a free, portable 68k Mac emulator. For more information, see the included
|
||||
"README" file.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BI "\-display " display-name
|
||||
.BI "\-\-display " display-name
|
||||
specifies the display to use; see
|
||||
.BR X (1)
|
||||
.TP
|
||||
.BI "\-break " offset
|
||||
.BI "\-\-break " offset
|
||||
specifies a ROM offset where a breakpoint will be placed (for debugging)
|
||||
.TP
|
||||
.B \-rominfo
|
||||
.B \-\-rominfo
|
||||
causes Basilisk II to print some information about the ROM being used on
|
||||
startup (for debugging)
|
||||
.SH FILES
|
||||
|
|
|
@ -50,6 +50,7 @@ struct sigstate {
|
|||
|
||||
#ifdef ENABLE_GTK
|
||||
# include <gtk/gtk.h>
|
||||
# include <gdk/gdk.h>
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_XF86_DGA
|
||||
|
@ -208,14 +209,43 @@ int main(int argc, char **argv)
|
|||
printf(GetString(STR_ABOUT_TEXT1), VERSION_MAJOR, VERSION_MINOR);
|
||||
printf(" %s\n", GetString(STR_ABOUT_TEXT2));
|
||||
|
||||
// Parse arguments
|
||||
#ifdef ENABLE_GTK
|
||||
// Init GTK
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
x_display_name = gdk_get_display(); // gtk_init() handles and removes the "--display" argument
|
||||
#endif
|
||||
|
||||
// Parse and remove arguments
|
||||
for (int i=1; i<argc; i++) {
|
||||
if (strcmp(argv[i], "-display") == 0 && ++i < argc)
|
||||
x_display_name = argv[i];
|
||||
else if (strcmp(argv[i], "-break") == 0 && ++i < argc)
|
||||
ROMBreakpoint = strtol(argv[i], NULL, 0);
|
||||
else if (strcmp(argv[i], "-rominfo") == 0)
|
||||
if (strcmp(argv[i], "--display") == 0) {
|
||||
argv[i] = NULL;
|
||||
if ((i + 1) < argc && argv[i + 1]) {
|
||||
argv[i++] = NULL;
|
||||
x_display_name = strdup(argv[i]);
|
||||
}
|
||||
} else if (strcmp(argv[i], "--break") == 0) {
|
||||
argv[i] = NULL;
|
||||
if ((i + 1) < argc && argv[i + 1]) {
|
||||
argv[i++] = NULL;
|
||||
ROMBreakpoint = strtol(argv[i], NULL, 0);
|
||||
}
|
||||
} else if (strcmp(argv[i], "--rominfo") == 0) {
|
||||
argv[i] = NULL;
|
||||
PrintROMInfo = true;
|
||||
}
|
||||
}
|
||||
for (int i=1; i<argc; i++) {
|
||||
int k;
|
||||
for (k=i; k<argc; k++)
|
||||
if (argv[k] != NULL)
|
||||
break;
|
||||
if (k > i) {
|
||||
k -= i;
|
||||
for (int j=i+k; j<argc; j++)
|
||||
argv[j-k] = argv[j];
|
||||
argc -= k;
|
||||
}
|
||||
}
|
||||
|
||||
// Open display
|
||||
|
@ -232,14 +262,8 @@ int main(int argc, char **argv)
|
|||
XF86DGAForkApp(DefaultScreen(x_display));
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_GTK
|
||||
// Init GTK
|
||||
gtk_set_locale();
|
||||
gtk_init(&argc, &argv);
|
||||
#endif
|
||||
|
||||
// Read preferences
|
||||
PrefsInit();
|
||||
PrefsInit(argc, argv);
|
||||
|
||||
// Init system routines
|
||||
SysInit();
|
||||
|
|
|
@ -402,8 +402,8 @@ static void cb_remove_volume(...)
|
|||
}
|
||||
|
||||
// "Boot From" selected
|
||||
static void mn_boot_any(...) {PrefsReplaceInt16("bootdriver", 0);}
|
||||
static void mn_boot_cdrom(...) {PrefsReplaceInt16("bootdriver", CDROMRefNum);}
|
||||
static void mn_boot_any(...) {PrefsReplaceInt32("bootdriver", 0);}
|
||||
static void mn_boot_cdrom(...) {PrefsReplaceInt32("bootdriver", CDROMRefNum);}
|
||||
|
||||
// "No CD-ROM Driver" button toggled
|
||||
static void tb_nocdrom(GtkWidget *widget)
|
||||
|
@ -466,7 +466,7 @@ static void create_volumes_pane(GtkWidget *top)
|
|||
{STR_BOOT_CDROM_LAB, GTK_SIGNAL_FUNC(mn_boot_cdrom)},
|
||||
{0, NULL}
|
||||
};
|
||||
int bootdriver = PrefsFindInt16("bootdriver"), active = 0;
|
||||
int bootdriver = PrefsFindInt32("bootdriver"), active = 0;
|
||||
switch (bootdriver) {
|
||||
case 0: active = 0; break;
|
||||
case CDROMRefNum: active = 1; break;
|
||||
|
@ -773,7 +773,7 @@ static GtkWidget *w_mouse_wheel_lines;
|
|||
static void set_input_sensitive(void)
|
||||
{
|
||||
gtk_widget_set_sensitive(w_keycode_file, PrefsFindBool("keycodes"));
|
||||
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt16("mousewheelmode") == 1);
|
||||
gtk_widget_set_sensitive(w_mouse_wheel_lines, PrefsFindInt32("mousewheelmode") == 1);
|
||||
}
|
||||
|
||||
// "Use Raw Keycodes" button toggled
|
||||
|
@ -784,8 +784,8 @@ static void tb_keycodes(GtkWidget *widget)
|
|||
}
|
||||
|
||||
// "Mouse Wheel Mode" selected
|
||||
static void mn_wheel_page(...) {PrefsReplaceInt16("mousewheelmode", 0); set_input_sensitive();}
|
||||
static void mn_wheel_cursor(...) {PrefsReplaceInt16("mousewheelmode", 1); set_input_sensitive();}
|
||||
static void mn_wheel_page(...) {PrefsReplaceInt32("mousewheelmode", 0); set_input_sensitive();}
|
||||
static void mn_wheel_cursor(...) {PrefsReplaceInt32("mousewheelmode", 1); set_input_sensitive();}
|
||||
|
||||
// Read settings from widgets and set preferences
|
||||
static void read_input_settings(void)
|
||||
|
@ -796,7 +796,7 @@ static void read_input_settings(void)
|
|||
else
|
||||
PrefsRemoveItem("keycodefile");
|
||||
|
||||
PrefsReplaceInt16("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines)));
|
||||
PrefsReplaceInt32("mousewheellines", gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(w_mouse_wheel_lines)));
|
||||
}
|
||||
|
||||
// Create "Input" pane
|
||||
|
@ -817,7 +817,7 @@ static void create_input_pane(GtkWidget *top)
|
|||
{STR_MOUSEWHEELMODE_CURSOR_LAB, GTK_SIGNAL_FUNC(mn_wheel_cursor)},
|
||||
{0, NULL}
|
||||
};
|
||||
int wheelmode = PrefsFindInt16("mousewheelmode"), active = 0;
|
||||
int wheelmode = PrefsFindInt32("mousewheelmode"), active = 0;
|
||||
switch (wheelmode) {
|
||||
case 0: active = 0; break;
|
||||
case 1: active = 1; break;
|
||||
|
@ -832,7 +832,7 @@ static void create_input_pane(GtkWidget *top)
|
|||
gtk_widget_show(label);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
||||
|
||||
adj = gtk_adjustment_new(PrefsFindInt16("mousewheellines"), 1, 1000, 1, 5, 0);
|
||||
adj = gtk_adjustment_new(PrefsFindInt32("mousewheellines"), 1, 1000, 1, 5, 0);
|
||||
w_mouse_wheel_lines = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 0.0, 0);
|
||||
gtk_widget_show(w_mouse_wheel_lines);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), w_mouse_wheel_lines, FALSE, FALSE, 0);
|
||||
|
|
|
@ -31,8 +31,8 @@ prefs_desc platform_prefs_items[] = {
|
|||
{"keycodes", TYPE_BOOLEAN, false}, // Use keycodes rather than keysyms to decode keyboard (video_x.cpp)
|
||||
{"keycodefile", TYPE_STRING, false}, // File name of keycode translation table (video_x.cpp)
|
||||
{"fbdevicefile", TYPE_STRING, false}, // File name of frame buffer device specifications (video_x.cpp)
|
||||
{"mousewheelmode", TYPE_INT16, false}, // Mouse wheel support mode (0=Page up/down, 1=Cursor up/down) (video_x.cpp)
|
||||
{"mousewheellines", TYPE_INT16, false}, // Number of lines to scroll in mouse whell mode 1 (video_x.cpp)
|
||||
{"mousewheelmode", TYPE_INT32, false}, // Mouse wheel support mode (0=Page up/down, 1=Cursor up/down) (video_x.cpp)
|
||||
{"mousewheellines", TYPE_INT32, false}, // Number of lines to scroll in mouse whell mode 1 (video_x.cpp)
|
||||
{NULL, TYPE_END, false} // End of list
|
||||
};
|
||||
|
||||
|
@ -96,6 +96,6 @@ void AddPlatformPrefsDefaults(void)
|
|||
{
|
||||
PrefsAddBool("keycodes", false);
|
||||
PrefsReplaceString("extfs", "/");
|
||||
PrefsReplaceInt16("mousewheelmode", 1);
|
||||
PrefsReplaceInt16("mousewheellines", 3);
|
||||
PrefsReplaceInt32("mousewheelmode", 1);
|
||||
PrefsReplaceInt32("mousewheellines", 3);
|
||||
}
|
||||
|
|
|
@ -954,8 +954,8 @@ bool VideoInit(bool classic)
|
|||
keycode_init();
|
||||
|
||||
// Read prefs
|
||||
mouse_wheel_mode = PrefsFindInt16("mousewheelmode");
|
||||
mouse_wheel_lines = PrefsFindInt16("mousewheellines");
|
||||
mouse_wheel_mode = PrefsFindInt32("mousewheelmode");
|
||||
mouse_wheel_lines = PrefsFindInt32("mousewheellines");
|
||||
|
||||
// Find screen and root window
|
||||
screen = XDefaultScreen(x_display);
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
extern void PrefsInit(void);
|
||||
extern void PrefsInit(int argc, char **argv);
|
||||
extern void PrefsExit(void);
|
||||
|
||||
extern void AddPrefsDefaults(void);
|
||||
|
@ -39,17 +39,14 @@ extern void SavePrefsToStream(FILE *f);
|
|||
// Public preferences access functions
|
||||
extern void PrefsAddString(const char *name, const char *s);
|
||||
extern void PrefsAddBool(const char *name, bool b);
|
||||
extern void PrefsAddInt16(const char *name, int16 val);
|
||||
extern void PrefsAddInt32(const char *name, int32 val);
|
||||
|
||||
extern void PrefsReplaceString(const char *name, const char *s, int index = 0);
|
||||
extern void PrefsReplaceBool(const char *name, bool b);
|
||||
extern void PrefsReplaceInt16(const char *name, int16 val);
|
||||
extern void PrefsReplaceInt32(const char *name, int32 val);
|
||||
|
||||
extern const char *PrefsFindString(const char *name, int index = 0);
|
||||
extern bool PrefsFindBool(const char *name);
|
||||
extern int16 PrefsFindInt16(const char *name);
|
||||
extern int32 PrefsFindInt32(const char *name);
|
||||
|
||||
extern void PrefsRemoveItem(const char *name, int index = 0);
|
||||
|
@ -63,7 +60,6 @@ extern void PrefsRemoveItem(const char *name, int index = 0);
|
|||
enum prefs_type {
|
||||
TYPE_STRING, // char[]
|
||||
TYPE_BOOLEAN, // bool
|
||||
TYPE_INT16, // int16
|
||||
TYPE_INT32, // int32
|
||||
TYPE_ANY, // Wildcard for find_node
|
||||
TYPE_END = TYPE_ANY // Terminator for prefs_desc list
|
||||
|
|
|
@ -102,10 +102,10 @@ bool InitAll(void)
|
|||
XPRAMInit();
|
||||
|
||||
// Set boot volume
|
||||
int16 i16 = PrefsFindInt16("bootdrive");
|
||||
int16 i16 = PrefsFindInt32("bootdrive");
|
||||
XPRAM[0x78] = i16 >> 8;
|
||||
XPRAM[0x79] = i16 & 0xff;
|
||||
i16 = PrefsFindInt16("bootdriver");
|
||||
i16 = PrefsFindInt32("bootdriver");
|
||||
XPRAM[0x7a] = i16 >> 8;
|
||||
XPRAM[0x7b] = i16 & 0xff;
|
||||
|
||||
|
|
|
@ -37,24 +37,76 @@ struct prefs_node {
|
|||
};
|
||||
|
||||
// List of prefs nodes
|
||||
static prefs_node *the_prefs;
|
||||
static prefs_node *the_prefs = NULL;
|
||||
|
||||
// Prototypes
|
||||
static const prefs_desc *find_prefs_desc(const char *name);
|
||||
|
||||
|
||||
/*
|
||||
* Initialize preferences
|
||||
*/
|
||||
|
||||
void PrefsInit(void)
|
||||
void PrefsInit(int argc, char **argv)
|
||||
{
|
||||
// Start with empty list
|
||||
the_prefs = NULL;
|
||||
|
||||
// Set defaults
|
||||
AddPrefsDefaults();
|
||||
AddPlatformPrefsDefaults();
|
||||
|
||||
// Load preferences from settings file
|
||||
LoadPrefs();
|
||||
|
||||
// Override prefs with command line arguments
|
||||
argc--; argv++;
|
||||
for (; argc>0; argc--, argv++) {
|
||||
|
||||
// Arguments are of the form '--keyword'
|
||||
if (strlen(*argv) < 3 || argv[0][0] != '-' || argv[0][1] != '-') {
|
||||
printf("WARNING: Unrecognized argument '%s'\n", *argv);
|
||||
continue;
|
||||
}
|
||||
const char *keyword = *argv + 2;
|
||||
const prefs_desc *d = find_prefs_desc(keyword);
|
||||
if (d == NULL) {
|
||||
printf("WARNING: Unrecognized argument '%s'\n", *argv);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Add/replace prefs item
|
||||
switch (d->type) {
|
||||
case TYPE_STRING:
|
||||
if (argc < 2) {
|
||||
printf("WARNING: Argument '%s' must be followed by value\n", *argv);
|
||||
break;
|
||||
}
|
||||
argc--; argv++;
|
||||
if (d->multiple)
|
||||
PrefsAddString(keyword, *argv);
|
||||
else
|
||||
PrefsReplaceString(keyword, *argv);
|
||||
break;
|
||||
|
||||
case TYPE_BOOLEAN:
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
argc--; argv++;
|
||||
PrefsReplaceBool(keyword, !strcmp(*argv, "true") || !strcmp(*argv, "on"));
|
||||
} else
|
||||
PrefsReplaceBool(keyword, true);
|
||||
break;
|
||||
|
||||
case TYPE_INT32:
|
||||
if (argc < 2) {
|
||||
printf("WARNING: Argument '%s' must be followed by value\n", *argv);
|
||||
break;
|
||||
}
|
||||
argc--; argv++;
|
||||
PrefsReplaceInt32(keyword, atoi(*argv));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,6 +142,14 @@ static const prefs_desc *find_prefs_desc(const char *name, const prefs_desc *lis
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const prefs_desc *find_prefs_desc(const char *name)
|
||||
{
|
||||
const prefs_desc *d = find_prefs_desc(name, common_prefs_items);
|
||||
if (d == NULL)
|
||||
d = find_prefs_desc(name, platform_prefs_items);
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set prefs items
|
||||
|
@ -125,11 +185,6 @@ void PrefsAddBool(const char *name, bool b)
|
|||
add_data(name, TYPE_BOOLEAN, &b, sizeof(bool));
|
||||
}
|
||||
|
||||
void PrefsAddInt16(const char *name, int16 val)
|
||||
{
|
||||
add_data(name, TYPE_INT16, &val, sizeof(int16));
|
||||
}
|
||||
|
||||
void PrefsAddInt32(const char *name, int32 val)
|
||||
{
|
||||
add_data(name, TYPE_INT32, &val, sizeof(int32));
|
||||
|
@ -175,15 +230,6 @@ void PrefsReplaceBool(const char *name, bool b)
|
|||
add_data(name, TYPE_BOOLEAN, &b, sizeof(bool));
|
||||
}
|
||||
|
||||
void PrefsReplaceInt16(const char *name, int16 val)
|
||||
{
|
||||
prefs_node *p = find_node(name, TYPE_INT16);
|
||||
if (p)
|
||||
*(int16 *)(p->data) = val;
|
||||
else
|
||||
add_data(name, TYPE_INT16, &val, sizeof(int16));
|
||||
}
|
||||
|
||||
void PrefsReplaceInt32(const char *name, int32 val)
|
||||
{
|
||||
prefs_node *p = find_node(name, TYPE_INT32);
|
||||
|
@ -216,15 +262,6 @@ bool PrefsFindBool(const char *name)
|
|||
return false;
|
||||
}
|
||||
|
||||
int16 PrefsFindInt16(const char *name)
|
||||
{
|
||||
prefs_node *p = find_node(name, TYPE_INT16, 0);
|
||||
if (p)
|
||||
return *(int16 *)(p->data);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 PrefsFindInt32(const char *name)
|
||||
{
|
||||
prefs_node *p = find_node(name, TYPE_INT32, 0);
|
||||
|
@ -292,10 +329,8 @@ void LoadPrefsFromStream(FILE *f)
|
|||
char *value = p;
|
||||
int32 i = atol(value);
|
||||
|
||||
// Look for keyword first in common item list, then in platform specific list
|
||||
const prefs_desc *desc = find_prefs_desc(keyword, common_prefs_items);
|
||||
if (desc == NULL)
|
||||
desc = find_prefs_desc(keyword, platform_prefs_items);
|
||||
// Look for keyword first in prefs item list
|
||||
const prefs_desc *desc = find_prefs_desc(keyword);
|
||||
if (desc == NULL) {
|
||||
printf("WARNING: Unknown preferences keyword '%s'\n", keyword);
|
||||
continue;
|
||||
|
@ -312,9 +347,6 @@ void LoadPrefsFromStream(FILE *f)
|
|||
case TYPE_BOOLEAN:
|
||||
PrefsReplaceBool(keyword, !strcmp(value, "true"));
|
||||
break;
|
||||
case TYPE_INT16:
|
||||
PrefsReplaceInt16(keyword, i);
|
||||
break;
|
||||
case TYPE_INT32:
|
||||
PrefsReplaceInt32(keyword, i);
|
||||
break;
|
||||
|
@ -343,9 +375,6 @@ static void write_prefs(FILE *f, const prefs_desc *list)
|
|||
case TYPE_BOOLEAN:
|
||||
fprintf(f, "%s %s\n", list->name, PrefsFindBool(list->name) ? "true" : "false");
|
||||
break;
|
||||
case TYPE_INT16:
|
||||
fprintf(f, "%s %d\n", list->name, PrefsFindInt16(list->name));
|
||||
break;
|
||||
case TYPE_INT32:
|
||||
fprintf(f, "%s %d\n", list->name, PrefsFindInt32(list->name));
|
||||
break;
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
|
||||
// Common preferences items (those which exist on all platforms)
|
||||
// Except for "disk", "floppy", "cdrom", "scsiX", "screen", "rom" and "ether",
|
||||
// these are guaranteed to be in the prefs; "disk", "floppy" and "cdrom" can
|
||||
// occur multiple times
|
||||
// these are guaranteed to be in the prefs.
|
||||
prefs_desc common_prefs_items[] = {
|
||||
{"disk", TYPE_STRING, true}, // Device/file names of Mac volumes (disk.cpp)
|
||||
{"floppy", TYPE_STRING, true}, // Device/file names of Mac floppy drives (sony.cpp)
|
||||
|
@ -45,8 +44,8 @@ prefs_desc common_prefs_items[] = {
|
|||
{"serialb", TYPE_STRING, false}, // Device name of Mac serial port B (serial_*.cpp)
|
||||
{"ether", TYPE_STRING, false}, // Device name of Mac ethernet adapter (ether_*.cpp)
|
||||
{"rom", TYPE_STRING, false}, // Path of ROM file (main_*.cpp)
|
||||
{"bootdrive", TYPE_INT16, false}, // Boot drive number (main.cpp)
|
||||
{"bootdriver", TYPE_INT16, false}, // Boot driver number (main.cpp)
|
||||
{"bootdrive", TYPE_INT32, false}, // Boot drive number (main.cpp)
|
||||
{"bootdriver", TYPE_INT32, false}, // Boot driver number (main.cpp)
|
||||
{"ramsize", TYPE_INT32, false}, // Size of Mac RAM in bytes (main_*.cpp)
|
||||
{"frameskip", TYPE_INT32, false}, // Number of frames to skip in refreshed video modes (video_*.cpp)
|
||||
{"modelid", TYPE_INT32, false}, // Mac Model ID (Gestalt Model ID minus 6) (rom_patches.cpp)
|
||||
|
@ -67,8 +66,8 @@ prefs_desc common_prefs_items[] = {
|
|||
void AddPrefsDefaults(void)
|
||||
{
|
||||
SysAddSerialPrefs();
|
||||
PrefsAddInt16("bootdriver", 0);
|
||||
PrefsAddInt16("bootdrive", 0);
|
||||
PrefsAddInt32("bootdriver", 0);
|
||||
PrefsAddInt32("bootdrive", 0);
|
||||
PrefsAddInt32("ramsize", 8 * 1024 * 1024);
|
||||
PrefsAddInt32("frameskip", 6);
|
||||
PrefsAddInt32("modelid", 5); // Mac IIci
|
||||
|
|
Loading…
Reference in New Issue
Block a user