Update BlitzUtility:

- New DECLS
- Begin wrapping __cdecl sqlite3 into __stdcall functions (sqlite3 doesn't understand __stdcall)
- Use __stdcall and /EXPORT instead of __cdecl to not corrupt the stack.
- Implement two versions of the Indexer, V1 for really fast access and V2 for memory saving.

Signed-off-by: Michael Fabian Dirks <michael.dirks@realitybends.de>
This commit is contained in:
Michael Fabian Dirks
2015-06-06 14:09:40 +02:00
parent 39ad6503d5
commit 8049964bd1
21 changed files with 436 additions and 225 deletions
+132 -140
View File
@@ -1,93 +1,146 @@
.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
; Math -------------------------------------------------------------------------
; -- 2D Vector
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"
; -- 3D Vector
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"
; Containers -------------------------------------------------------------------
; -- Native Blitz List (Not Threadsafe)
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
; Utility ----------------------------------------------------------------------
; -- Monitor/Display Enumeration
BU_Display_Enumerate() : "Display_Enumerate"
BU_Display_Count%() : "Display_Count"
BU_Display_Get(id%, rectangle*) : "Display_Get"
; -- Fast Indexing V1 (Array-based)
BU_IndexerV1_Create%() : "IndexerV1_Create"
BU_IndexerV1_Destroy(indexer%) : "IndexerV1_Destroy"
BU_IndexerV1_GetIndex%(indexer%) : "IndexerV1_GetFreeIndex"
BU_IndexerV1_MarkIndex(indexer%, index%) : "IndexerV1_MarkFreeIndex"
; -- Fast Indexing V2 (Vector-based)
BU_IndexerV2_Create%() : "IndexerV2_Create"
BU_IndexerV2_Destroy(indexer%) : "IndexerV2_Destroy"
BU_IndexerV2_GetIndex%(indexer%) : "IndexerV2_GetIndex"
BU_IndexerV2_MarkIndex(indexer%, index%) : "IndexerV2_MarkIndex"
BU_IndexerV2_IsFree%(indexer%, index%) : "IndexerV2_IsFree"
BU_IndexerV2_IsUsed%(indexer%, index%) : "IndexerV2_IsUsed"
; -- Window Message Handler
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"
; Databases --------------------------------------------------------------------
; -- 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_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
SQLite3_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
SQLite3_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
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_Int64(StatementHandle, ColumnIndex, outPtr*) : "sqlite3_column_int64_ex"
SQLite3_Column_Float#(StatementHandle, ColumnIndex) : "sqlite3_column_float"
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 ------------------------------------------------------------
; SQLite3 Wrapped
SQLite_Version$() : "sqlite3_libversion"
SQLite_Close%(DatabaseHandle) : "sqlite3_close"
SQLite_SetTimeOut%(DatabaseHandle, TimeOut) : "sqlite3_busy_timeout"
@@ -125,100 +178,39 @@ SQLite_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_by
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
; Backwards Compatability - Containers -----------------------------------------
; -- Lists
BlitzUtility_List_New%(obj*) : "BlitzList_New"
BlitzUtility_List_Activate(list%) : "BlitzList_Activate"
BlitzUtility_List_Deactivate(list%) : "BlitzList_Deactivate"
BlitzUtility_List_Destroy(list%) : "BlitzList_Delete"
; Backwards Compatability - Utility --------------------------------------------
; -- Monitor/Display Enumeration
BlitzUtility_EnumerateDisplays() : "Display_Enumerate"
BlitzUtility_GetDisplayCount%() : "Display_Count"
BlitzUtility_GetDisplay(id%, rectangle*) : "Display_Get"
; -- Fast Indexing V1 (Array-based)
Indexer_Create%() : "IndexerV1_Create"
Indexer_GetFreeIndex%(indexer%) : "IndexerV1_GetFreeIndex"
Indexer_MarkFreeIndex(indexer%, index%) : "IndexerV1_MarkFreeIndex"
Indexer_Destroy(indexer%) : "IndexerV1_Destroy"
; -- Window Message Handler
BlitzUtility_InstallCloseHandler(hwnd%) : "WindowMessageHandler_Install"
BlitzUtility_UninstallCloseHandler(hwnd%) : "WindowMessageHandler_Uninstall"
BlitzUtility_GetCloseCount%(hwnd%) : "WindowMessageHandler_Message_Close"
; 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"
; Internal ---------------------------------------------------------------------
.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"
; 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"
.lib "Kernel32.dll"
BlitzUtility_Kernel32_FlushFileBuffers%(hFile%) : "FlushFileBuffers"
+4 -2
View File
@@ -129,13 +129,14 @@
<ItemGroup>
<ClInclude Include="dllmain.h" />
<ClInclude Include="Containers\BlitzList.h" />
<ClInclude Include="Utility\Indexer.h" />
<ClInclude Include="Utility\IndexerV1.h" />
<ClInclude Include="Database\SQLite\SQLite.h" />
<ClInclude Include="Database\SQLite\sqlite3.h" />
<ClInclude Include="Math\Matrix3.h" />
<ClInclude Include="Math\Vector2.h" />
<ClInclude Include="Math\Vector3.h" />
<ClInclude Include="Utility\Display.h" />
<ClInclude Include="Utility\IndexerV2.h" />
<ClInclude Include="Utility\WindowMessageHandler.h" />
</ItemGroup>
<ItemGroup>
@@ -146,13 +147,14 @@
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Cdecl</CallingConvention>
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
</ClCompile>
<ClCompile Include="Utility\Indexer.cpp" />
<ClCompile Include="Utility\IndexerV1.cpp" />
<ClCompile Include="Database\SQLite\SQLite.cpp" />
<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\IndexerV2.cpp" />
<ClCompile Include="Utility\WindowMessageHandler.cpp" />
</ItemGroup>
<ItemGroup>
+11 -5
View File
@@ -43,15 +43,18 @@
<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>
<ClCompile Include="Database\SQLite\sqlite3.c">
<Filter>Source Files\Database\SQLite</Filter>
</ClCompile>
<ClCompile Include="Utility\IndexerV1.cpp">
<Filter>Source Files\Utility</Filter>
</ClCompile>
<ClCompile Include="Utility\IndexerV2.cpp">
<Filter>Source Files\Utility</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="dllmain.h">
@@ -78,10 +81,13 @@
<ClInclude Include="Utility\Display.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
<ClInclude Include="Utility\Indexer.h">
<ClInclude Include="Utility\WindowMessageHandler.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
<ClInclude Include="Utility\WindowMessageHandler.h">
<ClInclude Include="Utility\IndexerV1.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
<ClInclude Include="Utility\IndexerV2.h">
<Filter>Source Files\Utility</Filter>
</ClInclude>
</ItemGroup>
+12 -9
View File
@@ -1,4 +1,3 @@
#pragma once
#include "BlitzList.h"
std::list<BlitzTypeInfo*>* BlitzUtility_Lists;
@@ -12,9 +11,9 @@ void BlitzList_OnProcessDetach() {
delete BlitzUtility_Lists;
}
DLL_EXPORT void* BlitzList_New(void* elementPtr) {
BBVarElement* element = (BBVarElement*)(((int*)elementPtr) - 5);
BBVarType* type = (BBVarType*)(*(((int*)elementPtr) - 2));
DLL_EXPORT void* BlitzList_New(uint32_t* elementPtr) {
BBVarElement* element = (BBVarElement*)(((uint32_t*)elementPtr) - 5);
BBVarType* type = (BBVarType*)(*(((uint32_t*)elementPtr) - 2));
// Create and initialize structure to hold information about this change.
BlitzTypeInfo* bti = new BlitzTypeInfo();
@@ -29,14 +28,15 @@ DLL_EXPORT void* BlitzList_New(void* elementPtr) {
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);
element->prevPtr = (BBVarElement*)((uint32_t*)type + 1);
element->nextPtr = (BBVarElement*)((uint32_t*)type + 1);
BlitzUtility_Lists->push_back(bti);
return bti;
}
#pragma comment(linker, "/EXPORT:BlitzList_New=_BlitzList_New@4")
DLL_EXPORT void BlitzList_Activate(void* list) {
DLL_EXPORT void BlitzList_Activate(uint32_t* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
// Store current pointers
@@ -47,8 +47,9 @@ DLL_EXPORT void BlitzList_Activate(void* list) {
bti->type->used.nextPtr = bti->ourNextPtr;
bti->type->used.prevPtr = bti->ourPrevPtr;
}
#pragma comment(linker, "/EXPORT:BlitzList_Activate=_BlitzList_Activate@4")
DLL_EXPORT void BlitzList_Deactivate(void* list) {
DLL_EXPORT void BlitzList_Deactivate(uint32_t* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
// Store current pointers
@@ -59,9 +60,11 @@ DLL_EXPORT void BlitzList_Deactivate(void* list) {
bti->type->used.nextPtr = bti->lastNextPtr;
bti->type->used.prevPtr = bti->lastPrevPtr;
}
#pragma comment(linker, "/EXPORT:BlitzList_Deactivate=_BlitzList_Deactivate@4")
DLL_EXPORT void BlitzList_Delete(void* list) {
DLL_EXPORT void BlitzList_Delete(uint32_t* list) {
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
BlitzUtility_Lists->remove(bti);
delete bti;
}
#pragma comment(linker, "/EXPORT:BlitzList_Delete=_BlitzList_Delete@4")
+1 -6
View File
@@ -39,9 +39,4 @@ struct BlitzTypeInfo {
};
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);
void BlitzList_OnProcessDetach();
+37 -5
View File
@@ -1,4 +1,3 @@
#pragma once
#include "SQLite.h"
void SQLite3_OnProcessAttach() {
@@ -9,22 +8,55 @@ void SQLite3_OnProcessDetach() {
sqlite3_shutdown();
}
/*DLL_EXPORT const char* SQLite_LibVersion() {
return sqlite3_libversion();
}
DLL_EXPORT uint32_t SQLite_LibVersionNumber() {
return sqlite3_libversion_number();
}
DLL_EXPORT uint32_t* SQLite_Open(char* dbFilename) {
sqlite3* dbHandle;
sqlite3_open(dbFilename, &dbHandle);
return (uint32_t*)dbHandle;
}
DLL_EXPORT uint32_t* SQLite_Open_V2(char* dbFilename, uint32_t flags) {
sqlite3* dbHandle;
sqlite3_open_v2(dbFilename, &dbHandle, flags, nullptr);
return (uint32_t*)dbHandle;
}
DLL_EXPORT void SQLite_Close(uint32_t* dbHandlePtr) {
sqlite3* dbHandle = (sqlite3*)dbHandlePtr;
sqlite3_close(dbHandle);
}
DLL_EXPORT int SQLite_Busy_TimeOut() {
}*/
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));
}
#pragma comment(linker, "/EXPORT:sqlite3_bind_int64_ex=_sqlite3_bind_int64_ex@16")
DLL_EXPORT int sqlite3_bind_float(void* stmtPtr, uint32_t index, float value) {
return sqlite3_bind_double((sqlite3_stmt*)stmtPtr, index, (double)value);
}
#pragma comment(linker, "/EXPORT:sqlite3_bind_float=_sqlite3_bind_float@12")
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);
uint32_t* ourPtr = (uint32_t*)outPtr;
(*ourPtr) = (uint32_t)(out & 0xFFFFFFFF);
(*(ourPtr + 1)) = (uint32_t)(out >> 32);
}
#pragma comment(linker, "/EXPORT:sqlite3_column_int64_ex=_sqlite3_column_int64_ex@12")
DLL_EXPORT float sqlite3_column_float(void* stmtPtr, uint32_t index) {
double out = sqlite3_column_double((sqlite3_stmt*)stmtPtr, index);
return (float)out;
}
}
#pragma comment(linker, "/EXPORT:sqlite3_column_float=_sqlite3_column_float@8")
+2 -9
View File
@@ -1,14 +1,7 @@
#pragma once
#include "dllmain.h"
#include <list>
#include "sqlite3.h"
#include <list>
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);
}
+1 -1
View File
@@ -259,7 +259,7 @@ extern "C" {
# define SQLITE_API
#endif
#ifndef SQLITE_CDECL
# define SQLITE_CDECL
# define SQLITE_CDECL __cdecl
#endif
#ifndef SQLITE_STDCALL
# define SQLITE_STDCALL __cdecl
+3 -3
View File
@@ -46,13 +46,13 @@ extern "C" {
** Provide the ability to override linkage features of the interface.
*/
#ifndef SQLITE_EXTERN
# define SQLITE_EXTERN extern "C" __declspec(dllexport)
# define SQLITE_EXTERN
#endif
#ifndef SQLITE_API
# define SQLITE_API
# define SQLITE_API extern "C" __declspec(dllexport)
#endif
#ifndef SQLITE_CDECL
# define SQLITE_CDECL
# define SQLITE_CDECL __cdecl
#endif
#ifndef SQLITE_STDCALL
# define SQLITE_STDCALL __cdecl
-2
View File
@@ -1,7 +1,5 @@
#pragma once
#include "Matrix3.h"
void Matrix3::set(Matrix3 &M)
{
if (this != &M) {
+29 -1
View File
@@ -1,4 +1,3 @@
#pragma once
#include "Vector2.h"
void Vector2::set(const float &o)
@@ -172,6 +171,9 @@ DLL_EXPORT void Vector2_SetP(Vector2* a, float x, float y) {
DLL_EXPORT void Vector2_SetV(Vector2* a, Vector2* b) {
a->set(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Set=_Vector2_Set@8")
#pragma comment(linker, "/EXPORT:Vector2_SetP=_Vector2_SetP@12")
#pragma comment(linker, "/EXPORT:Vector2_SetV=_Vector2_SetV@8")
DLL_EXPORT void Vector2_Add(Vector2* a, float o) {
a->add(o);
@@ -182,6 +184,9 @@ DLL_EXPORT void Vector2_AddP(Vector2* a, float x, float y) {
DLL_EXPORT void Vector2_AddV(Vector2* a, Vector2* b) {
a->add(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Add=_Vector2_Add@8")
#pragma comment(linker, "/EXPORT:Vector2_AddP=_Vector2_AddP@12")
#pragma comment(linker, "/EXPORT:Vector2_AddV=_Vector2_AddV@8")
DLL_EXPORT void Vector2_Sub(Vector2* a, float o) {
a->sub(o);
@@ -192,6 +197,9 @@ DLL_EXPORT void Vector2_SubP(Vector2* a, float x, float y) {
DLL_EXPORT void Vector2_SubV(Vector2* a, Vector2* b) {
a->sub(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Sub=_Vector2_Sub@8")
#pragma comment(linker, "/EXPORT:Vector2_SubP=_Vector2_SubP@12")
#pragma comment(linker, "/EXPORT:Vector2_SubV=_Vector2_SubV@8")
DLL_EXPORT void Vector2_Mul(Vector2* a, float o) {
a->mul(o);
@@ -202,6 +210,9 @@ DLL_EXPORT void Vector2_MulP(Vector2* a, float x, float y) {
DLL_EXPORT void Vector2_MulV(Vector2* a, Vector2* b) {
a->mul(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Mul=_Vector2_Mul@8")
#pragma comment(linker, "/EXPORT:Vector2_MulP=_Vector2_MulP@12")
#pragma comment(linker, "/EXPORT:Vector2_MulV=_Vector2_MulV@8")
DLL_EXPORT void Vector2_Div(Vector2* a, float o) {
a->div(o);
@@ -212,6 +223,9 @@ DLL_EXPORT void Vector2_DivP(Vector2* a, float x, float y) {
DLL_EXPORT void Vector2_DivV(Vector2* a, Vector2* b) {
a->div(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Div=_Vector2_Div@8")
#pragma comment(linker, "/EXPORT:Vector2_DivP=_Vector2_DivP@12")
#pragma comment(linker, "/EXPORT:Vector2_DivV=_Vector2_DivV@8")
DLL_EXPORT float Vector2_Length(Vector2* a) {
return (float)a->length();
@@ -222,6 +236,9 @@ DLL_EXPORT float Vector2_DistanceP(Vector2* a, float x, float y) {
DLL_EXPORT float Vector2_DistanceV(Vector2* a, Vector2* b) {
return (float)a->distance(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_Length=_Vector2_Length@4")
#pragma comment(linker, "/EXPORT:Vector2_DistanceP=_Vector2_DistanceP@12")
#pragma comment(linker, "/EXPORT:Vector2_DistanceV=_Vector2_DistanceV@8")
DLL_EXPORT float Vector2_DotP(Vector2* a, float x, float y) {
return (float)a->dot(x, y);
@@ -232,6 +249,9 @@ DLL_EXPORT float Vector2_DotV(Vector2* a, Vector2* b) {
DLL_EXPORT void Vector2_Normalize(Vector2* a) {
a->normalize();
}
#pragma comment(linker, "/EXPORT:Vector2_DotP=_Vector2_DotP@12")
#pragma comment(linker, "/EXPORT:Vector2_DotV=_Vector2_DotV@8")
#pragma comment(linker, "/EXPORT:Vector2_Normalize=_Vector2_Normalize@4")
DLL_EXPORT void Vector2_Rotate(Vector2* a, float rotation) {
a->rotate(rotation);
@@ -242,6 +262,9 @@ DLL_EXPORT void Vector2_RotateAroundP(Vector2* a, float x, float y, float rotati
DLL_EXPORT void Vector2_RotateAroundV(Vector2* a, Vector2* b, float rotation) {
a->rotateAround(*b, rotation);
}
#pragma comment(linker, "/EXPORT:Vector2_Rotate=_Vector2_Rotate@8")
#pragma comment(linker, "/EXPORT:Vector2_RotateAroundP=_Vector2_RotateAroundP@16")
#pragma comment(linker, "/EXPORT:Vector2_RotateAroundV=_Vector2_RotateAroundV@12")
DLL_EXPORT float Vector2_DeltaRotation(Vector2* a) {
return (float)a->deltaRotation();
@@ -252,6 +275,9 @@ DLL_EXPORT float Vector2_DeltaRotationP(Vector2* a, float x, float y) {
DLL_EXPORT float Vector2_DeltaRotationV(Vector2* a, Vector2* b) {
return (float)a->deltaRotation(*b);
}
#pragma comment(linker, "/EXPORT:Vector2_DeltaRotation=_Vector2_DeltaRotation@4")
#pragma comment(linker, "/EXPORT:Vector2_DeltaRotationP=_Vector2_DeltaRotationP@12")
#pragma comment(linker, "/EXPORT:Vector2_DeltaRotationV=_Vector2_DeltaRotationV@8")
DLL_EXPORT char* Vector2_Serialize(Vector2* a) {
return a->serialize();
@@ -259,3 +285,5 @@ DLL_EXPORT char* Vector2_Serialize(Vector2* a) {
DLL_EXPORT void Vector2_Deserialize(Vector2* a, char* o) {
a->deserialize(o);
}
#pragma comment(linker, "/EXPORT:Vector2_Serialize=_Vector2_Serialize@4")
#pragma comment(linker, "/EXPORT:Vector2_Deserialize=_Vector2_Deserialize@8")
+33 -2
View File
@@ -1,4 +1,3 @@
#pragma once
#include "Vector3.h"
void Vector3::set(const float &o)
@@ -226,6 +225,9 @@ DLL_EXPORT void Vector3_SetP(Vector3* a, float x, float y, float z) {
DLL_EXPORT void Vector3_SetV(Vector3* a, Vector3* b) {
a->set(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Set=_Vector3_Set@8")
#pragma comment(linker, "/EXPORT:Vector3_SetP=_Vector3_SetP@16")
#pragma comment(linker, "/EXPORT:Vector3_SetV=_Vector3_SetV@8")
DLL_EXPORT void Vector3_Add(Vector3* a, float o) {
a->add(o);
@@ -236,6 +238,9 @@ DLL_EXPORT void Vector3_AddP(Vector3* a, float x, float y, float z) {
DLL_EXPORT void Vector3_AddV(Vector3* a, Vector3* b) {
a->add(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Add=_Vector3_Add@8")
#pragma comment(linker, "/EXPORT:Vector3_AddP=_Vector3_AddP@16")
#pragma comment(linker, "/EXPORT:Vector3_AddV=_Vector3_AddV@8")
DLL_EXPORT void Vector3_Sub(Vector3* a, float o) {
a->sub(o);
@@ -246,6 +251,9 @@ DLL_EXPORT void Vector3_SubP(Vector3* a, float x, float y, float z) {
DLL_EXPORT void Vector3_SubV(Vector3* a, Vector3* b) {
a->sub(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Sub=_Vector3_Sub@8")
#pragma comment(linker, "/EXPORT:Vector3_SubP=_Vector3_SubP@16")
#pragma comment(linker, "/EXPORT:Vector3_SubV=_Vector3_SubV@8")
DLL_EXPORT void Vector3_Mul(Vector3* a, float o) {
a->mul(o);
@@ -256,6 +264,9 @@ DLL_EXPORT void Vector3_MulP(Vector3* a, float x, float y, float z) {
DLL_EXPORT void Vector3_MulV(Vector3* a, Vector3* b) {
a->mul(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Mul=_Vector3_Mul@8")
#pragma comment(linker, "/EXPORT:Vector3_MulP=_Vector3_MulP@16")
#pragma comment(linker, "/EXPORT:Vector3_MulV=_Vector3_MulV@8")
DLL_EXPORT void Vector3_Div(Vector3* a, float o) {
a->div(o);
@@ -266,6 +277,9 @@ DLL_EXPORT void Vector3_DivP(Vector3* a, float x, float y, float z) {
DLL_EXPORT void Vector3_DivV(Vector3* a, Vector3* b) {
a->div(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Div=_Vector3_Div@8")
#pragma comment(linker, "/EXPORT:Vector3_DivP=_Vector3_DivP@16")
#pragma comment(linker, "/EXPORT:Vector3_DivV=_Vector3_DivV@8")
DLL_EXPORT float Vector3_Length(Vector3* a) {
return (float)a->length();
@@ -276,6 +290,9 @@ DLL_EXPORT float Vector3_DistanceP(Vector3* a, float x, float y, float z) {
DLL_EXPORT float Vector3_DistanceV(Vector3* a, Vector3* b) {
return (float)a->distance(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_Length=_Vector3_Length@4")
#pragma comment(linker, "/EXPORT:Vector3_DistanceP=_Vector3_DistanceP@16")
#pragma comment(linker, "/EXPORT:Vector3_DistanceV=_Vector3_DistanceV@8")
DLL_EXPORT float Vector3_DotP(Vector3* a, float x, float y, float z) {
return (float)a->dot(x, y, z);
@@ -294,6 +311,11 @@ DLL_EXPORT void Vector3_CrossV(Vector3* a, Vector3* b, Vector3* out) {
DLL_EXPORT void Vector3_Normalize(Vector3* a) {
a->normalize();
}
#pragma comment(linker, "/EXPORT:Vector3_DotP=_Vector3_DotP@16")
#pragma comment(linker, "/EXPORT:Vector3_DotV=_Vector3_DotV@8")
#pragma comment(linker, "/EXPORT:Vector3_CrossP=_Vector3_CrossP@20")
#pragma comment(linker, "/EXPORT:Vector3_CrossV=_Vector3_CrossV@12")
#pragma comment(linker, "/EXPORT:Vector3_Normalize=_Vector3_Normalize@4")
DLL_EXPORT void Vector3_Rotate(Vector3* a, float pitch, float yaw, float roll) {
a->rotate(pitch, yaw, roll);
@@ -304,6 +326,9 @@ DLL_EXPORT void Vector3_RotateAroundP(Vector3* a, float x, float y, float z, flo
DLL_EXPORT void Vector3_RotateAroundV(Vector3* a, Vector3* b, float pitch, float yaw, float roll) {
a->rotateAround(*b, pitch, yaw, roll);
}
#pragma comment(linker, "/EXPORT:Vector3_Rotate=_Vector3_Rotate@16")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundP=_Vector3_RotateAroundP@28")
#pragma comment(linker, "/EXPORT:Vector3_RotateAroundV=_Vector3_RotateAroundV@20")
DLL_EXPORT float Vector3_DeltaPitchP(Vector3* a, float x, float y, float z) {
return (float)a->deltaPitch(x, y, z);
@@ -317,10 +342,16 @@ DLL_EXPORT float Vector3_DeltaYawP(Vector3* a, float x, float y, float z) {
DLL_EXPORT float Vector3_DeltaYawV(Vector3* a, Vector3* b) {
return (float)a->deltaYaw(*b);
}
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchP=_Vector3_DeltaPitchP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaPitchV=_Vector3_DeltaPitchV@8")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawP=_Vector3_DeltaYawP@16")
#pragma comment(linker, "/EXPORT:Vector3_DeltaYawV=_Vector3_DeltaYawV@8")
DLL_EXPORT char* Vector3_Serialize(Vector3* a) {
return a->serialize();
}
DLL_EXPORT void Vector3_Deserialize(Vector3* a, char* s) {
a->deserialize(s);
}
}
#pragma comment(linker, "/EXPORT:Vector3_Serialize=_Vector3_Serialize@4")
#pragma comment(linker, "/EXPORT:Vector3_Deserialize=_Vector3_Deserialize@8")
+5 -2
View File
@@ -19,6 +19,7 @@ DLL_EXPORT void Display_Enumerate() {
EnumDisplayMonitors(NULL, NULL, Display_EnumerateProcedure, 0);
}
#pragma comment(linker, "/EXPORT:Display_Enumerate=_Display_Enumerate@0")
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
Display *thisDisplay = new Display;
@@ -36,9 +37,10 @@ BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRE
DLL_EXPORT int Display_Count() {
return Display_List->size();
}
#pragma comment(linker, "/EXPORT:Display_Count=_Display_Count@0")
DLL_EXPORT void Display_Get(int displayId, LPRECT display) {
if (Display_List->size() > (unsigned)displayId) {
DLL_EXPORT void Display_Get(uint32_t displayId, LPRECT display) {
if (Display_List->size() > displayId) {
auto iterator = Display_List->begin();
std::advance(iterator, displayId);
@@ -51,4 +53,5 @@ DLL_EXPORT void Display_Get(int displayId, LPRECT display) {
}
}
}
#pragma comment(linker, "/EXPORT:Display_Get=_Display_Get@8")
+1 -7
View File
@@ -12,10 +12,4 @@ struct Display {
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);
}
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
+16 -12
View File
@@ -1,5 +1,5 @@
#pragma once
#include "Indexer.h"
#include "IndexerV1.h"
#define INDEX_OFF_0 0x00000000
#define INDEX_OFF_1 0x10000000
@@ -18,7 +18,7 @@
#define INDEX_OFF_E 0xE0000000
#define INDEX_OFF_F 0xF0000000
unsigned int Indexer::GetFreeIndex()
unsigned int IndexerV1::GetFreeIndex()
{
unsigned int index = lastAssignedIndex + 1;
@@ -46,7 +46,7 @@ unsigned int Indexer::GetFreeIndex()
return lastAssignedIndex;
}
void Indexer::MarkFreeIndex(int index)
void IndexerV1::MarkFreeIndex(int index)
{
unsigned short bitFlip = index % 64;
@@ -54,22 +54,26 @@ void Indexer::MarkFreeIndex(int index)
this->indexes[index >> 6] &= ~(1ULL << bitFlip);
}
DLL_EXPORT void* Indexer_Create() {
Indexer* indexer = new Indexer();
DLL_EXPORT void* IndexerV1_Create() {
IndexerV1* indexer = new IndexerV1();
return indexer;
}
#pragma comment(linker, "/EXPORT:IndexerV1_Create=_IndexerV1_Create@0")
DLL_EXPORT int Indexer_GetFreeIndex(void* indexerPtr) {
Indexer* indexer = (Indexer*)indexerPtr;
DLL_EXPORT int IndexerV1_GetFreeIndex(uint32_t* indexerPtr) {
IndexerV1* indexer = (IndexerV1*)indexerPtr;
return indexer->GetFreeIndex();
}
#pragma comment(linker, "/EXPORT:IndexerV1_GetFreeIndex=_IndexerV1_GetFreeIndex@4")
DLL_EXPORT void Indexer_MarkFreeIndex(void* indexerPtr, int Index) {
Indexer* indexer = (Indexer*)indexerPtr;
DLL_EXPORT void IndexerV1_MarkFreeIndex(uint32_t* indexerPtr, uint32_t Index) {
IndexerV1* indexer = (IndexerV1*)indexerPtr;
indexer->MarkFreeIndex(Index);
}
#pragma comment(linker, "/EXPORT:IndexerV1_MarkFreeIndex=_IndexerV1_MarkFreeIndex@8")
DLL_EXPORT void Indexer_Destroy(void* indexerPtr) {
Indexer* indexer = (Indexer*)indexerPtr;
DLL_EXPORT void IndexerV1_Destroy(uint32_t* indexerPtr) {
IndexerV1* indexer = (IndexerV1*)indexerPtr;
delete indexer;
}
}
#pragma comment(linker, "/EXPORT:IndexerV1_Destroy=_IndexerV1_Destroy@4")
+1 -8
View File
@@ -9,17 +9,10 @@
/** 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 {
struct IndexerV1 {
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);
}
+118
View File
@@ -0,0 +1,118 @@
#include "IndexerV2.h"
IndexerV2::IndexerV2() {
this->range.reserve(32);
}
IndexerV2::~IndexerV2() {
this->range.clear();
}
uint32_t IndexerV2::GetIndex() {
uint32_t index = 0;
if (this->range.size() == 0) {
this->range.push_back(IndexerV2Range(0, 0));
} else {
auto range = this->range[0];
if (range.min > 0) {
index = --range.min;
} else {
index = ++range.max;
}
// Combine the next and current element if we need to.
if (this->range.size() > 1) {
auto rangeNext = this->range[1];
if (rangeNext.min == (index + 1)) {
uint32_t newMin, newMax;
newMin = range.min;
newMax = rangeNext.max;
this->range.erase(this->range.begin(), this->range.begin() + 1);
this->range.insert(this->range.begin(), IndexerV2Range(newMin, newMax));
}
}
}
return index;
}
void IndexerV2::MarkIndex(uint32_t index) {
IndexerV2Range* rangePtr;
uint32_t rangePtrPos;
uint32_t rangeSize = this->range.size();
for (uint32_t rangePos = 0; rangePos < rangeSize; rangePos++) {
auto range = this->range[rangePos];
if (index >= range.min && index <= range.max) {
rangePtr = &range;
rangePtrPos = rangePos;
break;
}
}
// Temporarily store the values needed for swapping.
uint32_t leftMin, leftMax, rightMin, rightMax;
leftMin = rangePtr->min; leftMax = index - 1;
rightMin = index + 1; rightMax = rangePtr->max;
// Due to us doing this instead of push_back, our vector is always sorted.
auto rangeIter = this->range.begin() + rangePtrPos;
this->range.erase(rangeIter);
this->range.insert(rangeIter, IndexerV2Range(leftMin, leftMax));
this->range.insert(rangeIter + 1, IndexerV2Range(rightMin, rightMax));
}
bool IndexerV2::IsFree(uint32_t index) {
uint32_t rangeSize = this->range.size();
for (uint32_t rangePos = 0; rangePos < rangeSize; rangePos++) {
auto range = this->range[rangePos];
if (index >= range.min && index <= range.max)
return false;
}
return true;
}
bool IndexerV2::IsUsed(uint32_t index) {
return !IsFree(index);
}
IndexerV2::IndexerV2Range::IndexerV2Range(uint32_t min, uint32_t max) {
this->min = min;
this->max = max;
}
DLL_EXPORT void* IndexerV2_Create() {
IndexerV2* indexerPtr = new IndexerV2();
return indexerPtr;
}
#pragma comment(linker, "/EXPORT:IndexerV2_Create=_IndexerV2_Create@0")
DLL_EXPORT void IndexerV2_Destroy(uint32_t indexerIntPtr) {
IndexerV2* indexerPtr = (IndexerV2*)indexerIntPtr;
delete indexerPtr;
}
#pragma comment(linker, "/EXPORT:IndexerV2_Destroy=_IndexerV2_Destroy@4")
DLL_EXPORT uint32_t IndexerV2_GetIndex(uint32_t indexerIntPtr) {
IndexerV2* indexerPtr = (IndexerV2*)indexerIntPtr;
return indexerPtr->GetIndex();
}
#pragma comment(linker, "/EXPORT:IndexerV2_GetIndex=_IndexerV2_GetIndex@4")
DLL_EXPORT uint32_t IndexerV2_IsFree(uint32_t indexerIntPtr, uint32_t index) {
IndexerV2* indexerPtr = (IndexerV2*)indexerIntPtr;
return indexerPtr->IsFree(index);
}
#pragma comment(linker, "/EXPORT:IndexerV2_IsFree=_IndexerV2_IsFree@8")
DLL_EXPORT uint32_t IndexerV2_IsUsed(uint32_t indexerIntPtr, uint32_t index) {
IndexerV2* indexerPtr = (IndexerV2*)indexerIntPtr;
return indexerPtr->IsUsed(index);
}
#pragma comment(linker, "/EXPORT:IndexerV2_IsUsed=_IndexerV2_IsUsed@8")
+24
View File
@@ -0,0 +1,24 @@
#pragma once
#include "dllmain.h"
#include <vector>
class IndexerV2 {
public:
IndexerV2();
~IndexerV2();
uint32_t GetIndex();
void MarkIndex(uint32_t index);
bool IsFree(uint32_t index);
bool IsUsed(uint32_t index);
private:
struct IndexerV2Range {
uint32_t min, max;
IndexerV2Range(uint32_t pmin, uint32_t pmax);
};
std::vector<IndexerV2Range> range;
};
+2 -8
View File
@@ -21,11 +21,5 @@ 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);
}
DLL_EXPORT void WindowMessageHandler_Install(HWND hwnd);
DLL_EXPORT void WindowMessageHandler_Uninstall(HWND hwnd);
+1 -2
View File
@@ -1,4 +1,3 @@
#pragma once
#include "dllmain.h"
#include <list>
@@ -8,7 +7,7 @@
#include "Math\Vector3.h"
#include "Math\Matrix3.h"
#include "Utility\Display.h"
#include "Utility\Indexer.h"
#include "Utility\IndexerV1.h"
#include "Utility\WindowMessageHandler.h"
bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
+3 -1
View File
@@ -1,3 +1,5 @@
#pragma once
// STL Exceptions
#include <exception>
#include <stdexcept>
@@ -9,4 +11,4 @@
#include <windows.h>
// Macros
#define DLL_EXPORT extern "C" __declspec(dllexport)
#define DLL_EXPORT extern "C" //__declspec(dllexport)