Skip to content

Commit

Permalink
Replaced P00FileProxy by MediaFileProxy
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Jun 7, 2024
1 parent 21941d5 commit b4994da
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 54 deletions.
19 changes: 19 additions & 0 deletions Emulator/Peripherals/Drive/Drive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,25 @@ Drive::insertFileSystem(const FileSystem &device, bool wp)
insertDisk(std::make_unique<Disk>(device, wp));
}

void
Drive::insertMediaFile(class MediaFile &file, bool wp)
{
try {

const D64File &d64 = dynamic_cast<const D64File &>(file);
insertDisk(std::make_unique<Disk>(d64, wp));

} catch (...) { try {

AnyCollection &collection = dynamic_cast<AnyCollection &>(file);
insertDisk(std::make_unique<Disk>(collection, wp));

} catch (...) {

throw VC64Error(ERROR_FILE_TYPE_MISMATCH);
}}
}

void
Drive::insertD64(const D64File &d64, bool wp)
{
Expand Down
1 change: 1 addition & 0 deletions Emulator/Peripherals/Drive/Drive.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ class Drive final : public SubComponent, public Inspectable<DriveInfo> {
void insertDisk(const string &path, bool wp) throws;
void insertDisk(std::unique_ptr<Disk> disk);
void insertNewDisk(DOSType fstype, PETName<16> name);
void insertMediaFile(class MediaFile &file, bool wp);
void insertD64(const class D64File &d64, bool wp);
void insertG64(const class G64File &g64, bool wp);
void insertCollection(class AnyCollection &archive, bool wp) throws;
Expand Down
4 changes: 2 additions & 2 deletions GUI/MediaManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class MediaManager {
return try MediaFileProxy.make(with: newUrl, type: .PRG)

case .P00:
return try P00FileProxy.make(with: newUrl)
return try MediaFileProxy.make(with: newUrl, type: .P00)

case .G64:
return try G64FileProxy.make(with: newUrl)
Expand Down Expand Up @@ -446,7 +446,7 @@ class MediaManager {

case .P00:
if fs.numFiles > 1 { showAlert(format: "P00") }
file = try P00FileProxy.make(with: fs)
file = try MediaFileProxy.make(with: fs, type: .P00)

default:
throw VC64Error(vc64.ErrorCode.FILE_TYPE_MISMATCH)
Expand Down
51 changes: 0 additions & 51 deletions Proxy/EmulatorProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ using namespace vc64;
@class MemoryProxy;
@class MouseProxy;
@class MyController;
@class P00FileProxy;
// @class PRGFileProxy;
@class RecorderProxy;
@class RetroShellProxy;
@class ScriptProxy;
Expand Down Expand Up @@ -711,27 +709,6 @@ struct GuardInfo {
@end


//
// Snapshot
//

/*
@interface SnapshotProxy : AnyFileProxy <MakeWithFile, MakeWithBuffer>
{
NSImage *preview;
}
+ (instancetype)makeWithFile:(NSString *)path exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithBuffer:(const void *)buf length:(NSInteger)len exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithC64:(EmulatorProxy *)c64proxy;
@property (readonly, strong) NSImage *previewImage;
@property (readonly) time_t timeStamp;
@end
*/


//
// Script
//
Expand Down Expand Up @@ -760,34 +737,6 @@ AnyCollectionProxy <MakeWithFile, MakeWithBuffer, MakeWithFileSystem> { }
@end


//
// PRGFile
//
/*
@interface PRGFileProxy :
AnyCollectionProxy <MakeWithFile, MakeWithBuffer, MakeWithFileSystem> { }
+ (instancetype)makeWithFile:(NSString *)path exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithBuffer:(const void *)buf length:(NSInteger)len exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithFileSystem:(FileSystemProxy *)proxy exception:(ExceptionWrapper *)ex;
@end
*/

//
// P00File
//

@interface P00FileProxy :
AnyCollectionProxy <MakeWithFile, MakeWithBuffer, MakeWithFileSystem> { }

+ (instancetype)makeWithFile:(NSString *)path exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithBuffer:(const void *)buf length:(NSInteger)len exception:(ExceptionWrapper *)ex;
+ (instancetype)makeWithFileSystem:(FileSystemProxy *)proxy exception:(ExceptionWrapper *)ex;

@end


//
// D64File
//
Expand Down
3 changes: 2 additions & 1 deletion Proxy/EmulatorProxy.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,7 @@ + (instancetype)makeWithFileSystem:(FileSystemProxy *)proxy exception:(Exception
// P00 proxy
//

/*
@implementation P00FileProxy
+ (instancetype)make:(P00File *)archive
Expand All @@ -1556,7 +1557,7 @@ + (instancetype)makeWithFileSystem:(FileSystemProxy *)proxy exception:(Exception
}
@end

*/

//
// D64 proxy
Expand Down

0 comments on commit b4994da

Please sign in to comment.