Tweak Struct Extra

This commit is contained in:
tomcw 2023-09-16 12:01:50 +01:00
parent 54ebde9fec
commit 47a9b231e9
6 changed files with 15 additions and 11 deletions

View File

@ -344,6 +344,7 @@ void Disk2InterfaceCard::ReadTrack(const int drive, ULONG uExecutedCycles)
pFloppy->m_trackimage,
&pFloppy->m_nibbles,
&pFloppy->m_bitCount,
&pFloppy->m_isFluxTrack,
m_enhanceDisk);
if (!ImageIsWOZ(pFloppy->m_imagehandle))

View File

@ -69,6 +69,7 @@ public:
m_trackimage = NULL;
m_trackimagedata = false;
m_trackimagedirty = false;
m_isFluxTrack = false;
m_longestSyncFFRunLength = 0;
m_longestSyncFFBitOffsetStart = -1;
m_initialBitOffset = 0;
@ -90,6 +91,7 @@ public:
LPBYTE m_trackimage;
bool m_trackimagedata;
bool m_trackimagedirty;
bool m_isFluxTrack;
UINT m_longestSyncFFRunLength;
int m_longestSyncFFBitOffsetStart;
UINT m_initialBitOffset; // debug

View File

@ -117,6 +117,7 @@ void ImageReadTrack( ImageInfo* const pImageInfo,
LPBYTE pTrackImageBuffer,
int* pNibbles,
UINT* pBitCount,
bool* pIsFluxTrack,
bool enhanceDisk)
{
_ASSERT(phase >= 0);
@ -127,9 +128,7 @@ void ImageReadTrack( ImageInfo* const pImageInfo,
if (pImageInfo->pImageType->AllowRW())
{
Extra extra;
extra.enhanceDisk = enhanceDisk;
extra.isFluxTrack = false;
Extra extra(pIsFluxTrack, enhanceDisk);
pImageInfo->pImageType->Read(pImageInfo, phase, pTrackImageBuffer, pNibbles, pBitCount, extra);
}
else

View File

@ -82,7 +82,7 @@ ImageError_e ImageOpen(const std::string & pszImageFilename, ImageInfo** ppImage
void ImageClose(ImageInfo* const pImageInfo);
BOOL ImageBoot(ImageInfo* const pImageInfo);
void ImageReadTrack(ImageInfo* const pImageInfo, float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, bool enhanceDisk);
void ImageReadTrack(ImageInfo* const pImageInfo, float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, bool* pIsFluxTrack, bool enhanceDisk);
void ImageWriteTrack(ImageInfo* const pImageInfo, float phase, LPBYTE pTrackImageBuffer, int nNibbles);
bool ImageReadBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);
bool ImageWriteBlock(ImageInfo* const pImageInfo, UINT nBlock, LPBYTE pBlockBuffer);

View File

@ -663,7 +663,7 @@ public:
const UINT track = PhaseToTrack(phase);
ReadTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
*pNibbles = NibblizeTrack(pTrackImageBuffer, eDOSOrder, track);
if (!extra.enhanceDisk)
if (!extra.m_enhanceDisk)
SkewTrack(track, *pNibbles, pTrackImageBuffer);
}
@ -731,7 +731,7 @@ public:
const UINT track = PhaseToTrack(phase);
ReadTrack(pImageInfo, track, m_pWorkBuffer, TRACK_DENIBBLIZED_SIZE);
*pNibbles = NibblizeTrack(pTrackImageBuffer, eProDOSOrder, track);
if (!extra.enhanceDisk)
if (!extra.m_enhanceDisk)
SkewTrack(track, *pNibbles, pTrackImageBuffer);
}
@ -1276,14 +1276,14 @@ public:
{
BYTE* pTrackMapFlux = ((CWOZHelper::Tmap*)pImageInfo->pWOZTrackMapFlux)->tmap;
indexFromTMAP = pTrackMapFlux[(BYTE)(phase * 2)];
extra.isFluxTrack = (indexFromTMAP != CWOZHelper::TMAP_TRACK_EMPTY);
*extra.m_pIsFluxTrack = (indexFromTMAP != CWOZHelper::TMAP_TRACK_EMPTY);
}
if (indexFromTMAP == CWOZHelper::TMAP_TRACK_EMPTY)
{
BYTE* pTrackMap = ((CWOZHelper::Tmap*)pImageInfo->pWOZTrackMap)->tmap;
indexFromTMAP = pTrackMap[(BYTE)(phase * 2)];
extra.isFluxTrack = false;
*extra.m_pIsFluxTrack = false;
}
if (indexFromTMAP == CWOZHelper::TMAP_TRACK_EMPTY)
@ -1292,7 +1292,7 @@ public:
CWOZHelper::TRKv2* pTRKS = (CWOZHelper::TRKv2*) &pImageInfo->pImageBuffer[pImageInfo->uOffset];
CWOZHelper::TRKv2* pTRK = &pTRKS[indexFromTMAP];
if (extra.isFluxTrack)
if (*extra.m_pIsFluxTrack)
{
*pBitCount = 0; // NB. use as a "flag" to callee that this is flux data
*pNibbles = pTRK->bitCount; // byte count of flux data

View File

@ -56,8 +56,10 @@ struct ImageInfo
struct Extra
{
bool enhanceDisk;
bool isFluxTrack;
Extra(bool* pIsFluxTrack, bool enhanceDisk) : m_pIsFluxTrack(pIsFluxTrack), m_enhanceDisk(enhanceDisk) { *m_pIsFluxTrack = false; }
const bool m_enhanceDisk; // read-only
bool* m_pIsFluxTrack;
};
class CImageBase