forked from samjviana/souls_vision
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil.cpp
More file actions
46 lines (33 loc) · 1.16 KB
/
Copy pathutil.cpp
File metadata and controls
46 lines (33 loc) · 1.16 KB
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
//
// Created by PC-SAMUEL on 25/11/2024.
//
#include "util.h"
namespace souls_vision {
D3D12_GPU_DESCRIPTOR_HANDLE GetGpuDescriptorHandle(D3D12_GPU_DESCRIPTOR_HANDLE srvHeapStart, SIZE_T descriptorIncrementSize, int index) {
D3D12_GPU_DESCRIPTOR_HANDLE handle = {};
handle.ptr = srvHeapStart.ptr + descriptorIncrementSize * index;
return handle;
}
BOOL CALLBACK EnumResourceNamesA(HMODULE hModule, LPCSTR lpType, LPSTR lpName, LONG_PTR lParam) {
if (!IS_INTRESOURCE(lpName)) {
return TRUE;
}
int resourceID = LOWORD(reinterpret_cast<ULONG_PTR>(lpName));
const int MIN_PNG_ID = 201;
const int MAX_PNG_ID = 299;
if (resourceID >= MIN_PNG_ID && resourceID <= MAX_PNG_ID) {
int* pCount = reinterpret_cast<int*>(lParam);
(*pCount)++;
}
return TRUE;
}
int CountPngResources(HMODULE hModule) {
int resourceCount = 0;
EnumResourceNames(hModule, RT_RCDATA, EnumResourceNamesA, reinterpret_cast<LONG_PTR>(&resourceCount));
return resourceCount;
}
bool ModuleExists(const std::string& moduleName) {
HMODULE hModule = GetModuleHandleA(moduleName.c_str());
return hModule != nullptr;
}
} // souls_vision