mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
1ad45edd6e
## Link to GitHub Issue, if one exists #345 ## Description of change Simplify camera hook in SDVX5/6. Camera hook will always be installed and return 0 cameras. Deprecate `-sdvxdisablecams` option as it is no longer needed as a result of this change. ## Testing Tested SDVX5 final, SDVX6 year 1, and a recent SDVX6 build.
38 lines
915 B
C++
38 lines
915 B
C++
|
|
// set version to Windows 7 to enable Media Foundation functions
|
|
#ifdef _WIN32_WINNT
|
|
#undef _WIN32_WINNT
|
|
#endif
|
|
#define _WIN32_WINNT 0x0601
|
|
|
|
// turn on C-style COM objects
|
|
#define CINTERFACE
|
|
|
|
#include "camera.h"
|
|
|
|
#include <mfobjects.h>
|
|
#include <mfidl.h>
|
|
|
|
#include "avs/game.h"
|
|
#include "util/detour.h"
|
|
#include "util/utils.h"
|
|
|
|
namespace games::sdvx {
|
|
|
|
static HRESULT WINAPI MFEnumDeviceSources_hook(IMFAttributes *pAttributes, IMFActivate ***pppSourceActivate,
|
|
UINT32 *pcSourceActivate) {
|
|
|
|
*pppSourceActivate = nullptr;
|
|
*pcSourceActivate = 0;
|
|
log_misc("sdvx", "MFEnumDeviceSources_hook called, returning 0 cameras");
|
|
return S_OK;
|
|
}
|
|
|
|
void camera_init() {
|
|
|
|
// camera media framework hook
|
|
log_info("sdvx", "installing camera hooks...");
|
|
detour::iat_try("MFEnumDeviceSources", MFEnumDeviceSources_hook, avs::game::DLL_INSTANCE);
|
|
}
|
|
}
|