From 8524f914953074fbd44faf7ec801f8afdc68cd91 Mon Sep 17 00:00:00 2001 From: tomcw Date: Sat, 20 Feb 2016 17:57:23 +0000 Subject: [PATCH] Save-state: Yaml: Removed GetMapValueBOOL() --- source/Harddisk.cpp | 11 ++++++----- source/MouseInterface.cpp | 20 +++++++++----------- source/MouseInterface.h | 6 +++--- source/YamlHelper.h | 7 ------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index 7d18c1f7..9df3d33f 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -125,7 +125,7 @@ struct HDD WORD hd_memblock; UINT hd_diskblock; WORD hd_buf_ptr; - BOOL hd_imageloaded; + bool hd_imageloaded; BYTE hd_buf[HD_BLOCK_SIZE+1]; // Why +1? Probably for erroreous reads beyond the block size (ie. reads from I/O addr 0xC0F8) #if HD_LED @@ -443,7 +443,7 @@ void HD_Unplug(const int iDrive) bool HD_IsDriveUnplugged(const int iDrive) { - return g_HardDisk[iDrive].hd_imageloaded == FALSE; + return g_HardDisk[iDrive].hd_imageloaded == false; } //----------------------------------------------------------------------------- @@ -726,12 +726,13 @@ static bool HD_LoadSnapshotHDDUnit(YamlLoadHelper& yamlLoadHelper, UINT unit) throw std::string("Card: Expected key: ") + hddUnitName; std::string filename = yamlLoadHelper.GetMapValueSTRING(SS_YAML_KEY_FILENAME).c_str(); - //strcpy_s(g_HardDisk[Unit].fullname, sizeof(g_HardDisk[unit].fullname), filename.c_str()); + g_HardDisk[unit].fullname[0] = 0; + g_HardDisk[unit].imagename[0] = 0; g_HardDisk[unit].hd_error = yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_ERROR); g_HardDisk[unit].hd_memblock = yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_MEMBLOCK); g_HardDisk[unit].hd_diskblock = yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_DISKBLOCK); - yamlLoadHelper.GetMapValueBOOL(SS_YAML_KEY_IMAGELOADED); // Consume - g_HardDisk[unit].hd_imageloaded = FALSE; // Default to FALSE (until image is successfully loaded below) + yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_IMAGELOADED); // Consume + g_HardDisk[unit].hd_imageloaded = false; // Default to false (until image is successfully loaded below) g_HardDisk[unit].hd_status_next = (Disk_Status_e) yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_STATUS_NEXT); g_HardDisk[unit].hd_status_prev = (Disk_Status_e) yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_STATUS_PREV); g_HardDisk[unit].hd_buf_ptr = yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_BUF_PTR); diff --git a/source/MouseInterface.cpp b/source/MouseInterface.cpp index d6bee8ed..b44e8784 100644 --- a/source/MouseInterface.cpp +++ b/source/MouseInterface.cpp @@ -211,7 +211,7 @@ void CMouseInterface::Reset() m_iMinY = 0; m_iMaxY = 1023; - m_bButtons[0] = m_bButtons[1] = FALSE; + m_bButtons[0] = m_bButtons[1] = false; // @@ -448,15 +448,13 @@ void CMouseInterface::OnMouseEvent(bool bEventVBL) if ( !( m_byMode & MODE_MOUSE_ON ) ) // Mouse Off return; - BOOL bBtn0 = m_bButtons[0]; - BOOL bBtn1 = m_bButtons[1]; if ( m_nX != m_iX || m_nY != m_iY ) { byState |= STAT_INT_MOVEMENT|STAT_MOVEMENT_SINCE_READMOUSE; // X/Y moved since last READMOUSE | Movement interrupt m_byState |= STAT_MOVEMENT_SINCE_READMOUSE; // [TC] Used by CopyII+9.1 and ProTERM3.1 } - if ( m_bBtn0 != bBtn0 || m_bBtn1 != bBtn1 ) + if ( m_bBtn0 != m_bButtons[0] || m_bBtn1 != m_bButtons[1] ) byState |= STAT_INT_BUTTON; // Button 0/1 interrupt if ( bEventVBL ) byState |= STAT_INT_VBL; @@ -496,8 +494,8 @@ void CMouseInterface::Clear() m_byState = 0; m_nX = 0; m_nY = 0; - m_bBtn0 = 0; - m_bBtn1 = 0; + m_bBtn0 = false; + m_bBtn1 = false; SetPositionAbs( 0, 0 ); // CpuIrqDeassert(IS_MOUSE); @@ -595,7 +593,7 @@ void CMouseInterface::SetPositionRel(long dX, long dY, int* pOutOfBoundsX, int* void CMouseInterface::SetButton(eBUTTON Button, eBUTTONSTATE State) { - m_bButtons[Button]= (State == BUTTON_DOWN) ? TRUE : FALSE; + m_bButtons[Button] = (State == BUTTON_DOWN); OnMouseEvent(); } @@ -743,8 +741,8 @@ bool CMouseInterface::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT sl m_byState = yamlLoadHelper.GetMapValueUINT(SS_YAML_KEY_MOUSESTATE); m_nX = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_X); m_nY = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_Y); - m_bBtn0 = yamlLoadHelper.GetMapValueBOOL(SS_YAML_KEY_BTN0); - m_bBtn1 = yamlLoadHelper.GetMapValueBOOL(SS_YAML_KEY_BTN1); + m_bBtn0 = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_BTN0); + m_bBtn1 = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_BTN1); m_bVBL = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_VBL); m_iX = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_IX); m_iMinX = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_IMINX); @@ -752,8 +750,8 @@ bool CMouseInterface::LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT sl m_iY = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_IY); m_iMinY = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_IMINY); m_iMaxY = yamlLoadHelper.GetMapValueINT(SS_YAML_KEY_IMAXY); - m_bButtons[0] = yamlLoadHelper.GetMapValueBOOL(SS_YAML_KEY_BUTTON0); - m_bButtons[1] = yamlLoadHelper.GetMapValueBOOL(SS_YAML_KEY_BUTTON1); + m_bButtons[0] = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_BUTTON0); + m_bButtons[1] = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_BUTTON1); m_bActive = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_ACTIVE); m_bEnabled = yamlLoadHelper.GetMapValueBool(SS_YAML_KEY_ENABLED); diff --git a/source/MouseInterface.h b/source/MouseInterface.h index edb62ca8..b98fdc83 100644 --- a/source/MouseInterface.h +++ b/source/MouseInterface.h @@ -75,8 +75,8 @@ protected: BYTE m_byState; int m_nX; int m_nY; - BOOL m_bBtn0; - BOOL m_bBtn1; + bool m_bBtn0; + bool m_bBtn1; bool m_bVBL; @@ -89,7 +89,7 @@ protected: int m_iMinY; int m_iMaxY; - BOOL m_bButtons[2]; + bool m_bButtons[2]; // diff --git a/source/YamlHelper.h b/source/YamlHelper.h index cc45ff0a..610ffd42 100644 --- a/source/YamlHelper.h +++ b/source/YamlHelper.h @@ -132,11 +132,6 @@ public: return GetMapValueUINT(key) ? true : false; } - BOOL GetMapValueBOOL(const std::string key) - { - return GetMapValueUINT(key) ? TRUE : FALSE; - } - std::string GetMapValueSTRING_NoThrow(const std::string& key, bool& bFound) { std::string value = m_yamlHelper.GetMapValue(*m_pMapYaml, key, bFound); @@ -226,8 +221,6 @@ private: class YamlSaveHelper { -friend class Indent; // Indent can access YamlSaveHelper's private members - public: YamlSaveHelper(std::string pathname) : m_hFile(NULL),