Move Struct Extra

This commit is contained in:
tomcw 2023-09-16 12:08:09 +01:00
parent 47a9b231e9
commit 9478739a15
5 changed files with 16 additions and 17 deletions

View File

@ -338,14 +338,15 @@ void Disk2InterfaceCard::ReadTrack(const int drive, ULONG uExecutedCycles)
const UINT32 currentBitPosition = pFloppy->m_bitOffset;
const UINT32 currentBitTrackLength = pFloppy->m_bitCount;
Extra extra(pFloppy->m_isFluxTrack, m_enhanceDisk);
ImageReadTrack(
pFloppy->m_imagehandle,
pDrive->m_phasePrecise,
pFloppy->m_trackimage,
&pFloppy->m_nibbles,
&pFloppy->m_bitCount,
&pFloppy->m_isFluxTrack,
m_enhanceDisk);
extra);
if (!ImageIsWOZ(pFloppy->m_imagehandle))
{

View File

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

View File

@ -78,11 +78,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
struct ImageInfo;
struct Extra
{
Extra(bool& isFluxTrack, bool enhanceDisk) : m_isFluxTrack(isFluxTrack), m_enhanceDisk(enhanceDisk) { m_isFluxTrack = false; }
const bool m_enhanceDisk; // read-only
bool& m_isFluxTrack;
};
ImageError_e ImageOpen(const std::string & pszImageFilename, ImageInfo** ppImageInfo, bool* pWriteProtected, const bool bCreateIfNecessary, std::string& strFilenameInZip, const bool bExpectFloppy=true);
void ImageClose(ImageInfo* const pImageInfo);
BOOL ImageBoot(ImageInfo* const pImageInfo);
void ImageReadTrack(ImageInfo* const pImageInfo, float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, bool* pIsFluxTrack, bool enhanceDisk);
void ImageReadTrack(ImageInfo* const pImageInfo, float phase, LPBYTE pTrackImageBuffer, int* pNibbles, UINT* pBitCount, Extra& extra);
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

@ -1276,14 +1276,14 @@ public:
{
BYTE* pTrackMapFlux = ((CWOZHelper::Tmap*)pImageInfo->pWOZTrackMapFlux)->tmap;
indexFromTMAP = pTrackMapFlux[(BYTE)(phase * 2)];
*extra.m_pIsFluxTrack = (indexFromTMAP != CWOZHelper::TMAP_TRACK_EMPTY);
extra.m_isFluxTrack = (indexFromTMAP != CWOZHelper::TMAP_TRACK_EMPTY);
}
if (indexFromTMAP == CWOZHelper::TMAP_TRACK_EMPTY)
{
BYTE* pTrackMap = ((CWOZHelper::Tmap*)pImageInfo->pWOZTrackMap)->tmap;
indexFromTMAP = pTrackMap[(BYTE)(phase * 2)];
*extra.m_pIsFluxTrack = false;
extra.m_isFluxTrack = 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.m_pIsFluxTrack)
if (extra.m_isFluxTrack)
{
*pBitCount = 0; // NB. use as a "flag" to callee that this is flux data
*pNibbles = pTRK->bitCount; // byte count of flux data

View File

@ -54,14 +54,6 @@ struct ImageInfo
#define DEFAULT_VOLUME_NUMBER 254
struct Extra
{
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
{
public: