Example #1
0
bool OBS::BufferVideoData(const List<DataPacket> &inputPackets, const List<PacketType> &inputTypes, DWORD timestamp, VideoSegment &segmentOut)
{
    VideoSegment &segmentIn = *bufferedVideo.CreateNew();
    segmentIn.ctsOffset = ctsOffset;
    segmentIn.timestamp = timestamp;

    segmentIn.packets.SetSize(inputPackets.Num());
    for(UINT i=0; i<inputPackets.Num(); i++)
    {
        segmentIn.packets[i].data.CopyArray(inputPackets[i].lpPacket, inputPackets[i].size);
        segmentIn.packets[i].type =  inputTypes[i];
    }

    if((bufferedVideo.Last().timestamp-bufferedVideo[0].timestamp) >= UINT(App->bufferingTime))
    {
        segmentOut.packets.TransferFrom(bufferedVideo[0].packets);
        segmentOut.ctsOffset = bufferedVideo[0].ctsOffset;
        segmentOut.timestamp = bufferedVideo[0].timestamp;
        bufferedVideo.Remove(0);

        return true;
    }

    return false;
}
Example #2
0
LRESULT QnSkinDialog::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
	if (m_pThemeDialog) {
		switch(message) {
		case WM_ACTIVATE:
			OnThemeActivate(wParam, CWnd::FromHandle((HWND)lParam), 0);
			return 0;
		case WM_NCACTIVATE:
			return OnThemeNcActivate((BOOL)wParam);
		case WM_NCCALCSIZE:
			OnThemeNcCalcSize((BOOL)wParam, (NCCALCSIZE_PARAMS *)lParam);
			break;
		case WM_NCHITTEST: {
				UINT nHitTest = OnThemeNcHitTest(CPoint(lParam));
				if (HTCLIENT != nHitTest) {
					return nHitTest;
				}
			}break;
		case WM_NCPAINT:
			OnThemeNcPaint();
			return 0;
		case WM_NCLBUTTONDOWN: {
			if (OnThemeNcLButtonDown(wParam, CPoint(lParam)))
				return 0;
			}break;
		case WM_NCLBUTTONUP: {
			if (OnThemeNcLButtonUp(wParam, CPoint(lParam)))
				return 0;
			}break;
		case WM_NCLBUTTONDBLCLK: {
			OnThemeNcLButtonDblClk(wParam, CPoint(lParam));
			}break;
		case WM_NCRBUTTONDOWN:
			OnThemeNcRButtonDown(wParam, CPoint(lParam));
			return 0;
		case WM_NCRBUTTONUP:
			OnThemeNcRButtonUp(wParam,CPoint(lParam));
			return 0;
		case WM_LBUTTONUP:
			OnThemeLButtonUp(UINT(wParam), CPoint(lParam));
			break;
		case WM_NCMOUSEMOVE:
			OnThemeNcMouseMove(wParam, CPoint(lParam));
			break;
		case WM_GETMINMAXINFO:
			OnThemeGetMinMaxInfo((MINMAXINFO*)lParam);
			break;
		case WM_CREATE:
			OnThemeResize();
			break;
		case WM_NCCREATE:
			DisableAeroStyle(m_hWnd);
			break;
		default:
			break;
		}
	}
	return QnBaseDialog::WindowProc(message, wParam, lParam);
}
Example #3
0
void CExtThemeSwitcherToolControlBar::ThemeSwitcher_OnButtonUpdate(
	CExtThemeSwitcherToolButton * pTBB
	)
{
	ASSERT_VALID( this );
	ASSERT_VALID( pTBB );
	ASSERT( LPVOID(pTBB->GetBar()) == LPVOID(this) );
bool bRedrawButton = false;
UINT nCmdID = pTBB->GetCmdID(false);
CRuntimeClass * pRTC = NULL;
	if( m_mapCmd2RTC.Lookup( nCmdID, pRTC ) )
	{
		if( pTBB->IsDisabled() )
		{
			bRedrawButton = true;
			pTBB->ModifyStyle( 0, TBBS_DISABLED );
		}
		
		CExtPaintManager::e_paint_manager_name_t ePMN =
			PmBridge_GetPM()->OnQueryPaintManagerName();
		UINT nCheckID = 0;
		if( ! m_arrMapsTT[m_eTIS_ToolBar].Lookup( UINT(ePMN), nCheckID ) )
			return;
		if( nCheckID == nCmdID )
		{
			if( (pTBB->GetStyle()&TBBS_CHECKED) == 0 )
			{
				bRedrawButton = true;
				pTBB->ModifyStyle( TBBS_CHECKED );
			}
		}
		else
		{
			if( (pTBB->GetStyle()&TBBS_CHECKED) != 0 )
			{
				bRedrawButton = true;
				pTBB->ModifyStyle( 0, TBBS_CHECKED );
			}
		}
	}
	else
	{
		if( (pTBB->GetStyle()&TBBS_CHECKED) != 0 )
		{
			bRedrawButton = true;
			pTBB->ModifyStyle( 0, TBBS_CHECKED );
		}
		if( ! pTBB->IsDisabled() )
		{
			bRedrawButton = true;
			pTBB->ModifyStyle( TBBS_DISABLED );
		}
	}
	if(		bRedrawButton
		&&	(pTBB->GetStyle()&TBBS_HIDDEN) == 0
		&&	pTBB->IsVisible()
		)
		pTBB->RedrawButton( false );
}
Example #4
0
dx10State::dx10State() : 
	m_pRasterizerState(0),
	m_pDepthStencilState(0),
	m_pBlendState(0),
	m_uiStencilRef(UINT(-1)),
	m_uiAlphaRef(0)
{
}
Example #5
0
static int enter_switch_op (ut64 addr, const ut8 * bytes, char *output, int outlen ) {
	ut8 idx = bytes[0];
	IN_SWITCH_OP = 1;
	ut8 sz = (BYTES_CONSUMED+1) % 4 ? 1 + 4 - (BYTES_CONSUMED+1) % 4: 1; // + (BYTES_CONSUMED+1)  % 4;
	ut8 sz2 = (4 - (addr+1) % 4) + (addr+1)  % 4;
	IFDBG eprintf ("Addr approach: 0x%04x and BYTES_CONSUMED approach: 0x%04x\n", sz2, sz);
	init_switch_op ();
	IN_SWITCH_OP = 1;
	SWITCH_OP.addr = addr;
	SWITCH_OP.def_jmp = (ut32)(UINT (bytes, sz));
	SWITCH_OP.min_val = (ut32)(UINT (bytes, sz + 4));
	SWITCH_OP.max_val = (ut32)(UINT (bytes, sz + 8));
	sz += 12;
	snprintf (output, outlen, "%s default: 0x%04"PFMT64x, JAVA_OPS[idx].name,
		SWITCH_OP.def_jmp+SWITCH_OP.addr);
	return update_bytes_consumed(sz);
}
Example #6
0
String& String::operator = (const char *String)
{
    UINT NewLength = UINT(strlen(String));
    Allocate(NewLength + 1);
    memcpy(_Data, String, NewLength + 1);
    _Length = NewLength;
    return *this;
}
Example #7
0
UnicodeString& UnicodeString::operator = (const UnicodeCharacter *S)
{
    UINT NewLength = UINT(lstrlenW(S));
    Allocate(NewLength + 1);
    memcpy(_Data, S, (NewLength + 1) * sizeof(UnicodeCharacter));
    _Length = NewLength;
    return *this;
}
Example #8
0
BOOL CRecBinViewer::ExecCommand (LPCONTEXTMENU pCtxMenu,  LPCTSTR lpszCommand)
{
	UINT uiID = UINT (-1);
	UINT uiCommand = 0;
	UINT uiMenuFirst = 1;
	UINT uiMenuLast = 0x00007FFF;
	HMENU hmenuCtx;
	int iMenuPos = 0;
	int iMenuMax = 0;
	TCHAR szMenuItem[MAX_PATH];	
	TCHAR verb[MAX_PATH] ;

	hmenuCtx = CreatePopupMenu();
	HRESULT hr = pCtxMenu->QueryContextMenu(hmenuCtx, 0, uiMenuFirst, uiMenuLast, CMF_NORMAL);

	iMenuMax = GetMenuItemCount(hmenuCtx);
	
	for (iMenuPos = 0 ; iMenuPos < iMenuMax; iMenuPos++)
	{
		GetMenuString(hmenuCtx, iMenuPos, szMenuItem, MAX_PATH, MF_BYPOSITION) ;
	
		uiID = GetMenuItemID(hmenuCtx, iMenuPos) ;
		
		if ((uiID == -1) || (uiID == 0))
		{
			
		}
		else
		{
			hr = pCtxMenu->GetCommandString(uiID - 1, GCS_VERB, NULL, (LPSTR)verb, MAX_PATH);
			if (FAILED (hr))
			{
				verb[0] = TCHAR ('\0') ;
			}
			else
			{
				if (0 == _tcsicmp (verb, lpszCommand))				
					uiCommand = uiID - 1;				
			}			
		}
	}
	
	if ((UINT)-1 != uiCommand)
	{
		CMINVOKECOMMANDINFO cmi;			
		ZeroMemory(&cmi, sizeof(CMINVOKECOMMANDINFO));
		cmi.cbSize			= sizeof(CMINVOKECOMMANDINFO);
		cmi.fMask			= CMIC_MASK_FLAG_NO_UI;
		cmi.hwnd			= m_hWnd;				
		cmi.lpVerb			= (LPSTR)MAKEINTRESOURCE (uiCommand);
		cmi.nShow			= SW_SHOWNORMAL;		
		hr = pCtxMenu->InvokeCommand(&cmi);			
		if (SUCCEEDED (hr))		
			return TRUE;		
	}

	return false;
}
void CEditTreeCtrl::DisplayContextMenu(CPoint & point) {
	CPoint pt(point);
	ScreenToClient(&pt);
	UINT flags;
	HTREEITEM hItem = HitTest(pt, &flags);
	bool bOnItem = (flags & TVHT_ONITEM) != 0;

	CMenu add;
	VERIFY(add.CreatePopupMenu());
	if(bOnItem) {
		if(CanInsertItem(GetParentItem(hItem)))
			VERIFY(add.AppendMenu(MF_STRING, ID_ADD_SIBLING, _T("New Sibling\tINS")));
		if(CanInsertItem(hItem))
			VERIFY(add.AppendMenu(MF_STRING, ID_ADD_CHILD, _T("New Child Item\tCtrl+INS")));
	}
	if(CanInsertItem(0))
		VERIFY(add.AppendMenu(MF_STRING, ID_ADD_ROOT, _T("New Root Item\tShift+INS")));

	CMenu sort;
	VERIFY(sort.CreatePopupMenu());
	VERIFY(sort.AppendMenu(MF_STRING, ID_SORT_LEVEL, _T("Current Level\tCtrl+S")));
	VERIFY(sort.AppendMenu(MF_STRING, ID_SORT_LEVELANDBELOW, _T("Current Level And Below\tCtrl+Shift+S")));

	CMenu menu;
	VERIFY(menu.CreatePopupMenu());
	if(bOnItem) {
		if(CanEditLabel(hItem))
			VERIFY(menu.AppendMenu(MF_STRING, ID_RENAME, _T("Rename\tF2")));
		if(CanDeleteItem(hItem))
			VERIFY(menu.AppendMenu(MF_STRING, ID_DELETE, _T("Delete\tDEL")));
	}
	if(add.GetMenuItemCount() > 0)
		VERIFY(menu.AppendMenu(MF_POPUP, UINT(add.GetSafeHmenu()), _T("Add")));
	if(bOnItem) {
		if(menu.GetMenuItemCount() > 0)
			VERIFY(menu.AppendMenu(MF_SEPARATOR));
		VERIFY(menu.AppendMenu(MF_POPUP, UINT(sort.GetSafeHmenu()), _T("Sort")));
	}

	ExtendContextMenu(menu);

	// maybe the menu is empty...
	if(menu.GetMenuItemCount() > 0)
		menu.TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);
}
Example #10
0
void CProgressCtrl :: DrawPosition (UINT iPos)
{	
	HRGN hrgn = NULL;
	CDC *pCDC = NULL;
	HBRUSH hBrush = NULL;

	if (iPos == 0)		// Reset !
	{
		hrgn = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
		m_iDrawPos == 0;
	}		
	else                                        
	{
		UINT iX = UINT (iPos * m_dFaktor);
		if (iX == m_iDrawPos)		// keine Postionsänderung
			return;
		if (iX > m_iDrawPos && iX <= (UINT) rc.Width ())					
			m_iDrawPos = iX;
		else
		{
			if (iX > (UINT) rc.Width())
				m_iDrawPos = rc.right;		
			else
				return;			
		}	
		hrgn = CreateRectRgn(rc.left, rc.top, m_iDrawPos, rc.bottom);					
	}		
	
	if (hrgn)
	{
		pCDC = GetDC (); 	
		if (pCDC)
		{
			int iRgn = (int) SelectObject (pCDC -> m_hDC, hrgn);
			if (NULLREGION != iRgn && ERROR != iRgn)
			{
				if (iPos == 0)
					hBrush = CreateSolidBrush(RGB(iDelCol, iDelCol, iDelCol));	
				else
					hBrush = CreateSolidBrush(RGB(0, 0, iShowCol));					
				if (hBrush)
					FillRgn(pCDC -> m_hDC, hrgn, hBrush);		// Fläche füllen
			}
		}
	}
		
//	alles wieder freigeben		
	if (hrgn)		
		DeleteObject(hrgn);
	if (hBrush)
		DeleteObject (hBrush);
	if (pCDC)		
		ReleaseDC (pCDC);
		
//	Fenster nachzeichnen	
	UpdateWindow ();
}	
Example #11
0
	LRESULT CMenuWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
	{
		if( m_pOwner != NULL) {
			LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
			styleValue &= ~WS_CAPTION;
			::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
			RECT rcClient;
			::GetClientRect(*this, &rcClient);
			::SetWindowPos(*this, NULL, rcClient.left, rcClient.top, rcClient.right - rcClient.left, \
				rcClient.bottom - rcClient.top, SWP_FRAMECHANGED);

			m_pm.Init(m_hWnd);
			// The trick is to add the items to the new container. Their owner gets
			// reassigned by this operation - which is why it is important to reassign
			// the items back to the righfull owner/manager when the window closes.
			m_pLayout = new CMenuUI();
			m_pm.SetForceUseSharedRes(true);
			m_pLayout->SetManager(&m_pm, NULL, true);
			LPCTSTR pDefaultAttributes = m_pOwner->GetManager()->GetDefaultAttributeList(_T("Menu"));
			if( pDefaultAttributes ) {
				m_pLayout->ApplyAttributeList(pDefaultAttributes);
			}
			m_pLayout->SetAutoDestroy(false);

			for( int i = 0; i < m_pOwner->GetCount(); i++ ) {
				if(m_pOwner->GetItemAt(i)->GetInterface(_T("MenuElement")) != NULL ){
					(static_cast<CMenuElementUI*>(m_pOwner->GetItemAt(i)))->SetOwner(m_pLayout);
					m_pLayout->Add(static_cast<CControlUI*>(m_pOwner->GetItemAt(i)));
				}
			}

			CShadowUI *pShadow = m_pOwner->GetManager()->GetShadow();
			pShadow->CopyShadow(m_pm.GetShadow());
			pShadow->ShowShadow(false);

			m_pm.AttachDialog(m_pLayout);
			m_pm.AddNotifier(this);

			ResizeSubMenu();
		}
		else {
			m_pm.Init(m_hWnd);

			CDialogBuilder builder;

			CControlUI* pRoot = builder.Create(m_xml,UINT(0), this, &m_pm);
			m_pm.GetShadow()->ShowShadow(false);
			m_pm.AttachDialog(pRoot);
			m_pm.AddNotifier(this);

			ResizeMenu();
		}

		m_pm.GetShadow()->ShowShadow(true);
		m_pm.GetShadow()->Create(&m_pm);
		return 0;
	}
