mirror of
https://github.com/narzoul/DDrawCompat
synced 2024-12-30 08:55:36 +01:00
Indented function logging
This commit is contained in:
parent
58aba66ca2
commit
c53ffab664
@ -138,10 +138,8 @@ private:
|
||||
DDraw::ScopedThreadLock lock;
|
||||
#ifdef _DEBUG
|
||||
const char* funcName = s_funcNames[getKey<MemberDataPtr, ptr>()].c_str();
|
||||
Compat::LogEnter(funcName, firstParam, params...);
|
||||
Result result = Hook::getCompatFunc<MemberDataPtr, ptr>(firstParam)(firstParam, params...);
|
||||
Compat::LogLeave(funcName, firstParam, params...) << result;
|
||||
return result;
|
||||
LOG_FUNC(funcName, firstParam, params...);
|
||||
return LOG_RESULT(Hook::getCompatFunc<MemberDataPtr, ptr>(firstParam)(firstParam, params...));
|
||||
#else
|
||||
return (s_compatVtable.*ptr)(firstParam, params...);
|
||||
#endif
|
||||
@ -153,9 +151,8 @@ private:
|
||||
DDraw::ScopedThreadLock lock;
|
||||
#ifdef _DEBUG
|
||||
const char* funcName = s_funcNames[getKey<MemberDataPtr, ptr>()].c_str();
|
||||
Compat::LogEnter(funcName, firstParam, params...);
|
||||
LOG_FUNC(funcName, firstParam, params...);
|
||||
Hook::getCompatFunc<MemberDataPtr, ptr>(firstParam)(firstParam, params...);
|
||||
Compat::LogLeave(funcName, firstParam, params...);
|
||||
#else
|
||||
(s_compatVtable.*ptr)(firstParam, params...);
|
||||
#endif
|
||||
|
@ -1,13 +1,17 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include "Common/Hook.h"
|
||||
#include "Common/Log.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
Compat::CriticalSection g_logCs;
|
||||
|
||||
template <typename DevMode>
|
||||
std::ostream& streamDevMode(std::ostream& os, const DevMode& dm)
|
||||
{
|
||||
@ -76,7 +80,7 @@ std::ostream& operator<<(std::ostream& os, const RECT& rect)
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, HDC__& dc)
|
||||
{
|
||||
return os << "DC(" << static_cast<void*>(&dc) << ',' << WindowFromDC(&dc) << ')';
|
||||
return os << "DC(" << static_cast<void*>(&dc) << ',' << CALL_ORIG_FUNC(WindowFromDC)(&dc) << ')';
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, HRGN__& rgn)
|
||||
@ -178,15 +182,20 @@ std::ostream& operator<<(std::ostream& os, const CWPRETSTRUCT& cwrp)
|
||||
|
||||
namespace Compat
|
||||
{
|
||||
Log::Log()
|
||||
Log::Log() : m_lock(g_logCs)
|
||||
{
|
||||
SYSTEMTIME st = {};
|
||||
GetLocalTime(&st);
|
||||
|
||||
char time[100];
|
||||
sprintf_s(time, "%02hu:%02hu:%02hu.%03hu ", st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
|
||||
char header[20];
|
||||
sprintf_s(header, "%04hx %02hu:%02hu:%02hu.%03hu ",
|
||||
GetCurrentThreadId(), st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
|
||||
s_logFile << header;
|
||||
|
||||
s_logFile << GetCurrentThreadId() << " " << time;
|
||||
if (0 != s_indent)
|
||||
{
|
||||
std::fill_n(std::ostreambuf_iterator<char>(s_logFile), s_indent, ' ');
|
||||
}
|
||||
}
|
||||
|
||||
Log::~Log()
|
||||
@ -194,6 +203,8 @@ namespace Compat
|
||||
s_logFile << std::endl;
|
||||
}
|
||||
|
||||
thread_local DWORD Log::s_indent = 0;
|
||||
|
||||
std::ofstream Log::s_logFile("ddraw.log");
|
||||
DWORD Log::s_outParamDepth = 0;
|
||||
bool Log::s_isLeaveLog = false;
|
||||
|
@ -2,9 +2,15 @@
|
||||
|
||||
#include <ddraw.h>
|
||||
#include <fstream>
|
||||
#include <functional>
|
||||
#include <ostream>
|
||||
#include <type_traits>
|
||||
|
||||
#include "Common/ScopedCriticalSection.h"
|
||||
|
||||
#define LOG_FUNC(...) Compat::LogFunc logFunc(__VA_ARGS__)
|
||||
#define LOG_RESULT(...) logFunc.setResult(__VA_ARGS__)
|
||||
|
||||
#define LOG_ONCE(msg) \
|
||||
static bool isAlreadyLogged##__LINE__ = false; \
|
||||
if (!isAlreadyLogged##__LINE__) \
|
||||
@ -34,37 +40,104 @@ namespace Compat
|
||||
{
|
||||
using ::operator<<;
|
||||
|
||||
template <typename Num>
|
||||
struct Hex
|
||||
namespace detail
|
||||
{
|
||||
explicit Hex(Num val) : val(val) {}
|
||||
Num val;
|
||||
};
|
||||
template <typename T>
|
||||
struct Hex
|
||||
{
|
||||
explicit Hex(T val) : val(val) {}
|
||||
T val;
|
||||
};
|
||||
|
||||
template <typename Num> Hex<Num> hex(Num val) { return Hex<Num>(val); }
|
||||
template <typename Elem>
|
||||
struct Array
|
||||
{
|
||||
Array(const Elem* elem, const unsigned long size) : elem(elem), size(size) {}
|
||||
const Elem* elem;
|
||||
const unsigned long size;
|
||||
};
|
||||
|
||||
template <typename Elem>
|
||||
struct Array
|
||||
{
|
||||
Array(const Elem* elem, const unsigned long size) : elem(elem), size(size) {}
|
||||
const Elem* elem;
|
||||
const unsigned long size;
|
||||
};
|
||||
template <typename T>
|
||||
struct Out
|
||||
{
|
||||
explicit Out(T val) : val(val) {}
|
||||
T val;
|
||||
};
|
||||
|
||||
template <typename Elem>
|
||||
Array<Elem> array(const Elem* elem, const unsigned long size)
|
||||
{
|
||||
return Array<Elem>(elem, size);
|
||||
class LogParams;
|
||||
|
||||
class LogFirstParam
|
||||
{
|
||||
public:
|
||||
LogFirstParam(std::ostream& os) : m_os(os) {}
|
||||
template <typename T> LogParams operator<<(const T& val) { m_os << val; return LogParams(m_os); }
|
||||
|
||||
protected:
|
||||
std::ostream& m_os;
|
||||
};
|
||||
|
||||
class LogParams
|
||||
{
|
||||
public:
|
||||
LogParams(std::ostream& os) : m_os(os) {}
|
||||
template <typename T> LogParams& operator<<(const T& val) { m_os << ',' << val; return *this; }
|
||||
|
||||
operator std::ostream&() { return m_os; }
|
||||
|
||||
private:
|
||||
std::ostream& m_os;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
std::ostream& operator<<(std::ostream& os, Hex<T> hex)
|
||||
{
|
||||
os << "0x" << std::hex << hex.val << std::dec;
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename Elem>
|
||||
std::ostream& operator<<(std::ostream& os, Array<Elem> array)
|
||||
{
|
||||
os << '[';
|
||||
if (Log::isPointerDereferencingAllowed())
|
||||
{
|
||||
if (0 != array.size)
|
||||
{
|
||||
os << array.elem[0];
|
||||
}
|
||||
for (unsigned long i = 1; i < array.size; ++i)
|
||||
{
|
||||
os << ',' << array.elem[i];
|
||||
}
|
||||
}
|
||||
return os << ']';
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::ostream& operator<<(std::ostream& os, Out<T> out)
|
||||
{
|
||||
++Log::s_outParamDepth;
|
||||
os << out.val;
|
||||
--Log::s_outParamDepth;
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct Out
|
||||
template <typename T> detail::Hex<T> hex(T val)
|
||||
{
|
||||
explicit Out(const T& val) : val(val) {}
|
||||
const T& val;
|
||||
};
|
||||
return detail::Hex<T>(val);
|
||||
}
|
||||
|
||||
template <typename T> Out<T> out(const T& val) { return Out<T>(val); }
|
||||
template <typename Elem>
|
||||
detail::Array<Elem> array(const Elem* elem, const unsigned long size)
|
||||
{
|
||||
return detail::Array<Elem>(elem, size);
|
||||
}
|
||||
|
||||
template <typename T> detail::Out<T> out(const T& val)
|
||||
{
|
||||
return detail::Out<T>(val);
|
||||
}
|
||||
|
||||
class Log
|
||||
{
|
||||
@ -91,8 +164,8 @@ namespace Compat
|
||||
}
|
||||
|
||||
private:
|
||||
friend class LogLeaveGuard;
|
||||
template <typename T> friend std::ostream& operator<<(std::ostream& os, Out<T> out);
|
||||
friend class LogFunc;
|
||||
template <typename T> friend std::ostream& detail::operator<<(std::ostream& os, detail::Out<T> out);
|
||||
|
||||
void toList()
|
||||
{
|
||||
@ -111,126 +184,102 @@ namespace Compat
|
||||
toList(remainingParams...);
|
||||
}
|
||||
|
||||
ScopedCriticalSection m_lock;
|
||||
|
||||
static thread_local DWORD s_indent;
|
||||
|
||||
static std::ofstream s_logFile;
|
||||
static DWORD s_outParamDepth;
|
||||
static bool s_isLeaveLog;
|
||||
};
|
||||
|
||||
class LogParams;
|
||||
|
||||
class LogFirstParam
|
||||
class LogStruct : public detail::LogFirstParam
|
||||
{
|
||||
public:
|
||||
LogFirstParam(std::ostream& os) : m_os(os) {}
|
||||
template <typename T> LogParams operator<<(const T& val) { m_os << val; return LogParams(m_os); }
|
||||
|
||||
protected:
|
||||
std::ostream& m_os;
|
||||
};
|
||||
|
||||
class LogParams
|
||||
{
|
||||
public:
|
||||
LogParams(std::ostream& os) : m_os(os) {}
|
||||
template <typename T> LogParams& operator<<(const T& val) { m_os << ',' << val; return *this; }
|
||||
|
||||
operator std::ostream&() { return m_os; }
|
||||
|
||||
private:
|
||||
std::ostream& m_os;
|
||||
};
|
||||
|
||||
class LogStruct : public LogFirstParam
|
||||
{
|
||||
public:
|
||||
LogStruct(std::ostream& os) : LogFirstParam(os) { m_os << '{'; }
|
||||
LogStruct(std::ostream& os) : detail::LogFirstParam(os) { m_os << '{'; }
|
||||
~LogStruct() { m_os << '}'; }
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
typedef Log LogDebug;
|
||||
|
||||
class LogEnter : private Log
|
||||
class LogFunc
|
||||
{
|
||||
public:
|
||||
template <typename... Params>
|
||||
LogEnter(const char* funcName, Params... params) : Log("-->", funcName, params...)
|
||||
LogFunc(const char* funcName, Params... params)
|
||||
: m_printCall([=](Log& log) { log << funcName << '('; toList(log, params...); log << ')'; })
|
||||
{
|
||||
Log log;
|
||||
log << "> ";
|
||||
m_printCall(log);
|
||||
Log::s_indent += 2;
|
||||
}
|
||||
};
|
||||
|
||||
class LogLeaveGuard
|
||||
{
|
||||
public:
|
||||
LogLeaveGuard() { Log::s_isLeaveLog = true; }
|
||||
~LogLeaveGuard() { Log::s_isLeaveLog = false; }
|
||||
};
|
||||
~LogFunc()
|
||||
{
|
||||
Log::s_indent -= 2;
|
||||
Log log;
|
||||
log << "< ";
|
||||
m_printCall(log);
|
||||
|
||||
class LogLeave : private LogLeaveGuard, private Log
|
||||
{
|
||||
public:
|
||||
template <typename... Params>
|
||||
LogLeave(const char* funcName, Params... params) : Log("<--", funcName, params...)
|
||||
if (m_printResult)
|
||||
{
|
||||
log << " = ";
|
||||
m_printResult(log);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T setResult(T result)
|
||||
{
|
||||
m_printResult = [=](Log& log) { log << std::hex << result << std::dec; };
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
void toList(Log&)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename Result>
|
||||
void operator<<(const Result& result)
|
||||
template <typename Param>
|
||||
void toList(Log& log, Param param)
|
||||
{
|
||||
static_cast<Log&>(*this) << " = " << std::hex << result << std::dec;
|
||||
log << param;
|
||||
}
|
||||
|
||||
template <typename Param, typename... Params>
|
||||
void toList(Log& log, Param firstParam, Params... remainingParams)
|
||||
{
|
||||
log << firstParam << ", ";
|
||||
toList(log, remainingParams...);
|
||||
}
|
||||
|
||||
std::function<void(Log&)> m_printCall;
|
||||
std::function<void(Log&)> m_printResult;
|
||||
};
|
||||
#else
|
||||
class LogNull
|
||||
class LogDebug
|
||||
{
|
||||
public:
|
||||
template <typename T> LogNull& operator<<(const T&) { return *this; }
|
||||
template <typename T> LogDebug& operator<<(const T&) { return *this; }
|
||||
};
|
||||
|
||||
typedef LogNull LogDebug;
|
||||
|
||||
class LogEnter : public LogNull
|
||||
class LogFunc
|
||||
{
|
||||
public:
|
||||
template <typename... Params> LogEnter(const char*, Params...) {}
|
||||
};
|
||||
|
||||
typedef LogEnter LogLeave;
|
||||
#endif
|
||||
|
||||
template <typename Num>
|
||||
std::ostream& operator<<(std::ostream& os, Hex<Num> hex)
|
||||
{
|
||||
os << "0x" << std::hex << hex.val << std::dec;
|
||||
return os;
|
||||
}
|
||||
|
||||
template <typename Elem>
|
||||
std::ostream& operator<<(std::ostream& os, Array<Elem> array)
|
||||
{
|
||||
os << '[';
|
||||
if (Log::isPointerDereferencingAllowed())
|
||||
template <typename... Params>
|
||||
LogFunc(const char* /*funcName*/, Params...)
|
||||
{
|
||||
if (0 != array.size)
|
||||
{
|
||||
os << array.elem[0];
|
||||
}
|
||||
for (unsigned long i = 1; i < array.size; ++i)
|
||||
{
|
||||
os << ',' << array.elem[i];
|
||||
}
|
||||
}
|
||||
return os << ']';
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::ostream& operator<<(std::ostream& os, Out<T> out)
|
||||
{
|
||||
++Log::s_outParamDepth;
|
||||
os << out.val;
|
||||
--Log::s_outParamDepth;
|
||||
return os;
|
||||
}
|
||||
template <typename T>
|
||||
T setResult(T result)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -46,7 +46,7 @@ namespace
|
||||
|
||||
HRESULT APIENTRY openAdapter(D3DDDIARG_OPENADAPTER* pOpenData)
|
||||
{
|
||||
Compat::LogEnter("openAdapter", pOpenData);
|
||||
LOG_FUNC("openAdapter", pOpenData);
|
||||
D3dDdi::AdapterCallbacks::hookVtable(pOpenData->pAdapterCallbacks);
|
||||
HRESULT result = g_origOpenAdapter(pOpenData);
|
||||
if (SUCCEEDED(result))
|
||||
@ -61,8 +61,7 @@ namespace
|
||||
D3dDdi::AdapterFuncs::hookDriverVtable(pOpenData->hAdapter, pOpenData->pAdapterFuncs);
|
||||
D3dDdi::AdapterFuncs::onOpenAdapter(pOpenData->hAdapter);
|
||||
}
|
||||
Compat::LogLeave("openAdapter", pOpenData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
void unhookOpenAdapter()
|
||||
|
@ -55,31 +55,29 @@ namespace
|
||||
|
||||
NTSTATUS APIENTRY createContext(D3DKMT_CREATECONTEXT* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTCreateContext", pData);
|
||||
LOG_FUNC("D3DKMTCreateContext", pData);
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTCreateContext)(pData);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
g_contexts[pData->hContext].device = pData->hDevice;
|
||||
}
|
||||
Compat::LogLeave("D3DKMTCreateContext", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY createContextVirtual(D3DKMT_CREATECONTEXTVIRTUAL* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTCreateContextVirtual", pData);
|
||||
LOG_FUNC("D3DKMTCreateContextVirtual", pData);
|
||||
NTSTATUS result = g_origD3dKmtCreateContextVirtual(pData);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
g_contexts[pData->hContext].device = pData->hDevice;
|
||||
}
|
||||
Compat::LogLeave("D3DKMTCreateContextVirtual", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY createDcFromMemory(D3DKMT_CREATEDCFROMMEMORY* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTCreateDCFromMemory", pData);
|
||||
LOG_FUNC("D3DKMTCreateDCFromMemory", pData);
|
||||
NTSTATUS result = 0;
|
||||
if (pData && D3DDDIFMT_P8 == pData->Format && !pData->pColorTable &&
|
||||
DDraw::PrimarySurface::s_palette)
|
||||
@ -92,13 +90,12 @@ namespace
|
||||
{
|
||||
result = CALL_ORIG_FUNC(D3DKMTCreateDCFromMemory)(pData);
|
||||
}
|
||||
Compat::LogLeave("D3DKMTCreateDCFromMemory", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY createDevice(D3DKMT_CREATEDEVICE* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTCreateDevice", pData);
|
||||
LOG_FUNC("D3DKMTCreateDevice", pData);
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTCreateDevice)(pData);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
@ -108,13 +105,12 @@ namespace
|
||||
limit.QueuedPresentLimit = 2;
|
||||
CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(&limit);
|
||||
}
|
||||
Compat::LogLeave("D3DKMTCreateDevice", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY destroyContext(const D3DKMT_DESTROYCONTEXT* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTDestroyContext", pData);
|
||||
LOG_FUNC("D3DKMTDestroyContext", pData);
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTDestroyContext)(pData);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
@ -124,8 +120,7 @@ namespace
|
||||
g_lastPresentContext = 0;
|
||||
}
|
||||
}
|
||||
Compat::LogLeave("D3DKMTDestroyContext", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
AdapterInfo getAdapterInfo(const D3DKMT_OPENADAPTERFROMHDC& data)
|
||||
@ -146,20 +141,19 @@ namespace
|
||||
|
||||
NTSTATUS APIENTRY openAdapterFromHdc(D3DKMT_OPENADAPTERFROMHDC* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTOpenAdapterFromHdc", pData);
|
||||
LOG_FUNC("D3DKMTOpenAdapterFromHdc", pData);
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTOpenAdapterFromHdc)(pData);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
Compat::ScopedCriticalSection lock(g_vblankCs);
|
||||
g_lastOpenAdapterInfo = getAdapterInfo(*pData);
|
||||
}
|
||||
Compat::LogLeave("D3DKMTOpenAdapterFromHdc", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY present(D3DKMT_PRESENT* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTPresent", pData);
|
||||
LOG_FUNC("D3DKMTPresent", pData);
|
||||
|
||||
if (pData->Flags.Flip)
|
||||
{
|
||||
@ -168,8 +162,7 @@ namespace
|
||||
|
||||
if (UINT_MAX == g_flipIntervalOverride)
|
||||
{
|
||||
Compat::LogLeave("D3DKMTPresent", pData) << S_OK;
|
||||
return S_OK;
|
||||
return LOG_RESULT(S_OK);
|
||||
}
|
||||
|
||||
++g_presentCount;
|
||||
@ -183,40 +176,33 @@ namespace
|
||||
pData->FlipInterval = static_cast<D3DDDI_FLIPINTERVAL_TYPE>(g_flipIntervalOverride);
|
||||
}
|
||||
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTPresent)(pData);
|
||||
|
||||
Compat::LogLeave("D3DKMTPresent", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(D3DKMTPresent)(pData));
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY queryAdapterInfo(const D3DKMT_QUERYADAPTERINFO* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTQueryAdapterInfo", pData);
|
||||
LOG_FUNC("D3DKMTQueryAdapterInfo", pData);
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTQueryAdapterInfo)(pData);
|
||||
if (SUCCEEDED(result) && KMTQAITYPE_UMDRIVERNAME == pData->Type)
|
||||
{
|
||||
auto info = static_cast<D3DKMT_UMDFILENAMEINFO*>(pData->pPrivateDriverData);
|
||||
D3dDdi::onUmdFileNameQueried(info->UmdFileName);
|
||||
}
|
||||
Compat::LogLeave("D3DKMTQueryAdapterInfo", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
NTSTATUS APIENTRY setQueuedLimit(const D3DKMT_SETQUEUEDLIMIT* pData)
|
||||
{
|
||||
Compat::LogEnter("D3DKMTSetQueuedLimit", pData);
|
||||
LOG_FUNC("D3DKMTSetQueuedLimit", pData);
|
||||
if (D3DKMT_SET_QUEUEDLIMIT_PRESENT == pData->Type)
|
||||
{
|
||||
const UINT origLimit = pData->QueuedPresentLimit;
|
||||
const_cast<D3DKMT_SETQUEUEDLIMIT*>(pData)->QueuedPresentLimit = 2;
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData);
|
||||
const_cast<D3DKMT_SETQUEUEDLIMIT*>(pData)->QueuedPresentLimit = origLimit;
|
||||
Compat::LogLeave("D3DKMTSetQueuedLimit", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
NTSTATUS result = CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData);
|
||||
Compat::LogLeave("D3DKMTSetQueuedLimit", pData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(D3DKMTSetQueuedLimit)(pData));
|
||||
}
|
||||
|
||||
void updateGdiAdapterInfo()
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include <ddraw.h>
|
||||
|
||||
#include "Common/Hook.h"
|
||||
#include "Common/Log.h"
|
||||
#include "DDraw/ActivateAppHandler.h"
|
||||
#include "DDraw/RealPrimarySurface.h"
|
||||
#include "Gdi/Gdi.h"
|
||||
@ -25,6 +26,7 @@ namespace
|
||||
|
||||
LRESULT CALLBACK ddWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
LOG_FUNC("ddWndProc", hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam));
|
||||
static bool isDisplayChangeNotificationEnabled = true;
|
||||
|
||||
switch (uMsg)
|
||||
@ -44,7 +46,7 @@ namespace
|
||||
LRESULT result = g_origDdWndProc(hwnd, uMsg, wParam, lParam);
|
||||
isDisplayChangeNotificationEnabled = true;
|
||||
DDraw::RealPrimarySurface::enableUpdates();
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
case WM_DISPLAYCHANGE:
|
||||
@ -52,13 +54,13 @@ namespace
|
||||
// Fix for alt-tabbing in Commandos 2
|
||||
if (!isDisplayChangeNotificationEnabled)
|
||||
{
|
||||
return 0;
|
||||
return LOG_RESULT(0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return g_origDdWndProc(hwnd, uMsg, wParam, lParam);
|
||||
return LOG_RESULT(g_origDdWndProc(hwnd, uMsg, wParam, lParam));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace
|
||||
|
||||
void onRelease()
|
||||
{
|
||||
Compat::LogEnter("RealPrimarySurface::onRelease");
|
||||
LOG_FUNC("RealPrimarySurface::onRelease");
|
||||
|
||||
g_frontBuffer = nullptr;
|
||||
g_clipper.release();
|
||||
@ -297,8 +297,6 @@ namespace
|
||||
g_waitingForPrimaryUnlock = false;
|
||||
g_paletteConverter.release();
|
||||
g_surfaceDesc = {};
|
||||
|
||||
Compat::LogLeave("RealPrimarySurface::onRelease");
|
||||
}
|
||||
|
||||
void onRestore()
|
||||
@ -348,14 +346,13 @@ namespace
|
||||
|
||||
void presentToPrimaryChain(CompatWeakPtr<IDirectDrawSurface7> src)
|
||||
{
|
||||
Compat::LogEnter("RealPrimarySurface::presentToPrimaryChain", src.get());
|
||||
LOG_FUNC("RealPrimarySurface::presentToPrimaryChain", src.get());
|
||||
|
||||
Gdi::VirtualScreen::update();
|
||||
|
||||
if (!g_frontBuffer || !src || DDraw::RealPrimarySurface::isLost())
|
||||
{
|
||||
bltToWindowViaGdi(nullptr);
|
||||
Compat::LogLeave("RealPrimarySurface::presentToPrimaryChain", src.get()) << false;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -392,8 +389,6 @@ namespace
|
||||
{
|
||||
bltVisibleLayeredWindowsToBackBuffer();
|
||||
}
|
||||
|
||||
Compat::LogLeave("RealPrimarySurface::presentToPrimaryChain", src.get());
|
||||
}
|
||||
|
||||
void updateNow(CompatWeakPtr<IDirectDrawSurface7> src, UINT flipInterval)
|
||||
|
@ -31,7 +31,7 @@ namespace DDraw
|
||||
|
||||
PrimarySurface::~PrimarySurface()
|
||||
{
|
||||
Compat::LogEnter("PrimarySurface::~PrimarySurface");
|
||||
LOG_FUNC("PrimarySurface::~PrimarySurface");
|
||||
|
||||
g_gdiResourceHandle = nullptr;
|
||||
g_primarySurface = nullptr;
|
||||
@ -42,8 +42,6 @@ namespace DDraw
|
||||
ZeroMemory(&g_primarySurfaceDesc, sizeof(g_primarySurfaceDesc));
|
||||
|
||||
DDraw::RealPrimarySurface::release();
|
||||
|
||||
Compat::LogLeave("PrimarySurface::~PrimarySurface");
|
||||
}
|
||||
|
||||
template <typename TDirectDraw, typename TSurface, typename TSurfaceDesc>
|
||||
|
@ -18,7 +18,7 @@ namespace
|
||||
|
||||
HRESULT CALLBACK enumZBufferFormatsCallback(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext)
|
||||
{
|
||||
Compat::LogEnter("CompatDepthBuffer::enumZBufferFormatsCallback", lpDDPixFmt, lpContext);
|
||||
LOG_FUNC("CompatDepthBuffer::enumZBufferFormatsCallback", lpDDPixFmt, lpContext);
|
||||
if (DDPF_ZBUFFER == lpDDPixFmt->dwFlags &&
|
||||
(static_cast<uint64_t>(1) << lpDDPixFmt->dwZBufferBitDepth) - 1 == lpDDPixFmt->dwZBitMask)
|
||||
{
|
||||
@ -31,9 +31,7 @@ namespace
|
||||
case 32: supportedBitDepths |= DDBD_32; break;
|
||||
}
|
||||
}
|
||||
Compat::LogLeave("CompatDepthBuffer::enumZBufferFormatsCallback",
|
||||
lpDDPixFmt, lpContext) << D3DENUMRET_OK;
|
||||
return D3DENUMRET_OK;
|
||||
return LOG_RESULT(D3DENUMRET_OK);
|
||||
}
|
||||
|
||||
GUID getDeviceGuid(const D3DDEVICEDESC& /*desc*/)
|
||||
|
@ -166,12 +166,10 @@ extern "C" HRESULT WINAPI DirectDrawCreate(
|
||||
LPDIRECTDRAW* lplpDD,
|
||||
IUnknown* pUnkOuter)
|
||||
{
|
||||
Compat::LogEnter(__func__, lpGUID, lplpDD, pUnkOuter);
|
||||
LOG_FUNC(__func__, lpGUID, lplpDD, pUnkOuter);
|
||||
installHooks();
|
||||
DDraw::suppressEmulatedDirectDraw(lpGUID);
|
||||
HRESULT result = CALL_ORIG_PROC(DirectDrawCreate, lpGUID, lplpDD, pUnkOuter);
|
||||
Compat::LogLeave(__func__, lpGUID, lplpDD, pUnkOuter) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_PROC(DirectDrawCreate, lpGUID, lplpDD, pUnkOuter));
|
||||
}
|
||||
|
||||
extern "C" HRESULT WINAPI DirectDrawCreateEx(
|
||||
@ -180,12 +178,10 @@ extern "C" HRESULT WINAPI DirectDrawCreateEx(
|
||||
REFIID iid,
|
||||
IUnknown* pUnkOuter)
|
||||
{
|
||||
Compat::LogEnter(__func__, lpGUID, lplpDD, iid, pUnkOuter);
|
||||
LOG_FUNC(__func__, lpGUID, lplpDD, iid, pUnkOuter);
|
||||
installHooks();
|
||||
DDraw::suppressEmulatedDirectDraw(lpGUID);
|
||||
HRESULT result = CALL_ORIG_PROC(DirectDrawCreateEx, lpGUID, lplpDD, iid, pUnkOuter);
|
||||
Compat::LogLeave(__func__, lpGUID, lplpDD, iid, pUnkOuter) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_PROC(DirectDrawCreateEx, lpGUID, lplpDD, iid, pUnkOuter));
|
||||
}
|
||||
|
||||
extern "C" HRESULT WINAPI DirectInputCreateA(
|
||||
@ -194,18 +190,14 @@ extern "C" HRESULT WINAPI DirectInputCreateA(
|
||||
IDirectInput** lplpDirectInput,
|
||||
LPUNKNOWN punkOuter)
|
||||
{
|
||||
Compat::LogEnter(__func__, hinst, dwVersion, lplpDirectInput, punkOuter);
|
||||
HRESULT result = CALL_ORIG_PROC(DirectInputCreateA, hinst, dwVersion, lplpDirectInput, punkOuter);
|
||||
Compat::LogLeave(__func__, hinst, dwVersion, lplpDirectInput, punkOuter) << result;
|
||||
return result;
|
||||
LOG_FUNC(__func__, hinst, dwVersion, lplpDirectInput, punkOuter);
|
||||
return LOG_RESULT(CALL_ORIG_PROC(DirectInputCreateA, hinst, dwVersion, lplpDirectInput, punkOuter));
|
||||
}
|
||||
|
||||
extern "C" HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
Compat::LogEnter(__func__, rclsid, riid, ppv);
|
||||
LOG_FUNC(__func__, rclsid, riid, ppv);
|
||||
LOG_ONCE("COM instantiation of DirectDraw detected");
|
||||
installHooks();
|
||||
HRESULT result = CALL_ORIG_PROC(DllGetClassObject, rclsid, riid, ppv);
|
||||
Compat::LogLeave(__func__, rclsid, riid, ppv) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_PROC(DllGetClassObject, rclsid, riid, ppv));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace
|
||||
|
||||
void beginAccess(Gdi::User user, Gdi::Access access)
|
||||
{
|
||||
Compat::LogEnter("beginAccess", user, access);
|
||||
LOG_FUNC("beginAccess", user, access);
|
||||
|
||||
Accessor& accessor = Gdi::USER_DDRAW == user ? g_ddrawAccessor : g_gdiAccessor;
|
||||
DWORD& accessDepth = Gdi::ACCESS_READ == access ? accessor.readAccessDepth : accessor.writeAccessDepth;
|
||||
@ -41,12 +41,12 @@ namespace
|
||||
otherAccessor.isSynced = false;
|
||||
}
|
||||
|
||||
Compat::LogLeave("beginAccess", user, access) << accessor.isSynced;
|
||||
LOG_RESULT(accessor.isSynced);
|
||||
}
|
||||
|
||||
void endAccess(Gdi::User user, Gdi::Access access)
|
||||
{
|
||||
Compat::LogEnter("endAccess", user, access);
|
||||
LOG_FUNC("endAccess", user, access);
|
||||
|
||||
Accessor& accessor = Gdi::USER_DDRAW == user ? g_ddrawAccessor : g_gdiAccessor;
|
||||
DWORD& accessDepth = Gdi::ACCESS_READ == access ? accessor.readAccessDepth : accessor.writeAccessDepth;
|
||||
@ -72,8 +72,6 @@ namespace
|
||||
DDraw::RealPrimarySurface::update();
|
||||
}
|
||||
}
|
||||
|
||||
Compat::LogLeave("endAccess", user, access);
|
||||
}
|
||||
|
||||
bool synchronize(Gdi::User user)
|
||||
|
@ -98,35 +98,27 @@ namespace
|
||||
Result WINAPI compatGdiDcFunc(Params... params)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Compat::LogEnter(g_funcNames[origFunc], params...);
|
||||
LOG_FUNC(g_funcNames[origFunc], params...);
|
||||
#else
|
||||
LOG_FUNC("", params...);
|
||||
#endif
|
||||
|
||||
Result result = 0;
|
||||
if (hasDisplayDcArg(params...))
|
||||
{
|
||||
const bool isReadOnlyAccess = !hasDisplayDcArg(getDestinationDc<OrigFuncPtr, origFunc>(params...));
|
||||
Gdi::GdiAccessGuard accessGuard(isReadOnlyAccess ? Gdi::ACCESS_READ : Gdi::ACCESS_WRITE);
|
||||
result = Compat::getOrigFuncPtr<OrigFuncPtr, origFunc>()(replaceDc(params)...);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = Compat::getOrigFuncPtr<OrigFuncPtr, origFunc>()(params...);
|
||||
return LOG_RESULT(Compat::getOrigFuncPtr<OrigFuncPtr, origFunc>()(replaceDc(params)...));
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
Compat::LogLeave(g_funcNames[origFunc], params...) << result;
|
||||
#endif
|
||||
|
||||
return result;
|
||||
return LOG_RESULT(Compat::getOrigFuncPtr<OrigFuncPtr, origFunc>()(params...));
|
||||
}
|
||||
|
||||
template <>
|
||||
BOOL WINAPI compatGdiDcFunc<decltype(&ExtTextOutW), &ExtTextOutW>(
|
||||
HDC hdc, int x, int y, UINT options, const RECT* lprect, LPCWSTR lpString, UINT c, const INT* lpDx)
|
||||
{
|
||||
Compat::LogEnter("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx);
|
||||
LOG_FUNC("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx);
|
||||
|
||||
BOOL result = TRUE;
|
||||
if (hasDisplayDcArg(hdc))
|
||||
{
|
||||
HWND hwnd = CALL_ORIG_FUNC(WindowFromDC)(hdc);
|
||||
@ -150,16 +142,15 @@ namespace
|
||||
else
|
||||
{
|
||||
Gdi::GdiAccessGuard accessGuard(Gdi::ACCESS_WRITE);
|
||||
result = CALL_ORIG_FUNC(ExtTextOutW)(replaceDc(hdc), x, y, options, lprect, lpString, c, lpDx);
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(ExtTextOutW)(replaceDc(hdc), x, y, options, lprect, lpString, c, lpDx));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = CALL_ORIG_FUNC(ExtTextOutW)(hdc, x, y, options, lprect, lpString, c, lpDx);
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(ExtTextOutW)(hdc, x, y, options, lprect, lpString, c, lpDx));
|
||||
}
|
||||
|
||||
Compat::LogLeave("ExtTextOutW", hdc, x, y, options, lprect, lpString, c, lpDx) << result;
|
||||
return result;
|
||||
return LOG_RESULT(TRUE);
|
||||
}
|
||||
|
||||
BOOL CALLBACK excludeRgnForOverlappingWindow(HWND hwnd, LPARAM lParam)
|
||||
|
@ -121,10 +121,8 @@ namespace
|
||||
LRESULT defPaintProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, WNDPROC origWndProc,
|
||||
const char* origWndProcName)
|
||||
{
|
||||
Compat::LogEnter(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam));
|
||||
LRESULT result = defPaintProc(hwnd, msg, wParam, lParam, origWndProc);
|
||||
Compat::LogLeave(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam)) << result;
|
||||
return result;
|
||||
LOG_FUNC(origWndProcName, hwnd, Compat::hex(msg), Compat::hex(wParam), Compat::hex(lParam));
|
||||
return LOG_RESULT(defPaintProc(hwnd, msg, wParam, lParam, origWndProc));
|
||||
}
|
||||
|
||||
LRESULT WINAPI defWindowProcA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
@ -378,12 +376,8 @@ namespace
|
||||
LRESULT CALLBACK user32WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
|
||||
const User32WndProc& user32WndProc, WndProcHook wndProcHook)
|
||||
{
|
||||
Compat::LogEnter(user32WndProc.name.c_str(),
|
||||
hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam));
|
||||
LRESULT result = wndProcHook(hwnd, uMsg, wParam, lParam, user32WndProc.oldWndProcTrampoline);
|
||||
Compat::LogLeave(user32WndProc.name.c_str(),
|
||||
hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam)) << result;
|
||||
return result;
|
||||
LOG_FUNC(user32WndProc.name.c_str(), hwnd, Compat::hex(uMsg), Compat::hex(wParam), Compat::hex(lParam));
|
||||
return LOG_RESULT(wndProcHook(hwnd, uMsg, wParam, lParam, user32WndProc.oldWndProcTrampoline));
|
||||
}
|
||||
|
||||
template <int index>
|
||||
|
@ -10,21 +10,19 @@ namespace
|
||||
BOOL WINAPI scrollWindow(HWND hWnd, int XAmount, int YAmount,
|
||||
const RECT* lpRect, const RECT* lpClipRect)
|
||||
{
|
||||
Compat::LogEnter("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect);
|
||||
LOG_FUNC("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect);
|
||||
BOOL result = CALL_ORIG_FUNC(ScrollWindow)(hWnd, XAmount, YAmount, lpRect, lpClipRect);
|
||||
if (result)
|
||||
{
|
||||
Gdi::ScrollFunctions::updateScrolledWindow(hWnd);
|
||||
}
|
||||
Compat::LogLeave("scrollWindow", hWnd, XAmount, YAmount, lpRect, lpClipRect) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
int WINAPI scrollWindowEx(HWND hWnd, int dx, int dy, const RECT* prcScroll, const RECT* prcClip,
|
||||
HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags)
|
||||
{
|
||||
Compat::LogEnter("scrollWindowEx",
|
||||
hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags);
|
||||
LOG_FUNC("scrollWindowEx", hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags);
|
||||
|
||||
if (flags & SW_SMOOTHSCROLL)
|
||||
{
|
||||
@ -38,9 +36,7 @@ namespace
|
||||
Gdi::ScrollFunctions::updateScrolledWindow(hWnd);
|
||||
}
|
||||
|
||||
Compat::LogLeave("scrollWindowEx",
|
||||
hWnd, dx, dy, prcScroll, prcClip, hrgnUpdate, prcUpdate, flags) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,15 +173,14 @@ namespace Gdi
|
||||
|
||||
bool update()
|
||||
{
|
||||
Compat::LogEnter("VirtualScreen::update");
|
||||
LOG_FUNC("VirtualScreen::update");
|
||||
DDraw::ScopedThreadLock lock;
|
||||
|
||||
static auto prevDisplaySettingsUniqueness = Win32::DisplayMode::queryDisplaySettingsUniqueness() - 1;
|
||||
const auto currentDisplaySettingsUniqueness = Win32::DisplayMode::queryDisplaySettingsUniqueness();
|
||||
if (currentDisplaySettingsUniqueness == prevDisplaySettingsUniqueness)
|
||||
{
|
||||
Compat::LogLeave("VirtualScreen::update") << false;
|
||||
return false;
|
||||
return LOG_RESULT(false);
|
||||
}
|
||||
|
||||
prevDisplaySettingsUniqueness = currentDisplaySettingsUniqueness;
|
||||
@ -215,9 +214,7 @@ namespace Gdi
|
||||
}
|
||||
|
||||
Gdi::redraw(nullptr);
|
||||
|
||||
Compat::LogLeave("VirtualScreen::update") << true;
|
||||
return true;
|
||||
return LOG_RESULT(true);
|
||||
}
|
||||
|
||||
void updatePalette()
|
||||
|
@ -37,7 +37,7 @@ namespace
|
||||
LRESULT CALLBACK callWndRetProc(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
auto ret = reinterpret_cast<CWPRETSTRUCT*>(lParam);
|
||||
Compat::LogEnter("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret);
|
||||
LOG_FUNC("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret);
|
||||
|
||||
if (HC_ACTION == nCode && !Gdi::Window::isPresentationWindow(ret->hwnd))
|
||||
{
|
||||
@ -63,9 +63,7 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT result = CallNextHookEx(nullptr, nCode, wParam, lParam);
|
||||
Compat::LogLeave("callWndRetProc", Compat::hex(nCode), Compat::hex(wParam), ret) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CallNextHookEx(nullptr, nCode, wParam, lParam));
|
||||
}
|
||||
|
||||
void disableDwmAttributes(HWND hwnd)
|
||||
|
@ -105,25 +105,21 @@ namespace
|
||||
LONG WINAPI changeDisplaySettingsExA(
|
||||
LPCSTR lpszDeviceName, DEVMODEA* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
|
||||
{
|
||||
Compat::LogEnter("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
LONG result = changeDisplaySettingsEx(
|
||||
LOG_FUNC("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
return LOG_RESULT(changeDisplaySettingsEx(
|
||||
CALL_ORIG_FUNC(ChangeDisplaySettingsExA),
|
||||
CALL_ORIG_FUNC(EnumDisplaySettingsExA),
|
||||
lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
Compat::LogLeave("ChangeDisplaySettingsExA", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam) << result;
|
||||
return result;
|
||||
lpszDeviceName, lpDevMode, hwnd, dwflags, lParam));
|
||||
}
|
||||
|
||||
LONG WINAPI changeDisplaySettingsExW(
|
||||
LPCWSTR lpszDeviceName, DEVMODEW* lpDevMode, HWND hwnd, DWORD dwflags, LPVOID lParam)
|
||||
{
|
||||
Compat::LogEnter("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
LONG result = changeDisplaySettingsEx(
|
||||
LOG_FUNC("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
return LOG_RESULT(changeDisplaySettingsEx(
|
||||
CALL_ORIG_FUNC(ChangeDisplaySettingsExW),
|
||||
CALL_ORIG_FUNC(EnumDisplaySettingsExW),
|
||||
lpszDeviceName, lpDevMode, hwnd, dwflags, lParam);
|
||||
Compat::LogLeave("ChangeDisplaySettingsExW", lpszDeviceName, lpDevMode, hwnd, dwflags, lParam) << result;
|
||||
return result;
|
||||
lpszDeviceName, lpDevMode, hwnd, dwflags, lParam));
|
||||
}
|
||||
|
||||
template <typename CStr, typename DevMode, typename ChangeDisplaySettingsExFunc>
|
||||
@ -271,35 +267,28 @@ namespace
|
||||
BOOL WINAPI enumDisplaySettingsExA(
|
||||
LPCSTR lpszDeviceName, DWORD iModeNum, DEVMODEA* lpDevMode, DWORD dwFlags)
|
||||
{
|
||||
Compat::LogEnter("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
BOOL result = enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExA),
|
||||
lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
Compat::LogLeave("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags) << result;
|
||||
return result;
|
||||
LOG_FUNC("EnumDisplaySettingsExA", lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
return LOG_RESULT(enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExA),
|
||||
lpszDeviceName, iModeNum, lpDevMode, dwFlags));
|
||||
}
|
||||
|
||||
BOOL WINAPI enumDisplaySettingsExW(
|
||||
LPCWSTR lpszDeviceName, DWORD iModeNum, DEVMODEW* lpDevMode, DWORD dwFlags)
|
||||
{
|
||||
Compat::LogEnter("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
BOOL result = enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExW),
|
||||
lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
Compat::LogLeave("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags) << result;
|
||||
return result;
|
||||
LOG_FUNC("EnumDisplaySettingsExW", lpszDeviceName, iModeNum, lpDevMode, dwFlags);
|
||||
return LOG_RESULT(enumDisplaySettingsEx(CALL_ORIG_FUNC(EnumDisplaySettingsExW),
|
||||
lpszDeviceName, iModeNum, lpDevMode, dwFlags));
|
||||
}
|
||||
|
||||
int WINAPI getDeviceCaps(HDC hdc, int nIndex)
|
||||
{
|
||||
Compat::LogEnter("GetDeviceCaps", hdc, nIndex);
|
||||
LOG_FUNC("GetDeviceCaps", hdc, nIndex);
|
||||
if (hdc && BITSPIXEL == nIndex &&
|
||||
DT_RASDISPLAY == GetDeviceCaps(hdc, TECHNOLOGY) && OBJ_DC == GetObjectType(hdc))
|
||||
{
|
||||
Compat::LogLeave("GetDeviceCaps", hdc, nIndex) << g_currentBpp;
|
||||
return g_currentBpp;
|
||||
return LOG_RESULT(g_currentBpp);
|
||||
}
|
||||
int result = CALL_ORIG_FUNC(GetDeviceCaps)(hdc, nIndex);
|
||||
Compat::LogLeave("GetDeviceCaps", hdc, nIndex) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(GetDeviceCaps)(hdc, nIndex));
|
||||
}
|
||||
|
||||
void releaseCompatibleDc()
|
||||
@ -340,31 +329,24 @@ namespace Win32
|
||||
{
|
||||
HBITMAP WINAPI createCompatibleBitmap(HDC hdc, int cx, int cy)
|
||||
{
|
||||
Compat::LogEnter("CreateCompatibleBitmap", hdc, cx, cy);
|
||||
LOG_FUNC("CreateCompatibleBitmap", hdc, cx, cy);
|
||||
replaceDc(hdc);
|
||||
HBITMAP result = CALL_ORIG_FUNC(CreateCompatibleBitmap)(hdc, cx, cy);
|
||||
Compat::LogLeave("CreateCompatibleBitmap", hdc, cx, cy) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(CreateCompatibleBitmap)(hdc, cx, cy));
|
||||
}
|
||||
|
||||
HBITMAP WINAPI createDIBitmap(HDC hdc, const BITMAPINFOHEADER* lpbmih, DWORD fdwInit,
|
||||
const void* lpbInit, const BITMAPINFO* lpbmi, UINT fuUsage)
|
||||
{
|
||||
Compat::LogEnter("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
|
||||
LOG_FUNC("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
|
||||
replaceDc(hdc);
|
||||
HBITMAP result = CALL_ORIG_FUNC(CreateDIBitmap)(hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage);
|
||||
Compat::LogLeave("CreateDIBitmap", hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage)
|
||||
<< result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(CreateDIBitmap)(hdc, lpbmih, fdwInit, lpbInit, lpbmi, fuUsage));
|
||||
}
|
||||
|
||||
HBITMAP WINAPI createDiscardableBitmap(HDC hdc, int nWidth, int nHeight)
|
||||
{
|
||||
Compat::LogEnter("CreateDiscardableBitmap", hdc, nWidth, nHeight);
|
||||
LOG_FUNC("CreateDiscardableBitmap", hdc, nWidth, nHeight);
|
||||
replaceDc(hdc);
|
||||
HBITMAP result = CALL_ORIG_FUNC(createDiscardableBitmap)(hdc, nWidth, nHeight);
|
||||
Compat::LogLeave("CreateDiscardableBitmap", hdc, nWidth, nHeight) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(createDiscardableBitmap)(hdc, nWidth, nHeight));
|
||||
}
|
||||
|
||||
DWORD getBpp()
|
||||
|
@ -91,7 +91,7 @@ namespace
|
||||
LONG WINAPI regGetValueW(HKEY hkey, LPCWSTR lpSubKey, LPCWSTR lpValue,
|
||||
DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
|
||||
{
|
||||
Compat::LogEnter("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
|
||||
LOG_FUNC("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
|
||||
LONG result = ERROR_SUCCESS;
|
||||
|
||||
const auto it = hkey && lpSubKey && lpValue && (dwFlags & RRF_RT_REG_DWORD)
|
||||
@ -131,15 +131,13 @@ namespace
|
||||
result = CALL_ORIG_FUNC(RegGetValueW)(hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData);
|
||||
}
|
||||
|
||||
Compat::LogLeave("regGetValueW", hkey, lpSubKey, lpValue, dwFlags, pdwType, pvData, pcbData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(result);
|
||||
}
|
||||
|
||||
LONG WINAPI regQueryValueExA(HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType,
|
||||
LPBYTE lpData, LPDWORD lpcbData)
|
||||
{
|
||||
Compat::LogEnter("regQueryValueExA", hKey, lpValueName, lpReserved, lpType,
|
||||
static_cast<void*>(lpData), lpcbData);
|
||||
LOG_FUNC("regQueryValueExA", hKey, lpValueName, lpReserved, lpType, static_cast<void*>(lpData), lpcbData);
|
||||
|
||||
if (hKey && lpValueName)
|
||||
{
|
||||
@ -153,17 +151,12 @@ namespace
|
||||
keyName.substr(localMachinePrefix.size()), oss.str()));
|
||||
if (it != g_unsetValues.end())
|
||||
{
|
||||
return ERROR_FILE_NOT_FOUND;
|
||||
return LOG_RESULT(ERROR_FILE_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LONG result = CALL_ORIG_FUNC(RegQueryValueExA)(hKey, lpValueName, lpReserved, lpType,
|
||||
lpData, lpcbData);
|
||||
|
||||
Compat::LogLeave("regQueryValueExA", hKey, lpValueName, lpReserved, lpType,
|
||||
static_cast<void*>(lpData), lpcbData) << result;
|
||||
return result;
|
||||
return LOG_RESULT(CALL_ORIG_FUNC(RegQueryValueExA)(hKey, lpValueName, lpReserved, lpType, lpData, lpcbData));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user