mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-03-01 07:30:27 +00:00
User can now specify wether the selected disk image is a CDROM (required for some games e.g. Diablo 2)
This commit is contained in:
parent
a3abfdc041
commit
fd62819e49
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.
4
SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
Normal file → Executable file
4
SheepShaver/src/MacOSX/Launcher/VMSettingsController.h
Normal file → Executable file
@ -31,6 +31,10 @@
|
|||||||
IBOutlet NSTextField *diskSaveSizeField;
|
IBOutlet NSTextField *diskSaveSizeField;
|
||||||
NSMutableArray *diskArray;
|
NSMutableArray *diskArray;
|
||||||
|
|
||||||
|
IBOutlet NSView *isCDROM;
|
||||||
|
IBOutlet NSButton *isCDROMcheckbox;
|
||||||
|
//NSMutableArray *cdromArray;
|
||||||
|
|
||||||
// Setup
|
// Setup
|
||||||
IBOutlet NSTableView *disks;
|
IBOutlet NSTableView *disks;
|
||||||
IBOutlet NSComboBox *bootFrom;
|
IBOutlet NSComboBox *bootFrom;
|
||||||
|
83
SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
Normal file → Executable file
83
SheepShaver/src/MacOSX/Launcher/VMSettingsController.mm
Normal file → Executable file
@ -26,8 +26,11 @@
|
|||||||
|
|
||||||
#import "VMSettingsController.h"
|
#import "VMSettingsController.h"
|
||||||
|
|
||||||
|
#import "DiskType.h"
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
const int CDROMRefNum = -62; // RefNum of driver
|
const int CDROMRefNum = -62; // RefNum of driver
|
||||||
|
|
||||||
#ifdef STANDALONE_PREFS
|
#ifdef STANDALONE_PREFS
|
||||||
@ -62,12 +65,28 @@ void prefs_exit()
|
|||||||
|
|
||||||
- (int) numberOfRowsInTableView: (NSTableView *) table
|
- (int) numberOfRowsInTableView: (NSTableView *) table
|
||||||
{
|
{
|
||||||
|
//NSLog(@"Count of diskArray: %d", [diskArray count]);
|
||||||
return [diskArray count];
|
return [diskArray count];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) tableView: (NSTableView *) table objectValueForTableColumn: (NSTableColumn *) col row: (int) row
|
- (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)
|
static NSString *getStringFromPrefs(const char *key)
|
||||||
@ -85,11 +104,27 @@ static NSString *getStringFromPrefs(const char *key)
|
|||||||
const char *dsk;
|
const char *dsk;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
while ((dsk = PrefsFindString("disk", index++)) != NULL)
|
while ((dsk = PrefsFindString("disk", index++)) != NULL)
|
||||||
[diskArray addObject: [NSString stringWithUTF8String: dsk ]];
|
{
|
||||||
|
DiskType *disk = [[DiskType alloc] init];
|
||||||
[disks setDataSource: self];
|
[disk setPath:[NSString stringWithUTF8String: dsk ]];
|
||||||
[disks reloadData];
|
[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];
|
||||||
|
|
||||||
int bootdriver = PrefsFindInt32("bootdriver"), active = 0;
|
int bootdriver = PrefsFindInt32("bootdriver"), active = 0;
|
||||||
switch (bootdriver) {
|
switch (bootdriver) {
|
||||||
case 0: active = 0; break;
|
case 0: active = 0; break;
|
||||||
@ -212,6 +247,7 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
|||||||
{
|
{
|
||||||
NSOpenPanel *open = [NSOpenPanel openPanel];
|
NSOpenPanel *open = [NSOpenPanel openPanel];
|
||||||
[open setCanChooseDirectories:YES];
|
[open setCanChooseDirectories:YES];
|
||||||
|
[open setAccessoryView:isCDROM];
|
||||||
[open setAllowsMultipleSelection:NO];
|
[open setAllowsMultipleSelection:NO];
|
||||||
[open setTreatsFilePackagesAsDirectories:YES];
|
[open setTreatsFilePackagesAsDirectories:YES];
|
||||||
[open beginSheetForDirectory: [[NSFileManager defaultManager] currentDirectoryPath]
|
[open beginSheetForDirectory: [[NSFileManager defaultManager] currentDirectoryPath]
|
||||||
@ -225,8 +261,19 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
|||||||
- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
|
- (void) _addDiskEnd: (NSOpenPanel *) open returnCode: (int) theReturnCode contextInfo: (void *) theContextInfo
|
||||||
{
|
{
|
||||||
if (theReturnCode == NSOKButton) {
|
if (theReturnCode == NSOKButton) {
|
||||||
[diskArray addObject: makeRelativeIfNecessary([open filename])];
|
DiskType *d=[[DiskType alloc] init];
|
||||||
[disks reloadData];
|
[d setPath:makeRelativeIfNecessary([open filename])];
|
||||||
|
|
||||||
|
if([isCDROMcheckbox state]==NSOnState)
|
||||||
|
{
|
||||||
|
[d setIsCDROM:YES];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
[d setIsCDROM:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
[diskArray addObject: d];
|
||||||
|
[disks reloadData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +308,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]);
|
snprintf(cmd, sizeof(cmd), "dd if=/dev/zero \"of=%s\" bs=1024k count=%d", [[save filename] UTF8String], [diskSaveSizeField intValue]);
|
||||||
int ret = system(cmd);
|
int ret = system(cmd);
|
||||||
if (ret == 0) {
|
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];
|
[disks reloadData];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -350,12 +401,24 @@ static NSString *makeRelativeIfNecessary(NSString *path)
|
|||||||
|
|
||||||
- (void) saveChanges: (id) sender
|
- (void) saveChanges: (id) sender
|
||||||
{
|
{
|
||||||
|
// Remove all disks
|
||||||
while (PrefsFindString("disk"))
|
while (PrefsFindString("disk"))
|
||||||
PrefsRemoveItem("disk");
|
PrefsRemoveItem("disk");
|
||||||
|
// Remove all cdroms
|
||||||
|
while (PrefsFindString("cdrom"))
|
||||||
|
PrefsRemoveItem("cdrom");
|
||||||
|
|
||||||
|
|
||||||
|
// Write all disks
|
||||||
for (int i = 0; i < [diskArray count]; i++) {
|
for (int i = 0; i < [diskArray count]; i++) {
|
||||||
PrefsAddString("disk", [[diskArray objectAtIndex:i] UTF8String]);
|
DiskType *d = [diskArray objectAtIndex:i];
|
||||||
|
if([d isCDROM])
|
||||||
|
PrefsAddString("cdrom", [[d path] UTF8String]);
|
||||||
|
else
|
||||||
|
PrefsAddString("disk", [[d path] UTF8String]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrefsReplaceInt32("bootdriver", ([bootFrom indexOfSelectedItem] == 1 ? CDROMRefNum : 0));
|
PrefsReplaceInt32("bootdriver", ([bootFrom indexOfSelectedItem] == 1 ? CDROMRefNum : 0));
|
||||||
PrefsReplaceString("rom", [[romFile stringValue] UTF8String]);
|
PrefsReplaceString("rom", [[romFile stringValue] UTF8String]);
|
||||||
PrefsReplaceString("extfs", [[unixRoot stringValue] UTF8String]);
|
PrefsReplaceString("extfs", [[unixRoot stringValue] UTF8String]);
|
||||||
|
@ -129,6 +129,7 @@
|
|||||||
08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */; };
|
08CD42DC14B7B85B009CA2A2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42DB14B7B85B009CA2A2 /* Cocoa.framework */; };
|
||||||
08CD42E814B7B8AA009CA2A2 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08CD42E714B7B8AA009CA2A2 /* Carbon.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 */; };
|
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 */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy 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>"; };
|
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>"; };
|
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>"; };
|
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 */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@ -940,6 +943,8 @@
|
|||||||
0856D2D614A9A704000B1711 /* Launcher */ = {
|
0856D2D614A9A704000B1711 /* Launcher */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
A7B1921218C35D4700791D8D /* DiskType.h */,
|
||||||
|
A7B1921318C35D4700791D8D /* DiskType.m */,
|
||||||
0856D30714A9A704000B1711 /* VMSettingsWindow.nib */,
|
0856D30714A9A704000B1711 /* VMSettingsWindow.nib */,
|
||||||
0856D31114A9A704000B1711 /* VMSettingsController.h */,
|
0856D31114A9A704000B1711 /* VMSettingsController.h */,
|
||||||
0856D31214A9A704000B1711 /* VMSettingsController.mm */,
|
0856D31214A9A704000B1711 /* VMSettingsController.mm */,
|
||||||
@ -1452,6 +1457,7 @@
|
|||||||
0873A80214AC515D004F12B7 /* utils_macosx.mm in Sources */,
|
0873A80214AC515D004F12B7 /* utils_macosx.mm in Sources */,
|
||||||
083E370C16EFE85000CCCA59 /* disk_sparsebundle.cpp in Sources */,
|
083E370C16EFE85000CCCA59 /* disk_sparsebundle.cpp in Sources */,
|
||||||
083E372216EFE87200CCCA59 /* tinyxml2.cpp in Sources */,
|
083E372216EFE87200CCCA59 /* tinyxml2.cpp in Sources */,
|
||||||
|
A7B1921418C35D4700791D8D /* DiskType.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user