Question / Help 32/64 bit game capture

Conviq

New Member
Is there a way to load a 32 bit game into the 64 bit version and vice versa of OBS?

Swapping between 32 and 64 is kinda annoying.
 

deilwynna

New Member
you can always use software capture and chose to only capture from a specific window but if its a fullscreen game then it can be a bit problematic. software capture works on 64bit softwares in 32bit obs and vice versa
 

Dopefish

Member
I took a look at the source code for this to see if I could add support for hooking 32-bit games from a 64-bit process.

In OBSApi/Utility/XT_Windows.cpp under the function OSGetLoadedModuleList() it uses EnumProcessModules().

If you want to be able to list the modules in a target 32-bit process from a 64-bit process, use EnumProcessModulesEx(). The last argument is for a filter criteria. You can choose to have it list only the 32-bit modules, 64-bit modules, all modules, or use the default behavior.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
I'm fairly sure the way to make 32bit hooking work from 64bit and vise versa is by injecting the DLL in a separate 64bit process.. I just haven't got around to it. The interprocess functions for creating remote threads/memory as far as I know are designed to be used on the same bit boundry as the calling application. VirtualAllocEx, WriteProcessMemory, CreateRemoteThread, and such. You can't exactly use the 64bit pointers that would be required in a 32bit application. Might be possible with the 64bit version, but to really properly do it the best bet would just be to use a separate spawned 64bit or 32bit process.
 

Dopefish

Member
I've only been focusing on getting 32-bit games captured with 64-bit OBS. Going this direction is fully supported by VirtualAllocEx, WriteProcessMemory, etc. However, getting 64-bit games to load until 32-bit OBS will be problematic. 64-bit games are not common and it might be best to just limit 32-bit games to 32-bit OBS, but allow 32-bit and 64-bit games to load under 64-bit OBS.

I'm currently playing around with having 64-bit OBS capture 32-bit games. It's going so far as to attempt to inject the DLL but failing. CreateRemoteThread executes just fine. It's failing on GetExitCodeThread(), so something is not returning or working right within GraphicsCaptureHook.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
There is another reason why this wouldn't work directly in the application though.. It needs the address of the corresponding 32bit/64bit LoadLibraryW function. You cannot simply call GetProcAddress(hKernel32, "LoadLibraryW") and expect to get any sort of value that would work for the opposing bit version in order to create the remote thread. This is another reason why a separate process is needed. It's really all that needs to be done, just create two EXEs, one 32bit, one 64bit, that do nothing but inject the library. Some of the code in the hook/game capture also may need to be updated to prevent any issues as well
 

Dopefish

Member
Yeah. I figured that out looking at the code. It does seem like a simple fix. It would just take time to get it going. I need to look at the actual GraphicsCaptureHook source to see what's going on and what might need changed, as well.
 

Lain

Forum Admin
Lain
Forum Moderator
Developer
The handles of the structures in GlobalCaptureStuff.h just need to be changed to DWORDs instead, other than that, nothing else should need to be changed. The alignment of the structures is also important.
 

Krazy

Town drunk
Game Capture takes the image directly from your GPU essentially and uses practically 0 CPU in the capture process.

Currently only works for OpenGL and DirectX 9 or higher games.
 
Top