-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.h
604 lines (530 loc) · 23.2 KB
/
main.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
// Variables
bool firstTime = true;
bool createdepthstencil = true;
UINT vps = 1;
D3D11_VIEWPORT viewport;
float ScreenCenterX;
float ScreenCenterY;
// D3D Objects
ID3D11Texture2D* texGreen = nullptr;
ID3D11Texture2D* texRed = nullptr;
ID3D11ShaderResourceView* texSRVgreen;
ID3D11ShaderResourceView* texSRVred;
ID3D11SamplerState* pSamplerState;
ID3D11SamplerState* pSamplerState2;
ID3D11RenderTargetView* RenderTargetView = NULL;
ID3D11RenderTargetView* pRTV[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT];
ID3D11DepthStencilView* pDSV;
ID3D11PixelShader* psRed = NULL;
ID3D11PixelShader* psGreen = NULL;
ID3D11Buffer* veBuffer;
UINT Stride;
UINT veBufferOffset;
D3D11_BUFFER_DESC vedesc;
ID3D11Buffer* inBuffer;
DXGI_FORMAT inFormat;
UINT inOffset;
D3D11_BUFFER_DESC indesc;
UINT pscStartSlot;
ID3D11Buffer* pscBuffer;
D3D11_BUFFER_DESC pscdesc;
UINT vscStartSlot;
ID3D11Buffer* vscBuffer;
D3D11_BUFFER_DESC vscdesc;
UINT pssrStartSlot;
ID3D11Resource* Resource;
D3D11_SHADER_RESOURCE_VIEW_DESC Descr;
D3D11_TEXTURE2D_DESC texdesc;
// Menu + Window
void* ReturnAddress;
HWND window = nullptr;
bool ShowMenu = false;
static WNDPROC OriginalWndProcHandler = nullptr;
wchar_t reportValue[256];
#define SAFE_RELEASE(x) if (x) { x->Release(); x = NULL; }
HRESULT hr;
bool greetings = true;
struct propertiesModel
{
UINT stride;
UINT vedesc_ByteWidth;
UINT indesc_ByteWidth;
UINT pscdesc_ByteWidth;
};
// Memory addresses of player func
uintptr_t PlayerNOP;
uintptr_t MountNOP;
uintptr_t RequestLoot;
uintptr_t TakeLoot;
uintptr_t NoCD;
uintptr_t FixTP;
// Player Attribute (Default settings)
int moveSpeedVal = 90000;
int attackSpeedVal = 90000;
int castSpeedVal = 90000;
int mountSpeed = 1200000;
float animationSpeedVal = 1;
float teleportSize = 0.01;
bool speedStart = false;
bool mountSpeedStart = false;
bool autoLootStart = false;
bool animLeftDownOnly = false;
bool playerNopped = false;
bool mountNopped = false;
bool lootingStart = false;
bool teleportStart = false;
#define BUFFER_SIZE 1024
// NOPing instructions for trampoline
#pragma region offsets
BYTE Nop[] = { 0x90, 0x90, 0x90 , 0x90, 0x90, 0x90, 0x90 };
#pragma endregion
#include <fstream>
// Address that we NOP (Player functions)
void NopAddress(PVOID address, int bytes)
{
DWORD d, ds;
VirtualProtect(address, bytes, PAGE_EXECUTE_READWRITE, &d);
memset(address, 0x90, bytes); VirtualProtect(address, bytes, d, &ds);
}
namespace std
{
template<> struct hash<propertiesModel>
{
std::size_t operator()(const propertiesModel& obj) const noexcept
{
std::size_t h1 = std::hash<int>{}(obj.stride);
std::size_t h2 = std::hash<int>{}(obj.vedesc_ByteWidth);
std::size_t h3 = std::hash<int>{}(obj.indesc_ByteWidth);
std::size_t h4 = std::hash<int>{}(obj.pscdesc_ByteWidth);
return (h1 ^ h3 + h4) ^ (h2 << 1);
}
};
}
// Set up console (LOGGER)
void ConsoleSetup()
{
AllocConsole();
FILE* file = nullptr;
SetConsoleTitle("[+] BeeDO Console");
freopen_s(&file, "CONOUT$", "w", stdout);
freopen_s(&file, "CONOUT$", "w", stderr);
freopen_s(&file, "CONIN$", "r", stdin);
}
int g_Index = -1;
std::vector<void*> g_Vector;
void* g_SelectedAddress = NULL;
// Check if the address is legal
bool IsAddressPresent(void* Address)
{
for (auto it = g_Vector.begin(); it != g_Vector.end(); ++it)
{
if (*it == Address)
return true;
}
return false;
}
// D3D11 Shader Initialization
HRESULT GenerateShader(ID3D11Device* pD3DDevice, ID3D11PixelShader** pShader, float r, float g, float b)
{
char szCast[] = "struct VS_OUT"
"{"
" float4 Position : SV_Position;"
" float4 Color : COLOR0;"
"};"
"float4 main( VS_OUT input ) : SV_Target"
"{"
" float4 fake;"
" fake.a = 1.0f;"
" fake.r = %f;"
" fake.g = %f;"
" fake.b = %f;"
" return fake;"
"}";
ID3D10Blob* pBlob;
char szPixelShader[1000];
sprintf_s(szPixelShader, szCast, r, g, b);
ID3DBlob* d3dErrorMsgBlob;
HRESULT hr = D3DCompile(szPixelShader, sizeof(szPixelShader), "shader", NULL, NULL, "main", "ps_4_0", NULL, NULL, &pBlob, &d3dErrorMsgBlob);
if (FAILED(hr))
return hr;
hr = pD3DDevice->CreatePixelShader((DWORD*)pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, pShader);
if (FAILED(hr))
return hr;
return S_OK;
}
UINT stencilRef = 0;
D3D11_DEPTH_STENCIL_DESC origdsd;
ID3D11DepthStencilState* origDepthStencilState = NULL;
enum eDepthState
{
ORIGINAL,
ENABLED,
DISABLED,
READ_NO_WRITE,
NO_READ_NO_WRITE,
ENABLED1,
ENABLED2,
ENABLED3,
ENABLED4,
ENABLED5,
ENABLED6,
ENABLED7,
ENABLED8,
READ_NO_WRITE1,
READ_NO_WRITE2,
READ_NO_WRITE3,
READ_NO_WRITE4,
READ_NO_WRITE5,
READ_NO_WRITE6,
READ_NO_WRITE7,
READ_NO_WRITE8,
_DEPTH_COUNT
};
ID3D11DepthStencilState* myDepthStencilStates[static_cast<int>(eDepthState::_DEPTH_COUNT)];
void SetDepthStencilState(eDepthState aState)
{
pContext->OMSetDepthStencilState(myDepthStencilStates[aState], 1);
}
char* state;
ID3D11RasterizerState* rDEPTHBIASState;
ID3D11RasterizerState* rNORMALState;
ID3D11RasterizerState* rWIREFRAMEState;
ID3D11RasterizerState* rSOLIDState;
#include <string>
#include <fstream>
// Save config file
void SaveCfg()
{
ofstream fout;
fout.close();
}
// Load config file
void LoadCfg()
{
ifstream fin;
string Word = "";
fin.close();
}
// D3D11 Rendering
void CreateRenderTarget()
{
DXGI_SWAP_CHAIN_DESC sd;
SwapChain->GetDesc(&sd);
ID3D11Texture2D* pBackBuffer;
D3D11_RENDER_TARGET_VIEW_DESC render_target_view_desc;
ZeroMemory(&render_target_view_desc, sizeof(render_target_view_desc));
render_target_view_desc.Format = sd.BufferDesc.Format;
render_target_view_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
hr = SwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&pBackBuffer);
hr = pDevice->CreateRenderTargetView(pBackBuffer, &render_target_view_desc, &RenderTargetView);
pBackBuffer->Release();
}
void CleanupRenderTarget()
{
if (nullptr != RenderTargetView)
{
RenderTargetView->Release();
RenderTargetView = nullptr;
}
}
void CreateDepthStencilStates()
{
D3D11_DEPTH_STENCIL_DESC stencilDesc;
stencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
stencilDesc.StencilEnable = true;
stencilDesc.StencilReadMask = 0xFF;
stencilDesc.StencilWriteMask = 0xFF;
stencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
stencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
stencilDesc.DepthEnable = true;
stencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED)]);
stencilDesc.DepthEnable = false;
stencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc, &myDepthStencilStates[static_cast<int>(eDepthState::DISABLED)]);
stencilDesc.DepthEnable = false;
stencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDesc.StencilEnable = false;
stencilDesc.StencilReadMask = UINT8(0xFF);
stencilDesc.StencilWriteMask = 0x0;
pDevice->CreateDepthStencilState(&stencilDesc, &myDepthStencilStates[static_cast<int>(eDepthState::NO_READ_NO_WRITE)]);
stencilDesc.DepthEnable = true;
stencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
stencilDesc.StencilEnable = false;
stencilDesc.StencilReadMask = UINT8(0xFF);
stencilDesc.StencilWriteMask = 0x0;
stencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_EQUAL;
stencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_NEVER;
pDevice->CreateDepthStencilState(&stencilDesc, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc1;
stencilDesc1.DepthFunc = D3D11_COMPARISON_NEVER;
stencilDesc1.StencilEnable = true;
stencilDesc1.StencilReadMask = 0xFF;
stencilDesc1.StencilWriteMask = 0xFF;
stencilDesc1.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc1.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc1.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc1.FrontFace.StencilFunc = D3D11_COMPARISON_NEVER;
stencilDesc1.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc1.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc1.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc1.BackFace.StencilFunc = D3D11_COMPARISON_NEVER;
stencilDesc1.DepthEnable = true;
stencilDesc1.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc1, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED1)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc2;
stencilDesc2.DepthFunc = (D3D11_COMPARISON_FUNC)2;
stencilDesc2.StencilEnable = true;
stencilDesc2.StencilReadMask = 0xFF;
stencilDesc2.StencilWriteMask = 0xFF;
stencilDesc2.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc2.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc2.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc2.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
stencilDesc2.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc2.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc2.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc2.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
stencilDesc2.DepthEnable = true;
stencilDesc2.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc2, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED2)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc3;
stencilDesc3.DepthFunc = (D3D11_COMPARISON_FUNC)3;
stencilDesc3.StencilEnable = true;
stencilDesc3.StencilReadMask = 0xFF;
stencilDesc3.StencilWriteMask = 0xFF;
stencilDesc3.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc3.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc3.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc3.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)3;
stencilDesc3.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc3.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc3.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc3.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)3;
stencilDesc3.DepthEnable = true;
stencilDesc3.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc3, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED3)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc4;
stencilDesc4.DepthFunc = (D3D11_COMPARISON_FUNC)4;
stencilDesc4.StencilEnable = true;
stencilDesc4.StencilReadMask = 0xFF;
stencilDesc4.StencilWriteMask = 0xFF;
stencilDesc4.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc4.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc4.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc4.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)4;
stencilDesc4.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc4.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc4.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc4.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)4;
stencilDesc4.DepthEnable = true;
stencilDesc4.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc4, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED4)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc5;
stencilDesc5.DepthFunc = (D3D11_COMPARISON_FUNC)5;
stencilDesc5.StencilEnable = true;
stencilDesc5.StencilReadMask = 0xFF;
stencilDesc5.StencilWriteMask = 0xFF;
stencilDesc5.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc5.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc5.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc5.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)5;
stencilDesc5.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc5.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc5.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc5.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)5;
stencilDesc5.DepthEnable = true;
stencilDesc5.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc5, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED5)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc6;
stencilDesc6.DepthFunc = (D3D11_COMPARISON_FUNC)6;
stencilDesc6.StencilEnable = true;
stencilDesc6.StencilReadMask = 0xFF;
stencilDesc6.StencilWriteMask = 0xFF;
stencilDesc6.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc6.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc6.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc6.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)6;
stencilDesc6.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc6.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc6.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc6.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)6;
stencilDesc6.DepthEnable = true;
stencilDesc6.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc6, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED6)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc7;
ZeroMemory(&stencilDesc7, sizeof(D3D11_DEPTH_STENCIL_DESC));
stencilDesc7.DepthFunc = (D3D11_COMPARISON_FUNC)7;
stencilDesc7.StencilEnable = true;
stencilDesc7.StencilReadMask = 0xFF;
stencilDesc7.StencilWriteMask = 0xFF;
stencilDesc7.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc7.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc7.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc7.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)7;
stencilDesc7.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc7.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc7.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc7.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)7;
stencilDesc7.DepthEnable = true;
stencilDesc7.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc7, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED7)]);
D3D11_DEPTH_STENCIL_DESC stencilDesc8;
ZeroMemory(&stencilDesc8, sizeof(D3D11_DEPTH_STENCIL_DESC));
stencilDesc8.DepthFunc = (D3D11_COMPARISON_FUNC)8;
stencilDesc8.StencilEnable = true;
stencilDesc8.StencilReadMask = 0xFF;
stencilDesc8.StencilWriteMask = 0xFF;
stencilDesc8.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc8.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
stencilDesc8.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc8.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)8;
stencilDesc8.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
stencilDesc8.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
stencilDesc8.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDesc8.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)8;
stencilDesc8.DepthEnable = true;
stencilDesc8.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
pDevice->CreateDepthStencilState(&stencilDesc8, &myDepthStencilStates[static_cast<int>(eDepthState::ENABLED8)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW1;
stencilDescRNW1.DepthEnable = true;
stencilDescRNW1.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW1.DepthFunc = D3D11_COMPARISON_NEVER;
stencilDescRNW1.StencilEnable = false;
stencilDescRNW1.StencilReadMask = UINT8(0xFF);
stencilDescRNW1.StencilWriteMask = 0x0;
stencilDescRNW1.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW1.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW1.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW1.FrontFace.StencilFunc = D3D11_COMPARISON_NEVER;
stencilDescRNW1.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW1.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW1.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW1.BackFace.StencilFunc = D3D11_COMPARISON_NEVER;
pDevice->CreateDepthStencilState(&stencilDescRNW1, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE1)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW2;
stencilDescRNW2.DepthEnable = true;
stencilDescRNW2.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW2.DepthFunc = (D3D11_COMPARISON_FUNC)2;
stencilDescRNW2.StencilEnable = false;
stencilDescRNW2.StencilReadMask = UINT8(0xFF);
stencilDescRNW2.StencilWriteMask = 0x0;
stencilDescRNW2.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW2.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW2.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW2.FrontFace.StencilFunc = D3D11_COMPARISON_EQUAL;
stencilDescRNW2.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW2.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW2.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW2.BackFace.StencilFunc = D3D11_COMPARISON_NEVER;
pDevice->CreateDepthStencilState(&stencilDescRNW2, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE2)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW3;
stencilDescRNW3.DepthEnable = true;
stencilDescRNW3.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW3.DepthFunc = (D3D11_COMPARISON_FUNC)3;
stencilDescRNW3.StencilEnable = false;
stencilDescRNW3.StencilReadMask = UINT8(0xFF);
stencilDescRNW3.StencilWriteMask = 0x0;
stencilDescRNW3.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW3.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW3.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW3.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)3;
stencilDescRNW3.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW3.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW3.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW3.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)3;
pDevice->CreateDepthStencilState(&stencilDescRNW3, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE3)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW4;
stencilDescRNW4.DepthEnable = true;
stencilDescRNW4.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW4.DepthFunc = (D3D11_COMPARISON_FUNC)4;
stencilDescRNW4.StencilEnable = false;
stencilDescRNW4.StencilReadMask = UINT8(0xFF);
stencilDescRNW4.StencilWriteMask = 0x0;
stencilDescRNW4.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW4.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW4.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW4.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)4;
stencilDescRNW4.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW4.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW4.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW4.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)4;
pDevice->CreateDepthStencilState(&stencilDescRNW4, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE4)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW5;
stencilDescRNW5.DepthEnable = true;
stencilDescRNW5.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW5.DepthFunc = (D3D11_COMPARISON_FUNC)5;
stencilDescRNW5.StencilEnable = false;
stencilDescRNW5.StencilReadMask = UINT8(0xFF);
stencilDescRNW5.StencilWriteMask = 0x0;
stencilDescRNW5.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW5.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW5.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW5.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)5;
stencilDescRNW5.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW5.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW5.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW5.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)5;
pDevice->CreateDepthStencilState(&stencilDescRNW5, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE5)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW6;
stencilDescRNW6.DepthEnable = true;
stencilDescRNW6.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW6.DepthFunc = (D3D11_COMPARISON_FUNC)6;
stencilDescRNW6.StencilEnable = false;
stencilDescRNW6.StencilReadMask = UINT8(0xFF);
stencilDescRNW6.StencilWriteMask = 0x0;
stencilDescRNW6.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW6.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW6.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW6.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)6;
stencilDescRNW6.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW6.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW6.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW6.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)6;
pDevice->CreateDepthStencilState(&stencilDescRNW6, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE6)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW7;
stencilDescRNW7.DepthEnable = true;
stencilDescRNW7.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW7.DepthFunc = (D3D11_COMPARISON_FUNC)7;
stencilDescRNW7.StencilEnable = false;
stencilDescRNW7.StencilReadMask = UINT8(0xFF);
stencilDescRNW7.StencilWriteMask = 0x0;
stencilDescRNW7.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW7.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW7.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW7.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)7;
stencilDescRNW7.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW7.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW7.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW7.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)7;
pDevice->CreateDepthStencilState(&stencilDescRNW7, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE7)]);
D3D11_DEPTH_STENCIL_DESC stencilDescRNW8;
stencilDescRNW8.DepthEnable = true;
stencilDescRNW8.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
stencilDescRNW8.DepthFunc = (D3D11_COMPARISON_FUNC)8;
stencilDescRNW8.StencilEnable = false;
stencilDescRNW8.StencilReadMask = UINT8(0xFF);
stencilDescRNW8.StencilWriteMask = 0x0;
stencilDescRNW8.FrontFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW8.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW8.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
stencilDescRNW8.FrontFace.StencilFunc = (D3D11_COMPARISON_FUNC)8;
stencilDescRNW8.BackFace.StencilFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW8.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW8.BackFace.StencilPassOp = D3D11_STENCIL_OP_ZERO;
stencilDescRNW8.BackFace.StencilFunc = (D3D11_COMPARISON_FUNC)8;
pDevice->CreateDepthStencilState(&stencilDescRNW8, &myDepthStencilStates[static_cast<int>(eDepthState::READ_NO_WRITE8)]);
}