mirror of
https://github.com/Dadido3/noita-mapcap.git
synced 2024-11-22 21:17:33 +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 NewList Queue.QueueElement()
|
||||
|
||||
ExamineDesktops()
|
||||
|
||||
For i = 1 To 4
|
||||
CreateThread(@Worker(), #Null)
|
||||
Next
|
||||
@ -45,8 +47,6 @@ EndProcedure
|
||||
ProcedureDLL Capture(px.i, py.i)
|
||||
; Get dimensions of main screen
|
||||
|
||||
ExamineDesktops()
|
||||
|
||||
x = DesktopX(0)
|
||||
y = DesktopY(0)
|
||||
w = DesktopWidth(0)
|
||||
@ -59,14 +59,23 @@ ProcedureDLL Capture(px.i, py.i)
|
||||
|
||||
; Get DC of whole screen
|
||||
screenDC = GetDC_(#Null)
|
||||
|
||||
hDC = StartDrawing(ImageOutput(imageID))
|
||||
If Not hDC
|
||||
ReleaseDC_(#Null, screenDC)
|
||||
If Not screenDC
|
||||
FreeImage(imageID)
|
||||
ProcedureReturn
|
||||
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()
|
||||
|
||||
ReleaseDC_(#Null, screenDC)
|
||||
@ -91,7 +100,8 @@ EndProcedure
|
||||
|
||||
; IDE Options = PureBasic 5.71 LTS (Windows - x64)
|
||||
; ExecutableFormat = Shared dll
|
||||
; CursorPosition = 15
|
||||
; CursorPosition = 72
|
||||
; FirstLine = 32
|
||||
; Folding = -
|
||||
; EnableThread
|
||||
; EnableXP
|
||||
|
@ -4,4 +4,4 @@ A dynamically linked library, that supplies a single function to take a screensh
|
||||
|
||||
## 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