mirror of
https://github.com/alex47exe/gse_fork.git
synced 2026-02-03 21:31:18 +01:00
fix return code for CreateInterface()
This commit is contained in:
11
dll/dll.cpp
11
dll/dll.cpp
@@ -1358,10 +1358,13 @@ STEAMCLIENT_API void* CreateInterface( const char *pName, int *pReturnCode )
|
||||
{
|
||||
PRINT_DEBUG("%s %p", pName, pReturnCode);
|
||||
auto ptr = create_client_interface(pName);
|
||||
if (ptr) {
|
||||
if (pReturnCode) *pReturnCode = 1;
|
||||
} else {
|
||||
if (pReturnCode) *pReturnCode = 0;
|
||||
if (pReturnCode) {
|
||||
// https://github.com/ValveSoftware/source-sdk-2013/blob/57a8b644af418c691f1fba45791019cf2367dedd/src/public/tier1/interface.h#L156-L160
|
||||
if (ptr) {
|
||||
*pReturnCode = 0; // IFACE_OK
|
||||
} else {
|
||||
*pReturnCode = 1; // IFACE_FAILED
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
@@ -14,22 +14,23 @@ extern "C" __declspec( dllexport ) void* __cdecl CreateInterface( const char *p
|
||||
|
||||
auto steam_api = LoadLibraryA(DLL_NAME);
|
||||
if (!steam_api) {
|
||||
if (pReturnCode) *pReturnCode = 0;
|
||||
if (pReturnCode) *pReturnCode = 1; // IFACE_FAILED
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto create_interface = (fn_create_interface_t)GetProcAddress(steam_api, "SteamInternal_CreateInterface");
|
||||
// https://github.com/ValveSoftware/source-sdk-2013/blob/57a8b644af418c691f1fba45791019cf2367dedd/src/public/tier1/interface.h#L156-L160
|
||||
if (!create_interface) {
|
||||
if (pReturnCode) *pReturnCode = 0;
|
||||
if (pReturnCode) *pReturnCode = 1; // IFACE_FAILED
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto ptr = create_interface(pName);
|
||||
if (pReturnCode) {
|
||||
if (ptr) {
|
||||
*pReturnCode = 1;
|
||||
*pReturnCode = 0; // IFACE_OK
|
||||
} else {
|
||||
*pReturnCode = 0;
|
||||
*pReturnCode = 1; // IFACE_FAILED
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user