mirror of
https://github.com/Detanup01/gbe_fork.git
synced 2025-08-04 14:45:32 +02:00
Add starter pdk
This commit is contained in:
parent
af904d9934
commit
7a5bae58ec
3 changed files with 82 additions and 0 deletions
59
pdk/pdk.cpp
Normal file
59
pdk/pdk.cpp
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#include "pdk.h"
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Registering from the Maker
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="interfaceMakePtr"></param>
|
||||||
|
/// <param name="interfaceVersion"></param>
|
||||||
|
/// <returns>0 for success, 1 if failed</returns>
|
||||||
|
int PDK::RegisterInterface(InterfaceMaker interfaceMakePtr, const char* interfaceVersion)
|
||||||
|
{
|
||||||
|
if (interfaceMakePtr == NULL)
|
||||||
|
return 1;
|
||||||
|
if (interfaceVersion == NULL)
|
||||||
|
return 1;
|
||||||
|
if (!client_known_interfaces.count(interfaceVersion))
|
||||||
|
return 1;
|
||||||
|
interfaceMap.insert(std::make_pair(interfaceMakePtr, interfaceVersion));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unregistering from the Maker
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="interfaceMakePtr"></param>
|
||||||
|
/// <returns>0 for success, 1 if failed</returns>
|
||||||
|
int PDK::UnRegisterInterface(InterfaceMaker interfaceMakePtr)
|
||||||
|
{
|
||||||
|
if (interfaceMakePtr == NULL)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
interfaceMap.erase(interfaceMakePtr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* PDK::MakeInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* interfaceVersion)
|
||||||
|
{
|
||||||
|
for (const auto& [key, value] : interfaceMap)
|
||||||
|
{
|
||||||
|
if (strstr(interfaceVersion, value) == 0)
|
||||||
|
{
|
||||||
|
auto maker = (InterfaceMaker)key;
|
||||||
|
return maker(hSteamUser, hSteamPipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void* TestCreate(HSteamUser hSteamUser, HSteamPipe hSteamPipe)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Register()
|
||||||
|
{
|
||||||
|
// Which one should be good? idk
|
||||||
|
//PDK::RegisterInterface(TestCreate, "STEAMAPPLIST_INTERFACE_VERSION001");
|
||||||
|
//PDK::RegisterInterface(&TestCreate, "STEAMAPPLIST_INTERFACE_VERSION001");
|
||||||
|
}
|
20
pdk/pdk.h
Normal file
20
pdk/pdk.h
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#ifndef PDK_INCLUDE_H
|
||||||
|
#define PDK_INCLUDE_H
|
||||||
|
|
||||||
|
#include "dll/base.h"
|
||||||
|
#include "dll/client_known_interfaces.h"
|
||||||
|
|
||||||
|
typedef void* (__cdecl* InterfaceMaker)(HSteamUser hSteamUser, HSteamPipe hSteamPipe);
|
||||||
|
|
||||||
|
class PDK
|
||||||
|
{
|
||||||
|
static inline std::map<void* /* interfaceMaker */, const char* /* interfaceVersion */> interfaceMap;
|
||||||
|
public:
|
||||||
|
|
||||||
|
static int RegisterInterface(InterfaceMaker interfaceMakePtr, const char* interfaceVersion);
|
||||||
|
static int UnRegisterInterface(InterfaceMaker interfaceMakePtr);
|
||||||
|
static void* MakeInterface(HSteamUser hSteamUser, HSteamPipe hSteamPipe, const char* interfaceVersion);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //PDK_INCLUDE_H
|
|
@ -197,6 +197,7 @@ local common_include = {
|
||||||
'crash_printer',
|
'crash_printer',
|
||||||
'sdk',
|
'sdk',
|
||||||
"overlay_experimental",
|
"overlay_experimental",
|
||||||
|
"pdk"
|
||||||
}
|
}
|
||||||
|
|
||||||
local x32_deps_include = {
|
local x32_deps_include = {
|
||||||
|
@ -243,6 +244,8 @@ local common_files = {
|
||||||
"helpers/common_helpers.cpp", "helpers/common_helpers/**",
|
"helpers/common_helpers.cpp", "helpers/common_helpers/**",
|
||||||
-- helpers/dbg_log
|
-- helpers/dbg_log
|
||||||
"helpers/dbg_log.cpp", "helpers/dbg_log/**",
|
"helpers/dbg_log.cpp", "helpers/dbg_log/**",
|
||||||
|
-- pdk
|
||||||
|
"pdk/**",
|
||||||
}
|
}
|
||||||
|
|
||||||
local overlay_files = {
|
local overlay_files = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue