From 7f8416ea7d8d62171d2343e439cfba2762584de4 Mon Sep 17 00:00:00 2001 From: Michael Fabian Dirks Date: Sun, 17 May 2015 12:45:11 +0200 Subject: [PATCH] Initial Commit --- BlitzPointerLink.cpp | 5 ++ BlitzSteam.bb | 149 ++++++++++++++++++++++++++++++++++ BlitzSteam.decls | 112 +++++++++++++++++++++++++ BlitzSteam.vcxproj | 162 +++++++++++++++++++++++++++++++++++++ BlitzSteam.vcxproj.filters | 51 ++++++++++++ BlitzSteam.vcxproj.user | 4 + Libraries/BlitzPointer.cpp | 30 +++++++ Libraries/BlitzPointer.h | 15 ++++ Steam.cpp | 32 ++++++++ Wrapper/Steam.cpp | 32 ++++++++ Wrapper/SteamClient.cpp | 20 +++++ Wrapper/SteamUser.cpp | 7 ++ dllmain.cpp | 18 +++++ dllmain.h | 21 +++++ 14 files changed, 658 insertions(+) create mode 100644 BlitzPointerLink.cpp create mode 100644 BlitzSteam.bb create mode 100644 BlitzSteam.decls create mode 100644 BlitzSteam.vcxproj create mode 100644 BlitzSteam.vcxproj.filters create mode 100644 BlitzSteam.vcxproj.user create mode 100644 Libraries/BlitzPointer.cpp create mode 100644 Libraries/BlitzPointer.h create mode 100644 Steam.cpp create mode 100644 Wrapper/Steam.cpp create mode 100644 Wrapper/SteamClient.cpp create mode 100644 Wrapper/SteamUser.cpp create mode 100644 dllmain.cpp create mode 100644 dllmain.h diff --git a/BlitzPointerLink.cpp b/BlitzPointerLink.cpp new file mode 100644 index 0000000..3c1d892 --- /dev/null +++ b/BlitzPointerLink.cpp @@ -0,0 +1,5 @@ +#include "BlitzPointer.h" + +uint32_t BlitzPointer_CallFunction0(uint32_t fpFunctionPointer) { + +} \ No newline at end of file diff --git a/BlitzSteam.bb b/BlitzSteam.bb new file mode 100644 index 0000000..4c0f67a --- /dev/null +++ b/BlitzSteam.bb @@ -0,0 +1,149 @@ +;---------------------------------------------------------------- +;-- Enumerations +;---------------------------------------------------------------- +Const EResultOK = 1; ; success +Const EResultFail = 2; ; generic failure +Const EResultNoConnection = 3; ; no/failed network connection +Const EResultInvalidPassword = 5; ; password/ticket is invalid +Const EResultLoggedInElsewhere = 6; ; same user logged in elsewhere +Const EResultInvalidProtocolVer = 7; ; protocol version is incorrect +Const EResultInvalidParam = 8; ; a parameter is incorrect +Const EResultFileNotFound = 9; ; file was not found +Const EResultBusy = 10; ; called method busy - action not taken +Const EResultInvalidState = 11; ; called object was in an invalid state +Const EResultInvalidName = 12; ; name is invalid +Const EResultInvalidEmail = 13; ; email is invalid +Const EResultDuplicateName = 14; ; name is not unique +Const EResultAccessDenied = 15; ; access is denied +Const EResultTimeout = 16; ; operation timed out +Const EResultBanned = 17; ; VAC2 banned +Const EResultAccountNotFound = 18; ; account not found +Const EResultInvalidSteamID = 19; ; steamID is invalid +Const EResultServiceUnavailable = 20; ; The requested service is currently unavailable +Const EResultNotLoggedOn = 21; ; The user is not logged on +Const EResultPending = 22; ; Request is pending (may be in process; or waiting on third party) +Const EResultEncryptionFailure = 23; ; Encryption or Decryption failed +Const EResultInsufficientPrivilege = 24; ; Insufficient privilege +Const EResultLimitExceeded = 25; ; Too much of a good thing +Const EResultRevoked = 26; ; Access has been revoked (used for revoked guest passes) +Const EResultExpired = 27; ; License/Guest pass the user is trying to access is expired +Const EResultAlreadyRedeemed = 28; ; Guest pass has already been redeemed by account; cannot be acked again +Const EResultDuplicateRequest = 29; ; The request is a duplicate and the action has already occurred in the past; ignored this time +Const EResultAlreadyOwned = 30; ; All the games in this guest pass redemption request are already owned by the user +Const EResultIPNotFound = 31; ; IP address not found +Const EResultPersistFailed = 32; ; failed to write change to the data store +Const EResultLockingFailed = 33; ; failed to acquire access lock for this operation +Const EResultLogonSessionReplaced = 34; +Const EResultConnectFailed = 35; +Const EResultHandshakeFailed = 36; +Const EResultIOFailure = 37; +Const EResultRemoteDisconnect = 38; +Const EResultShoppingCartNotFound = 39; ; failed to find the shopping cart requested +Const EResultBlocked = 40; ; a user didn't allow it +Const EResultIgnored = 41; ; target is ignoring sender +Const EResultNoMatch = 42; ; nothing matching the request found +Const EResultAccountDisabled = 43; +Const EResultServiceReadOnly = 44; ; this service is not accepting content changes right now +Const EResultAccountNotFeatured = 45; ; account doesn't have value; so this feature isn't available +Const EResultAdministratorOK = 46; ; allowed to take this action; but only because requester is admin +Const EResultContentVersion = 47; ; A Version mismatch in content transmitted within the Steam protocol. +Const EResultTryAnotherCM = 48; ; The current CM can't service the user making a request; user should try another. +Const EResultPasswordRequiredToKickSession = 49;; You are already logged in elsewhere; this cached credential login has failed. +Const EResultAlreadyLoggedInElsewhere = 50; ; You are already logged in elsewhere; you must wait +Const EResultSuspended = 51; ; Long running operation (content download) suspended/paused +Const EResultCancelled = 52; ; Operation canceled (typically by user: content download) +Const EResultDataCorruption = 53; ; Operation canceled because data is ill formed or unrecoverable +Const EResultDiskFull = 54; ; Operation canceled - not enough disk space. +Const EResultRemoteCallFailed = 55; ; an remote call or IPC call failed +Const EResultPasswordUnset = 56; ; Password could not be verified as it's unset server side +Const EResultExternalAccountUnlinked = 57; ; External account (PSN; Facebook...) is not linked to a Steam account +Const EResultPSNTicketInvalid = 58; ; PSN ticket was invalid +Const EResultExternalAccountAlreadyLinked = 59; ; External account (PSN; Facebook...) is already linked to some other account; must explicitly request to replace/delete the link first +Const EResultRemoteFileConflict = 60; ; The sync cannot resume due to a conflict between the local and remote files +Const EResultIllegalPassword = 61; ; The requested new password is not legal +Const EResultSameAsPreviousValue = 62; ; new value is the same as the old one ( secret question and answer ) +Const EResultAccountLogonDenied = 63; ; account login denied due to 2nd factor authentication failure +Const EResultCannotUseOldPassword = 64; ; The requested new password is not legal +Const EResultInvalidLoginAuthCode = 65; ; account login denied due to auth code invalid +Const EResultAccountLogonDeniedNoMail = 66; ; account login denied due to 2nd factor auth failure - and no mail has been sent +Const EResultHardwareNotCapableOfIPT = 67; ; +Const EResultIPTInitError = 68; ; +Const EResultParentalControlRestricted = 69; ; operation failed due to parental control restrictions for current user +Const EResultFacebookQueryError = 70; ; Facebook query returned an error +Const EResultExpiredLoginAuthCode = 71; ; account login denied due to auth code expired +Const EResultIPLoginRestrictionFailed = 72; +Const EResultAccountLockedDown = 73; +Const EResultAccountLogonDeniedVerifiedEmailRequired = 74; +Const EResultNoMatchingURL = 75; +Const EResultBadResponse = 76; ; parse failure; missing field; etc. +Const EResultRequirePasswordReEntry = 77; ; The user cannot complete the action until they re-enter their password +Const EResultValueOutOfRange = 78; ; the value entered is outside the acceptable range +Const EResultUnexpectedError = 79; ; something happened that we didn't expect to ever happen +Const EResultDisabled = 80; ; The requested service has been configured to be unavailable +Const EResultInvalidCEGSubmission = 81; ; The set of files submitted to the CEG server are not valid ! +Const EResultRestrictedDevice = 82; ; The device being used is not allowed to perform this action +Const EResultRegionLocked = 83; ; The action could not be complete because it is region restricted +Const EResultRateLimitExceeded = 84; ; Temporary rate limit exceeded; try again later; different from k_EResultLimitExceeded which may be permanent +Const EResultAccountLoginDeniedNeedTwoFactor = 85; ; Need two-factor code to login +Const EResultItemDeleted = 86; ; The thing we're trying to access has been deleted +Const EResultAccountLoginDeniedThrottle = 87; ; login attempt failed; try to throttle response to possible attacker +Const EResultTwoFactorCodeMismatch = 88; ; two factor code mismatch +Const EResultTwoFactorActivationCodeMismatch = 89; ; activation code for two-factor didn't match +Const EResultAccountAssociatedToMultiplePartners = 90; ; account has been associated with multiple partners +Const EResultNotModified = 91; ; data not modified +Const EResultNoMobileDevice = 92; ; the account does not have a mobile device associated with it +Const EResultTimeNotSynced = 93; ; the time presented is out of range or tolerance +Const EResultSmsCodeFailed = 94; ; SMS code failure (no match; none pending; etc.) +Const EResultAccountLimitExceeded = 95; ; Too many accounts access this resource +Const EResultAccountActivityLimitExceeded = 96; ; Too many changes to this account +Const EResultPhoneActivityLimitExceeded = 97; ; Too many changes to this phone + +Const EVoiceResultOK = 0; +Const EVoiceResultNotInitialized = 1; +Const EVoiceResultNotRecording = 2; +Const EVoiceResultNoData = 3; +Const EVoiceResultBufferTooSmall = 4; +Const EVoiceResultDataCorrupted = 5; +Const EVoiceResultRestricted = 6; +Const EVoiceResultUnsupportedCodec = 7; +Const EVoiceResultReceiverOutOfDate = 8; +Const EVoiceResultReceiverDidNotAnswer = 9; + +Const EDenyInvalid = 0; +Const EDenyInvalidVersion = 1; +Const EDenyGeneric = 2; +Const EDenyNotLoggedOn = 3; +Const EDenyNoLicense = 4; +Const EDenyCheater = 5; +Const EDenyLoggedInElseWhere = 6; +Const EDenyUnknownText = 7; +Const EDenyIncompatibleAnticheat = 8; +Const EDenyMemoryCorruption = 9; +Const EDenyIncompatibleSoftware = 10; +Const EDenySteamConnectionLost = 11; +Const EDenySteamConnectionError = 12; +Const EDenySteamResponseTimedOut = 13; +Const EDenySteamValidationStalled = 14; +Const EDenySteamOwnerLeftGuestUser = 15; + +Const EBeginAuthSessionResultOK = 0; ; Ticket is valid for this game and this steamID. +Const EBeginAuthSessionResultInvalidTicket = 1; ; Ticket is not valid. +Const EBeginAuthSessionResultDuplicateRequest = 2; ; A ticket has already been submitted for this steamID +Const EBeginAuthSessionResultInvalidVersion = 3; ; Ticket is from an incompatible interface version +Const EBeginAuthSessionResultGameMismatch = 4; ; Ticket is not for this game +Const EBeginAuthSessionResultExpiredTicket = 5; ; Ticket has expired + +Const EAuthSessionResponseOK = 0; ; Steam has verified the user is online; the ticket is valid and ticket has not been reused. +Const EAuthSessionResponseUserNotConnectedToSteam = 1; ; The user in question is not connected to steam +Const EAuthSessionResponseNoLicenseOrExpired = 2; ; The license has expired. +Const EAuthSessionResponseVACBanned = 3; ; The user is VAC banned for this game. +Const EAuthSessionResponseLoggedInElseWhere = 4; ; The user account has logged in elsewhere and the session containing the game instance has been disconnected. +Const EAuthSessionResponseVACCheckTimedOut = 5; ; VAC has been unable to perform anti-cheat checks on this user +Const EAuthSessionResponseAuthTicketCanceled = 6; ; The ticket has been canceled by the issuer +Const EAuthSessionResponseAuthTicketInvalidAlreadyUsed = 7; ; This ticket has already been used; it is not valid. +Const EAuthSessionResponseAuthTicketInvalid = 8; ; This ticket is not from a user instance currently connected to steam. +Const EAuthSessionResponsePublisherIssuedBan = 9; ; The user is banned for this game. The ban came via the web api and not VAC + +Const EUserHasLicenseResultHasLicense = 0; ; User has a license for specified app +Const EUserHasLicenseResultDoesNotHaveLicense = 1; ; User does not have a license for the specified app +Const EUserHasLicenseResultNoAuth = 2; ; User has not been authenticated diff --git a/BlitzSteam.decls b/BlitzSteam.decls new file mode 100644 index 0000000..3dbc239 --- /dev/null +++ b/BlitzSteam.decls @@ -0,0 +1,112 @@ +; Native SteamAPI +.lib "steam_api.dll" +; SteamAPI +SteamAPI_Init%() +SteamAPI_InitSafe%() +SteamAPI_IsSteamRunning%() +SteamAPI_RestartAppIfNecessary%(unOwnAppID%) +SteamAPI_WriteMiniDump(uStructuredExceptionCode%, pvExceptionInfo*, uBuildID%) +SteamAPI_SetMiniDumpComment(pchMsg$) +SteamAPI_Shutdown() +SteamClient%() +SteamUser%() +SteamFriends%() +SteamUtils%() +SteamMatchmaking%() +SteamUserStats%() +SteamApps%() +SteamNetworking%() +SteamMatchmakingServers%() +SteamRemoteStorage%() +SteamScreenshots%() +SteamHTTP%() +SteamUnifiedMessages%() +SteamController%() +SteamUGC%() +SteamAppList%() +SteamMusic%() +SteamMusicRemote%() +SteamHTMLSurface%() +SteamInventory%() +SteamVideo%() +SteamAPI_RunCallbacks() +; SteamAPI-Callbacks +SteamAPI_RegisterCallback(pCallback%, iCallback%) +SteamAPI_UnregisterCallback(pCallback%) +SteamAPI_RegisterCallResult(pCallback%, hAPICall%) +SteamAPI_UnregisterCallResult(pCallback%, hAPICall%) + +; ISteamClient +SteamAPI_ISteamClient_CreateSteamPipe%(lpSteamClient%) +SteamAPI_ISteamClient_BReleaseSteamPipe%(lpSteamClient%, hSteamPipe%) +SteamAPI_ISteamClient_ConnectToGlobalUser%(lpSteamClient%, hSteamPipe%) +SteamAPI_ISteamClient_CreateLocalUser%(lpSteamClient%, phSteamPipe%, eAccountType%) +SteamAPI_ISteamClient_ReleaseUser(lpSteamClient%, hSteamPipe%, hUser%) +SteamAPI_ISteamClient_GetISteamUser%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamGameServer%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_SetLocalIPBinding(lpSteamClient%, unIP%, usPort%) +SteamAPI_ISteamClient_GetISteamFriends%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamUtils%(lpSteamClient%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamMatchmaking%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamMatchmakingServers%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamGenericInterface%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamUserStats%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamGameServerStats%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamApps%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamNetworking%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamRemoteStorage%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamScreenshots%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_RunFrame(lpSteamClient%) +SteamAPI_ISteamClient_GetIPCCallCount%(lpSteamClient%) +SteamAPI_ISteamClient_BShutdownIfAllPipesClosed%(lpSteamClient%) +SteamAPI_ISteamClient_GetISteamHTTP%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamUnifiedMessages%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamController%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamUGC%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamAppList%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamMusic%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamMusicRemote%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamHTMLSurface%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamInventory%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +SteamAPI_ISteamClient_GetISteamVideo%(lpSteamClient%, hSteamUser%, hSteamPipe%, pchVersion$) +; ISteamClient-Callbacks +;SteamAPI_ISteamClient_SetWarningMessageHook(lpSteamClient%, SteamAPIWarningMessageHook_t%) +;SteamAPI_ISteamClient_Set_SteamAPI_CPostAPIResultInProcess(lpSteamClient%, SteamAPI_PostAPIResultInProcess_t%) +;SteamAPI_ISteamClient_Remove_SteamAPI_CPostAPIResultInProcess(lpSteamClient%, SteamAPI_PostAPIResultInProcess_t%) +;SteamAPI_ISteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess(lpSteamClient%, SteamAPI_CheckCallbackRegistered_t%) + +; ISteamUser +SteamAPI_ISteamUser_GetHSteamUser%(lpSteamUser%) +SteamAPI_ISteamUser_BLoggedOn%(lpSteamUser%) +;Wrapped: uint64 SteamAPI_ISteamUser_GetSteamID(lpSteamUser%) +SteamAPI_ISteamUser_InitiateGameConnection%(lpSteamUser%, pAuthBlob*, cbMaxAuthBlob%, steamIDGameServer%, unIPServer%, usPortServer%, bSecure%) +SteamAPI_ISteamUser_TerminateGameConnection(lpSteamUser%, unIPServer%, usPortServer%) +SteamAPI_ISteamUser_TrackAppUsageEvent(lpSteamUser%, gameID%, eAppUsageEvent%, pchExtraInfo$) +SteamAPI_ISteamUser_GetUserDataFolder%(lpSteamUser%, pchBuffer$, cubBuffer%) +SteamAPI_ISteamUser_StartVoiceRecording(lpSteamUser%) +SteamAPI_ISteamUser_StopVoiceRecording(lpSteamUser%) +SteamAPI_ISteamUser_GetAvailableVoice%(lpSteamUser%, pcbCompressed*, pcbUncompressed*, nUncompressedVoiceDesiredSampleRate%) +SteamAPI_ISteamUser_GetVoice%(lpSteamUser%, bWantCompressed%, pDestBuffer*, cbDestBufferSize%, nBytesWritten*, bWantUncompressed%, pUncompressedDestBuffer*, cbUncompressedDestBufferSize%, nUncompressBytesWritten*, nUncompressedVoiceDesiredSampleRate%) +SteamAPI_ISteamUser_DecompressVoice%(lpSteamUser%, pCompressed*, cbCompressed%, pDestBuffer*, cbDestBufferSize%, nBytesWritten*, nDesiredSampleRate%) +SteamAPI_ISteamUser_GetVoiceOptimalSampleRate%(lpSteamUser%) +SteamAPI_ISteamUser_GetAuthSessionTicket%(lpSteamUser%, pTicket%, cbMaxTicket%, pcbTicket*) +SteamAPI_ISteamUser_BeginAuthSession%(lpSteamUser%, pAuthTicket%, cbAuthTicket%, steamID%) +SteamAPI_ISteamUser_EndAuthSession(lpSteamUser%, steamID%) +SteamAPI_ISteamUser_CancelAuthTicket(lpSteamUser%, hAuthTicket%) +SteamAPI_ISteamUser_UserHasLicenseForApp%(lpSteamUser%, steamID%, appID%) +SteamAPI_ISteamUser_BIsBehindNAT%(lpSteamUser%) +SteamAPI_ISteamUser_AdvertiseGame(lpSteamUser%, steamIDGameServer%, unIPServer%, usPortServer%) +;SteamAPICall_t SteamAPI_ISteamUser_RequestEncryptedAppTicket(lpSteamUser%, pDataToInclude%, cbDataToInclude%) +SteamAPI_ISteamUser_GetEncryptedAppTicket%(lpSteamUser%, pTicket%, cbMaxTicket%, pcbTicket%) +SteamAPI_ISteamUser_GetGameBadgeLevel%(lpSteamUser%, nSeries%, bFoil%) +SteamAPI_ISteamUser_GetPlayerSteamLevel%(lpSteamUser%) +;SteamAPICall_t SteamAPI_ISteamUser_RequestStoreAuthURL(lpSteamUser%, pchRedirectURL$) + +; Wrapped SteamAPI +.lib "BlitzSteam.dll" +; SteamAPI Callback Support +BlitzSteam_CreateCallback%(fpFunctionPointer%) +BlitzSteam_DestroyCallback(lpCallback%) + +;ISteamUser +BlitzSteam_ISteamUser_GetSteamID%(lpSteamUser%) \ No newline at end of file diff --git a/BlitzSteam.vcxproj b/BlitzSteam.vcxproj new file mode 100644 index 0000000..e6d4c1f --- /dev/null +++ b/BlitzSteam.vcxproj @@ -0,0 +1,162 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {805CB1EB-82F0-405E-AC0B-03FBE82CC77D} + BlitzSteam + + + + DynamicLibrary + true + v120 + Unicode + false + + + DynamicLibrary + false + v120 + false + Unicode + + + + + + + + + + + + + $(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\ + $(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\ + .dll + true + $(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + $(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\ + $(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\ + .dll + true + $(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath); + + + + Level3 + Disabled + + + Neither + MultiThreaded + false + $(SolutionDir);$(ProjectDir);D:\Projects\Cpp\#Libraries\Steamworks SDK\public + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + EditAndContinue + false + Default + 4Bytes + true + false + false + false + false + false + false + false + + + false + StdCall + + + true + 1.0 + D:\Projects\Cpp\#Libraries\Steamworks SDK\redistributable_bin + steam_api.lib;%(AdditionalDependencies) + + + + + + + + + + + Level3 + Full + false + true + + + Speed + MultiThreaded + $(SolutionDir);$(ProjectDir);D:\Projects\Cpp\#Libraries\Steamworks SDK\public + _CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions) + false + 4Bytes + true + false + false + false + false + false + false + + + Default + false + StdCall + + + false + + + + + 1.0 + D:\Projects\Cpp\#Libraries\Steamworks SDK\redistributable_bin + steam_api.lib;%(AdditionalDependencies) + Default + + + + + + + + + + + + + + + + + + BlitzSteam.bb + PreserveNewest + + + BlitzSteam.decls + PreserveNewest + + + + + + \ No newline at end of file diff --git a/BlitzSteam.vcxproj.filters b/BlitzSteam.vcxproj.filters new file mode 100644 index 0000000..1c898e0 --- /dev/null +++ b/BlitzSteam.vcxproj.filters @@ -0,0 +1,51 @@ + + + + + {3072c53c-2be5-4712-b853-1bc1438cdc6e} + + + {5016ba8f-d781-40f4-9904-56cc2ce9a588} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {8f00e86e-e1bc-499e-8b2c-da93e9e8f287} + + + {1b813d7f-3558-4f10-b237-1bcf7d5f0b60} + + + + + Source Files + + + Source Files\Wrapper + + + Source Files\Wrapper + + + Source Files\Wrapper + + + Source Files\Libraries + + + + + Source Files + + + Source Files\Libraries + + + + + Blitz Files + + + Blitz Files + + + \ No newline at end of file diff --git a/BlitzSteam.vcxproj.user b/BlitzSteam.vcxproj.user new file mode 100644 index 0000000..ef5ff2a --- /dev/null +++ b/BlitzSteam.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Libraries/BlitzPointer.cpp b/Libraries/BlitzPointer.cpp new file mode 100644 index 0000000..6a31e85 --- /dev/null +++ b/Libraries/BlitzPointer.cpp @@ -0,0 +1,30 @@ +#pragma once +#include "BlitzPointer.h" + +BlitzPointer_CallFunction0_t BlitzPointer_CallFunction0 = 0; +BlitzPointer_CallFunction1_t BlitzPointer_CallFunction1 = 0; +BlitzPointer_CallFunction2_t BlitzPointer_CallFunction2 = 0; +BlitzPointer_CallFunction3_t BlitzPointer_CallFunction3 = 0; +BlitzPointer_CallFunction4_t BlitzPointer_CallFunction4 = 0; +HMODULE hmBlitzPointerDLL; + +void BlitzPointer_Initialize() { + hmBlitzPointerDLL = LoadLibrary(TEXT("BlitzPointer.dll")); + if (hmBlitzPointerDLL != nullptr) { + BlitzPointer_CallFunction0 = (BlitzPointer_CallFunction0_t)GetProcAddress(hmBlitzPointerDLL, "BlitzPointer_CallFunction0"); + BlitzPointer_CallFunction1 = (BlitzPointer_CallFunction1_t)GetProcAddress(hmBlitzPointerDLL, "BlitzPointer_CallFunction1"); + BlitzPointer_CallFunction2 = (BlitzPointer_CallFunction2_t)GetProcAddress(hmBlitzPointerDLL, "BlitzPointer_CallFunction2"); + BlitzPointer_CallFunction3 = (BlitzPointer_CallFunction3_t)GetProcAddress(hmBlitzPointerDLL, "BlitzPointer_CallFunction3"); + BlitzPointer_CallFunction4 = (BlitzPointer_CallFunction4_t)GetProcAddress(hmBlitzPointerDLL, "BlitzPointer_CallFunction4"); + + if (BlitzPointer_CallFunction0 == nullptr + || BlitzPointer_CallFunction1 == nullptr + || BlitzPointer_CallFunction2 == nullptr + || BlitzPointer_CallFunction3 == nullptr + || BlitzPointer_CallFunction4 == nullptr) { + MessageBox(0, ERROR_TEXT_001, ERROR_TITLE_001, 0); + } + } else { + MessageBox(0, ERROR_TEXT_001, ERROR_TITLE_001, 0); + } +} \ No newline at end of file diff --git a/Libraries/BlitzPointer.h b/Libraries/BlitzPointer.h new file mode 100644 index 0000000..e3f1f6e --- /dev/null +++ b/Libraries/BlitzPointer.h @@ -0,0 +1,15 @@ +#include "dllmain.h" + +typedef uint32_t(__cdecl *BlitzPointer_CallFunction0_t)(uint32_t); +typedef uint32_t(__cdecl *BlitzPointer_CallFunction1_t)(uint32_t, uint32_t); +typedef uint32_t(__cdecl *BlitzPointer_CallFunction2_t)(uint32_t, uint32_t, uint32_t); +typedef uint32_t(__cdecl *BlitzPointer_CallFunction3_t)(uint32_t, uint32_t, uint32_t, uint32_t); +typedef uint32_t(__cdecl *BlitzPointer_CallFunction4_t)(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t); + +extern BlitzPointer_CallFunction0_t BlitzPointer_CallFunction0; +extern BlitzPointer_CallFunction1_t BlitzPointer_CallFunction1; +extern BlitzPointer_CallFunction2_t BlitzPointer_CallFunction2; +extern BlitzPointer_CallFunction3_t BlitzPointer_CallFunction3; +extern BlitzPointer_CallFunction4_t BlitzPointer_CallFunction4; + +void BlitzPointer_Initialize(); \ No newline at end of file diff --git a/Steam.cpp b/Steam.cpp new file mode 100644 index 0000000..06c1d83 --- /dev/null +++ b/Steam.cpp @@ -0,0 +1,32 @@ +#include "dllmain.h" +#include "BlitzPointerLink.cpp" + +class BlitzSteamCallback : CCallbackBase { +public: + uint32_t blitzFunctionPointer; + + virtual void Run(void *pvParam) { + BlitzPointer_CallFunction1((uint32_t)blitzFunctionPointer, (uint32_t)pvParam); + } + + virtual void Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) { + BlitzPointer_CallFunction4((uint32_t)blitzFunctionPointer, (uint32_t)pvParam, bIOFailure, (uint32_t)(hSteamAPICall & 0xFFFFFFFF), (uint32_t)(hSteamAPICall >> 32)); + } + + virtual int GetCallbackSizeBytes() { + return sizeof(BlitzSteamCallback); + } +}; + +DLL_EXPORT void* BlitzSteam_CreateCallback(uint32_t fpFunctionPointer) { + BlitzSteamCallback* lpBSCallback = new BlitzSteamCallback(); + lpBSCallback->blitzFunctionPointer = fpFunctionPointer; + return lpBSCallback; +} + +DLL_EXPORT void BlitzSteam_DestroyCallback(uint32_t lpCallback) { + BlitzSteamCallback* lpBSCallback = (BlitzSteamCallback*)lpCallback; + if (lpBSCallback != nullptr) { + delete lpBSCallback; + } +} \ No newline at end of file diff --git a/Wrapper/Steam.cpp b/Wrapper/Steam.cpp new file mode 100644 index 0000000..56507c6 --- /dev/null +++ b/Wrapper/Steam.cpp @@ -0,0 +1,32 @@ +#include "dllmain.h" +#include "Libraries\BlitzPointer.h" + +class BlitzSteamCallback : CCallbackBase { +public: + uint32_t blitzFunctionPointer; + + virtual void Run(void *pvParam) { + BlitzPointer_CallFunction1((uint32_t)blitzFunctionPointer, (uint32_t)pvParam); + } + + virtual void Run(void *pvParam, bool bIOFailure, SteamAPICall_t hSteamAPICall) { + BlitzPointer_CallFunction4((uint32_t)blitzFunctionPointer, (uint32_t)pvParam, bIOFailure, (uint32_t)(hSteamAPICall & 0xFFFFFFFF), (uint32_t)(hSteamAPICall >> 32)); + } + + virtual int GetCallbackSizeBytes() { + return sizeof(BlitzSteamCallback); + } +}; + +DLL_EXPORT void* BlitzSteam_CreateCallback(uint32_t fpFunctionPointer) { + BlitzSteamCallback* lpBSCallback = new BlitzSteamCallback(); + lpBSCallback->blitzFunctionPointer = fpFunctionPointer; + return lpBSCallback; +} + +DLL_EXPORT void BlitzSteam_DestroyCallback(uint32_t lpCallback) { + BlitzSteamCallback* lpBSCallback = (BlitzSteamCallback*)lpCallback; + if (lpBSCallback != nullptr) { + delete lpBSCallback; + } +} \ No newline at end of file diff --git a/Wrapper/SteamClient.cpp b/Wrapper/SteamClient.cpp new file mode 100644 index 0000000..5a4cd37 --- /dev/null +++ b/Wrapper/SteamClient.cpp @@ -0,0 +1,20 @@ +#include "dllmain.h" + + + +// Callbacks +DLL_EXPORT void SteamClient_SetWarningMessageHook(ISteamClient* lpSteamClient, SteamAPIWarningMessageHook_t pFunction) { + lpSteamClient->SetWarningMessageHook(pFunction); +} + +DLL_EXPORT void SteamClient_Set_SteamAPI_CPostAPIResultInProcess(ISteamClient* lpSteamClient, SteamAPI_PostAPIResultInProcess_t fpFunction) { + lpSteamClient->Set_SteamAPI_CPostAPIResultInProcess(fpFunction); +} + +DLL_EXPORT void SteamClient_Remove_SteamAPI_CPostAPIResultInProcess(ISteamClient* lpSteamClient, SteamAPI_PostAPIResultInProcess_t fpFunction) { + lpSteamClient->Remove_SteamAPI_CPostAPIResultInProcess(fpFunction); +} + +DLL_EXPORT void SteamClient_Set_SteamAPI_CCheckCallbackRegisteredInProcess(ISteamClient* lpSteamClient, SteamAPI_CheckCallbackRegistered_t fpFunction) { + lpSteamClient->Set_SteamAPI_CCheckCallbackRegisteredInProcess(fpFunction); +} \ No newline at end of file diff --git a/Wrapper/SteamUser.cpp b/Wrapper/SteamUser.cpp new file mode 100644 index 0000000..9f1e373 --- /dev/null +++ b/Wrapper/SteamUser.cpp @@ -0,0 +1,7 @@ +#include "dllmain.h" + +DLL_EXPORT void* BlitzSteam_ISteamUser_GetSteamID(void* lpSteamUser) { + return (void*)&(((ISteamUser*)lpSteamUser)->GetSteamID()); +} + +//DLL_EXPORT void* BlitzSteam_ISteamUser_ \ No newline at end of file diff --git a/dllmain.cpp b/dllmain.cpp new file mode 100644 index 0000000..530c949 --- /dev/null +++ b/dllmain.cpp @@ -0,0 +1,18 @@ +#include "dllmain.h" +#include "Libraries\BlitzPointer.h" + +bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + BlitzPointer_Initialize(); + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + + return true; +} \ No newline at end of file diff --git a/dllmain.h b/dllmain.h new file mode 100644 index 0000000..b2e205e --- /dev/null +++ b/dllmain.h @@ -0,0 +1,21 @@ +// STL Exceptions +#include +#include + +// Memory Management +#include + +// Platform specific: Windows +#include + +// Macros +#define DLL_EXPORT extern "C" __declspec(dllexport) + +// Steam +#include "steam/steam_api.h" + +// Error Messages +#define ERROR_TITLE_001 TEXT("Error 001") +#define ERROR_TEXT_001 TEXT("E001: Could not load 'BlitzPointer.dll'.") +#define ERROR_TITLE_002 TEXT("Error 002") +#define ERROR_TEXT_002 TEXT("E002: Unable to find one or multiple function addresses in 'BlitzPointer.dll'.") \ No newline at end of file