2014-12-31 23:59:24 -08:00
|
|
|
#include <windows.h>
|
2014-03-05 09:43:14 -08:00
|
|
|
#include <obs-module.h>
|
|
|
|
|
|
|
|
OBS_DECLARE_MODULE()
|
2014-07-09 22:12:57 -07:00
|
|
|
OBS_MODULE_USE_DEFAULT_LOCALE("win-capture", "en-US")
|
2014-03-05 09:43:14 -08:00
|
|
|
|
2014-12-31 23:59:24 -08:00
|
|
|
extern struct obs_source_info duplicator_capture_info;
|
2014-03-05 09:43:14 -08:00
|
|
|
extern struct obs_source_info monitor_capture_info;
|
2014-04-07 01:20:36 -07:00
|
|
|
extern struct obs_source_info window_capture_info;
|
2014-11-10 17:35:02 -08:00
|
|
|
extern struct obs_source_info game_capture_info;
|
|
|
|
|
|
|
|
extern bool load_graphics_offsets(bool is32bit);
|
|
|
|
|
|
|
|
/* temporary, will eventually be erased once we figure out how to create both
|
|
|
|
* 32bit and 64bit versions of the helpers/hook */
|
|
|
|
#ifdef _WIN64
|
|
|
|
#define IS32BIT false
|
|
|
|
#else
|
|
|
|
#define IS32BIT true
|
|
|
|
#endif
|
2014-03-05 09:43:14 -08:00
|
|
|
|
2014-07-27 12:42:43 -07:00
|
|
|
bool obs_module_load(void)
|
2014-03-05 09:43:14 -08:00
|
|
|
{
|
2014-12-31 23:59:24 -08:00
|
|
|
OSVERSIONINFO osvi = {0};
|
|
|
|
bool win8_or_above = false;
|
|
|
|
|
|
|
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
|
|
|
|
|
|
|
if (!!GetVersionEx(&osvi)) {
|
|
|
|
win8_or_above = osvi.dwMajorVersion > 6 ||
|
|
|
|
(osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_enter_graphics();
|
|
|
|
|
|
|
|
if (win8_or_above && gs_get_device_type() == GS_DEVICE_DIRECT3D_11)
|
|
|
|
obs_register_source(&duplicator_capture_info);
|
|
|
|
else
|
|
|
|
obs_register_source(&monitor_capture_info);
|
|
|
|
|
|
|
|
obs_leave_graphics();
|
|
|
|
|
2014-04-07 01:20:36 -07:00
|
|
|
obs_register_source(&window_capture_info);
|
2014-11-10 17:35:02 -08:00
|
|
|
|
|
|
|
if (load_graphics_offsets(IS32BIT)) {
|
|
|
|
load_graphics_offsets(!IS32BIT);
|
|
|
|
obs_register_source(&game_capture_info);
|
|
|
|
}
|
|
|
|
|
2014-03-05 09:43:14 -08:00
|
|
|
return true;
|
|
|
|
}
|