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