4 |
|
* |
5 |
|
* $Id$ |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2001 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
8 |
|
* |
9 |
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
30 |
|
self = [super init]; |
31 |
|
|
32 |
|
numItems = 0; |
33 |
< |
col1 = [[NSMutableArray alloc] init]; |
34 |
< |
col2 = [[NSMutableArray alloc] init]; |
33 |
> |
col1 = [NSMutableArray new]; |
34 |
> |
col2 = [NSMutableArray new]; |
35 |
|
|
36 |
|
return self; |
37 |
|
} |
105 |
|
|
106 |
|
@end |
107 |
|
|
108 |
– |
@implementation PrefsEditor |
109 |
– |
|
108 |
|
#import <AppKit/NSImage.h> // For [NSBundle pathForImageResource:] proto |
109 |
|
|
110 |
+ |
#include <string> |
111 |
+ |
using std::string; |
112 |
+ |
extern string UserPrefsPath; // from prefs_unix.cpp |
113 |
+ |
|
114 |
|
#import "sysdeps.h" // Types used in Basilisk C++ code |
115 |
|
#import "video_macosx.h" // some items that we edit here |
116 |
|
#import "misc_macosx.h" // WarningSheet() prototype |
117 |
+ |
#import "main_macosx.h" // ChoiceAlert() prototype |
118 |
+ |
|
119 |
|
|
120 |
|
#import <prefs.h> |
121 |
|
|
122 |
|
#define DEBUG 0 |
123 |
|
#import <debug.h> |
124 |
|
|
125 |
+ |
@implementation PrefsEditor |
126 |
+ |
|
127 |
|
- (PrefsEditor *) init |
128 |
|
{ |
129 |
|
self = [super init]; |
132 |
|
|
133 |
|
devs = @"/dev"; |
134 |
|
home = NSHomeDirectory(); |
135 |
< |
volsDS = [[TableDS alloc] init]; |
136 |
< |
SCSIds = [[TableDS alloc] init]; |
135 |
> |
volsDS = [TableDS new]; |
136 |
> |
SCSIds = [TableDS new]; |
137 |
|
|
138 |
< |
lockCell = [[NSImageCell alloc] init]; |
138 |
> |
lockCell = [NSImageCell new]; |
139 |
|
if ( lockCell == nil ) |
140 |
|
NSLog (@"%s - Can't create NSImageCell?", __PRETTY_FUNCTION__); |
141 |
|
|
142 |
< |
blank = [[NSImage alloc] init]; |
142 |
> |
blank = [NSImage new]; |
143 |
|
locked = [NSImage alloc]; |
144 |
|
if ( [locked initWithContentsOfFile: |
145 |
|
[[NSBundle mainBundle] |
198 |
|
{ |
199 |
|
[volsDS addObject: (NSObject *) locked |
200 |
|
withPath: [oP filename] ]; |
201 |
< |
PrefsAddString("disk", [[oP filename] cString]); |
201 |
> |
PrefsAddString("disk", [[oP filename] UTF8String]); |
202 |
|
[diskImages reloadData]; |
203 |
|
edited = YES; |
204 |
|
} |
219 |
|
types:nil] == NSOKButton ) |
220 |
|
{ |
221 |
|
[extFS setStringValue: [oP directory] ]; |
222 |
< |
PrefsReplaceString("extfs", [[oP directory] cString]); |
222 |
> |
PrefsReplaceString("extfs", [[oP directory] UTF8String]); |
223 |
|
edited = YES; |
224 |
|
} |
225 |
|
} |
226 |
|
|
227 |
+ |
- (IBAction) BrowsePrefs: (id)sender |
228 |
+ |
{ |
229 |
+ |
NSOpenPanel *oP = [NSOpenPanel openPanel]; |
230 |
+ |
|
231 |
+ |
[oP setCanChooseFiles: YES]; |
232 |
+ |
[oP setTitle: @"Select a Preferences file"]; |
233 |
+ |
D(NSLog(@"%s - home = %@", __PRETTY_FUNCTION__, home)); |
234 |
+ |
if ( [oP runModalForDirectory: ([prefsFile stringValue] ? [prefsFile stringValue] : home) |
235 |
+ |
file:nil |
236 |
+ |
types:nil] == NSOKButton ) |
237 |
+ |
{ |
238 |
+ |
[prefsFile setStringValue: [oP filename] ]; |
239 |
+ |
UserPrefsPath = [[oP filename] UTF8String]; |
240 |
+ |
} |
241 |
+ |
} |
242 |
+ |
|
243 |
|
- (IBAction) BrowseROM: (id)sender |
244 |
|
{ |
245 |
|
NSOpenPanel *oP = [NSOpenPanel openPanel]; |
252 |
|
types:nil] == NSOKButton ) |
253 |
|
{ |
254 |
|
[ROMfile setStringValue: [oP filename] ]; |
255 |
< |
PrefsReplaceString("rom", [[oP filename] cString]); |
255 |
> |
PrefsReplaceString("rom", [[oP filename] UTF8String]); |
256 |
|
edited = YES; |
257 |
|
} |
258 |
|
} |
261 |
|
|
262 |
|
- (IBAction) ChangeBootFrom: (NSMatrix *)sender |
263 |
|
{ |
264 |
< |
if ( [sender selectedCell] == bootFromCD ) |
264 |
> |
if ( [sender selectedCell] == (id)bootFromCD ) |
265 |
|
PrefsReplaceInt32("bootdriver", CDROMRefNum); |
266 |
|
else |
267 |
|
PrefsReplaceInt32("bootdriver", 0); |
282 |
|
|
283 |
|
- (IBAction) ChangeDisableSound: (NSButton *)sender |
284 |
|
{ |
285 |
< |
PrefsReplaceBool("nosound", [disableSound state]); |
285 |
> |
BOOL noSound = [disableSound state]; |
286 |
> |
|
287 |
> |
if ( ! noSound ) |
288 |
> |
WarningSheet(@"Sound is currently unimplemented", panel); |
289 |
> |
|
290 |
> |
PrefsReplaceBool("nosound", noSound); |
291 |
|
edited = YES; |
292 |
|
} |
293 |
|
|
297 |
|
edited = YES; |
298 |
|
} |
299 |
|
|
300 |
+ |
- (IBAction) ChangeKeyboard: (NSPopUpButton *)sender |
301 |
+ |
{ |
302 |
+ |
// Deselest current item |
303 |
+ |
int current = [keyboard indexOfItemWithTag: PrefsFindInt32("keyboardtype")]; |
304 |
+ |
if ( current != -1 ) |
305 |
+ |
[[keyboard itemAtIndex: current] setState: FALSE]; |
306 |
+ |
|
307 |
+ |
PrefsReplaceInt32("keyboardtype", [[sender selectedItem] tag]); |
308 |
+ |
edited = YES; |
309 |
+ |
} |
310 |
+ |
|
311 |
|
- (IBAction) ChangeModel: (NSMatrix *)sender |
312 |
|
{ |
313 |
|
PrefsReplaceInt32("modelid", [[sender selectedCell] tag]); |
314 |
|
edited = YES; |
315 |
|
} |
316 |
|
|
279 |
– |
// Screen/window changing stuff |
317 |
|
|
318 |
< |
// This is called when any of the screen/window, width, height or depth is changed |
318 |
> |
// If we are not using the CGIMAGEREF drawing strategy, |
319 |
> |
// then source bitmaps must be 32bits deep. |
320 |
> |
|
321 |
> |
- (short) testWinDepth: (int) newbpp |
322 |
> |
{ |
323 |
> |
#ifdef CGIMAGEREF |
324 |
> |
return newbpp; |
325 |
> |
#else |
326 |
> |
if ( newbpp != 32 ) |
327 |
> |
WarningSheet(@"Sorry - In windowed mode, depth must be 32", panel); |
328 |
> |
return 32 |
329 |
> |
#endif |
330 |
> |
} |
331 |
> |
|
332 |
> |
// This is called when the screen/window, |
333 |
> |
// width, height or depth is clicked. |
334 |
> |
// |
335 |
> |
// Note that sender may not actually be an NSMatrix. |
336 |
|
|
337 |
|
- (IBAction) ChangeScreen: (NSMatrix *)sender |
338 |
|
{ |
339 |
+ |
NSButton *cell = [sender selectedCell]; |
340 |
+ |
|
341 |
|
short newx = [width intValue]; |
342 |
|
short newy = [height intValue]; |
343 |
|
short newbpp = [depth intValue]; |
344 |
< |
short newtype = DISPLAY_WINDOW; |
344 |
> |
short newtype; |
345 |
|
char str[20]; |
346 |
|
|
347 |
< |
if ( [sender selectedCell] == openGL ) |
292 |
< |
newtype = DISPLAY_OPENGL; |
293 |
< |
if ( [sender selectedCell] == screen ) |
347 |
> |
if ( cell == screen ) |
348 |
|
newtype = DISPLAY_SCREEN; |
349 |
+ |
else if ( cell == window ) |
350 |
+ |
newtype = DISPLAY_WINDOW; |
351 |
+ |
else |
352 |
+ |
newtype = display_type; |
353 |
|
|
354 |
|
// Check that a field actually changed |
355 |
|
if ( newbpp == init_depth && newx == init_width && |
356 |
|
newy == init_height && newtype == display_type ) |
357 |
+ |
{ |
358 |
+ |
D(NSLog(@"No changed GUI items in ChangeScreen")); |
359 |
|
return; |
360 |
< |
|
360 |
> |
} |
361 |
|
|
362 |
|
// If we are changing type, supply some sensible defaults |
363 |
+ |
|
364 |
+ |
short screenx = CGDisplayPixelsWide(kCGDirectMainDisplay), |
365 |
+ |
screeny = CGDisplayPixelsHigh(kCGDirectMainDisplay), |
366 |
+ |
screenb = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
367 |
+ |
|
368 |
|
if ( newtype != display_type ) |
369 |
|
{ |
370 |
< |
if ( newtype == DISPLAY_SCREEN ) // If changing to full screen |
306 |
< |
{ |
307 |
< |
// supply main screen dimensions as a default |
308 |
< |
NSScreen *s = [NSScreen mainScreen]; |
309 |
< |
NSRect sr = [s frame]; |
310 |
< |
|
311 |
< |
newx = (short) sr.size.width; |
312 |
< |
newy = (short) sr.size.height; |
313 |
< |
// This always returns 24, despite the mode |
314 |
< |
//newbpp = NSBitsPerPixelFromDepth([s depth]); |
315 |
< |
newbpp = CGDisplayBitsPerPixel(kCGDirectMainDisplay); |
316 |
< |
} |
370 |
> |
D(NSLog(@"Changing display type in ChangeScreen")); |
371 |
|
|
372 |
< |
if ( display_type == DISPLAY_SCREEN ) // If changing from full screen |
372 |
> |
// If changing to full screen, supply main screen dimensions as a default |
373 |
> |
if ( newtype == DISPLAY_SCREEN ) |
374 |
> |
newx = screenx, newy = screeny, newbpp = screenb; |
375 |
> |
|
376 |
> |
// If changing from full screen, use minimum screen resolutions |
377 |
> |
if ( display_type == DISPLAY_SCREEN ) |
378 |
> |
{ |
379 |
|
newx = MIN_WIDTH, newy = MIN_HEIGHT; |
380 |
< |
|
381 |
< |
[width setIntValue: newx]; |
322 |
< |
[height setIntValue: newy]; |
323 |
< |
[depth setIntValue: newbpp]; |
380 |
> |
newbpp = [self testWinDepth: newbpp]; |
381 |
> |
} |
382 |
|
} |
383 |
|
else |
384 |
|
{ |
385 |
+ |
newbpp = [self testWinDepth: newbpp]; |
386 |
+ |
|
387 |
|
// Check size is within ranges of MIN_WIDTH ... MAX_WIDTH |
388 |
|
// and MIN_HEIGHT ... MAX_HEIGHT |
389 |
|
// ??? |
390 |
|
} |
391 |
|
|
392 |
+ |
[width setIntValue: newx]; |
393 |
+ |
[height setIntValue: newy]; |
394 |
+ |
[depth setIntValue: newbpp]; |
395 |
+ |
|
396 |
|
|
397 |
|
// Store new prefs |
398 |
|
*str = '\0'; |
404 |
|
else |
405 |
|
sprintf(str, "win/%hd/%hd", newx, newy); |
406 |
|
break; |
343 |
– |
case DISPLAY_OPENGL: |
344 |
– |
if ( newbpp ) |
345 |
– |
sprintf(str, "opengl/%hd/%hd/%hd", newx, newy, newbpp); |
346 |
– |
else |
347 |
– |
sprintf(str, "opengl/%hd/%hd", newx, newy); |
348 |
– |
break; |
407 |
|
case DISPLAY_SCREEN: |
408 |
|
if ( newbpp ) |
409 |
|
sprintf(str, "full/%hd/%hd/%hd", newx, newy, newbpp); |
418 |
|
edited = YES; |
419 |
|
|
420 |
|
if ( display_type != DISPLAY_SCREEN ) |
421 |
+ |
{ |
422 |
+ |
D(NSLog(@"Display type is not SCREEN (%d), resizing window", |
423 |
+ |
display_type)); |
424 |
|
resizeWinTo(newx, newy); |
425 |
+ |
} |
426 |
|
} |
427 |
|
|
428 |
|
- (IBAction) CreateVolume: (id)sender |
436 |
|
if ( [sP runModalForDirectory:NSHomeDirectory() file:@"basilisk-II.vol"] == NSOKButton ) |
437 |
|
{ |
438 |
|
char cmd[1024]; |
439 |
< |
const char *filename = [[sP filename] cString]; |
439 |
> |
const char *filename = [[sP filename] UTF8String]; |
440 |
|
int retVal, |
441 |
|
size = [newVolumeSize intValue]; |
442 |
|
|
443 |
|
sprintf(cmd, "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", filename, size); |
444 |
+ |
|
445 |
|
retVal = system(cmd); |
446 |
|
if (retVal != 0) |
447 |
|
{ |
448 |
|
NSString *details = [NSString stringWithFormat: |
449 |
|
@"The dd command failed.\nReturn status %d (%s)", |
450 |
|
retVal, strerror(errno)]; |
451 |
< |
WarningSheet(@"Unable to create volume", details, @"OK", panel); |
451 |
> |
WarningSheet(@"Unable to create volume", details, nil, panel); |
452 |
|
} |
453 |
|
else |
454 |
|
{ |
460 |
|
} |
461 |
|
} |
462 |
|
|
463 |
+ |
- (BOOL) fileManager: (NSFileManager *) manager |
464 |
+ |
shouldProceedAfterError: (NSDictionary *) errorDict |
465 |
+ |
{ |
466 |
+ |
NSRunAlertPanel(@"File operation error", |
467 |
+ |
@"%@ %@, toPath %@", |
468 |
+ |
@"Bugger!", nil, nil, |
469 |
+ |
[errorDict objectForKey:@"Error"], |
470 |
+ |
[errorDict objectForKey:@"Path"], |
471 |
+ |
[errorDict objectForKey:@"ToPath"]); |
472 |
+ |
return NO; |
473 |
+ |
} |
474 |
+ |
|
475 |
|
- (IBAction) DeleteVolume: (id)sender |
476 |
|
{ |
477 |
< |
const char *path = [self RemoveVolumeEntry]; |
478 |
< |
if ( unlink(path) == -1 ) |
477 |
> |
NSString *Path = [self RemoveVolumeEntry]; |
478 |
> |
|
479 |
> |
if ( ! Path ) |
480 |
> |
return; |
481 |
> |
|
482 |
> |
if ( ! [[NSFileManager defaultManager] removeFileAtPath: Path |
483 |
> |
handler: self] ) |
484 |
|
{ |
485 |
< |
NSLog(@"%s unlink(%s) failed", __PRETTY_FUNCTION__, path, strerror(errno)); |
485 |
> |
WarningSheet(@"Unable to delete volume", panel); |
486 |
> |
NSLog(@"%s unlink(%s) failed - %s", __PRETTY_FUNCTION__, |
487 |
> |
[Path cString], strerror(errno)); |
488 |
|
} |
489 |
|
} |
490 |
|
|
509 |
|
int B = (int) [bytes floatValue]; |
510 |
|
float M = B / 1024 / 1024; |
511 |
|
|
512 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
512 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
513 |
|
PrefsReplaceInt32("ramsize", B); |
514 |
|
[MB setFloatValue: M]; |
515 |
|
edited = YES; |
519 |
|
{ |
520 |
|
NSString *path = [etherNet stringValue]; |
521 |
|
|
522 |
< |
PrefsReplaceString("ether", [path cString]); |
522 |
> |
PrefsReplaceString("ether", [path UTF8String]); |
523 |
|
edited = YES; |
524 |
|
} |
525 |
|
|
527 |
|
{ |
528 |
|
NSString *path = [extFS stringValue]; |
529 |
|
|
530 |
< |
PrefsReplaceString("extfs", [path cString]); |
530 |
> |
PrefsReplaceString("extfs", [path UTF8String]); |
531 |
|
edited = YES; |
532 |
|
} |
533 |
|
|
544 |
|
{ |
545 |
|
NSString *path = [modem stringValue]; |
546 |
|
|
547 |
< |
PrefsReplaceString("seriala", [path cString]); |
547 |
> |
PrefsReplaceString("seriala", [path UTF8String]); |
548 |
|
edited = YES; |
549 |
|
} |
550 |
|
|
553 |
|
float M = [MB floatValue]; |
554 |
|
int B = (int) (M * 1024 * 1024); |
555 |
|
|
556 |
< |
NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B); |
556 |
> |
D(NSLog(@"%s = %f %d", __PRETTY_FUNCTION__, M, B)); |
557 |
|
PrefsReplaceInt32("ramsize", B); |
558 |
|
[bytes setIntValue: B]; |
559 |
|
edited = YES; |
563 |
|
{ |
564 |
|
NSString *path = [printer stringValue]; |
565 |
|
|
566 |
< |
PrefsReplaceString("serialb", [path cString]); |
485 |
< |
edited = YES; |
486 |
< |
} |
487 |
< |
|
488 |
< |
- (IBAction) EditRAMsize: (NSTextField *)sender |
489 |
< |
{ |
490 |
< |
int B = [bytes intValue]; |
491 |
< |
float M = B / (1024.0 * 1024.0); |
492 |
< |
|
493 |
< |
NSLog(@"%s = %d %f", __PRETTY_FUNCTION__, B, M); |
494 |
< |
PrefsReplaceInt32("ramsize", B); |
495 |
< |
[MB setFloatValue: M]; |
566 |
> |
PrefsReplaceString("serialb", [path UTF8String]); |
567 |
|
edited = YES; |
568 |
|
} |
569 |
|
|
571 |
|
{ |
572 |
|
NSString *path = [ROMfile stringValue]; |
573 |
|
|
574 |
< |
PrefsReplaceString("rom", [path cString]); |
574 |
> |
PrefsReplaceString("rom", [path UTF8String]); |
575 |
|
} |
576 |
|
|
577 |
|
- (IBAction) RemoveSCSI: (id)sender |
584 |
|
NSLog (@"%s - [SCSIds deleteRow: %d] failed", __PRETTY_FUNCTION__, row); |
585 |
|
[SCSIdisks reloadData]; |
586 |
|
sprintf(pref, "scsi%d", SCSIid); |
587 |
< |
PrefsRemoveItem(pref,0); |
587 |
> |
//PrefsRemoveItem(pref,0); |
588 |
> |
PrefsRemoveItem(pref, 1); |
589 |
|
} |
590 |
|
|
591 |
< |
- (const char *) RemoveVolumeEntry |
591 |
> |
- (NSString *) RemoveVolumeEntry |
592 |
|
{ |
593 |
|
int row = [diskImages selectedRow]; |
594 |
|
|
595 |
|
if ( row != -1 ) |
596 |
|
{ |
597 |
< |
const char *path = [[volsDS pathAtRow: row] cString], |
597 |
> |
NSString *Path = [volsDS pathAtRow: row]; |
598 |
> |
const char *path = [Path UTF8String], |
599 |
|
*str; |
600 |
|
int tmp = 0; |
601 |
|
|
602 |
+ |
NSString *prompt = [NSString stringWithFormat: @"%s\n%s", |
603 |
+ |
"Are you sure you want to delete the file", |
604 |
+ |
path]; |
605 |
+ |
|
606 |
+ |
if ( ! ChoiceAlert([prompt cString], "Delete", "Cancel") ) |
607 |
+ |
return NULL; |
608 |
+ |
|
609 |
|
while ( (str = PrefsFindString("disk", tmp) ) != NULL ) |
610 |
|
{ |
611 |
|
if ( strcmp(str, path) == 0 ) |
612 |
|
{ |
613 |
|
PrefsRemoveItem("disk", tmp); |
614 |
< |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", __PRETTY_FUNCTION__, tmp)); |
614 |
> |
D(NSLog(@"%s - Deleted prefs entry \"disk\", %d", |
615 |
> |
__PRETTY_FUNCTION__, tmp)); |
616 |
|
edited = YES; |
617 |
|
break; |
618 |
|
} |
621 |
|
|
622 |
|
if ( str == NULL ) |
623 |
|
{ |
624 |
< |
NSLog(@"%s - Couldn't find any disk preference to match %s", __PRETTY_FUNCTION__, path); |
624 |
> |
NSLog(@"%s - Couldn't find any disk preference to match %s", |
625 |
> |
__PRETTY_FUNCTION__, path); |
626 |
|
return NULL; |
627 |
|
} |
628 |
|
|
629 |
|
if ( ! [volsDS deleteRow: row] ) |
630 |
|
NSLog (@"%s - RemoveVolume %d failed", __PRETTY_FUNCTION__, tmp); |
631 |
|
[diskImages reloadData]; |
632 |
< |
return path; |
632 |
> |
// return path; |
633 |
> |
return Path; |
634 |
|
} |
635 |
|
else |
636 |
|
{ |
637 |
< |
WarningSheet(@"Please select a volume first", @"", @"OK", panel); |
637 |
> |
WarningSheet(@"Please select a volume first", panel); |
638 |
|
return NULL; |
639 |
|
} |
640 |
|
} |
644 |
|
[self RemoveVolumeEntry]; |
645 |
|
} |
646 |
|
|
647 |
< |
- (IBAction) ResetPrefs: (id)sender |
647 |
> |
- (void) loadPrefs: (int) argc |
648 |
> |
args: (char **) argv |
649 |
|
{ |
566 |
– |
int argc = 0; |
567 |
– |
char **argv = NULL; |
568 |
– |
|
650 |
|
[panel close]; // Temporarily hide preferences panel |
651 |
|
|
652 |
|
PrefsExit(); // Purge all the old pref values |
662 |
|
edited = NO; |
663 |
|
} |
664 |
|
|
665 |
+ |
- (IBAction) LoadPrefs: (id)sender |
666 |
+ |
{ |
667 |
+ |
int argc = 2; |
668 |
+ |
char *argv[2]; |
669 |
+ |
|
670 |
+ |
argv[0] = "--prefs", |
671 |
+ |
argv[1] = (char *) [[prefsFile stringValue] UTF8String]; |
672 |
+ |
|
673 |
+ |
[self loadPrefs: argc |
674 |
+ |
args: argv]; |
675 |
+ |
} |
676 |
+ |
|
677 |
+ |
- (IBAction) ResetPrefs: (id)sender |
678 |
+ |
{ |
679 |
+ |
[self loadPrefs: 0 |
680 |
+ |
args: NULL]; |
681 |
+ |
} |
682 |
+ |
|
683 |
|
- (void) setStringOf: (NSTextField *) field |
684 |
< |
fromPref: (const char *) prefName |
684 |
> |
fromPref: (const char *) prefName |
685 |
|
{ |
686 |
|
const char *value = PrefsFindString(prefName, 0); |
687 |
|
|
688 |
|
if ( value ) |
689 |
< |
[field setStringValue: [NSString stringWithCString: value] ]; |
689 |
> |
[field setStringValue: [NSString stringWithUTF8String: value] ]; |
690 |
|
} |
691 |
|
|
692 |
|
- (IBAction) SavePrefs: (id)sender |
699 |
|
{ |
700 |
|
NSTableColumn *locks; |
701 |
|
const char *str; |
702 |
< |
int cpu, tmp; |
702 |
> |
int cpu, tmp, val; |
703 |
|
|
704 |
|
|
705 |
|
// Set simple single field items |
706 |
|
|
707 |
< |
tmp = PrefsFindInt32("frameskip"); |
708 |
< |
[delay setIntValue: tmp]; |
709 |
< |
if ( tmp ) |
710 |
< |
[frequency setFloatValue: 60.0 / tmp]; |
707 |
> |
val = PrefsFindInt32("frameskip"); |
708 |
> |
[delay setIntValue: val]; |
709 |
> |
if ( val ) |
710 |
> |
[frequency setFloatValue: 60.0 / val]; |
711 |
|
else |
712 |
|
[frequency setFloatValue: 60.0]; |
713 |
|
|
714 |
< |
tmp = PrefsFindInt32("ramsize"); |
715 |
< |
[bytes setIntValue: tmp]; |
716 |
< |
[MB setFloatValue: tmp / (1024.0 * 1024.0)]; |
714 |
> |
val = PrefsFindInt32("ramsize"); |
715 |
> |
[bytes setIntValue: val]; |
716 |
> |
[MB setFloatValue: val / (1024.0 * 1024.0)]; |
717 |
|
|
718 |
|
[disableCD setState: PrefsFindBool("nocdrom")]; |
719 |
|
[disableSound setState: PrefsFindBool("nosound")]; |
723 |
|
[self setStringOf: extFS fromPref: "extfs" ]; |
724 |
|
[self setStringOf: modem fromPref: "seriala"]; |
725 |
|
[self setStringOf: printer fromPref: "serialb"]; |
726 |
< |
[self setStringOf: ROMfile fromPref: "rom" ]; |
726 |
> |
[self setStringOf: ROMfile fromPref: "rom"]; |
727 |
> |
|
728 |
> |
[prefsFile setStringValue: [NSString stringWithUTF8String: UserPrefsPath.c_str()] ]; |
729 |
|
|
730 |
|
|
731 |
|
parse_screen_prefs(PrefsFindString("screen")); |
734 |
|
[height setIntValue: init_height]; |
735 |
|
[depth setIntValue: init_depth]; |
736 |
|
|
737 |
< |
[window setState: NO]; |
737 |
> |
[screen setState: NO]; |
738 |
|
switch ( display_type ) |
739 |
|
{ |
740 |
|
case DISPLAY_WINDOW: [window setState: YES]; break; |
640 |
– |
case DISPLAY_OPENGL: [openGL setState: YES]; break; |
741 |
|
case DISPLAY_SCREEN: [screen setState: YES]; break; |
742 |
|
} |
743 |
|
|
745 |
|
|
746 |
|
// Radio button groups: |
747 |
|
|
748 |
< |
tmp = PrefsFindInt32("bootdriver"); |
749 |
< |
[bootFromAny setState: tmp != CDROMRefNum]; |
750 |
< |
[bootFromCD setState: tmp == CDROMRefNum]; |
748 |
> |
val = PrefsFindInt32("bootdriver"); |
749 |
> |
[bootFromAny setState: val != CDROMRefNum]; |
750 |
> |
[bootFromCD setState: val == CDROMRefNum]; |
751 |
|
|
752 |
|
cpu = PrefsFindInt32("cpu"); |
753 |
< |
tmp = PrefsFindInt32("modelid"); |
753 |
> |
val = PrefsFindInt32("modelid"); |
754 |
|
|
755 |
|
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
756 |
|
puts("Current memory model does not support 24bit addressing"); |
757 |
< |
if ( tmp == [classic tag] ) |
757 |
> |
if ( val == [classic tag] ) |
758 |
|
{ |
759 |
|
// Window already created by NIB file, just display |
760 |
|
[panel makeKeyAndOrderFront:self]; |
761 |
|
WarningSheet(@"Compiled-in memory model does not support 24bit", |
762 |
< |
@"Disabling Mac Classic emulation", @"OK", panel); |
762 |
> |
@"Disabling Mac Classic emulation", nil, panel); |
763 |
|
cpu = [CPU68030 tag]; |
764 |
|
PrefsReplaceInt32("cpu", cpu); |
765 |
< |
tmp = [IIci tag]; |
766 |
< |
PrefsReplaceInt32("modelid", tmp); |
765 |
> |
val = [IIci tag]; |
766 |
> |
PrefsReplaceInt32("modelid", val); |
767 |
|
} |
768 |
|
|
769 |
|
puts("Disabling 68000 & Mac Classic buttons"); |
776 |
|
[CPU68030 setState: [CPU68030 tag] == cpu]; |
777 |
|
[CPU68040 setState: [CPU68040 tag] == cpu]; |
778 |
|
|
779 |
< |
[classic setState: [classic tag] == tmp]; |
780 |
< |
[IIci setState: [IIci tag] == tmp]; |
781 |
< |
[quadra900 setState: [quadra900 tag] == tmp]; |
779 |
> |
[classic setState: [classic tag] == val]; |
780 |
> |
[IIci setState: [IIci tag] == val]; |
781 |
> |
[quadra900 setState: [quadra900 tag] == val]; |
782 |
|
|
783 |
|
|
784 |
|
// Lists of thingies: |
785 |
|
|
786 |
+ |
val = PrefsFindInt32("keyboardtype"); |
787 |
+ |
tmp = [keyboard indexOfItemWithTag: val]; |
788 |
+ |
if ( tmp != -1 ) |
789 |
+ |
[keyboard selectItemAtIndex: tmp]; |
790 |
+ |
for ( tmp = 0; tmp < [keyboard numberOfItems]; ++tmp ) |
791 |
+ |
{ |
792 |
+ |
NSMenuItem *type = [keyboard itemAtIndex: tmp]; |
793 |
+ |
[type setState: [type tag] == val]; |
794 |
+ |
} |
795 |
+ |
|
796 |
+ |
|
797 |
|
for ( tmp = 0; tmp < 7; ++tmp) |
798 |
|
{ |
799 |
|
char pref[6]; |
818 |
|
{ |
819 |
|
if ( *str == '*' ) |
820 |
|
[volsDS addObject: (NSObject *) locked |
821 |
< |
withPath: [NSString stringWithCString: str+1]]; |
821 |
> |
withPath: [NSString stringWithUTF8String: str+1]]; |
822 |
|
else |
823 |
|
[volsDS addObject: (NSObject *) blank |
824 |
< |
withPath: [NSString stringWithCString: str]]; |
824 |
> |
withPath: [NSString stringWithUTF8String: str]]; |
825 |
|
} |
826 |
|
|
827 |
|
[diskImages setDataSource: volsDS]; |