Example #12
0
static int handle_switch_op (ut64 addr, const ut8 * bytes, char *output, int outlen ) {
    int sz = 4;
    ut32 jmp = (int)(UINT (bytes, 0)) + SWITCH_OP.addr;
    int ccase = SWITCH_OP.cur_val + SWITCH_OP.min_val;
    snprintf(output, outlen, "case %d: goto 0x%04x", ccase, jmp);

    update_switch_op (addr, bytes);
    return update_bytes_consumed(sz);
}
Example #13
0
//===============================================================================================
// FUNCTION: FreeReadBuffer
// PURPOSE:  Frees the read buffer and resets the cached episode.
//
void CFileDescriptor::FreeReadBuffer()
{
   MEMBERASSERT();
   if (m_pvReadBuffer != NULL)
      free(m_pvReadBuffer);
   m_pvReadBuffer = NULL;
   m_uCachedEpisode = UINT(-1);
   m_uCachedEpisodeSize = 0;
}
Example #14
0
template <class type> void Vector<type>::Randomize()
{
    UINT Len = Length();
    for(UINT i = 0; i < Len; i++)
    {
        UINT RandomNumber = UINT(rand());
        Utility::Swap(Data[i], Data[i + RandomNumber % (Len - i)]);
    }
}
Example #15
0
RequestRouter::RequestRouter(IRestService *service, QObject *parent)
    : QObject(parent),
      m_service(service),
      m_restService(service),
      m_uidRestService(NULL),
      m_hasDefaultRoute(false)
{
    addRoute("/")
            ->on(IRequest::GET, ROUTE(m_restService->index))
            ->on(IRequest::POST, ROUTE(m_restService->create));

    addRoute("/:id")
            ->on(IRequest::GET, ROUTE(m_restService->show, UINT(id) ))
            ->on(IRequest::PUT, ROUTE(m_restService->edit, UINT(id) ))
            ->on(IRequest::DELETE, ROUTE(m_restService->del, UINT(id) ));

    service->init(this);
}
	bool MyDynamicManyRectsBase::Create(ID3D11Device* pD3DDevice, UINT rectCount, UINT strideInBytes, const void* pInitialData)
	{
		_ASSERTE(m_pVertexBuffer == nullptr);
		_ASSERTE(m_pIndexBuffer == nullptr);
		_ASSERTE(pD3DDevice != nullptr);
		_ASSERTE(pInitialData != nullptr); // 頂点バッファ初期化データに NULL 指定は不可。テクスチャの生成のときや、OpenGL とは違う。
		_ASSERTE(rectCount > 0);
		_ASSERTE(strideInBytes > 0);

		HRESULT hr = E_FAIL;
		const UINT vertexCount = rectCount * 4;

		D3D11_BUFFER_DESC vbDesc = {};
		vbDesc.ByteWidth = vertexCount * strideInBytes;
		vbDesc.Usage = D3D11_USAGE_DYNAMIC;
		vbDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
		vbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

		D3D11_SUBRESOURCE_DATA vbSubrData = {};
		vbSubrData.pSysMem = pInitialData;

		hr = pD3DDevice->CreateBuffer(&vbDesc, &vbSubrData, m_pVertexBuffer.ReleaseAndGetAddressOf());
		if (FAILED(hr))
		{
			return false;
		}

		std::vector<TIndex> indexArray(rectCount * 6);
		for (size_t i = 0; i < rectCount; ++i)
		{
			// CCW
			indexArray[i * 6 + 0] = TIndex(0 + (i * 4));
			indexArray[i * 6 + 1] = TIndex(2 + (i * 4));
			indexArray[i * 6 + 2] = TIndex(1 + (i * 4));
			indexArray[i * 6 + 3] = TIndex(1 + (i * 4));
			indexArray[i * 6 + 4] = TIndex(2 + (i * 4));
			indexArray[i * 6 + 5] = TIndex(3 + (i * 4));
		}

		D3D11_BUFFER_DESC ibDesc = {};
		ibDesc.ByteWidth = UINT(indexArray.size() * sizeof(TIndex));
		ibDesc.Usage = D3D11_USAGE_DEFAULT;
		ibDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;

		D3D11_SUBRESOURCE_DATA ibSubrData = {};
		ibSubrData.pSysMem = &indexArray[0];

		hr = pD3DDevice->CreateBuffer(&ibDesc, &ibSubrData, m_pIndexBuffer.ReleaseAndGetAddressOf());
		if (FAILED(hr))
		{
			return false;
		}

		m_rectCount = rectCount;
		m_vertexBufferSizeInBytes = vbDesc.ByteWidth;
		return true;
	}
