mirror of
https://github.com/AppleWin/AppleWin.git
synced 2026-04-20 00:17:16 +00:00
Supports: - all "woz test images" v1.3 (WOZ1, WOZ2) are working, except 3.5" - additionally: Frogger (spiradisc), Choplifter (not Enhanced //e!), Lode Runner, Marble Madness, Skyfox. - woz images can be .gz or .zip compressed (ie. same as other supported images) - save-state Limitations: - read-only, so WOZ images are forced to be write-protected . as a result, games that need r/w images won't work (Stickybear Town Builder, Wizardry) - 5.25" only (not 3.5")
This commit is contained in:
+47
-16
@@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "Common.h"
|
||||
#include "DiskImage.h"
|
||||
#include "DiskImageHelper.h"
|
||||
|
||||
@@ -152,19 +153,21 @@ void ImageInitialize(void)
|
||||
//===========================================================================
|
||||
|
||||
void ImageReadTrack( ImageInfo* const pImageInfo,
|
||||
const int nTrack,
|
||||
const int nQuarterTrack,
|
||||
float phase, // phase [0..79] +/- 0.5
|
||||
LPBYTE pTrackImageBuffer,
|
||||
int* pNibbles,
|
||||
UINT* pBitCount,
|
||||
bool enhanceDisk)
|
||||
{
|
||||
_ASSERT(nTrack >= 0);
|
||||
if (nTrack < 0)
|
||||
return;
|
||||
_ASSERT(phase >= 0);
|
||||
if (phase < 0)
|
||||
phase = 0;
|
||||
|
||||
if (pImageInfo->pImageType->AllowRW() && pImageInfo->ValidTrack[nTrack])
|
||||
const UINT track = pImageInfo->pImageType->PhaseToTrack(phase);
|
||||
|
||||
if (pImageInfo->pImageType->AllowRW() && pImageInfo->ValidTrack[track])
|
||||
{
|
||||
pImageInfo->pImageType->Read(pImageInfo, nTrack, nQuarterTrack, pTrackImageBuffer, pNibbles, enhanceDisk);
|
||||
pImageInfo->pImageType->Read(pImageInfo, phase, pTrackImageBuffer, pNibbles, pBitCount, enhanceDisk);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -176,19 +179,20 @@ void ImageReadTrack( ImageInfo* const pImageInfo,
|
||||
//===========================================================================
|
||||
|
||||
void ImageWriteTrack( ImageInfo* const pImageInfo,
|
||||
const int nTrack,
|
||||
const int nQuarterTrack,
|
||||
LPBYTE pTrackImage,
|
||||
float phase, // phase [0..79] +/- 0.5
|
||||
LPBYTE pTrackImageBuffer,
|
||||
const int nNibbles)
|
||||
{
|
||||
_ASSERT(nTrack >= 0);
|
||||
if (nTrack < 0)
|
||||
return;
|
||||
_ASSERT(phase >= 0);
|
||||
if (phase < 0)
|
||||
phase = 0;
|
||||
|
||||
const UINT track = pImageInfo->pImageType->PhaseToTrack(phase);
|
||||
|
||||
if (pImageInfo->pImageType->AllowRW() && !pImageInfo->bWriteProtected)
|
||||
{
|
||||
pImageInfo->pImageType->Write(pImageInfo, nTrack, nQuarterTrack, pTrackImage, nNibbles);
|
||||
pImageInfo->ValidTrack[nTrack] = 1;
|
||||
pImageInfo->pImageType->Write(pImageInfo, phase, pTrackImageBuffer, nNibbles);
|
||||
pImageInfo->ValidTrack[track] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +224,7 @@ bool ImageWriteBlock( ImageInfo* const pImageInfo,
|
||||
|
||||
//===========================================================================
|
||||
|
||||
int ImageGetNumTracks(ImageInfo* const pImageInfo)
|
||||
UINT ImageGetNumTracks(ImageInfo* const pImageInfo)
|
||||
{
|
||||
return pImageInfo ? pImageInfo->uNumTracks : 0;
|
||||
}
|
||||
@@ -246,6 +250,33 @@ UINT ImageGetImageSize(ImageInfo* const pImageInfo)
|
||||
return pImageInfo ? pImageInfo->uImageSize : 0;
|
||||
}
|
||||
|
||||
bool ImageIsWOZ(ImageInfo* const pImageInfo)
|
||||
{
|
||||
return pImageInfo ? (pImageInfo->pImageType->GetType() == eImageWOZ1 || pImageInfo->pImageType->GetType() == eImageWOZ2) : false;
|
||||
}
|
||||
|
||||
BYTE ImageGetOptimalBitTiming(ImageInfo* const pImageInfo)
|
||||
{
|
||||
return pImageInfo ? pImageInfo->optimalBitTiming : 32;
|
||||
}
|
||||
|
||||
UINT ImagePhaseToTrack(ImageInfo* const pImageInfo, const float phase, const bool limit/*=true*/)
|
||||
{
|
||||
if (!pImageInfo)
|
||||
return 0;
|
||||
|
||||
UINT track = pImageInfo->pImageType->PhaseToTrack(phase);
|
||||
|
||||
if (limit)
|
||||
{
|
||||
const UINT numTracksInImage = ImageGetNumTracks(pImageInfo);
|
||||
track = (numTracksInImage == 0) ? 0
|
||||
: MIN(numTracksInImage - 1, track);
|
||||
}
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
void GetImageTitle(LPCTSTR pPathname, TCHAR* pImageName, TCHAR* pFullName)
|
||||
{
|
||||
TCHAR imagetitle[ MAX_DISK_FULL_NAME+1 ];
|
||||
|
||||
Reference in New Issue
Block a user