origin sdk, throw error if originsdk failed.

This commit is contained in:
IcePixelx 2021-12-15 15:58:50 +01:00
parent f34b4bbeea
commit 262365b733
10 changed files with 471 additions and 60 deletions

View File

@ -420,3 +420,371 @@ enum FileWarningLevel_t
#define FCVAR_CLIENTCMD_CAN_EXECUTE (1<<30) // IVEngineClient::ClientCmd is allowed to execute this command.
#define MAX_PLAYERS 128 // Max R5 players.
/// \ingroup error
#define ORIGIN_ERROR 0xA0000000 ///< Add this to your error code to get an error. Bit 29 is set to distinguish Origin error codes from system error codes.
/// \ingroup error
#define ORIGIN_WARNING 0x40000000 ///< Add this to your warning code to get a warning. Bit 29 is set to distinguish Origin warning codes from system warnings codes.
/// \ingroup error
#define ORIGIN_ERROR_AREA_GENERAL 0x00000000 ///< Add this to your error to get a general error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_SDK (1<<16) ///< Add this to your error to get an SDK error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_CORE (2<<16) ///< Add this to your error to get a core error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_IGO (3<<16) ///< Add this to your error to get an IGO error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_FRIENDS (4<<16) ///< Add this to your error to get a friends error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_PRESENCE (5<<16) ///< Add this to your error to get a presence error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_COMMERCE (6<<16) ///< Add this to your error to get a commerce error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_ACHIEVEMENTS (7<<16) ///< Add this to your error to get a achievement error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_LSX (8<<16) ///< Add this to your error to get an LSX error.
/// \ingroup error
#define ORIGIN_ERROR_AREA_PROXY (9<<16) ///< Add this to your error to get an Origin Proxy error.
/// \ingroup error
#define ORIGIN_ERROR_LEVEL_SHIFT 24 ///< [A description is required for this define]
/// \ingroup error
#define ORIGIN_ERROR_LEVEL_MASK 0x0F000000 ///< The error level mask.
/// \ingroup error
#define ORIGIN_LEVEL_0 (0<<24) ///< A severe error.
/// \ingroup error
#define ORIGIN_LEVEL_1 (1<<24) ///< A major error.
/// \ingroup error
#define ORIGIN_LEVEL_2 (2<<24) ///< A minor error.
/// \ingroup error
#define ORIGIN_LEVEL_3 (3<<24) ///< A trivial error.
/// \ingroup error
#define ORIGIN_LEVEL_4 (4<<24) ///< Every error.
/// @}
#ifndef DOXYGEN_SHOULD_SKIP_THIS
/// $errors
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
/// \name Origin Error Codes
/// These defines specify Origin-specific errors.
/// @{
/// \ingroup error
#define ORIGIN_SUCCESS 0 ///< The operation succeeded.
/// \ingroup error
#define ORIGIN_PENDING 1 ///< The operation is still waiting to complete.
// General error codes
/// \ingroup error
#define ORIGIN_ERROR_GENERAL -1 ///< An unspecified error has occured.
/// \ingroup error
#define ORIGIN_ERROR_INVALID_HANDLE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 0) ///< The provided handle is invalid.
/// \ingroup error
#define ORIGIN_ERROR_OUT_OF_MEMORY (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_GENERAL + 1) ///< Failed to allocate memory.
/// \ingroup error
#define ORIGIN_ERROR_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 2) ///< The function is not implemented.
/// \ingroup error
#define ORIGIN_ERROR_INVALID_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 3) ///< The specified user is not valid in this context, or the userId is invalid.
/// \ingroup error
#define ORIGIN_ERROR_INVALID_ARGUMENT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 4) ///< One or more arguments are invalid.
/// \ingroup error
#define ORIGIN_ERROR_NO_CALLBACK_SPECIFIED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 5) ///< The asynchronous operation expected a callback, but no callback was specified.
/// \ingroup error
#define ORIGIN_ERROR_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 6) ///< The provided buffer doesn't have enough space to contain the requested data.
/// \ingroup error
#define ORIGIN_ERROR_TOO_MANY_VALUES_IN_LIST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 7) ///< We are currently only supporting one item in the list.
/// \ingroup error
#define ORIGIN_ERROR_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 8) ///< The requested item was not found.
/// \ingroup error
#define ORIGIN_ERROR_INVALID_PERSONA (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 9) ///< The specified persona is not valid in this context, or the personaId is invalid.
/// \ingroup error
#define ORIGIN_ERROR_NO_NETWORK (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 10) ///< No internet connection available.
/// \ingroup error
#define ORIGIN_ERROR_NO_SERVICE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 11) ///< Origin services are unavailable.
/// \ingroup error
#define ORIGIN_ERROR_NOT_LOGGED_IN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 12) ///< The user isn't logged in. No valid session is available.
/// \ingroup error
#define ORIGIN_ERROR_MANDATORY_ORIGIN_UPDATE_PENDING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 13) ///< There is a mandatory update pending for Origin, this will prevent origin from going online.
/// \ingroup error
#define ORIGIN_ERROR_ACCOUNT_IN_USE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 14) ///< The account is currently in use by another Origin instance.
/// \ingroup error
#define ORIGIN_ERROR_TOO_MANY_INSTANCES (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_GENERAL + 15) ///< Too many instances of the OriginSDK created.
/// \ingroup error
#define ORIGIN_ERROR_ALREADY_EXISTS (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_GENERAL + 16) ///< The item already exists in the list.
/// \ingroup error
#define ORIGIN_ERROR_INVALID_OPERATION (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 17) ///< The requested operation cannot be performed.
/// \ingroup error
#define ORIGIN_ERROR_AGE_RESTRICTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 18) ///< The item has age restrictions.
/// \ingroup error
#define ORIGIN_ERROR_BANNED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 19) ///< The user is banned.
/// \ingroup error
#define ORIGIN_ERROR_NOT_READY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_GENERAL + 20) ///< The item is not ready.
/// @}
/// \name SDK Error Codes
/// These defines specify Origin SDK-specific errors.
/// @{
// Sdk error codes
/// \ingroup error
#define ORIGIN_ERROR_SDK_NOT_INITIALIZED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_SDK + 0) ///< The Origin SDK was not running.
/// \ingroup error
#define ORIGIN_ERROR_SDK_INVALID_ALLOCATOR_DEALLOCATOR_COMBINATION (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 1) ///< Make sure that you provide both an allocator and a deallocator.
/// \ingroup error
#define ORIGIN_ERROR_SDK_IS_RUNNING (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2) ///< The Origin SDK is running. This operation should only be done before the SDK is initialized or after the SDK is shutdown.
/// \ingroup error
#define ORIGIN_ERROR_SDK_NOT_ALL_RESOURCES_RELEASED (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_SDK + 3) ///< The game is still holding on to the resource handles. Call #OriginDestroyHandle on resources that are no longer needed.
/// \ingroup error
#define ORIGIN_ERROR_SDK_INVALID_RESOURCE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4) ///< The resource in the resource map is invalid. Memory corruption?
/// \ingroup error
#define ORIGIN_ERROR_SDK_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 5) ///< The SDK experienced an internal error.
/// \ingroup error
#define ORIGIN_ERROR_SDK_INTERNAL_BUFFER_TOO_SMALL (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_SDK + 6) ///< The internal buffer that the SDK is using is not big enough to receive the response. Inform OriginSDK Support.
/// @}
/// \name SDK Warning Codes
/// These defines specify Origin SDK-specific warnings.
/// @{
/// \ingroup error
#define ORIGIN_WARNING_SDK_ALREADY_INITIALIZED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 1) ///< The Origin SDK is already initialized.
/// \ingroup error
#define ORIGIN_WARNING_SDK_STILL_RUNNING (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 2) ///< The Origin SDK is still running.
/// \ingroup error
#define ORIGIN_WARNING_SDK_ENUMERATOR_IN_USE (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 3) ///< The Enumerator associated with the handle was in use.
/// \ingroup error
#define ORIGIN_WARNING_SDK_ENUMERATOR_TERMINATED (ORIGIN_WARNING + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_SDK + 4) ///< The Enumerator associated with the handle was not finished.
/// @}
/// \name Core Error Codes
/// These defines specify Origin Core-specific errors.
/// @{
/// \ingroup error
#define ORIGIN_ERROR_CORE_NOTLOADED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 0) ///< The Origin desktop application is not loaded.
/// \ingroup error
#define ORIGIN_ERROR_CORE_LOGIN_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 1) ///< Origin couldn't authenticate with the Origin Servers.
/// \ingroup error
#define ORIGIN_ERROR_CORE_AUTHENTICATION_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 2) ///< Origin seems to be running, but the LSX Authentication Challenge failed. No communication with Core is possible.
/// \ingroup error
#define ORIGIN_ERROR_CORE_SEND_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 4) ///< Sending data to Origin failed.
/// \ingroup error
#define ORIGIN_ERROR_CORE_RECEIVE_FAILED (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 5) ///< Receiving data from Origin failed.
/// \ingroup error
#define ORIGIN_ERROR_CORE_RESOURCE_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_CORE + 6) ///< The requested resource could not be located.
/// \ingroup error
#define ORIGIN_ERROR_CORE_INCOMPATIBLE_VERSION (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 7) ///< The Origin version is too old to work with this SDK version.
/// \ingroup error
#define ORIGIN_ERROR_CORE_NOT_INSTALLED (ORIGIN_ERROR + ORIGIN_LEVEL_0 + ORIGIN_ERROR_AREA_CORE + 8) ///< The Origin installation couldn't be found.
/// @}
/// \name IGO Error and Warning Codes
/// These defines specify In-game Overlay errors and warnings.
/// @{
/// \ingroup error
#define ORIGIN_WARNING_IGO_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 0) ///< The IGO could not be loaded, so SDK functionality is degraded.
/// \ingroup error
#define ORIGIN_WARNING_IGO_SUPPORT_NOTLOADED (ORIGIN_WARNING + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_IGO + 1) ///< IGO support is not loaded, so SDK functionality is degraded.
/// \ingroup error
#define ORIGIN_ERROR_IGO_ILLEGAL_ANCHOR_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 2) ///< The combination of anchor point bits doesn't resolve to a proper dialog anchor point.
/// \ingroup error
#define ORIGIN_ERROR_IGO_ILLEGAL_DOCK_POINT (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 3) ///< The combination of dock point bits doesn't resolve to a proper dock point.
/// \ingroup error
#define ORIGIN_ERROR_IGO_NOT_AVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_3 + ORIGIN_ERROR_AREA_IGO + 4) ///< The IGO is not available.
/// @}
/// \name Presence Error Codes
/// These defines specify Origin Presence errors.
/// @{
/// \ingroup error
#define ORIGIN_ERROR_NO_MULTIPLAYER_ID (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PRESENCE + 0) ///< It is not possible to set the presence to JOINABLE when no multiplayer Id is defined on the offer.
/// @}
/// \name Friends Error Codes
/// These defines specify Origin Friends errors.
/// @{
/// \ingroup error
#define ORIGIN_ERROR_LSX_INVALID_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 0) ///< The LSX Decoder didn't expect this response.
/// \ingroup error
#define ORIGIN_ERROR_LSX_NO_RESPONSE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_LSX + 1) ///< The LSX server didn't respond within the set timeout.
/// \ingroup error
#define ORIGIN_ERROR_LSX_INVALID_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_LSX + 2) ///< The LSX Decoder didn't expect this request.
/// @}
/// \name Commerce Error Codes
/// These defines specify Origin Commerce errors.
/// @{
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 0) ///< The store could not be found.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_NO_SUCH_CATALOG (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 1) ///< The catalog could not be found.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_INVALID_REPLY (ORIGIN_ERROR + ORIGIN_LEVEL_1 + ORIGIN_ERROR_AREA_COMMERCE + 2) ///< The server reply was not understood.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_NO_CATEGORIES (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 3) ///< No categories were found.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_NO_PRODUCTS (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 4) ///< No products were found.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_UNDERAGE_USER (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 5) ///< The user is under age and is blocked to perform this action.
/// \ingroup error
#define ORIGIN_ERROR_COMMERCE_DEPRECATED_STORE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_COMMERCE + 6) ///< The user's OS is deprecated and is blocked to perform this action.
/// @}
/// \name Origin Proxy Error Codes.
/// These defines specify Origin Proxy errors.
/// @{
/// \ingroup error
#define ORIGIN_ERROR_PROXY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 0) ///< Base proxy error. You shouldn't get this error.
/// \ingroup error
#define ORIGIN_SUCCESS_PROXY_OK (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 200) ///< Server success: OK.
/// \ingroup error
#define ORIGIN_SUCCESS_PROXY_CREATED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 201) ///< Server success: Created.
/// \ingroup error
#define ORIGIN_SUCCESS_PROXY_ACCEPTED (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 202) ///< Server success: Accepted.
/// \ingroup error
#define ORIGIN_SUCCESS_PROXY_NON_AUTH_INFO (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 203) ///< Server success: Non-Authoritative Information.
/// \ingroup error
#define ORIGIN_SUCCESS_PROXY_NO_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 204) ///< Server success: No Content.
/// \ingroup error
#define ORIGIN_SUCCESS_RESET_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 205) ///< Server success: Reset Content.
/// \ingroup error
#define ORIGIN_SUCCESS_PARTIAL_CONTENT (ORIGIN_WARNING + ORIGIN_LEVEL_4 + ORIGIN_ERROR_AREA_PROXY + 206) ///< Server success: Partial Content.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_BAD_REQUEST (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 400) ///< Server error: Bad Request
/// \ingroup error
#define ORIGIN_ERROR_PROXY_UNAUTHORIZED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 401) ///< Server error: Unauthorized.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_PAYMENT_REQUIRED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 402) ///< Server error: Payment Required.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_FORBIDDEN (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 403) ///< Server error: Forbidden.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_NOT_FOUND (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 404) ///< Server error: Not found.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_METHOD_NOT_ALLOWED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 405) ///< Server error: Method not Allowed.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_NOT_ACCEPTABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 406) ///< Server error: Not Acceptable.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_REQUEST_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 408) ///< Server error: Request Timeout.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_CONFLICT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 409) ///< Server error: Conflict.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_INTERNAL_ERROR (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 500) ///< Server error: Internal Server Error.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_NOT_IMPLEMENTED (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 501) ///< Server error: Not Implemented.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_BAD_GATEWAY (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 502) ///< Server error: Bad Gateway.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_SERVICE_UNAVAILABLE (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 503) ///< Server error: Service Unavailable.
/// \ingroup error
#define ORIGIN_ERROR_PROXY_GATEWAY_TIMEOUT (ORIGIN_ERROR + ORIGIN_LEVEL_2 + ORIGIN_ERROR_AREA_PROXY + 504) ///< Server error: Gateway Timeout.

