diff --git a/METHODSTABLE.txt b/METHODSTABLE.txt
deleted file mode 100644
index 0ebc776..0000000
--- a/METHODSTABLE.txt
+++ /dev/null
@@ -1,1073 +0,0 @@
-D3D9 Methods Table:
-[0] QueryInterface
-[1] AddRef
-[2] Release
-[3] TestCooperativeLevel
-[4] GetAvailableTextureMem
-[5] EvictManagedResources
-[6] GetDirect3D
-[7] GetDeviceCaps
-[8] GetDisplayMode
-[9] GetCreationParameters
-[10] SetCursorProperties
-[11] SetCursorPosition
-[12] ShowCursor
-[13] CreateAdditionalSwapChain
-[14] GetSwapChain
-[15] GetNumberOfSwapChains
-[16] Reset
-[17] Present
-[18] GetBackBuffer
-[19] GetRasterStatus
-[20] SetDialogBoxMode
-[21] SetGammaRamp
-[22] GetGammaRamp
-[23] CreateTexture
-[24] CreateVolumeTexture
-[25] CreateCubeTexture
-[26] CreateVertexBuffer
-[27] CreateIndexBuffer
-[28] CreateRenderTarget
-[29] CreateDepthStencilSurface
-[30] UpdateSurface
-[31] UpdateTexture
-[32] GetRenderTargetData
-[33] GetFrontBufferData
-[34] StretchRect
-[35] ColorFill
-[36] CreateOffscreenPlainSurface
-[37] SetRenderTarget
-[38] GetRenderTarget
-[39] SetDepthStencilSurface
-[40] GetDepthStencilSurface
-[41] BeginScene
-[42] EndScene
-[43] Clear
-[44] SetTransform
-[45] GetTransform
-[46] MultiplyTransform
-[47] SetViewport
-[48] GetViewport
-[49] SetMaterial
-[50] GetMaterial
-[51] SetLight
-[52] GetLight
-[53] LightEnable
-[54] GetLightEnable
-[55] SetClipPlane
-[56] GetClipPlane
-[57] SetRenderState
-[58] GetRenderState
-[59] CreateStateBlock
-[60] BeginStateBlock
-[61] EndStateBlock
-[62] SetClipStatus
-[63] GetClipStatus
-[64] GetTexture
-[65] SetTexture
-[66] GetTextureStageState
-[67] SetTextureStageState
-[68] GetSamplerState
-[69] SetSamplerState
-[70] ValidateDevice
-[71] SetPaletteEntries
-[72] GetPaletteEntries
-[73] SetCurrentTexturePalette
-[74] GetCurrentTexturePalette
-[75] SetScissorRect
-[76] GetScissorRect
-[77] SetSoftwareVertexProcessing
-[78] GetSoftwareVertexProcessing
-[79] SetNPatchMode
-[80] GetNPatchMode
-[81] DrawPrimitive
-[82] DrawIndexedPrimitive
-[83] DrawPrimitiveUP
-[84] DrawIndexedPrimitiveUP
-[85] ProcessVertices
-[86] CreateVertexDeclaration
-[87] SetVertexDeclaration
-[88] GetVertexDeclaration
-[89] SetFVF
-[90] GetFVF
-[91] CreateVertexShader
-[92] SetVertexShader
-[93] GetVertexShader
-[94] SetVertexShaderConstantF
-[95] GetVertexShaderConstantF
-[96] SetVertexShaderConstantI
-[97] GetVertexShaderConstantI
-[98] SetVertexShaderConstantB
-[99] GetVertexShaderConstantB
-[100] SetStreamSource
-[101] GetStreamSource
-[102] SetStreamSourceFreq
-[103] GetStreamSourceFreq
-[104] SetIndices
-[105] GetIndices
-[106] CreatePixelShader
-[107] SetPixelShader
-[108] GetPixelShader
-[109] SetPixelShaderConstantF
-[110] GetPixelShaderConstantF
-[111] SetPixelShaderConstantI
-[112] GetPixelShaderConstantI
-[113] SetPixelShaderConstantB
-[114] GetPixelShaderConstantB
-[115] DrawRectPatch
-[116] DrawTriPatch
-[117] DeletePatch
-[118] CreateQuery
-
-D3D10 Methods Table:
-[0] QueryInterface
-[1] AddRef
-[2] Release
-[3] SetPrivateData
-[4] SetPrivateDataInterface
-[5] GetPrivateData
-[6] GetParent
-[7] GetDevice
-[8] Present
-[9] GetBuffer
-[10] SetFullscreenState
-[11] GetFullscreenState
-[12] GetDesc
-[13] ResizeBuffers
-[14] ResizeTarget
-[15] GetContainingOutput
-[16] GetFrameStatistics
-[17] GetLastPresentCount
-[18] QueryInterface
-[19] AddRef
-[20] Release
-[21] VSSetConstantBuffers
-[22] PSSetShaderResources
-[23] PSSetShader
-[24] PSSetSamplers
-[25] VSSetShader
-[26] DrawIndexed
-[27] Draw
-[28] PSSetConstantBuffers
-[29] IASetInputLayout
-[30] IASetVertexBuffers
-[31] IASetIndexBuffer
-[32] DrawIndexedInstanced
-[33] DrawInstanced
-[34] GSSetConstantBuffers
-[35] GSSetShader
-[36] IASetPrimitiveTopology
-[37] VSSetShaderResources
-[38] VSSetSamplers
-[39] SetPredication
-[40] GSSetShaderResources
-[41] GSSetSamplers
-[42] OMSetRenderTargets
-[43] OMSetBlendState
-[44] OMSetDepthStencilState
-[45] SOSetTargets
-[46] DrawAuto
-[47] RSSetState
-[48] RSSetViewports
-[49] RSSetScissorRects
-[50] CopySubresourceRegion
-[51] CopyResource
-[52] UpdateSubresource
-[53] ClearRenderTargetView
-[54] ClearDepthStencilView
-[55] GenerateMips
-[56] ResolveSubresource
-[57] VSGetConstantBuffers
-[58] PSGetShaderResources
-[59] PSGetShader
-[60] PSGetSamplers
-[61] VSGetShader
-[62] PSGetConstantBuffers
-[63] IAGetInputLayout
-[64] IAGetVertexBuffers
-[65] IAGetIndexBuffer
-[66] GSGetConstantBuffers
-[67] GSGetShader
-[68] IAGetPrimitiveTopology
-[69] VSGetShaderResources
-[70] VSGetSamplers
-[71] GetPredication
-[72] GSGetShaderResources
-[73] GSGetSamplers
-[74] OMGetRenderTargets
-[75] OMGetBlendState
-[76] OMGetDepthStencilState
-[77] SOGetTargets
-[78] RSGetState
-[79] RSGetViewports
-[80] RSGetScissorRects
-[81] GetDeviceRemovedReason
-[82] SetExceptionMode
-[83] GetExceptionMode
-[84] GetPrivateData
-[85] SetPrivateData
-[86] SetPrivateDataInterface
-[87] ClearState
-[88] Flush
-[89] CreateBuffer
-[90] CreateTexture1D
-[91] CreateTexture2D
-[92] CreateTexture3D
-[93] CreateShaderResourceView
-[94] CreateRenderTargetView
-[95] CreateDepthStencilView
-[96] CreateInputLayout
-[97] CreateVertexShader
-[98] CreateGeometryShader
-[99] CreateGemoetryShaderWithStreamOutput
-[100] CreatePixelShader
-[101] CreateBlendState
-[102] CreateDepthStencilState
-[103] CreateRasterizerState
-[104] CreateSamplerState
-[105] CreateQuery
-[106] CreatePredicate
-[107] CreateCounter
-[108] CheckFormatSupport
-[109] CheckMultisampleQualityLevels
-[110] CheckCounterInfo
-[111] CheckCounter
-[112] GetCreationFlags
-[113] OpenSharedResource
-[114] SetTextFilterSize
-[115] GetTextFilterSize
-
-D3D11 Methods Table:
-[0] QueryInterface
-[1] AddRef
-[2] Release
-[3] SetPrivateData
-[4] SetPrivateDataInterface
-[5] GetPrivateData
-[6] GetParent
-[7] GetDevice
-[8] Present
-[9] GetBuffer
-[10] SetFullscreenState
-[11] GetFullscreenState
-[12] GetDesc
-[13] ResizeBuffers
-[14] ResizeTarget
-[15] GetContainingOutput
-[16] GetFrameStatistics
-[17] GetLastPresentCount
-[18] QueryInterface
-[19] AddRef
-[20] Release
-[21] CreateBuffer
-[22] CreateTexture1D
-[23] CreateTexture2D
-[24] CreateTexture3D
-[25] CreateShaderResourceView
-[26] CreateUnorderedAccessView
-[27] CreateRenderTargetView
-[28] CreateDepthStencilView
-[29] CreateInputLayout
-[30] CreateVertexShader
-[31] CreateGeometryShader
-[32] CreateGeometryShaderWithStreamOutput
-[33] CreatePixelShader
-[34] CreateHullShader
-[35] CreateDomainShader
-[36] CreateComputeShader
-[37] CreateClassLinkage
-[38] CreateBlendState
-[39] CreateDepthStencilState
-[40] CreateRasterizerState
-[41] CreateSamplerState
-[42] CreateQuery
-[43] CreatePredicate
-[44] CreateCounter
-[45] CreateDeferredContext
-[46] OpenSharedResource
-[47] CheckFormatSupport
-[48] CheckMultisampleQualityLevels
-[49] CheckCounterInfo
-[50] CheckCounter
-[51] CheckFeatureSupport
-[52] GetPrivateData
-[53] SetPrivateData
-[54] SetPrivateDataInterface
-[55] GetFeatureLevel
-[56] GetCreationFlags
-[57] GetDeviceRemovedReason
-[58] GetImmediateContext
-[59] SetExceptionMode
-[60] GetExceptionMode
-[61] QueryInterface
-[62] AddRef
-[63] Release
-[64] GetDevice
-[65] GetPrivateData
-[66] SetPrivateData
-[67] SetPrivateDataInterface
-[68] SetConstantBuffers
-[69] SetShaderResources
-[70] SetShader
-[71] SetSamplers
-[72] SetShader
-[73] DrawIndexed
-[74] Draw
-[75] Map
-[76] Unmap
-[77] SetConstantBuffers
-[78] IASetInputLayout
-[79] IASetVertexBuffers
-[80] IASetIndexBuffer
-[81] DrawIndexedInstanced
-[82] DrawInstanced
-[83] SetConstantBuffers
-[84] SetShader
-[85] IASetPrimitiveTopology
-[86] SetShaderResources
-[87] SetSamplers
-[88] Begin
-[89] End
-[90] GetData
-[91] SetPredication
-[92] SetShaderResources
-[93] SetSamplers
-[94] OMSetRenderTargets
-[95] OMSetRenderTargetsAndUnorderedAccessViews
-[96] OMSetBlendState
-[97] OMSetDepthStencilState
-[98] SOSetTargets
-[99] DrawAuto
-[100] DrawIndexedInstancedIndirect
-[101] DrawInstancedIndirect
-[102] Dispatch
-[103] DispatchIndirect
-[104] RSSetState
-[105] RSSetViewports
-[106] RSSetScissorRects
-[107] CopySubresourceRegion
-[108] CopyResource
-[109] UpdateSubresource
-[110] CopyStructureCount
-[111] ClearRenderTargetView
-[112] ClearUnorderedAccessViewUint
-[113] ClearUnorderedAccessViewFloat
-[114] ClearDepthStencilView
-[115] GenerateMips
-[116] SetResourceMinLOD
-[117] GetResourceMinLOD
-[118] ResolveSubresource
-[119] ExecuteCommandList
-[120] SetShaderResources
-[121] SetShader
-[122] SetSamplers
-[123] SetConstantBuffers
-[124] SetShaderResources
-[125] SetShader
-[126] SetSamplers
-[127] SetConstantBuffers
-[128] SetShaderResources
-[129] CSSetUnorderedAccessViews
-[130] SetShader
-[131] SetSamplers
-[132] SetConstantBuffers
-[133] VSGetConstantBuffers
-[134] PSGetShaderResources
-[135] PSGetShader
-[136] PSGetSamplers
-[137] VSGetShader
-[138] PSGetConstantBuffers
-[139] IAGetInputLayout
-[140] IAGetVertexBuffers
-[141] IAGetIndexBuffer
-[142] GSGetConstantBuffers
-[143] GSGetShader
-[144] IAGetPrimitiveTopology
-[145] VSGetShaderResources
-[146] VSGetSamplers
-[147] GetPredication
-[148] GSGetShaderResources
-[149] GSGetSamplers
-[150] OMGetRenderTargets
-[151] OMGetRenderTargetsAndUnorderedAccessViews
-[152] OMGetBlendState
-[153] OMGetDepthStencilState
-[154] SOGetTargets
-[155] RSGetState
-[156] RSGetViewports
-[157] RSGetScissorRects
-[158] HSGetShaderResources
-[159] HSGetShader
-[160] HSGetSamplers
-[161] HSGetConstantBuffers
-[162] DSGetShaderResources
-[163] DSGetShader
-[164] DSGetSamplers
-[165] DSGetConstantBuffers
-[166] CSGetShaderResources
-[167] CSGetUnorderedAccessViews
-[168] CSGetShader
-[169] CSGetSamplers
-[170] CSGetConstantBuffers
-[171] ClearState
-[172] Flush
-[173] GetType
-[174] GetContextFlags
-[175] FinishCommandList
-[176] CopySubresourceRegion1
-[177] UpdateSubresource1
-[178] DiscardResource
-[179] DiscardView
-[180] SetConstantBuffers1
-[181] SetConstantBuffers1
-[182] SetConstantBuffers1
-[183] SetConstantBuffers1
-[184] SetConstantBuffers1
-[185] SetConstantBuffers1
-[186] VSGetConstantBuffers1
-[187] HSGetConstantBuffers1
-[188] DSGetConstantBuffers1
-[189] GSGetConstantBuffers1
-[190] PSGetConstantBuffers1
-[191] CSGetConstantBuffers1
-[192] SwapDeviceContextState
-[193] ClearView
-[194] DiscardView1
-[195] UpdateTileMappings
-[196] CopyTileMappings
-[197] CopyTiles
-[198] UpdateTiles
-[199] ResizeTilePool
-[200] TiledResourceBarrier
-[201] IsAnnotationEnabled
-[202] SetMarkerInt
-[203] BeginEventInt
-[204] EndEvent
-
-D3D12 Methods Table:
-[0] QueryInterface
-[1] AddRef
-[2] Release
-[3] GetPrivateData
-[4] SetPrivateData
-[5] SetPrivateDataInterface
-[6] SetName
-[7] GetNodeCount
-[8] CreateCommandQueue
-[9] CreateCommandAllocator
-[10] CreateGraphicsPipelineState
-[11] CreateComputePipelineState
-[12] CreateCommandList
-[13] CheckFeatureSupport
-[14] CreateDescriptorHeap
-[15] GetDescriptorHandleIncrementSize
-[16] CreateRootSignature
-[17] CreateConstantBufferView
-[18] CreateShaderResourceView
-[19] CreateUnorderedAccessView
-[20] CreateRenderTargetView
-[21] CreateDepthStencilView
-[22] CreateSampler
-[23] CopyDescriptors
-[24] CopyDescriptorsSimple
-[25] GetResourceAllocationInfo
-[26] GetCustomHeapProperties
-[27] CreateCommittedResource
-[28] CreateHeap
-[29] CreatePlacedResource
-[30] CreateReservedResource
-[31] CreateSharedHandle
-[32] OpenSharedHandle
-[33] OpenSharedHandleByName
-[34] MakeResident
-[35] Evict
-[36] CreateFence
-[37] GetDeviceRemovedReason
-[38] GetCopyableFootprints
-[39] CreateQueryHeap
-[40] SetStablePowerState
-[41] CreateCommandSignature
-[42] GetResourceTiling
-[43] GetAdapterLuid
-[44] QueryInterface
-[45] AddRef
-[46] Release
-[47] GetPrivateData
-[48] SetPrivateData
-[49] SetPrivateDataInterface
-[50] SetName
-[51] GetDevice
-[52] UpdateTileMappings
-[53] CopyTileMappings
-[54] ExecuteCommandLists
-[55] SetMarker
-[56] BeginEvent
-[57] EndEvent
-[58] Signal
-[59] Wait
-[60] GetTimestampFrequency
-[61] GetClockCalibration
-[62] GetDesc
-[63] QueryInterface
-[64] AddRef
-[65] Release
-[66] GetPrivateData
-[67] SetPrivateData
-[68] SetPrivateDataInterface
-[69] SetName
-[70] GetDevice
-[71] Reset
-[72] QueryInterface
-[73] AddRef
-[74] Release
-[75] GetPrivateData
-[76] SetPrivateData
-[77] SetPrivateDataInterface
-[78] SetName
-[79] GetDevice
-[80] GetType
-[81] Close
-[82] Reset
-[83] ClearState
-[84] DrawInstanced
-[85] DrawIndexedInstanced
-[86] Dispatch
-[87] CopyBufferRegion
-[88] CopyTextureRegion
-[89] CopyResource
-[90] CopyTiles
-[91] ResolveSubresource
-[92] IASetPrimitiveTopology
-[93] RSSetViewports
-[94] RSSetScissorRects
-[95] OMSetBlendFactor
-[96] OMSetStencilRef
-[97] SetPipelineState
-[98] ResourceBarrier
-[99] ExecuteBundle
-[100] SetDescriptorHeaps
-[101] SetComputeRootSignature
-[102] SetGraphicsRootSignature
-[103] SetComputeRootDescriptorTable
-[104] SetGraphicsRootDescriptorTable
-[105] SetComputeRoot32BitConstant
-[106] SetGraphicsRoot32BitConstant
-[107] SetComputeRoot32BitConstants
-[108] SetGraphicsRoot32BitConstants
-[109] SetComputeRootConstantBufferView
-[110] SetGraphicsRootConstantBufferView
-[111] SetComputeRootShaderResourceView
-[112] SetGraphicsRootShaderResourceView
-[113] SetComputeRootUnorderedAccessView
-[114] SetGraphicsRootUnorderedAccessView
-[115] IASetIndexBuffer
-[116] IASetVertexBuffers
-[117] SOSetTargets
-[118] OMSetRenderTargets
-[119] ClearDepthStencilView
-[120] ClearRenderTargetView
-[121] ClearUnorderedAccessViewUint
-[122] ClearUnorderedAccessViewFloat
-[123] DiscardResource
-[124] BeginQuery
-[125] EndQuery
-[126] ResolveQueryData
-[127] SetPredication
-[128] SetMarker
-[129] BeginEvent
-[130] EndEvent
-[131] ExecuteIndirect
-[132] QueryInterface
-[133] AddRef
-[134] Release
-[135] SetPrivateData
-[136] SetPrivateDataInterface
-[137] GetPrivateData
-[138] GetParent
-[139] GetDevice
-[140] Present
-[141] GetBuffer
-[142] SetFullscreenState
-[143] GetFullscreenState
-[144] GetDesc
-[145] ResizeBuffers
-[146] ResizeTarget
-[147] GetContainingOutput
-[148] GetFrameStatistics
-[149] GetLastPresentCount
-
-OpenGL Methods Table:
-[0] glAccum
-[1] glAlphaFunc
-[2] glAreTexturesResident
-[3] glArrayElement
-[4] glBegin
-[5] glBindTexture
-[6] glBitmap
-[7] glBlendFunc
-[8] glCallList
-[9] glCallLists
-[10] glClear
-[11] glClearAccum
-[12] glClearColor
-[13] glClearDepth
-[14] glClearIndex
-[15] glClearStencil
-[16] glClipPlane
-[17] glColor3b
-[18] glColor3bv
-[19] glColor3d
-[20] glColor3dv
-[21] glColor3f
-[22] glColor3fv
-[23] glColor3i
-[24] glColor3iv
-[25] glColor3s
-[26] glColor3sv
-[27] glColor3ub
-[28] glColor3ubv
-[29] glColor3ui
-[30] glColor3uiv
-[31] glColor3us
-[32] glColor3usv
-[33] glColor4b
-[34] glColor4bv
-[35] glColor4d
-[36] glColor4dv
-[37] glColor4f
-[38] glColor4fv
-[39] glColor4i
-[40] glColor4iv
-[41] glColor4s
-[42] glColor4sv
-[43] glColor4ub
-[44] glColor4ubv
-[45] glColor4ui
-[46] glColor4uiv
-[47] glColor4us
-[48] glColor4usv
-[49] glColorMask
-[50] glColorMaterial
-[51] glColorPointer
-[52] glCopyPixels
-[53] glCopyTexImage1D
-[54] glCopyTexImage2D
-[55] glCopyTexSubImage1D
-[56] glCopyTexSubImage2D
-[57] glCullFaceglCullFace
-[58] glDeleteLists
-[59] glDeleteTextures
-[60] glDepthFunc
-[61] glDepthMask
-[62] glDepthRange
-[63] glDisable
-[64] glDisableClientState
-[65] glDrawArrays
-[66] glDrawBuffer
-[67] glDrawElements
-[68] glDrawPixels
-[69] glEdgeFlag
-[70] glEdgeFlagPointer
-[71] glEdgeFlagv
-[72] glEnable
-[73] glEnableClientState
-[74] glEnd
-[75] glEndList
-[76] glEvalCoord1d
-[77] glEvalCoord1dv
-[78] glEvalCoord1f
-[79] glEvalCoord1fv
-[80] glEvalCoord2d
-[81] glEvalCoord2dv
-[82] glEvalCoord2f
-[83] glEvalCoord2fv
-[84] glEvalMesh1
-[85] glEvalMesh2
-[86] glEvalPoint1
-[87] glEvalPoint2
-[88] glFeedbackBuffer
-[89] glFinish
-[90] glFlush
-[91] glFogf
-[92] glFogfv
-[93] glFogi
-[94] glFogiv
-[95] glFrontFace
-[96] glFrustum
-[97] glGenLists
-[98] glGenTextures
-[99] glGetBooleanv
-[100] glGetClipPlane
-[101] glGetDoublev
-[102] glGetError
-[103] glGetFloatv
-[104] glGetIntegerv
-[105] glGetLightfv
-[106] glGetLightiv
-[107] glGetMapdv
-[108] glGetMapfv
-[109] glGetMapiv
-[110] glGetMaterialfv
-[111] glGetMaterialiv
-[112] glGetPixelMapfv
-[113] glGetPixelMapuiv
-[114] glGetPixelMapusv
-[115] glGetPointerv
-[116] glGetPolygonStipple
-[117] glGetString
-[118] glGetTexEnvfv
-[119] glGetTexEnviv
-[120] glGetTexGendv
-[121] glGetTexGenfv
-[122] glGetTexGeniv
-[123] glGetTexImage
-[124] glGetTexLevelParameterfv
-[125] glGetTexLevelParameteriv
-[126] glGetTexParameterfv
-[127] glGetTexParameteriv
-[128] glHint
-[129] glIndexMask
-[130] glIndexPointer
-[131] glIndexd
-[132] glIndexdv
-[133] glIndexf
-[134] glIndexfv
-[135] glIndexi
-[136] glIndexiv
-[137] glIndexs
-[138] glIndexsv
-[139] glIndexub
-[140] glIndexubv
-[141] glInitNames
-[142] glInterleavedArrays
-[143] glIsEnabled
-[144] glIsList
-[145] glIsTexture
-[146] glLightModelf
-[147] glLightModelfv
-[148] glLightModeli
-[149] glLightModeliv
-[150] glLightf
-[151] glLightfv
-[152] glLighti
-[153] glLightiv
-[154] glLineStipple
-[155] glLineWidth
-[156] glListBase
-[157] glLoadIdentity
-[158] glLoadMatrixd
-[159] glLoadMatrixf
-[160] glLoadName
-[161] glLogicOp
-[162] glMap1d
-[163] glMap1f
-[164] glMap2d
-[165] glMap2f
-[166] glMapGrid1d
-[167] glMapGrid1f
-[168] glMapGrid2d
-[169] glMapGrid2f
-[170] glMaterialf
-[171] glMaterialfv
-[172] glMateriali
-[173] glMaterialiv
-[174] glMatrixMode
-[175] glMultMatrixd
-[176] glMultMatrixf
-[177] glNewList
-[178] glNormal3b
-[179] glNormal3bv
-[180] glNormal3d
-[181] glNormal3dv
-[182] glNormal3f
-[183] glNormal3fv
-[184] glNormal3i
-[185] glNormal3iv
-[186] glNormal3s
-[187] glNormal3sv
-[188] glNormalPointer
-[189] glOrtho
-[190] glPassThrough
-[191] glPixelMapfv
-[192] glPixelMapuiv
-[193] glPixelMapusv
-[194] glPixelStoref
-[195] glPixelStorei
-[196] glPixelTransferf
-[197] glPixelTransferi
-[198] glPixelZoom
-[199] glPointSize
-[200] glPolygonMode
-[201] glPolygonOffset
-[202] glPolygonStipple
-[203] glPopAttrib
-[204] glPopClientAttrib
-[205] glPopMatrix
-[206] glPopName
-[207] glPrioritizeTextures
-[208] glPushAttrib
-[209] glPushClientAttrib
-[210] glPushMatrix
-[211] glPushName
-[212] glRasterPos2d
-[213] glRasterPos2dv
-[214] glRasterPos2f
-[215] glRasterPos2fv
-[216] glRasterPos2i
-[217] glRasterPos2iv
-[218] glRasterPos2s
-[219] glRasterPos2sv
-[220] glRasterPos3d
-[221] glRasterPos3dv
-[222] glRasterPos3f
-[223] glRasterPos3fv
-[224] glRasterPos3i
-[225] glRasterPos3iv
-[226] glRasterPos3s
-[227] glRasterPos3sv
-[228] glRasterPos4d
-[229] glRasterPos4dv
-[230] glRasterPos4f
-[231] glRasterPos4fv
-[232] glRasterPos4i
-[233] glRasterPos4iv
-[234] glRasterPos4s
-[235] glRasterPos4sv
-[236] glReadBuffer
-[237] glReadPixels
-[238] glRectd
-[239] glRectdv
-[240] glRectf
-[241] glRectfv
-[242] glRecti
-[243] glRectiv
-[244] glRects
-[245] glRectsv
-[246] glRenderMode
-[247] glRotated
-[248] glRotatef
-[249] glScaled
-[250] glScalef
-[251] glScissor
-[252] glSelectBuffer
-[253] glShadeModel
-[254] glStencilFunc
-[255] glStencilMask
-[256] glStencilOp
-[257] glTexCoord1d
-[258] glTexCoord1dv
-[259] glTexCoord1f
-[260] glTexCoord1fv
-[261] glTexCoord1i
-[262] glTexCoord1iv
-[263] glTexCoord1s
-[264] glTexCoord1sv
-[265] glTexCoord2d
-[266] glTexCoord2dv
-[267] glTexCoord2f
-[268] glTexCoord2fv
-[269] glTexCoord2i
-[270] glTexCoord2iv
-[271] glTexCoord2s
-[272] glTexCoord2sv
-[273] glTexCoord3d
-[274] glTexCoord3dv
-[275] glTexCoord3f
-[276] glTexCoord3fv
-[277] glTexCoord3i
-[278] glTexCoord3iv
-[279] glTexCoord3s
-[280] glTexCoord3sv
-[281] glTexCoord4d
-[282] glTexCoord4dv
-[283] glTexCoord4f
-[284] glTexCoord4fv
-[285] glTexCoord4i
-[286] glTexCoord4iv
-[287] glTexCoord4s
-[288] glTexCoord4sv
-[289] glTexCoordPointer
-[290] glTexEnvf
-[291] glTexEnvfv
-[292] glTexEnvi
-[293] glTexEnviv
-[294] glTexGend
-[295] glTexGendv
-[296] glTexGenf
-[297] glTexGenfv
-[298] glTexGeni
-[299] glTexGeniv
-[300] glTexImage1D
-[301] glTexImage2D
-[302] glTexParameterf
-[303] glTexParameterfv
-[304] glTexParameteri
-[305] glTexParameteriv
-[306] glTexSubImage1D
-[307] glTexSubImage2D
-[308] glTranslated
-[309] glTranslatef
-[310] glVertex2d
-[311] glVertex2dv
-[312] glVertex2f
-[313] glVertex2fv
-[314] glVertex2i
-[315] glVertex2iv
-[316] glVertex2s
-[317] glVertex2sv
-[318] glVertex3d
-[319] glVertex3dv
-[320] glVertex3f
-[321] glVertex3fv
-[322] glVertex3i
-[323] glVertex3iv
-[324] glVertex3s
-[325] glVertex3sv
-[326] glVertex4d
-[327] glVertex4dv
-[328] glVertex4f
-[329] glVertex4fv
-[330] glVertex4i
-[331] glVertex4iv
-[332] glVertex4s
-[333] glVertex4sv
-[334] glVertexPointer
-[335] glViewport
-
-Vulkan Methods Table:
-[0] vkCreateInstance
-[1] vkDestroyInstance
-[2] vkEnumeratePhysicalDevices
-[3] vkGetPhysicalDeviceFeatures
-[4] vkGetPhysicalDeviceFormatProperties
-[5] vkGetPhysicalDeviceImageFormatProperties
-[6] vkGetPhysicalDeviceProperties
-[7] vkGetPhysicalDeviceQueueFamilyProperties
-[8] vkGetPhysicalDeviceMemoryProperties
-[9] vkGetInstanceProcAddr
-[10] vkGetDeviceProcAddr
-[11] vkCreateDevice
-[12] vkDestroyDevice
-[13] vkEnumerateInstanceExtensionProperties
-[14] vkEnumerateDeviceExtensionProperties
-[15] vkEnumerateDeviceLayerProperties
-[16] vkGetDeviceQueue
-[17] vkQueueSubmit
-[18] vkQueueWaitIdle
-[19] vkDeviceWaitIdle
-[20] vkAllocateMemory
-[21] vkFreeMemory
-[22] vkMapMemory
-[23] vkUnmapMemory
-[24] vkFlushMappedMemoryRanges
-[25] vkInvalidateMappedMemoryRanges
-[26] vkGetDeviceMemoryCommitment
-[27] vkBindBufferMemory
-[28] vkBindImageMemory
-[29] vkGetBufferMemoryRequirements
-[30] vkGetImageMemoryRequirements
-[31] vkGetImageSparseMemoryRequirements
-[32] vkGetPhysicalDeviceSparseImageFormatProperties
-[33] vkQueueBindSparse
-[34] vkCreateFence
-[35] vkDestroyFence
-[36] vkResetFences
-[37] vkGetFenceStatus
-[38] vkWaitForFences
-[39] vkCreateSemaphore
-[40] vkDestroySemaphore
-[41] vkCreateEvent
-[42] vkDestroyEvent
-[43] vkGetEventStatus
-[44] vkSetEvent
-[45] vkResetEvent
-[46] vkCreateQueryPool
-[47] vkDestroyQueryPool
-[48] vkGetQueryPoolResults
-[49] vkCreateBuffer
-[50] vkDestroyBuffer
-[51] vkCreateBufferView
-[52] vkDestroyBufferView
-[53] vkCreateImage
-[54] vkDestroyImage
-[55] vkGetImageSubresourceLayout
-[56] vkCreateImageView
-[57] vkDestroyImageView
-[58] vkCreateShaderModule
-[59] vkDestroyShaderModule
-[60] vkCreatePipelineCache
-[61] vkDestroyPipelineCache
-[62] vkGetPipelineCacheData
-[63] vkMergePipelineCaches
-[64] vkCreateGraphicsPipelines
-[65] vkCreateComputePipelines
-[66] vkDestroyPipeline
-[67] vkCreatePipelineLayout
-[68] vkDestroyPipelineLayout
-[69] vkCreateSampler
-[70] vkDestroySampler
-[71] vkCreateDescriptorSetLayout
-[72] vkDestroyDescriptorSetLayout
-[73] vkCreateDescriptorPool
-[74] vkDestroyDescriptorPool
-[75] vkResetDescriptorPool
-[76] vkAllocateDescriptorSets
-[77] vkFreeDescriptorSets
-[78] vkUpdateDescriptorSets
-[79] vkCreateFramebuffer
-[80] vkDestroyFramebuffer
-[81] vkCreateRenderPass
-[82] vkDestroyRenderPass
-[83] vkGetRenderAreaGranularity
-[84] vkCreateCommandPool
-[85] vkDestroyCommandPool
-[86] vkResetCommandPool
-[87] vkAllocateCommandBuffers
-[88] vkFreeCommandBuffers
-[89] vkBeginCommandBuffer
-[90] vkEndCommandBuffer
-[91] vkResetCommandBuffer
-[92] vkCmdBindPipeline
-[93] vkCmdSetViewport
-[94] vkCmdSetScissor
-[95] vkCmdSetLineWidth
-[96] vkCmdSetDepthBias
-[97] vkCmdSetBlendConstants
-[98] vkCmdSetDepthBounds
-[99] vkCmdSetStencilCompareMask
-[100] vkCmdSetStencilWriteMask
-[101] vkCmdSetStencilReference
-[102] vkCmdBindDescriptorSets
-[103] vkCmdBindIndexBuffer
-[104] vkCmdBindVertexBuffers
-[105] vkCmdDraw
-[106] vkCmdDrawIndexed
-[107] vkCmdDrawIndirect
-[108] vkCmdDrawIndexedIndirect
-[109] vkCmdDispatch
-[110] vkCmdDispatchIndirect
-[111] vkCmdCopyBuffer
-[112] vkCmdCopyImage
-[113] vkCmdBlitImage
-[114] vkCmdCopyBufferToImage
-[115] vkCmdCopyImageToBuffer
-[116] vkCmdUpdateBuffer
-[117] vkCmdFillBuffer
-[118] vkCmdClearColorImage
-[119] vkCmdClearDepthStencilImage
-[120] vkCmdClearAttachments
-[121] vkCmdResolveImage
-[122] vkCmdSetEvent
-[123] vkCmdResetEvent
-[124] vkCmdWaitEvents
-[125] vkCmdPipelineBarrier
-[126] vkCmdBeginQuery
-[127] vkCmdEndQuery
-[128] vkCmdResetQueryPool
-[129] vkCmdWriteTimestamp
-[130] vkCmdCopyQueryPoolResults
-[131] vkCmdPushConstants
-[132] vkCmdBeginRenderPass
-[133] vkCmdNextSubpass
-[134] vkCmdEndRenderPass
-[135] vkCmdExecuteCommands
\ No newline at end of file
diff --git a/README.md b/README.md
index 752a4d6..50f8618 100644
--- a/README.md
+++ b/README.md
@@ -7,90 +7,44 @@
- Universal graphical hook for a D3D9-D3D12, OpenGL and Vulcan based games
+ Universal graphical hook for a D3D9-D3D12, OpenGL and Vulkan based games
-### Requirement
-[Windows SDK](https://www.microsoft.com/en-us/download/details.aspx?id=8279) (For D3D9/D3D10/D3D11/OpenGL hook)
+! ATTENTION !
+At the beginning, I would like to thank everyone who puts stars and says kind words. This gives me an incentive to move on. Thank you for that. But today I have bad news for you, all my projects and work are under threat.
+My computer broke down and this means that I will not be able to develop this and other projects, as well as help people with their issues.
+Since I don't have enough money and I believe that the world is not without good people, I am releasing this unfinished version of kiero so that you can see that the project is really developing, and if you want it to develop further, help raise money to fix my computer. According to my calculations, I need about $140. I will be glad and very grateful for any donation.
-[DirectX SDK](https://www.microsoft.com/en-us/download/details.aspx?id=4064) (For D3D9/D3D10/D3D11 hook)
-
-[Vulkan SDK](https://www.lunarg.com/vulkan-sdk) (For Vulkan hook)
-
-[MinHook](https://github.com/TsudaKageyu/minhook) (For kiero::bind function)
-
-### Example
-To start, go to the kiero.h and select the desired hooks
-```C++
-// Example for D3D9 hook
-#define KIERO_INCLUDE_D3D9 1 // 1 if you need D3D9 hook
-#define KIERO_INCLUDE_D3D10 0 // 1 if you need D3D10 hook
-#define KIERO_INCLUDE_D3D11 0 // 1 if you need D3D11 hook
-#define KIERO_INCLUDE_D3D12 0 // 1 if you need D3D12 hook
-#define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook
-#define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook
-```
-
-Then proceed to the main work
-```C++
-// Example for D3D9 hook
-
-// Include required libraries
-#include "kiero.h"
-#include
-#include
-
-// Create the type of function that we will hook
-typedef long(__stdcall* EndScene)(LPDIRECT3DDEVICE9);
-static EndScene oEndScene = NULL;
-
-// Declare the detour function
-long __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
-{
- // ... Your magic here ...
-
- // static bool init = false;
- // if (!init)
- // {
- // MessageBox(0, "Boom! It's works!", "Kiero", MB_OK);
- // init = true;
- // }
-
- return oEndScene(pDevice);
-}
-
-int kieroExampleThread()
-{
- if (kiero::init(kiero::RenderType::D3D9) == kiero::Status::Success)
- // or
- if (kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)
- {
- // define KIERO_USE_MINHOOK must be 1
- // the index of the required function can be found in the METHODSTABLE.txt
- kiero::bind(42, (void**)&oEndScene, hkEndScene);
-
- // If you just need to get the function address you can use the kiero::getMethodsTable function
- oEndScene = (EndScene)kiero::getMethodsTable()[42];
- }
+
+
+
+
+
+
+
+
+
+
+
- return 0;
-}
+#### Roadmap of the this version
+- [x] Userconfig
+- [ ] D3D7 support
+- [x] D3D8 support
+- [x] D3D9Ex support (thanks @breadbyte)
+- [x] Remove any dependencies
+- [x] New API (aka. alias bindings)
+- [ ] Project documentation
+- [ ] Examples
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID)
-{
- DisableThreadLibraryCalls(hInstance);
+#### Need a stable branch?
+The previous stable version can be found [here](https://github.com/Rebzzel/kiero/tree/1.2.12).
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)kieroExampleThread, NULL, 0, NULL);
- break;
- }
- return TRUE;
-}
+#### Need a examples?
+No examples for this version. Sorry. Try stable version.
-```
+
### License
```
diff --git a/examples/imgui/README.md b/examples/imgui/README.md
deleted file mode 100644
index 6f2b8eb..0000000
--- a/examples/imgui/README.md
+++ /dev/null
@@ -1,10 +0,0 @@
-## Kiero ImGui Universal Example
-### TODO:
-- [x] D3D9
-- [x] D3D10
-- [x] D3D11
-- [ ] D3D12
-- [ ] OpenGL
-- [ ] Vulkan
-
-Author(s): [Rebzzel](https://github.com/Rebzzel)
\ No newline at end of file
diff --git a/examples/imgui/imgui b/examples/imgui/imgui
deleted file mode 160000
index 110f506..0000000
--- a/examples/imgui/imgui
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 110f506ec0dd10999ed685c87c609553cb162028
diff --git a/examples/imgui/impl/d3d10_impl.cpp b/examples/imgui/impl/d3d10_impl.cpp
deleted file mode 100644
index b6867a6..0000000
--- a/examples/imgui/impl/d3d10_impl.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "../../../kiero.h"
-
-#if KIERO_INCLUDE_D3D10
-
-#include "d3d10_impl.h"
-#include
-#include
-
-#include "win32_impl.h"
-
-#include "../imgui/imgui.h"
-#include "../imgui/examples/imgui_impl_win32.h"
-#include "../imgui/examples/imgui_impl_dx10.h"
-
-typedef long(__stdcall* Present)(IDXGISwapChain*, UINT, UINT);
-static Present oPresent = NULL;
-
-long __stdcall hkPresent10(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
-{
- static bool init = false;
-
- if (!init)
- {
- DXGI_SWAP_CHAIN_DESC desc;
- pSwapChain->GetDesc(&desc);
-
- ID3D10Device* device;
- pSwapChain->GetDevice(__uuidof(ID3D10Device), (void**)&device);
-
- impl::win32::init(desc.OutputWindow);
-
- ImGui::CreateContext();
- ImGui_ImplWin32_Init(desc.OutputWindow);
- ImGui_ImplDX10_Init(device);
-
- init = true;
- }
-
- ImGui_ImplDX10_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- impl::showExampleWindow("D3D10");
-
- ImGui::EndFrame();
- ImGui::Render();
- ImGui_ImplDX10_RenderDrawData(ImGui::GetDrawData());
-
- return oPresent(pSwapChain, SyncInterval, Flags);
-}
-
-void impl::d3d10::init()
-{
- assert(kiero::bind(8, (void**)&oPresent, hkPresent10) == kiero::Status::Success);
-}
-
-#endif // KIERO_INCLUDE_D3D10
\ No newline at end of file
diff --git a/examples/imgui/impl/d3d10_impl.h b/examples/imgui/impl/d3d10_impl.h
deleted file mode 100644
index a8f87fe..0000000
--- a/examples/imgui/impl/d3d10_impl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __D3D10_IMPL_H__
-#define __D3D10_IMPL_H__
-
-#include "shared.h"
-
-namespace impl
-{
- namespace d3d10
- {
- void init();
- }
-}
-
-#endif // __D3D10_IMPL_H__
\ No newline at end of file
diff --git a/examples/imgui/impl/d3d11_impl.cpp b/examples/imgui/impl/d3d11_impl.cpp
deleted file mode 100644
index 795504a..0000000
--- a/examples/imgui/impl/d3d11_impl.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "../../../kiero.h"
-
-#if KIERO_INCLUDE_D3D11
-
-#include "d3d11_impl.h"
-#include
-#include
-
-#include "win32_impl.h"
-
-#include "../imgui/imgui.h"
-#include "../imgui/examples/imgui_impl_win32.h"
-#include "../imgui/examples/imgui_impl_dx11.h"
-
-typedef long(__stdcall* Present)(IDXGISwapChain*, UINT, UINT);
-static Present oPresent = NULL;
-
-long __stdcall hkPresent11(IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags)
-{
- static bool init = false;
-
- if (!init)
- {
- DXGI_SWAP_CHAIN_DESC desc;
- pSwapChain->GetDesc(&desc);
-
- ID3D11Device* device;
- pSwapChain->GetDevice(__uuidof(ID3D11Device), (void**)&device);
-
- ID3D11DeviceContext* context;
- device->GetImmediateContext(&context);
-
- impl::win32::init(desc.OutputWindow);
-
- ImGui::CreateContext();
- ImGui_ImplWin32_Init(desc.OutputWindow);
- ImGui_ImplDX11_Init(device, context);
-
- init = true;
- }
-
- ImGui_ImplDX11_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- impl::showExampleWindow("D3D11");
-
- ImGui::EndFrame();
- ImGui::Render();
- ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
-
- return oPresent(pSwapChain, SyncInterval, Flags);
-}
-
-void impl::d3d11::init()
-{
- assert(kiero::bind(8, (void**)&oPresent, hkPresent11) == kiero::Status::Success);
-}
-
-#endif // KIERO_INCLUDE_D3D11
\ No newline at end of file
diff --git a/examples/imgui/impl/d3d11_impl.h b/examples/imgui/impl/d3d11_impl.h
deleted file mode 100644
index 75c0fa8..0000000
--- a/examples/imgui/impl/d3d11_impl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __D3D11_IMPL_H__
-#define __D3D11_IMPL_H__
-
-#include "shared.h"
-
-namespace impl
-{
- namespace d3d11
- {
- void init();
- }
-}
-
-#endif // __D3D11_IMPL_H__
\ No newline at end of file
diff --git a/examples/imgui/impl/d3d9_impl.cpp b/examples/imgui/impl/d3d9_impl.cpp
deleted file mode 100644
index 8a5ae16..0000000
--- a/examples/imgui/impl/d3d9_impl.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-#include "../../../kiero.h"
-
-#if KIERO_INCLUDE_D3D9
-
-#include "d3d9_impl.h"
-#include
-#include
-
-#include "win32_impl.h"
-
-#include "../imgui/imgui.h"
-#include "../imgui/examples/imgui_impl_win32.h"
-#include "../imgui/examples/imgui_impl_dx9.h"
-
-typedef long(__stdcall* Reset)(LPDIRECT3DDEVICE9, D3DPRESENT_PARAMETERS*);
-static Reset oReset = NULL;
-
-typedef long(__stdcall* EndScene)(LPDIRECT3DDEVICE9);
-static EndScene oEndScene = NULL;
-
-long __stdcall hkReset(LPDIRECT3DDEVICE9 pDevice, D3DPRESENT_PARAMETERS* pPresentationParameters)
-{
- ImGui_ImplDX9_InvalidateDeviceObjects();
- long result = oReset(pDevice, pPresentationParameters);
- ImGui_ImplDX9_CreateDeviceObjects();
-
- return result;
-}
-
-long __stdcall hkEndScene(LPDIRECT3DDEVICE9 pDevice)
-{
- static bool init = false;
-
- if (!init)
- {
- D3DDEVICE_CREATION_PARAMETERS params;
- pDevice->GetCreationParameters(¶ms);
-
- impl::win32::init(params.hFocusWindow);
-
- ImGui::CreateContext();
- ImGui_ImplWin32_Init(params.hFocusWindow);
- ImGui_ImplDX9_Init(pDevice);
-
- init = true;
- }
-
- ImGui_ImplDX9_NewFrame();
- ImGui_ImplWin32_NewFrame();
- ImGui::NewFrame();
-
- impl::showExampleWindow("D3D9");
-
- ImGui::EndFrame();
- ImGui::Render();
- ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData());
-
- return oEndScene(pDevice);
-}
-
-void impl::d3d9::init()
-{
- assert(kiero::bind(16, (void**)&oReset, hkReset) == kiero::Status::Success);
- assert(kiero::bind(42, (void**)&oEndScene, hkEndScene) == kiero::Status::Success);
-}
-
-#endif // KIERO_INCLUDE_D3D9
\ No newline at end of file
diff --git a/examples/imgui/impl/d3d9_impl.h b/examples/imgui/impl/d3d9_impl.h
deleted file mode 100644
index 9118439..0000000
--- a/examples/imgui/impl/d3d9_impl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __D3D9_IMPL_H__
-#define __D3D9_IMPL_H__
-
-#include "shared.h"
-
-namespace impl
-{
- namespace d3d9
- {
- void init();
- }
-}
-
-#endif // __D3D9_IMPL_H__
\ No newline at end of file
diff --git a/examples/imgui/impl/shared.cpp b/examples/imgui/impl/shared.cpp
deleted file mode 100644
index 2ee9b29..0000000
--- a/examples/imgui/impl/shared.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-#define _CRT_SECURE_NO_WARNINGS
-
-#include "shared.h"
-#include
-#include "../imgui/imgui.h"
-
-void impl::showExampleWindow(const char* comment)
-{
- char buffer[128];
- ::memset(buffer, 0, 128);
- ::sprintf(buffer, "Kiero Dear ImGui Example (%s)", comment);
-
- ImGui::Begin(buffer);
-
- ImGui::Text("Hello");
- ImGui::Button("World!");
-
- ImGui::End();
-}
\ No newline at end of file
diff --git a/examples/imgui/impl/shared.h b/examples/imgui/impl/shared.h
deleted file mode 100644
index 2f2f1c3..0000000
--- a/examples/imgui/impl/shared.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#pragma once
-
-namespace impl
-{
- void showExampleWindow(const char* comment);
-}
\ No newline at end of file
diff --git a/examples/imgui/impl/win32_impl.cpp b/examples/imgui/impl/win32_impl.cpp
deleted file mode 100644
index 7ef9381..0000000
--- a/examples/imgui/impl/win32_impl.cpp
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "../../../kiero.h"
-
-#include "win32_impl.h"
-#include
-
-#include "../imgui/imgui.h"
-#include "../imgui/examples/imgui_impl_win32.h"
-
-static WNDPROC oWndProc = NULL;
-
-extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
-LRESULT CALLBACK hkWindowProc(
- _In_ HWND hwnd,
- _In_ UINT uMsg,
- _In_ WPARAM wParam,
- _In_ LPARAM lParam
-)
-{
- if (ImGui_ImplWin32_WndProcHandler(hwnd, uMsg, wParam, lParam) > 0)
- return 1L;
- return ::CallWindowProcA(oWndProc, hwnd, uMsg, wParam, lParam);
-}
-
-void impl::win32::init(void* hwnd)
-{
- oWndProc = (WNDPROC)::SetWindowLongPtr((HWND)hwnd, GWLP_WNDPROC, (LONG)hkWindowProc);
-}
\ No newline at end of file
diff --git a/examples/imgui/impl/win32_impl.h b/examples/imgui/impl/win32_impl.h
deleted file mode 100644
index d494ea0..0000000
--- a/examples/imgui/impl/win32_impl.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __WIN32_IMPL_H__
-#define __WIN32_IMPL_H__
-
-#include "shared.h"
-
-namespace impl
-{
- namespace win32
- {
- void init(void* hwnd);
- }
-}
-
-#endif // __WIN32_IMPL_H__
\ No newline at end of file
diff --git a/examples/imgui/main.cpp b/examples/imgui/main.cpp
deleted file mode 100644
index f88444b..0000000
--- a/examples/imgui/main.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "../../kiero.h"
-
-#if KIERO_INCLUDE_D3D9
-# include "impl/d3d9_impl.h"
-#endif
-
-#if KIERO_INCLUDE_D3D10
-# include "impl/d3d10_impl.h"
-#endif
-
-#if KIERO_INCLUDE_D3D11
-# include "impl/d3d11_impl.h"
-#endif
-
-#if KIERO_INCLUDE_D3D12
-#endif
-
-#if KIERO_INCLUDE_OPENGL
-#endif
-
-#if KIERO_INCLUDE_VULKAN
-#endif
-
-#if !KIERO_USE_MINHOOK
-# error "The example requires that minhook be enabled!"
-#endif
-
-#include
-
-int kieroExampleThread()
-{
- if (kiero::init(kiero::RenderType::Auto) == kiero::Status::Success)
- {
- switch (kiero::getRenderType())
- {
-#if KIERO_INCLUDE_D3D9
- case kiero::RenderType::D3D9:
- impl::d3d9::init();
- break;
-#endif
-#if KIERO_INCLUDE_D3D10
- case kiero::RenderType::D3D10:
- impl::d3d10::init();
- break;
-#endif
-#if KIERO_INCLUDE_D3D11
- case kiero::RenderType::D3D11:
- impl::d3d11::init();
- break;
-#endif
- case kiero::RenderType::D3D12:
- // TODO: D3D12 implementation?
- break;
- case kiero::RenderType::OpenGL:
- // TODO: OpenGL implementation?
- break;
- case kiero::RenderType::Vulkan:
- // TODO: Vulkan implementation?
- break;
- }
-
- return 1;
- }
-
- return 0;
-}
-
-BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID)
-{
- DisableThreadLibraryCalls(hInstance);
-
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)kieroExampleThread, NULL, 0, NULL);
- break;
- }
-
- return TRUE;
-}
\ No newline at end of file
diff --git a/kiero.cpp b/kiero.cpp
index 73e87f0..d460c32 100644
--- a/kiero.cpp
+++ b/kiero.cpp
@@ -1,663 +1,1581 @@
-#include "kiero.h"
#include
-#include
-
-#if KIERO_INCLUDE_D3D9
-# include
-#endif
-
-#if KIERO_INCLUDE_D3D10
-# include
-# include
-# include
-#endif
-
-#if KIERO_INCLUDE_D3D11
-# include
-# include
-#endif
-
-#if KIERO_INCLUDE_D3D12
-# include
-# include
-#endif
-
-#if KIERO_INCLUDE_OPENGL
-# include
-#endif
+#include
+#include "kiero.h"
-#if KIERO_INCLUDE_VULKAN
-# include
+#ifdef UNICODE
+# define KIERO_TEXT(_TEXT) KIERO_TEXTW(_TEXT)
+#else
+# define KIERO_TEXT(_TEXT) KIERO_TEXTA(_TEXT)
#endif
-#if KIERO_USE_MINHOOK
-# include "minhook/include/MinHook.h"
-#endif
+#define KIERO_DIRECTX_BUILD 0
-#ifdef _UNICODE
-# define KIERO_TEXT(text) L##text
-#else
-# define KIERO_TEXT(text) text
+#if defined(KIERO_INCLUDE_D3D7 ) || defined(KIERO_INCLUDE_D3D8 ) || \
+ defined(KIERO_INCLUDE_D3D9 ) || defined(KIERO_INCLUDE_D3D9EX) || \
+ defined(KIERO_INCLUDE_D3D10) || defined(KIERO_INCLUDE_D3D11 ) || defined(KIERO_INCLUDE_D3D12)
+# undef KIERO_DIRECTX_BUILD
+# define KIERO_DIRECTX_BUILD 1
+# include
#endif
-#define KIERO_ARRAY_SIZE(arr) ((size_t)(sizeof(arr)/sizeof(arr[0])))
-
static kiero::RenderType::Enum g_renderType = kiero::RenderType::None;
-static uint150_t* g_methodsTable = NULL;
+static std::unordered_map g_methodsMap = {};
+static HMODULE g_autoImportLib = NULL;
-kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
+namespace kiero
{
- if (g_renderType != RenderType::None)
+ namespace kitchen
{
- return Status::AlreadyInitializedError;
- }
+#if KIERO_DIRECTX_BUILD
+ struct DirectXWindow
+ {
+ WNDCLASSEX clazz;
+ HWND handle;
- if (_renderType != RenderType::None)
- {
- if (_renderType >= RenderType::D3D9 && _renderType <= RenderType::D3D12)
- {
- WNDCLASSEX windowClass;
- windowClass.cbSize = sizeof(WNDCLASSEX);
- windowClass.style = CS_HREDRAW | CS_VREDRAW;
- windowClass.lpfnWndProc = DefWindowProc;
- windowClass.cbClsExtra = 0;
- windowClass.cbWndExtra = 0;
- windowClass.hInstance = GetModuleHandle(NULL);
- windowClass.hIcon = NULL;
- windowClass.hCursor = NULL;
- windowClass.hbrBackground = NULL;
- windowClass.lpszMenuName = NULL;
- windowClass.lpszClassName = KIERO_TEXT("Kiero");
- windowClass.hIconSm = NULL;
-
- ::RegisterClassEx(&windowClass);
-
- HWND window = ::CreateWindow(windowClass.lpszClassName, KIERO_TEXT("Kiero DirectX Window"), WS_OVERLAPPEDWINDOW, 0, 0, 100, 100, NULL, NULL, windowClass.hInstance, NULL);
-
- if (_renderType == RenderType::D3D9)
+ DirectXWindow()
{
-#if KIERO_INCLUDE_D3D9
- HMODULE libD3D9;
- if ((libD3D9 = ::GetModuleHandle(KIERO_TEXT("d3d9.dll"))) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::ModuleNotFoundError;
- }
-
- void* Direct3DCreate9;
- if ((Direct3DCreate9 = ::GetProcAddress(libD3D9, "Direct3DCreate9")) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
-
- LPDIRECT3D9 direct3D9;
- if ((direct3D9 = ((LPDIRECT3D9(__stdcall*)(uint32_t))(Direct3DCreate9))(D3D_SDK_VERSION)) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
-
- D3DPRESENT_PARAMETERS params;
- params.BackBufferWidth = 0;
- params.BackBufferHeight = 0;
- params.BackBufferFormat = D3DFMT_UNKNOWN;
- params.BackBufferCount = 0;
- params.MultiSampleType = D3DMULTISAMPLE_NONE;
- params.MultiSampleQuality = NULL;
- params.SwapEffect = D3DSWAPEFFECT_DISCARD;
- params.hDeviceWindow = window;
- params.Windowed = 1;
- params.EnableAutoDepthStencil = 0;
- params.AutoDepthStencilFormat = D3DFMT_UNKNOWN;
- params.Flags = NULL;
- params.FullScreen_RefreshRateInHz = 0;
- params.PresentationInterval = 0;
-
- LPDIRECT3DDEVICE9 device;
- if (direct3D9->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_NULLREF, window, D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT, ¶ms, &device) < 0)
- {
- direct3D9->Release();
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
-
- g_methodsTable = (uint150_t*)::calloc(119, sizeof(uint150_t));
- ::memcpy(g_methodsTable, *(uint150_t**)device, 119 * sizeof(uint150_t));
-
-#if KIERO_USE_MINHOOK
- MH_Initialize();
-#endif
-
- device->Release();
- device = NULL;
-
- direct3D9->Release();
- direct3D9 = NULL;
+ clazz.cbSize = sizeof(WNDCLASSEX);
+ clazz.style = CS_HREDRAW | CS_VREDRAW;
+ clazz.lpfnWndProc = DefWindowProc;
+ clazz.cbClsExtra = 0;
+ clazz.cbWndExtra = 0;
+ clazz.hInstance = ::GetModuleHandle(NULL);
+ clazz.hIcon = NULL;
+ clazz.hCursor = NULL;
+ clazz.hbrBackground = NULL;
+ clazz.lpszMenuName = NULL;
+ clazz.lpszClassName = KIERO_TEXT("Kiero");
+ clazz.hIconSm = NULL;
+
+ ::RegisterClassEx(&clazz);
+
+ handle = ::CreateWindow(
+ clazz.lpszClassName,
+ KIERO_TEXT("Kiero DirectX Window"),
+ WS_OVERLAPPEDWINDOW,
+ 0, 0, 100, 100, NULL, NULL,
+ clazz.hInstance,
+ NULL
+ );
+ }
- g_renderType = RenderType::D3D9;
+ ~DirectXWindow()
+ {
+ ::DestroyWindow(handle);
+ ::UnregisterClass(clazz.lpszClassName, clazz.hInstance);
+ }
+ };
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
+ struct DirectXObjectPtr
+ {
+ void* instance;
- return Status::Success;
-#endif
- }
- else if (_renderType == RenderType::D3D10)
+ DirectXObjectPtr()
+ : instance(NULL)
{
-#if KIERO_INCLUDE_D3D10
- HMODULE libDXGI;
- HMODULE libD3D10;
- if ((libDXGI = ::GetModuleHandle(KIERO_TEXT("dxgi.dll"))) == NULL || (libD3D10 = ::GetModuleHandle(KIERO_TEXT("d3d10.dll"))) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::ModuleNotFoundError;
- }
+ }
- void* CreateDXGIFactory;
- if ((CreateDXGIFactory = ::GetProcAddress(libDXGI, "CreateDXGIFactory")) == NULL)
+ ~DirectXObjectPtr()
+ {
+ if (instance != NULL)
{
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
+ ((IUnknown*)instance)->Release();
+ instance = NULL;
}
+ }
+ };
- IDXGIFactory* factory;
- if (((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+# ifdef KIERO_INCLUDE_D3D7
+ namespace d3d7
+ {
+ static const char* s_methodsTable[] =
+ {
+ "**NOT IMPLEMENTED**"
+ };
+ }
+# endif
+# ifdef KIERO_INCLUDE_D3D8
+ namespace d3d8
+ {
+ static const char* s_methodsTable[] =
+ {
+ "IDirect3DDevice8::QueryInterface",
+ "IDirect3DDevice8::AddRef",
+ "IDirect3DDevice8::Release",
+ "IDirect3DDevice8::TestCooperativeLevel",
+ "IDirect3DDevice8::GetAvailableTextureMem",
+ "IDirect3DDevice8::ResourceManagerDiscardBytes",
+ "IDirect3DDevice8::GetDirect3D",
+ "IDirect3DDevice8::GetDeviceCaps",
+ "IDirect3DDevice8::GetDisplayMode",
+ "IDirect3DDevice8::GetCreationParameters",
+ "IDirect3DDevice8::SetCursorProperties",
+ "IDirect3DDevice8::SetCursorPosition",
+ "IDirect3DDevice8::ShowCursor",
+ "IDirect3DDevice8::CreateAdditionalSwapChain",
+ "IDirect3DDevice8::Reset",
+ "IDirect3DDevice8::Present",
+ "IDirect3DDevice8::GetBackBuffer",
+ "IDirect3DDevice8::GetRasterStatus",
+ "IDirect3DDevice8::SetGammaRamp",
+ "IDirect3DDevice8::GetGammaRamp",
+ "IDirect3DDevice8::CreateTexture",
+ "IDirect3DDevice8::CreateVolumeTexture",
+ "IDirect3DDevice8::CreateCubeTexture",
+ "IDirect3DDevice8::CreateVertexBuffer",
+ "IDirect3DDevice8::CreateIndexBuffer",
+ "IDirect3DDevice8::CreateRenderTarget",
+ "IDirect3DDevice8::CreateDepthStencilSurface",
+ "IDirect3DDevice8::CreateImageSurface",
+ "IDirect3DDevice8::CopyRects",
+ "IDirect3DDevice8::UpdateTexture",
+ "IDirect3DDevice8::GetFrontBuffer",
+ "IDirect3DDevice8::SetRenderTarget",
+ "IDirect3DDevice8::GetRenderTarget",
+ "IDirect3DDevice8::GetDepthStencilSurface",
+ "IDirect3DDevice8::BeginScene",
+ "IDirect3DDevice8::EndScene",
+ "IDirect3DDevice8::Clear",
+ "IDirect3DDevice8::SetTransform",
+ "IDirect3DDevice8::GetTransform",
+ "IDirect3DDevice8::MultiplyTransform",
+ "IDirect3DDevice8::SetViewport",
+ "IDirect3DDevice8::GetViewport",
+ "IDirect3DDevice8::SetMaterial",
+ "IDirect3DDevice8::GetMaterial",
+ "IDirect3DDevice8::SetLight",
+ "IDirect3DDevice8::GetLight",
+ "IDirect3DDevice8::LightEnable",
+ "IDirect3DDevice8::GetLightEnable",
+ "IDirect3DDevice8::SetClipPlane",
+ "IDirect3DDevice8::GetClipPlane",
+ "IDirect3DDevice8::SetRenderState",
+ "IDirect3DDevice8::GetRenderState",
+ "IDirect3DDevice8::BeginStateBlock",
+ "IDirect3DDevice8::EndStateBlock",
+ "IDirect3DDevice8::ApplyStateBlock",
+ "IDirect3DDevice8::CaptureStateBlock",
+ "IDirect3DDevice8::DeleteStateBlock",
+ "IDirect3DDevice8::CreateStateBlock",
+ "IDirect3DDevice8::SetClipStatus",
+ "IDirect3DDevice8::GetClipStatus",
+ "IDirect3DDevice8::GetTexture",
+ "IDirect3DDevice8::SetTexture",
+ "IDirect3DDevice8::GetTextureStageState",
+ "IDirect3DDevice8::SetTextureStageState",
+ "IDirect3DDevice8::ValidateDevice",
+ "IDirect3DDevice8::GetInfo",
+ "IDirect3DDevice8::SetPaletteEntries",
+ "IDirect3DDevice8::GetPaletteEntries",
+ "IDirect3DDevice8::SetCurrentTexturePalette",
+ "IDirect3DDevice8::GetCurrentTexturePalette",
+ "IDirect3DDevice8::DrawPrimitive",
+ "IDirect3DDevice8::DrawIndexedPrimitive",
+ "IDirect3DDevice8::DrawPrimitiveUP",
+ "IDirect3DDevice8::DrawIndexedPrimitiveUP",
+ "IDirect3DDevice8::ProcessVertices",
+ "IDirect3DDevice8::CreateVertexShader",
+ "IDirect3DDevice8::SetVertexShader",
+ "IDirect3DDevice8::GetVertexShader",
+ "IDirect3DDevice8::DeleteVertexShader",
+ "IDirect3DDevice8::SetVertexShaderConstant",
+ "IDirect3DDevice8::GetVertexShaderConstant",
+ "IDirect3DDevice8::GetVertexShaderDeclaration",
+ "IDirect3DDevice8::GetVertexShaderFunction",
+ "IDirect3DDevice8::SetStreamSource",
+ "IDirect3DDevice8::GetStreamSource",
+ "IDirect3DDevice8::SetIndices",
+ "IDirect3DDevice8::GetIndices",
+ "IDirect3DDevice8::CreatePixelShader",
+ "IDirect3DDevice8::SetPixelShader",
+ "IDirect3DDevice8::GetPixelShader",
+ "IDirect3DDevice8::DeletePixelShader",
+ "IDirect3DDevice8::SetPixelShaderConstant",
+ "IDirect3DDevice8::GetPixelShaderConstant",
+ "IDirect3DDevice8::GetPixelShaderFunction",
+ "IDirect3DDevice8::DrawRectPatch",
+ "IDirect3DDevice8::DrawTriPatch",
+ "IDirect3DDevice8::DeletePatch"
+ };
+
+ struct D3DPRESENT_PARAMETERS
+ {
+ UINT BackBufferWidth;
+ UINT BackBufferHeight;
+ UINT BackBufferFormat;
+ UINT BackBufferCount;
+ UINT MultiSampleType;
+ UINT SwapEffect;
+ HWND hDeviceWindow;
+ BOOL Windowed;
+ BOOL EnableAutoDepthStencil;
+ UINT AutoDepthStencilFormat;
+ DWORD Flags;
+ UINT FullScreen_RefreshRateInHz;
+ UINT FullScreen_PresentationInterval;
+ };
+ }
+# endif
+# if defined(KIERO_INCLUDE_D3D9) || defined(KIERO_INCLUDE_D3D9EX)
+ namespace d3d9
+ {
+ static const char* s_methodsTable[] =
+ {
+ "IDirect3DDevice9::QueryInterface",
+ "IDirect3DDevice9::AddRef",
+ "IDirect3DDevice9::Release",
+ "IDirect3DDevice9::TestCooperativeLevel",
+ "IDirect3DDevice9::GetAvailableTextureMem",
+ "IDirect3DDevice9::EvictManagedResources",
+ "IDirect3DDevice9::GetDirect3D",
+ "IDirect3DDevice9::GetDeviceCaps",
+ "IDirect3DDevice9::GetDisplayMode",
+ "IDirect3DDevice9::GetCreationParameters",
+ "IDirect3DDevice9::SetCursorProperties",
+ "IDirect3DDevice9::SetCursorPosition",
+ "IDirect3DDevice9::ShowCursor",
+ "IDirect3DDevice9::CreateAdditionalSwapChain",
+ "IDirect3DDevice9::GetSwapChain",
+ "IDirect3DDevice9::GetNumberOfSwapChains",
+ "IDirect3DDevice9::Reset",
+ "IDirect3DDevice9::Present",
+ "IDirect3DDevice9::GetBackBuffer",
+ "IDirect3DDevice9::GetRasterStatus",
+ "IDirect3DDevice9::SetDialogBoxMode",
+ "IDirect3DDevice9::SetGammaRamp",
+ "IDirect3DDevice9::GetGammaRamp",
+ "IDirect3DDevice9::CreateTexture",
+ "IDirect3DDevice9::CreateVolumeTexture",
+ "IDirect3DDevice9::CreateCubeTexture",
+ "IDirect3DDevice9::CreateVertexBuffer",
+ "IDirect3DDevice9::CreateIndexBuffer",
+ "IDirect3DDevice9::CreateRenderTarget",
+ "IDirect3DDevice9::CreateDepthStencilSurface",
+ "IDirect3DDevice9::UpdateSurface",
+ "IDirect3DDevice9::UpdateTexture",
+ "IDirect3DDevice9::GetRenderTargetData",
+ "IDirect3DDevice9::GetFrontBufferData",
+ "IDirect3DDevice9::StretchRect",
+ "IDirect3DDevice9::ColorFill",
+ "IDirect3DDevice9::CreateOffscreenPlainSurface",
+ "IDirect3DDevice9::SetRenderTarget",
+ "IDirect3DDevice9::GetRenderTarget",
+ "IDirect3DDevice9::SetDepthStencilSurface",
+ "IDirect3DDevice9::GetDepthStencilSurface",
+ "IDirect3DDevice9::BeginScene",
+ "IDirect3DDevice9::EndScene",
+ "IDirect3DDevice9::Clear",
+ "IDirect3DDevice9::SetTransform",
+ "IDirect3DDevice9::GetTransform",
+ "IDirect3DDevice9::MultiplyTransform",
+ "IDirect3DDevice9::SetViewport",
+ "IDirect3DDevice9::GetViewport",
+ "IDirect3DDevice9::SetMaterial",
+ "IDirect3DDevice9::GetMaterial",
+ "IDirect3DDevice9::SetLight",
+ "IDirect3DDevice9::GetLight",
+ "IDirect3DDevice9::LightEnable",
+ "IDirect3DDevice9::GetLightEnable",
+ "IDirect3DDevice9::SetClipPlane",
+ "IDirect3DDevice9::GetClipPlane",
+ "IDirect3DDevice9::SetRenderState",
+ "IDirect3DDevice9::GetRenderState",
+ "IDirect3DDevice9::CreateStateBlock",
+ "IDirect3DDevice9::BeginStateBlock",
+ "IDirect3DDevice9::EndStateBlock",
+ "IDirect3DDevice9::SetClipStatus",
+ "IDirect3DDevice9::GetClipStatus",
+ "IDirect3DDevice9::GetTexture",
+ "IDirect3DDevice9::SetTexture",
+ "IDirect3DDevice9::GetTextureStageState",
+ "IDirect3DDevice9::SetTextureStageState",
+ "IDirect3DDevice9::GetSamplerState",
+ "IDirect3DDevice9::SetSamplerState",
+ "IDirect3DDevice9::ValidateDevice",
+ "IDirect3DDevice9::SetPaletteEntries",
+ "IDirect3DDevice9::GetPaletteEntries",
+ "IDirect3DDevice9::SetCurrentTexturePalette",
+ "IDirect3DDevice9::GetCurrentTexturePalette",
+ "IDirect3DDevice9::SetScissorRect",
+ "IDirect3DDevice9::GetScissorRect",
+ "IDirect3DDevice9::SetSoftwareVertexProcessing",
+ "IDirect3DDevice9::GetSoftwareVertexProcessing",
+ "IDirect3DDevice9::SetNPatchMode",
+ "IDirect3DDevice9::GetNPatchMode",
+ "IDirect3DDevice9::DrawPrimitive",
+ "IDirect3DDevice9::DrawIndexedPrimitive",
+ "IDirect3DDevice9::DrawPrimitiveUP",
+ "IDirect3DDevice9::DrawIndexedPrimitiveUP",
+ "IDirect3DDevice9::ProcessVertices",
+ "IDirect3DDevice9::CreateVertexDeclaration",
+ "IDirect3DDevice9::SetVertexDeclaration",
+ "IDirect3DDevice9::GetVertexDeclaration",
+ "IDirect3DDevice9::SetFVF",
+ "IDirect3DDevice9::GetFVF",
+ "IDirect3DDevice9::CreateVertexShader",
+ "IDirect3DDevice9::SetVertexShader",
+ "IDirect3DDevice9::GetVertexShader",
+ "IDirect3DDevice9::SetVertexShaderConstantF",
+ "IDirect3DDevice9::GetVertexShaderConstantF",
+ "IDirect3DDevice9::SetVertexShaderConstantI",
+ "IDirect3DDevice9::GetVertexShaderConstantI",
+ "IDirect3DDevice9::SetVertexShaderConstantB",
+ "IDirect3DDevice9::GetVertexShaderConstantB",
+ "IDirect3DDevice9::SetStreamSource",
+ "IDirect3DDevice9::GetStreamSource",
+ "IDirect3DDevice9::SetStreamSourceFreq",
+ "IDirect3DDevice9::GetStreamSourceFreq",
+ "IDirect3DDevice9::SetIndices",
+ "IDirect3DDevice9::GetIndices",
+ "IDirect3DDevice9::CreatePixelShader",
+ "IDirect3DDevice9::SetPixelShader",
+ "IDirect3DDevice9::GetPixelShader",
+ "IDirect3DDevice9::SetPixelShaderConstantF",
+ "IDirect3DDevice9::GetPixelShaderConstantF",
+ "IDirect3DDevice9::SetPixelShaderConstantI",
+ "IDirect3DDevice9::GetPixelShaderConstantI",
+ "IDirect3DDevice9::SetPixelShaderConstantB",
+ "IDirect3DDevice9::GetPixelShaderConstantB",
+ "IDirect3DDevice9::DrawRectPatch",
+ "IDirect3DDevice9::DrawTriPatch",
+ "IDirect3DDevice9::DeletePatch",
+ "IDirect3DDevice9::CreateQuery",
+
+ "IDirect3DDevice9Ex::SetConvolutionMonoKernel",
+ "IDirect3DDevice9Ex::ComposeRects",
+ "IDirect3DDevice9Ex::PresentEx",
+ "IDirect3DDevice9Ex::GetGPUThreadPriority",
+ "IDirect3DDevice9Ex::SetGPUThreadPriority",
+ "IDirect3DDevice9Ex::WaitForVBlank",
+ "IDirect3DDevice9Ex::CheckResourceResidency",
+ "IDirect3DDevice9Ex::SetMaximumFrameLatency",
+ "IDirect3DDevice9Ex::GetMaximumFrameLatency",
+ "IDirect3DDevice9Ex::CheckDeviceState",
+ "IDirect3DDevice9Ex::CreateRenderTargetEx",
+ "IDirect3DDevice9Ex::CreateOffscreenPlainSurfaceEx",
+ "IDirect3DDevice9Ex::CreateDepthStencilSurfaceEx",
+ "IDirect3DDevice9Ex::ResetEx",
+ "IDirect3DDevice9Ex::GetDisplayModeEx"
+ };
+
+ struct D3DPRESENT_PARAMETERS
+ {
+ UINT BackBufferWidth;
+ UINT BackBufferHeight;
+ UINT BackBufferFormat;
+ UINT BackBufferCount;
+ UINT MultiSampleType;
+ DWORD MultiSampleQuality;
+ UINT SwapEffect;
+ HWND hDeviceWindow;
+ BOOL Windowed;
+ BOOL EnableAutoDepthStencil;
+ UINT AutoDepthStencilFormat;
+ DWORD Flags;
+ UINT FullScreen_RefreshRateInHz;
+ UINT PresentationInterval;
+ };
+ }
+# endif
+# if defined(KIERO_INCLUDE_D3D10) || defined(KIERO_INCLUDE_D3D11) || defined(KIERO_INCLUDE_D3D12)
+ namespace dxgi
+ {
+ static GUID IID_IDXGIFactory = { 0x7b7166ec, 0x21c7, 0x44ae, 0xb2, 0x1a, 0xc9, 0xae, 0x32, 0x1a, 0xe3, 0x69 };
- IDXGIAdapter* adapter;
- if (factory->EnumAdapters(0, &adapter) == DXGI_ERROR_NOT_FOUND)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ struct DXGI_RATIONAL
+ {
+ UINT Numerator;
+ UINT Denominator;
+ };
- void* D3D10CreateDeviceAndSwapChain;
- if ((D3D10CreateDeviceAndSwapChain = ::GetProcAddress(libD3D10, "D3D10CreateDeviceAndSwapChain")) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ struct DXGI_MODE_DESC
+ {
+ UINT Width;
+ UINT Height;
+ DXGI_RATIONAL RefreshRate;
+ UINT Format;
+ UINT ScanlineOrdering;
+ UINT Scaling;
+ };
+
+ struct DXGI_SAMPLE_DESC
+ {
+ UINT Count;
+ UINT Quality;
+ };
- DXGI_RATIONAL refreshRate;
- refreshRate.Numerator = 60;
- refreshRate.Denominator = 1;
-
- DXGI_MODE_DESC bufferDesc;
- bufferDesc.Width = 100;
- bufferDesc.Height = 100;
- bufferDesc.RefreshRate = refreshRate;
- bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
- bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
- DXGI_SAMPLE_DESC sampleDesc;
- sampleDesc.Count = 1;
- sampleDesc.Quality = 0;
-
- DXGI_SWAP_CHAIN_DESC swapChainDesc;
- swapChainDesc.BufferDesc = bufferDesc;
- swapChainDesc.SampleDesc = sampleDesc;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.BufferCount = 1;
- swapChainDesc.OutputWindow = window;
- swapChainDesc.Windowed = 1;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
-
- IDXGISwapChain* swapChain;
- ID3D10Device* device;
-
- if (((long(__stdcall*)(
- IDXGIAdapter*,
- D3D10_DRIVER_TYPE,
- HMODULE,
- UINT,
- UINT,
- DXGI_SWAP_CHAIN_DESC*,
- IDXGISwapChain**,
- ID3D10Device**))(D3D10CreateDeviceAndSwapChain))(adapter, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &swapChainDesc, &swapChain, &device) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ struct DXGI_SWAP_CHAIN_DESC
+ {
+ DXGI_MODE_DESC BufferDesc;
+ DXGI_SAMPLE_DESC SampleDesc;
+ UINT BufferUsage;
+ UINT BufferCount;
+ HWND OutputWindow;
+ BOOL Windowed;
+ UINT SwapEffect;
+ UINT Flags;
+ };
+ }
+# endif
+# ifdef KIERO_INCLUDE_D3D10
+ namespace d3d10
+ {
+ static const char* s_methodsTable[] =
+ {
+ "IDXGISwapChain::QueryInterface",
+ "IDXGISwapChain::AddRef",
+ "IDXGISwapChain::Release",
+ "IDXGISwapChain::SetPrivateData",
+ "IDXGISwapChain::SetPrivateDataInterface",
+ "IDXGISwapChain::GetPrivateData",
+ "IDXGISwapChain::GetParent",
+ "IDXGISwapChain::GetDevice",
+ "IDXGISwapChain::Present",
+ "IDXGISwapChain::GetBuffer",
+ "IDXGISwapChain::SetFullscreenState",
+ "IDXGISwapChain::GetFullscreenState",
+ "IDXGISwapChain::GetDesc",
+ "IDXGISwapChain::ResizeBuffers",
+ "IDXGISwapChain::ResizeTarget",
+ "IDXGISwapChain::GetContainingOutput",
+ "IDXGISwapChain::GetFrameStatistics",
+ "IDXGISwapChain::GetLastPresentCount",
+
+ "ID3D10Device::QueryInterface",
+ "ID3D10Device::AddRef",
+ "ID3D10Device::Release",
+ "ID3D10Device::VSSetConstantBuffers",
+ "ID3D10Device::PSSetShaderResources",
+ "ID3D10Device::PSSetShader",
+ "ID3D10Device::PSSetSamplers",
+ "ID3D10Device::VSSetShader",
+ "ID3D10Device::DrawIndexed",
+ "ID3D10Device::Draw",
+ "ID3D10Device::PSSetConstantBuffers",
+ "ID3D10Device::IASetInputLayout",
+ "ID3D10Device::IASetVertexBuffers",
+ "ID3D10Device::IASetIndexBuffer",
+ "ID3D10Device::DrawIndexedInstanced",
+ "ID3D10Device::DrawInstanced",
+ "ID3D10Device::GSSetConstantBuffers",
+ "ID3D10Device::GSSetShader",
+ "ID3D10Device::IASetPrimitiveTopology",
+ "ID3D10Device::VSSetShaderResources",
+ "ID3D10Device::VSSetSamplers",
+ "ID3D10Device::SetPredication",
+ "ID3D10Device::GSSetShaderResources",
+ "ID3D10Device::GSSetSamplers",
+ "ID3D10Device::OMSetRenderTargets",
+ "ID3D10Device::OMSetBlendState",
+ "ID3D10Device::OMSetDepthStencilState",
+ "ID3D10Device::SOSetTargets",
+ "ID3D10Device::DrawAuto",
+ "ID3D10Device::RSSetState",
+ "ID3D10Device::RSSetViewports",
+ "ID3D10Device::RSSetScissorRects",
+ "ID3D10Device::CopySubresourceRegion",
+ "ID3D10Device::CopyResource",
+ "ID3D10Device::UpdateSubresource",
+ "ID3D10Device::ClearRenderTargetView",
+ "ID3D10Device::ClearDepthStencilView",
+ "ID3D10Device::GenerateMips",
+ "ID3D10Device::ResolveSubresource",
+ "ID3D10Device::VSGetConstantBuffers",
+ "ID3D10Device::PSGetShaderResources",
+ "ID3D10Device::PSGetShader",
+ "ID3D10Device::PSGetSamplers",
+ "ID3D10Device::VSGetShader",
+ "ID3D10Device::PSGetConstantBuffers",
+ "ID3D10Device::IAGetInputLayout",
+ "ID3D10Device::IAGetVertexBuffers",
+ "ID3D10Device::IAGetIndexBuffer",
+ "ID3D10Device::GSGetConstantBuffers",
+ "ID3D10Device::GSGetShader",
+ "ID3D10Device::IAGetPrimitiveTopology",
+ "ID3D10Device::VSGetShaderResources",
+ "ID3D10Device::VSGetSamplers",
+ "ID3D10Device::GetPredication",
+ "ID3D10Device::GSGetShaderResources",
+ "ID3D10Device::GSGetSamplers",
+ "ID3D10Device::OMGetRenderTargets",
+ "ID3D10Device::OMGetBlendState",
+ "ID3D10Device::OMGetDepthStencilState",
+ "ID3D10Device::SOGetTargets",
+ "ID3D10Device::RSGetState",
+ "ID3D10Device::RSGetViewports",
+ "ID3D10Device::RSGetScissorRects",
+ "ID3D10Device::GetDeviceRemovedReason",
+ "ID3D10Device::SetExceptionMode",
+ "ID3D10Device::GetExceptionMode",
+ "ID3D10Device::GetPrivateData",
+ "ID3D10Device::SetPrivateData",
+ "ID3D10Device::SetPrivateDataInterface",
+ "ID3D10Device::ClearState",
+ "ID3D10Device::Flush",
+ "ID3D10Device::CreateBuffer",
+ "ID3D10Device::CreateTexture1D",
+ "ID3D10Device::CreateTexture2D",
+ "ID3D10Device::CreateTexture3D",
+ "ID3D10Device::CreateShaderResourceView",
+ "ID3D10Device::CreateRenderTargetView",
+ "ID3D10Device::CreateDepthStencilView",
+ "ID3D10Device::CreateInputLayout",
+ "ID3D10Device::CreateVertexShader",
+ "ID3D10Device::CreateGeometryShader",
+ "ID3D10Device::CreateGemoetryShaderWithStreamOutput",
+ "ID3D10Device::CreatePixelShader",
+ "ID3D10Device::CreateBlendState",
+ "ID3D10Device::CreateDepthStencilState",
+ "ID3D10Device::CreateRasterizerState",
+ "ID3D10Device::CreateSamplerState",
+ "ID3D10Device::CreateQuery",
+ "ID3D10Device::CreatePredicate",
+ "ID3D10Device::CreateCounter",
+ "ID3D10Device::CheckFormatSupport",
+ "ID3D10Device::CheckMultisampleQualityLevels",
+ "ID3D10Device::CheckCounterInfo",
+ "ID3D10Device::CheckCounter",
+ "ID3D10Device::GetCreationFlags",
+ "ID3D10Device::OpenSharedResource",
+ "ID3D10Device::SetTextFilterSize",
+ "ID3D10Device::GetTextFilterSize"
+ };
+ }
+# endif
+# ifdef KIERO_INCLUDE_D3D11
+ namespace d3d11
+ {
+ static const char* s_methodsTable[] =
+ {
+ "IDXGISwapChain::QueryInterface",
+ "IDXGISwapChain::AddRef",
+ "IDXGISwapChain::Release",
+ "IDXGISwapChain::SetPrivateData",
+ "IDXGISwapChain::SetPrivateDataInterface",
+ "IDXGISwapChain::GetPrivateData",
+ "IDXGISwapChain::GetParent",
+ "IDXGISwapChain::GetDevice",
+ "IDXGISwapChain::Present",
+ "IDXGISwapChain::GetBuffer",
+ "IDXGISwapChain::SetFullscreenState",
+ "IDXGISwapChain::GetFullscreenState",
+ "IDXGISwapChain::GetDesc",
+ "IDXGISwapChain::ResizeBuffers",
+ "IDXGISwapChain::ResizeTarget",
+ "IDXGISwapChain::GetContainingOutput",
+ "IDXGISwapChain::GetFrameStatistics",
+ "IDXGISwapChain::GetLastPresentCount",
+
+ "ID3D11Device::QueryInterface",
+ "ID3D11Device::AddRef",
+ "ID3D11Device::Release",
+ "ID3D11Device::CreateBuffer",
+ "ID3D11Device::CreateTexture1D",
+ "ID3D11Device::CreateTexture2D",
+ "ID3D11Device::CreateTexture3D",
+ "ID3D11Device::CreateShaderResourceView",
+ "ID3D11Device::CreateUnorderedAccessView",
+ "ID3D11Device::CreateRenderTargetView",
+ "ID3D11Device::CreateDepthStencilView",
+ "ID3D11Device::CreateInputLayout",
+ "ID3D11Device::CreateVertexShader",
+ "ID3D11Device::CreateGeometryShader",
+ "ID3D11Device::CreateGeometryShaderWithStreamOutput",
+ "ID3D11Device::CreatePixelShader",
+ "ID3D11Device::CreateHullShader",
+ "ID3D11Device::CreateDomainShader",
+ "ID3D11Device::CreateComputeShader",
+ "ID3D11Device::CreateClassLinkage",
+ "ID3D11Device::CreateBlendState",
+ "ID3D11Device::CreateDepthStencilState",
+ "ID3D11Device::CreateRasterizerState",
+ "ID3D11Device::CreateSamplerState",
+ "ID3D11Device::CreateQuery",
+ "ID3D11Device::CreatePredicate",
+ "ID3D11Device::CreateCounter",
+ "ID3D11Device::CreateDeferredContext",
+ "ID3D11Device::OpenSharedResource",
+ "ID3D11Device::CheckFormatSupport",
+ "ID3D11Device::CheckMultisampleQualityLevels",
+ "ID3D11Device::CheckCounterInfo",
+ "ID3D11Device::CheckCounter",
+ "ID3D11Device::CheckFeatureSupport",
+ "ID3D11Device::GetPrivateData",
+ "ID3D11Device::SetPrivateData",
+ "ID3D11Device::SetPrivateDataInterface",
+ "ID3D11Device::GetFeatureLevel",
+ "ID3D11Device::GetCreationFlags",
+ "ID3D11Device::GetDeviceRemovedReason",
+ "ID3D11Device::GetImmediateContext",
+ "ID3D11Device::SetExceptionMode",
+ "ID3D11Device::GetExceptionMode",
+
+ "ID3D11DeviceContext::QueryInterface",
+ "ID3D11DeviceContext::AddRef",
+ "ID3D11DeviceContext::Release",
+ "ID3D11DeviceContext::GetDevice",
+ "ID3D11DeviceContext::GetPrivateData",
+ "ID3D11DeviceContext::SetPrivateData",
+ "ID3D11DeviceContext::SetPrivateDataInterface",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::DrawIndexed",
+ "ID3D11DeviceContext::Draw",
+ "ID3D11DeviceContext::Map",
+ "ID3D11DeviceContext::Unmap",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::IASetInputLayout",
+ "ID3D11DeviceContext::IASetVertexBuffers",
+ "ID3D11DeviceContext::IASetIndexBuffer",
+ "ID3D11DeviceContext::DrawIndexedInstanced",
+ "ID3D11DeviceContext::DrawInstanced",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::IASetPrimitiveTopology",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::Begin",
+ "ID3D11DeviceContext::End",
+ "ID3D11DeviceContext::GetData",
+ "ID3D11DeviceContext::SetPredication",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::OMSetRenderTargets",
+ "ID3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews",
+ "ID3D11DeviceContext::OMSetBlendState",
+ "ID3D11DeviceContext::OMSetDepthStencilState",
+ "ID3D11DeviceContext::SOSetTargets",
+ "ID3D11DeviceContext::DrawAuto",
+ "ID3D11DeviceContext::DrawIndexedInstancedIndirect",
+ "ID3D11DeviceContext::DrawInstancedIndirect",
+ "ID3D11DeviceContext::Dispatch",
+ "ID3D11DeviceContext::DispatchIndirect",
+ "ID3D11DeviceContext::RSSetState",
+ "ID3D11DeviceContext::RSSetViewports",
+ "ID3D11DeviceContext::RSSetScissorRects",
+ "ID3D11DeviceContext::CopySubresourceRegion",
+ "ID3D11DeviceContext::CopyResource",
+ "ID3D11DeviceContext::UpdateSubresource",
+ "ID3D11DeviceContext::CopyStructureCount",
+ "ID3D11DeviceContext::ClearRenderTargetView",
+ "ID3D11DeviceContext::ClearUnorderedAccessViewUint",
+ "ID3D11DeviceContext::ClearUnorderedAccessViewFloat",
+ "ID3D11DeviceContext::ClearDepthStencilView",
+ "ID3D11DeviceContext::GenerateMips",
+ "ID3D11DeviceContext::SetResourceMinLOD",
+ "ID3D11DeviceContext::GetResourceMinLOD",
+ "ID3D11DeviceContext::ResolveSubresource",
+ "ID3D11DeviceContext::ExecuteCommandList",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::SetShaderResources",
+ "ID3D11DeviceContext::CSSetUnorderedAccessViews",
+ "ID3D11DeviceContext::SetShader",
+ "ID3D11DeviceContext::SetSamplers",
+ "ID3D11DeviceContext::SetConstantBuffers",
+ "ID3D11DeviceContext::VSGetConstantBuffers",
+ "ID3D11DeviceContext::PSGetShaderResources",
+ "ID3D11DeviceContext::PSGetShader",
+ "ID3D11DeviceContext::PSGetSamplers",
+ "ID3D11DeviceContext::VSGetShader",
+ "ID3D11DeviceContext::PSGetConstantBuffers",
+ "ID3D11DeviceContext::IAGetInputLayout",
+ "ID3D11DeviceContext::IAGetVertexBuffers",
+ "ID3D11DeviceContext::IAGetIndexBuffer",
+ "ID3D11DeviceContext::GSGetConstantBuffers",
+ "ID3D11DeviceContext::GSGetShader",
+ "ID3D11DeviceContext::IAGetPrimitiveTopology",
+ "ID3D11DeviceContext::VSGetShaderResources",
+ "ID3D11DeviceContext::VSGetSamplers",
+ "ID3D11DeviceContext::GetPredication",
+ "ID3D11DeviceContext::GSGetShaderResources",
+ "ID3D11DeviceContext::GSGetSamplers",
+ "ID3D11DeviceContext::OMGetRenderTargets",
+ "ID3D11DeviceContext::OMGetRenderTargetsAndUnorderedAccessViews",
+ "ID3D11DeviceContext::OMGetBlendState",
+ "ID3D11DeviceContext::OMGetDepthStencilState",
+ "ID3D11DeviceContext::SOGetTargets",
+ "ID3D11DeviceContext::RSGetState",
+ "ID3D11DeviceContext::RSGetViewports",
+ "ID3D11DeviceContext::RSGetScissorRects",
+ "ID3D11DeviceContext::HSGetShaderResources",
+ "ID3D11DeviceContext::HSGetShader",
+ "ID3D11DeviceContext::HSGetSamplers",
+ "ID3D11DeviceContext::HSGetConstantBuffers",
+ "ID3D11DeviceContext::DSGetShaderResources",
+ "ID3D11DeviceContext::DSGetShader",
+ "ID3D11DeviceContext::DSGetSamplers",
+ "ID3D11DeviceContext::DSGetConstantBuffers",
+ "ID3D11DeviceContext::CSGetShaderResources",
+ "ID3D11DeviceContext::CSGetUnorderedAccessViews",
+ "ID3D11DeviceContext::CSGetShader",
+ "ID3D11DeviceContext::CSGetSamplers",
+ "ID3D11DeviceContext::CSGetConstantBuffers",
+ "ID3D11DeviceContext::ClearState",
+ "ID3D11DeviceContext::Flush",
+ "ID3D11DeviceContext::GetType",
+ "ID3D11DeviceContext::GetContextFlags",
+ "ID3D11DeviceContext::FinishCommandList",
+ "ID3D11DeviceContext::CopySubresourceRegion1",
+ "ID3D11DeviceContext::UpdateSubresource1",
+ "ID3D11DeviceContext::DiscardResource",
+ "ID3D11DeviceContext::DiscardView",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::SetConstantBuffers1",
+ "ID3D11DeviceContext::VSGetConstantBuffers1",
+ "ID3D11DeviceContext::HSGetConstantBuffers1",
+ "ID3D11DeviceContext::DSGetConstantBuffers1",
+ "ID3D11DeviceContext::GSGetConstantBuffers1",
+ "ID3D11DeviceContext::PSGetConstantBuffers1",
+ "ID3D11DeviceContext::CSGetConstantBuffers1",
+ "ID3D11DeviceContext::SwapDeviceContextState",
+ "ID3D11DeviceContext::ClearView",
+ "ID3D11DeviceContext::DiscardView1",
+ "ID3D11DeviceContext::UpdateTileMappings",
+ "ID3D11DeviceContext::CopyTileMappings",
+ "ID3D11DeviceContext::CopyTiles",
+ "ID3D11DeviceContext::UpdateTiles",
+ "ID3D11DeviceContext::ResizeTilePool",
+ "ID3D11DeviceContext::TiledResourceBarrier",
+ "ID3D11DeviceContext::IsAnnotationEnabled",
+ "ID3D11DeviceContext::SetMarkerInt",
+ "ID3D11DeviceContext::BeginEventInt",
+ "ID3D11DeviceContext::EndEvent",
+ };
+ }
+# endif
+# ifdef KIERO_INCLUDE_D3D12
+ namespace d3d12
+ {
+ static const char* s_methodsTable[] =
+ {
+ "IDXGISwapChain::QueryInterface",
+ "IDXGISwapChain::AddRef",
+ "IDXGISwapChain::Release",
+ "IDXGISwapChain::SetPrivateData",
+ "IDXGISwapChain::SetPrivateDataInterface",
+ "IDXGISwapChain::GetPrivateData",
+ "IDXGISwapChain::GetParent",
+ "IDXGISwapChain::GetDevice",
+ "IDXGISwapChain::Present",
+ "IDXGISwapChain::GetBuffer",
+ "IDXGISwapChain::SetFullscreenState",
+ "IDXGISwapChain::GetFullscreenState",
+ "IDXGISwapChain::GetDesc",
+ "IDXGISwapChain::ResizeBuffers",
+ "IDXGISwapChain::ResizeTarget",
+ "IDXGISwapChain::GetContainingOutput",
+ "IDXGISwapChain::GetFrameStatistics",
+ "IDXGISwapChain::GetLastPresentCount",
+
+ "ID3D12Device::QueryInterface",
+ "ID3D12Device::AddRef",
+ "ID3D12Device::Release",
+ "ID3D12Device::GetPrivateData",
+ "ID3D12Device::SetPrivateData",
+ "ID3D12Device::SetPrivateDataInterface",
+ "ID3D12Device::SetName",
+ "ID3D12Device::GetNodeCount",
+ "ID3D12Device::CreateCommandQueue",
+ "ID3D12Device::CreateCommandAllocator",
+ "ID3D12Device::CreateGraphicsPipelineState",
+ "ID3D12Device::CreateComputePipelineState",
+ "ID3D12Device::CreateCommandList",
+ "ID3D12Device::CheckFeatureSupport",
+ "ID3D12Device::CreateDescriptorHeap",
+ "ID3D12Device::GetDescriptorHandleIncrementSize",
+ "ID3D12Device::CreateRootSignature",
+ "ID3D12Device::CreateConstantBufferView",
+ "ID3D12Device::CreateShaderResourceView",
+ "ID3D12Device::CreateUnorderedAccessView",
+ "ID3D12Device::CreateRenderTargetView",
+ "ID3D12Device::CreateDepthStencilView",
+ "ID3D12Device::CreateSampler",
+ "ID3D12Device::CopyDescriptors",
+ "ID3D12Device::CopyDescriptorsSimple",
+ "ID3D12Device::GetResourceAllocationInfo",
+ "ID3D12Device::GetCustomHeapProperties",
+ "ID3D12Device::CreateCommittedResource",
+ "ID3D12Device::CreateHeap",
+ "ID3D12Device::CreatePlacedResource",
+ "ID3D12Device::CreateReservedResource",
+ "ID3D12Device::CreateSharedHandle",
+ "ID3D12Device::OpenSharedHandle",
+ "ID3D12Device::OpenSharedHandleByName",
+ "ID3D12Device::MakeResident",
+ "ID3D12Device::Evict",
+ "ID3D12Device::CreateFence",
+ "ID3D12Device::GetDeviceRemovedReason",
+ "ID3D12Device::GetCopyableFootprints",
+ "ID3D12Device::CreateQueryHeap",
+ "ID3D12Device::SetStablePowerState",
+ "ID3D12Device::CreateCommandSignature",
+ "ID3D12Device::GetResourceTiling",
+ "ID3D12Device::GetAdapterLuid",
+
+ "ID3D12CommandQueue::QueryInterface",
+ "ID3D12CommandQueue::AddRef",
+ "ID3D12CommandQueue::Release",
+ "ID3D12CommandQueue::GetPrivateData",
+ "ID3D12CommandQueue::SetPrivateData",
+ "ID3D12CommandQueue::SetPrivateDataInterface",
+ "ID3D12CommandQueue::SetName",
+ "ID3D12CommandQueue::GetDevice",
+ "ID3D12CommandQueue::UpdateTileMappings",
+ "ID3D12CommandQueue::CopyTileMappings",
+ "ID3D12CommandQueue::ExecuteCommandLists",
+ "ID3D12CommandQueue::SetMarker",
+ "ID3D12CommandQueue::BeginEvent",
+ "ID3D12CommandQueue::EndEvent",
+ "ID3D12CommandQueue::Signal",
+ "ID3D12CommandQueue::Wait",
+ "ID3D12CommandQueue::GetTimestampFrequency",
+ "ID3D12CommandQueue::GetClockCalibration",
+ "ID3D12CommandQueue::GetDesc",
+
+ "ID3D12CommandAllocator::QueryInterface",
+ "ID3D12CommandAllocator::AddRef",
+ "ID3D12CommandAllocator::Release",
+ "ID3D12CommandAllocator::GetPrivateData",
+ "ID3D12CommandAllocator::SetPrivateData",
+ "ID3D12CommandAllocator::SetPrivateDataInterface",
+ "ID3D12CommandAllocator::SetName",
+ "ID3D12CommandAllocator::GetDevice",
+ "ID3D12CommandAllocator::Reset",
+
+ "ID3D12GraphicsCommandList::QueryInterface",
+ "ID3D12GraphicsCommandList::AddRef",
+ "ID3D12GraphicsCommandList::Release",
+ "ID3D12GraphicsCommandList::GetPrivateData",
+ "ID3D12GraphicsCommandList::SetPrivateData",
+ "ID3D12GraphicsCommandList::SetPrivateDataInterface",
+ "ID3D12GraphicsCommandList::SetName",
+ "ID3D12GraphicsCommandList::GetDevice",
+ "ID3D12GraphicsCommandList::GetType",
+ "ID3D12GraphicsCommandList::Close",
+ "ID3D12GraphicsCommandList::Reset",
+ "ID3D12GraphicsCommandList::ClearState",
+ "ID3D12GraphicsCommandList::DrawInstanced",
+ "ID3D12GraphicsCommandList::DrawIndexedInstanced",
+ "ID3D12GraphicsCommandList::Dispatch",
+ "ID3D12GraphicsCommandList::CopyBufferRegion",
+ "ID3D12GraphicsCommandList::CopyTextureRegion",
+ "ID3D12GraphicsCommandList::CopyResource",
+ "ID3D12GraphicsCommandList::CopyTiles",
+ "ID3D12GraphicsCommandList::ResolveSubresource",
+ "ID3D12GraphicsCommandList::IASetPrimitiveTopology",
+ "ID3D12GraphicsCommandList::RSSetViewports",
+ "ID3D12GraphicsCommandList::RSSetScissorRects",
+ "ID3D12GraphicsCommandList::OMSetBlendFactor",
+ "ID3D12GraphicsCommandList::OMSetStencilRef",
+ "ID3D12GraphicsCommandList::SetPipelineState",
+ "ID3D12GraphicsCommandList::ResourceBarrier",
+ "ID3D12GraphicsCommandList::ExecuteBundle",
+ "ID3D12GraphicsCommandList::SetDescriptorHeaps",
+ "ID3D12GraphicsCommandList::SetComputeRootSignature",
+ "ID3D12GraphicsCommandList::SetGraphicsRootSignature",
+ "ID3D12GraphicsCommandList::SetComputeRootDescriptorTable",
+ "ID3D12GraphicsCommandList::SetGraphicsRootDescriptorTable",
+ "ID3D12GraphicsCommandList::SetComputeRoot32BitConstant",
+ "ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstant",
+ "ID3D12GraphicsCommandList::SetComputeRoot32BitConstants",
+ "ID3D12GraphicsCommandList::SetGraphicsRoot32BitConstants",
+ "ID3D12GraphicsCommandList::SetComputeRootConstantBufferView",
+ "ID3D12GraphicsCommandList::SetGraphicsRootConstantBufferView",
+ "ID3D12GraphicsCommandList::SetComputeRootShaderResourceView",
+ "ID3D12GraphicsCommandList::SetGraphicsRootShaderResourceView",
+ "ID3D12GraphicsCommandList::SetComputeRootUnorderedAccessView",
+ "ID3D12GraphicsCommandList::SetGraphicsRootUnorderedAccessView",
+ "ID3D12GraphicsCommandList::IASetIndexBuffer",
+ "ID3D12GraphicsCommandList::IASetVertexBuffers",
+ "ID3D12GraphicsCommandList::SOSetTargets",
+ "ID3D12GraphicsCommandList::OMSetRenderTargets",
+ "ID3D12GraphicsCommandList::ClearDepthStencilView",
+ "ID3D12GraphicsCommandList::ClearRenderTargetView",
+ "ID3D12GraphicsCommandList::ClearUnorderedAccessViewUint",
+ "ID3D12GraphicsCommandList::ClearUnorderedAccessViewFloat",
+ "ID3D12GraphicsCommandList::DiscardResource",
+ "ID3D12GraphicsCommandList::BeginQuery",
+ "ID3D12GraphicsCommandList::EndQuery",
+ "ID3D12GraphicsCommandList::ResolveQueryData",
+ "ID3D12GraphicsCommandList::SetPredication",
+ "ID3D12GraphicsCommandList::SetMarker",
+ "ID3D12GraphicsCommandList::BeginEvent",
+ "ID3D12GraphicsCommandList::EndEvent",
+ "ID3D12GraphicsCommandList::ExecuteIndirect",
+ };
+
+ static GUID IID_ID3D12Device = { 0x189819f1, 0x1db6, 0x4b57, 0xbe, 0x54, 0x18, 0x21, 0x33, 0x9b, 0x85, 0xf7 };
+ static GUID IID_ID3D12CommandQueue = { 0x0ec870a6, 0x5d7e, 0x4c22, 0x8c, 0xfc, 0x5b, 0xaa, 0xe0, 0x76, 0x16, 0xed };
+ static GUID IID_ID3D12CommandAllocator = { 0x6102dee4, 0xaf59, 0x4b09, 0xb9, 0x99, 0xb4, 0x4d, 0x73, 0xf0, 0x9b, 0x24 };
+ static GUID IID_ID3D12GraphicsCommandList = { 0x5b160d0f, 0xac1b, 0x4185, 0x8b, 0xa8, 0xb3, 0xae, 0x42, 0xa5, 0xa4, 0x55 };
+
+ struct D3D12_COMMAND_QUEUE_DESC
+ {
+ UINT Type;
+ INT Priority;
+ UINT Flags;
+ UINT NodeMask;
+ };
+ }
+# endif
+#endif
+ }
+}
- g_methodsTable = (uint150_t*)::calloc(116, sizeof(uint150_t));
- ::memcpy(g_methodsTable, *(uint150_t**)swapChain, 18 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 18, *(uint150_t**)device, 98 * sizeof(uint150_t));
+kiero::Status::Enum kiero::init(RenderType::Enum _renderType)
+{
+ if (g_renderType != RenderType::None)
+ {
+ KIERO_ASSERT(0 && "Are you trying to initialize twice?");
+ return Status::AlreadyInitialized;
+ }
-#if KIERO_USE_MINHOOK
- MH_Initialize();
+ if (_renderType == RenderType::D3D7)
+ {
+#ifndef KIERO_INCLUDE_D3D7
+ goto NOT_IMPLEMENT_ERR;
+#else
+ // TODO: ...
#endif
+ }
+ else if (_renderType == RenderType::D3D8)
+ {
+#ifndef KIERO_INCLUDE_D3D8
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libD3D8;
+ if ((libD3D8 = ::GetModuleHandle(KIERO_TEXT("d3d8.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- swapChain->Release();
- swapChain = NULL;
-
- device->Release();
- device = NULL;
+ void* Direct3DCreate8;
+ if ((Direct3DCreate8 = ::GetProcAddress(libD3D8, KIERO_TEXTA("Direct3DCreate8"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
+ kitchen::DirectXObjectPtr direct3D8;
+ if ((direct3D8.instance = ((void*(__stdcall*)(uint32_t))(Direct3DCreate8))(220)) == NULL)
+ {
+ return Status::UnknownError;
+ }
- g_renderType = RenderType::D3D10;
+ kitchen::DirectXWindow window;
+ kitchen::d3d8::D3DPRESENT_PARAMETERS params;
+ params.BackBufferWidth = 0;
+ params.BackBufferHeight = 0;
+ params.BackBufferFormat = 0;
+ params.BackBufferCount = 0;
+ params.MultiSampleType = 0;
+ params.SwapEffect = 1;
+ params.hDeviceWindow = window.handle;
+ params.Windowed = 1;
+ params.EnableAutoDepthStencil = 0;
+ params.AutoDepthStencilFormat = 0;
+ params.Flags = 0;
+ params.FullScreen_RefreshRateInHz = 0;
+ params.FullScreen_PresentationInterval = 0;
+
+ // IDirect3D8::CreateDevice
+ kitchen::DirectXObjectPtr device;
+ if (((int(__stdcall*)(
+ void*,
+ uint32_t,
+ int,
+ HWND,
+ uint32_t,
+ void*,
+ void**))(((*(uintptr_t**)(direct3D8.instance)))[15]))(
+ direct3D8.instance,
+ 0, // D3DADAPTER_DEFAULT
+ 4, // D3DDEVTYPE_NULLREF
+ window.handle,
+ 0x120, // D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT
+ ¶ms,
+ &device.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- return Status::Success;
+ // IDirect3DDevice8
+ for (size_t i = 0; i < 97; ++i)
+ {
+ const char* alias = kitchen::d3d9::s_methodsTable[i];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
#endif
- }
- else if (_renderType == RenderType::D3D11)
- {
-#if KIERO_INCLUDE_D3D11
- HMODULE libD3D11;
- if ((libD3D11 = ::GetModuleHandle(KIERO_TEXT("d3d11.dll"))) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::ModuleNotFoundError;
- }
+ }
+ else if (_renderType == RenderType::D3D9)
+ {
+#ifndef KIERO_INCLUDE_D3D9
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libD3D9;
+ if ((libD3D9 = ::GetModuleHandle(KIERO_TEXT("d3d9.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- void* D3D11CreateDeviceAndSwapChain;
- if ((D3D11CreateDeviceAndSwapChain = ::GetProcAddress(libD3D11, "D3D11CreateDeviceAndSwapChain")) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ void* Direct3DCreate9;
+ if ((Direct3DCreate9 = ::GetProcAddress(libD3D9, KIERO_TEXTA("Direct3DCreate9"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- D3D_FEATURE_LEVEL featureLevel;
- const D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_11_0 };
-
- DXGI_RATIONAL refreshRate;
- refreshRate.Numerator = 60;
- refreshRate.Denominator = 1;
-
- DXGI_MODE_DESC bufferDesc;
- bufferDesc.Width = 100;
- bufferDesc.Height = 100;
- bufferDesc.RefreshRate = refreshRate;
- bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
- bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
- DXGI_SAMPLE_DESC sampleDesc;
- sampleDesc.Count = 1;
- sampleDesc.Quality = 0;
-
- DXGI_SWAP_CHAIN_DESC swapChainDesc;
- swapChainDesc.BufferDesc = bufferDesc;
- swapChainDesc.SampleDesc = sampleDesc;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.BufferCount = 1;
- swapChainDesc.OutputWindow = window;
- swapChainDesc.Windowed = 1;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
-
- IDXGISwapChain* swapChain;
- ID3D11Device* device;
- ID3D11DeviceContext* context;
-
- if (((long(__stdcall*)(
- IDXGIAdapter*,
- D3D_DRIVER_TYPE,
- HMODULE,
- UINT,
- const D3D_FEATURE_LEVEL*,
- UINT,
- UINT,
- const DXGI_SWAP_CHAIN_DESC*,
- IDXGISwapChain**,
- ID3D11Device**,
- D3D_FEATURE_LEVEL*,
- ID3D11DeviceContext**))(D3D11CreateDeviceAndSwapChain))(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, featureLevels, 2, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, &featureLevel, &context) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ kitchen::DirectXObjectPtr direct3D9;
+ if ((direct3D9.instance = ((void* (__stdcall*)(uint32_t))(Direct3DCreate9))(32)) == NULL)
+ {
+ return Status::UnknownError;
+ }
- g_methodsTable = (uint150_t*)::calloc(205, sizeof(uint150_t));
- ::memcpy(g_methodsTable, *(uint150_t**)swapChain, 18 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 18, *(uint150_t**)device, 43 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 18 + 43, *(uint150_t**)context, 144 * sizeof(uint150_t));
+ kitchen::DirectXWindow window;
+ kitchen::d3d9::D3DPRESENT_PARAMETERS params;
+ params.BackBufferWidth = 0;
+ params.BackBufferHeight = 0;
+ params.BackBufferFormat = 0;
+ params.BackBufferCount = 0;
+ params.MultiSampleType = 0;
+ params.MultiSampleQuality = 0;
+ params.SwapEffect = 1;
+ params.hDeviceWindow = window.handle;
+ params.Windowed = 1;
+ params.EnableAutoDepthStencil = 0;
+ params.AutoDepthStencilFormat = 0;
+ params.Flags = 0;
+ params.FullScreen_RefreshRateInHz = 0;
+ params.PresentationInterval = 0;
+
+ // IDirect3D9::CreateDevice
+ kitchen::DirectXObjectPtr device;
+ if (((int(__stdcall*)(
+ void*,
+ uint32_t,
+ int,
+ HWND,
+ uint32_t,
+ void*,
+ void**))(((*(uintptr_t**)(direct3D9.instance)))[16]))(
+ direct3D9.instance,
+ 0, // D3DADAPTER_DEFAULT
+ 4, // D3DDEVTYPE_NULLREF
+ window.handle,
+ 0x120, // D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT
+ ¶ms,
+ &device.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
-#if KIERO_USE_MINHOOK
- MH_Initialize();
+ // IDirect3DDevice9
+ for (size_t i = 0; i < 119; ++i)
+ {
+ const char* alias = kitchen::d3d9::s_methodsTable[i];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
#endif
+ }
+ else if (_renderType == RenderType::D3D9Ex)
+ {
+#ifndef KIERO_INCLUDE_D3D9EX
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libD3D9;
+ if ((libD3D9 = ::GetModuleHandle(KIERO_TEXT("d3d9.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- swapChain->Release();
- swapChain = NULL;
-
- device->Release();
- device = NULL;
-
- context->Release();
- context = NULL;
+ void* Direct3DCreate9Ex;
+ if ((Direct3DCreate9Ex = ::GetProcAddress(libD3D9, KIERO_TEXTA("Direct3DCreate9Ex"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
+ kitchen::DirectXObjectPtr direct3D9Ex;
+ if ((direct3D9Ex.instance = ((void* (__stdcall*)(uint32_t))(Direct3DCreate9Ex))(32)) == NULL)
+ {
+ return Status::UnknownError;
+ }
- g_renderType = RenderType::D3D11;
+ kitchen::DirectXWindow window;
+ kitchen::d3d9::D3DPRESENT_PARAMETERS params;
+ params.BackBufferWidth = 0;
+ params.BackBufferHeight = 0;
+ params.BackBufferFormat = 0;
+ params.BackBufferCount = 0;
+ params.MultiSampleType = 0;
+ params.MultiSampleQuality = 0;
+ params.SwapEffect = 1;
+ params.hDeviceWindow = window.handle;
+ params.Windowed = 1;
+ params.EnableAutoDepthStencil = 0;
+ params.AutoDepthStencilFormat = 0;
+ params.Flags = 0;
+ params.FullScreen_RefreshRateInHz = 0;
+ params.PresentationInterval = 0;
+
+ // IDirect3D9::CreateDeviceEx
+ kitchen::DirectXObjectPtr device;
+ if (((int(__stdcall*)(
+ void*,
+ uint32_t,
+ int,
+ HWND,
+ uint32_t,
+ void*,
+ void*,
+ void**))(((*(uintptr_t**)(direct3D9Ex.instance)))[20]))(
+ direct3D9Ex.instance,
+ 0, // D3DADAPTER_DEFAULT
+ 4, // D3DDEVTYPE_NULLREF
+ window.handle,
+ 0x120, // D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_DISABLE_DRIVER_MANAGEMENT
+ ¶ms,
+ NULL,
+ &device.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- return Status::Success;
+ // IDirect3DDevice9Ex
+ for (size_t i = 0; i < 134; ++i)
+ {
+ const char* alias = kitchen::d3d9::s_methodsTable[i];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
#endif
- }
- else if (_renderType == RenderType::D3D12)
- {
-#if KIERO_INCLUDE_D3D12
- HMODULE libDXGI;
- HMODULE libD3D12;
- if ((libDXGI = ::GetModuleHandle(KIERO_TEXT("dxgi.dll"))) == NULL || (libD3D12 = ::GetModuleHandle(KIERO_TEXT("d3d12.dll"))) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::ModuleNotFoundError;
- }
-
- void* CreateDXGIFactory;
- if ((CreateDXGIFactory = ::GetProcAddress(libDXGI, "CreateDXGIFactory")) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ }
+ else if (_renderType == RenderType::D3D10)
+ {
+#ifndef KIERO_INCLUDE_D3D10
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libD3D10;
+ if ((libD3D10 = ::GetModuleHandle(KIERO_TEXT("d3d10.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- IDXGIFactory* factory;
- if (((long(__stdcall*)(const IID&, void**))(CreateDXGIFactory))(__uuidof(IDXGIFactory), (void**)&factory) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ void* D3D10CreateDeviceAndSwapChain;
+ if ((D3D10CreateDeviceAndSwapChain = ::GetProcAddress(libD3D10, KIERO_TEXTA("D3D10CreateDeviceAndSwapChain"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- IDXGIAdapter* adapter;
- if (factory->EnumAdapters(0, &adapter) == DXGI_ERROR_NOT_FOUND)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ kitchen::DirectXWindow window;
+
+ kitchen::dxgi::DXGI_RATIONAL refreshRate;
+ refreshRate.Numerator = 60;
+ refreshRate.Denominator = 1;
+
+ kitchen::dxgi::DXGI_MODE_DESC bufferDesc;
+ bufferDesc.Width = 100;
+ bufferDesc.Height = 100;
+ bufferDesc.RefreshRate = refreshRate;
+ bufferDesc.Format = 28; // DXGI_FORMAT_R8G8B8A8_UNORM
+ bufferDesc.ScanlineOrdering = 0; // DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
+ bufferDesc.Scaling = 0; // DXGI_MODE_SCALING_UNSPECIFIED
+
+ kitchen::dxgi::DXGI_SAMPLE_DESC sampleDesc;
+ sampleDesc.Count = 1;
+ sampleDesc.Quality = 0;
+
+ kitchen::dxgi::DXGI_SWAP_CHAIN_DESC swapChainDesc;
+ swapChainDesc.BufferDesc = bufferDesc;
+ swapChainDesc.SampleDesc = sampleDesc;
+ swapChainDesc.BufferUsage = 0x20; // DXGI_USAGE_RENDER_TARGET_OUTPUT
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.OutputWindow = window.handle;
+ swapChainDesc.Windowed = 1;
+ swapChainDesc.SwapEffect = 0; // DXGI_SWAP_EFFECT_DISCARD
+ swapChainDesc.Flags = 2; // DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
+
+ kitchen::DirectXObjectPtr device;
+ kitchen::DirectXObjectPtr swapChain;
+
+ if (((long(__stdcall*)(
+ void*,
+ UINT,
+ HMODULE,
+ UINT,
+ UINT,
+ void*,
+ void**,
+ void**))(D3D10CreateDeviceAndSwapChain))(
+ NULL,
+ 0, // D3D10_DRIVER_TYPE_HARDWARE
+ NULL,
+ 0,
+ 29, // D3D10_SDK_VERSION
+ &swapChainDesc,
+ &swapChain.instance,
+ &device.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- void* D3D12CreateDevice;
- if ((D3D12CreateDevice = ::GetProcAddress(libD3D12, "D3D12CreateDevice")) == NULL)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ size_t i, o;
- ID3D12Device* device;
- if (((long(__stdcall*)(IUnknown*, D3D_FEATURE_LEVEL, const IID&, void**))(D3D12CreateDevice))(adapter, D3D_FEATURE_LEVEL_11_0, __uuidof(ID3D12Device), (void**)&device) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ // IDXGISwapChain
+ for (i = 0, o = 0; i < 18; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d10::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(swapChain.instance)))[i];
+ }
- D3D12_COMMAND_QUEUE_DESC queueDesc;
- queueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
- queueDesc.Priority = 0;
- queueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
- queueDesc.NodeMask = 0;
+ // ID3D10Device
+ for (i = 0; i < 98; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d10::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
+#endif
+ }
+ else if (_renderType == RenderType::D3D11)
+ {
+#ifndef KIERO_INCLUDE_D3D11
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libD3D11;
+ if ((libD3D11 = ::GetModuleHandle(KIERO_TEXT("d3d11.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- ID3D12CommandQueue* commandQueue;
- if (device->CreateCommandQueue(&queueDesc, __uuidof(ID3D12CommandQueue), (void**)&commandQueue) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ void* D3D11CreateDeviceAndSwapChain;
+ if ((D3D11CreateDeviceAndSwapChain = ::GetProcAddress(libD3D11, KIERO_TEXTA("D3D11CreateDeviceAndSwapChain"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- ID3D12CommandAllocator* commandAllocator;
- if (device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, __uuidof(ID3D12CommandAllocator), (void**)&commandAllocator) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ kitchen::DirectXWindow window;
+
+ kitchen::dxgi::DXGI_RATIONAL refreshRate;
+ refreshRate.Numerator = 60;
+ refreshRate.Denominator = 1;
+
+ kitchen::dxgi::DXGI_MODE_DESC bufferDesc;
+ bufferDesc.Width = 100;
+ bufferDesc.Height = 100;
+ bufferDesc.RefreshRate = refreshRate;
+ bufferDesc.Format = 28; // DXGI_FORMAT_R8G8B8A8_UNORM
+ bufferDesc.ScanlineOrdering = 0; // DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
+ bufferDesc.Scaling = 0; // DXGI_MODE_SCALING_UNSPECIFIED
+
+ kitchen::dxgi::DXGI_SAMPLE_DESC sampleDesc;
+ sampleDesc.Count = 1;
+ sampleDesc.Quality = 0;
+
+ kitchen::dxgi::DXGI_SWAP_CHAIN_DESC swapChainDesc;
+ swapChainDesc.BufferDesc = bufferDesc;
+ swapChainDesc.SampleDesc = sampleDesc;
+ swapChainDesc.BufferUsage = 0x20; // DXGI_USAGE_RENDER_TARGET_OUTPUT
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.OutputWindow = window.handle;
+ swapChainDesc.Windowed = 1;
+ swapChainDesc.SwapEffect = 0; // DXGI_SWAP_EFFECT_DISCARD
+ swapChainDesc.Flags = 2; // DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
+
+ kitchen::DirectXObjectPtr device;
+ kitchen::DirectXObjectPtr context;
+ kitchen::DirectXObjectPtr swapChain;
+
+ HRESULT hr;
+
+ if ((hr = ((long(__stdcall*)(
+ void*,
+ UINT,
+ HMODULE,
+ UINT,
+ const void*,
+ UINT,
+ UINT,
+ const void*,
+ void**,
+ void**,
+ void*,
+ void**))(D3D11CreateDeviceAndSwapChain))(
+ NULL,
+ 1, // D3D_DRIVER_TYPE_HARDWARE
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 7, // D3D11_SDK_VERSION
+ &swapChainDesc,
+ &swapChain.instance,
+ &device.instance,
+ NULL,
+ &context.instance)) < 0)
+ {
+ return Status::UnknownError;
+ }
- ID3D12GraphicsCommandList* commandList;
- if (device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, commandAllocator, NULL, __uuidof(ID3D12GraphicsCommandList), (void**)&commandList) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ size_t i, o;
- DXGI_RATIONAL refreshRate;
- refreshRate.Numerator = 60;
- refreshRate.Denominator = 1;
-
- DXGI_MODE_DESC bufferDesc;
- bufferDesc.Width = 100;
- bufferDesc.Height = 100;
- bufferDesc.RefreshRate = refreshRate;
- bufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
- bufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
- bufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
-
- DXGI_SAMPLE_DESC sampleDesc;
- sampleDesc.Count = 1;
- sampleDesc.Quality = 0;
-
- DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
- swapChainDesc.BufferDesc = bufferDesc;
- swapChainDesc.SampleDesc = sampleDesc;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.OutputWindow = window;
- swapChainDesc.Windowed = 1;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
- swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;
-
- IDXGISwapChain* swapChain;
- if (factory->CreateSwapChain(commandQueue, &swapChainDesc, &swapChain) < 0)
- {
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
- return Status::UnknownError;
- }
+ // IDXGISwapChain
+ for (i = 0, o = 0; i < 18; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d11::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(swapChain.instance)))[i];
+ }
- g_methodsTable = (uint150_t*)::calloc(150, sizeof(uint150_t));
- ::memcpy(g_methodsTable, *(uint150_t**)device, 44 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 44, *(uint150_t**)commandQueue, 19 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 44 + 19, *(uint150_t**)commandAllocator, 9 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 44 + 19 + 9, *(uint150_t**)commandList, 60 * sizeof(uint150_t));
- ::memcpy(g_methodsTable + 44 + 19 + 9 + 60, *(uint150_t**)swapChain, 18 * sizeof(uint150_t));
+ // ID3D11Device
+ for (i = 0; i < 43; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d11::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
-#if KIERO_USE_MINHOOK
- MH_Initialize();
+ // ID3D11DeviceContext
+ for (i = 0; i < 144; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d11::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(context.instance)))[i];
+ }
#endif
+ }
+ else if (_renderType == RenderType::D3D12)
+ {
+#ifndef KIERO_INCLUDE_D3D12
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libDXGI;
+ HMODULE libD3D12;
+ if ((libDXGI = ::GetModuleHandle(KIERO_TEXT("dxgi.dll"))) == NULL || (libD3D12 = ::GetModuleHandle(KIERO_TEXT("d3d12.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- device->Release();
- device = NULL;
-
- commandQueue->Release();
- commandQueue = NULL;
-
- commandAllocator->Release();
- commandAllocator = NULL;
-
- commandList->Release();
- commandList = NULL;
+ void* CreateDXGIFactory;
+ if ((CreateDXGIFactory = ::GetProcAddress(libDXGI, KIERO_TEXTA("CreateDXGIFactory"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- swapChain->Release();
- swapChain = NULL;
+ kitchen::DirectXObjectPtr factory;
+ if (((long(__stdcall*)(
+ const IID&,
+ void**))(CreateDXGIFactory))(
+ kitchen::dxgi::IID_IDXGIFactory,
+ &factory.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
+ void* D3D12CreateDevice;
+ if ((D3D12CreateDevice = ::GetProcAddress(libD3D12, KIERO_TEXTA("D3D12CreateDevice"))) == NULL)
+ {
+ return Status::UnknownError;
+ }
- g_renderType = RenderType::D3D12;
+ kitchen::DirectXObjectPtr device;
+
+ if (((long(__stdcall*)(
+ IUnknown*,
+ UINT,
+ const IID&,
+ void**))(D3D12CreateDevice))(
+ NULL,
+ 0xb000, // D3D_FEATURE_LEVEL_11_0
+ kitchen::d3d12::IID_ID3D12Device,
+ (void**)&device.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- return Status::Success;
-#endif
- }
+ kitchen::d3d12::D3D12_COMMAND_QUEUE_DESC queueDesc;
+ queueDesc.Type = 0; // D3D12_COMMAND_LIST_TYPE_DIRECT
+ queueDesc.Priority = 0;
+ queueDesc.Flags = 0; // D3D12_COMMAND_QUEUE_FLAG_NONE
+ queueDesc.NodeMask = 0;
+
+ // ID3D12Device::CreateCommandQueue
+ kitchen::DirectXObjectPtr commandQueue;
+ if (((int(__stdcall*)(
+ void*,
+ void*,
+ REFIID,
+ void**))(((*(uintptr_t**)(device.instance)))[8]))(
+ device.instance,
+ &queueDesc,
+ kitchen::d3d12::IID_ID3D12CommandQueue,
+ &commandQueue.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- ::DestroyWindow(window);
- ::UnregisterClass(windowClass.lpszClassName, windowClass.hInstance);
+ // ID3D12Device::CreateCommandAllocator
+ kitchen::DirectXObjectPtr commandAllocator;
+ if (((int(__stdcall*)(
+ void*,
+ UINT,
+ REFIID,
+ void**))(((*(uintptr_t**)(device.instance)))[9]))(
+ device.instance,
+ 0, // D3D12_COMMAND_LIST_TYPE_DIRECT
+ kitchen::d3d12::IID_ID3D12CommandAllocator,
+ &commandAllocator.instance) < 0)
+ {
+ return Status::UnknownError;
+ }
- return Status::NotSupportedError;
+ // ID3D12Device::CreateCommandList
+ kitchen::DirectXObjectPtr commandList;
+ if (((int(__stdcall*)(
+ void*,
+ UINT,
+ UINT,
+ void*,
+ void*,
+ REFIID,
+ void**))(((*(uintptr_t**)(device.instance)))[12]))(
+ device.instance,
+ 0,
+ 0, // D3D12_COMMAND_LIST_TYPE_DIRECT
+ commandAllocator.instance,
+ NULL,
+ kitchen::d3d12::IID_ID3D12GraphicsCommandList,
+ &commandAllocator.instance) < 0)
+ {
+ return Status::UnknownError;
}
- else if (_renderType != RenderType::Auto)
+
+ kitchen::DirectXWindow window;
+
+ kitchen::dxgi::DXGI_RATIONAL refreshRate;
+ refreshRate.Numerator = 60;
+ refreshRate.Denominator = 1;
+
+ kitchen::dxgi::DXGI_MODE_DESC bufferDesc;
+ bufferDesc.Width = 100;
+ bufferDesc.Height = 100;
+ bufferDesc.RefreshRate = refreshRate;
+ bufferDesc.Format = 28; // DXGI_FORMAT_R8G8B8A8_UNORM
+ bufferDesc.ScanlineOrdering = 0; // DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED
+ bufferDesc.Scaling = 0; // DXGI_MODE_SCALING_UNSPECIFIED
+
+ kitchen::dxgi::DXGI_SAMPLE_DESC sampleDesc;
+ sampleDesc.Count = 1;
+ sampleDesc.Quality = 0;
+
+ kitchen::dxgi::DXGI_SWAP_CHAIN_DESC swapChainDesc;
+ swapChainDesc.BufferDesc = bufferDesc;
+ swapChainDesc.SampleDesc = sampleDesc;
+ swapChainDesc.BufferUsage = 0x20; // DXGI_USAGE_RENDER_TARGET_OUTPUT
+ swapChainDesc.BufferCount = 1;
+ swapChainDesc.OutputWindow = window.handle;
+ swapChainDesc.Windowed = 1;
+ swapChainDesc.SwapEffect = 0; // DXGI_SWAP_EFFECT_DISCARD
+ swapChainDesc.Flags = 2; // DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
+
+ kitchen::DirectXObjectPtr swapChain;
+ if (((int(__stdcall*)(
+ void*,
+ void*,
+ void*,
+ void**))(((*(uintptr_t**)(factory.instance)))[10]))(
+ factory.instance,
+ commandQueue.instance,
+ &swapChainDesc,
+ &swapChain.instance) < 0)
{
- if (_renderType == RenderType::OpenGL)
- {
-#if KIERO_INCLUDE_OPENGL
- HMODULE libOpenGL32;
- if ((libOpenGL32 = ::GetModuleHandle(KIERO_TEXT("opengl32.dll"))) == NULL)
- {
- return Status::ModuleNotFoundError;
- }
+ return Status::UnknownError;
+ }
- const char* const methodsNames[] = {
- "glAccum", "glAlphaFunc", "glAreTexturesResident", "glArrayElement", "glBegin", "glBindTexture", "glBitmap", "glBlendFunc", "glCallList", "glCallLists", "glClear", "glClearAccum",
- "glClearColor", "glClearDepth", "glClearIndex", "glClearStencil", "glClipPlane", "glColor3b", "glColor3bv", "glColor3d", "glColor3dv", "glColor3f", "glColor3fv", "glColor3i", "glColor3iv",
- "glColor3s", "glColor3sv", "glColor3ub", "glColor3ubv", "glColor3ui", "glColor3uiv", "glColor3us", "glColor3usv", "glColor4b", "glColor4bv", "glColor4d", "glColor4dv", "glColor4f",
- "glColor4fv", "glColor4i", "glColor4iv", "glColor4s", "glColor4sv", "glColor4ub", "glColor4ubv", "glColor4ui", "glColor4uiv", "glColor4us", "glColor4usv", "glColorMask", "glColorMaterial",
- "glColorPointer", "glCopyPixels", "glCopyTexImage1D", "glCopyTexImage2D", "glCopyTexSubImage1D", "glCopyTexSubImage2D", "glCullFaceglCullFace", "glDeleteLists", "glDeleteTextures",
- "glDepthFunc", "glDepthMask", "glDepthRange", "glDisable", "glDisableClientState", "glDrawArrays", "glDrawBuffer", "glDrawElements", "glDrawPixels", "glEdgeFlag", "glEdgeFlagPointer",
- "glEdgeFlagv", "glEnable", "glEnableClientState", "glEnd", "glEndList", "glEvalCoord1d", "glEvalCoord1dv", "glEvalCoord1f", "glEvalCoord1fv", "glEvalCoord2d", "glEvalCoord2dv",
- "glEvalCoord2f", "glEvalCoord2fv", "glEvalMesh1", "glEvalMesh2", "glEvalPoint1", "glEvalPoint2", "glFeedbackBuffer", "glFinish", "glFlush", "glFogf", "glFogfv", "glFogi", "glFogiv",
- "glFrontFace", "glFrustum", "glGenLists", "glGenTextures", "glGetBooleanv", "glGetClipPlane", "glGetDoublev", "glGetError", "glGetFloatv", "glGetIntegerv", "glGetLightfv", "glGetLightiv",
- "glGetMapdv", "glGetMapfv", "glGetMapiv", "glGetMaterialfv", "glGetMaterialiv", "glGetPixelMapfv", "glGetPixelMapuiv", "glGetPixelMapusv", "glGetPointerv", "glGetPolygonStipple",
- "glGetString", "glGetTexEnvfv", "glGetTexEnviv", "glGetTexGendv", "glGetTexGenfv", "glGetTexGeniv", "glGetTexImage", "glGetTexLevelParameterfv", "glGetTexLevelParameteriv",
- "glGetTexParameterfv", "glGetTexParameteriv", "glHint", "glIndexMask", "glIndexPointer", "glIndexd", "glIndexdv", "glIndexf", "glIndexfv", "glIndexi", "glIndexiv", "glIndexs", "glIndexsv",
- "glIndexub", "glIndexubv", "glInitNames", "glInterleavedArrays", "glIsEnabled", "glIsList", "glIsTexture", "glLightModelf", "glLightModelfv", "glLightModeli", "glLightModeliv", "glLightf",
- "glLightfv", "glLighti", "glLightiv", "glLineStipple", "glLineWidth", "glListBase", "glLoadIdentity", "glLoadMatrixd", "glLoadMatrixf", "glLoadName", "glLogicOp", "glMap1d", "glMap1f",
- "glMap2d", "glMap2f", "glMapGrid1d", "glMapGrid1f", "glMapGrid2d", "glMapGrid2f", "glMaterialf", "glMaterialfv", "glMateriali", "glMaterialiv", "glMatrixMode", "glMultMatrixd",
- "glMultMatrixf", "glNewList", "glNormal3b", "glNormal3bv", "glNormal3d", "glNormal3dv", "glNormal3f", "glNormal3fv", "glNormal3i", "glNormal3iv", "glNormal3s", "glNormal3sv",
- "glNormalPointer", "glOrtho", "glPassThrough", "glPixelMapfv", "glPixelMapuiv", "glPixelMapusv", "glPixelStoref", "glPixelStorei", "glPixelTransferf", "glPixelTransferi", "glPixelZoom",
- "glPointSize", "glPolygonMode", "glPolygonOffset", "glPolygonStipple", "glPopAttrib", "glPopClientAttrib", "glPopMatrix", "glPopName", "glPrioritizeTextures", "glPushAttrib",
- "glPushClientAttrib", "glPushMatrix", "glPushName", "glRasterPos2d", "glRasterPos2dv", "glRasterPos2f", "glRasterPos2fv", "glRasterPos2i", "glRasterPos2iv", "glRasterPos2s",
- "glRasterPos2sv", "glRasterPos3d", "glRasterPos3dv", "glRasterPos3f", "glRasterPos3fv", "glRasterPos3i", "glRasterPos3iv", "glRasterPos3s", "glRasterPos3sv", "glRasterPos4d",
- "glRasterPos4dv", "glRasterPos4f", "glRasterPos4fv", "glRasterPos4i", "glRasterPos4iv", "glRasterPos4s", "glRasterPos4sv", "glReadBuffer", "glReadPixels", "glRectd", "glRectdv", "glRectf",
- "glRectfv", "glRecti", "glRectiv", "glRects", "glRectsv", "glRenderMode", "glRotated", "glRotatef", "glScaled", "glScalef", "glScissor", "glSelectBuffer", "glShadeModel", "glStencilFunc",
- "glStencilMask", "glStencilOp", "glTexCoord1d", "glTexCoord1dv", "glTexCoord1f", "glTexCoord1fv", "glTexCoord1i", "glTexCoord1iv", "glTexCoord1s", "glTexCoord1sv", "glTexCoord2d",
- "glTexCoord2dv", "glTexCoord2f", "glTexCoord2fv", "glTexCoord2i", "glTexCoord2iv", "glTexCoord2s", "glTexCoord2sv", "glTexCoord3d", "glTexCoord3dv", "glTexCoord3f", "glTexCoord3fv",
- "glTexCoord3i", "glTexCoord3iv", "glTexCoord3s", "glTexCoord3sv", "glTexCoord4d", "glTexCoord4dv", "glTexCoord4f", "glTexCoord4fv", "glTexCoord4i", "glTexCoord4iv", "glTexCoord4s",
- "glTexCoord4sv", "glTexCoordPointer", "glTexEnvf", "glTexEnvfv", "glTexEnvi", "glTexEnviv", "glTexGend", "glTexGendv", "glTexGenf", "glTexGenfv", "glTexGeni", "glTexGeniv", "glTexImage1D",
- "glTexImage2D", "glTexParameterf", "glTexParameterfv", "glTexParameteri", "glTexParameteriv", "glTexSubImage1D", "glTexSubImage2D", "glTranslated", "glTranslatef", "glVertex2d",
- "glVertex2dv", "glVertex2f", "glVertex2fv", "glVertex2i", "glVertex2iv", "glVertex2s", "glVertex2sv", "glVertex3d", "glVertex3dv", "glVertex3f", "glVertex3fv", "glVertex3i", "glVertex3iv",
- "glVertex3s", "glVertex3sv", "glVertex4d", "glVertex4dv", "glVertex4f", "glVertex4fv", "glVertex4i", "glVertex4iv", "glVertex4s", "glVertex4sv", "glVertexPointer", "glViewport"
- };
-
- size_t size = KIERO_ARRAY_SIZE(methodsNames);
-
- g_methodsTable = (uint150_t*)::calloc(size, sizeof(uint150_t));
-
- for (int i = 0; i < size; i++)
- {
- g_methodsTable[i] = (uint150_t)::GetProcAddress(libOpenGL32, methodsNames[i]);
- }
+ size_t i, o;
-#if KIERO_USE_MINHOOK
- MH_Initialize();
-#endif
+ // IDXGISwapChain
+ for (i = 0, o = 0; i < 18; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d12::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(swapChain.instance)))[i];
+ }
- g_renderType = RenderType::OpenGL;
+ // ID3D12Device
+ for (i = 0; i < 44; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d12::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(device.instance)))[i];
+ }
- return Status::Success;
-#endif
- }
- else if (_renderType == RenderType::Vulkan)
- {
-#if KIERO_INCLUDE_VULKAN
- HMODULE libVulkan;
- if ((libVulkan = GetModuleHandle(KIERO_TEXT("vulkan-1.dll"))) == NULL)
- {
- return Status::ModuleNotFoundError;
- }
+ // ID3D12CommandQueue
+ for (i = 0; i < 19; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d12::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(commandQueue.instance)))[i];
+ }
- const char* const methodsNames[] = {
- "vkCreateInstance", "vkDestroyInstance", "vkEnumeratePhysicalDevices", "vkGetPhysicalDeviceFeatures", "vkGetPhysicalDeviceFormatProperties", "vkGetPhysicalDeviceImageFormatProperties",
- "vkGetPhysicalDeviceProperties", "vkGetPhysicalDeviceQueueFamilyProperties", "vkGetPhysicalDeviceMemoryProperties", "vkGetInstanceProcAddr", "vkGetDeviceProcAddr", "vkCreateDevice",
- "vkDestroyDevice", "vkEnumerateInstanceExtensionProperties", "vkEnumerateDeviceExtensionProperties", "vkEnumerateDeviceLayerProperties", "vkGetDeviceQueue", "vkQueueSubmit", "vkQueueWaitIdle",
- "vkDeviceWaitIdle", "vkAllocateMemory", "vkFreeMemory", "vkMapMemory", "vkUnmapMemory", "vkFlushMappedMemoryRanges", "vkInvalidateMappedMemoryRanges", "vkGetDeviceMemoryCommitment",
- "vkBindBufferMemory", "vkBindImageMemory", "vkGetBufferMemoryRequirements", "vkGetImageMemoryRequirements", "vkGetImageSparseMemoryRequirements", "vkGetPhysicalDeviceSparseImageFormatProperties",
- "vkQueueBindSparse", "vkCreateFence", "vkDestroyFence", "vkResetFences", "vkGetFenceStatus", "vkWaitForFences", "vkCreateSemaphore", "vkDestroySemaphore", "vkCreateEvent", "vkDestroyEvent",
- "vkGetEventStatus", "vkSetEvent", "vkResetEvent", "vkCreateQueryPool", "vkDestroyQueryPool", "vkGetQueryPoolResults", "vkCreateBuffer", "vkDestroyBuffer", "vkCreateBufferView", "vkDestroyBufferView",
- "vkCreateImage", "vkDestroyImage", "vkGetImageSubresourceLayout", "vkCreateImageView", "vkDestroyImageView", "vkCreateShaderModule", "vkDestroyShaderModule", "vkCreatePipelineCache",
- "vkDestroyPipelineCache", "vkGetPipelineCacheData", "vkMergePipelineCaches", "vkCreateGraphicsPipelines", "vkCreateComputePipelines", "vkDestroyPipeline", "vkCreatePipelineLayout",
- "vkDestroyPipelineLayout", "vkCreateSampler", "vkDestroySampler", "vkCreateDescriptorSetLayout", "vkDestroyDescriptorSetLayout", "vkCreateDescriptorPool", "vkDestroyDescriptorPool",
- "vkResetDescriptorPool", "vkAllocateDescriptorSets", "vkFreeDescriptorSets", "vkUpdateDescriptorSets", "vkCreateFramebuffer", "vkDestroyFramebuffer", "vkCreateRenderPass", "vkDestroyRenderPass",
- "vkGetRenderAreaGranularity", "vkCreateCommandPool", "vkDestroyCommandPool", "vkResetCommandPool", "vkAllocateCommandBuffers", "vkFreeCommandBuffers", "vkBeginCommandBuffer", "vkEndCommandBuffer",
- "vkResetCommandBuffer", "vkCmdBindPipeline", "vkCmdSetViewport", "vkCmdSetScissor", "vkCmdSetLineWidth", "vkCmdSetDepthBias", "vkCmdSetBlendConstants", "vkCmdSetDepthBounds",
- "vkCmdSetStencilCompareMask", "vkCmdSetStencilWriteMask", "vkCmdSetStencilReference", "vkCmdBindDescriptorSets", "vkCmdBindIndexBuffer", "vkCmdBindVertexBuffers", "vkCmdDraw", "vkCmdDrawIndexed",
- "vkCmdDrawIndirect", "vkCmdDrawIndexedIndirect", "vkCmdDispatch", "vkCmdDispatchIndirect", "vkCmdCopyBuffer", "vkCmdCopyImage", "vkCmdBlitImage", "vkCmdCopyBufferToImage", "vkCmdCopyImageToBuffer",
- "vkCmdUpdateBuffer", "vkCmdFillBuffer", "vkCmdClearColorImage", "vkCmdClearDepthStencilImage", "vkCmdClearAttachments", "vkCmdResolveImage", "vkCmdSetEvent", "vkCmdResetEvent", "vkCmdWaitEvents",
- "vkCmdPipelineBarrier", "vkCmdBeginQuery", "vkCmdEndQuery", "vkCmdResetQueryPool", "vkCmdWriteTimestamp", "vkCmdCopyQueryPoolResults", "vkCmdPushConstants", "vkCmdBeginRenderPass", "vkCmdNextSubpass",
- "vkCmdEndRenderPass", "vkCmdExecuteCommands"
- };
-
- size_t size = KIERO_ARRAY_SIZE(methodsNames);
-
- g_methodsTable = (uint150_t*)::calloc(size, sizeof(uint150_t));
-
- for (int i = 0; i < size; i++)
- {
- g_methodsTable[i] = (uint150_t)::GetProcAddress(libVulkan, methodsNames[i]);
- }
+ // ID3D12CommandAllocator
+ for (i = 0; i < 9; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d12::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(commandAllocator.instance)))[i];
+ }
-#if KIERO_USE_MINHOOK
- MH_Initialize();
+ // ID3D12CommandList
+ for (i = 0; i < 60; ++i, ++o)
+ {
+ const char* alias = kitchen::d3d12::s_methodsTable[o];
+ g_methodsMap[alias] = ((*(uintptr_t**)(commandList.instance)))[i];
+ }
#endif
+ }
+ else if (_renderType == RenderType::OpenGL)
+ {
+#ifndef KIERO_INCLUDE_OPENGL
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libOpenGL32;
+ if ((libOpenGL32 = ::GetModuleHandle(KIERO_TEXT("opengl32.dll"))) == NULL)
+ {
+ return Status::ModuleNotFoundError;
+ }
- g_renderType = RenderType::Vulkan;
-
- return Status::Success;
+ g_autoImportLib = libOpenGL32;
#endif
- }
-
- return Status::NotSupportedError;
- }
- else
+ }
+ else if (_renderType == RenderType::Vulkan)
+ {
+#ifndef KIERO_INCLUDE_VULKAN
+ goto NOT_IMPLEMENT_ERR;
+#else
+ HMODULE libVulkan;
+ if ((libVulkan = ::GetModuleHandle(KIERO_TEXT("vulkan-1.dll"))) == NULL)
{
- RenderType::Enum type = RenderType::None;
-
- if (::GetModuleHandle(KIERO_TEXT("d3d9.dll")) != NULL)
- {
- type = RenderType::D3D9;
- }
- else if (::GetModuleHandle(KIERO_TEXT("d3d10.dll")) != NULL)
- {
- type = RenderType::D3D10;
- }
- else if (::GetModuleHandle(KIERO_TEXT("d3d11.dll")) != NULL)
- {
- type = RenderType::D3D11;
- }
- else if (::GetModuleHandle(KIERO_TEXT("d3d12.dll")) != NULL)
- {
- type = RenderType::D3D12;
- }
- else if (::GetModuleHandle(KIERO_TEXT("opengl32.dll")) != NULL)
- {
- type = RenderType::OpenGL;
- }
- else if (::GetModuleHandle(KIERO_TEXT("vulkan-1.dll")) != NULL)
- {
- type = RenderType::Vulkan;
- }
- else
- {
- return Status::NotSupportedError;
- }
-
- return init(type);
+ return Status::ModuleNotFoundError;
}
+
+ g_autoImportLib = libVulkan;
+#endif
+ }
+ else if (_renderType == RenderType::Auto)
+ {
+ // TODO: ...
}
+ else
+ {
+ NOT_IMPLEMENT_ERR:
+ KIERO_ASSERT(0 && "Initialization attempt for a library that is not included in the build.");
+ return Status::NotImplementedError;
+ }
+
+ g_renderType = _renderType;
return Status::Success;
}
@@ -666,54 +1584,48 @@ void kiero::shutdown()
{
if (g_renderType != RenderType::None)
{
-#if KIERO_USE_MINHOOK
- MH_DisableHook(MH_ALL_HOOKS);
-#endif
-
- ::free(g_methodsTable);
- g_methodsTable = NULL;
+ // TODO: ...
+ g_autoImportLib = NULL;
+ g_methodsMap.clear();
g_renderType = RenderType::None;
}
}
-kiero::Status::Enum kiero::bind(uint16_t _index, void** _original, void* _function)
+kiero::RenderType::Enum kiero::getRenderType()
{
- // TODO: Need own detour function
-
- assert(_original != NULL && _function != NULL);
+ return g_renderType;
+}
- if (g_renderType != RenderType::None)
+uintptr_t kiero::getMethodAddress(const char* alias)
+{
+ if (g_renderType == RenderType::None)
{
-#if KIERO_USE_MINHOOK
- void* target = (void*)g_methodsTable[_index];
- if (MH_CreateHook(target, _function, _original) != MH_OK || MH_EnableHook(target) != MH_OK)
- {
- return Status::UnknownError;
- }
-#endif
+ KIERO_ASSERT(0 && "Trying get methods without initialization?");
+ return NULL;
+ }
- return Status::Success;
+ if (g_autoImportLib != NULL)
+ {
+ return (uintptr_t)::GetProcAddress(g_autoImportLib, alias);
}
- return Status::NotInitializedError;
-}
+ std::unordered_map::iterator it = g_methodsMap.find(alias);
-void kiero::unbind(uint16_t _index)
-{
- if (g_renderType != RenderType::None)
+ if (it != g_methodsMap.end())
{
-#if KIERO_USE_MINHOOK
- MH_DisableHook((void*)g_methodsTable[_index]);
-#endif
+ return it->second;
}
+
+ return NULL;
}
-kiero::RenderType::Enum kiero::getRenderType()
+kiero::Status::Enum kiero::bind(const char* alias, void** original, void* function)
{
- return g_renderType;
+ // TODO: ...
+ return Status::NotImplementedError;
}
-uint150_t* kiero::getMethodsTable()
+void kiero::unbind(const char* alias)
{
- return g_methodsTable;
-}
\ No newline at end of file
+ // TODO: ...
+}
\ No newline at end of file
diff --git a/kiero.h b/kiero.h
index 4aba3d4..5ddb83d 100644
--- a/kiero.h
+++ b/kiero.h
@@ -1,33 +1,34 @@
#ifndef __KIERO_H__
#define __KIERO_H__
+//
+// ** ATTENTION: This version is unfinished! **
+// More information in README.md or https://github.com/Rebzzel/kiero
+//
+
+#define KIERO_VERSION "1.22.0-preview"
+
+#ifndef KIERO_DISABLE_USERCONFIG
+# include "kiero_userconfig.h"
+#endif
+
#include
-#define KIERO_VERSION "1.2.12"
-
-#define KIERO_INCLUDE_D3D9 0 // 1 if you need D3D9 hook
-#define KIERO_INCLUDE_D3D10 0 // 1 if you need D3D10 hook
-#define KIERO_INCLUDE_D3D11 0 // 1 if you need D3D11 hook
-#define KIERO_INCLUDE_D3D12 0 // 1 if you need D3D12 hook
-#define KIERO_INCLUDE_OPENGL 0 // 1 if you need OpenGL hook
-#define KIERO_INCLUDE_VULKAN 0 // 1 if you need Vulkan hook
-#define KIERO_USE_MINHOOK 0 // 1 if you will use kiero::bind function
-
-#define KIERO_ARCH_X64 0
-#define KIERO_ARCH_X86 0
-
-#if defined(_M_X64)
-# undef KIERO_ARCH_X64
-# define KIERO_ARCH_X64 1
-#else
-# undef KIERO_ARCH_X86
-# define KIERO_ARCH_X86 1
+#ifndef KIERO_ASSERT
+# include
+# define KIERO_ASSERT(_EXPR) assert(_EXPR)
+#endif
+
+#ifndef KIERO_TEXTA
+# define KIERO_TEXTA(_TEXT) _TEXT
+#endif
+
+#ifndef KIERO_TEXTW
+# define KIERO_TEXTW(_TEXT) L##_TEXT
#endif
-#if KIERO_ARCH_X64
-typedef uint64_t uint150_t;
-#else
-typedef uint32_t uint150_t;
+#ifndef KIERO_ARRAYSIZE
+# define KIERO_ARRAYSIZE(_ARR) ((size_t)(sizeof(_ARR) / sizeof(*(_ARR))))
#endif
namespace kiero
@@ -36,14 +37,15 @@ namespace kiero
{
enum Enum
{
- UnknownError = -1,
- NotSupportedError = -2,
ModuleNotFoundError = -3,
- AlreadyInitializedError = -4,
- NotInitializedError = -5,
+ NotImplementedError = -2,
+
+ UnknownError = -1,
Success = 0,
+
+ AlreadyInitialized = 1,
};
};
@@ -53,26 +55,29 @@ namespace kiero
{
None,
+ D3D7,
+ D3D8,
D3D9,
+ D3D9Ex,
D3D10,
D3D11,
D3D12,
-
+
OpenGL,
Vulkan,
- Auto
+ Auto,
};
};
Status::Enum init(RenderType::Enum renderType);
void shutdown();
- Status::Enum bind(uint16_t index, void** original, void* function);
- void unbind(uint16_t index);
-
RenderType::Enum getRenderType();
- uint150_t* getMethodsTable();
+ uintptr_t getMethodAddress(const char* alias);
+
+ Status::Enum bind(const char* alias, void** original, void* function);
+ void unbind(const char* alias);
}
#endif // __KIERO_H__
\ No newline at end of file
diff --git a/kiero_userconfig.h b/kiero_userconfig.h
new file mode 100644
index 0000000..44bf4b1
--- /dev/null
+++ b/kiero_userconfig.h
@@ -0,0 +1,51 @@
+#ifndef __KIERO_USERCONFIG_H__
+#define __KIERO_USERCONFIG_H__
+
+//
+// Hello dear user ^.^
+// Here you can configure Kiero for yourself:
+// Read the comments below - they will help you with this <3
+//
+
+//
+// Below you can configure the hooks for which libraries will be included in the build.
+// Just uncomment what you need.
+// Hint: You can uncomment all.
+//
+
+//#define KIERO_INCLUDE_D3D7 // Includes d3d7 hook implementation
+//#define KIERO_INCLUDE_D3D8 // Includes d3d8 hook implementation
+//#define KIERO_INCLUDE_D3D9 // Includes d3d9 hook implementation
+//#define KIERO_INCLUDE_D3D9EX // Includes d3d9ex hook implementation
+//#define KIERO_INCLUDE_D3D10 // Includes d3d10 hook implementation
+//#define KIERO_INCLUDE_D3D11 // Includes d3d11 hook implementation
+//#define KIERO_INCLUDE_D3D12 // Includes d3d12 hook implementation
+//#define KIERO_INCLUDE_OPENGL // Includes opengl hook implementation
+//#define KIERO_INCLUDE_VULKAN // Includes vulkan hook implementation
+
+//
+// Below you can configure utility definitions
+//
+// ---------------------------------------------------------------
+// ** ATTENTION: You must really understand what you are doing! **
+// ---------------------------------------------------------------
+//
+// Examples:
+// 1. Disabling asserts:
+// #define KIERO_ASSERT(_EXPR) ((void)(_EXPR))
+//
+// 2. Strings encryption:
+// #define KIERO_TEXTA(_TEXT) _SXOR_A_(_TEXT)
+// #define KIERO_TEXTW(_TEXT) _SXOR_W_(_TEXT)
+//
+// 3. STL array size calculation:
+// #include
+// #define KIERO_ARRAYSIZE(_ARR) std::size(_ARR)
+//
+
+//#define KIERO_ASSERT(_EXPR)
+//#define KIERO_TEXTA(_TEXT)
+//#define KIERO_TEXTW(_TEXT)
+//#define KIERO_ARRAYSIZE(_ARR)
+
+#endif
\ No newline at end of file
diff --git a/minhook b/minhook
deleted file mode 160000
index 8fda4f5..0000000
--- a/minhook
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 8fda4f5481fed5797dc2651cd91e238e9b3928c6