mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-18 17:17:31 +00:00
Fix empty screenshots & add DLL
This commit is contained in:
parent
1a4700eba3
commit
a228b00815
1
bin/capture-b/.gitignore
vendored
Normal file
1
bin/capture-b/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
!*.dll
|
@ -18,6 +18,8 @@ ProcedureDLL AttachProcess(Instance)
|
|||||||
Global Mutex = CreateMutex()
|
Global Mutex = CreateMutex()
|
||||||
Global NewList Queue.QueueElement()
|
Global NewList Queue.QueueElement()
|
||||||
|
|
||||||
|
ExamineDesktops()
|
||||||
|
|
||||||
For i = 1 To 4
|
For i = 1 To 4
|
||||||
CreateThread(@Worker(), #Null)
|
CreateThread(@Worker(), #Null)
|
||||||
Next
|
Next
|
||||||
@ -45,8 +47,6 @@ EndProcedure
|
|||||||
ProcedureDLL Capture(px.i, py.i)
|
ProcedureDLL Capture(px.i, py.i)
|
||||||
; Get dimensions of main screen
|
; Get dimensions of main screen
|
||||||
|
|
||||||
ExamineDesktops()
|
|
||||||
|
|
||||||
x = DesktopX(0)
|
x = DesktopX(0)
|
||||||
y = DesktopY(0)
|
y = DesktopY(0)
|
||||||
w = DesktopWidth(0)
|
w = DesktopWidth(0)
|
||||||
@ -59,14 +59,23 @@ ProcedureDLL Capture(px.i, py.i)
|
|||||||
|
|
||||||
; Get DC of whole screen
|
; Get DC of whole screen
|
||||||
screenDC = GetDC_(#Null)
|
screenDC = GetDC_(#Null)
|
||||||
|
If Not screenDC
|
||||||
hDC = StartDrawing(ImageOutput(imageID))
|
|
||||||
If Not hDC
|
|
||||||
ReleaseDC_(#Null, screenDC)
|
|
||||||
FreeImage(imageID)
|
FreeImage(imageID)
|
||||||
ProcedureReturn
|
ProcedureReturn
|
||||||
EndIf
|
EndIf
|
||||||
BitBlt_(hDC, 0, 0, w, h, screenDC, x, y, #SRCCOPY)
|
|
||||||
|
hDC = StartDrawing(ImageOutput(imageID))
|
||||||
|
If Not hDC
|
||||||
|
FreeImage(imageID)
|
||||||
|
ReleaseDC_(#Null, screenDC)
|
||||||
|
ProcedureReturn
|
||||||
|
EndIf
|
||||||
|
If Not BitBlt_(hDC, 0, 0, w, h, screenDC, x, y, #SRCCOPY) ; After some time BitBlt will fail, no idea why. Also, that's moments before noita crashes.
|
||||||
|
FreeImage(imageID)
|
||||||
|
ReleaseDC_(#Null, screenDC)
|
||||||
|
StopDrawing()
|
||||||
|
ProcedureReturn
|
||||||
|
EndIf
|
||||||
StopDrawing()
|
StopDrawing()
|
||||||
|
|
||||||
ReleaseDC_(#Null, screenDC)
|
ReleaseDC_(#Null, screenDC)
|
||||||
@ -91,7 +100,8 @@ EndProcedure
|
|||||||
|
|
||||||
; IDE Options = PureBasic 5.71 LTS (Windows - x64)
|
; IDE Options = PureBasic 5.71 LTS (Windows - x64)
|
||||||
; ExecutableFormat = Shared dll
|
; ExecutableFormat = Shared dll
|
||||||
; CursorPosition = 15
|
; CursorPosition = 72
|
||||||
|
; FirstLine = 32
|
||||||
; Folding = -
|
; Folding = -
|
||||||
; EnableThread
|
; EnableThread
|
||||||
; EnableXP
|
; EnableXP
|
||||||
|
@ -4,4 +4,4 @@ A dynamically linked library, that supplies a single function to take a screensh
|
|||||||
|
|
||||||
## State
|
## State
|
||||||
|
|
||||||
Works, not as fast as the go version, but ok.
|
Works, not as fast as the go version, but fast enough.
|
||||||
|
BIN
bin/capture-b/capture.dll
Normal file
BIN
bin/capture-b/capture.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user