Initial Commit with Data

Signed-off-by: Michael Fabian Dirks <michael.dirks@realitybends.de>
This commit is contained in:
Michael Fabian Dirks
2015-05-10 17:31:34 +02:00
commit b641313a75
46 changed files with 167364 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.40302.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlitzSteam", "BlitzSteam\BlitzSteam.vcxproj", "{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}"
ProjectSection(ProjectDependencies) = postProject
{AC8F52F4-9FE6-4CEF-B549-8180757020C8} = {AC8F52F4-9FE6-4CEF-B549-8180757020C8}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlitzUtility", "BlitzUtility\BlitzUtility.vcxproj", "{C08C5F9A-0C63-4798-A93F-FE96C014074B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlitzPointer", "BlitzPointer\BlitzPointer.vcxproj", "{AC8F52F4-9FE6-4CEF-B549-8180757020C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}.Debug|Win32.ActiveCfg = Debug|Win32
{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}.Debug|Win32.Build.0 = Debug|Win32
{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}.Release|Win32.ActiveCfg = Release|Win32
{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}.Release|Win32.Build.0 = Release|Win32
{C08C5F9A-0C63-4798-A93F-FE96C014074B}.Debug|Win32.ActiveCfg = Debug|Win32
{C08C5F9A-0C63-4798-A93F-FE96C014074B}.Debug|Win32.Build.0 = Debug|Win32
{C08C5F9A-0C63-4798-A93F-FE96C014074B}.Release|Win32.ActiveCfg = Release|Win32
{C08C5F9A-0C63-4798-A93F-FE96C014074B}.Release|Win32.Build.0 = Release|Win32
{AC8F52F4-9FE6-4CEF-B549-8180757020C8}.Debug|Win32.ActiveCfg = Debug|Win32
{AC8F52F4-9FE6-4CEF-B549-8180757020C8}.Debug|Win32.Build.0 = Debug|Win32
{AC8F52F4-9FE6-4CEF-B549-8180757020C8}.Release|Win32.ActiveCfg = Release|Win32
{AC8F52F4-9FE6-4CEF-B549-8180757020C8}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file not shown.
Binary file not shown.
+126
View File
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{AC8F52F4-9FE6-4CEF-B549-8180757020C8}</ProjectGuid>
<RootNamespace>BlitzPointer</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetExt>.dll</TargetExt>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetExt>.dll</TargetExt>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>false</FunctionLevelLinking>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<Version>1.0</Version>
<LinkStatus>
</LinkStatus>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Version>1.0</Version>
<LinkStatus>
</LinkStatus>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
+16
View File
@@ -0,0 +1,16 @@
#pragma once
#include "dllmain.h"
bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return true;
}
+12
View File
@@ -0,0 +1,12 @@
// STL Exceptions
#include <exception>
#include <stdexcept>
// Memory Management
#include <memory>
// Platform specific: Windows
#include <windows.h>
// Macros
#define DLL_EXPORT extern "C" __declspec(dllexport)
+109
View File
@@ -0,0 +1,109 @@
// Original Code by Noodoby<http://www.blitzforum.de/forum/viewtopic.php?t=31651>
// Modified Code by Xaymar<http://project-kube.de>
#include "BlitzPointer.h"
DLL_EXPORT uint32_t BlitzPointer_GetReturnAddress() {
unsigned int StackPointer, ReturnAddress;
__asm { //ASM. Do touch if suicidal.
mov StackPointer, esp // Store current Stack Pointer
mov esp, ebp // On X86, EBP[0] is our own function and EBP[1] is the return address.
add esp, 4 // Which means that we can just take it from there into our own variable.
pop ReturnAddress // Just like this.
mov esp, [StackPointer] // And then reset the Stack Pointer.
}
return ReturnAddress;
}
DLL_EXPORT uint32_t BlitzPointer_GetFunctionPointer() {
unsigned int StackPointer, ReturnAddress;
__asm { //ASM. Do touch if suicidal.
mov StackPointer, esp // Store current Stack Pointer
mov esp, ebp // On X86, EBP[0] is our own function and EBP[1] is the return address.
add esp, 4 // Which means that we can just take it from there into our own variable.
pop ReturnAddress // Just like this.
mov esp, [StackPointer] // And then reset the Stack Pointer.
}
// let's look backwards in memory for the function signature (0x53 0x56 0x57 0x55 0x89 0xE5) for at most one megabyte.
uint8_t* startPtr = (uint8_t*)ReturnAddress;
uint8_t* endPtr = (uint8_t*)(ReturnAddress - 1048576);
for (uint8_t* curPtr = startPtr; curPtr != endPtr; curPtr--) {
if (*(curPtr) == 0x53) // push ebx
if (*(curPtr+1) == 0x56) // push esi
if (*(curPtr+2) == 0x57) // push edi
if (*(curPtr+3) == 0x55) // push ebp
if (*(curPtr + 4) == 0x89 && *(curPtr +5) == 0xE5) // mov ebp,esp
return (uint32_t)curPtr;
}
return 0;
}
DLL_EXPORT uint32_t BlitzPointer_CallFunction0(uint32_t fpFunctionPointer) {
uint32_t returnvalue;
__asm {
call dword ptr[fpFunctionPointer]
mov[returnvalue], eax
}
return returnvalue;
}
DLL_EXPORT uint32_t BlitzPointer_CallFunction1(uint32_t fpFunctionPointer, uint32_t p1) {
uint32_t returnvalue;
__asm {
sub esp, 0x4
mov eax, [p1]
mov[esp], eax
call dword ptr[fpFunctionPointer]
mov[returnvalue], eax
}
return returnvalue;
}
DLL_EXPORT uint32_t BlitzPointer_CallFunction2(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2) {
uint32_t returnvalue;
__asm {
sub esp, 0x8
mov eax, [p2]
mov[esp+4], eax
mov eax, [p1]
mov[esp], eax
call dword ptr[fpFunctionPointer]
mov[returnvalue], eax
}
return returnvalue;
}
DLL_EXPORT uint32_t BlitzPointer_CallFunction3(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2, uint32_t p3) {
uint32_t returnvalue;
__asm {
sub esp, 0xC
mov eax, [p3]
mov[esp + 8], eax
mov eax, [p2]
mov[esp + 4], eax
mov eax, [p1]
mov[esp], eax
call dword ptr[fpFunctionPointer]
mov[returnvalue], eax
}
return returnvalue;
}
DLL_EXPORT uint32_t BlitzPointer_CallFunction4(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4) {
uint32_t returnvalue;
__asm {
sub esp, 0x10
mov eax, [p4]
mov[esp + 12], eax
mov eax, [p3]
mov[esp + 8], eax
mov eax, [p2]
mov[esp + 4], eax
mov eax, [p1]
mov[esp], eax
call dword ptr[fpFunctionPointer]
mov[returnvalue], eax
}
return returnvalue;
}
+9
View File
@@ -0,0 +1,9 @@
#include "dllmain.h"
DLL_EXPORT uint32_t BlitzPointer_GetReturnAddress();
DLL_EXPORT uint32_t BlitzPointer_GetFunctionPointer();
DLL_EXPORT uint32_t BlitzPointer_CallFunction0(uint32_t fpFunctionPointer);
DLL_EXPORT uint32_t BlitzPointer_CallFunction1(uint32_t fpFunctionPointer, uint32_t p1);
DLL_EXPORT uint32_t BlitzPointer_CallFunction2(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2);
DLL_EXPORT uint32_t BlitzPointer_CallFunction3(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2, uint32_t p3);
DLL_EXPORT uint32_t BlitzPointer_CallFunction4(uint32_t fpFunctionPointer, uint32_t p1, uint32_t p2, uint32_t p3, uint32_t p4);
+149
View File
@@ -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
File diff suppressed because it is too large Load Diff
+156
View File
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{805CB1EB-82F0-405E-AC0B-03FBE82CC77D}</ProjectGuid>
<RootNamespace>BlitzSteam</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WholeProgramOptimization>false</WholeProgramOptimization>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetExt>.dll</TargetExt>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<TargetExt>.dll</TargetExt>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>
</SDLCheck>
<FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<WholeProgramOptimization>false</WholeProgramOptimization>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir);D:\Projects\Cpp\#Libraries\Steamworks SDK\public</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BufferSecurityCheck>false</BufferSecurityCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<FunctionLevelLinking>false</FunctionLevelLinking>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<Version>1.0</Version>
<AdditionalLibraryDirectories>D:\Projects\Cpp\#Libraries\Steamworks SDK\redistributable_bin</AdditionalLibraryDirectories>
<AdditionalDependencies>steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>
</LinkTimeCodeGeneration>
<OptimizeReferences>
</OptimizeReferences>
<LinkStatus>
</LinkStatus>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir);D:\Projects\Cpp\#Libraries\Steamworks SDK\public</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BufferSecurityCheck>false</BufferSecurityCheck>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Version>1.0</Version>
<AdditionalLibraryDirectories>D:\Projects\Cpp\#Libraries\Steamworks SDK\redistributable_bin</AdditionalLibraryDirectories>
<AdditionalDependencies>steam_api.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
<LinkStatus>
</LinkStatus>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="BlitzPointer.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="Steam.cpp" />
<ClCompile Include="SteamClient.cpp" />
<ClCompile Include="SteamUser.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BlitzPointer.h" />
<ClInclude Include="dllmain.h" />
</ItemGroup>
<ItemGroup>
<None Include="BlitzSteam.bb">
<Link>BlitzSteam.bb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="BlitzSteam.decls">
<Link>BlitzSteam.decls</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+44
View File
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source">
<UniqueIdentifier>{5016ba8f-d781-40f4-9904-56cc2ce9a588}</UniqueIdentifier>
</Filter>
<Filter Include="Source\Wrapper">
<UniqueIdentifier>{8f00e86e-e1bc-499e-8b2c-da93e9e8f287}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="Steam.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="SteamClient.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="SteamUser.cpp">
<Filter>Source</Filter>
</ClCompile>
<ClCompile Include="BlitzPointer.cpp">
<Filter>Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h">
<Filter>Source</Filter>
</ClInclude>
<ClInclude Include="BlitzPointer.h">
<Filter>Source</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="BlitzSteam.decls">
<Filter>Source</Filter>
</None>
<None Include="BlitzSteam.bb">
<Filter>Source</Filter>
</None>
</ItemGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
+32
View File
@@ -0,0 +1,32 @@
#include "dllmain.h"
#include "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;
}
}
+20
View File
@@ -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);
}
+7
View File
@@ -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_
+16
View File
@@ -0,0 +1,16 @@
#include "dllmain.h"
bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return true;
}
+15
View File
@@ -0,0 +1,15 @@
// STL Exceptions
#include <exception>
#include <stdexcept>
// Memory Management
#include <memory>
// Platform specific: Windows
#include <windows.h>
// Macros
#define DLL_EXPORT extern "C" __declspec(dllexport)
// Steam
#include "steam/steam_api.h"
+228
View File
@@ -0,0 +1,228 @@
;----------------------------------------------------------------
;-- Vector2
;----------------------------------------------------------------
Type Vector2
Field X#, Y#
End Type
Function Vector2_Create.Vector2(X#, Y#)
Local vec.Vector2 = New Vector2
vec\X = X
vec\Y = Y
Return vec
End Function
;----------------------------------------------------------------
;-- Vector3
;----------------------------------------------------------------
Type Vector3
Field X#, Y#, Z#
End Type
Function Vector3_Create.Vector3(X#, Y#, Z#)
Local vec.Vector3 = New Vector3
vec\X = X
vec\Y = Y
vec\Z = Z
Return vec
End Function
;----------------------------------------------------------------
;-- SQLite3
;----------------------------------------------------------------
;[Block] Return Codes / Error Codes
; Many SQLite functions return an integer result code from the set shown
; here in order to indicate success or failure.
;
; New error codes may be added in future versions of SQLite.
Const SQLITE_OK% = 0 ; Successful result
Const SQLITE_ERROR% = 1 ; SQL error or missing database
Const SQLITE_INTERNAL% = 2 ; Internal logic error in SQLite
Const SQLITE_PERM% = 3 ; Access permission denied
Const SQLITE_ABORT% = 4 ; Callback routine requested an abort
Const SQLITE_BUSY% = 5 ; The database file is locked
Const SQLITE_LOCKED% = 6 ; A table in the database is locked
Const SQLITE_NOMEM% = 7 ; A malloc() failed
Const SQLITE_READONLY% = 8 ; Attempt to write a readonly database
Const SQLITE_INTERRUPT% = 9 ; Operation terminated by SQLite3_Interrupt()
Const SQLITE_IOERR% = 10 ; Some kind of disk I/O error occurred
Const SQLITE_CORRUPT% = 11 ; The database disk image is malformed
Const SQLITE_NOTFOUND% = 12 ; Unknown opcode in sqlite3_file_control()
Const SQLITE_FULL% = 13 ; Insertion failed because database is full
Const SQLITE_CANTOPEN% = 14 ; Unable to open the database file
Const SQLITE_PROTOCOL% = 15 ; Database lock protocol error
Const SQLITE_EMPTY% = 16 ; Database is empty
Const SQLITE_SCHEMA% = 17 ; The database schema changed
Const SQLITE_TOOBIG% = 18 ; String or BLOB exceeds size limit
Const SQLITE_CONSTRAINT% = 19 ; Abort due to constraint violation
Const SQLITE_MISMATCH% = 20 ; Data type mismatch
Const SQLITE_MISUSE% = 21 ; Library used incorrectly
Const SQLITE_NOLFS% = 22 ; Uses OS features not supported on host
Const SQLITE_AUTH% = 23 ; Authorization denied
Const SQLITE_FORMAT% = 24 ; Auxiliary database format error
Const SQLITE_RANGE% = 25 ; 2nd parameter to sqlite3_bind out of range
Const SQLITE_NOTADB% = 26 ; File opened that is not a database file
Const SQLITE_NOTICE% = 27 ; Notifications from sqlite3_log()
Const SQLITE_WARNING% = 28 ; Warnings from sqlite3_log()
Const SQLITE_ROW% = 100 ; sqlite3_step() has another row ready
Const SQLITE_DONE% = 101 ; sqlite3_step() has finished executing
;[End Block]
;[Block] SQLite_Open Flags
; These bit values are intended for use in the
; 3rd parameter to the [sqlite3_open_v2()] interface.
Const SQLITE_OPEN_READONLY% = $00000001
Const SQLITE_OPEN_READWRITE% = $00000002
Const SQLITE_OPEN_CREATE% = $00000004
Const SQLITE_OPEN_URI% = $00000040
Const SQLITE_OPEN_MEMORY% = $00000080
Const SQLITE_OPEN_NOMUTEX% = $00008000
Const SQLITE_OPEN_FULLMUTEX% = $00010000
Const SQLITE_OPEN_SHAREDCACHE% = $00020000
Const SQLITE_OPEN_PRIVATECACHE% = $00040000
;[End Block]
;[Block] Column Type
Const SQLITE_UNKNOWN = 0
Const SQLITE_INTEGER = 1
Const SQLITE_REAL = 2
Const SQLITE_FLOAT = 2
Const SQLITE_DOUBLE = 2
Const SQLITE_TEXT = 3
Const SQLITE_STRING = 3
Const SQLITE_BLOB = 4
Const SQLITE_NULL = 5
;[End Block]
;[Block] Internal Types
Type SQLite_Container
Field Pointer%
End Type
Type SQLite_Int64
Field Left%, Right%
End Type
;[End Block]
Function SQLite_Open%(File$, Flags% = $00000006)
; Create a Container to hold the database pointer.
Local Container.SQLite_Container = New SQLite_Container
Local ErrCode = SQLite3_Open_V2(File, Container, Flags, 0)
Local Database = Container\Pointer
Delete Container
If ErrCode = SQLITE_OK
Return Database
Else
Return False
EndIf
End Function
Function SQLite_Execute(Database, SQL$)
Return SQLite3_Exec(Database, SQL, 0, 0, 0)
End Function
Function SQLite_Prepare(Database, SQL$)
Local Container.SQLite_Container = New SQLite_Container
Local ErrCode = SQLite3_Prepare(Database, SQL$, -1, Container, 0)
Local Statement = Container\Pointer
Delete Container
If ErrCode = SQLITE_OK
Return Statement
Else
Return False
EndIf
End Function
Global SQLite_Column_Int64_L%, SQLite_Column_Int64_R%
Function SQLite_Column_Int64(Statement, ColumnIndex%)
Local Result.SQLite_Int64 = New SQLite_Int64
SQLite3_Column_Int64(Statement, ColumnIndex, Result)
SQLite_Column_Int64_L = Result\Left
SQLite_Column_Int64_R = Result\Right
Delete Result
End Function
Function SQLite_Bind_Text(Statement, ColumnIndex%, Value$)
Return SQLite3_Bind_Text(Statement, ColumnIndex, Value, -1, -1)
End Function
Function SQLite_Bind_Blob(Statement, ColumnIndex%, Bank)
If Bank <> 0 Then
Local Size% = BankSize(Bank)
Return SQLite3_Bind_Blob(Statement, ColumnIndex, Bank, Size, 0)
EndIf
End Function
;----------------------------------------------------------------
;-- Helpers
;----------------------------------------------------------------
Type BlitzUtility_Rectangle
Field X,Y,X2,Y2
End Type
Type BlitzUtility_Point
Field X,Y
End Type
Global BlitzUtility_Rect.BlitzUtility_Rectangle = New BlitzUtility_Rectangle
Global BlitzUtility_Point.BlitzUtility_Point = New BlitzUtility_Point
Function BlitzUtility_LockPointerToWindow(hwnd=0)
If hwnd = 0 Then
BlitzUtility_User32_ClipCursorI(0)
Else
BlitzUtility_User32_GetWindowRect(hwnd, BlitzUtility_Rect)
;Grab TopLeft
BlitzUtility_Point\X = BlitzUtility_Rect\X
BlitzUtility_Point\Y = BlitzUtility_Rect\Y
BlitzUtility_Rect\X = BlitzUtility_Point\X
BlitzUtility_Rect\Y = BlitzUtility_Point\Y
;Grab BottomRight
BlitzUtility_Point\X = BlitzUtility_Rect\X2 - 1
BlitzUtility_Point\Y = BlitzUtility_Rect\Y2 - 1
BlitzUtility_Rect\X2 = BlitzUtility_Point\X
BlitzUtility_Rect\Y2 = BlitzUtility_Point\Y
BlitzUtility_User32_ClipCursor(BlitzUtility_Rect)
EndIf
End Function
Function BlitzUtility_LockPointerToWindowAuto(hwnd=0)
If BlitzUtility_User32_GetActiveWindow() = hwnd Then
BlitzUtility_LockPointerToWindow(hwnd)
Else
BlitzUtility_LockPointerToWindow(0)
EndIf
End Function
Function BlitzUtility_BorderlessWindowmode(hwnd=0, MonitorId=0, Width=0, Height=0)
If hwnd = 0 Then hwnd = SystemProperty("AppHwnd")
BlitzUtility_EnumerateDisplays()
Local dispCnt = BlitzUtility_GetDisplayCount()
If MonitorId < 0 Then MonitorId = 0
If MonitorId >= dispCnt Then MonitorId = dispCnt - 1
Local rct.BlitzUtility_Rectangle = New BlitzUtility_Rectangle
BlitzUtility_GetDisplay(MonitorId, rct)
rct\X = rct\X + (rct\X2 / 2.0) - Width / 2.0
rct\Y = rct\Y + (rct\Y2 / 2.0) - Height / 2.0
rct\X2 = Width
rct\Y2 = Height
BlitzUtility_User32_SetWindowLong hwnd, -16, $01000000
BlitzUtility_User32_SetWindowPos hwnd, 0, rct\X, rct\Y, rct\X2, rct\Y2, 64
Delete rct
End Function
Function FlushFile(File%)
Return BlitzUtility_Kernel32_FlushFileBuffers(File)
End Function
;~IDEal Editor Parameters:
;~F#20#46#54
;~C#Blitz3D
+224
View File
@@ -0,0 +1,224 @@
.lib "User32.dll"
BlitzUtility_User32_ClientToScreen%(hwnd%, point*) : "ClientToScreen"
BlitzUtility_User32_ClipCursor%(rect*) : "ClipCursor"
BlitzUtility_User32_ClipCursorI%(ptr%) : "ClipCursor"
BlitzUtility_User32_GetActiveWindow%() : "GetActiveWindow"
BlitzUtility_User32_GetSystemMetrics%(index%) : "GetSystemMetrics"
BlitzUtility_User32_SetWindowLong%(hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
BlitzUtility_User32_GetWindowLong%(hwnd%, index%) : "GetWindowLongA"
BlitzUtility_User32_GetWindowRect%(hwnd%, rect*) : "GetWindowRect"
BlitzUtility_User32_GetClientRect%(hwnd%, rect*) : "GetClientRect"
BlitzUtility_User32_SetWindowPos%(hwnd%, hWndInsertAfter%, x%, y%, cx%, cy%, wFlags%) : "SetWindowPos"
.lib "Kernel32.dll"
BlitzUtility_Kernel32_FlushFileBuffers%(hFile%) : "FlushFileBuffers"
.lib "BlitzUtility.dll"
; Containers - BlitzList
BU_BlitzList_New%(obj*) : "BlitzList_New"
BU_BlitzList_Activate(list%) : "BlitzList_Activate"
BU_BlitzList_Deactivate(list%) : "BlitzList_Deactivate"
BU_BlitzList_Destroy(list%) : "BlitzList_Delete"
; Containers - BlitzList - Backward Compatability
BlitzUtility_List_New%(obj*) : "BlitzList_New"
BlitzUtility_List_Activate(list%) : "BlitzList_Activate"
BlitzUtility_List_Deactivate(list%) : "BlitzList_Deactivate"
BlitzUtility_List_Destroy(list%) : "BlitzList_Delete"
; Database - SQLite3
SQLite3_LibVersion$() : "sqlite3_libversion"
; Opening and Closing ------------------------------------------------
SQLite3_Open%(Filename$, DatabaseHandle*) : "sqlite3_open"
SQLite3_Open_V2%(Filename$, DatabaseHandle*, Flags%, VFS%) : "sqlite3_open_v2"
SQLite3_Close%(DatabaseHandle) : "sqlite3_close"
; Misc ---------------------------------------------------------------
SQLite3_Busy_TimeOut%(DatabaseHandle, TimeOut) : "sqlite3_busy_timeout"
SQLite3_Get_AutoCommit%(DatabaseHandle) : "sqlite3_get_autocommit"
SQLite3_Interrupt(DatabaseHandle) : "sqlite3_interrupt"
; Errors -------------------------------------------------------------
SQLite3_ErrCode%(DatabaseHandle) : "sqlite3_errcode"
SQLite3_ErrMsg$(DatabaseHandle) : "sqlite3_errmsg"
; Executing SQL without results --------------------------------------
; As Blitz3D doesn't have function pointers the CallBack is pointless
; and this can only really be used for result-less SQL statements.
; Also, I've never got the Error return to work. So just pass in
; zeros for the last three parameters and use SQLite3_ErrMsg if you
; need to get the error message.
SQLite3_Exec%(DatabaseHandle, SQL$, CallBack, FirstParam, Error) : "sqlite3_exec"
SQLite3_Changes%(DatabaseHandle) : "sqlite3_changes"
SQLite3_Total_Changes%(DatabaseHandle) : "sqlite3_total_changes"
SQLite3_Last_Insert_RowID%(DatabaseHandle) : "sqlite3_last_insert_rowid"
; Executing SQL with results -----------------------------------------
; Never got the SQLTail to work so just pass in a zero.
SQLite3_Prepare%(DatabaseHandle, SQL$, LengthOfSQL, StatementHandle*, SQLTail) : "sqlite3_prepare"
SQLite3_Step%(StatementHandle) : "sqlite3_step"
SQLite3_Reset%(StatementHandle) : "sqlite3_reset"
SQLite3_Finalize%(StatementHandle) : "sqlite3_finalize"
SQLite3_Data_Count%(StatementHandle) : "sqlite3_data_count"
SQLite3_DB_Handle%(StatementHandle) : "sqlite3_db_handle"
; SQL Parameter Binding ----------------------------------------------
SQLite3_Bind_Parameter_Count%(StatementHandle) : "sqlite3_bind_parameter_count"
SQLite3_Bind_Parameter_Index%(StatementHandle, ParameterName$) : "sqlite3_bind_parameter_index"
SQLite3_Bind_Parameter_Name$(StatementHandle, ParameterIndex) : "sqlite3_bind_parameter_name"
; Never tested this for real, but it should work.
SQLite3_Transfer_Bindings%(StatementHandle1, StatementHandle2) : "sqlite3_transfer_bindings"
SQLite3_Bind_Null%(StatementHandle, Index) : "sqlite3_bind_null"
SQLite3_Bind_Int%(StatementHandle, Index, Value) : "sqlite3_bind_int"
; If you pass -1 for LengthOfText it will work it out for itself. Pass a zero in for Destructor.
SQLite3_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
; Never tried this so it probably won't work. Pass a zero in for Destructor.
SQLite3_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
; Doesn't seem to work unfortunately.
SQLite3_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
; Helpers
SQLite3_Bind_Int64%(StatementHandle, Index, Left, Right) : "sqlite3_bind_int64_ex"
SQLite3_Bind_Float%(StatementHandle, Index, Value#) : "sqlite3_bind_float"
; Getting values from executed SQL ----------------------------------
SQLite3_Column_Count%(StatementHandle) : "sqlite3_column_count"
SQLite3_Column_Name$(StatementHandle, ColumnIndex) : "sqlite3_column_name"
SQLite3_Column_Type%(StatementHandle, ColumnIndex) : "sqlite3_column_type"
SQLite3_Column_DeclType$(StatementHandle, ColumnIndex) : "sqlite3_column_decltype"
SQLite3_Column_Int%(StatementHandle, ColumnIndex) : "sqlite3_column_int"
SQLite3_Column_Double#(StatementHandle, ColumnIndex) : "sqlite3_column_double"
SQLite3_Column_Text$(StatementHandle, ColumnIndex) : "sqlite3_column_text"
SQLite3_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_bytes"
; Never tried this so it probably won't work.
SQLite3_Column_Blob%(StatementHandle, ColumnIndex) : "sqlite3_column_blob"
; Helpers
SQLite3_Column_Int64(StatementHandle, ColumnIndex, outPtr*) : "sqlite3_column_int64_ex"
SQLite3_Column_Float#(StatementHandle, ColumnIndex) : "sqlite3_column_float"
; Helpers ------------------------------------------------------------
SQLite_Version$() : "sqlite3_libversion"
SQLite_Close%(DatabaseHandle) : "sqlite3_close"
SQLite_SetTimeOut%(DatabaseHandle, TimeOut) : "sqlite3_busy_timeout"
SQLite_Get_AutoCommit%(DatabaseHandle) : "sqlite3_get_autocommit"
SQLite_Interrupt(DatabaseHandle) : "sqlite3_interrupt"
SQLite_ErrCode%(DatabaseHandle) : "sqlite3_errcode"
SQLite_ErrMsg$(DatabaseHandle) : "sqlite3_errmsg"
SQLite_Changes%(DatabaseHandle) : "sqlite3_changes"
SQLite_Total_Changes%(DatabaseHandle) : "sqlite3_total_changes"
SQLite_Last_Insert_RowID%(DatabaseHandle) : "sqlite3_last_insert_rowid"
SQLite_Step%(StatementHandle) : "sqlite3_step"
SQLite_Reset%(StatementHandle) : "sqlite3_reset"
SQLite_Finalize%(StatementHandle) : "sqlite3_finalize"
SQLite_Data_Count%(StatementHandle) : "sqlite3_data_count"
SQLite_DB_Handle%(StatementHandle) : "sqlite3_db_handle"
SQLite_Bind_Parameter_Count%(StatementHandle) : "sqlite3_bind_parameter_count"
SQLite_Bind_Parameter_Index%(StatementHandle, ParameterName$) : "sqlite3_bind_parameter_index"
SQLite_Bind_Parameter_Name$(StatementHandle, ParameterIndex) : "sqlite3_bind_parameter_name"
SQLite_Transfer_Bindings%(StatementHandle1, StatementHandle2) : "sqlite3_transfer_bindings"
SQLite_Bind_Null%(StatementHandle, Index) : "sqlite3_bind_null"
SQLite_Bind_Int%(StatementHandle, Index, Value) : "sqlite3_bind_int"
SQLite_Bind_Int64%(StatementHandle, Index, Left, Right) : "sqlite3_bind_int64_ex"
;SQLite_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
;SQLite_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
SQLite_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
SQLite_Bind_Float%(StatementHandle, Index, Value#) : "sqlite3_bind_float"
SQLite_Column_Count%(StatementHandle) : "sqlite3_column_count"
SQLite_Column_Name$(StatementHandle, ColumnIndex) : "sqlite3_column_name"
SQLite_Column_Type%(StatementHandle, ColumnIndex) : "sqlite3_column_type"
SQLite_Column_DeclType$(StatementHandle, ColumnIndex) : "sqlite3_column_decltype"
SQLite_Column_Int%(StatementHandle, ColumnIndex) : "sqlite3_column_int"
SQLite_Column_Double#(StatementHandle, ColumnIndex) : "sqlite3_column_double"
SQLite_Column_Text$(StatementHandle, ColumnIndex) : "sqlite3_column_text"
SQLite_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_bytes"
SQLite_Column_Blob%(StatementHandle, ColumnIndex) : "sqlite3_column_blob"
SQLite_Column_Float#(StatementHandle, ColumnIndex) : "sqlite3_column_float"
; Math - Vector2
Vector2_Set(vector*, value#) : "Vector2_Set"
Vector2_SetP(vector*, x#, y#) : "Vector2_SetP"
Vector2_SetV(vector*, other*) : "Vector2_SetV"
Vector2_Add(vector*, value#) : "Vector2_Add"
Vector2_AddP(vector*, x#, y#) : "Vector2_AddP"
Vector2_AddV(vector*, other*) : "Vector2_AddV"
Vector2_Sub(vector*, value#) : "Vector2_Sub"
Vector2_SubP(vector*, x#, y#) : "Vector2_SubP"
Vector2_SubV(vector*, other*) : "Vector2_SubV"
Vector2_Mul(vector*, value#) : "Vector2_Mul"
Vector2_MulP(vector*, x#, y#) : "Vector2_MulP"
Vector2_MulV(vector*, other*) : "Vector2_MulV"
Vector2_Div(vector*, value#) : "Vector2_Div"
Vector2_DivP(vector*, x#, y#) : "Vector2_DivP"
Vector2_DivV(vector*, other*) : "Vector2_DivV"
Vector2_Length#(vector*) : "Vector2_Length"
Vector2_DistanceP#(vector*, x#, y#) : "Vector2_DistanceP"
Vector2_DistanceV#(vector*, other*) : "Vector2_DistanceV"
Vector2_DotP#(vector*, x#, y#) : "Vector2_DotP"
Vector2_DotV#(vector*, other*) : "Vector2_DotV"
Vector2_Normalize(vector*) : "Vector2_Normalize"
Vector2_Rotate(vector*, rotation#) : "Vector2_Rotate"
Vector2_RotateAroundP(vector*, x#, y#, rotation#) : "Vector2_RotateAroundP"
Vector2_RotateAroundV(vector*, other*, rotation#) : "Vector2_RotateAroundV"
Vector2_DeltaRotation#(vector*) : "Vector2_DeltaRotation"
Vector2_DeltaRotationP#(vector*, x#, y#) : "Vector2_DeltaRotationP"
Vector2_DeltaRotationV#(vector*, other*) : "Vector2_DeltaRotationV"
Vector2_Serialize$(vector*) : "Vector2_Serialize"
Vector2_Deserialize(vector*, serial$) : "Vector2_Deserialize"
; Math - Vector3
Vector3_Set(vector*, value#) : "Vector3_Set"
Vector3_SetP(vector*, x#, y#, z#) : "Vector3_SetP"
Vector3_SetV(vector*, other*) : "Vector3_SetV"
Vector3_Add(vector*, value#) : "Vector3_Add"
Vector3_AddP(vector*, x#, y#, z#) : "Vector3_AddP"
Vector3_AddV(vector*, other*) : "Vector3_AddV"
Vector3_Sub(vector*, value#) : "Vector3_Sub"
Vector3_SubP(vector*, x#, y#, z#) : "Vector3_SubP"
Vector3_SubV(vector*, other*) : "Vector3_SubV"
Vector3_Mul(vector*, value#) : "Vector3_Mul"
Vector3_MulP(vector*, x#, y#, z#) : "Vector3_MulP"
Vector3_MulV(vector*, other*) : "Vector3_MulV"
Vector3_Div(vector*, value#) : "Vector3_Div"
Vector3_DivP(vector*, x#, y#, z#) : "Vector3_DivP"
Vector3_DivV(vector*, other*) : "Vector3_DivV"
Vector3_Length#(vector*) : "Vector3_Length"
Vector3_DistanceP#(vector*, x#, y#, z#) : "Vector3_DistanceP"
Vector3_DistanceV#(vector*, other*) : "Vector3_DistanceV"
Vector3_DotP#(vector*, x#, y#, z#) : "Vector3_DotP"
Vector3_DotV#(vector*, other*) : "Vector3_DotV"
Vector3_CrossP(vector*, x#, y#, z#, out*) : "Vector3_CrossP"
Vector3_CrossV(vector*, other*, out*) : "Vector3_CrossV"
Vector3_Normalize(vector*) : "Vector3_Normalize"
Vector3_Rotate(vector*, pitch#, yaw#, roll#) : "Vector3_Rotate"
Vector3_RotateAroundP(vector*, x#, y#, z#, pitch#, yaw#, roll#) : "Vector3_RotateAroundP"
Vector3_RotateAroundV(vector*, other*, pitch#, yaw#, roll#) : "Vector3_RotateAroundV"
Vector3_DeltaPitch#(vector*) : "Vector3_DeltaPitch"
Vector3_DeltaPitchP#(vector*, x#, y#, z#) : "Vector3_DeltaPitchP"
Vector3_DeltaPitchV#(vector*, other*) : "Vector3_DeltaPitchV"
Vector3_DeltaYaw#(vector*) : "Vector3_DeltaYaw"
Vector3_DeltaYawP#(vector*, x#, y#, z#) : "Vector3_DeltaYawP"
Vector3_DeltaYawV#(vector*, other*) : "Vector3_DeltaYawV"
Vector3_Serialize$(vector*) : "Vector3_Serialize"
Vector3_Deserialize(vector*, serial$) : "Vector3_Deserialize"
; Utility - Displays
BU_Display_Enumerate() : "Display_Enumerate"
BU_Display_Count%() : "Display_Count"
BU_Display_Get(id%, rectangle*) : "Display_Get"
; Utility - Displays - Backward Compatability
BlitzUtility_EnumerateDisplays() : "Display_Enumerate"
BlitzUtility_GetDisplayCount%() : "Display_Count"
BlitzUtility_GetDisplay(id%, rectangle*) : "Display_Get"
; Utility - Indexing
BU_Indexer_Create%() : "Indexer_Create"
BU_Indexer_GetFreeIndex%(indexer%) : "Indexer_GetFreeIndex"
BU_Indexer_MarkFreeIndex(indexer%, index%) : "Indexer_MarkFreeIndex"
BU_Indexer_Destroy(indexer%) : "Indexer_Destroy"
; Utility - Indexing - Backward Compatability
Indexer_Create%() : "Indexer_Create"
Indexer_GetFreeIndex%(indexer%) : "Indexer_GetFreeIndex"
Indexer_MarkFreeIndex(indexer%, index%) : "Indexer_MarkFreeIndex"
Indexer_Destroy(indexer%) : "Indexer_Destroy"
; Utility - Window Messages
BU_WindowMessageHandler_InstallHandler(hwnd%) : "WindowMessageHandler_Install"
BU_WindowMessageHandler_UninstallHandler(hwnd%) : "WindowMessageHandler_Uninstall"
BU_WindowMessageHandler_Message_Close%(hwnd%) : "WindowMessageHandler_Message_Close"
BU_WindowMessageHandler_Message_Destroy%(hwnd%) : "WindowMessageHandler_Message_Destroy"
BU_WindowMessageHandler_Message_Resize%(hwnd%, point*) : "WindowMessageHandler_Message_Resize"
; Utility - Window Messages - Backward Compatability
BlitzUtility_InstallCloseHandler(hwnd%) : "WindowMessageHandler_InstallHandler"
BlitzUtility_UninstallCloseHandler(hwnd%) : "WindowMessageHandler_UninstallHandler"
BlitzUtility_GetCloseCount%(hwnd%) : "WindowMessageHandler_CountCloseMessages"
+174
View File
@@ -0,0 +1,174 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{C08C5F9A-0C63-4798-A93F-FE96C014074B}</ProjectGuid>
<RootNamespace>BlitzUtility</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v120</PlatformToolset>
<WholeProgramOptimization>false</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)\Build\$(ProjectName)\$(Configuration)\</OutDir>
<IntDir>$(SolutionDir)\Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>SQLITE_ENABLE_FTS4;SQLITE_ENABLE_RTREE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<BufferSecurityCheck>false</BufferSecurityCheck>
<FunctionLevelLinking>false</FunctionLevelLinking>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<Version>1.0</Version>
<LinkStatus>
</LinkStatus>
</Link>
<CustomBuildStep>
<Message>Copying Resources</Message>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Full</Optimization>
<FunctionLevelLinking>false</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>
</SDLCheck>
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<PreprocessorDefinitions>SQLITE_ENABLE_FTS4;SQLITE_ENABLE_RTREE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<CompileAsManaged>false</CompileAsManaged>
<CompileAsWinRT>false</CompileAsWinRT>
<MultiProcessorCompilation>false</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StructMemberAlignment>4Bytes</StructMemberAlignment>
<BufferSecurityCheck>false</BufferSecurityCheck>
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
<FloatingPointExceptions>
</FloatingPointExceptions>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<OpenMPSupport>false</OpenMPSupport>
<ForcedIncludeFiles>dllmain.h</ForcedIncludeFiles>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
</ClCompile>
<Link>
<GenerateDebugInformation>false</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<Version>1.0</Version>
<LinkStatus>
</LinkStatus>
</Link>
<CustomBuildStep>
<Message>Copying Resources</Message>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="dllmain.h" />
<ClInclude Include="Containers\BlitzList.h" />
<ClInclude Include="Utility\Indexer.h" />
<ClInclude Include="Database\SQLite\SQLite.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Database\SQLite\sqlite3.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Math\Matrix3.h" />
<ClInclude Include="Math\Vector2.h" />
<ClInclude Include="Math\Vector3.h" />
<ClInclude Include="Utility\Display.h" />
<ClInclude Include="Utility\WindowMessageHandler.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="Containers\BlitzList.cpp" />
<ClCompile Include="Utility\Indexer.cpp" />
<ClCompile Include="Database\SQLite\SQLite.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Database\SQLite\sqlite3.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Math\Matrix3.cpp" />
<ClCompile Include="Math\Vector3.cpp" />
<ClCompile Include="Math\Vector2.cpp" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="Utility\Display.cpp" />
<ClCompile Include="Utility\WindowMessageHandler.cpp" />
</ItemGroup>
<ItemGroup>
<None Include="BlitzUtility.bb">
<Link>BlitzUtility.bb</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="BlitzUtility.decls">
<Link>BlitzUtility.decls</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Source Files\Utility">
<UniqueIdentifier>{48292af9-63a5-40ae-a447-ad7cecfddd8a}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Containers">
<UniqueIdentifier>{ff6bcb4d-9140-40a9-80dd-3698b63bd1c1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Database">
<UniqueIdentifier>{4b84c339-4e83-489c-b421-2cf9fd9e72d1}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Database\SQLite">
<UniqueIdentifier>{3ac37a01-a835-479c-b0b0-ecfd04640134}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Math">
<UniqueIdentifier>{38444b44-ebf1-4cae-a1a3-1a0b80b045a1}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="dllmain.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Containers\BlitzList.cpp">
<Filter>Source Files\Containers</Filter>
</ClCompile>
<ClCompile Include="Database\SQLite\SQLite.cpp">
<Filter>Source Files\Database\SQLite</Filter>
</ClCompile>
<ClCompile Include="Database\SQLite\sqlite3.c">
<Filter>Source Files\Database\SQLite</Filter>
</ClCompile>
<ClCompile Include="Math\Matrix3.cpp">
<Filter>Source Files\Math</Filter>
</ClCompile>
<ClCompile Include="Math\Vector2.cpp">
<Filter>Source Files\Math</Filter>
</ClCompile>
<ClCompile Include="Math\Vector3.cpp">
<Filter>Source Files\Math</Filter>
</ClCompile>
<ClCompile Include="Utility\Display.cpp">
<Filter>Source Files\Utility</Filter>
</ClCompile>
<ClCompile Include="Utility\Indexer.cpp">
<Filter>Source Files\Utility</Filter>
</ClCompile>
<ClCompile Include="Utility\WindowMessageHandler.cpp">
<Filter>Source Files\Utility</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h">
<Filter>Source Files</Filter>
</ClInclude>
<ClInclude Include="Containers\BlitzList.h">
<Filter>Source Files\Containers</Filter>
</ClInclude>
<ClInclude Include="Database\SQLite\SQLite.h">
<Filter>Source Files\Database\SQLite</Filter>
</ClInclude>
<ClInclude Include="Database\SQLite\sqlite3.h">
<Filter>Source Files\Database\SQLite</Filter>
</ClInclude>
<ClInclude Include="Math\Matrix3.h">
<Filter>Source Files\Math</Filter>
</ClInclude>
<ClInclude Include="Math\Vector2.h">
<Filter>Source Files\Math</Filter>
</ClInclude>
<ClInclude Include="Math\Vector3.h">
<Filter>Source Files\Math</Filter>
</ClInclude>
<ClInclude Include="Utility\Display.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
<ClInclude Include="Utility\Indexer.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
<ClInclude Include="Utility\WindowMessageHandler.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="BlitzUtility.decls">
<Filter>Source Files</Filter>
</None>
<None Include="BlitzUtility.bb">
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
+67
View File
@@ -0,0 +1,67 @@
#pragma once
#include "BlitzList.h"
std::list<BlitzTypeInfo*>* BlitzUtility_Lists;
void BlitzList_OnProcessAttach() {
BlitzUtility_Lists = new std::list<BlitzTypeInfo*>();
}
void BlitzList_OnProcessDetach() {
BlitzUtility_Lists->clear();
delete BlitzUtility_Lists;
}
DLL_EXPORT void* BlitzList_New(void* elementPtr) {
BBVarElement* element = (BBVarElement*)(((int*)elementPtr) - 5);
BBVarType* type = (BBVarType*)(*(((int*)elementPtr) - 2));
// Create and initialize structure to hold information about this change.
BlitzTypeInfo* bti = new BlitzTypeInfo();
bti->type = type;
// Store list pointers.
bti->ourNextPtr = element;
bti->ourPrevPtr = element;
// Remove passed object from the flow of the old list.
element->prevPtr->nextPtr = element->nextPtr;
element->nextPtr->prevPtr = element->prevPtr;
// Correct element next/prev pointers to no longer be inside the old list.
element->prevPtr = (BBVarElement*)((int*)type + 1);
element->nextPtr = (BBVarElement*)((int*)type + 1);
BlitzUtility_Lists->push_back(bti);
return bti;
}
DLL_EXPORT void BlitzList_Activate(void* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
// Store current pointers
bti->lastNextPtr = bti->type->used.nextPtr;
bti->lastPrevPtr = bti->type->used.prevPtr;
// ... and replace them.
bti->type->used.nextPtr = bti->ourNextPtr;
bti->type->used.prevPtr = bti->ourPrevPtr;
}
DLL_EXPORT void BlitzList_Deactivate(void* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
// Store current pointers
bti->ourNextPtr = bti->type->used.nextPtr;
bti->ourPrevPtr = bti->type->used.prevPtr;
// ... and replace them.
bti->type->used.nextPtr = bti->lastNextPtr;
bti->type->used.prevPtr = bti->lastPrevPtr;
}
DLL_EXPORT void BlitzList_Delete(void* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
BlitzUtility_Lists->remove(bti);
delete bti;
}
+47
View File
@@ -0,0 +1,47 @@
#pragma once
#include "dllmain.h"
#include <memory>
#include <sstream>
#include <iomanip>
#include <list>
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
#define BBVARTYPE_GLOBAL 0
#define BBVARTYPE_INT 1
#define BBVARTYPE_FLOAT 2
#define BBVARTYPE_UNUSED 3
#define BBVARTYPE_STRING 4
#define BBVARTYPE_TYPE 5
#define BBVARTYPE_ARRAY 6
struct BBVar {
unsigned int Type;
};
struct BBVarElement {
int* currentPtr; // Points towards fields.
BBVarElement* nextPtr;
BBVarElement* prevPtr;
void* BBVarTypePtr;
unsigned int refCount; // Fields usually follow here, may be at another location, see currentPtr.
};
struct BBVarType : BBVar {
BBVarElement used, free;
unsigned int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
//BBVar* fields[];
};
struct BlitzTypeInfo {
BBVarType *type;
BBVarElement *lastNextPtr, *lastPrevPtr;
BBVarElement *ourNextPtr, *ourPrevPtr;
};
void BlitzList_OnProcessAttach();
void BlitzList_OnProcessDetach();
DLL_EXPORT void* BlitzList_New(void* type);
DLL_EXPORT void BlitzList_Activate(void* list);
DLL_EXPORT void BlitzList_Deactivate(void* list);
DLL_EXPORT void BlitzList_Delete(void* list);
+30
View File
@@ -0,0 +1,30 @@
#pragma once
#include "SQLite.h"
void SQLite3_OnProcessAttach() {
sqlite3_initialize();
}
void SQLite3_OnProcessDetach() {
sqlite3_shutdown();
}
DLL_EXPORT int sqlite3_bind_int64_ex(void* stmtPtr, uint32_t index, uint32_t low, uint32_t high) {
return sqlite3_bind_int64((sqlite3_stmt*)stmtPtr, index, (((uint64_t)low << 32) + (uint64_t)high));
}
DLL_EXPORT int sqlite3_bind_float(void* stmtPtr, uint32_t index, float value) {
return sqlite3_bind_double((sqlite3_stmt*)stmtPtr, index, (double)value);
}
DLL_EXPORT void sqlite3_column_int64_ex(void* stmtPtr, uint32_t index, void* outPtr) {
sqlite3_int64 out = sqlite3_column_int64((sqlite3_stmt*)stmtPtr, index);
int* ourPtr = (int*)outPtr;
(*ourPtr) = (int)(out & 0xFFFFFFFF);
(*(ourPtr + 1)) = (int)(out >> 32);
}
DLL_EXPORT float sqlite3_column_float(void* stmtPtr, uint32_t index) {
double out = sqlite3_column_double((sqlite3_stmt*)stmtPtr, index);
return (float)out;
}
+14
View File
@@ -0,0 +1,14 @@
#include "dllmain.h"
#include <list>
#include "sqlite3.h"
void SQLite3_OnProcessAttach();
void SQLite3_OnProcessDetach();
extern "C" {
DLL_EXPORT int sqlite3_bind_int64_ex(void* stmtPtr, uint32_t index, uint32_t low, uint32_t high);
DLL_EXPORT int sqlite3_bind_float(void* stmtPtr, uint32_t index, float value);
DLL_EXPORT void sqlite3_column_int64_ex(void* stmtPtr, uint32_t index, void* outPtr);
DLL_EXPORT float sqlite3_column_float(void* stmtPtr, uint32_t index);
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+132
View File
@@ -0,0 +1,132 @@
#include "Common.h"
#include <memory>
#include <sstream>
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
#define BBVARTYPE_GLOBAL 0
#define BBVARTYPE_INT 1
#define BBVARTYPE_FLOAT 2
#define BBVARTYPE_UNUSED 3
#define BBVARTYPE_STRING 4
#define BBVARTYPE_TYPE 5
#define BBVARTYPE_ARRAY 6
struct BBVar {
int Type = -1;
};
struct BBVarGlobal {
int GlobalType = -1;
int* Value;
};
struct BBVarInt : BBVar {
int Value;
};
struct BBVarFloat : BBVar {
float Value;
};
struct BBVarUnused : BBVar {
// Not a Dim, as you can see here:
// https://github.com/blitz-research/blitz3d/blob/master/compiler/stmtnode.cpp#L86
};
struct BBVarString : BBVar {
int Length;
char* Value;
};
struct BBVarElement;
struct BBVarType : BBVar {
BBVarElement used, free;
int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
int* fields[];
};
struct BBVarElement {
int* currentPtr; // Points towards fields.
int* nextPtr, prevPtr;
BBVarType* BBStructPtr;
int refCount; // Fields usually follow here, may be at another location, see currentPtr.
//BBVar* fields[];
};
struct BBVarArray : BBVar {
int Size; //???
BBVar* ArrayType;
};
std::string BBVar_Serialize(void* obj) {
std::stringstream myStream;
BBVar* var = (BBVar*)obj;
switch (var->Type) {
case BBVARTYPE_GLOBAL:
BBVarGlobal* varGlobal = (BBVarGlobal*)obj;
myStream << "[Global] " << BBVar_Serialize(varGlobal->Value) << std::endl;
break;
case BBVARTYPE_INT:
BBVarInt* varInt = (BBVarInt*)obj;
myStream << "Int" << std::endl;
break;
case BBVARTYPE_FLOAT:
BBVarFloat* varFloat = (BBVarFloat*)obj;
myStream << "Float" << std::endl;
break;
case BBVARTYPE_UNUSED:
BBVarUnused* varUnused = (BBVarUnused*)obj;
myStream << "Unused" << std::endl;
break;
case BBVARTYPE_STRING:
BBVarString* varString = (BBVarString*)obj;
myStream << "String" << std::endl;
break;
case BBVARTYPE_TYPE:
BBVarType* varType = (BBVarType*)obj;
myStream << BBVarType_Serialize(varType);
break;
case BBVARTYPE_ARRAY:
BBVarArray* varArray = (BBVarArray*)obj;
myStream << "Array = " << std::endl;
break;
}
return myStream.str();
}
std::string BBVarType_Serialize(BBVarType* obj, unsigned int indent = 0) {
std::stringstream myStream;
std::stringstream myPaddingSS;
for (unsigned int pad = 0; pad < indent; pad++) {
myPaddingSS << " ";
}
std::string myPadding = myPaddingSS.str();
myStream << myPadding << "Type {" << std::endl;
for (unsigned int fld = 0; fld < obj->fieldCount; fld++) {
myStream << myPadding << " (" << fld << ") => " << BBVar_Serialize(obj->fields[fld]) << std::endl;
}
myStream << myPadding << "}" << std::endl;
return myStream.str();
}
DLL_EXPORT(char*) SerializeObject(void* obj) {
return strdup(BBVar_Serialize(obj).c_str());
}
// Laut Mark Sibly:
struct BBType {
int obj_size;
BBObj usedList, freeList;
};
struct BBObj {
BBObj *curr;
BBObj *next, *prev;
int* bbtype;
int ref_cnt;
};
+48
View File
@@ -0,0 +1,48 @@
#pragma once
#include "Matrix3.h"
void Matrix3::set(Matrix3 &M)
{
if (this != &M) {
this->X.set(M.X);
this->Y.set(M.Y);
this->Z.set(M.Z);
}
}
void Matrix3::set(Vector3 &X, Vector3 &Y, Vector3 &Z)
{
this->X.set(X);
this->Y.set(Y);
this->Z.set(Z);
}
void Matrix3::set(float &XX, float &XY, float &XZ, float &YX, float &YY, float &YZ, float &ZX, float &ZY, float &ZZ)
{
this->X.set(XX, XY, XZ);
this->Y.set(YX, YY, YZ);
this->Z.set(ZX, ZY, ZZ);
}
void Matrix3::rotate(float &pitch, float &yaw, float &roll)
{
this->X.mul(cos(yaw) * cos(roll), -sin(roll), sin(yaw));
this->Y.mul(sin(roll), cos(pitch) * cos(roll), -sin(pitch));
this->Z.mul(-sin(yaw), sin(pitch), cos(pitch) * cos(yaw));
}
void Matrix3::angles(float &pitch, float &yaw, float &roll)
{
// ToDo
}
void Matrix3::transpose()
{
Matrix3 temp;
temp.set(*this);
this->X.set(temp.X.X, temp.Y.X, temp.Z.X);
this->Y.set(temp.X.Y, temp.Y.Y, temp.Z.Y);
this->Z.set(temp.X.Z, temp.Y.Z, temp.Z.Z);
}
+18
View File
@@ -0,0 +1,18 @@
#pragma once
#include <math.h>
#include "dllmain.h"
#include "Vector3.h"
struct Matrix3 {
Vector3 X, Y, Z;
void set(Matrix3 &M);
void set(Vector3 &X, Vector3 &Y, Vector3 &Z);
void set(float &XX, float &XY, float &XZ, float &YX, float &YY, float &YZ, float &ZX, float &ZY, float &ZZ);
void rotate(float &pitch, float &yaw, float &roll);
void angles(float &pitch, float &yaw, float &roll);
void transpose();
};
+261
View File
@@ -0,0 +1,261 @@
#pragma once
#include "Vector2.h"
void Vector2::set(const float &o)
{
this->X = o;
this->Y = o;
}
void Vector2::set(const float &x, const float &y)
{
this->X = x;
this->Y = y;
}
void Vector2::set(const Vector2 &o)
{
if (this != &o) {
this->X = o.X;
this->Y = o.Y;
}
}
void Vector2::add(const float &o)
{
this->X += o;
this->Y += o;
}
void Vector2::add(const float &x, const float &y)
{
this->X += x;
this->Y += y;
}
void Vector2::add(const Vector2 &o)
{
this->X += o.X;
this->Y += o.Y;
}
void Vector2::sub(const float &o)
{
this->X -= o;
this->Y -= o;
}
void Vector2::sub(const float &x, const float &y)
{
this->X -= x;
this->Y -= y;
}
void Vector2::sub(const Vector2 &o)
{
this->X -= o.X;
this->Y -= o.Y;
}
void Vector2::mul(const float &o)
{
this->X *= o;
this->Y *= o;
}
void Vector2::mul(const float &x, const float &y)
{
this->X *= x;
this->Y *= y;
}
void Vector2::mul(const Vector2 &o)
{
this->X *= o.X;
this->Y *= o.Y;
}
void Vector2::div(const float &o)
{
this->X /= o;
this->Y /= o;
}
void Vector2::div(const float &x, const float &y)
{
this->X /= x;
this->Y /= y;
}
void Vector2::div(const Vector2 &o)
{
this->X /= o.X;
this->Y /= o.Y;
}
float Vector2::length()
{
return (float)sqrt((this->X * this->X) + (this->Y * this->Y));
}
float Vector2::distance(const float &x, const float &y)
{
float X = this->X - x;
float Y = this->Y - y;
return (float)sqrt((X * X) + (Y * Y));
}
float Vector2::distance(const Vector2 &o)
{
float X = this->X - o.X;
float Y = this->Y - o.Y;
return (float)sqrt((X * X) + (Y * Y));
}
float Vector2::dot(const float &x, const float &y)
{
return (this->X * x) + (this->Y * y);
}
float Vector2::dot(const Vector2 &o)
{
return (this->X * o.X) + (this->Y * o.Y);
}
void Vector2::normalize()
{
this->div(this->length());
}
void Vector2::rotate(const float rotation)
{
float mX = cos(rotation);
float mY = sin(rotation);
float X = this->X * mX + this->Y * mY; this->X = X;
float Y = this->X * mY + this->X * mX; this->Y = Y;
}
void Vector2::rotateAround(const float &x, const float &y, const float &rotation)
{
this->sub(x, y);
this->rotate(rotation);
this->add(x, y);
}
void Vector2::rotateAround(const Vector2 &o, const float &rotation)
{
this->sub(o);
this->rotate(rotation);
this->add(o);
}
float Vector2::deltaRotation() {
return (float)(atan2(this->Y, this->X) * (180.0 / M_PI));
}
float Vector2::deltaRotation(const float &x, const float &y)
{
return (float)(atan2(this->Y - y, this->X - x) * (180.0 / M_PI));
}
float Vector2::deltaRotation(const Vector2 &o)
{
return (float)(atan2(this->Y - o.Y, this->X - o.X) * (180.0 / M_PI));
}
char* Vector2::serialize()
{
char* data = new char[9];
memcpy(data, this->Xc, 4);
memcpy(data + 4, this->Yc, 4);
data[8] = 0;
return data;
}
void Vector2::deserialize(char* o)
{
memcpy(o, this->Xc, 4);
memcpy(o + 4, this->Yc, 4);
}
/* ------------------------- Exported Functionality ------------------------- */
DLL_EXPORT void Vector2_Set(Vector2* a, float o) {
a->set(o);
}
DLL_EXPORT void Vector2_SetP(Vector2* a, float x, float y) {
a->set(x, y);
}
DLL_EXPORT void Vector2_SetV(Vector2* a, Vector2* b) {
a->set(*b);
}
DLL_EXPORT void Vector2_Add(Vector2* a, float o) {
a->add(o);
}
DLL_EXPORT void Vector2_AddP(Vector2* a, float x, float y) {
a->add(x, y);
}
DLL_EXPORT void Vector2_AddV(Vector2* a, Vector2* b) {
a->add(*b);
}
DLL_EXPORT void Vector2_Sub(Vector2* a, float o) {
a->sub(o);
}
DLL_EXPORT void Vector2_SubP(Vector2* a, float x, float y) {
a->sub(x, y);
}
DLL_EXPORT void Vector2_SubV(Vector2* a, Vector2* b) {
a->sub(*b);
}
DLL_EXPORT void Vector2_Mul(Vector2* a, float o) {
a->mul(o);
}
DLL_EXPORT void Vector2_MulP(Vector2* a, float x, float y) {
a->mul(x, y);
}
DLL_EXPORT void Vector2_MulV(Vector2* a, Vector2* b) {
a->mul(*b);
}
DLL_EXPORT void Vector2_Div(Vector2* a, float o) {
a->div(o);
}
DLL_EXPORT void Vector2_DivP(Vector2* a, float x, float y) {
a->div(x, y);
}
DLL_EXPORT void Vector2_DivV(Vector2* a, Vector2* b) {
a->div(*b);
}
DLL_EXPORT float Vector2_Length(Vector2* a) {
return (float)a->length();
}
DLL_EXPORT float Vector2_DistanceP(Vector2* a, float x, float y) {
return (float)a->distance(x, y);
}
DLL_EXPORT float Vector2_DistanceV(Vector2* a, Vector2* b) {
return (float)a->distance(*b);
}
DLL_EXPORT float Vector2_DotP(Vector2* a, float x, float y) {
return (float)a->dot(x, y);
}
DLL_EXPORT float Vector2_DotV(Vector2* a, Vector2* b) {
return (float)a->dot(*b);
}
DLL_EXPORT void Vector2_Normalize(Vector2* a) {
a->normalize();
}
DLL_EXPORT void Vector2_Rotate(Vector2* a, float rotation) {
a->rotate(rotation);
}
DLL_EXPORT void Vector2_RotateAroundP(Vector2* a, float x, float y, float rotation) {
a->rotateAround(x, y, rotation);
}
DLL_EXPORT void Vector2_RotateAroundV(Vector2* a, Vector2* b, float rotation) {
a->rotateAround(*b, rotation);
}
DLL_EXPORT float Vector2_DeltaRotation(Vector2* a) {
return (float)a->deltaRotation();
}
DLL_EXPORT float Vector2_DeltaRotationP(Vector2* a, float x, float y) {
return (float)a->deltaRotation(x, y);
}
DLL_EXPORT float Vector2_DeltaRotationV(Vector2* a, Vector2* b) {
return (float)a->deltaRotation(*b);
}
DLL_EXPORT char* Vector2_Serialize(Vector2* a) {
return a->serialize();
}
DLL_EXPORT void Vector2_Deserialize(Vector2* a, char* o) {
a->deserialize(o);
}
+57
View File
@@ -0,0 +1,57 @@
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct Vector2 {
union {
float X;
char Xc[4];
};
union {
float Y;
char Yc[4];
};
void set(const float &o);
void set(const float &x, const float &y);
void set(const Vector2 &o);
void add(const float &o);
void add(const float &x, const float &y);
void add(const Vector2 &o);
void sub(const float &o);
void sub(const float &x, const float &y);
void sub(const Vector2 &o);
void mul(const float &o);
void mul(const float &x, const float &y);
void mul(const Vector2 &o);
void div(const float &o);
void div(const float &x, const float &y);
void div(const Vector2 &o);
float length();
float distance(const float &x, const float &y);
float distance(const Vector2 &o);
float dot(const float &x, const float &y);
float dot(const Vector2 &o);
void normalize();
void rotate(const float rotation);
void rotateAround(const float &x, const float &y, const float &rotation);
void rotateAround(const Vector2 &o, const float &rotation);
float deltaRotation();
float deltaRotation(const float &x, const float &y);
float deltaRotation(const Vector2 &o);
char* serialize();
void deserialize(char* o);
};
+326
View File
@@ -0,0 +1,326 @@
#pragma once
#include "Vector3.h"
void Vector3::set(const float &o)
{
this->X = o;
this->Y = o;
this->Z = o;
}
void Vector3::set(const float &x, const float &y, const float &z)
{
this->X = x;
this->Y = y;
this->Z = z;
}
void Vector3::set(const Vector3 &o)
{
if (this != &o) {
this->X = o.X;
this->Y = o.Y;
this->Z = o.Z;
}
}
void Vector3::add(const float &o)
{
this->X += o;
this->Y += o;
this->Z += o;
}
void Vector3::add(const float &x, const float &y, const float &z)
{
this->X += x;
this->Y += y;
this->Z += z;
}
void Vector3::add(const Vector3 &o)
{
this->X += o.X;
this->Y += o.Y;
this->Z += o.Z;
}
void Vector3::sub(const float &o)
{
this->X -= o;
this->Y -= o;
this->Z -= o;
}
void Vector3::sub(const float &x, const float &y, const float &z)
{
this->X -= x;
this->Y -= y;
this->Z -= z;
}
void Vector3::sub(const Vector3 &o)
{
this->X -= o.X;
this->Y -= o.Y;
this->Z -= o.Z;
}
void Vector3::mul(const float &o)
{
this->X *= o;
this->Y *= o;
this->Z *= o;
}
void Vector3::mul(const float &x, const float &y, const float &z)
{
this->X *= x;
this->Y *= y;
this->Z *= z;
}
void Vector3::mul(const Vector3 &o)
{
this->X *= o.X;
this->Y *= o.Y;
this->Z *= o.Z;
}
void Vector3::div(const float &o)
{
this->X /= o;
this->Y /= o;
this->Z /= o;
}
void Vector3::div(const float &x, const float &y, const float &z)
{
this->X /= x;
this->Y /= y;
this->Z /= z;
}
void Vector3::div(const Vector3 &o)
{
this->X /= o.X;
this->Y /= o.Y;
this->Z /= o.Z;
}
float Vector3::length()
{
return sqrt(this->X * this->X + this->Y * this->Y + this->Z * this->Z);
}
float Vector3::distance(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
float Z = (this->Z - z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::distance(const Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
float Z = (this->Z - o.Z);
return sqrt(X * X + Y * Y + Z * Z);
}
float Vector3::dot(const float &x, const float &y, const float &z)
{
return (this->X * x) + (this->Y * y) + (this->Z * z);
}
float Vector3::dot(const Vector3 &o)
{
return (this->X * o.X) + (this->Y * o.Y) + (this->Z * o.Z);
}
Vector3 Vector3::cross(const float &x, const float &y, const float &z)
{
Vector3* data = new Vector3();
data->X = (this->Y * z) - (this->Z * y);
data->Y = (this->Z * x) - (this->X * z);
data->Z = (this->X * y) - (this->Y * x);
return *data;
}
Vector3 Vector3::cross(const Vector3 &o)
{
Vector3* data = new Vector3();
data->X = (this->Y * o.Z) - (this->Z * o.Y);
data->Y = (this->Z * o.X) - (this->X * o.Z);
data->Z = (this->X * o.Y) - (this->Y * o.X);
return *data;
}
void Vector3::normalize()
{
this->div(this->length());
}
void Vector3::rotate(float &pitch, float &yaw, float &roll)
{
float** matrix = new float*[3];
matrix[0] = new float[3]; matrix[1] = new float[3]; matrix[2] = new float[3];
matrix[0][0] = cos(yaw) * cos(roll); matrix[0][1] = -sin(roll); matrix[0][2] = sin(yaw);
matrix[1][0] = sin(roll); matrix[1][1] = cos(pitch) * cos(roll); matrix[1][2] = -sin(pitch);
matrix[2][0] = -sin(yaw); matrix[2][1] = sin(pitch); matrix[2][2] = cos(pitch) * cos(yaw);
float X = (this->X * matrix[0][0]) + (this->Y * matrix[0][1]) + (this->Z * matrix[0][2]);
float Y = (this->X * matrix[1][0]) + (this->Y * matrix[1][1]) + (this->Z * matrix[1][2]);
float Z = (this->X * matrix[2][0]) + (this->Y * matrix[2][1]) + (this->Z * matrix[2][2]);
this->X = X; this->Y = Y; this->Z = Z;
}
void Vector3::rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll)
{
this->sub(x, y, z);
this->rotate(pitch, yaw, roll);
this->add(x, y, z);
}
void Vector3::rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll)
{
this->sub(o);
this->rotate(pitch, yaw, roll);
this->add(o);
}
float Vector3::deltaPitch() {
return (float)atan(this->X / -this->Y) * (180.0 / M_PI);
}
float Vector3::deltaPitch(const float &x, const float &y, const float &z)
{
return (float)atan((this->X - x) / (-(this->Y - y))) * (180.0 / M_PI);
}
float Vector3::deltaPitch(Vector3 &o)
{
return (float)atan((this->X - o.X) / (-(this->Y - o.Y))) * (180.0 / M_PI);
}
float Vector3::deltaYaw() {
return (float)atan(sqrt((this->X * this->X) + (this->Y * this->Y)) / this->Z) * (180.0 / M_PI);
}
float Vector3::deltaYaw(const float &x, const float &y, const float &z)
{
float X = (this->X - x);
float Y = (this->Y - y);
return (float)atan(sqrt((X * X) + (Y * Y)) / (this->Z - z)) * (180.0 / M_PI);
}
float Vector3::deltaYaw(Vector3 &o)
{
float X = (this->X - o.X);
float Y = (this->Y - o.Y);
return (float)atan(sqrt((X * X) + (Y * Y)) / (this->Z - o.Z)) * (180.0 / M_PI);
}
char* Vector3::serialize()
{
char* data = new char[13];
memcpy(data, this->Xc, 4);
memcpy(data + 4, this->Yc, 4);
memcpy(data + 8, this->Zc, 4);
data[12] = 0;
return data;
}
void Vector3::deserialize(char* o)
{
memcpy(o, this->Xc, 4);
memcpy(o + 4, this->Yc, 4);
memcpy(o + 8, this->Zc, 4);
}
/* ------------------------- Exported Functionality ------------------------- */
DLL_EXPORT void Vector3_Set(Vector3* a, float o) {
a->set(o);
}
DLL_EXPORT void Vector3_SetP(Vector3* a, float x, float y, float z) {
a->set(x, y, z);
}
DLL_EXPORT void Vector3_SetV(Vector3* a, Vector3* b) {
a->set(*b);
}
DLL_EXPORT void Vector3_Add(Vector3* a, float o) {
a->add(o);
}
DLL_EXPORT void Vector3_AddP(Vector3* a, float x, float y, float z) {
a->add(x, y, z);
}
DLL_EXPORT void Vector3_AddV(Vector3* a, Vector3* b) {
a->add(*b);
}
DLL_EXPORT void Vector3_Sub(Vector3* a, float o) {
a->sub(o);
}
DLL_EXPORT void Vector3_SubP(Vector3* a, float x, float y, float z) {
a->sub(x, y, z);
}
DLL_EXPORT void Vector3_SubV(Vector3* a, Vector3* b) {
a->sub(*b);
}
DLL_EXPORT void Vector3_Mul(Vector3* a, float o) {
a->mul(o);
}
DLL_EXPORT void Vector3_MulP(Vector3* a, float x, float y, float z) {
a->mul(x, y, z);
}
DLL_EXPORT void Vector3_MulV(Vector3* a, Vector3* b) {
a->mul(*b);
}
DLL_EXPORT void Vector3_Div(Vector3* a, float o) {
a->div(o);
}
DLL_EXPORT void Vector3_DivP(Vector3* a, float x, float y, float z) {
a->div(x, y, z);
}
DLL_EXPORT void Vector3_DivV(Vector3* a, Vector3* b) {
a->div(*b);
}
DLL_EXPORT float Vector3_Length(Vector3* a) {
return (float)a->length();
}
DLL_EXPORT float Vector3_DistanceP(Vector3* a, float x, float y, float z) {
return (float)a->distance(x, y, z);
}
DLL_EXPORT float Vector3_DistanceV(Vector3* a, Vector3* b) {
return (float)a->distance(*b);
}
DLL_EXPORT float Vector3_DotP(Vector3* a, float x, float y, float z) {
return (float)a->dot(x, y, z);
}
DLL_EXPORT float Vector3_DotV(Vector3* a, Vector3* b) {
return (float)a->dot(*b);
}
DLL_EXPORT void Vector3_CrossP(Vector3* a, float x, float y, float z, Vector3* out) {
Vector3 temp = a->cross(x, y, z);
*out = temp;
}
DLL_EXPORT void Vector3_CrossV(Vector3* a, Vector3* b, Vector3* out) {
Vector3 temp = a->cross(*b);
*out = temp;
}
DLL_EXPORT void Vector3_Normalize(Vector3* a) {
a->normalize();
}
DLL_EXPORT void Vector3_Rotate(Vector3* a, float pitch, float yaw, float roll) {
a->rotate(pitch, yaw, roll);
}
DLL_EXPORT void Vector3_RotateAroundP(Vector3* a, float x, float y, float z, float pitch, float yaw, float roll) {
a->rotateAround(x, y, z, pitch, yaw, roll);
}
DLL_EXPORT void Vector3_RotateAroundV(Vector3* a, Vector3* b, float pitch, float yaw, float roll) {
a->rotateAround(*b, pitch, yaw, roll);
}
DLL_EXPORT float Vector3_DeltaPitchP(Vector3* a, float x, float y, float z) {
return (float)a->deltaPitch(x, y, z);
}
DLL_EXPORT float Vector3_DeltaPitchV(Vector3* a, Vector3* b) {
return (float)a->deltaPitch(*b);
}
DLL_EXPORT float Vector3_DeltaYawP(Vector3* a, float x, float y, float z) {
return (float)a->deltaYaw(x, y, z);
}
DLL_EXPORT float Vector3_DeltaYawV(Vector3* a, Vector3* b) {
return (float)a->deltaYaw(*b);
}
DLL_EXPORT char* Vector3_Serialize(Vector3* a) {
return a->serialize();
}
DLL_EXPORT void Vector3_Deserialize(Vector3* a, char* s) {
a->deserialize(s);
}
+65
View File
@@ -0,0 +1,65 @@
#pragma once
#include "dllmain.h"
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#include <math.h>
#undef _USE_MATH_DEFINES
#endif
struct Vector3 {
union {
float X;
char Xc[4];
};
union {
float Y;
char Yc[4];
};
union {
float Z;
char Zc[4];
};
void set(const float &o);
void set(const float &x, const float &y, const float &z);
void set(const Vector3 &o);
void add(const float &o);
void add(const float &x, const float &y, const float &z);
void add(const Vector3 &o);
void sub(const float &o);
void sub(const float &x, const float &y, const float &z);
void sub(const Vector3 &o);
void mul(const float &o);
void mul(const float &x, const float &y, const float &z);
void mul(const Vector3 &o);
void div(const float &o);
void div(const float &x, const float &y, const float &z);
void div(const Vector3 &o);
float length();
float distance(const float &x, const float &y, const float &z);
float distance(const Vector3 &o);
float dot(const float &x, const float &y, const float &z);
float dot(const Vector3 &o);
Vector3 cross(const float &x, const float &y, const float &z);
Vector3 cross(const Vector3 &o);
void normalize();
void rotate(float &pitch, float &yaw, float &roll);
void rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll);
void rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll);
float deltaPitch();
float deltaPitch(const float &x, const float &y, const float &z);
float deltaPitch(Vector3 &o);
float deltaYaw();
float deltaYaw(const float &x, const float &y, const float &z);
float deltaYaw(Vector3 &o);
char* serialize();
void deserialize(char* o);
};
+54
View File
@@ -0,0 +1,54 @@
#include "Display.h"
std::list<Display>* Display_List = NULL;
void Display_OnProcessAttach() {
Display_List = new std::list<Display>();
}
void Display_OnProcessDetach() {
Display_List->clear();
delete Display_List;
}
DLL_EXPORT void Display_Enumerate() {
if (Display_List == NULL)
return;
Display_List->clear();
EnumDisplayMonitors(NULL, NULL, Display_EnumerateProcedure, 0);
}
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
Display *thisDisplay = new Display;
thisDisplay->left = lprcMonitor->left;
thisDisplay->top = lprcMonitor->top;
thisDisplay->right = lprcMonitor->right;
thisDisplay->bottom = lprcMonitor->bottom;
Display_List->push_back(*thisDisplay);
return TRUE;
}
DLL_EXPORT int Display_Count() {
return Display_List->size();
}
DLL_EXPORT void Display_Get(int displayId, LPRECT display) {
if (Display_List->size() > (unsigned)displayId) {
auto iterator = Display_List->begin();
std::advance(iterator, displayId);
if (display != NULL) {
display->left = iterator->left;
display->top = iterator->top;
display->right = iterator->right;
display->bottom = iterator->bottom;
}
}
}
+21
View File
@@ -0,0 +1,21 @@
#pragma once
#include "dllmain.h"
#include <list>
struct Display {
int left;
int top;
int right;
int bottom;
};
void Display_OnProcessAttach();
void Display_OnProcessDetach();
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
extern "C" {
DLL_EXPORT void Display_Enumerate();
DLL_EXPORT int Display_Count();
DLL_EXPORT void Display_Get(int displayId, LPRECT display);
}
+75
View File
@@ -0,0 +1,75 @@
#pragma once
#include "Indexer.h"
#define INDEX_OFF_0 0x00000000
#define INDEX_OFF_1 0x10000000
#define INDEX_OFF_2 0x20000000
#define INDEX_OFF_3 0x30000000
#define INDEX_OFF_4 0x40000000
#define INDEX_OFF_5 0x50000000
#define INDEX_OFF_6 0x60000000
#define INDEX_OFF_7 0x70000000
#define INDEX_OFF_8 0x80000000
#define INDEX_OFF_9 0x90000000
#define INDEX_OFF_A 0xA0000000
#define INDEX_OFF_B 0xB0000000
#define INDEX_OFF_C 0xC0000000
#define INDEX_OFF_D 0xD0000000
#define INDEX_OFF_E 0xE0000000
#define INDEX_OFF_F 0xF0000000
unsigned int Indexer::GetFreeIndex()
{
unsigned int index = lastAssignedIndex + 1;
bool foundIndex = false;
char indexBitOffset = 0;
// We use 16 offsets here to speed up the search for a free index.
while (foundIndex == false) {
index = index + 64;
uint64_t toCheck = this->indexes[index >> 6];
for (indexBitOffset = 0; indexBitOffset < 64; indexBitOffset++) {
if ((toCheck & (1ULL << indexBitOffset)) == false) {
foundIndex = true;
break;
}
}
}
index = index + indexBitOffset;
// Mark Index as in use.
this->indexes[index >> 6] |= 1ULL << indexBitOffset;
lastAssignedIndex = index;
return lastAssignedIndex;
}
void Indexer::MarkFreeIndex(int index)
{
unsigned short bitFlip = index % 64;
// Mark index as unused.
this->indexes[index >> 6] &= ~(1ULL << bitFlip);
}
DLL_EXPORT void* Indexer_Create() {
Indexer* indexer = new Indexer();
return indexer;
}
DLL_EXPORT int Indexer_GetFreeIndex(void* indexerPtr) {
Indexer* indexer = (Indexer*)indexerPtr;
return indexer->GetFreeIndex();
}
DLL_EXPORT void Indexer_MarkFreeIndex(void* indexerPtr, int Index) {
Indexer* indexer = (Indexer*)indexerPtr;
indexer->MarkFreeIndex(Index);
}
DLL_EXPORT void Indexer_Destroy(void* indexerPtr) {
Indexer* indexer = (Indexer*)indexerPtr;
delete indexer;
}
+25
View File
@@ -0,0 +1,25 @@
#pragma once
#include <cstdlib>
#include <list>
#include "dllmain.h"
// 67108864 = 2 ^ 32 / 64
#define INDEXER_INDEXES 67108864
/** Indexer structure helps with getting unique, unused Indexes (Ids).
* Doing this natively would be too slow, so I'm using a DLL for this.
*/
struct Indexer {
uint64_t indexes[67108864];
uint32_t lastAssignedIndex;
unsigned int GetFreeIndex();
void MarkFreeIndex(int index);
};
extern "C" {
DLL_EXPORT void* Indexer_Create();
DLL_EXPORT int Indexer_GetFreeIndex(void* index);
DLL_EXPORT void Indexer_MarkFreeIndex(void* index, int Index);
DLL_EXPORT void Indexer_Destroy(void* index);
}
@@ -0,0 +1,104 @@
#pragma once
#include "WindowMessageHandler.h"
std::list<WindowUserData>* WindowMessageHandler_List;
void WindowMessageHandler_OnProcessAttach() {
WindowMessageHandler_List = new std::list<WindowUserData>();
}
void WindowMessageHandler_OnProcessDetach() {
for (auto iterator = WindowMessageHandler_List->begin(), end = WindowMessageHandler_List->end(); iterator != end; iterator++) {
WindowMessageHandler_Uninstall(iterator->hwnd);
}
WindowMessageHandler_List->clear();
delete WindowMessageHandler_List;
}
LRESULT CALLBACK WindowMessageHandler_Procedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
if (UserData) {
switch (uMsg) {
case WM_SIZE:
UserData->WindowWasResized = true;
UserData->WindowClientWidth = lParam & 0xFFFF;
UserData->WindowClientHeight = lParam & 0xFFFF0000 >> 16;
return CallWindowProc(UserData->oWindowProcedure, hwnd, uMsg, wParam, lParam);
break;
case WM_CLOSE:
UserData->DestroyCount++;
return false;
case WM_DESTROY:
UserData->CloseCount++;
return false;
default:
return CallWindowProc(UserData->oWindowProcedure, hwnd, uMsg, wParam, lParam);
}
} else {
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
DLL_EXPORT void WindowMessageHandler_Install(HWND hwnd) {
if (hwnd) {
WindowUserData* UserData = new WindowUserData;
ZeroMemory(UserData, sizeof(UserData));
UserData->oWindowProcedure = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)&WindowMessageHandler_Procedure);
UserData->oUserData = SetWindowLong(hwnd, GWL_USERDATA, (LONG)UserData);
}
}
DLL_EXPORT void WindowMessageHandler_Uninstall(HWND hwnd) {
if (hwnd) {
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
if (UserData) {
SetWindowLong(hwnd, GWL_USERDATA, UserData->oUserData);
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)(UserData->oWindowProcedure));
delete UserData;
}
}
}
DLL_EXPORT int WindowMessageHandler_Message_Resize(HWND hwnd, LPPOINT point) {
if (hwnd) {
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
if (UserData) {
int toReturn = UserData->WindowWasResized;
point->x = UserData->WindowClientWidth;
point->y = UserData->WindowClientHeight;
UserData->WindowWasResized = false;
return toReturn;
}
}
return 0;
}
DLL_EXPORT int WindowMessageHandler_Message_Destroy(HWND hwnd) {
if (hwnd) {
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
if (UserData) {
int toReturn = UserData->DestroyCount;
UserData->DestroyCount = 0;
return toReturn;
}
}
return 0;
}
DLL_EXPORT int WindowMessageHandler_Message_Close(HWND hwnd) {
if (hwnd) {
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
if (UserData) {
int toReturn = UserData->CloseCount;
UserData->CloseCount = 0;
return toReturn;
}
}
return 0;
}
@@ -0,0 +1,31 @@
#pragma once
#include "dllmain.h"
#include <list>
struct WindowUserData {
HWND hwnd;
WNDPROC oWindowProcedure;
LONG oUserData;
// WM_SIZE
bool WindowWasResized;
uint32_t WindowClientWidth, WindowClientHeight;
// WM_DESTROY, WM_CLOSE
uint32_t DestroyCount, CloseCount;
};
void WindowMessageHandler_OnProcessAttach();
void WindowMessageHandler_OnProcessDetach();
LRESULT CALLBACK WindowMessageHandler_Procedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern "C" {
DLL_EXPORT void WindowMessageHandler_Install(HWND hwnd);
DLL_EXPORT void WindowMessageHandler_Uninstall(HWND hwnd);
DLL_EXPORT int WindowMessageHandler_Message_Resize(HWND hwnd, LPPOINT point);
DLL_EXPORT int WindowMessageHandler_Message_Destroy(HWND hwnd);
DLL_EXPORT int WindowMessageHandler_Message_Close(HWND hwnd);
}
+46
View File
@@ -0,0 +1,46 @@
#pragma once
#include "dllmain.h"
#include <list>
#include "Containers\BlitzList.h"
//#include "Database\SQLite\SQLite.h"
#include "Math\Vector2.h"
#include "Math\Vector3.h"
#include "Math\Matrix3.h"
#include "Utility\Display.h"
#include "Utility\Indexer.h"
#include "Utility\WindowMessageHandler.h"
bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
// Containers
BlitzList_OnProcessAttach();
// Math
// Database
//SQLite3_OnProcessAttach();
// Utility
Display_OnProcessAttach();
WindowMessageHandler_OnProcessAttach();
break;
case DLL_PROCESS_DETACH:
// Containers
BlitzList_OnProcessDetach();
// Math
// Database
//SQLite3_OnProcessDetach();
// Utility
Display_OnProcessDetach();
WindowMessageHandler_OnProcessDetach();
break;
}
return TRUE;
}
+12
View File
@@ -0,0 +1,12 @@
// STL Exceptions
#include <exception>
#include <stdexcept>
// Memory Management
#include <memory>
// Platform specific: Windows
#include <windows.h>
// Macros
#define DLL_EXPORT extern "C" __declspec(dllexport)