We need to extract a pointer to Source's DirectX device
This is currently done with a hard-coded memory offset
This is likely to break between GMod updates
Scope
Identify a dll exported function which directly uses the DirectX device pointer (or equivalent memory that we can get to the device from)
In temp code with a working device offset, iterate from that function's pointer until you find a value equal to the device pointer found by manual offset
This assumes the assembly references the device literally, and not via a pointer stored in a registry or on the stack
Save the local offset into that function, and store that as the new offset in the production code
Update where the offset is used to offset into the scanned function and read the pointer at that location
⬆️ This will still break if the function scanned is ever changed, but that is less likely
Acceptance Criteria
Gelly does not break when I manually roll-back GMod to a depot with a different memory offset
Other
The scope above is based on minimal research on my part.
It's worth double checking that source never exposes the device directly, or a function to get the raw device (on the latest SDK, not the 2007 leak). If that doesn't exist, see what programs like ReShade do to solve this
Context
Scope
⬆️ This will still break if the function scanned is ever changed, but that is less likely
Acceptance Criteria
Gelly does not break when I manually roll-back GMod to a depot with a different memory offset
Other
The scope above is based on minimal research on my part.
It's worth double checking that source never exposes the device directly, or a function to get the raw device (on the latest SDK, not the 2007 leak). If that doesn't exist, see what programs like ReShade do to solve this