diff --git a/res/version.h b/res/version.h index 70a62dc..927f342 100644 --- a/res/version.h +++ b/res/version.h @@ -1,14 +1,14 @@ #pragma once -#define VERSION_DATE "2018-10-28" -#define VERSION_TIME "19:44:16" +#define VERSION_DATE "2018-10-30" +#define VERSION_TIME "23:11:46" #define VERSION_BASEYEAR 0 -#define VERSION_FULL 0.0.0.19 +#define VERSION_FULL 0.0.0.20 #define VERSION_MAJOR 0 #define VERSION_MINOR 0 #define VERSION_REVISION 0 -#define VERSION_BUILD 19 +#define VERSION_BUILD 20 -#define VERSION_STRING_FILE "0.0.0.19" +#define VERSION_STRING_FILE "0.0.0.20" #define VERSION_STRING_PRODUCT "0.0.0" diff --git a/source/JWEMSingleton.h b/source/JWEMSingleton.h index f388c2f..4542077 100644 --- a/source/JWEMSingleton.h +++ b/source/JWEMSingleton.h @@ -129,7 +129,13 @@ class Singleton { }; + std::map> crcToPixelshader = { + }; + + std::map, uint32_t> crcToShaderResourceView = { + + }; //make this a map? std::vector> DinoTexList; @@ -171,6 +177,11 @@ class Singleton { ULONG LoadedTextureRef = 0; bool DisableReshade = false; + bool RecordShaderResourceViews = false; + + bool RenderTargetCleared = false; + int FoundViewCount = 0; + int frame = 0; //-- long long lastPresentDuration = 0; @@ -178,6 +189,13 @@ class Singleton { ID3D11DeviceContext * singleContext; ID3D11Device * originalDevice; + com_ptr< ID3D11PixelShader> lastCreatedPixelShader; + uint32_t setShader; + com_ptr< ID3D11PixelShader> lastSetPixelShader; + + ID3D11RenderTargetView * lastRenderTarget = nullptr; + ID3D11RenderTargetView * foundRenderTarget = nullptr; + //bool FoundRenderTarget; bool savingImage = false; const DWORD texFlags = DirectX::DDS_FLAGS_NONE; @@ -260,6 +278,18 @@ class Singleton { return filename; } + void CheckShaderResource(ID3D11Resource *pResource) + { + for (int i = 0; i < DinoTexList.size(); i++) + { + auto checkPointer = DinoTexList[i].get(); + if (pResource == checkPointer) + { + LOG(DEBUG) << "Duplicate dino found for crc: " << DinoCrcList[i]; //TESTING + } + } + } + void ReloadDiscoveredTextures() { std::ifstream crcFile(DLLDirectory + "\\FULLCRC_LIST.txt"); @@ -419,9 +449,209 @@ class Singleton { } + foundRenderTarget = nullptr; + } + + //taken from NinjaRipper + //https://github.com/riccochicco/ninjaripper + void ScanShaders() + { + HRESULT hr; + auto shaderSize = D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT; + + ID3D11ShaderResourceView * ShaderRes[D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT] = {}; + //Init with NULL + for (size_t i = 0; i < shaderSize; i++) { + ShaderRes[i] = NULL; + } + + singleContext->PSGetShaderResources(0, shaderSize, &ShaderRes[0]); + + for (size_t i = 0; i < sizeof(ShaderRes); i++) { + + ID3D11ShaderResourceView* pShaderResView = ShaderRes[i]; + if (pShaderResView) { + //Check resource type for "Texture" + D3D11_SHADER_RESOURCE_VIEW_DESC Descr; + pShaderResView->GetDesc(&Descr); + if ( + (Descr.ViewDimension == D3D11_SRV_DIMENSION_BUFFER) || + (Descr.ViewDimension == D3D11_SRV_DIMENSION_BUFFEREX) + ) { + continue;//Skip buffer resources + } + } + else + { + continue; + } + D3D11_TEXTURE2D_DESC TexDescr; + D3D11_SHADER_RESOURCE_VIEW_DESC Descr; + + + pShaderResView->GetDesc(&Descr); + if (Descr.ViewDimension != D3D11_SRV_DIMENSION_TEXTURE2D) + { + return; + } + + com_ptr pSrcResourceRef; + //Get ID3D11Resource* from ID3D11ShaderResourceView* + pShaderResView->GetResource(&pSrcResourceRef); + + //Cast ID3D11Resource* to ID3D11Texture2D* + ID3D11Texture2D* pSrcTexture = NULL; + pSrcTexture = static_cast (pSrcResourceRef.get()); + // Check pointer for NULL + pSrcTexture->GetDesc(&TexDescr); + + if (TexDescr.Format == DXGI_FORMAT::DXGI_FORMAT_BC7_UNORM_SRGB) + { + LOG(DEBUG) << "Found possible albedo texture"; + } + } + } + + void ProcessShaderResourceView(ID3D11ShaderResourceView* pShaderResView) + { + LOG(DEBUG) << "ProcessShaderResourceView"; + + //ID3D11ShaderResourceView* pShaderResView = ShaderRes[i]; + D3D11_SHADER_RESOURCE_VIEW_DESC Descr; + if (pShaderResView) { + //Check resource type for "Texture" + pShaderResView->GetDesc(&Descr); + if ( + (Descr.ViewDimension == D3D11_SRV_DIMENSION_BUFFER) || + (Descr.ViewDimension == D3D11_SRV_DIMENSION_BUFFEREX) + ) + { + return; + } + } + else + { + return; + } + D3D11_TEXTURE2D_DESC TexDescr; + //D3D11_SHADER_RESOURCE_VIEW_DESC Descr; + + //pShaderResView->GetDesc(&Descr); + if (Descr.ViewDimension != D3D11_SRV_DIMENSION_TEXTURE2D && Descr.ViewDimension != D3D11_SRV_DIMENSION_TEXTURE2DARRAY) + { + return; + } + + com_ptr pSrcResourceRef; + //Get ID3D11Resource* from ID3D11ShaderResourceView* + /* + if (Descr.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2DARRAY) + { + + } + else if (Descr.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D) + { + + } + */ + pShaderResView->GetResource(&pSrcResourceRef); + + //Cast ID3D11Resource* to ID3D11Texture2D* + ID3D11Texture2D* pSrcTexture = NULL; + pSrcTexture = static_cast (pSrcResourceRef.get()); + // Check pointer for NULL + pSrcTexture->GetDesc(&TexDescr); + + if (TexDescr.Height >= RecordTextureCutoffSize + && TexDescr.Width >= RecordTextureCutoffSize + //&& pDesc->Height == 1024 + //&& pDesc->Width == 1024 + && (TexDescr.Format == DXGI_FORMAT::DXGI_FORMAT_BC7_UNORM_SRGB + || TexDescr.Format == DXGI_FORMAT::DXGI_FORMAT_BC5_UNORM + || TexDescr.Format == DXGI_FORMAT::DXGI_FORMAT_BC7_UNORM + || TexDescr.Format == DXGI_FORMAT::DXGI_FORMAT_BC1_TYPELESS) + ) + { + PrintDescription(TexDescr); + + ptrdiff_t pos = find(DinoTexList.begin(), DinoTexList.end(), pSrcTexture) - DinoTexList.begin(); + if (pos < DinoTexList.size()) + { + auto crc = DinoCrcList[pos]; + LOG(INFO) << "Found Crc for ID3D11ShaderResourceView: " << crc; + crcToShaderResourceView.insert(std::pair, uint32_t>(pShaderResView, crc)); + } + + } + + //LastCrcCheckCreatedResource + //uint32_t crc = CrcInitialData(pSrcTexture, TexDescr.Width * TexDescr.Height); + + /* + std::vector::iterator it = std::find(crcListCrc.begin(), crcListCrc.end(), crc); + if (it != crcListCrc.end()) + { + LOG(INFO) << "Found Crc for ID3D11ShaderResourceView: " << crc; + crcToShaderResourceView.insert(std::pair, uint32_t>(pShaderResView, crc)); + } + */ } + + void SaveResourceAsDDS(ID3D11Resource * pSrcTexture) + { + DirectX::ScratchImage image; + HRESULT hr = DirectX::CaptureTexture(originalDevice, singleContext, pSrcTexture, image); + //singleton_mutex.unlock(); + + if (SUCCEEDED(hr)) + { + LOG(DEBUG) << "Saving to memory.."; + + + PrintMetadata(image.GetMetadata()); + + //auto crc = GetDebugInitialCrcList()[texIdToSave]; + + std::stringstream ss; + /* + if (CrcAsName) + { + ss << saveTextureDirectory << "\\" << texIdToSave << "_" << crc << "_.dds"; + } + else + { + ss << saveTextureDirectory << "\\" << std::to_string(texIdToSave) << ".dds"; + } + */ + ss << saveTextureDirectory << "\\" << image.GetMetadata().width << "-" << image.GetMetadata().height << ".dds"; + std::string dir = ss.str(); + std::wstring widestr = std::wstring(dir.begin(), dir.end()); + const wchar_t* cdar = widestr.c_str(); + + LOG(DEBUG) << "Filename: " << cdar; + + LOG(DEBUG) << "SaveToDDSFile..."; + hr = SaveToDDSFile(image.GetImages(), image.GetImageCount(), image.GetMetadata(), + DirectX::DDS_FLAGS_NONE, cdar); + + + if (FAILED(hr)) + { + LOG(WARNING) << "Could not SaveToDDSFile"; + } + else + { + LOG(WARNING) << "Save Complete?"; + } + } + else + { + LOG(WARNING) << "Could not CaptureTexture"; + } + } + void ProcessJWEMS(std::string filename) { @@ -591,7 +821,9 @@ class Singleton { { DinoTexList.push_back(tex); DinoCrcList.push_back(initialCrc); + crcToPixelshader.insert(std::pair>(initialCrc, lastCreatedPixelShader)); } + /* std::map::iterator it = crcTextureName.find(initialCrc); if (it != crcTextureName.end()) @@ -609,6 +841,74 @@ class Singleton { return false; } + + void CheckSetShader(com_ptr shader) + { + if (shader != nullptr) + lastSetPixelShader = shader; + } + void CheckPSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView *const *ppShaderResourceViews) + { + //LOG(DEBUG) << "CheckPSSetShaderResources"; + + if (!RecordShaderResourceViews) + return; + + if (foundRenderTarget != nullptr && foundRenderTarget != lastRenderTarget) + return; + + + if (RenderTargetCleared) + { + FoundViewCount = 0; + RenderTargetCleared = false; + } + + + for (int i = 0; i < NumViews; i++) + { + std::map, uint32_t>::iterator it = crcToShaderResourceView.find(ppShaderResourceViews[i]); + if (it != crcToShaderResourceView.end()) + { + //if (foundRenderTarget == nullptr) + // foundRenderTarget = lastRenderTarget; + + LOG(DEBUG) << "-CheckPSSetShaderResources- "; + if (lastSetPixelShader != nullptr) + LOG(DEBUG) << "PixelShader: " << lastSetPixelShader.get(); + LOG(DEBUG) << ". frame: " << frame << ". FoundViewCount: " << FoundViewCount + << ". lastRenderTarget: " << lastRenderTarget + << "Loading texture into " << it->first.get() << " - " << it->second; + + } + } + + FoundViewCount++; + } + void CheckClearRenderTargetView(ID3D11RenderTargetView *pRenderTargetView) + { + lastRenderTarget = pRenderTargetView; + RenderTargetCleared = true; + //LOG(DEBUG) << "CheckClearRenderTargetView: " << pRenderTargetView; //TESTING + } + void CheckCopyResource(com_ptr source) + { + return; + if (source == nullptr) + return; + + ID3D11Texture2D* pSrcTexture = NULL; + pSrcTexture = static_cast (source.get()); + + ptrdiff_t pos = find(DinoTexList.begin(), DinoTexList.end(), pSrcTexture) - DinoTexList.begin(); + if (pos < DinoTexList.size()) + { + LOG(DEBUG) << "CheckCopyResource- " << source.get() << " Was copied!"; + //old_name_ not found + } + //DinoTexList + } + std::vector> GetDinoTexList() { mtx.lock(); diff --git a/source/d3d11/d3d11_device.cpp b/source/d3d11/d3d11_device.cpp index 280ecae..9afde65 100644 --- a/source/d3d11/d3d11_device.cpp +++ b/source/d3d11/d3d11_device.cpp @@ -204,6 +204,8 @@ ULONG STDMETHODCALLTYPE D3D11Device::Release() } HRESULT STDMETHODCALLTYPE D3D11Device::CreateBuffer(const D3D11_BUFFER_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Buffer **ppBuffer) { + //if (Singleton::getInstance()->MonitorTextures) + // LOG(DEBUG) << "CreateBuffer"; //TESTING return _orig->CreateBuffer(pDesc, pInitialData, ppBuffer); } HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture1D(const D3D11_TEXTURE1D_DESC *pDesc, const D3D11_SUBRESOURCE_DATA *pInitialData, ID3D11Texture1D **ppTexture1D) @@ -214,6 +216,8 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture2D(const D3D11_TEXTURE2D_DES { //d_mutex.lock(); + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "CreateTexture2D"; //TESTING Singleton * JWEmSingleton = Singleton::getInstance(); JWEmSingleton->singleContext = _immediate_context; @@ -301,7 +305,15 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateTexture3D(const D3D11_TEXTURE3D_DES } HRESULT STDMETHODCALLTYPE D3D11Device::CreateShaderResourceView(ID3D11Resource *pResource, const D3D11_SHADER_RESOURCE_VIEW_DESC *pDesc, ID3D11ShaderResourceView **ppSRView) { - return _orig->CreateShaderResourceView(pResource, pDesc, ppSRView); + if (Singleton::getInstance()->RecordShaderResourceViews) + LOG(DEBUG) << "CreateShaderResourceView"; //TESTING + + auto result = _orig->CreateShaderResourceView(pResource, pDesc, ppSRView); + + if (Singleton::getInstance()->RecordShaderResourceViews)//SaveResourceAsDDS + Singleton::getInstance()->ProcessShaderResourceView(*ppSRView); + + return result; } HRESULT STDMETHODCALLTYPE D3D11Device::CreateUnorderedAccessView(ID3D11Resource *pResource, const D3D11_UNORDERED_ACCESS_VIEW_DESC *pDesc, ID3D11UnorderedAccessView **ppUAView) { @@ -309,6 +321,8 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateUnorderedAccessView(ID3D11Resource } HRESULT STDMETHODCALLTYPE D3D11Device::CreateRenderTargetView(ID3D11Resource *pResource, const D3D11_RENDER_TARGET_VIEW_DESC *pDesc, ID3D11RenderTargetView **ppRTView) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "CreateRenderTargetView"; //TESTING return _orig->CreateRenderTargetView(pResource, pDesc, ppRTView); } HRESULT STDMETHODCALLTYPE D3D11Device::CreateDepthStencilView(ID3D11Resource *pResource, const D3D11_DEPTH_STENCIL_VIEW_DESC *pDesc, ID3D11DepthStencilView **ppDepthStencilView) @@ -321,10 +335,12 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateInputLayout(const D3D11_INPUT_ELEME } HRESULT STDMETHODCALLTYPE D3D11Device::CreateVertexShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11VertexShader **ppVertexShader) { + LOG(DEBUG) << "CreateVertexShader"; //TESTING return _orig->CreateVertexShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader); } HRESULT STDMETHODCALLTYPE D3D11Device::CreateGeometryShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11GeometryShader **ppGeometryShader) { + LOG(DEBUG) << "CreateGeometryShader"; //TESTING return _orig->CreateGeometryShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader); } HRESULT STDMETHODCALLTYPE D3D11Device::CreateGeometryShaderWithStreamOutput(const void *pShaderBytecode, SIZE_T BytecodeLength, const D3D11_SO_DECLARATION_ENTRY *pSODeclaration, UINT NumEntries, const UINT *pBufferStrides, UINT NumStrides, UINT RasterizedStream, ID3D11ClassLinkage *pClassLinkage, ID3D11GeometryShader **ppGeometryShader) @@ -333,7 +349,10 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateGeometryShaderWithStreamOutput(cons } HRESULT STDMETHODCALLTYPE D3D11Device::CreatePixelShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11PixelShader **ppPixelShader) { - return _orig->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader); + LOG(DEBUG) << "CreatePixelShader"; //TESTING + auto result = _orig->CreatePixelShader(pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader); + Singleton::getInstance()->lastCreatedPixelShader = *ppPixelShader; + return result; } HRESULT STDMETHODCALLTYPE D3D11Device::CreateHullShader(const void *pShaderBytecode, SIZE_T BytecodeLength, ID3D11ClassLinkage *pClassLinkage, ID3D11HullShader **ppHullShader) { @@ -365,6 +384,8 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateRasterizerState(const D3D11_RASTERI } HRESULT STDMETHODCALLTYPE D3D11Device::CreateSamplerState(const D3D11_SAMPLER_DESC *pSamplerDesc, ID3D11SamplerState **ppSamplerState) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "CreateSamplerState"; //TESTING return _orig->CreateSamplerState(pSamplerDesc, ppSamplerState); } HRESULT STDMETHODCALLTYPE D3D11Device::CreateQuery(const D3D11_QUERY_DESC *pQueryDesc, ID3D11Query **ppQuery) @@ -407,6 +428,9 @@ HRESULT STDMETHODCALLTYPE D3D11Device::CreateDeferredContext(UINT ContextFlags, } HRESULT STDMETHODCALLTYPE D3D11Device::OpenSharedResource(HANDLE hResource, REFIID ReturnedInterface, void **ppResource) { + + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "OpenSharedResource"; //TESTING return _orig->OpenSharedResource(hResource, ReturnedInterface, ppResource); } HRESULT STDMETHODCALLTYPE D3D11Device::CheckFormatSupport(DXGI_FORMAT Format, UINT *pFormatSupport) diff --git a/source/d3d11/d3d11_device_context.cpp b/source/d3d11/d3d11_device_context.cpp index 992819f..25e27f4 100644 --- a/source/d3d11/d3d11_device_context.cpp +++ b/source/d3d11/d3d11_device_context.cpp @@ -6,6 +6,7 @@ #include "log.hpp" #include "d3d11_device.hpp" #include "d3d11_device_context.hpp" +#include "JWEMSingleton.h" void D3D11DeviceContext::clear_drawcall_stats() { @@ -250,10 +251,15 @@ void STDMETHODCALLTYPE D3D11DeviceContext::VSSetConstantBuffers(UINT StartSlot, } void STDMETHODCALLTYPE D3D11DeviceContext::PSSetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView *const *ppShaderResourceViews) { + Singleton::getInstance()->CheckPSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); _orig->PSSetShaderResources(StartSlot, NumViews, ppShaderResourceViews); + return; } void STDMETHODCALLTYPE D3D11DeviceContext::PSSetShader(ID3D11PixelShader *pPixelShader, ID3D11ClassInstance *const *ppClassInstances, UINT NumClassInstances) { + if (Singleton::getInstance()->MonitorTextures) + Singleton::getInstance()->CheckSetShader(pPixelShader); + _orig->PSSetShader(pPixelShader, ppClassInstances, NumClassInstances); } void STDMETHODCALLTYPE D3D11DeviceContext::PSSetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState *const *ppSamplers) @@ -423,10 +429,15 @@ void STDMETHODCALLTYPE D3D11DeviceContext::CopySubresourceRegion(ID3D11Resource } void STDMETHODCALLTYPE D3D11DeviceContext::CopyResource(ID3D11Resource *pDstResource, ID3D11Resource *pSrcResource) { + if (Singleton::getInstance()->MonitorTextures) + Singleton::getInstance()->CheckCopyResource(pSrcResource); + _orig->CopyResource(pDstResource, pSrcResource); } void STDMETHODCALLTYPE D3D11DeviceContext::UpdateSubresource(ID3D11Resource *pDstResource, UINT DstSubresource, const D3D11_BOX *pDstBox, const void *pSrcData, UINT SrcRowPitch, UINT SrcDepthPitch) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "UpdateSubresource"; //TESTING _orig->UpdateSubresource(pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch); } void STDMETHODCALLTYPE D3D11DeviceContext::CopyStructureCount(ID3D11Buffer *pDstBuffer, UINT DstAlignedByteOffset, ID3D11UnorderedAccessView *pSrcView) @@ -435,6 +446,8 @@ void STDMETHODCALLTYPE D3D11DeviceContext::CopyStructureCount(ID3D11Buffer *pDst } void STDMETHODCALLTYPE D3D11DeviceContext::ClearRenderTargetView(ID3D11RenderTargetView *pRenderTargetView, const FLOAT ColorRGBA[4]) { + if (Singleton::getInstance()->RecordShaderResourceViews) + Singleton::getInstance()->CheckClearRenderTargetView(pRenderTargetView); _orig->ClearRenderTargetView(pRenderTargetView, ColorRGBA); } void STDMETHODCALLTYPE D3D11DeviceContext::ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView *pUnorderedAccessView, const UINT Values[4]) @@ -535,10 +548,14 @@ void STDMETHODCALLTYPE D3D11DeviceContext::VSGetConstantBuffers(UINT StartSlot, } void STDMETHODCALLTYPE D3D11DeviceContext::PSGetShaderResources(UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView **ppShaderResourceViews) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "PSGetShaderResources"; //TESTING _orig->PSGetShaderResources(StartSlot, NumViews, ppShaderResourceViews); } void STDMETHODCALLTYPE D3D11DeviceContext::PSGetShader(ID3D11PixelShader **ppPixelShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "PSGetShader"; //TESTING _orig->PSGetShader(ppPixelShader, ppClassInstances, pNumClassInstances); } void STDMETHODCALLTYPE D3D11DeviceContext::PSGetSamplers(UINT StartSlot, UINT NumSamplers, ID3D11SamplerState **ppSamplers) @@ -547,6 +564,8 @@ void STDMETHODCALLTYPE D3D11DeviceContext::PSGetSamplers(UINT StartSlot, UINT Nu } void STDMETHODCALLTYPE D3D11DeviceContext::VSGetShader(ID3D11VertexShader **ppVertexShader, ID3D11ClassInstance **ppClassInstances, UINT *pNumClassInstances) { + if (Singleton::getInstance()->MonitorTextures) + LOG(DEBUG) << "VSGetShader"; //TESTING _orig->VSGetShader(ppVertexShader, ppClassInstances, pNumClassInstances); } void STDMETHODCALLTYPE D3D11DeviceContext::PSGetConstantBuffers(UINT StartSlot, UINT NumBuffers, ID3D11Buffer **ppConstantBuffers) diff --git a/source/gui.cpp b/source/gui.cpp index 606b074..f68bf18 100644 --- a/source/gui.cpp +++ b/source/gui.cpp @@ -47,6 +47,8 @@ namespace reshade void runtime::draw_overlay() { + Singleton::getInstance()->frame++; + const bool show_splash = (_last_present_time - _last_reload_time) < std::chrono::seconds(5); if (!_overlay_key_setting_active && @@ -1089,6 +1091,13 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI //we can only store 1 skin type at a time. Also the pointers are reused every time a new dino is created //CRCs for textures that made a match + /* + int * item_list = new int[JWEmSingleton->DinoCrcList.size()]; + for (int i = 0; i < JWEmSingleton->DinoCrcList.size(); i++) + item_list[i] = 0; + int ComboCount = 0; + */ + static int item_list[128]; for (auto const& dinoTex : JWEmSingleton->DinoCrcList) { crcListId++; @@ -1135,6 +1144,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI std::vector fileNames; auto files = JWEmSingleton->getSkinsForCrc(dinoTex, &fileNames); + if (fileNames.size() > 0) { char ** arr = new char*[fileNames.size()]; @@ -1143,17 +1153,20 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI strcpy(arr[i], fileNames[i].c_str()); } - static int item_current = 0; ImGui::SameLine(); - ImGui::Combo(std::to_string(crcListId).c_str(), &item_current, arr, fileNames.size()); + + //static int item_current = 0; + ImGui::Combo(std::to_string(crcListId).c_str(), &item_list[texCount], arr, fileNames.size()); ImGui::SameLine(); if (ImGui::Button("Load")) { - JWEmSingleton->UpdateDinoTexture(crcListId, files[item_current]); + JWEmSingleton->UpdateDinoTexture(crcListId, files[item_list[texCount]]); LOG(INFO) << "Loaded!"; //LOG(DEBUG) << "Here we would load:" << files[item_current]; } + + //ComboCount++; } @@ -1205,9 +1218,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI } if (ImGui::CollapsingHeader("Misc")) { + ImGui::Checkbox("Record Shader Resource Views", &JWEmSingleton->RecordShaderResourceViews); ImGui::Text("Last Present Duration: "); - ImGui::Text(std::to_string(JWEmSingleton->lastPresentDuration).c_str()); + //ImGui::Text(std::to_string(JWEmSingleton->lastPresentDuration).c_str()); ImGui::Checkbox("Disable ReShade", &JWEmSingleton->DisableReshade); + if (ImGui::Button("Scan Shaders")) + { + JWEmSingleton->ScanShaders(); + } } if (ImGui::CollapsingHeader("Recorded Textures")) {