Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signed __int64 __fastcall cGraphicDeviceDx11::create(CGraphicDeviceDx11 *pThis, __int64 a2, __int64 a3, HWND hWindow, __int64 pInfo)
- {
- CGraphicDeviceDx11 *pGraphicsDevice; // rbx
- HWND hWnd; // r12
- __int64 v7; // rsi
- __int64 pContext; // rax
- __int64 pDeviceCtx; // r15
- char *v10; // rdx
- int iAdapter; // er8
- int v12; // ecx
- int v13; // ecx
- int v14; // er9
- char *msg; // rdx
- __int64 v16; // ST28_8
- D3D11_QUERY_DESC query_timestamp; // rax
- ID3D11Device *v18; // rcx
- __int64 v19; // rdi
- ID3D11Device *v20; // rcx
- ID3D11Device *v21; // rcx
- ID3D11Device *v22; // rcx
- int v23; // edi
- int v24; // esi
- D3D11_QUERY_DESC query_occlusion; // [rsp+30h] [rbp-48h]
- int v27; // [rsp+38h] [rbp-40h]
- int v28; // [rsp+3Ch] [rbp-3Ch]
- int v29; // [rsp+40h] [rbp-38h]
- int v30; // [rsp+44h] [rbp-34h]
- __int64 v31; // [rsp+48h] [rbp-30h]
- struct tagRECT Rect; // [rsp+50h] [rbp-28h]
- *&Rect.left = a2;
- pGraphicsDevice = pThis;
- hWnd = hWindow;
- v7 = a3;
- pContext = fiber_t::new_operator(0x580ui64, *(pInfo + 16));
- if ( !pContext || (pDeviceCtx = Hw::cGraphicContextDx11::Hw::cGraphicContextDx11(pContext)) == 0 )
- {
- v10 = &unk_141AB2B60;
- goto LABEL_34;
- }
- if ( CreateDXGIFactory(&IID_IDXGIFactory, &pGraphicsDevice->pFactory) < 0 )
- {
- v10 = aCgraphicdevice_1;
- LABEL_34:
- FailureMessage(0x1426DEA58i64, v10);
- return 0i64;
- }
- if ( !sub_140E835F0(pGraphicsDevice, *(pInfo + 16)) )
- {
- v10 = aCgraphicdevice_0;
- goto LABEL_34;
- }
- if ( ReadGraphicsIni(pGraphicsDevice, &query_occlusion) )
- {
- iAdapter = query_occlusion.Query;
- }
- else
- {
- iAdapter = 0;
- query_occlusion = 0i64;
- }
- v12 = *pInfo;
- v27 = 1280;
- v28 = 720;
- if ( v12 )
- {
- v13 = v12 - 1;
- if ( v13 )
- {
- if ( v13 == 1 )
- {
- v27 = 1920;
- v28 = 1080;
- }
- }
- else
- {
- v27 = 1600;
- v28 = 900;
- }
- }
- else
- {
- v27 = 1280;
- v28 = 720;
- }
- v14 = *(pInfo + 136);
- v30 = 0;
- v31 = 1i64;
- v29 = 1114636288;
- if ( cGraphicDeviceDx11::createDevice(pGraphicsDevice, (pDeviceCtx + 8), iAdapter, v14) )
- {
- if ( cGraphicObjectFactoryDx11::create(&pGraphicsDevice->pD3D11Device2, pGraphicsDevice->pID3D11Device, pGraphicsDevice->pFactory, pInfo) )
- {
- v16 = *(pInfo + 16);
- if ( sub_140E7CEC0(pGraphicsDevice, v7) )
- {
- query_timestamp = query_occlusion;
- pGraphicsDevice->m_QueryDescs[1] = query_occlusion;
- pGraphicsDevice->m_QueryDescs[2] = query_timestamp;
- *(pDeviceCtx + 0x90) = pGraphicsDevice + 0x40;
- v18 = pGraphicsDevice->pID3D11Device;
- query_occlusion = 0i64;
- query_occlusion.Query = D3D11_QUERY_OCCLUSION;
- if ( v18->lpVtbl->CreateQuery(v18, &query_occlusion, &pGraphicsDevice->m_pOcclusion) >= 0 )
- {
- LOBYTE(pGraphicsDevice[1].iScreenWidth) = 0;
- *&pGraphicsDevice[1]._0x0080[8] = 0;
- query_occlusion = 0i64;
- v19 = 0i64;
- while ( 1 )
- {
- v20 = pGraphicsDevice->pID3D11Device;
- query_occlusion = D3D11_QUERY_TIMESTAMP_DISJOINT;
- if ( v20->lpVtbl->CreateQuery(v20, &query_occlusion, &pGraphicsDevice[1]._0x0048[8 * v19 + 0x18]) < 0 )
- break;
- v21 = pGraphicsDevice->pID3D11Device;
- query_occlusion.Query = D3D11_QUERY_TIMESTAMP;
- if ( v21->lpVtbl->CreateQuery(v21, &query_occlusion, &pGraphicsDevice[1].flScreenHz + v19) < 0 )
- break;
- v22 = pGraphicsDevice->pID3D11Device;
- query_occlusion.Query = D3D11_QUERY_TIMESTAMP;
- if ( v22->lpVtbl->CreateQuery(v22, &query_occlusion, &pGraphicsDevice[1].hWnd + v19) < 0 )
- break;
- v19 = (v19 + 1);
- if ( v19 >= 5 )
- {
- pGraphicsDevice->_0x0108 = *(pDeviceCtx + 8);
- *(pDeviceCtx + 0x578) = pGraphicsDevice->pID3D11Device;
- **&Rect.left = pDeviceCtx;
- *&pGraphicsDevice->_0x0080[88] = *(pInfo + 40);
- *&pGraphicsDevice->_0x0080[80] = *(pInfo + 16);
- *&pGraphicsDevice->_0x0080[72] = *(pInfo + 48);
- GetClientRect(hWnd, &Rect);
- v23 = Rect.right - Rect.left;
- v24 = Rect.bottom - Rect.top;
- if ( !sub_140E59E60() )
- sub_140E99C50(pGraphicsDevice, hWnd, v23, v24);
- pGraphicsDevice->m_QueryDescs[0].Query = v23;
- pGraphicsDevice->m_QueryDescs[0].MiscFlags = v24;
- pGraphicsDevice->hWnd = hWnd;
- pGraphicsDevice->isWindowed = 1;
- *(&pGraphicsDevice->m_uAdapterCount + 1) = 1;
- return 1i64;
- }
- }
- }
- msg = &unk_141AB2D10;
- }
- else
- {
- msg = aCgraphicdevice_15;
- }
- }
- else
- {
- msg = aCgraphicdevice_16;
- }
- }
- else
- {
- msg = &unk_141AB2C28;
- }
- FailureMessage(5409466968i64, msg);
- (**pDeviceCtx)(pDeviceCtx, 1i64);
- return 0i64;
- }
Add Comment
Please, Sign In to add comment