mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-08-05 07:05:34 +02:00
Merge pull request #317 from otavepto/patch/itf-code
Fix return code for `CreateInterface()`
This commit is contained in:
commit
6fb99e9d6a
2 changed files with 12 additions and 8 deletions
|
@ -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 (pReturnCode) {
|
||||
// https://github.com/ValveSoftware/source-sdk-2013/blob/57a8b644af418c691f1fba45791019cf2367dedd/src/public/tier1/interface.h#L156-L160
|
||||
if (ptr) {
|
||||
if (pReturnCode) *pReturnCode = 1;
|
||||
*pReturnCode = 0; // IFACE_OK
|
||||
} else {
|
||||
if (pReturnCode) *pReturnCode = 0;
|
||||
*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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue