mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-22 15:30:09 +00:00
41bdcd4aed
* Update logging * Remove duplicate code * Update unit tests * Clean up includes * Merge ProtobufSerializer into protobuf_util namespace * Precompile regex * Add const * Add Split() convenience method, update log level/ID parsing * Move log.h to legacy folder * Elimininate gotos * Fixes for gcc 13 * Update compiler flags * Update default folder handling * Use references instead of pointers * Move code for better encapsulation * Move code * Remove unused method argument * Move device logger * Remove redundant to_string * Rename for consistency * Update handling of protobuf pointers * Simplify protobuf usage * Memory handling update * Add hasher
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
//---------------------------------------------------------------------------
|
||
//
|
||
// X68000 EMULATOR "XM6"
|
||
//
|
||
// Copyright (C) 2001-2006 PI.(ytanaka@ipc-tokai.or.jp)
|
||
// Copyright (C) 2014-2020 GIMONS
|
||
//
|
||
// XM6i
|
||
// Copyright (C) 2010-2015 isaki@NetBSD.org
|
||
//
|
||
// Imported sava's Anex86/T98Next image and MO format support patch.
|
||
// Comments translated to english by akuker.
|
||
//
|
||
//---------------------------------------------------------------------------
|
||
|
||
#pragma once
|
||
|
||
#include <cstdlib>
|
||
#include <cstdint>
|
||
#include <span>
|
||
#include <vector>
|
||
#include <string>
|
||
|
||
using namespace std;
|
||
|
||
class DiskTrack
|
||
{
|
||
struct {
|
||
int track; // Track Number
|
||
int size; // Sector Size (8=256, 9=512, 10=1024, 11=2048, 12=4096)
|
||
int sectors; // Number of sectors(<0x100)
|
||
uint32_t length; // Data buffer length
|
||
uint8_t *buffer; // Data buffer
|
||
bool init; // Is it initilized?
|
||
bool changed; // Changed flag
|
||
vector<bool> changemap; // Changed map
|
||
bool raw; // RAW mode flag
|
||
off_t imgoffset; // Offset to actual data
|
||
} dt = {};
|
||
|
||
public:
|
||
|
||
DiskTrack() = default;
|
||
~DiskTrack();
|
||
DiskTrack(DiskTrack&) = delete;
|
||
DiskTrack& operator=(const DiskTrack&) = delete;
|
||
|
||
private:
|
||
|
||
friend class DiskCache;
|
||
|
||
void Init(int track, int size, int sectors, bool raw = false, off_t imgoff = 0);
|
||
bool Load(const string& path);
|
||
bool Save(const string& path);
|
||
|
||
// Read / Write
|
||
bool ReadSector(span<uint8_t>, int) const; // Sector Read
|
||
bool WriteSector(span<const uint8_t> buf, int); // Sector Write
|
||
|
||
int GetTrack() const { return dt.track; } // Get track
|
||
};
|