forked from vAmigaWeb/vAmigaWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOtherFile.h
85 lines (62 loc) · 2.6 KB
/
OtherFile.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// -----------------------------------------------------------------------------
// This file is part of vAmiga
//
// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
// Licensed under the GNU General Public License v3
//
// See https://www.gnu.org for license information
// -----------------------------------------------------------------------------
#pragma once
#include "ADFFile.h"
namespace vamiga {
class OtherFile : public FloppyFile {
ADFFile adf;
public:
static bool isCompatible(const string &path);
static bool isCompatible(std::istream &stream);
//
// Initializing
//
public:
using AmigaFile::init;
//OtherFile(const string &path) throws { init(path); }
//OtherFile(const string &path, std::istream &stream) throws { init(path, stream); }
OtherFile(const char *name, const u8 *buf, isize len) throws {
filename = name;
if(filename.ends_with(".disk"))
{
filename[filename.length()-5]='\0'; //remove .disk meta extension
}
init(buf, len);
}
const char *getDescription() const override { return "EXE"; }
std::string filename;
//
// Methods from AmigaFile
//
FileType type() const override { return FILETYPE_EXE; }
u64 fnv64() const override { return adf.fnv64(); }
bool isCompatiblePath(const string &path) const override { return isCompatible(path); }
bool isCompatibleStream(std::istream &stream) const override { return isCompatible(stream); }
void finalizeRead() throws override;
//
// Methods from DiskFile
//
isize numCyls() const override { return adf.numCyls(); }
isize numHeads() const override { return adf.numHeads(); }
isize numSectors() const override { return adf.numSectors(); }
//
// Methods from FloppyFile
//
FSVolumeType getDos() const override { return adf.getDos(); }
void setDos(FSVolumeType dos) override { adf.setDos(dos); }
Diameter getDiameter() const override { return adf.getDiameter(); }
Density getDensity() const override { return adf.getDensity(); }
BootBlockType bootBlockType() const override { return adf.bootBlockType(); }
const char *bootBlockName() const override { return adf.bootBlockName(); }
void killVirus() override { adf.killVirus(); }
void readSector(u8 *target, isize s) const override { return adf.readSector(target, s); }
void readSector(u8 *target, isize t, isize s) const override { return adf.readSector(target, t, s); }
void encodeDisk(class FloppyDisk &disk) const throws override { return adf.encodeDisk(disk); }
};
}