1 |
|
/* |
2 |
|
* VMSettingsController.mm - Preferences editing in Cocoa on Mac OS X |
3 |
|
* |
4 |
< |
* Copyright (C) 2006-2009 Alexei Svitkine |
4 |
> |
* Copyright (C) 2006-2010 Alexei Svitkine |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
18 |
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
*/ |
20 |
|
|
21 |
– |
#import "VMSettingsController.h" |
22 |
– |
|
21 |
|
#import "sysdeps.h" |
22 |
|
#import "prefs.h" |
23 |
|
|
24 |
+ |
// The _UINT64 define is needed to guard against a typedef mismatch with Snow Leopard headers. |
25 |
+ |
#define _UINT64 |
26 |
+ |
|
27 |
+ |
#import "VMSettingsController.h" |
28 |
+ |
|
29 |
+ |
#include <unistd.h> |
30 |
+ |
|
31 |
|
const int CDROMRefNum = -62; // RefNum of driver |
32 |
|
|
33 |
+ |
#ifdef STANDALONE_PREFS |
34 |
|
void prefs_init() |
35 |
|
{ |
36 |
|
} |
38 |
|
void prefs_exit() |
39 |
|
{ |
40 |
|
} |
41 |
+ |
#endif |
42 |
|
|
43 |
|
@implementation VMSettingsController |
44 |
|
|
176 |
|
[NSApp runModalForWindow:window]; |
177 |
|
} |
178 |
|
|
179 |
+ |
- (void) editSettingsForNewVM: (NSString *) vmdir sender: (id) sender |
180 |
+ |
{ |
181 |
+ |
chdir([vmdir fileSystemRepresentation]); |
182 |
+ |
AddPrefsDefaults(); |
183 |
+ |
AddPlatformPrefsDefaults(); |
184 |
+ |
LoadPrefs([vmdir fileSystemRepresentation]); |
185 |
+ |
PrefsReplaceString("screen", "win/800/600"); |
186 |
+ |
PrefsReplaceString("extfs", ""); |
187 |
+ |
PrefsReplaceString("ether", "slirp"); |
188 |
+ |
PrefsReplaceInt32("ramsize", 64 << 20); |
189 |
+ |
PrefsReplaceInt32("frameskip", 2); |
190 |
+ |
PrefsReplaceBool("jit", true); |
191 |
+ |
NSWindow *window = [self window]; |
192 |
+ |
[self setupGUI]; |
193 |
+ |
[NSApp runModalForWindow:window]; |
194 |
+ |
} |
195 |
+ |
|
196 |
|
static NSString *makeRelativeIfNecessary(NSString *path) |
197 |
|
{ |
198 |
|
char cwd[1024], filename[1024]; |
340 |
|
|
341 |
|
- (void) cancelEdit: (id) sender |
342 |
|
{ |
343 |
+ |
#ifdef STANDALONE_PREFS |
344 |
|
PrefsExit(); |
345 |
+ |
#endif |
346 |
|
[[self window] close]; |
347 |
|
[NSApp stopModal]; |
348 |
|
cancelWasClicked = YES; |
399 |
|
PrefsReplaceString("serialb", [[printerPort stringValue] UTF8String]); |
400 |
|
PrefsReplaceString("ether", [[ethernetInterface stringValue] UTF8String]); |
401 |
|
SavePrefs(); |
402 |
+ |
#ifdef STANDALONE_PREFS |
403 |
|
PrefsExit(); |
404 |
+ |
#endif |
405 |
|
|
406 |
|
[[self window] close]; |
407 |
|
[NSApp stopModal]; |