mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-03-01 07:30:27 +00:00
Merge pull request #59 from atmaxinger/master
Allow the user to specify wether a Volume shall be treated as CDROM
This commit is contained in:
commit
6e06a22dd5
23
SheepShaver/src/MacOSX/Launcher/DiskType.h
Executable file
23
SheepShaver/src/MacOSX/Launcher/DiskType.h
Executable file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// DiskType.h
|
||||
// SheepShaver
|
||||
//
|
||||
// Created by maximilian on 01.02.14.
|
||||
// Copyright 2014 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@interface DiskType : NSObject {
|
||||
NSString* _path;
|
||||
BOOL _isCDROM;
|
||||
}
|
||||
|
||||
-(NSString*)path;
|
||||
-(BOOL)isCDROM;
|
||||
|
||||
-(void)setPath:(NSString*)thePath;
|
||||
-(void)setIsCDROM:(BOOL)cdrom;
|
||||
|
||||
@end
|
35
SheepShaver/src/MacOSX/Launcher/DiskType.m
Executable file
35
SheepShaver/src/MacOSX/Launcher/DiskType.m
Executable file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// DiskType.m
|
||||
// SheepShaver
|
||||
//
|
||||
// Created by maximilian on 01.02.14.
|
||||
// Copyright 2014 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DiskType.h"
|
||||
|
||||
|
||||
@implementation DiskType
|
||||
-(NSString*)path
|
||||
{
|
||||
return _path;
|
||||
}
|
||||
-(BOOL)isCDROM
|
||||
{
|
||||
return _isCDROM;
|
||||
}
|
||||
|
||||
-(void)setPath:(NSString*)thePath
|
||||
{
|
||||
_path = [thePath copy];
|
||||
}
|
||||
-(void)setIsCDROM:(BOOL)cdrom
|
||||
{
|
||||
_isCDROM=cdrom;
|
||||
}
|
||||
|
||||
-(NSString*)description {
|
||||
return [NSString stringWithFormat:@"DiskType, path:%@ isCDROM:%@", _path, _isCDROM];
|
||||
}
|
||||
|
||||
@end
|
0
SheepShaver/src/MacOSX/Launcher/English.lproj/InfoPlist.strings
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/InfoPlist.strings
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/classes.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/classes.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/info.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/designable.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/keyedobjects.nib
generated
Normal file → Executable file
0
SheepShaver/src/MacOSX/Launcher/English.lproj/VMListWindow.nib/keyedobjects.nib
generated
Normal file → Executable file
826
SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib
generated
Normal file → Executable file
826
SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/designable.nib
generated
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
BIN
SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib
generated
Normal file → Executable file
BIN
SheepShaver/src/MacOSX/Launcher/English.lproj/VMSettingsWindow.nib/keyedobjects.nib
generated
Normal file → Executable file
Binary file not shown.
5
SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
Normal file → Executable file
5
SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
Normal file → Executable file
@ -30,7 +30,8 @@
|
||||
IBOutlet NSView *diskSaveSize;
|
||||
IBOutlet NSTextField *diskSaveSizeField;
|
||||
NSMutableArray *diskArray;
|
||||
|
||||
IBOutlet NSView *isCDROM;
|
||||
IBOutlet NSButton *isCDROMcheckbox;
|
||||
// Setup
|
||||
IBOutlet NSTableView *disks;
|
||||
IBOutlet NSComboBox *bootFrom;
|
||||
@ -51,7 +52,7 @@
|
||||
// Keyboard/Mouse
|
||||
IBOutlet NSButton *useRawKeyCodes;
|
||||
IBOutlet NSTextField *rawKeyCodes;
|
||||
IBOutlet NSButton *browseRawKeyCodesButton;
|
||||
IBOutlet NSButton *browseRawKeyCodesButton;
|
||||
IBOutlet NSPopUpButton *mouseWheel;
|
||||
IBOutlet NSTextField *scrollLines;
|
||||
IBOutlet NSStepper *scrollLinesStepper;
|
||||
|
61
SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
Normal file → Executable file
61
SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
Normal file → Executable file
@ -26,6 +26,8 @@
|
||||
|
||||
#import "VMSettingsController.h"
|
||||
|
||||
#import "DiskType.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
const int CDROMRefNum = -62; // RefNum of driver
|
||||
@ -67,7 +69,21 @@ void prefs_exit()
|
||||
|
||||
- (id) tableView: (NSTableView *) table objectValueForTableColumn: (NSTableColumn *) col row: (int) row
|
||||
{
|
||||
return [diskArray objectAtIndex: row];
|
||||
DiskType *d = (DiskType*)[diskArray objectAtIndex:row];
|
||||
|
||||
if ([[col identifier] isEqualTo:@"isCDROMcol"]) {
|
||||
return [NSString stringWithFormat:@"%d", [d isCDROM]];
|
||||
}
|
||||
|
||||
return [d path];
|
||||
}
|
||||
|
||||
-(void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
|
||||
{
|
||||
if ([[tableColumn identifier] isEqual:@"isCDROMcol"]) {
|
||||
DiskType *d = (DiskType*)[diskArray objectAtIndex:row];
|
||||
[d setIsCDROM:![d isCDROM]];
|
||||
}
|
||||
}
|
||||
|
||||
static NSString *getStringFromPrefs(const char *key)
|
||||
@ -84,8 +100,23 @@ static NSString *getStringFromPrefs(const char *key)
|
||||
|
||||
const char *dsk;
|
||||
int index = 0;
|
||||
while ((dsk = PrefsFindString("disk", index++)) != NULL)
|
||||
[diskArray addObject: [NSString stringWithUTF8String: dsk ]];
|
||||
while ((dsk = PrefsFindString("disk", index++)) != NULL) {
|
||||
DiskType *disk = [[DiskType alloc] init];
|
||||
[disk setPath:[NSString stringWithUTF8String: dsk ]];
|
||||
[disk setIsCDROM:NO];
|
||||
|
||||
[diskArray addObject:disk];
|
||||
}
|
||||
|
||||
/* Fetch all CDROMs */
|
||||
index = 0;
|
||||
while ((dsk = PrefsFindString("cdrom", index++)) != NULL) {
|
||||
DiskType *disk = [[DiskType alloc] init];
|
||||
[disk setPath:[NSString stringWithUTF8String: dsk ]];
|
||||
[disk setIsCDROM:YES];
|
||||
|
||||
[diskArray addObject:disk];
|
||||
}
|
||||
|
||||
[disks setDataSource: self];
|
||||
[disks reloadData];
|
||||
@ -212,6 +243,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
{
|
||||
NSOpenPanel *open = [NSOpenPanel openPanel];
|
||||
[open setCanChooseDirectories:YES];
|
||||
[open setAccessoryView:isCDROM];
|
||||
[open setAllowsMultipleSelection:NO];
|
||||
[open setTreatsFilePackagesAsDirectories:YES];
|
||||
[open beginSheetForDirectory: [[NSFileManager defaultManager] currentDirectoryPath]
|
||||
@ -225,7 +257,12 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
|
||||
{
|
||||
if (theReturnCode == NSOKButton) {
|
||||
[diskArray addObject: makeRelativeIfNecessary([open filename])];
|
||||
DiskType *d = [[DiskType alloc] init];
|
||||
[d setPath:makeRelativeIfNecessary([open filename])];
|
||||
|
||||
[d setIsCDROM:([isCDROMcheckbox state] == NSOnState)];
|
||||
|
||||
[diskArray addObject: d];
|
||||
[disks reloadData];
|
||||
}
|
||||
}
|
||||
@ -261,7 +298,11 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
snprintf(cmd, sizeof(cmd), "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", [[save filename] UTF8String], [diskSaveSizeField intValue]);
|
||||
int ret = system(cmd);
|
||||
if (ret == 0) {
|
||||
[diskArray addObject: makeRelativeIfNecessary([save filename])];
|
||||
DiskType *d = [[DiskType alloc] init];
|
||||
[d setPath:makeRelativeIfNecessary([save filename])];
|
||||
[d setIsCDROM:NO];
|
||||
|
||||
[diskArray addObject: d];
|
||||
[disks reloadData];
|
||||
}
|
||||
}
|
||||
@ -350,12 +391,20 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
||||
|
||||
- (void) saveChanges: (id) sender
|
||||
{
|
||||
// Remove all disks
|
||||
while (PrefsFindString("disk"))
|
||||
PrefsRemoveItem("disk");
|
||||
// Remove all cdroms
|
||||
while (PrefsFindString("cdrom"))
|
||||
PrefsRemoveItem("cdrom");
|
||||
|
||||
|
||||
// Write all disks
|
||||
for (int i = 0; i < [diskArray count]; i++) {
|
||||
PrefsAddString("disk", [[diskArray objectAtIndex:i] UTF8String]);
|
||||
DiskType *d = [diskArray objectAtIndex:i];
|
||||
PrefsAddString([d isCDROM] ? "cdrom" : "disk", [[d path] UTF8String]);
|
||||
}
|
||||
|
||||
PrefsReplaceInt32("bootdriver", ([bootFrom indexOfSelectedItem] == 1 ? CDROMRefNum : 0));
|
||||
PrefsReplaceString("rom", [[romFile stringValue] UTF8String]);
|
||||
PrefsReplaceString("extfs", [[unixRoot stringValue] UTF8String]);
|
||||
|
@ -129,6 +129,7 @@
|
||||
08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */; };
|
||||
08CD42E814B7B8AA009CA2A2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42E714B7B8AA009CA2A2 /* Carbon.framework */; };
|
||||
08D93A16159FE174003B04EC /* clip_macosx64.mm in Sources */ = {isa = PBXBuildFile; fileRef = 08D93A15159FE174003B04EC /* clip_macosx64.mm */; };
|
||||
A7B1921418C35D4700791D8D /* DiskType.m in Sources */ = {isa = PBXBuildFile; fileRef = A7B1921318C35D4700791D8D /* DiskType.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -448,6 +449,8 @@
|
||||
08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
|
||||
08CD42E714B7B8AA009CA2A2 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
|
||||
08D93A15159FE174003B04EC /* clip_macosx64.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = clip_macosx64.mm; sourceTree = "<group>"; };
|
||||
A7B1921218C35D4700791D8D /* DiskType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiskType.h; sourceTree = "<group>"; };
|
||||
A7B1921318C35D4700791D8D /* DiskType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiskType.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -940,6 +943,8 @@
|
||||
0856D2D614A9A704000B1711 /* Launcher */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A7B1921218C35D4700791D8D /* DiskType.h */,
|
||||
A7B1921318C35D4700791D8D /* DiskType.m */,
|
||||
0856D30714A9A704000B1711 /* VMSettingsWindow.nib */,
|
||||
0856D31114A9A704000B1711 /* VMSettingsController.h */,
|
||||
0856D31214A9A704000B1711 /* VMSettingsController.mm */,
|
||||
@ -1452,6 +1457,7 @@
|
||||
0873A80214AC515D004F12B7 /* utils_macosx.mm in Sources */,
|
||||
083E370C16EFE85000CCCA59 /* disk_sparsebundle.cpp in Sources */,
|
||||
083E372216EFE87200CCCA59 /* tinyxml2.cpp in Sources */,
|
||||
A7B1921418C35D4700791D8D /* DiskType.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user