Moved setting the auto expanding disk size logic.

This commit is contained in:
Peter Ibbotson 2024-01-28 15:58:49 +00:00
parent 6472f47c79
commit 2927a10865
4 changed files with 12 additions and 6 deletions

View File

@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../Interface.h"
#include "../Uthernet2.h"
#include "../Tfe/PCapBackend.h"
#include "../CmdLine.h"
/*
Config causing AfterClose msgs:
@ -134,6 +135,8 @@ void CPropertySheetHelper::SetSlot(UINT slot, SS_CARDTYPE newCardType)
GetCardMgr().Insert(slot, newCardType);
GetCardMgr().GetRef(slot).InitializeIO(GetCxRomPeripheral());
if (newCardType == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(slot)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks);
}
// Used by:

View File

@ -37,7 +37,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Registry.h"
#include "SaveState.h"
#include "YamlHelper.h"
#include "CmdLine.h"
#include "Debugger/Debug.h"
#include "../resource/resource.h"
@ -677,13 +676,13 @@ BYTE __stdcall HarddiskInterfaceCard::IORead(WORD pc, WORD addr, BYTE bWrite, BY
break;
case 0x9:
if (pHDD->m_imageloaded)
r = (BYTE)(GetImageSizeInBlocks(pHDD->m_imagehandle) & 0x00ff);
r = (BYTE)(pCard->GetImageSizeInBlocks(pHDD->m_imagehandle) & 0x00ff);
else
r = 0;
break;
case 0xa:
if (pHDD->m_imageloaded)
r = (BYTE)((GetImageSizeInBlocks(pHDD->m_imagehandle) & 0xff00) >> 8);
r = (BYTE)((pCard->GetImageSizeInBlocks(pHDD->m_imagehandle) & 0xff00) >> 8);
else
r = 0;
break;
@ -750,8 +749,8 @@ BYTE __stdcall HarddiskInterfaceCard::IOWrite(WORD pc, WORD addr, BYTE bWrite, B
UINT HarddiskInterfaceCard::GetImageSizeInBlocks(ImageInfo* const pImageInfo)
{
if (g_cmdLine.uHarddiskNumBlocks != 0)
return g_cmdLine.uHarddiskNumBlocks;
if (m_userNumBlocks != 0)
return m_userNumBlocks;
UINT numberOfBlocks = (pImageInfo ? pImageInfo->uImageSize : 0) / HD_BLOCK_SIZE;
if (numberOfBlocks > kHarddiskMaxNumBlocks)
numberOfBlocks = kHarddiskMaxNumBlocks;

View File

@ -100,6 +100,7 @@ public:
void Unplug(const int iDrive);
bool IsDriveUnplugged(const int iDrive);
void LoadLastDiskImage(const int iDrive);
void SetUserNumBlocks(UINT numBlocks) { m_userNumBlocks = numBlocks; }
void GetLightStatus(Disk_Status_e* pDisk1Status);
bool ImageSwap(void);
@ -119,7 +120,7 @@ private:
const std::string& DiskGetBaseName(const int iDrive);
bool SelectImage(const int drive, LPCSTR pszFilename);
void UpdateLightStatus(HardDiskDrive* pHDD);
static UINT GetImageSizeInBlocks(ImageInfo* const pImageInfo);
UINT GetImageSizeInBlocks(ImageInfo* const pImageInfo);
void SaveSnapshotHDDUnit(YamlSaveHelper& yamlSaveHelper, UINT unit);
bool LoadSnapshotHDDUnit(YamlLoadHelper& yamlLoadHelper, UINT unit);
@ -128,6 +129,7 @@ private:
BYTE m_unitNum; // b7=unit
BYTE m_command;
UINT64 m_notBusyCycle;
UINT m_userNumBlocks;
bool m_saveDiskImage; // Save the DiskImage name to Registry

View File

@ -802,6 +802,8 @@ static void RepeatInitialization(void)
{
if (GetCardMgr().QuerySlot(i) == CT_Disk2 && g_cmdLine.slotInfo[i].isDiskII13)
dynamic_cast<Disk2InterfaceCard&>(GetCardMgr().GetRef(i)).SetFirmware13Sector();
if (GetCardMgr().QuerySlot(i) == CT_GenericHDD)
dynamic_cast<HarddiskInterfaceCard&>(GetCardMgr().GetRef(i)).SetUserNumBlocks(g_cmdLine.uHarddiskNumBlocks);
}
// Create window after inserting/removing VidHD card (as it affects width & height)