Exemple #1
0
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 CChart::Construct(HWND hwnd, const string& symbol, int period, int digits, double lotSize)
{
	m_hwnd = hwnd;
	m_symbol = symbol;
	m_period = period;
	m_digits = digits;
	m_lotSize = lotSize;

	CStream() << "CChart::Construct() - 0 = " << GetCurrentThreadId() >> DebugLog;

	m_original = reinterpret_cast<WNDPROC>(SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(ChartProcHandler)));
	SendMessage(hwnd, cServiceMessage, cCreate, 0);
	CStream() << "CChart::Construct() - 1 = " << GetCurrentThreadId() >> DebugLog;
}
VMAssembleInput::VMAssembleInput( CStream stream ){
	assert( stream.get() );
	BinaryReader reader( stream );
	this->m_asm = new VMAssembleCollection();

	while( reader.hasNext() ){
		vector<unsigned char> Code;
		string AssemblyName = reader.ToString();
		size_t StackFrame = reader.ToUInt32();
		size_t Address = reader.ToUInt32();
		size_t Args = reader.ToUInt32();
		size_t CodeSize = reader.ToUInt32();
		if( !reader.hasNext() ){
			break;
		}
		for( size_t i = 0 ; i < CodeSize ; i++ ){
			Code.push_back( reader.getByte() );
		}
		AsmInfo* asmInfo = new AsmInfo();
		asmInfo->setName( AssemblyName );
		asmInfo->setStackFrame( StackFrame );
		asmInfo->setAddress( Address );
		asmInfo->setArgs( Args );
		asmInfo->setBytes( CStream( new BinaryStream( Code ) ) );
		this->m_asm->entryAssembly( asmInfo );
	}
}
Exemple #4
0
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();
	}
Exemple #5
0
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;
}