From 5056d8f040bd63dc5f192a7f158ae2b9669256ac Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sat, 1 Apr 2023 01:05:43 +0200 Subject: [PATCH] Move interface types to public header --- r5dev/public/interface.h | 39 +++++++++++++++++++++++++++ r5dev/vpc/interfaces.h | 38 +------------------------- r5dev/vproj/clientsdk.vcxproj | 1 + r5dev/vproj/clientsdk.vcxproj.filters | 3 +++ r5dev/vproj/dedicated.vcxproj | 1 + r5dev/vproj/dedicated.vcxproj.filters | 3 +++ r5dev/vproj/gamesdk.vcxproj | 1 + r5dev/vproj/gamesdk.vcxproj.filters | 3 +++ 8 files changed, 52 insertions(+), 37 deletions(-) create mode 100644 r5dev/public/interface.h diff --git a/r5dev/public/interface.h b/r5dev/public/interface.h new file mode 100644 index 00000000..1ff6f8d6 --- /dev/null +++ b/r5dev/public/interface.h @@ -0,0 +1,39 @@ +#ifndef INTERFACE_H +#define INTERFACE_H + +enum class InterfaceStatus_t : int +{ + IFACE_OK = 0, + IFACE_FAILED +}; + +//----------------------------------------------------------------------------- +// Mapping of interface string to globals +//----------------------------------------------------------------------------- +typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); +typedef void* (*InstantiateInterfaceFn)(); +typedef HINSTANCE CSysModule; + +struct InterfaceGlobals_t +{ + InstantiateInterfaceFn m_pInterfacePtr; + const char* m_pInterfaceName; + InterfaceGlobals_t* m_pNextInterfacePtr; +}; +//----------------------------------------------------------------------------- + +struct FactoryInfo_t +{ + CMemory m_pFactoryPtr; + string m_szFactoryFullName; + string m_szFactoryName; + string m_szFactoryVersion; + + FactoryInfo_t() : m_szFactoryFullName(string()), m_szFactoryName(string()), m_szFactoryVersion(string()), m_pFactoryPtr(nullptr) {} + FactoryInfo_t(string factoryFullName, string factoryName, string factoryVersion, uintptr_t factoryPtr) : + m_szFactoryFullName(factoryFullName), m_szFactoryName(factoryName), m_szFactoryVersion(factoryVersion), m_pFactoryPtr(factoryPtr) {} + FactoryInfo_t(string factoryFullName, uintptr_t factoryPtr) : + m_szFactoryFullName(factoryFullName), m_szFactoryName(string()), m_szFactoryVersion(string()), m_pFactoryPtr(factoryPtr) {} +}; + +#endif // INTERFACE_H diff --git a/r5dev/vpc/interfaces.h b/r5dev/vpc/interfaces.h index 474f958e..4c177111 100644 --- a/r5dev/vpc/interfaces.h +++ b/r5dev/vpc/interfaces.h @@ -1,10 +1,10 @@ #pragma once +#include "public/interface.h" /*----------------------------------------------------------------------------- * _interfaces.h *-----------------------------------------------------------------------------*/ -// Maybe make them constexpr. #define VENGINE_LAUNCHER_API_VERSION "VENGINE_LAUNCHER_API_VERSION004" #define VENGINE_GAMEUIFUNCS_VERSION "VENGINE_GAMEUIFUNCS_VERSION005" @@ -41,42 +41,6 @@ #define FACTORY_INTERFACE_VERSION "VFactorySystem001" #define FILESYSTEM_INTERFACE_VERSION "VFileSystem017" #define BASEFILESYSTEM_INTERFACE_VERSION "VBaseFileSystem011" -//----------------------------------------------------------------------------- - -enum class InterfaceStatus_t : int -{ - IFACE_OK = 0, - IFACE_FAILED -}; - -//----------------------------------------------------------------------------- -// Mapping of interface string to globals -//----------------------------------------------------------------------------- -typedef void* (*CreateInterfaceFn)(const char* pName, int* pReturnCode); -typedef void* (*InstantiateInterfaceFn)(); -typedef HINSTANCE CSysModule; - -struct InterfaceGlobals_t -{ - InstantiateInterfaceFn m_pInterfacePtr; - const char* m_pInterfaceName; - InterfaceGlobals_t* m_pNextInterfacePtr; -}; -//----------------------------------------------------------------------------- - -struct FactoryInfo_t -{ - CMemory m_pFactoryPtr; - string m_szFactoryFullName; - string m_szFactoryName; - string m_szFactoryVersion; - - FactoryInfo_t() : m_szFactoryFullName(string()), m_szFactoryName(string()), m_szFactoryVersion(string()), m_pFactoryPtr(nullptr) {} - FactoryInfo_t(string factoryFullName, string factoryName, string factoryVersion, uintptr_t factoryPtr) : - m_szFactoryFullName(factoryFullName), m_szFactoryName(factoryName), m_szFactoryVersion(factoryVersion), m_pFactoryPtr(factoryPtr) {} - FactoryInfo_t(string factoryFullName, uintptr_t factoryPtr) : - m_szFactoryFullName(factoryFullName), m_szFactoryName(string()), m_szFactoryVersion(string()), m_pFactoryPtr(factoryPtr) {} -}; //----------------------------------------------------------------------------- // Class to hold all factories (interfaces) diff --git a/r5dev/vproj/clientsdk.vcxproj b/r5dev/vproj/clientsdk.vcxproj index 985f9d36..cd54ee6e 100644 --- a/r5dev/vproj/clientsdk.vcxproj +++ b/r5dev/vproj/clientsdk.vcxproj @@ -342,6 +342,7 @@ + diff --git a/r5dev/vproj/clientsdk.vcxproj.filters b/r5dev/vproj/clientsdk.vcxproj.filters index f87cf08b..2c3d384f 100644 --- a/r5dev/vproj/clientsdk.vcxproj.filters +++ b/r5dev/vproj/clientsdk.vcxproj.filters @@ -1688,6 +1688,9 @@ thirdparty\imgui\misc + + sdk\public + diff --git a/r5dev/vproj/dedicated.vcxproj b/r5dev/vproj/dedicated.vcxproj index 5a65f30b..c77cfb04 100644 --- a/r5dev/vproj/dedicated.vcxproj +++ b/r5dev/vproj/dedicated.vcxproj @@ -336,6 +336,7 @@ + diff --git a/r5dev/vproj/dedicated.vcxproj.filters b/r5dev/vproj/dedicated.vcxproj.filters index 50cb241c..442ce717 100644 --- a/r5dev/vproj/dedicated.vcxproj.filters +++ b/r5dev/vproj/dedicated.vcxproj.filters @@ -1095,6 +1095,9 @@ sdk\tier1 + + sdk\public + diff --git a/r5dev/vproj/gamesdk.vcxproj b/r5dev/vproj/gamesdk.vcxproj index 061dd706..99181203 100644 --- a/r5dev/vproj/gamesdk.vcxproj +++ b/r5dev/vproj/gamesdk.vcxproj @@ -390,6 +390,7 @@ + diff --git a/r5dev/vproj/gamesdk.vcxproj.filters b/r5dev/vproj/gamesdk.vcxproj.filters index ffc5cbc6..82d0abdd 100644 --- a/r5dev/vproj/gamesdk.vcxproj.filters +++ b/r5dev/vproj/gamesdk.vcxproj.filters @@ -1859,6 +1859,9 @@ thirdparty\imgui\misc + + sdk\public +