Example #17
0
void BoneModel::createBone(){

	auto& bones = mBoneAssetDataPtr->GetFileData().GetBoneData().mBoneBuffer;
	auto& boneName = mBoneAssetDataPtr->GetFileData().GetBoneData().mBoneName;

	DWORD mBoneNum = bones.size();
	mBone.clear();
	mIk.clear();
	mBone.resize(mBoneNum);

	DWORD ikCount = 0;
	for (DWORD i = 0; i < mBoneNum; i++){
		auto& bone = bones[i];


		mBone[i].mStrName = boneName[i];
		mBone[i].mHierarchy.mIdxSelf = i;
		mBone[i].mHierarchy.mIdxParent = bone.parent_bidx;
		if (bone.parent_bidx >= (int)mBoneNum) mBone[i].mHierarchy.mIdxParent = UINT(-1);


		XMVECTOR head_pos = XMVectorSet(bone.bone_head_pos[0], bone.bone_head_pos[1], bone.bone_head_pos[2], 0.0f);
		XMVECTOR parent_pos = { 0, 0, 0, 1 };
		if (mBone[i].mHierarchy.mIdxParent < (int)mBoneNum){
			UINT p = mBone[i].mHierarchy.mIdxParent;
			parent_pos = XMVectorSet(bones[p].bone_head_pos[0], bones[p].bone_head_pos[1], bones[p].bone_head_pos[2], 0.0f);
		}

		XMVECTOR local_pos = XMVectorSubtract(head_pos, parent_pos);

		mBone[i].mPos = XMFLOAT3(XMVectorGetX(local_pos), XMVectorGetY(local_pos), XMVectorGetZ(local_pos));
		mBone[i].mScale = XMFLOAT3(1.0f, 1.0f, 1.0f);
		XMVECTOR q = XMQuaternionIdentity();
		mBone[i].mRot = XMFLOAT4(XMVectorGetX(q), XMVectorGetY(q), XMVectorGetZ(q), XMVectorGetW(q));

		//ワールド行列計算
		XMVECTOR scale = { 1, 1, 1, 1 };
		mBone[i].mMtxPose = SRTMatrix(scale, q, local_pos);
		if (mBone[i].mHierarchy.mIdxParent < (int)mBoneNum){
			mBone[i].mMtxPose = XMMatrixMultiply(mBone[i].mMtxPose, mBone[mBone[i].mHierarchy.mIdxParent].mMtxPose);
		}
		if (bone.bone_flag & pmx::t_bone::BIT_IK){
			mBone[i].mIkBoneIdx = (WORD)bone.t_ik_data_idx;

			createIk(ikCount, i);
			ikCount++;
		}
		else{
			mBone[i].mIkBoneIdx = 0;
		}


		mBone[i].mMtxPoseInit = mBone[i].mMtxPose;

	}
}
Example #18
0
HRESULT CCDDAStream::Read(PBYTE pbBuffer, DWORD dwBytesToRead, BOOL bAlign, LPDWORD pdwBytesRead)
{
    CAutoLock lck(&m_csLock);

    PBYTE pbBufferOrg = pbBuffer;
    LONGLONG pos = m_llPosition;
    size_t len = dwBytesToRead;

    if (!m_bDTS) {
        if (pos < sizeof(m_header) && len > 0) {
            size_t l = std::min(len, size_t(sizeof(m_header) - pos));
            memcpy(pbBuffer, &((BYTE*)&m_header)[pos], l);
            pbBuffer += l;
            pos += l;
            len -= l;
        }

        pos -= sizeof(m_header);
    }

    while (pos >= 0 && pos < m_llLength && len > 0) {
        RAW_READ_INFO rawreadinfo;
        rawreadinfo.TrackMode = CDDA;

        UINT sector = m_nStartSector + UINT(pos / RAW_SECTOR_SIZE);
        UINT offset = pos % RAW_SECTOR_SIZE;

        // Reading 20 sectors at once seems to be a good trade-off between performance and compatibility
        rawreadinfo.SectorCount = std::min(20u, m_nStopSector - sector);

        if (m_buff.size() < rawreadinfo.SectorCount * RAW_SECTOR_SIZE) {
            m_buff.resize(rawreadinfo.SectorCount * RAW_SECTOR_SIZE);
        }

        rawreadinfo.DiskOffset.QuadPart = sector * 2048;
        DWORD dwBytesReturned = 0;
        VERIFY(DeviceIoControl(m_hDrive, IOCTL_CDROM_RAW_READ,
                               &rawreadinfo, sizeof(rawreadinfo),
                               m_buff.data(), (DWORD)m_buff.size(),
                               &dwBytesReturned, 0));

        size_t l = std::min(std::min(len, m_buff.size() - offset), size_t(m_llLength - pos));
        memcpy(pbBuffer, &m_buff[offset], l);

        pbBuffer += l;
        pos += l;
        len -= l;
    }

    if (pdwBytesRead) {
        *pdwBytesRead = DWORD(pbBuffer - pbBufferOrg);
    }
    m_llPosition += pbBuffer - pbBufferOrg;

    return S_OK;
}
Example #19
0
void CPLViewerDoc::OnProgress
( double Part
)
{
    //TRACE ("V %.4f\n", Part);
    // Jo Hagelberg 13.4.99
    // added real progress info
    UINT ipart = UINT( Part * 100.0);
    ((CMainFrame*)AfxGetMainWnd())->SetProgressInfo(ipart);
}
Example #20
0
	void MainWindow::SetupMenu()
	{
		HMENU hMenu, hSubMenu;

		hMenu = CreateMenu();

		hSubMenu = CreatePopupMenu();
		AppendMenu(hSubMenu, MF_STRING, IDM_QUIT, L"E&xit");
		AppendMenu(hMenu, MF_STRING | MF_POPUP, UINT(hSubMenu), L"&File");

		hSubMenu = CreatePopupMenu();
		AppendMenu(hSubMenu, MF_STRING, IDM_GO, L"&Go");
		AppendMenu(hSubMenu, MF_STRING, IDM_STOP, L"&Stop");
		AppendMenu(hSubMenu, MF_STRING, IDM_SLOWER, L"S&lower");
		AppendMenu(hSubMenu, MF_STRING, IDM_FASTER, L"&Faster");
		AppendMenu(hMenu, MF_STRING | MF_POPUP, UINT(hSubMenu), L"&Actions");

		SetMenu(ThisWindow, hMenu);
	}
