void CSettings::SaveCalibration() { FILEINFO f; if ( !BIOS::DSK::Open(&f, "CALIB DAT", BIOS::DSK::IoWrite) ) { _ASSERT( 0 ); return; } ui8* pSharedBuffer = (ui8*)BIOS::DSK::GetSharedBuffer(); memset( pSharedBuffer, 0, FILEINFO::SectorSize ); ui32 dwId = ToDword('C', 'A', 'L', '1'); CStream bufStream( pSharedBuffer, FILEINFO::SectorSize ); bufStream << dwId << CStream(&DacCalib, sizeof(DacCalib)); _ASSERT_VALID( BIOS::DSK::Write(&f, pSharedBuffer) ); memset( pSharedBuffer, 0, FILEINFO::SectorSize ); bufStream.Reset(); bufStream << CStream(&CH1Calib, sizeof(CH1Calib)); _ASSERT_VALID( BIOS::DSK::Write(&f, pSharedBuffer) ); memset( pSharedBuffer, 0, FILEINFO::SectorSize ); bufStream.Reset(); bufStream << CStream(&CH2Calib, sizeof(CH1Calib)); _ASSERT_VALID( BIOS::DSK::Write(&f, pSharedBuffer) ); BIOS::DSK::Close(&f); }
void CWndUserManager::LoadModuleList() { CBufferedReader2 fMods; if ( fMods.Open((char*)"modules.dat") ) { ui32 dwCheck; fMods >> dwCheck; if ( dwCheck != ToDword('M', 'L', 'S', '1') ) { fMods.Close(); return; } int nCount = 0; fMods >> nCount; if ( nCount < 0 || nCount > m_arrLoaded.GetMaxSize() ) { fMods.Close(); return; } for ( int i=0; i<nCount; i++ ) { TLoadedModule mod; fMods >> CStream( &mod, sizeof(TLoadedModule) ); _ASSERT( !(mod.dwBegin & 0x80000000) ); m_arrLoaded.Add( mod ); } fMods.Close(); }
bool CSettings::LoadCalibration() { FILEINFO f; if ( !BIOS::DSK::Open(&f, "CALIB DAT", BIOS::DSK::IoRead) ) { return false; } ui8* pSharedBuffer = (ui8*)BIOS::DSK::GetSharedBuffer(); _ASSERT_VALID( BIOS::DSK::Read(&f, pSharedBuffer) ); CStream bufStream( pSharedBuffer, FILEINFO::SectorSize ); ui32 dwId = 0; bufStream >> dwId; if ( dwId != ToDword('C', 'A', 'L', '1') ) { _ASSERT(0); return false; } bufStream >> CStream(&DacCalib, sizeof(DacCalib)); bufStream.Reset(); _ASSERT_VALID( BIOS::DSK::Read(&f, pSharedBuffer) ); bufStream >> CStream(&CH1Calib, sizeof(CH1Calib)); bufStream.Reset(); _ASSERT_VALID( BIOS::DSK::Read(&f, pSharedBuffer) ); bufStream >> CStream(&CH2Calib, sizeof(CH2Calib)); BIOS::DSK::Close(&f); return true; }