remove unneeded abstraction

This commit is contained in:
Akash Mozumdar 2018-05-20 16:26:26 -04:00
parent 05fa52f589
commit 65ec2d5be0
5 changed files with 21 additions and 52 deletions

View File

@ -1 +0,0 @@
.bak

View File

@ -59,8 +59,6 @@ set(vnrhook_src
${PROJECT_SOURCE_DIR}/memdbg/memsearch.h
${PROJECT_SOURCE_DIR}/ntinspect/ntinspect.cc
${PROJECT_SOURCE_DIR}/ntinspect/ntinspect.h
${PROJECT_SOURCE_DIR}/winversion/winversion.cc
${PROJECT_SOURCE_DIR}/winversion/winversion.h
${PROJECT_SOURCE_DIR}/mono/monoobject.h
${PROJECT_SOURCE_DIR}/mono/monotype.h
)

View File

@ -19,7 +19,6 @@
#include "memdbg/memsearch.h"
#include "ntinspect/ntinspect.h"
#include "disasm/disasm.h"
#include "winversion/winversion.h"
#include "hashutil/hashstr.h"
#include "cpputil/cppcstring.h"
#include "ccutil/ccmacro.h"
@ -16633,8 +16632,27 @@ bool InsertPPSSPPHooks()
ConsoleOutput("vnreng: PPSSPP: enter");
//if (!WinVersion::queryFileVersion(process_path_, PPSSPP_VERSION))
// ConsoleOutput("vnreng: failed to get PPSSPP version");
// http://stackoverflow.com/questions/940707/how-do-i-programatically-get-the-version-of-a-dll-or-exe-file
// get the version info for the file requested
if (DWORD dwSize = ::GetFileVersionInfoSizeW(process_path_, nullptr)) {
UINT len = 0;
BYTE * buf = new BYTE[dwSize];
VS_FIXEDFILEINFO * info = nullptr;
if (::GetFileVersionInfoW(process_path_, 0, dwSize, buf)
&& ::VerQueryValueW(buf, L"\\", (LPVOID*)&info, &len)
&& info)
{
PPSSPP_VERSION[0] = HIWORD(info->dwFileVersionMS),
PPSSPP_VERSION[1] = LOWORD(info->dwFileVersionMS),
PPSSPP_VERSION[2] = HIWORD(info->dwFileVersionLS),
PPSSPP_VERSION[3] = LOWORD(info->dwFileVersionLS);
}
else
ConsoleOutput("vnreng: failed to get PPSSPP version");
delete[] buf;
}
InsertPPSSPPHLEHooks();

View File

@ -1,30 +0,0 @@
// winversion.cc
// 9/5/2014 jichi
#include "winversion/winversion.h"
#include <windows.h>
// http://stackoverflow.com/questions/940707/how-do-i-programatically-get-the-version-of-a-dll-or-exe-file
bool WinVersion::queryFileVersion(const wchar_t *path, int ver[])
{
bool ok = false;
// get the version info for the file requested
if (DWORD dwSize = ::GetFileVersionInfoSizeW(path, nullptr)) {
UINT len = 0;
BYTE *buf = new BYTE[dwSize];
VS_FIXEDFILEINFO *info = nullptr;
ok = ::GetFileVersionInfoW(path, 0, dwSize, buf)
&& ::VerQueryValueW(buf, L"\\", (LPVOID*)&info, &len)
&& info;
if (ok) {
ver[0] = HIWORD(info->dwFileVersionMS),
ver[1] = LOWORD(info->dwFileVersionMS),
ver[2] = HIWORD(info->dwFileVersionLS),
ver[3] = LOWORD(info->dwFileVersionLS);
}
delete[] buf;
}
return ok;
}
// EOF

View File

@ -1,16 +0,0 @@
#pragma once
// winversion.h
// 9/5/2014 jichi
#ifdef _MSC_VER
# include <cstddef> // for wchar_t
#endif // _MSC_VER
namespace WinVersion {
bool queryFileVersion(const wchar_t *path, int ver[4]);
} // namespace WinVersion
// EOF