MCPcopy Create free account
hub / github.com/Rat431/ColdAPI_Steam / ProvideInterface

Function ProvideInterface

src/ColdAPI_Steam/ColdManager.cpp:2456–2542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2454 }
2455 char FormattedMessage[0x9000] = { 0 };
2456 void* ProvideInterface(int type, const char* Version, bool ScanForName)
2457 {
2458 if (ScanForName)
2459 {
2460 // Search interface by name
2461 for (std::vector<InterfaceData>::size_type i = 0; i < PublicInterfaces.size(); i++)
2462 if (std::strcmp(PublicInterfaces[i].key.c_str(), Version) == 0)
2463 return PublicInterfaces[i].datapointer;
2464
2465 // Looks like the interface is not available, warn if the user want it.
2466 if (Steam_Config::InterfaceNFound)
2467 {
2468 // Check if the user choosen to ignore the current interface.
2469 bool Ignore = false;
2470 for (auto iter = IgnoredWInterfacesS.begin(); iter != IgnoredWInterfacesS.end(); ++iter)
2471 {
2472 std::string CInterface = *iter;
2473 if (std::strcmp(CInterface.c_str(), Version) == 0)
2474 {
2475 Ignore = true;
2476 break;
2477 }
2478 }
2479 if (!Ignore) {
2480 std::memset(FormattedMessage, 0, sizeof(FormattedMessage));
2481 std::sprintf(FormattedMessage, "The interface %s couldn't be loaded or it is not available. Do you want to ignore the current interface and try to continue the execution? (Game might crash)", Version);
2482
2483 // Print the message
2484 if (MessageBoxA(NULL, FormattedMessage, "Interface error", MB_ICONWARNING | MB_YESNOCANCEL) == IDYES) {
2485 IgnoredWInterfacesS.push_back(Version);
2486 }
2487 else {
2488 ExitProcess(NULL);
2489 }
2490 }
2491 }
2492 return nullptr;
2493 }
2494 else
2495 {
2496 // Search interface by the enum type
2497 int InVersion = 0;
2498
2499 for (std::vector<InterfaceInfo>::size_type i = 0; i < PublicInterfacesInfo.size(); i++) {
2500 if (PublicInterfacesInfo[i].SteamType == type) {
2501 InVersion = PublicInterfacesInfo[i].Version;
2502 break;
2503 }
2504 }
2505 if (InVersion != 0) {
2506 for (std::vector<InterfaceData>::size_type i = 0; i < PublicInterfaces.size(); i++) {
2507
2508 if (PublicInterfaces[i].SteamType == type && PublicInterfaces[i].Version == InVersion) {
2509 return PublicInterfaces[i].datapointer;
2510 }
2511 }
2512 }
2513

Callers 15

SteamAppsFunction · 0.85
SteamClientFunction · 0.85
SteamControllerFunction · 0.85
SteamBillingFunction · 0.85
SteamContentServerFunction · 0.85
SteamFriendsFunction · 0.85
SteamParentalSettingsFunction · 0.85
SteamGameSearchFunction · 0.85
SteamInputFunction · 0.85
SteamPartiesFunction · 0.85
SteamGameServerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected