Skip to content

Commit

Permalink
Fixed only R1 available in SOC game settings if R2 is missing (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xottab-DUTY committed Apr 3, 2022
1 parent f77babc commit 9bd6d2b
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions src/xrEngine/EngineAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ extern xr_vector<xr_token> VidQualityToken;
constexpr pcstr GET_RENDERER_MODULE_FUNC = "GetRendererModule";

constexpr pcstr r1_library = "xrRender_R1";
constexpr pcstr r2_library = "xrRender_R2";
constexpr pcstr gl_library = "xrRender_GL";

constexpr pcstr RENDER_LIBRARIES[] =
{
#if defined(XR_PLATFORM_WINDOWS)
r1_library,
r2_library,
"xrRender_R2",
"xrRender_R4",
#endif
gl_library
Expand Down Expand Up @@ -214,15 +213,9 @@ void CEngineAPI::CreateRendererList()
{
for (pcstr library : RENDER_LIBRARIES)
{
loadLibrary(library);
if (loadLibrary(library) && library != r1_library)
r2_available = true;
}

const auto it = std::find_if(renderers.begin(), renderers.end(), [](const RendererDesc& desc)
{
return desc.libraryName == r2_library;
});
if (it != renderers.end())
r2_available = true;
}

int modeIndex{};
Expand Down Expand Up @@ -280,16 +273,11 @@ void CEngineAPI::CreateRendererList()
modes.emplace_back(nullptr, -1);
}

bool is_r2_available()
{
return r2_available;
}

SCRIPT_EXPORT(CheckRendererSupport, (),
{
using namespace luabind;
module(luaState)
[
def("xrRender_test_r2_hw", &is_r2_available)
def("xrRender_test_r2_hw", +[](){ return r2_available; })
];
});

0 comments on commit 9bd6d2b

Please sign in to comment.