mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-08 14:25:05 +00:00
Corrected some minor out-of-style breaks, and ensured that the name of ZX81 files is returned.
This commit is contained in:
@@ -50,8 +50,10 @@ static std::shared_ptr<File> ZX81FileFromData(const std::vector<uint8_t> &data)
|
|||||||
|
|
||||||
// Look for a file name.
|
// Look for a file name.
|
||||||
size_t data_pointer = 0;
|
size_t data_pointer = 0;
|
||||||
|
std::vector<uint8_t> name_data;
|
||||||
int c = 11;
|
int c = 11;
|
||||||
while(c < data.size() && c--) {
|
while(c < data.size() && c--) {
|
||||||
|
name_data.push_back(data[data_pointer] & 0x3f);
|
||||||
if(data[data_pointer] & 0x80) break;
|
if(data[data_pointer] & 0x80) break;
|
||||||
data_pointer++;
|
data_pointer++;
|
||||||
}
|
}
|
||||||
@@ -80,6 +82,7 @@ static std::shared_ptr<File> ZX81FileFromData(const std::vector<uint8_t> &data)
|
|||||||
// TODO: check that the line numbers declared above exist (?)
|
// TODO: check that the line numbers declared above exist (?)
|
||||||
|
|
||||||
std::shared_ptr<File> file(new File);
|
std::shared_ptr<File> file(new File);
|
||||||
|
file->name = StringFromData(name_data, true);
|
||||||
file->data = data;
|
file->data = data;
|
||||||
file->isZX81 = true;
|
file->isZX81 = true;
|
||||||
return file;
|
return file;
|
||||||
|
@@ -19,7 +19,7 @@ namespace ZX8081 {
|
|||||||
|
|
||||||
struct File {
|
struct File {
|
||||||
std::vector<uint8_t> data;
|
std::vector<uint8_t> data;
|
||||||
std::string name;
|
std::wstring name;
|
||||||
bool isZX81;
|
bool isZX81;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -29,14 +29,11 @@ void Parser::post_pulse() {
|
|||||||
|
|
||||||
if(pulse_time > expected_gap_length * 1.25f) {
|
if(pulse_time > expected_gap_length * 1.25f) {
|
||||||
push_wave(WaveType::LongGap);
|
push_wave(WaveType::LongGap);
|
||||||
}
|
} else if(pulse_time > expected_pulse_length * 1.25f) {
|
||||||
else if(pulse_time > expected_pulse_length * 1.25f) {
|
|
||||||
push_wave(WaveType::Gap);
|
push_wave(WaveType::Gap);
|
||||||
}
|
} else if(pulse_time >= expected_pulse_length * 0.75f && pulse_time <= expected_pulse_length * 1.25f) {
|
||||||
else if(pulse_time >= expected_pulse_length * 0.75f && pulse_time <= expected_pulse_length * 1.25f) {
|
|
||||||
push_wave(WaveType::Pulse);
|
push_wave(WaveType::Pulse);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
push_wave(WaveType::Unrecognised);
|
push_wave(WaveType::Unrecognised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user