Example #21
0
BOOL CALLBACK DlgMain_EnableStandalone(HWND hWnd)
{
	if (IsDlgButtonChecked(hWnd, 205))
	{
		TCHAR buffer[40];
		const UINT major = UINT(VERSION7Z);
		const UINT minor = UINT(VERSION7Z * 100 + 0.5) % 100;
		wsprintf(buffer, "Merge7z%u%02u.dll", major, minor);
		int lower = SendDlgItemMessage(hWnd, 100, LB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
		wsprintf(buffer, "Merge7z%u%02uU.dll", major, minor);
		int upper = SendDlgItemMessage(hWnd, 100, LB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
		SendDlgItemMessage(hWnd, 100, LB_SELITEMRANGEEX, lower, upper);
		if (GetFocus() == GetDlgItem(hWnd, 205))
		{
			SendDlgItemMessage(hWnd, 100, LB_SETTOPINDEX, lower, 0);
		}
	}
	return TRUE;
}
                /**
                 * for a given axis: returns the largest value that this implementation is able to store
                 */
                static int limit(dim_t axis)
                {
                    (void) axis; //supress -Wunused-parameter

                    UINT l = (UINT(1)<<BITS_PER_ENTRY)-1;
                    if (l > std::numeric_limits<int>::max())
                        return std::numeric_limits<int>::max();
                    else
                        return (int)l;
                }
void IRenderPipeline3D::RasterizePoints()
{
	for (UINT i = 0;i < m_pIB_HomoSpace_Clipped->size() ;++i)
	{
		RasterizedFragment outVertex;


		//get vertex
		UINT idx = m_pIB_HomoSpace_Clipped->at(i);
		const auto& v1 = m_pVB_HomoSpace_Clipped->at(idx);

		//convert to pixel space
		auto convertToPixelSpace = [&](const VertexShaderOutput_Vertex& v, VECTOR2& outV)
		{
			outV.x = float(mBufferWidth) * (v.posH.x + 1.0f) / 2.0f;
			outV.y = float(mBufferHeight) * (-v.posH.y + 1.0f) / 2.0f;
		};

		VECTOR2 v1_pixel;//pixel space
		convertToPixelSpace(v1, v1_pixel);

		//clip in scr space 
		if (v1_pixel.x >= mBufferWidth || v1_pixel.y >= mBufferHeight)
		{
			goto label_nextPixel;
		}

		//perform depth test
		float depth = v1.posH.z;
		if (mFunction_DepthTest(UINT(v1_pixel.x), UINT(v1_pixel.y), depth) == FALSE)goto label_nextPixel;

		//I will use normal bilinear interpolation to see the result first
		outVertex.pixelX = UINT(v1_pixel.x);
		outVertex.pixelY = UINT(v1_pixel.y);

		//perspective correct interpolation
		outVertex.color = v1.color;
		outVertex.texcoord = v1.texcoord;

		m_pVB_Rasterized->push_back(outVertex);
		label_nextPixel:;
	}//for each homogeneous space point
}
Example #24
0
//===============================================================================================
// FUNCTION: GetCurrentPos
// PURPOSE:  Get the current byte offset in the file.
//
UINT CTextFile::GetCurrentPos()
{
   MEMBERASSERT();

   LONGLONG lCurrentPosition = 0;
   m_File.GetCurrentPosition(&lCurrentPosition);
   UINT uPos = UINT(lCurrentPosition);
   uPos -= strlen(m_pszNext);
   return uPos;
}
Example #25
0
		void MenuAdapter::update(Menu& menu)
		{
			MENUITEMINFO info = { 0 };

			if (menu.getAdapter())
			{
				// Set the new menu item information.
				info.cbSize     = sizeof(info);
				info.fMask      = MIIM_STRING | MIIM_STATE | MIIM_SUBMENU | MIIM_ID | MIIM_FTYPE;
				info.fState     = MFS_ENABLED;
				info.fType      = MFT_STRING;
				info.wID        = UINT(menu.getId());
				info.hSubMenu   = HMENU(menu.getAdapter()->getHandle());
				info.dwTypeData = LPWSTR(menu.getText().toArray());

				if (::SetMenuItemInfo(HMENU(getHandle()), UINT(menu.getId()), FALSE, &info) == 0)
					throw UserInterfaceException("SetMenuItemInfo() failed");
			}
		}
Example #26
0
void CSoundSourceFMod::SetGain( FLOAT gain )
{
	TDU_Clamp(gain, 0.00001f, 1.0f);
	_Gain = gain;

	if(!_b3DMode)
	{
		FSOUND_SetVolume(_FModChannel, UINT(_Gain*255));
	}
}
Example #27
0
// посмотреть с удалением строчек
void CMatrix::setSize(UINT n, UINT m){

	// отслеживаем нулевое количество строк
	if (rowCount != n)
	{
		if (n == 0)
		{
			std::string 
				error, msg, place, 
				reason, object;
			error = "Error: length_error: ";
			place = "CMatrix::setSize(), newRowSize = ";
			reason = std::to_string(n);
			object = std::to_string(UINT(this));

			msg = error + place + reason + ", Object = " + object;
			throw std::length_error(msg);
		}

		CMatrix TempThis(*this);
		delete[] elements;

		UINT oldRowCount = rowCount;
		rowCount = n;

		elements = new CVector[rowCount];

		// если мы увеличили размер матрицы, в конце добавляем нули
		if (oldRowCount < rowCount)
		{
			for (UINT i = 0; i < oldRowCount; i++)
				elements[i] = TempThis[i];

			// выстраиваем хвост (добавляем в конец вектора нужного размера)
			for (UINT i = oldRowCount; i < rowCount; i++)
				elements[i].setSize(colCount);
		}
		else // иначе обрезаем имеющуюся матрицу, теряя элементы
		{
			for (UINT i = 0; i < rowCount; i++)
				elements[i] = TempThis[i];
		}
	}

	// вышли из try-catch для RowCount, у строк собственная проверка исключений

	if (colCount != m)
	{
		for (UINT i = 0; i < rowCount; i++)
			elements[i].setSize(m);

		colCount = m;
	}

}
	void ConvertToUnicode::Convert(const char * & sourceStart, const char * sourceEnd,
		UnicodeChar * & destStart, UnicodeChar * destEnd)
	{
		UINT sourceSize = UINT(sourceEnd - sourceStart);
		UINT destSize = UINT(destEnd - destStart);
		// It appears that DoConversionToUnicode fails if the destination buffer is too small.
		// Limit the number of input characters to the number of output characters that the
		// ouptut buffer can handle.
		if (sourceSize > destSize) {
			sourceSize = destSize;
		}
		HRESULT err = mConverter->DoConversionToUnicode(
			const_cast<char *>(sourceStart), &sourceSize,
			destStart, &destSize);
		if (err == S_OK) {
			sourceStart += sourceSize;
			destStart += destSize;
		}
		else ThrowXMLError(err);
	}
void CWizardSharePage::OnDoubleClick(NMHDR* /*pNMHDR*/, LRESULT* pResult)
{
	*pResult = 0;

	// Toggle checkmarks (newly selected items at second click)
	for ( int nItem = 0 ; nItem < m_wndList.GetItemCount() ; nItem++ )
	{
		if ( m_wndList.GetItemState( nItem, LVIS_SELECTED ) )
			m_wndList.SetItemState( nItem, UINT( ( m_wndList.GetCheck(nItem) ? 1 : 2 ) << 12 ), LVIS_STATEIMAGEMASK );
	}
}
void vmsWindowsStatusBar::MakeSureBarIsVisible()
{
	if (m_uBarPrevState != UINT (-1))
		return;

	APPBARDATA abd;
	abd.cbSize = sizeof (abd);
	abd.hWnd = NULL;
	m_uBarPrevState = SHAppBarMessage (ABM_GETSTATE, &abd);
	
	if ((m_uBarPrevState & ABS_AUTOHIDE) || (m_uBarPrevState & ABS_ALWAYSONTOP) == 0)
	{
		abd.lParam = ABS_ALWAYSONTOP;
		SHAppBarMessage (ABM_SETSTATE, &abd);
	}
	else
	{
		m_uBarPrevState = UINT (-1);
	}
}