2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-27 22:17:54 +03:00

Fixed compilation in MSVC 2017 (fixed #3)

This commit is contained in:
asmodai 2017-03-11 17:39:04 +03:00
parent f3e0772b12
commit 3674c3e946
5 changed files with 9 additions and 9 deletions

View File

@ -3,7 +3,7 @@
#define MM_PRE_HOOK
#define MM_POST_HOOK
enum
enum : uint8
{
P_PRE, // plugin function called before gamedll
P_POST, // plugin function called after gamedll

View File

@ -7,7 +7,7 @@ class CUniqueLabel
public:
CUniqueLabel(const char* name) : m_name(name)
{
m_name += m_unique_index++;
m_name += std::to_string(m_unique_index++);
}
operator std::string&()
@ -357,7 +357,7 @@ bool CJit::is_hook_needed(jitdata_t* jitdata)
if (!jitdata->plugins)
return false;
for (int i = 0, hookid = 0; i < jitdata->plugins_count; i++) {
for (int i = 0; i < jitdata->plugins_count; i++) {
auto plug = &jitdata->plugins[i];
const size_t fn_table = *(size_t *)(size_t(plug) + jitdata->table_offset);

View File

@ -1,6 +1,6 @@
#pragma once
#define CDATA_ENTRY(s, x, p, h) {#x, offsetof(s, x), getArgsCount(decltype(s##::##x)()), !is_void(decltype(s##::##x)()), is_varargs(decltype(s##::##x)()), p, h}
#define CDATA_ENTRY(s, x, p, h) {#x, offsetof(s, x), (uint8)getArgsCount(decltype(s##::##x)()), !is_void(decltype(s##::##x)()), is_varargs(decltype(s##::##x)()), p, h}
struct jitdata_t
{

View File

@ -2,7 +2,7 @@
#define CDATA_DLL_H(x, p, h) CDATA_ENTRY(DLL_FUNCTIONS, x, p, size_t(h))
#define CDATA_DLL(x) CDATA_ENTRY(DLL_FUNCTIONS, x, P_PRE, 0u)
#define CDATA_NEWDLL_H(x, p, h) CDATA_ENTRY(NEW_DLL_FUNCTIONS, x, p, size_t(h))
#define CDATA_NEWDLL_H(x, p, h) CDATA_ENTRY(NEW_DLL_FUNCTIONS, x, p, uint8(h))
#define CDATA_NEWDLL(x) CDATA_ENTRY(NEW_DLL_FUNCTIONS, x, P_PRE, 0u)
DLL_FUNCTIONS sFunctionTable;

View File

@ -344,7 +344,7 @@ namespace detail
JITASM_ASSERT(opd.IsReg() && (opd.opdtype_ & O_TYPE_TYPE_MASK) == (constraint.opdtype_ & O_TYPE_TYPE_MASK) && !constraint.GetReg().IsSymbolic());
Opd o(opd);
o.opdtype_ = static_cast<OpdType>(static_cast<int>(o.opdtype_) | O_TYPE_DUMMY);
o.reg_assignable_ = (1 << constraint.reg_.id);
o.reg_assignable_ = uint32(1 << constraint.reg_.id);
return o;
}
@ -910,9 +910,9 @@ struct Backend
void dd(uint64 d) {put_bytes(&d, 4);}
void dq(uint64 q) {put_bytes(&q, 8);}
uint8 GetWRXB(int w, const detail::Opd& reg, const detail::Opd& r_m)
uint8 GetWRXB(unsigned int w, const detail::Opd& reg, const detail::Opd& r_m)
{
uint8 wrxb = w ? 8 : 0;
uint8 wrxb = uint8(w ? 8 : 0);
if (reg.IsReg()) {
if (!reg.GetReg().IsInvalid() && reg.GetReg().id >= R8) wrxb |= 4;
}
@ -933,7 +933,7 @@ struct Backend
#ifdef JITASM64
if (r_m.IsMem() && r_m.GetAddressSize() != O_SIZE_64) db(0x67);
#endif
uint8 vvvv = vex.IsReg() ? 0xF - (uint8) vex.GetReg().id : 0xF;
uint8 vvvv = uint8(vex.IsReg() ? 0xF - (uint8) vex.GetReg().id : 0xF);
uint8 mmmmm = (flag & E_VEX_MMMMM_MASK) >> E_VEX_MMMMM_SHIFT;
uint8 pp = static_cast<uint8>((flag & E_VEX_PP_MASK) >> E_VEX_PP_SHIFT);
uint8 wrxb = GetWRXB(flag & E_VEX_W, reg, r_m);