Martymoose98

cGraphicDeviceDx11::create debug

Jul 7th, 2019
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.06 KB | None | 0 0
  1. signed __int64 __fastcall cGraphicDeviceDx11::create(CGraphicDeviceDx11 *pThis, __int64 a2, __int64 a3, HWND hWindow, __int64 pInfo)
  2. {
  3. CGraphicDeviceDx11 *pGraphicsDevice; // rbx
  4. HWND hWnd; // r12
  5. __int64 v7; // rsi
  6. __int64 pContext; // rax
  7. __int64 pDeviceCtx; // r15
  8. char *v10; // rdx
  9. int iAdapter; // er8
  10. int v12; // ecx
  11. int v13; // ecx
  12. int v14; // er9
  13. char *msg; // rdx
  14. __int64 v16; // ST28_8
  15. D3D11_QUERY_DESC query_timestamp; // rax
  16. ID3D11Device *v18; // rcx
  17. __int64 v19; // rdi
  18. ID3D11Device *v20; // rcx
  19. ID3D11Device *v21; // rcx
  20. ID3D11Device *v22; // rcx
  21. int v23; // edi
  22. int v24; // esi
  23. D3D11_QUERY_DESC query_occlusion; // [rsp+30h] [rbp-48h]
  24. int v27; // [rsp+38h] [rbp-40h]
  25. int v28; // [rsp+3Ch] [rbp-3Ch]
  26. int v29; // [rsp+40h] [rbp-38h]
  27. int v30; // [rsp+44h] [rbp-34h]
  28. __int64 v31; // [rsp+48h] [rbp-30h]
  29. struct tagRECT Rect; // [rsp+50h] [rbp-28h]
  30.  
  31. *&Rect.left = a2;
  32. pGraphicsDevice = pThis;
  33. hWnd = hWindow;
  34. v7 = a3;
  35. pContext = fiber_t::new_operator(0x580ui64, *(pInfo + 16));
  36. if ( !pContext || (pDeviceCtx = Hw::cGraphicContextDx11::Hw::cGraphicContextDx11(pContext)) == 0 )
  37. {
  38. v10 = &unk_141AB2B60;
  39. goto LABEL_34;
  40. }
  41. if ( CreateDXGIFactory(&IID_IDXGIFactory, &pGraphicsDevice->pFactory) < 0 )
  42. {
  43. v10 = aCgraphicdevice_1;
  44. LABEL_34:
  45. FailureMessage(0x1426DEA58i64, v10);
  46. return 0i64;
  47. }
  48. if ( !sub_140E835F0(pGraphicsDevice, *(pInfo + 16)) )
  49. {
  50. v10 = aCgraphicdevice_0;
  51. goto LABEL_34;
  52. }
  53. if ( ReadGraphicsIni(pGraphicsDevice, &query_occlusion) )
  54. {
  55. iAdapter = query_occlusion.Query;
  56. }
  57. else
  58. {
  59. iAdapter = 0;
  60. query_occlusion = 0i64;
  61. }
  62. v12 = *pInfo;
  63. v27 = 1280;
  64. v28 = 720;
  65. if ( v12 )
  66. {
  67. v13 = v12 - 1;
  68. if ( v13 )
  69. {
  70. if ( v13 == 1 )
  71. {
  72. v27 = 1920;
  73. v28 = 1080;
  74. }
  75. }
  76. else
  77. {
  78. v27 = 1600;
  79. v28 = 900;
  80. }
  81. }
  82. else
  83. {
  84. v27 = 1280;
  85. v28 = 720;
  86. }
  87. v14 = *(pInfo + 136);
  88. v30 = 0;
  89. v31 = 1i64;
  90. v29 = 1114636288;
  91. if ( cGraphicDeviceDx11::createDevice(pGraphicsDevice, (pDeviceCtx + 8), iAdapter, v14) )
  92. {
  93. if ( cGraphicObjectFactoryDx11::create(&pGraphicsDevice->pD3D11Device2, pGraphicsDevice->pID3D11Device, pGraphicsDevice->pFactory, pInfo) )
  94. {
  95. v16 = *(pInfo + 16);
  96. if ( sub_140E7CEC0(pGraphicsDevice, v7) )
  97. {
  98. query_timestamp = query_occlusion;
  99. pGraphicsDevice->m_QueryDescs[1] = query_occlusion;
  100. pGraphicsDevice->m_QueryDescs[2] = query_timestamp;
  101. *(pDeviceCtx + 0x90) = pGraphicsDevice + 0x40;
  102. v18 = pGraphicsDevice->pID3D11Device;
  103. query_occlusion = 0i64;
  104. query_occlusion.Query = D3D11_QUERY_OCCLUSION;
  105. if ( v18->lpVtbl->CreateQuery(v18, &query_occlusion, &pGraphicsDevice->m_pOcclusion) >= 0 )
  106. {
  107. LOBYTE(pGraphicsDevice[1].iScreenWidth) = 0;
  108. *&pGraphicsDevice[1]._0x0080[8] = 0;
  109. query_occlusion = 0i64;
  110. v19 = 0i64;
  111. while ( 1 )
  112. {
  113. v20 = pGraphicsDevice->pID3D11Device;
  114. query_occlusion = D3D11_QUERY_TIMESTAMP_DISJOINT;
  115. if ( v20->lpVtbl->CreateQuery(v20, &query_occlusion, &pGraphicsDevice[1]._0x0048[8 * v19 + 0x18]) < 0 )
  116. break;
  117. v21 = pGraphicsDevice->pID3D11Device;
  118. query_occlusion.Query = D3D11_QUERY_TIMESTAMP;
  119. if ( v21->lpVtbl->CreateQuery(v21, &query_occlusion, &pGraphicsDevice[1].flScreenHz + v19) < 0 )
  120. break;
  121. v22 = pGraphicsDevice->pID3D11Device;
  122. query_occlusion.Query = D3D11_QUERY_TIMESTAMP;
  123. if ( v22->lpVtbl->CreateQuery(v22, &query_occlusion, &pGraphicsDevice[1].hWnd + v19) < 0 )
  124. break;
  125. v19 = (v19 + 1);
  126. if ( v19 >= 5 )
  127. {
  128. pGraphicsDevice->_0x0108 = *(pDeviceCtx + 8);
  129. *(pDeviceCtx + 0x578) = pGraphicsDevice->pID3D11Device;
  130. **&Rect.left = pDeviceCtx;
  131. *&pGraphicsDevice->_0x0080[88] = *(pInfo + 40);
  132. *&pGraphicsDevice->_0x0080[80] = *(pInfo + 16);
  133. *&pGraphicsDevice->_0x0080[72] = *(pInfo + 48);
  134. GetClientRect(hWnd, &Rect);
  135. v23 = Rect.right - Rect.left;
  136. v24 = Rect.bottom - Rect.top;
  137. if ( !sub_140E59E60() )
  138. sub_140E99C50(pGraphicsDevice, hWnd, v23, v24);
  139. pGraphicsDevice->m_QueryDescs[0].Query = v23;
  140. pGraphicsDevice->m_QueryDescs[0].MiscFlags = v24;
  141. pGraphicsDevice->hWnd = hWnd;
  142. pGraphicsDevice->isWindowed = 1;
  143. *(&pGraphicsDevice->m_uAdapterCount + 1) = 1;
  144. return 1i64;
  145. }
  146. }
  147. }
  148. msg = &unk_141AB2D10;
  149. }
  150. else
  151. {
  152. msg = aCgraphicdevice_15;
  153. }
  154. }
  155. else
  156. {
  157. msg = aCgraphicdevice_16;
  158. }
  159. }
  160. else
  161. {
  162. msg = &unk_141AB2C28;
  163. }
  164. FailureMessage(5409466968i64, msg);
  165. (**pDeviceCtx)(pDeviceCtx, 1i64);
  166. return 0i64;
  167. }
Add Comment
Please, Sign In to add comment