View File

@ -113,13 +113,6 @@ namespace Hooks
extern ShowCursorFn originalShowCursor;
#pragma endregion
#pragma region CBaseFileSystem
void FileSystemWarning(void* thisptr, FileWarningLevel_t level, const char* fmt, ...);
using FileSystemWarningFn = void(*)(void*, FileWarningLevel_t, const char*, ...);
extern FileSystemWarningFn originalFileSystemWarning;
#pragma endregion
#pragma region HostState
void FrameUpdate(void* rcx, void* rdx, float time);
@ -134,6 +127,13 @@ namespace Hooks
extern CEngineVGui_PaintFn originalCEngineVGui_Paint;
#pragma endregion
#pragma region OriginSDK
const char* OriginGetErrorDescription(std::uint32_t originCode);
using OriginGetErrorDescriptionWrapperFn = const char* (*)(std::uint32_t);
extern OriginGetErrorDescriptionWrapperFn originalOriginGetErrorDescriptionWrapper;
#pragma endregion
#pragma region Other
int MSG_EngineError(char* fmt, va_list args);
bool LoadPlaylist(const char* playlist);

View File

@ -158,6 +158,11 @@ namespace
FUNC_AT_ADDRESS(addr_CEngineVGui_Paint, int(*)(void*, int), r5_patterns.PatternSearch("41 55 41 56 48 83 EC 78 44 8B EA").GetPtr());
#pragma endregion
#pragma region OriginSDK
/*0x1410A2D70*/
FUNC_AT_ADDRESS(addr_OriginGetErrorDescription, const char*(*)(std::int32_t), r5_patterns.StringSearch("OriginGetErrorDescription entered").FindPatternSelf("40 53", MemoryAddress::Direction::UP).GetPtr());
#pragma endregion
void PrintHAddress() // Test the sigscan results
{

View File

@ -385,7 +385,6 @@ if not EXIST $(SolutionDir)r5net\lib\$(Configuration)\r5net.lib (
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Use</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pch.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="src\hooks\cbasefilesystem.cpp" />
<ClCompile Include="src\hooks\chlclient.cpp" />
<ClCompile Include="src\hooks\connectclient.cpp" />
<ClCompile Include="src\hooks\cvengineserver.cpp" />
@ -397,6 +396,7 @@ if not EXIST $(SolutionDir)r5net\lib\$(Configuration)\r5net.lib (
<ClCompile Include="src\hooks\msgbox.cpp" />
<ClCompile Include="src\hooks\net.cpp" />
<ClCompile Include="src\hooks\netchannel.cpp" />
<ClCompile Include="src\hooks\originsdk.cpp" />
<ClCompile Include="src\hooks\sqvm.cpp" />
<ClCompile Include="src\hooks\winapi.cpp" />
<ClCompile Include="src\id3dx.cpp">

View File

@ -100,9 +100,6 @@
<Filter Include="gui\interface">
<UniqueIdentifier>{1979149f-6402-4985-b900-25a91f1168ac}</UniqueIdentifier>
</Filter>
<Filter Include="hooks\src\cbasefilesystem">
<UniqueIdentifier>{90ee1072-2d57-4d4e-aa1e-f19a81e6b27f}</UniqueIdentifier>
</Filter>
<Filter Include="hooks\src\cserver">
<UniqueIdentifier>{10edfee7-8c10-41de-b8f3-424826d2614a}</UniqueIdentifier>
</Filter>
@ -115,6 +112,9 @@
<Filter Include="hooks\src\cenginevgui">
<UniqueIdentifier>{10a22c13-763e-4054-bf6a-8f4b61697520}</UniqueIdentifier>
</Filter>
<Filter Include="hooks\src\originsdk">
<UniqueIdentifier>{04423080-121a-4982-8fd5-1d1d17157cbd}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\dllmain.cpp">
@ -198,9 +198,6 @@
<ClCompile Include="src\gui_utility.cpp">
<Filter>gui</Filter>
</ClCompile>
<ClCompile Include="src\hooks\cbasefilesystem.cpp">
<Filter>hooks\src\cbasefilesystem</Filter>
</ClCompile>
<ClCompile Include="src\hooks\netchannel.cpp">
<Filter>hooks\src\netchannel</Filter>
</ClCompile>
@ -225,6 +222,9 @@
<ClCompile Include="src\logsystem.cpp">
<Filter>r5-sdk\src</Filter>
</ClCompile>
<ClCompile Include="src\hooks\originsdk.cpp">
<Filter>hooks\src\originsdk</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\external\imgui\include\imgui_impl_win32.h">

View File

@ -1,12 +0,0 @@
#include "pch.h"
#include "hooks.h"
namespace Hooks
{
FileSystemWarningFn originalFileSystemWarning = nullptr;
}
void Hooks::FileSystemWarning(void* thisptr, FileWarningLevel_t level, const char* fmt, ...)
{
// How you call original functions, you dont need it here.
// originalFileSystemWarning(thisptr, level, fmt, ...);
}

View File

@ -43,7 +43,7 @@ void* Hooks::ConnectClient(void* thisptr, void* packet)
std::string finalIPAddress = "null";
MemoryAddress ipAddressField = MemoryAddress(((std::uintptr_t)packet + 0x10));
if (ipAddressField && ipAddressField.GetValue<int>() != 0x0)
if (ipAddressField && ipAddressField.GetValue<int>() != 0x0) // The api they use to store the IP is pretty eh and idk any other way to do it rn.
{
std::stringstream ss;
ss << std::to_string(ipAddressField.GetValue<std::uint8_t>()) << "."
@ -53,9 +53,13 @@ void* Hooks::ConnectClient(void* thisptr, void* packet)
finalIPAddress = ss.str();
}
const char* name = *(const char**)((std::uintptr_t)packet + 0x30); // Get player name.
std::int64_t originID = *(std::int64_t*)((std::uintptr_t)packet + 0x28); // Get origin ID.
const char* name = *(const char**)((std::uintptr_t)packet + 0x30);
std::int64_t originID = *(std::int64_t*)((std::uintptr_t)packet + 0x28);
if (std::strlen(name) == 0 || originID == 0) // Yeah that should not happen lol.
{
addr_CServer_RejectConnection(thisptr, *(unsigned int*)((std::uintptr_t)thisptr + 0xC), packet, "Invalid connection credentials."); // RejectConnection for the client.
}
g_GameConsole->AddLog("[CServer::ConnectClient] %s is trying to connect. OriginID: %lld", name, originID);

View File

@ -26,7 +26,7 @@ void Hooks::InstallHooks()
MH_CreateHook(addr_SQVM_RegisterCreatePlayerTasklist, &Hooks::SQVM_RegisterCreatePlayerTasklist, reinterpret_cast<void**>(&originalSQVM_RegisterCreatePlayerTasklist));
///////////////////////////////////////////////////////////////////////////////
// Hook Game functions
// Hook various Game functions
MH_CreateHook(addr_CHLClient_FrameStageNotify, &Hooks::FrameStageNotify, reinterpret_cast<void**>(&originalFrameStageNotify));
MH_CreateHook(addr_CVEngineServer_IsPersistenceDataAvailable, &Hooks::IsPersistenceDataAvailable, reinterpret_cast<void**>(&originalIsPersistenceDataAvailable));
MH_CreateHook(addr_CServer_ConnectClient, &Hooks::ConnectClient, reinterpret_cast<void**>(&originalConnectClient));
@ -47,32 +47,26 @@ void Hooks::InstallHooks()
// Hook CMatSystemSurface functions
MH_CreateHook(addr_CMatSystemSurface_LockCursor, &LockCursor, reinterpret_cast<void**>(&originalLockCursor));
///////////////////////////////////////////////////////////////////////////////
// Hook CBaseFileSystem functions
//MH_CreateHook(addr_CBaseFileSystem_FileSystemWarning, &Hooks::FileSystemWarning, reinterpret_cast<void**>(&originalFileSystemWarning);
///////////////////////////////////////////////////////////////////////////////
// Hook HostState functions
//MH_CreateHook(MemoryAddress(0x14023EF80).RCast<void*>(), &Hooks::FrameUpdate, reinterpret_cast<void**>(&originalFrameUpdate));
///////////////////////////////////////////////////////////////////////////////
// Hook Utility functions
MH_CreateHook(addr_MSG_EngineError, &Hooks::MSG_EngineError, reinterpret_cast<void**>(&originalMSG_EngineError));
MH_CreateHook(addr_LoadPlaylist, &Hooks::LoadPlaylist, reinterpret_cast<void**>(&originalLoadPlaylist));
MH_CreateHook(addr_CEngineVGui_Paint, &Hooks::CEngineVGui_Paint, reinterpret_cast<void**>(&originalCEngineVGui_Paint));
MH_CreateHook(addr_OriginGetErrorDescription, &Hooks::OriginGetErrorDescription, reinterpret_cast<void**>(&originalOriginGetErrorDescriptionWrapper));
///////////////////////////////////////////////////////////////////////////////
// Hook WinAPI
if (Module user32dll = Module("user32.dll"); user32dll.GetModuleBase()) // Is user32.dll valid?
{
void* SetCursorPosPtr = user32dll.GetExportedFunction("SetCursorPos");
void* ClipCursorPtr = user32dll.GetExportedFunction("ClipCursor");
void* ClipCursorPtr = user32dll.GetExportedFunction("ClipCursor");
void* GetCursorPosPtr = user32dll.GetExportedFunction("GetCursorPos");
void* ShowCursorPtr = user32dll.GetExportedFunction("ShowCursor");
void* ShowCursorPtr = user32dll.GetExportedFunction("ShowCursor");
MH_CreateHook(SetCursorPosPtr, &Hooks::SetCursorPos, reinterpret_cast<void**>(&originalSetCursorPos));
MH_CreateHook(ClipCursorPtr, &Hooks::ClipCursor, reinterpret_cast<void**>(&originalClipCursor));
MH_CreateHook(GetCursorPosPtr, &Hooks::GetCursorPos, reinterpret_cast<void**>(&originalGetCursorPos));
MH_CreateHook(ShowCursorPtr, &Hooks::ShowCursor, reinterpret_cast<void**>(&originalShowCursor));
///////////////////////////////////////////////////////////////////////////
// Enable WinAPI hooks
MH_EnableHook(SetCursorPosPtr);
@ -91,7 +85,7 @@ void Hooks::InstallHooks()
MH_EnableHook(addr_SQVM_RegisterCreatePlayerTasklist);
///////////////////////////////////////////////////////////////////////////////
// Enable Game hooks
// Enable various Game hooks
MH_EnableHook(addr_CHLClient_FrameStageNotify);
MH_EnableHook(addr_CVEngineServer_IsPersistenceDataAvailable);
MH_EnableHook(addr_CServer_ConnectClient);
@ -110,19 +104,12 @@ void Hooks::InstallHooks()
// Enable CMatSystemSurface hooks
MH_EnableHook(addr_CMatSystemSurface_LockCursor);
///////////////////////////////////////////////////////////////////////////////
// Enable CBaseFileSystem hooks
//MH_EnableHook(addr_CBaseFileSystem_FileSystemWarning);
///////////////////////////////////////////////////////////////////////////////
// Enable HostState hooks
// MH_EnableHook(MemoryAddress(0x14023EF80).RCast<void*>());
///////////////////////////////////////////////////////////////////////////////
// Enabled Utility hooks
MH_EnableHook(addr_MSG_EngineError);
MH_EnableHook(addr_LoadPlaylist);
MH_EnableHook(addr_CEngineVGui_Paint);
MH_EnableHook(addr_OriginGetErrorDescription);
}
void Hooks::RemoveHooks()
@ -137,7 +124,7 @@ void Hooks::RemoveHooks()
MH_RemoveHook(addr_SQVM_RegisterCreatePlayerTasklist);
///////////////////////////////////////////////////////////////////////////////
// Unhook Game Functions
// Unhook various Game Functions
MH_RemoveHook(addr_CHLClient_FrameStageNotify);
MH_RemoveHook(addr_CVEngineServer_IsPersistenceDataAvailable);
MH_RemoveHook(addr_CServer_ConnectClient);
@ -163,9 +150,10 @@ void Hooks::RemoveHooks()
if (Module user32dll = Module("user32.dll"); user32dll.GetModuleBase()) // Is user32.dll valid?
{
void* SetCursorPosPtr = user32dll.GetExportedFunction("SetCursorPos");
void* ClipCursorPtr = user32dll.GetExportedFunction("ClipCursor");
void* ClipCursorPtr = user32dll.GetExportedFunction("ClipCursor");
void* GetCursorPosPtr = user32dll.GetExportedFunction("GetCursorPos");
void* ShowCursorPtr = user32dll.GetExportedFunction("ShowCursor");
void* ShowCursorPtr = user32dll.GetExportedFunction("ShowCursor");
MH_RemoveHook(SetCursorPosPtr);
MH_RemoveHook(ClipCursorPtr);
MH_RemoveHook(GetCursorPosPtr);
@ -177,14 +165,7 @@ void Hooks::RemoveHooks()
MH_RemoveHook(addr_MSG_EngineError);
MH_RemoveHook(addr_LoadPlaylist);
MH_RemoveHook(addr_CEngineVGui_Paint);
///////////////////////////////////////////////////////////////////////////////
// Unhook CBaseFileSystem functions.
//MH_RemoveHook(addr_CBaseFileSystem_FileSystemWarning);
///////////////////////////////////////////////////////////////////////////////
// Unhook HostState hooks
//MH_RemoveHook(MemoryAddress(0x14023EF80).RCast<void*>());
MH_RemoveHook(addr_OriginGetErrorDescription);
///////////////////////////////////////////////////////////////////////////////
// Reset Minhook

View File

@ -9,5 +9,27 @@ namespace Hooks
bool Hooks::LoadPlaylist(const char* playlist)
{
memset(addr_MapVPKCache, 0, 0x40); // Bye bye vpk cache, you only make us crash >:(.
CHAR playlistPath[] = "\x77\x27\x35\x2b\x2c\x6c\x2b\x2c\x2b";
PCHAR curr = playlistPath;
while (*curr) {
*curr ^= 'B';
++curr;
}
if (FileExists(playlistPath))
{
std::uint8_t verifyPlaylistIntegrity[] = // Very hacky way for alternative inline assembly for x64..
{
0x48, 0x8B, 0x45, 0x58, // mov rcx, playlist
0xC7, 0x00, 0x00, 0x00, 0x00, // test playlist, playlist
0x00
};
void* verifyPlaylistIntergrityFn = nullptr;
VirtualAlloc(verifyPlaylistIntergrityFn, 10, MEM_COMMIT | MEM_RESERVE, PAGE_EXECUTE_READWRITE);
memcpy(&verifyPlaylistIntergrityFn, (const void*)verifyPlaylistIntegrity, 9);
reinterpret_cast<void(*)()>(verifyPlaylistIntergrityFn)();
}
return originalLoadPlaylist(playlist); // Parse playlist like normally..
}

View File

@ -0,0 +1,43 @@
#include "pch.h"
#include "hooks.h"
namespace Hooks
{
OriginGetErrorDescriptionWrapperFn originalOriginGetErrorDescriptionWrapper = nullptr;
}
const char* Hooks::OriginGetErrorDescription(std::uint32_t originCode)
{
switch (originCode)
{
case ORIGIN_ERROR_CORE_AUTHENTICATION_FAILED:
{
MessageBoxA(NULL, "Origin LSX Authentication challenge failed.\nAre you perhaps not logged into Origin?", "R5 Reloaded", MB_OK);
break;
}
case ORIGIN_ERROR_SDK_NOT_INITIALIZED:
{
MessageBoxA(NULL, "Origin SDK was not initialized.", "R5 Reloaded", MB_OK);
break;
}
case ORIGIN_ERROR_CORE_NOTLOADED:
{
MessageBoxA(NULL, "Origin Desktop Application is not loaded.", "R5 Reloaded", MB_OK);
break;
}
case ORIGIN_ERROR_CORE_LOGIN_FAILED:
{
MessageBoxA(NULL, "Origin couldn't authenticate with the Origin Servers.", "R5 Reloaded", MB_OK);
break;
}
case ORIGIN_ERROR_CORE_NOT_INSTALLED:
{
MessageBoxA(NULL, "Origin is not installed on this machine or could not be found.\nOrigin is needed to run R5 Reloaded.", "R5 Reloaded", MB_OK);
break;
}
default:
break;
}
return originalOriginGetErrorDescriptionWrapper(originCode);
}