mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2025-02-26 22:49:28 +01:00
formatting update
This commit is contained in:
parent
78374492a1
commit
bcbd5178d1
@ -196,7 +196,6 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
IDirect3D9Ex *real = COM_PROXY_UNWRAP(self);
|
||||
HRESULT hr;
|
||||
|
||||
|
||||
if (d3d9ex_device_adapter >= 0) {
|
||||
log_info("Forcing adapter %d -> %d", adapter, d3d9ex_device_adapter);
|
||||
adapter = d3d9ex_device_adapter;
|
||||
@ -218,22 +217,25 @@ static HRESULT STDCALL my_CreateDeviceEx(
|
||||
}
|
||||
}
|
||||
|
||||
if (d3d9ex_force_orientation >= DMDO_DEFAULT && d3d9ex_force_orientation <= DMDO_270) {
|
||||
if (d3d9ex_force_orientation >= DMDO_DEFAULT &&
|
||||
d3d9ex_force_orientation <= DMDO_270) {
|
||||
D3DADAPTER_IDENTIFIER9 adapter_ident;
|
||||
if (IDirect3D9Ex_GetAdapterIdentifier(real, adapter, 0, &adapter_ident) == D3D_OK) {
|
||||
if (IDirect3D9Ex_GetAdapterIdentifier(
|
||||
real, adapter, 0, &adapter_ident) == D3D_OK) {
|
||||
// straight outta MSDN
|
||||
DEVMODE dm;
|
||||
// initialize the DEVMODE structure
|
||||
ZeroMemory(&dm, sizeof(dm));
|
||||
dm.dmSize = sizeof(dm);
|
||||
|
||||
if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm))
|
||||
{
|
||||
int32_t delta = d3d9ex_force_orientation - dm.dmDisplayOrientation;
|
||||
if (0 !=
|
||||
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &dm)) {
|
||||
int32_t delta =
|
||||
d3d9ex_force_orientation - dm.dmDisplayOrientation;
|
||||
if (delta % 2 != 0) {
|
||||
// swap height and width
|
||||
DWORD dwTemp = dm.dmPelsHeight;
|
||||
dm.dmPelsHeight= dm.dmPelsWidth;
|
||||
dm.dmPelsHeight = dm.dmPelsWidth;
|
||||
dm.dmPelsWidth = dwTemp;
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,19 @@ my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len)
|
||||
if (use_address_override) {
|
||||
while (info) {
|
||||
// this is well defined to be at most sizeof(IP_ADDRESS_STRING)
|
||||
// and NULL filled if shorter (hence the memset in adapter_hook_override)
|
||||
if (!memcmp(info->IpAddressList.IpAddress.String, override_address.String, sizeof(IP_ADDRESS_STRING))) {
|
||||
log_info("%s: using [override] adapter: %s, %s, %s, %s", __FUNCTION__, info->AdapterName, info->Description, info->IpAddressList.IpAddress.String, info->IpAddressList.IpMask.String);
|
||||
// and NULL filled if shorter (hence the memset in
|
||||
// adapter_hook_override)
|
||||
if (!memcmp(
|
||||
info->IpAddressList.IpAddress.String,
|
||||
override_address.String,
|
||||
sizeof(IP_ADDRESS_STRING))) {
|
||||
log_info(
|
||||
"%s: using [override] adapter: %s, %s, %s, %s",
|
||||
__FUNCTION__,
|
||||
info->AdapterName,
|
||||
info->Description,
|
||||
info->IpAddressList.IpAddress.String,
|
||||
info->IpAddressList.IpMask.String);
|
||||
|
||||
// copy only this adapter over
|
||||
memcpy(adapter_info, info, sizeof(*info));
|
||||
@ -83,7 +93,13 @@ my_GetAdaptersInfo(PIP_ADAPTER_INFO adapter_info, PULONG out_buf_len)
|
||||
|
||||
while (info) {
|
||||
if (info->Index == best_adapter) {
|
||||
log_info("%s: using [best] adapter: %s, %s, %s, %s", __FUNCTION__, info->AdapterName, info->Description, info->IpAddressList.IpAddress.String, info->IpAddressList.IpMask.String);
|
||||
log_info(
|
||||
"%s: using [best] adapter: %s, %s, %s, %s",
|
||||
__FUNCTION__,
|
||||
info->AdapterName,
|
||||
info->Description,
|
||||
info->IpAddressList.IpAddress.String,
|
||||
info->IpAddressList.IpMask.String);
|
||||
|
||||
// copy only this adapter over
|
||||
memcpy(adapter_info, info, sizeof(*info));
|
||||
@ -102,7 +118,7 @@ void adapter_hook_init(void)
|
||||
NULL, "iphlpapi.dll", adapter_hook_syms, lengthof(adapter_hook_syms));
|
||||
}
|
||||
|
||||
void adapter_hook_override(const char* adapter_address)
|
||||
void adapter_hook_override(const char *adapter_address)
|
||||
{
|
||||
// starts off false anyways due to static
|
||||
// but in case it gets called multiple times, set it anyways
|
||||
@ -113,7 +129,8 @@ void adapter_hook_override(const char* adapter_address)
|
||||
return;
|
||||
}
|
||||
if (strlen(adapter_address) > sizeof(IP_ADDRESS_STRING)) {
|
||||
log_warning("%s: %s is not an ipv4 address", __FUNCTION__, adapter_address);
|
||||
log_warning(
|
||||
"%s: %s is not an ipv4 address", __FUNCTION__, adapter_address);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,6 @@ void adapter_hook_init(void);
|
||||
*
|
||||
* @param network ip to match
|
||||
*/
|
||||
void adapter_hook_override(const char* adapter_address);
|
||||
void adapter_hook_override(const char *adapter_address);
|
||||
|
||||
#endif
|
||||
|
@ -17,7 +17,8 @@ void hooklib_config_adapter_init(struct cconfig *config)
|
||||
"IP of adapter to force override with");
|
||||
}
|
||||
|
||||
void hooklib_config_adapter_get(struct hooklib_config_adapter *config_adapter, struct cconfig *config)
|
||||
void hooklib_config_adapter_get(
|
||||
struct hooklib_config_adapter *config_adapter, struct cconfig *config)
|
||||
{
|
||||
if (!cconfig_util_get_str(
|
||||
config,
|
||||
|
@ -12,6 +12,7 @@ struct hooklib_config_adapter {
|
||||
|
||||
void hooklib_config_adapter_init(struct cconfig *config);
|
||||
|
||||
void hooklib_config_adapter_get(struct hooklib_config_adapter *config_adapter, struct cconfig *config);
|
||||
void hooklib_config_adapter_get(
|
||||
struct hooklib_config_adapter *config_adapter, struct cconfig *config);
|
||||
|
||||
#endif
|
Loading…
x
Reference in New Issue
Block a user