mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Run code through the advanced tool 'sed' to remove trailing whitespace.
This commit is contained in:
@ -34,7 +34,7 @@ char *GetCPUString()
|
||||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
@ -43,7 +43,7 @@ char *GetCPUString()
|
||||
cpu_string = strndup(cpu_string, strlen(cpu_string) - 1); // Strip the newline
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return cpu_string;
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ bool CheckCPUFeature(const char *feature)
|
||||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
@ -120,11 +120,11 @@ bool CheckCPUFeature(const char *feature)
|
||||
while (token != NULL)
|
||||
{
|
||||
if (strstr(token, feature))
|
||||
return true;
|
||||
return true;
|
||||
token = strtok(NULL, " ");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@ -144,14 +144,14 @@ int GetCoreCount()
|
||||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
continue;
|
||||
++cores;
|
||||
}
|
||||
|
||||
|
||||
return cores;
|
||||
#endif
|
||||
}
|
||||
@ -170,10 +170,10 @@ void CPUInfo::Detect()
|
||||
HTT = false;
|
||||
OS64bit = false;
|
||||
CPU64bit = false;
|
||||
Mode64bit = false;
|
||||
Mode64bit = false;
|
||||
vendor = VENDOR_ARM;
|
||||
|
||||
// Get the information about the CPU
|
||||
|
||||
// Get the information about the CPU
|
||||
num_cores = GetCoreCount();
|
||||
#if defined(__SYMBIAN32__) || defined(BLACKBERRY) || defined(IOS)
|
||||
bool isVFP3 = false;
|
||||
|
@ -104,7 +104,7 @@ bool ARMXEmitter::TrySetValue_TwoOp(ARMReg reg, u32 val)
|
||||
}
|
||||
if (ops > 2)
|
||||
return false;
|
||||
|
||||
|
||||
bool first = true;
|
||||
for (int i = 0; i < 16; i++, val >>=2) {
|
||||
if (val & 0x3) {
|
||||
@ -418,7 +418,7 @@ void ARMXEmitter::SetJumpTarget(FixupBranch const &branch)
|
||||
branch.ptr);
|
||||
if(branch.type == 0) // B
|
||||
*(u32*)branch.ptr = (u32)(branch.condition | (10 << 24) | ((distance >> 2) &
|
||||
0x00FFFFFF));
|
||||
0x00FFFFFF));
|
||||
else // BL
|
||||
*(u32*)branch.ptr = (u32)(branch.condition | 0x0B000000 | ((distance >> 2)
|
||||
& 0x00FFFFFF));
|
||||
@ -497,7 +497,7 @@ void ARMXEmitter::WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg
|
||||
Write32(condition | (13 << 21) | (SetFlags << 20) | (dest << 12) | op2.Imm5() | (op << 4) | src);
|
||||
}
|
||||
|
||||
// IMM, REG, IMMSREG, RSR
|
||||
// IMM, REG, IMMSREG, RSR
|
||||
// -1 for invalid if the instruction doesn't support that
|
||||
const s32 InstOps[][4] = {{16, 0, 0, 0}, // AND(s)
|
||||
{17, 1, 1, 1}, // EOR(s)
|
||||
@ -517,7 +517,7 @@ const s32 InstOps[][4] = {{16, 0, 0, 0}, // AND(s)
|
||||
{31, 15, 15, 15}, // MVN(s)
|
||||
{24, -1, -1, -1}, // MOVW
|
||||
{26, -1, -1, -1}, // MOVT
|
||||
};
|
||||
};
|
||||
|
||||
const char *InstNames[] = { "AND",
|
||||
"EOR",
|
||||
@ -586,7 +586,7 @@ void ARMXEmitter::WriteInstruction (u32 Op, ARMReg Rd, ARMReg Rn, Operand2 Rm, b
|
||||
}
|
||||
}
|
||||
if (op == -1)
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s not yet support %d", InstNames[Op], Rm.GetType());
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s not yet support %d", InstNames[Op], Rm.GetType());
|
||||
Write32(condition | (op << 21) | (SetFlags ? (1 << 20) : 0) | Rn << 16 | Rd << 12 | Data);
|
||||
}
|
||||
|
||||
@ -678,7 +678,7 @@ void ARMXEmitter::SXTH (ARMReg dest, ARMReg op2, u8 rotation)
|
||||
{
|
||||
SXTAH(dest, (ARMReg)15, op2, rotation);
|
||||
}
|
||||
void ARMXEmitter::SXTAH(ARMReg dest, ARMReg src, ARMReg op2, u8 rotation)
|
||||
void ARMXEmitter::SXTAH(ARMReg dest, ARMReg src, ARMReg op2, u8 rotation)
|
||||
{
|
||||
// bits ten and 11 are the rotation amount, see 8.8.232 for more
|
||||
// information
|
||||
@ -688,7 +688,7 @@ void ARMXEmitter::RBIT(ARMReg dest, ARMReg src)
|
||||
{
|
||||
Write32(condition | (0x6F << 20) | (0xF << 16) | (dest << 12) | (0xF3 << 4) | src);
|
||||
}
|
||||
void ARMXEmitter::REV (ARMReg dest, ARMReg src)
|
||||
void ARMXEmitter::REV (ARMReg dest, ARMReg src)
|
||||
{
|
||||
Write32(condition | (0x6BF << 16) | (dest << 12) | (0xF3 << 4) | src);
|
||||
}
|
||||
@ -768,7 +768,7 @@ void ARMXEmitter::WriteStoreOp(u32 Op, ARMReg Rt, ARMReg Rn, Operand2 Rm, bool R
|
||||
bool SignedLoad = false;
|
||||
|
||||
if (op == -1)
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %d", LoadStoreNames[Op], Rm.GetType());
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %d", LoadStoreNames[Op], Rm.GetType());
|
||||
|
||||
switch (Op)
|
||||
{
|
||||
@ -910,7 +910,7 @@ u32 EncodeVn(ARMReg Vn)
|
||||
{
|
||||
bool quad_reg = Vn >= Q0;
|
||||
bool double_reg = Vn >= D0;
|
||||
|
||||
|
||||
ARMReg Reg = SubBase(Vn);
|
||||
if (quad_reg)
|
||||
return ((Reg & 0xF) << 16) | ((Reg & 0x10) << 3);
|
||||
@ -980,7 +980,7 @@ void ARMXEmitter::WriteVFPDataOp(u32 Op, ARMReg Vd, ARMReg Vn, ARMReg Vm)
|
||||
|
||||
VFPEnc enc = VFPOps[Op][quad_reg];
|
||||
if (enc.opc1 == -1 && enc.opc2 == -1)
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %s", VFPOpNames[Op], quad_reg ? "NEON" : "VFP");
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %s", VFPOpNames[Op], quad_reg ? "NEON" : "VFP");
|
||||
u32 VdEnc = EncodeVd(Vd);
|
||||
u32 VnEnc = EncodeVn(Vn);
|
||||
u32 VmEnc = EncodeVm(Vm);
|
||||
@ -995,7 +995,7 @@ void ARMXEmitter::WriteVFPDataOp6bit(u32 Op, ARMReg Vd, ARMReg Vn, ARMReg Vm, u3
|
||||
|
||||
VFPEnc enc = VFPOps[Op][quad_reg];
|
||||
if (enc.opc1 == -1 && enc.opc2 == -1)
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %s", VFPOpNames[Op], quad_reg ? "NEON" : "VFP");
|
||||
_dbg_assert_msg_(DYNA_REC, false, "%s does not support %s", VFPOpNames[Op], quad_reg ? "NEON" : "VFP");
|
||||
u32 VdEnc = EncodeVd(Vd);
|
||||
u32 VnEnc = EncodeVn(Vn);
|
||||
u32 VmEnc = EncodeVm(Vm);
|
||||
@ -1112,7 +1112,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
|
||||
if (Dest < D0)
|
||||
{
|
||||
// Moving to a Neon register FROM ARM Reg
|
||||
Dest = (ARMReg)(Dest - S0);
|
||||
Dest = (ARMReg)(Dest - S0);
|
||||
Write32(condition | (0xE0 << 20) | ((Dest & 0x1E) << 15) | (Src << 12) \
|
||||
| (0xA << 8) | ((Dest & 0x1) << 7) | (1 << 4));
|
||||
return;
|
||||
@ -1121,9 +1121,9 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
|
||||
{
|
||||
// Move 64bit from Arm reg
|
||||
ARMReg Src2 = (ARMReg)(Src + 1);
|
||||
Dest = SubBase(Dest);
|
||||
Dest = SubBase(Dest);
|
||||
Write32(condition | (0xC4 << 20) | (Src2 << 16) | (Src << 12) \
|
||||
| (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | (Dest & 0xF));
|
||||
| (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | (Dest & 0xF));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1146,7 +1146,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
|
||||
ARMReg Dest2 = (ARMReg)(Dest + 1);
|
||||
Src = SubBase(Src);
|
||||
Write32(condition | (0xC5 << 20) | (Dest2 << 16) | (Dest << 12) \
|
||||
| (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | (Src & 0xF));
|
||||
| (0xB << 8) | ((Dest & 0x10) << 1) | (1 << 4) | (Src & 0xF));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1178,7 +1178,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
|
||||
// Double and quad
|
||||
if (Quad)
|
||||
{
|
||||
_dbg_assert_msg_(DYNA_REC, cpu_info.bNEON, "Trying to use quad registers when you don't support ASIMD.");
|
||||
_dbg_assert_msg_(DYNA_REC, cpu_info.bNEON, "Trying to use quad registers when you don't support ASIMD.");
|
||||
// Gets encoded as a Double register
|
||||
Write32((0xF2 << 24) | ((Dest & 0x10) << 18) | (2 << 20) | ((Src & 0xF) << 16) \
|
||||
| ((Dest & 0xF) << 12) | (1 << 8) | ((Src & 0x10) << 3) | (1 << 6) \
|
||||
@ -1728,11 +1728,11 @@ void NEONXEmitter::VSUB(NEONElementType Size, ARMReg Vd, ARMReg Vn, ARMReg Vm)
|
||||
|
||||
void NEONXEmitter::VLD1(NEONElementType Size, ARMReg Vd, ARMReg Rn, NEONAlignment align, ARMReg Rm)
|
||||
{
|
||||
u32 spacing = 0x7; // Only support loading to 1 reg
|
||||
u32 spacing = 0x7; // Only support loading to 1 reg
|
||||
// Gets encoded as a double register
|
||||
Vd = SubBase(Vd);
|
||||
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (1 << 21) | (Rn << 16)
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (1 << 21) | (Rn << 16)
|
||||
| ((Vd & 0xF) << 12) | (spacing << 8) | (encodedSize(Size) << 6)
|
||||
| (align << 4) | Rm);
|
||||
}
|
||||
@ -1743,7 +1743,7 @@ void NEONXEmitter::VLD2(NEONElementType Size, ARMReg Vd, ARMReg Rn, NEONAlignmen
|
||||
// Gets encoded as a double register
|
||||
Vd = SubBase(Vd);
|
||||
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (1 << 21) | (Rn << 16)
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (1 << 21) | (Rn << 16)
|
||||
| ((Vd & 0xF) << 12) | (spacing << 8) | (encodedSize(Size) << 6)
|
||||
| (align << 4) | Rm);
|
||||
}
|
||||
@ -1754,7 +1754,7 @@ void NEONXEmitter::VST1(NEONElementType Size, ARMReg Vd, ARMReg Rn, NEONAlignmen
|
||||
// Gets encoded as a double register
|
||||
Vd = SubBase(Vd);
|
||||
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (Rn << 16)
|
||||
Write32((0xF4 << 24) | ((Vd & 0x10) << 18) | (Rn << 16)
|
||||
| ((Vd & 0xF) << 12) | (spacing << 8) | (encodedSize(Size) << 6)
|
||||
| (align << 4) | Rm);
|
||||
}
|
||||
@ -1805,7 +1805,7 @@ void NEONXEmitter::VORR(ARMReg Vd, ARMReg Vn, ARMReg Vm)
|
||||
Vm = SubBase(Vm);
|
||||
|
||||
Write32((0xF2 << 24) | (0x1 << 21) | ((Vd & 0x10) << 18) | ((Vn & 0xF) << 16)
|
||||
| ((Vd & 0xF) << 12) | (1 << 8) | ((Vn & 0x10) << 3)
|
||||
| ((Vd & 0xF) << 12) | (1 << 8) | ((Vn & 0x10) << 3)
|
||||
| (register_quad << 6) | ((Vm & 0x10) << 1) | (1 << 4) | (Vm & 0xF));
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ enum ARMReg
|
||||
D8, D9, D10, D11, D12, D13, D14, D15,
|
||||
D16, D17, D18, D19, D20, D21, D22, D23,
|
||||
D24, D25, D26, D27, D28, D29, D30, D31,
|
||||
|
||||
|
||||
// ASIMD Quad-Word registers
|
||||
Q0, Q1, Q2, Q3, Q4, Q5, Q6, Q7,
|
||||
Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15,
|
||||
@ -142,11 +142,11 @@ public:
|
||||
{
|
||||
return Type;
|
||||
}
|
||||
Operand2() {}
|
||||
Operand2() {}
|
||||
Operand2(u32 imm, OpType type = TYPE_IMM)
|
||||
{
|
||||
Type = type;
|
||||
Value = imm;
|
||||
{
|
||||
Type = type;
|
||||
Value = imm;
|
||||
Rotation = 0;
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ u32 EncodeVd(ARMReg Vd);
|
||||
u32 EncodeVn(ARMReg Vn);
|
||||
u32 EncodeVm(ARMReg Vm);
|
||||
// Subtracts the base from the register to give us the real one
|
||||
ARMReg SubBase(ARMReg Reg);
|
||||
ARMReg SubBase(ARMReg Reg);
|
||||
|
||||
class ARMXEmitter
|
||||
{
|
||||
@ -474,7 +474,7 @@ public:
|
||||
void MOVW(ARMReg dest, Operand2 op2);
|
||||
void MOVT(ARMReg dest, Operand2 op2, bool TopBits = false);
|
||||
|
||||
// UDIV and SDIV are only available on CPUs that have
|
||||
// UDIV and SDIV are only available on CPUs that have
|
||||
// the idiva hardare capacity
|
||||
void UDIV(ARMReg dest, ARMReg dividend, ARMReg divisor);
|
||||
void SDIV(ARMReg dest, ARMReg dividend, ARMReg divisor);
|
||||
@ -526,7 +526,7 @@ public:
|
||||
// None of these will be created with conditional since ARM
|
||||
// is deprecating conditional execution of ASIMD instructions.
|
||||
// ASIMD instructions don't even have a conditional encoding.
|
||||
|
||||
|
||||
// VFP Only
|
||||
void VLDR(ARMReg Dest, ARMReg Base, s16 offset);
|
||||
void VSTR(ARMReg Src, ARMReg Base, s16 offset);
|
||||
@ -574,7 +574,7 @@ public:
|
||||
|
||||
enum NEONElementType
|
||||
{
|
||||
I_8 = (1 << 0),
|
||||
I_8 = (1 << 0),
|
||||
I_16 = (1 << 1),
|
||||
I_32 = (1 << 2),
|
||||
I_64 = (1 << 3),
|
||||
@ -597,7 +597,7 @@ class NEONXEmitter
|
||||
private:
|
||||
ARMXEmitter *_emit;
|
||||
inline void Write32(u32 value) { _emit->Write32(value); }
|
||||
|
||||
|
||||
inline u32 encodedSize(u32 value)
|
||||
{
|
||||
if (value & I_8)
|
||||
@ -612,7 +612,7 @@ private:
|
||||
_dbg_assert_msg_(DYNA_REC, false, "Passed invalid size to integer NEON instruction");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void VREVX(u32 size, NEONElementType Size, ARMReg Vd, ARMReg Vm);
|
||||
|
||||
public:
|
||||
@ -703,7 +703,7 @@ public:
|
||||
|
||||
// Always clear code space with breakpoints, so that if someone accidentally executes
|
||||
// uninitialized, it just breaks into the debugger.
|
||||
void ClearCodeSpace()
|
||||
void ClearCodeSpace()
|
||||
{
|
||||
// x86/64: 0xCC = breakpoint
|
||||
memset(region, 0xCC, region_size);
|
||||
|
@ -107,7 +107,7 @@ void BreakPoints::Clear()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
m_BreakPoints.clear();
|
||||
}
|
||||
|
||||
|
@ -180,7 +180,6 @@ public:
|
||||
void Do(T& x)
|
||||
{
|
||||
static_assert(IsTriviallyCopyable(T), "Only sane for trivially copyable types");
|
||||
|
||||
DoVoid((void*)&x, sizeof(x));
|
||||
}
|
||||
|
||||
@ -321,7 +320,7 @@ public:
|
||||
|
||||
if (!File::Exists(_rFilename))
|
||||
return false;
|
||||
|
||||
|
||||
// Check file size
|
||||
const u64 fileSize = File::GetSize(_rFilename);
|
||||
static const u64 headerSize = sizeof(SChunkHeader);
|
||||
@ -374,7 +373,7 @@ public:
|
||||
u8* ptr = &buffer[0];
|
||||
PointerWrap p(&ptr, PointerWrap::MODE_READ);
|
||||
_class.DoState(p);
|
||||
|
||||
|
||||
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ struct ArraySizeImpl : public std::extent<T>
|
||||
#define b2(x) ( (x) | ( (x) >> 1) )
|
||||
#define b4(x) ( b2(x) | ( b2(x) >> 2) )
|
||||
#define b8(x) ( b4(x) | ( b4(x) >> 4) )
|
||||
#define b16(x) ( b8(x) | ( b8(x) >> 8) )
|
||||
#define b16(x) ( b8(x) | ( b8(x) >> 8) )
|
||||
#define b32(x) (b16(x) | (b16(x) >>16) )
|
||||
#define ROUND_UP_POW2(x) (b32(x - 1) + 1)
|
||||
|
||||
@ -95,12 +95,12 @@ inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
#define unlink _unlink
|
||||
#define snprintf _snprintf
|
||||
#define vscprintf _vscprintf
|
||||
|
||||
|
||||
// Locale Cross-Compatibility
|
||||
#define locale_t _locale_t
|
||||
#define freelocale _free_locale
|
||||
#define newlocale(mask, locale, base) _create_locale(mask, locale)
|
||||
|
||||
|
||||
#define LC_GLOBAL_LOCALE ((locale_t)-1)
|
||||
#define LC_ALL_MASK LC_ALL
|
||||
#define LC_COLLATE_MASK LC_COLLATE
|
||||
@ -108,7 +108,7 @@ inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
#define LC_MONETARY_MASK LC_MONETARY
|
||||
#define LC_NUMERIC_MASK LC_NUMERIC
|
||||
#define LC_TIME_MASK LC_TIME
|
||||
|
||||
|
||||
inline locale_t uselocale(locale_t new_locale)
|
||||
{
|
||||
// Retrieve the current per thread locale setting
|
||||
@ -184,8 +184,8 @@ inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);}
|
||||
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);}
|
||||
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);}
|
||||
#elif _M_ARM
|
||||
inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;}
|
||||
inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
|
||||
inline u16 swap16 (u16 _data) { u32 data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (u16)data;}
|
||||
inline u32 swap32 (u32 _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
|
||||
inline u64 swap64(u64 _data) {return ((u64)swap32(_data) << 32) | swap32(_data >> 32);}
|
||||
#elif __linux__
|
||||
inline u16 swap16(u16 _data) {return bswap_16(_data);}
|
||||
@ -242,7 +242,7 @@ template <typename T>
|
||||
inline T FromBigEndian(T data)
|
||||
{
|
||||
//static_assert(std::is_arithmetic<T>::value, "function only makes sense with arithmetic types");
|
||||
|
||||
|
||||
swap<sizeof(data)>(reinterpret_cast<u8*>(&data));
|
||||
return data;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ bool ConsoleListener::IsOpen()
|
||||
|
||||
/*
|
||||
LetterSpace: SetConsoleScreenBufferSize and SetConsoleWindowInfo are
|
||||
dependent on each other, that's the reason for the additional checks.
|
||||
dependent on each other, that's the reason for the additional checks.
|
||||
*/
|
||||
void ConsoleListener::BufferWidthHeight(int BufferWidth, int BufferHeight, int ScreenWidth, int ScreenHeight, bool BufferFirst)
|
||||
{
|
||||
@ -226,7 +226,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||
|
||||
BytesWritten += cAttrWritten;
|
||||
coordScreen = GetCoordinates(BytesWritten, LBufWidth);
|
||||
}
|
||||
}
|
||||
|
||||
const int OldCursor = ConInfo.dwCursorPosition.Y * ConInfo.dwSize.X + ConInfo.dwCursorPosition.X;
|
||||
COORD Coo = GetCoordinates(OldCursor, LBufWidth);
|
||||
@ -311,23 +311,23 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||
}
|
||||
// Clear console screen
|
||||
void ConsoleListener::ClearScreen(bool Cursor)
|
||||
{
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
COORD coordScreen = { 0, 0 };
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
COORD coordScreen = { 0, 0 };
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
|
||||
// Write space to the entire console
|
||||
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten);
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
|
||||
// Reset cursor
|
||||
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
if (Cursor) SetConsoleCursorPosition(hConsole, coordScreen);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ void point_mul(u8 *d, const u8 *a, u8 *b) // a is bignum
|
||||
}
|
||||
}
|
||||
|
||||
void silly_random(u8 * rndArea, u8 count)
|
||||
void silly_random(u8 * rndArea, u8 count)
|
||||
{
|
||||
u16 i;
|
||||
srand((unsigned) (time(NULL)));
|
||||
@ -331,7 +331,7 @@ void silly_random(u8 * rndArea, u8 count)
|
||||
for(i=0;i<count;i++)
|
||||
{
|
||||
rndArea[i]=rand();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void generate_ecdsa(u8 *R, u8 *S, const u8 *k, u8 *hash)
|
||||
|
@ -30,7 +30,7 @@ using namespace std;
|
||||
void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut )
|
||||
{
|
||||
#if defined(UNICODE)||defined(_UNICODE)
|
||||
ULONG index = 0;
|
||||
ULONG index = 0;
|
||||
PCSTR lpAct = lpszIn;
|
||||
|
||||
for( ; ; lpAct++ )
|
||||
@ -38,7 +38,7 @@ void PCSTR2LPTSTR( PCSTR lpszIn, LPTSTR lpszOut )
|
||||
lpszOut[index++] = (TCHAR)(*lpAct);
|
||||
if ( *lpAct == 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// This is trivial :)
|
||||
strcpy( lpszOut, lpszIn );
|
||||
@ -102,7 +102,7 @@ BOOL InitSymInfo( PCSTR lpszInitialSymbolPath )
|
||||
CHAR lpszSymbolPath[BUFFERSIZE];
|
||||
DWORD symOptions = SymGetOptions();
|
||||
|
||||
symOptions |= SYMOPT_LOAD_LINES;
|
||||
symOptions |= SYMOPT_LOAD_LINES;
|
||||
symOptions &= ~SYMOPT_UNDNAME;
|
||||
SymSetOptions( symOptions );
|
||||
InitSymbolPath( lpszSymbolPath, lpszInitialSymbolPath );
|
||||
@ -154,15 +154,15 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
|
||||
#ifndef _M_X64
|
||||
DWORD dwDisp = 0;
|
||||
if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, &dwDisp, pSym ) )
|
||||
#else
|
||||
#else
|
||||
//makes it compile but hell im not sure if this works...
|
||||
DWORD64 dwDisp = 0;
|
||||
if ( SymGetSymFromAddr( GetCurrentProcess(), (ULONG)fnAddress, (PDWORD64)&dwDisp, pSym ) )
|
||||
#endif
|
||||
{
|
||||
// Make the symbol readable for humans
|
||||
UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE,
|
||||
UNDNAME_COMPLETE |
|
||||
UnDecorateSymbolName( pSym->Name, lpszNonUnicodeUnDSymbol, BUFFERSIZE,
|
||||
UNDNAME_COMPLETE |
|
||||
UNDNAME_NO_THISTYPE |
|
||||
UNDNAME_NO_SPECIAL_SYMS |
|
||||
UNDNAME_NO_MEMBER_TYPE |
|
||||
@ -224,7 +224,7 @@ static BOOL GetFunctionInfoFromAddresses( ULONG fnAddress, ULONG stackAddress, L
|
||||
_tcscat( lpszSymbol, lpszParsed );
|
||||
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
GlobalFree( pSym );
|
||||
|
||||
return ret;
|
||||
@ -330,14 +330,14 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
|
||||
|
||||
PrintFunctionAndSourceInfo(file, callStack);
|
||||
|
||||
for( ULONG index = 0; ; index++ )
|
||||
for( ULONG index = 0; ; index++ )
|
||||
{
|
||||
bResult = StackWalk(
|
||||
IMAGE_FILE_MACHINE_I386,
|
||||
hProcess,
|
||||
hThread,
|
||||
&callStack,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SymFunctionTableAccess,
|
||||
SymGetModuleBase,
|
||||
@ -346,7 +346,7 @@ void StackTrace( HANDLE hThread, const char* lpszMessage, FILE *file )
|
||||
if ( index == 0 )
|
||||
continue;
|
||||
|
||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
||||
break;
|
||||
|
||||
PrintFunctionAndSourceInfo(file, callStack);
|
||||
@ -387,14 +387,14 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||
|
||||
PrintFunctionAndSourceInfo(file, callStack);
|
||||
|
||||
for( ULONG index = 0; ; index++ )
|
||||
for( ULONG index = 0; ; index++ )
|
||||
{
|
||||
bResult = StackWalk(
|
||||
IMAGE_FILE_MACHINE_I386,
|
||||
hProcess,
|
||||
hThread,
|
||||
&callStack,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
SymFunctionTableAccess,
|
||||
SymGetModuleBase,
|
||||
@ -403,7 +403,7 @@ void StackTrace(HANDLE hThread, const char* lpszMessage, FILE *file, DWORD eip,
|
||||
if ( index == 0 )
|
||||
continue;
|
||||
|
||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
||||
if( !bResult || callStack.AddrFrame.Offset == 0 )
|
||||
break;
|
||||
|
||||
PrintFunctionAndSourceInfo(file, callStack);
|
||||
|
@ -35,12 +35,12 @@ namespace FPURoundMode
|
||||
void SetRoundMode(u32 mode);
|
||||
|
||||
void SetPrecisionMode(u32 mode);
|
||||
|
||||
|
||||
void SetSIMDMode(u32 mode);
|
||||
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
||||
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
||||
*
|
||||
* The first rounds according to the MXCSR rounding bits.
|
||||
* The second one always uses round towards zero.
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
// create the element, add it to the queue
|
||||
m_write_ptr->current = std::forward<Arg>(t);
|
||||
// set the next pointer to a new element ptr
|
||||
// then advance the write pointer
|
||||
// then advance the write pointer
|
||||
ElementPtr* new_ptr = new ElementPtr();
|
||||
AtomicStoreRelease(m_write_ptr->next, new_ptr);
|
||||
m_write_ptr = new_ptr;
|
||||
|
@ -92,7 +92,7 @@ bool IsDirectory(const std::string &filename)
|
||||
#endif
|
||||
|
||||
if (result < 0) {
|
||||
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s",
|
||||
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s",
|
||||
filename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
@ -106,7 +106,7 @@ bool Delete(const std::string &filename)
|
||||
{
|
||||
INFO_LOG(COMMON, "Delete: file %s", filename.c_str());
|
||||
|
||||
// Return true because we care about the file no
|
||||
// Return true because we care about the file no
|
||||
// being there, not the actual delete.
|
||||
if (!Exists(filename))
|
||||
{
|
||||
@ -124,13 +124,13 @@ bool Delete(const std::string &filename)
|
||||
#ifdef _WIN32
|
||||
if (!DeleteFile(UTF8ToTStr(filename).c_str()))
|
||||
{
|
||||
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
|
||||
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s",
|
||||
filename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (unlink(filename.c_str()) == -1) {
|
||||
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
|
||||
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
|
||||
filename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
@ -234,10 +234,10 @@ bool DeleteDir(const std::string &filename)
|
||||
return false;
|
||||
}
|
||||
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
bool Rename(const std::string &srcFilename, const std::string &destFilename)
|
||||
{
|
||||
INFO_LOG(COMMON, "Rename: %s --> %s",
|
||||
INFO_LOG(COMMON, "Rename: %s --> %s",
|
||||
srcFilename.c_str(), destFilename.c_str());
|
||||
#ifdef _WIN32
|
||||
auto sf = UTF8ToTStr(srcFilename);
|
||||
@ -256,7 +256,7 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename)
|
||||
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
|
||||
return true;
|
||||
#endif
|
||||
ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s",
|
||||
ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
@ -296,16 +296,16 @@ bool RenameSync(const std::string &srcFilename, const std::string &destFilename)
|
||||
return true;
|
||||
}
|
||||
|
||||
// copies file srcFilename to destFilename, returns true on success
|
||||
// copies file srcFilename to destFilename, returns true on success
|
||||
bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
{
|
||||
INFO_LOG(COMMON, "Copy: %s --> %s",
|
||||
INFO_LOG(COMMON, "Copy: %s --> %s",
|
||||
srcFilename.c_str(), destFilename.c_str());
|
||||
#ifdef _WIN32
|
||||
if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE))
|
||||
return true;
|
||||
|
||||
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s",
|
||||
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
#else
|
||||
@ -319,7 +319,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
FILE *input = fopen(srcFilename.c_str(), "rb");
|
||||
if (!input)
|
||||
{
|
||||
ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s",
|
||||
ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
@ -329,7 +329,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
if (!output)
|
||||
{
|
||||
fclose(input);
|
||||
ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s",
|
||||
ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
return false;
|
||||
}
|
||||
@ -343,8 +343,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
{
|
||||
if (ferror(input) != 0)
|
||||
{
|
||||
ERROR_LOG(COMMON,
|
||||
"Copy: failed reading from source, %s --> %s: %s",
|
||||
ERROR_LOG(COMMON,
|
||||
"Copy: failed reading from source, %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
goto bail;
|
||||
}
|
||||
@ -354,8 +354,8 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
|
||||
int wnum = fwrite(buffer, sizeof(char), rnum, output);
|
||||
if (wnum != rnum)
|
||||
{
|
||||
ERROR_LOG(COMMON,
|
||||
"Copy: failed writing to output, %s --> %s: %s",
|
||||
ERROR_LOG(COMMON,
|
||||
"Copy: failed writing to output, %s --> %s: %s",
|
||||
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
|
||||
goto bail;
|
||||
}
|
||||
@ -387,7 +387,7 @@ u64 GetSize(const std::string &filename)
|
||||
WARN_LOG(COMMON, "GetSize: failed %s: is a directory", filename.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
struct stat64 buf;
|
||||
#ifdef _WIN32
|
||||
if (_tstat64(UTF8ToTStr(filename).c_str(), &buf) == 0)
|
||||
@ -436,10 +436,10 @@ u64 GetSize(FILE *f)
|
||||
return size;
|
||||
}
|
||||
|
||||
// creates an empty file filename, returns true on success
|
||||
// creates an empty file filename, returns true on success
|
||||
bool CreateEmptyFile(const std::string &filename)
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str());
|
||||
INFO_LOG(COMMON, "CreateEmptyFile: %s", filename.c_str());
|
||||
|
||||
if (!File::IOFile(filename, "wb"))
|
||||
{
|
||||
@ -489,7 +489,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
|
||||
#endif
|
||||
// check for "." and ".."
|
||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
(virtualName[2] == '\0')))
|
||||
continue;
|
||||
entry.virtualName = virtualName;
|
||||
@ -504,14 +504,14 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
|
||||
foundEntries += (u32)entry.size;
|
||||
}
|
||||
else
|
||||
{ // is a file
|
||||
{ // is a file
|
||||
entry.isDirectory = false;
|
||||
entry.size = GetSize(entry.physicalName.c_str());
|
||||
}
|
||||
++foundEntries;
|
||||
// Push into the tree
|
||||
parentEntry.children.push_back(entry);
|
||||
#ifdef _WIN32
|
||||
parentEntry.children.push_back(entry);
|
||||
#ifdef _WIN32
|
||||
} while (FindNextFile(hFind, &ffd) != 0);
|
||||
FindClose(hFind);
|
||||
#else
|
||||
@ -556,7 +556,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
|
||||
// check for "." and ".."
|
||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
(virtualName[2] == '\0')))
|
||||
continue;
|
||||
|
||||
@ -592,7 +592,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
closedir(dirp);
|
||||
#endif
|
||||
File::DeleteDir(directory);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -653,7 +653,7 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
|
||||
std::string GetCurrentDir()
|
||||
{
|
||||
char *dir;
|
||||
// Get the current working directory (getcwd uses malloc)
|
||||
// Get the current working directory (getcwd uses malloc)
|
||||
if (!(dir = __getcwd(NULL, 0))) {
|
||||
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
|
||||
@ -687,7 +687,7 @@ std::string GetTempFilenameForAtomicWrite(const std::string &path)
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
std::string GetBundleDirectory()
|
||||
std::string GetBundleDirectory()
|
||||
{
|
||||
CFURLRef BundleRef;
|
||||
char AppBundlePath[MAXPATHLEN];
|
||||
@ -798,8 +798,8 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
|
||||
paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
else
|
||||
paths[D_USER_IDX] = std::string(getenv("HOME") ?
|
||||
getenv("HOME") : getenv("PWD") ?
|
||||
paths[D_USER_IDX] = std::string(getenv("HOME") ?
|
||||
getenv("HOME") : getenv("PWD") ?
|
||||
getenv("PWD") : "") + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
|
||||
#endif
|
||||
|
||||
@ -917,7 +917,7 @@ const std::string& GetUserPath(const unsigned int DirIDX, const std::string &new
|
||||
|
||||
paths[D_WIIUSER_IDX] = paths[D_WIIROOT_IDX] + DIR_SEP;
|
||||
paths[D_WIIWC24_IDX] = paths[D_WIIUSER_IDX] + WII_WC24CONF_DIR DIR_SEP;
|
||||
paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
|
||||
paths[D_WIISYSCONF_IDX] = paths[D_WIIUSER_IDX] + WII_SYSCONF_DIR + DIR_SEP;
|
||||
paths[F_WIISYSCONF_IDX] = paths[D_WIISYSCONF_IDX] + WII_SYSCONF;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ enum {
|
||||
namespace File
|
||||
{
|
||||
|
||||
// FileSystem tree node/
|
||||
// FileSystem tree node/
|
||||
struct FSTEntry
|
||||
{
|
||||
bool isDirectory;
|
||||
@ -94,16 +94,16 @@ bool Delete(const std::string &filename);
|
||||
// Deletes a directory filename, returns true on success
|
||||
bool DeleteDir(const std::string &filename);
|
||||
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
bool Rename(const std::string &srcFilename, const std::string &destFilename);
|
||||
|
||||
// ditto, but syncs the source file and, on Unix, syncs the directories after rename
|
||||
bool RenameSync(const std::string &srcFilename, const std::string &destFilename);
|
||||
|
||||
// copies file srcFilename to destFilename, returns true on success
|
||||
// copies file srcFilename to destFilename, returns true on success
|
||||
bool Copy(const std::string &srcFilename, const std::string &destFilename);
|
||||
|
||||
// creates an empty file filename, returns true on success
|
||||
// creates an empty file filename, returns true on success
|
||||
bool CreateEmptyFile(const std::string &filename);
|
||||
|
||||
// Scans the directory tree gets, starting from _Directory and adds the
|
||||
@ -157,10 +157,10 @@ public:
|
||||
IOFile(const std::string& filename, const char openmode[]);
|
||||
|
||||
~IOFile();
|
||||
|
||||
|
||||
IOFile(IOFile&& other);
|
||||
IOFile& operator=(IOFile&& other);
|
||||
|
||||
|
||||
void Swap(IOFile& other);
|
||||
|
||||
bool Open(const std::string& filename, const char openmode[]);
|
||||
|
@ -115,15 +115,15 @@ inline u64 getblock(const u64 * p, int i)
|
||||
|
||||
inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
|
||||
{
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl64(h2,41);
|
||||
|
||||
k2 *= c2;
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
@ -250,7 +250,7 @@ u64 GetCRC32(const u8 *src, int len, u32 samples)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* NOTE: This hash function is used for custom texture loading/dumping, so
|
||||
* it should not be changed, which would require all custom textures to be
|
||||
* recalculated for their new hash values. If the hashing function is
|
||||
@ -273,7 +273,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
u64 k = data[0];
|
||||
data+=Step;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
@ -292,13 +292,13 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
case 1: h ^= u64(data2[0]);
|
||||
h *= m;
|
||||
};
|
||||
|
||||
|
||||
h ^= h >> r;
|
||||
h *= m;
|
||||
h ^= h >> r;
|
||||
|
||||
return h;
|
||||
}
|
||||
}
|
||||
#else
|
||||
// CRC32 hash using the SSE4.2 instruction
|
||||
u64 GetCRC32(const u8 *src, int len, u32 samples)
|
||||
@ -351,15 +351,15 @@ inline u32 fmix32(u32 h)
|
||||
|
||||
inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2)
|
||||
{
|
||||
k1 *= c1;
|
||||
k1 = _rotl(k1,11);
|
||||
k1 *= c1;
|
||||
k1 = _rotl(k1,11);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl(h2,17);
|
||||
|
||||
k2 *= c2;
|
||||
k2 *= c2;
|
||||
k2 = _rotl(k2,11);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
@ -405,7 +405,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
||||
|
||||
//----------
|
||||
// tail
|
||||
|
||||
|
||||
const u8 * tail = (const u8*)(data + nblocks*8);
|
||||
|
||||
u32 k1 = 0;
|
||||
@ -439,7 +439,7 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
||||
|
||||
out[0] = h1;
|
||||
out[1] = h2;
|
||||
|
||||
|
||||
return *((u64 *)&out);
|
||||
}
|
||||
|
||||
@ -463,11 +463,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
u64 k = data[0];
|
||||
data+=Step;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
h *= m;
|
||||
}
|
||||
|
||||
const u8 * data2 = (const u8*)end;
|
||||
@ -483,7 +483,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
case 1: h ^= u64(data2[0]);
|
||||
h *= m;
|
||||
};
|
||||
|
||||
|
||||
h ^= h >> r;
|
||||
h *= m;
|
||||
h ^= h >> r;
|
||||
|
@ -81,10 +81,10 @@ void IniFile::Section::Set(const char* key, bool newValue, bool defaultValue)
|
||||
Delete(key);
|
||||
}
|
||||
|
||||
void IniFile::Section::Set(const char* key, const std::vector<std::string>& newValues)
|
||||
void IniFile::Section::Set(const char* key, const std::vector<std::string>& newValues)
|
||||
{
|
||||
std::string temp;
|
||||
// Join the strings with ,
|
||||
// Join the strings with ,
|
||||
std::vector<std::string>::const_iterator it;
|
||||
for (it = newValues.begin(); it != newValues.end(); ++it)
|
||||
{
|
||||
@ -124,13 +124,13 @@ bool IniFile::Section::Get(const char* key, std::vector<std::string>& out)
|
||||
size_t subStart = temp.find_first_not_of(",");
|
||||
size_t subEnd;
|
||||
|
||||
// split by ,
|
||||
// split by ,
|
||||
while (subStart != std::string::npos)
|
||||
{
|
||||
// Find next ,
|
||||
// Find next ,
|
||||
subEnd = temp.find_first_of(",", subStart);
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
if (subStart != subEnd)
|
||||
// take from first char until next ,
|
||||
out.push_back(StripSpaces(temp.substr(subStart, subEnd - subStart)));
|
||||
// Find the next non , char
|
||||
subStart = temp.find_first_not_of(",", subEnd);
|
||||
@ -435,7 +435,7 @@ bool IniFile::Get(const char* sectionName, const char* key, std::string* value,
|
||||
return section->Get(key, value, defaultValue);
|
||||
}
|
||||
|
||||
bool IniFile::Get(const char *sectionName, const char* key, std::vector<std::string>& values)
|
||||
bool IniFile::Get(const char *sectionName, const char* key, std::vector<std::string>& values)
|
||||
{
|
||||
Section *section = GetSection(sectionName);
|
||||
if (!section)
|
||||
|
@ -53,12 +53,12 @@ public:
|
||||
void Set(const char* key, double newValue) {
|
||||
Set(key, StringFromFormat("%f", newValue).c_str());
|
||||
}
|
||||
|
||||
|
||||
void Set(const char* key, int newValue, int defaultValue);
|
||||
void Set(const char* key, int newValue) {
|
||||
Set(key, StringFromInt(newValue).c_str());
|
||||
}
|
||||
|
||||
|
||||
void Set(const char* key, bool newValue, bool defaultValue);
|
||||
void Set(const char* key, bool newValue) {
|
||||
Set(key, StringFromBool(newValue).c_str());
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
m_file.seekg(0, std::ios::beg);
|
||||
std::fstream::pos_type start_pos = m_file.tellg();
|
||||
std::streamoff file_size = end_pos - start_pos;
|
||||
|
||||
|
||||
if (m_file.is_open() && ValidateHeader())
|
||||
{
|
||||
// good header, read some key/value pairs
|
||||
@ -86,7 +86,7 @@ public:
|
||||
|
||||
// read key/value and pass to reader
|
||||
if (Read(&key) &&
|
||||
Read(value, value_size) &&
|
||||
Read(value, value_size) &&
|
||||
Read(&entry_number) &&
|
||||
entry_number == m_num_entries+1)
|
||||
{
|
||||
@ -114,7 +114,7 @@ public:
|
||||
WriteHeader();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void Sync()
|
||||
{
|
||||
m_file.flush();
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define _LOG_H_
|
||||
|
||||
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
|
||||
#define ERROR_LEVEL 2 // Critical errors
|
||||
#define ERROR_LEVEL 2 // Critical errors
|
||||
#define WARNING_LEVEL 3 // Something is suspicious.
|
||||
#define INFO_LEVEL 4 // General information.
|
||||
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
|
||||
@ -40,7 +40,7 @@ enum LOG_TYPE
|
||||
MEMMAP,
|
||||
MEMCARD_MANAGER,
|
||||
OSREPORT,
|
||||
PAD,
|
||||
PAD,
|
||||
PROCESSORINTERFACE,
|
||||
PIXELENGINE,
|
||||
SERIALINTERFACE,
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "Thread.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char* fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
@ -110,7 +110,7 @@ LogManager::~LogManager()
|
||||
delete m_debuggerLog;
|
||||
}
|
||||
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char *format, va_list args)
|
||||
{
|
||||
char temp[MAX_MSGLEN];
|
||||
@ -128,7 +128,7 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
file, line, level_to_char[(int)level],
|
||||
log->GetShortName(), temp);
|
||||
#ifdef ANDROID
|
||||
Host_SysMessage(msg);
|
||||
Host_SysMessage(msg);
|
||||
#endif
|
||||
log->Trigger(level, msg);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class LogContainer
|
||||
{
|
||||
public:
|
||||
LogContainer(const char* shortName, const char* fullName, bool enable = false);
|
||||
|
||||
|
||||
const char* GetShortName() const { return m_shortName; }
|
||||
const char* GetFullName() const { return m_fullName; }
|
||||
|
||||
@ -99,7 +99,7 @@ public:
|
||||
|
||||
static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
|
||||
|
||||
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
|
||||
const char *file, int line, const char *fmt, va_list args);
|
||||
|
||||
void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
|
||||
|
@ -17,7 +17,7 @@ u32 ClassifyDouble(double dvalue)
|
||||
value.d = dvalue;
|
||||
u64 sign = value.i & DOUBLE_SIGN;
|
||||
u64 exp = value.i & DOUBLE_EXP;
|
||||
if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP)
|
||||
if (exp > DOUBLE_ZERO && exp < DOUBLE_EXP)
|
||||
{
|
||||
// Nice normalized number.
|
||||
return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN;
|
||||
@ -57,7 +57,7 @@ u32 ClassifyFloat(float fvalue)
|
||||
value.f = fvalue;
|
||||
u32 sign = value.i & FLOAT_SIGN;
|
||||
u32 exp = value.i & FLOAT_EXP;
|
||||
if (exp > FLOAT_ZERO && exp < FLOAT_EXP)
|
||||
if (exp > FLOAT_ZERO && exp < FLOAT_EXP)
|
||||
{
|
||||
// Nice normalized number.
|
||||
return sign ? PPC_FPCLASS_NN : PPC_FPCLASS_PN;
|
||||
@ -76,13 +76,13 @@ u32 ClassifyFloat(float fvalue)
|
||||
// Denormalized number.
|
||||
return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD;
|
||||
}
|
||||
}
|
||||
else if (exp)
|
||||
}
|
||||
else if (exp)
|
||||
{
|
||||
// Infinite
|
||||
return sign ? PPC_FPCLASS_NINF : PPC_FPCLASS_PINF;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
//Zero
|
||||
return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ;
|
||||
|
@ -105,7 +105,7 @@ struct Rectangle
|
||||
Rectangle(T theLeft, T theTop, T theRight, T theBottom)
|
||||
: left(theLeft), top(theTop), right(theRight), bottom(theBottom)
|
||||
{ }
|
||||
|
||||
|
||||
bool operator==(const Rectangle& r) { return left==r.left && top==r.top && right==r.right && bottom==r.bottom; }
|
||||
|
||||
T GetWidth() const { return abs(right - left); }
|
||||
@ -123,7 +123,7 @@ struct Rectangle
|
||||
|
||||
// If the rectangle is in a coordinate system with an upper-left origin,
|
||||
// use this Clamp.
|
||||
void ClampUL(T x1, T y1, T x2, T y2)
|
||||
void ClampUL(T x1, T y1, T x2, T y2)
|
||||
{
|
||||
if (left < x1) left = x1;
|
||||
if (right > x2) right = x2;
|
||||
|
@ -257,7 +257,7 @@ u8 *MemoryMap_Setup(const MemoryView *views, int num_views, u32 flags, MemArena
|
||||
{
|
||||
base_attempts++;
|
||||
base = (u8 *)base_addr;
|
||||
if (Memory_TryBase(base, views, num_views, flags, arena))
|
||||
if (Memory_TryBase(base, views, num_views, flags, arena))
|
||||
{
|
||||
INFO_LOG(MEMMAP, "Found valid memory base at %p after %i tries.", base, base_attempts);
|
||||
base_attempts = 0;
|
||||
|
@ -16,7 +16,7 @@ enum MSG_TYPE
|
||||
CRITICAL
|
||||
};
|
||||
|
||||
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
||||
typedef bool (*MsgAlertHandler)(const char* caption, const char* text,
|
||||
bool yes_no, int Style);
|
||||
typedef std::string (*StringTranslator)(const char* text);
|
||||
|
||||
@ -32,29 +32,29 @@ void SetEnableAlert(bool enable);
|
||||
|
||||
#ifndef GEKKO
|
||||
#ifdef _WIN32
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, __VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, __VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, __VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, __VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, __VA_ARGS__)
|
||||
#else
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
#define SuccessAlert(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlert(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNo(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNo(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlert(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
// Use these macros (that do the same thing) if the message should be translated.
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
#define SuccessAlertT(format, ...) MsgAlert(false, INFORMATION, format, ##__VA_ARGS__)
|
||||
#define PanicAlertT(format, ...) MsgAlert(false, WARNING, format, ##__VA_ARGS__)
|
||||
#define PanicYesNoT(format, ...) MsgAlert(true, WARNING, format, ##__VA_ARGS__)
|
||||
#define AskYesNoT(format, ...) MsgAlert(true, QUESTION, format, ##__VA_ARGS__)
|
||||
#define CriticalAlertT(format, ...) MsgAlert(false, CRITICAL, format, ##__VA_ARGS__)
|
||||
#endif
|
||||
#else
|
||||
// GEKKO
|
||||
|
@ -58,7 +58,7 @@ bool CheckTitleTMD(u64 _titleID)
|
||||
|
||||
bool CheckTitleTIK(u64 _titleID)
|
||||
{
|
||||
const std::string ticketFileName = Common::GetTicketFileName(_titleID);
|
||||
const std::string ticketFileName = Common::GetTicketFileName(_titleID);
|
||||
if (File::Exists(ticketFileName))
|
||||
{
|
||||
File::IOFile pTIKFile(ticketFileName, "rb");
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define __has_include(s) 0
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__
|
||||
#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
// GCC 4.4 provides <condition_variable>
|
||||
#include <condition_variable>
|
||||
|
@ -108,7 +108,7 @@ public:
|
||||
return (0 != TryEnterCriticalSection(&m_handle));
|
||||
#else
|
||||
return !pthread_mutex_trylock(&m_handle);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
native_handle_type native_handle()
|
||||
@ -283,10 +283,10 @@ public:
|
||||
swap(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_RVALUE_REFERENCES
|
||||
unique_lock(const unique_lock&) /*= delete*/;
|
||||
|
||||
|
||||
unique_lock(unique_lock&& other)
|
||||
: pm(NULL), owns(false)
|
||||
{
|
||||
@ -295,7 +295,7 @@ public:
|
||||
: pm(NULL), owns(false)
|
||||
{
|
||||
// ugly const_cast to get around lack of rvalue references
|
||||
unique_lock& other = const_cast<unique_lock&>(u);
|
||||
unique_lock& other = const_cast<unique_lock&>(u);
|
||||
#endif
|
||||
swap(other);
|
||||
}
|
||||
@ -316,7 +316,7 @@ public:
|
||||
//bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
//template <class Clock, class Duration>
|
||||
//bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
|
||||
|
||||
void unlock()
|
||||
{
|
||||
mutex()->unlock();
|
||||
|
@ -213,7 +213,7 @@ public:
|
||||
std::swap(m_handle, other.m_handle);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static unsigned hardware_concurrency()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -227,7 +227,7 @@ public:
|
||||
|
||||
private:
|
||||
id m_id;
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
native_handle_type m_handle;
|
||||
#endif
|
||||
@ -247,7 +247,7 @@ private:
|
||||
m_id = id();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
template <typename C>
|
||||
class Func
|
||||
{
|
||||
|
@ -109,11 +109,11 @@ std::string ArrayToString(const u8 *data, u32 size, int line_len, bool spaces)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << std::setfill('0') << std::hex;
|
||||
|
||||
|
||||
for (int line = 0; size; ++data, --size)
|
||||
{
|
||||
oss << std::setw(2) << (int)*data;
|
||||
|
||||
|
||||
if (line_len == ++line)
|
||||
{
|
||||
oss << '\n';
|
||||
@ -156,7 +156,7 @@ bool TryParse(const std::string &str, u32 *const output)
|
||||
errno = 0;
|
||||
|
||||
unsigned long value = strtoul(str.c_str(), &endptr, 0);
|
||||
|
||||
|
||||
if (!endptr || *endptr)
|
||||
return false;
|
||||
|
||||
@ -284,7 +284,7 @@ std::string ReplaceAll(std::string result, const std::string& src, const std::st
|
||||
//#include <string>
|
||||
//#include <assert.h>
|
||||
|
||||
const char HEX2DEC[256] =
|
||||
const char HEX2DEC[256] =
|
||||
{
|
||||
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
|
||||
/* 0 */ 16,16,16,16, 16,16,16,16, 16,16,16,16, 16,16,16,16,
|
||||
@ -317,7 +317,7 @@ std::string UriDecode(const std::string & sSrc)
|
||||
const unsigned char * pSrc = (const unsigned char *)sSrc.c_str();
|
||||
const size_t SRC_LEN = sSrc.length();
|
||||
const unsigned char * const SRC_END = pSrc + SRC_LEN;
|
||||
const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%'
|
||||
const unsigned char * const SRC_LAST_DEC = SRC_END - 2; // last decodable '%'
|
||||
|
||||
char * const pStart = new char[SRC_LEN];
|
||||
char * pEnd = pStart;
|
||||
@ -384,7 +384,7 @@ std::string UriEncode(const std::string & sSrc)
|
||||
|
||||
for (; pSrc < SRC_END; ++pSrc)
|
||||
{
|
||||
if (SAFE[*pSrc])
|
||||
if (SAFE[*pSrc])
|
||||
*pEnd++ = *pSrc;
|
||||
else
|
||||
{
|
||||
@ -494,10 +494,10 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
||||
|
||||
out_buffer.resize(out_buffer_size - dst_bytes);
|
||||
out_buffer.swap(result);
|
||||
|
||||
|
||||
iconv_close(conv_desc);
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ template <typename N>
|
||||
static bool TryParse(const std::string &str, N *const output)
|
||||
{
|
||||
std::istringstream iss(str);
|
||||
|
||||
|
||||
N tmp = 0;
|
||||
if (iss >> tmp)
|
||||
{
|
||||
|
@ -38,11 +38,11 @@ bool SysConf::LoadFromFile(const char *filename)
|
||||
GenerateSysConf();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
u64 size = File::GetSize(filename);
|
||||
if (size != SYSCONF_SIZE)
|
||||
{
|
||||
if (AskYesNoT("Your SYSCONF file is the wrong size.\nIt should be 0x%04x (but is 0x%04llx)\nDo you want to generate a new one?",
|
||||
if (AskYesNoT("Your SYSCONF file is the wrong size.\nIt should be 0x%04x (but is 0x%04llx)\nDo you want to generate a new one?",
|
||||
SYSCONF_SIZE, size))
|
||||
{
|
||||
GenerateSysConf();
|
||||
@ -314,7 +314,7 @@ void SysConf::GenerateSysConf()
|
||||
}
|
||||
const u16 end_data_offset = Common::swap16(current_offset);
|
||||
g.WriteBytes(&end_data_offset, 2);
|
||||
|
||||
|
||||
// Write the items
|
||||
const u8 null_byte = 0;
|
||||
for (int i = 0; i != 27; ++i)
|
||||
@ -398,7 +398,7 @@ void SysConf::UpdateLocation()
|
||||
if (m_IsValid)
|
||||
Save();
|
||||
|
||||
// Clear the old filename and set the default filename to the new user path
|
||||
// Clear the old filename and set the default filename to the new user path
|
||||
// So that it can be generated if the file does not exist in the new location
|
||||
m_Filename.clear();
|
||||
m_FilenameDefault = File::GetUserPath(F_WIISYSCONF_IDX);
|
||||
|
@ -28,7 +28,7 @@ int CurrentThreadId()
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
||||
@ -55,7 +55,7 @@ void SwitchCurrentThread()
|
||||
// Sets the debugger-visible name of the current thread.
|
||||
// Uses undocumented (actually, it is now documented) trick.
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsdebug/html/vxtsksettingthreadname.asp
|
||||
|
||||
|
||||
// This is implemented much nicer in upcoming msvc++, see:
|
||||
// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx
|
||||
void SetCurrentThreadName(const char* szThreadName)
|
||||
@ -84,7 +84,7 @@ void SetCurrentThreadName(const char* szThreadName)
|
||||
__except(EXCEPTION_CONTINUE_EXECUTION)
|
||||
{}
|
||||
}
|
||||
|
||||
|
||||
#else // !WIN32, so must be POSIX threads
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask)
|
||||
|
@ -32,7 +32,7 @@ int CurrentThreadId();
|
||||
|
||||
void SetThreadAffinity(std::thread::native_handle_type thread, u32 mask);
|
||||
void SetCurrentThreadAffinity(u32 mask);
|
||||
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
@ -137,7 +137,7 @@ private:
|
||||
const size_t m_count;
|
||||
volatile size_t m_waiting;
|
||||
};
|
||||
|
||||
|
||||
void SleepCurrentThread(int ms);
|
||||
void SwitchCurrentThread(); // On Linux, this is equal to sleep 1ms
|
||||
|
||||
@ -148,9 +148,9 @@ inline void YieldCPU()
|
||||
{
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
|
||||
void SetCurrentThreadName(const char *name);
|
||||
|
||||
|
||||
} // namespace Common
|
||||
|
||||
#endif // _THREAD_H_
|
||||
|
@ -29,7 +29,7 @@ const char *scm_rev_str = "Dolphin "
|
||||
#else
|
||||
#ifdef _M_ARM
|
||||
#define NP_ARCH "ARM"
|
||||
#else
|
||||
#else
|
||||
#define NP_ARCH "x86"
|
||||
#endif
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@ unsigned int XEmitter::ABI_GetAlignedFrameSize(unsigned int frameSize, bool noPr
|
||||
// On platforms other than Windows 32-bit: At the beginning of a function,
|
||||
// the stack pointer is 4/8 bytes less than a multiple of 16; however, the
|
||||
// function prolog immediately subtracts an appropriate amount to align
|
||||
// it, so no alignment is required around a call.
|
||||
// it, so no alignment is required around a call.
|
||||
// In the functions generated by ThunkManager::ProtectFunction and some
|
||||
// others, we add the necessary subtraction (and 0x20 bytes shadow space
|
||||
// for Win64) into this rather than having a separate prolog.
|
||||
@ -497,12 +497,12 @@ void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
//we only want to do this once
|
||||
PUSH(RBP);
|
||||
MOV(64, R(RBP), R(RSP));
|
||||
PUSH(RBX);
|
||||
PUSH(RSI);
|
||||
PUSH(RBX);
|
||||
PUSH(RSI);
|
||||
PUSH(RDI);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(R15);
|
||||
SUB(64, R(RSP), Imm8(0x28));
|
||||
//TODO: Also preserve XMM0-3?
|
||||
@ -511,12 +511,12 @@ void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
ADD(64, R(RSP), Imm8(0x28));
|
||||
POP(R15);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R12);
|
||||
POP(RDI);
|
||||
POP(RSI);
|
||||
POP(RBX);
|
||||
POP(RSI);
|
||||
POP(RBX);
|
||||
POP(RBP);
|
||||
}
|
||||
|
||||
@ -526,10 +526,10 @@ void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
PUSH(RBP);
|
||||
MOV(64, R(RBP), R(RSP));
|
||||
PUSH(RBX);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(RBX);
|
||||
PUSH(R12);
|
||||
PUSH(R13);
|
||||
PUSH(R14);
|
||||
PUSH(R15);
|
||||
SUB(64, R(RSP), Imm8(8));
|
||||
}
|
||||
@ -537,10 +537,10 @@ void XEmitter::ABI_PushAllCalleeSavedRegsAndAdjustStack() {
|
||||
void XEmitter::ABI_PopAllCalleeSavedRegsAndAdjustStack() {
|
||||
ADD(64, R(RSP), Imm8(8));
|
||||
POP(R15);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R14);
|
||||
POP(R13);
|
||||
POP(R12);
|
||||
POP(RBX);
|
||||
POP(RBX);
|
||||
POP(RBP);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
#else // 64 bit calling convention
|
||||
|
||||
#ifdef _WIN32 // 64-bit Windows - the really exotic calling convention
|
||||
#ifdef _WIN32 // 64-bit Windows - the really exotic calling convention
|
||||
|
||||
#define ABI_PARAM1 RCX
|
||||
#define ABI_PARAM2 RDX
|
||||
|
@ -10,7 +10,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||
u8 rex = 0;
|
||||
u8 codeByte = 0;
|
||||
u8 codeByte2 = 0;
|
||||
|
||||
|
||||
//Check for regular prefix
|
||||
info->operandSize = 4;
|
||||
info->zeroExtend = false;
|
||||
@ -28,7 +28,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||
{
|
||||
info->operandSize = 2;
|
||||
codePtr++;
|
||||
}
|
||||
}
|
||||
else if (*codePtr == 0x67)
|
||||
{
|
||||
codePtr++;
|
||||
@ -47,17 +47,17 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||
|
||||
codeByte = *codePtr++;
|
||||
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
{
|
||||
twoByte = true;
|
||||
twoByte = true;
|
||||
codeByte2 = *codePtr++;
|
||||
}
|
||||
|
||||
if (!twoByte)
|
||||
{
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
((codeByte & 0xF8) == 0xC0 && (codeByte & 0x0E) != 0x02))
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
@ -66,20 +66,20 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((codeByte2 & 0xF0) == 0x00 && (codeByte2 & 0x0F) >= 0x04 && (codeByte2 & 0x0D) != 0x0D) ||
|
||||
(codeByte2 & 0xF0) == 0x30 ||
|
||||
codeByte2 == 0x77 ||
|
||||
(codeByte2 & 0xF0) == 0x80 ||
|
||||
((codeByte2 & 0xF0) == 0xA0 && (codeByte2 & 0x07) <= 0x02) ||
|
||||
(codeByte2 & 0xF8) == 0xC8)
|
||||
if (((codeByte2 & 0xF0) == 0x00 && (codeByte2 & 0x0F) >= 0x04 && (codeByte2 & 0x0D) != 0x0D) ||
|
||||
(codeByte2 & 0xF0) == 0x30 ||
|
||||
codeByte2 == 0x77 ||
|
||||
(codeByte2 & 0xF0) == 0x80 ||
|
||||
((codeByte2 & 0xF0) == 0xA0 && (codeByte2 & 0x07) <= 0x02) ||
|
||||
(codeByte2 & 0xF8) == 0xC8)
|
||||
{
|
||||
// No mod R/M byte
|
||||
// No mod R/M byte
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
hasModRM = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasModRM)
|
||||
@ -99,7 +99,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo *info)
|
||||
}
|
||||
else
|
||||
{
|
||||
//info->scaledReg =
|
||||
//info->scaledReg =
|
||||
}
|
||||
}
|
||||
if (mrm.mod == 1 || mrm.mod == 2)
|
||||
|
@ -114,19 +114,19 @@ void CPUInfo::Detect()
|
||||
OS64bit = (f64 == TRUE) ? true : false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
// Set obvious defaults, for extra safety
|
||||
if (Mode64bit) {
|
||||
bSSE = true;
|
||||
bSSE2 = true;
|
||||
bLongMode = true;
|
||||
}
|
||||
|
||||
|
||||
// Assume CPU supports the CPUID instruction. Those that don't can barely
|
||||
// boot modern OS:es anyway.
|
||||
int cpu_id[4];
|
||||
memset(cpu_string, 0, sizeof(cpu_string));
|
||||
|
||||
|
||||
// Detect CPU's CPUID capabilities, and grab cpu string
|
||||
__cpuid(cpu_id, 0x00000000);
|
||||
u32 max_std_fn = cpu_id[0]; // EAX
|
||||
@ -141,10 +141,10 @@ void CPUInfo::Detect()
|
||||
vendor = VENDOR_AMD;
|
||||
else
|
||||
vendor = VENDOR_OTHER;
|
||||
|
||||
|
||||
// Set reasonable default brand string even if brand string not available.
|
||||
strcpy(brand_string, cpu_string);
|
||||
|
||||
|
||||
// Detect family and other misc stuff.
|
||||
bool ht = false;
|
||||
HTT = ht;
|
||||
@ -189,7 +189,7 @@ void CPUInfo::Detect()
|
||||
}
|
||||
|
||||
num_cores = (logical_cpu_count == 0) ? 1 : logical_cpu_count;
|
||||
|
||||
|
||||
if (max_ex_fn >= 0x80000008) {
|
||||
// Get number of cores. This is a bit complicated. Following AMD manual here.
|
||||
__cpuid(cpu_id, 0x80000008);
|
||||
@ -210,7 +210,7 @@ void CPUInfo::Detect()
|
||||
// Use AMD's new method.
|
||||
num_cores = (cpu_id[2] & 0xFF) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
|
@ -16,7 +16,7 @@ struct NormalOpDef
|
||||
u8 toRm8, toRm32, fromRm8, fromRm32, imm8, imm32, simm8, ext;
|
||||
};
|
||||
|
||||
static const NormalOpDef nops[11] =
|
||||
static const NormalOpDef nops[11] =
|
||||
{
|
||||
{0x00, 0x01, 0x02, 0x03, 0x80, 0x81, 0x83, 0}, //ADD
|
||||
{0x10, 0x11, 0x12, 0x13, 0x80, 0x81, 0x83, 2}, //ADC
|
||||
@ -230,7 +230,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
|
||||
SIB = true;
|
||||
}
|
||||
|
||||
if (scale == SCALE_ATREG && ((_offsetOrBaseReg & 7) == 4))
|
||||
if (scale == SCALE_ATREG && ((_offsetOrBaseReg & 7) == 4))
|
||||
{
|
||||
SIB = true;
|
||||
ireg = _offsetOrBaseReg;
|
||||
@ -255,7 +255,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
|
||||
int oreg = _offsetOrBaseReg;
|
||||
if (SIB)
|
||||
oreg = 4;
|
||||
|
||||
|
||||
// TODO(ector): WTF is this if about? I don't remember writing it :-)
|
||||
//if (RIP)
|
||||
// oreg = 5;
|
||||
@ -268,7 +268,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
|
||||
int ss;
|
||||
switch (scale)
|
||||
{
|
||||
case SCALE_NONE: _offsetOrBaseReg = 4; ss = 0; break; //RSP
|
||||
case SCALE_NONE: _offsetOrBaseReg = 4; ss = 0; break; //RSP
|
||||
case SCALE_1: ss = 0; break;
|
||||
case SCALE_2: ss = 1; break;
|
||||
case SCALE_4: ss = 2; break;
|
||||
@ -299,7 +299,7 @@ void OpArg::WriteRest(XEmitter *emit, int extraBytes, X64Reg _operandReg,
|
||||
// B = base register# upper bit
|
||||
void XEmitter::Rex(int w, int r, int x, int b)
|
||||
{
|
||||
w = w ? 1 : 0;
|
||||
w = w ? 1 : 0;
|
||||
r = r ? 1 : 0;
|
||||
x = x ? 1 : 0;
|
||||
b = b ? 1 : 0;
|
||||
@ -495,7 +495,7 @@ void XEmitter::NOP(int count)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XEmitter::PAUSE() {Write8(0xF3); NOP();} //use in tight spinloops for energy saving on some cpu
|
||||
void XEmitter::CLC() {Write8(0xF8);} //clear carry
|
||||
@ -557,8 +557,8 @@ void XEmitter::CBW(int bits)
|
||||
void XEmitter::PUSH(X64Reg reg) {WriteSimple1Byte(32, 0x50, reg);}
|
||||
void XEmitter::POP(X64Reg reg) {WriteSimple1Byte(32, 0x58, reg);}
|
||||
|
||||
void XEmitter::PUSH(int bits, const OpArg ®)
|
||||
{
|
||||
void XEmitter::PUSH(int bits, const OpArg ®)
|
||||
{
|
||||
if (reg.IsSimpleReg())
|
||||
PUSH(reg.GetSimpleReg());
|
||||
else if (reg.IsImm())
|
||||
@ -594,7 +594,7 @@ void XEmitter::PUSH(int bits, const OpArg ®)
|
||||
}
|
||||
|
||||
void XEmitter::POP(int /*bits*/, const OpArg ®)
|
||||
{
|
||||
{
|
||||
if (reg.IsSimpleReg())
|
||||
POP(reg.GetSimpleReg());
|
||||
else
|
||||
@ -787,7 +787,7 @@ void XEmitter::WriteShift(int bits, OpArg dest, OpArg &shift, int ext)
|
||||
}
|
||||
if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8))
|
||||
{
|
||||
_assert_msg_(DYNA_REC, 0, "WriteShift - illegal argument");
|
||||
_assert_msg_(DYNA_REC, 0, "WriteShift - illegal argument");
|
||||
}
|
||||
dest.operandReg = ext;
|
||||
if (bits == 16) Write8(0x66);
|
||||
@ -834,7 +834,7 @@ void XEmitter::WriteBitTest(int bits, OpArg &dest, OpArg &index, int ext)
|
||||
}
|
||||
if ((index.IsImm() && index.GetImmBits() != 8))
|
||||
{
|
||||
_assert_msg_(DYNA_REC, 0, "WriteBitTest - illegal argument");
|
||||
_assert_msg_(DYNA_REC, 0, "WriteBitTest - illegal argument");
|
||||
}
|
||||
if (bits == 16) Write8(0x66);
|
||||
if (index.IsImm())
|
||||
@ -871,7 +871,7 @@ void XEmitter::SHRD(int bits, OpArg dest, OpArg src, OpArg shift)
|
||||
}
|
||||
if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8))
|
||||
{
|
||||
_assert_msg_(DYNA_REC, 0, "SHRD - illegal shift");
|
||||
_assert_msg_(DYNA_REC, 0, "SHRD - illegal shift");
|
||||
}
|
||||
if (bits == 16) Write8(0x66);
|
||||
X64Reg operand = src.GetSimpleReg();
|
||||
@ -901,7 +901,7 @@ void XEmitter::SHLD(int bits, OpArg dest, OpArg src, OpArg shift)
|
||||
}
|
||||
if ((shift.IsSimpleReg() && shift.GetSimpleReg() != ECX) || (shift.IsImm() && shift.GetImmBits() != 8))
|
||||
{
|
||||
_assert_msg_(DYNA_REC, 0, "SHLD - illegal shift");
|
||||
_assert_msg_(DYNA_REC, 0, "SHLD - illegal shift");
|
||||
}
|
||||
if (bits == 16) Write8(0x66);
|
||||
X64Reg operand = src.GetSimpleReg();
|
||||
@ -954,13 +954,13 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg &o
|
||||
_assert_msg_(DYNA_REC, 0, "WriteNormalOp - Writing to Imm (!toRM)");
|
||||
}
|
||||
|
||||
if (operand.scale == SCALE_IMM8 && bits == 8)
|
||||
if (operand.scale == SCALE_IMM8 && bits == 8)
|
||||
{
|
||||
emit->Write8(nops[op].imm8);
|
||||
immToWrite = 8;
|
||||
}
|
||||
else if ((operand.scale == SCALE_IMM16 && bits == 16) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 64))
|
||||
{
|
||||
emit->Write8(nops[op].imm32);
|
||||
@ -1056,11 +1056,11 @@ void XEmitter::SBB (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(t
|
||||
void XEmitter::AND (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(this, bits, nrmAND, a1, a2);}
|
||||
void XEmitter::OR (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(this, bits, nrmOR , a1, a2);}
|
||||
void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(this, bits, nrmXOR, a1, a2);}
|
||||
void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2)
|
||||
void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
_assert_msg_(DYNA_REC, !a1.IsSimpleReg() || !a2.IsSimpleReg() || a1.GetSimpleReg() != a2.GetSimpleReg(), "Redundant MOV @ %p - bug in JIT?",
|
||||
code);
|
||||
_assert_msg_(DYNA_REC, !a1.IsSimpleReg() || !a2.IsSimpleReg() || a1.GetSimpleReg() != a2.GetSimpleReg(), "Redundant MOV @ %p - bug in JIT?",
|
||||
code);
|
||||
#endif
|
||||
WriteNormalOp(this, bits, nrmMOV, a1, a2);
|
||||
}
|
||||
@ -1188,7 +1188,7 @@ void XEmitter::MOVQ_xmm(OpArg arg, X64Reg src) {
|
||||
|
||||
void XEmitter::WriteMXCSR(OpArg arg, int ext)
|
||||
{
|
||||
if (arg.IsImm() || arg.IsSimpleReg())
|
||||
if (arg.IsImm() || arg.IsSimpleReg())
|
||||
_assert_msg_(DYNA_REC, 0, "MXCSR - invalid operand");
|
||||
|
||||
arg.operandReg = ext;
|
||||
@ -1248,8 +1248,8 @@ void XEmitter::MAXPD(X64Reg regOp, OpArg arg) {WriteSSEOp(64, sseMAX, true, re
|
||||
void XEmitter::SQRTPS(X64Reg regOp, OpArg arg) {WriteSSEOp(32, sseSQRT, true, regOp, arg);}
|
||||
void XEmitter::SQRTPD(X64Reg regOp, OpArg arg) {WriteSSEOp(64, sseSQRT, true, regOp, arg);}
|
||||
void XEmitter::RSQRTPS(X64Reg regOp, OpArg arg) {WriteSSEOp(32, sseRSQRT, true, regOp, arg);}
|
||||
void XEmitter::SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle) {WriteSSEOp(32, sseSHUF, true, regOp, arg,1); Write8(shuffle);}
|
||||
void XEmitter::SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle) {WriteSSEOp(64, sseSHUF, true, regOp, arg,1); Write8(shuffle);}
|
||||
void XEmitter::SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle) {WriteSSEOp(32, sseSHUF, true, regOp, arg,1); Write8(shuffle);}
|
||||
void XEmitter::SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle) {WriteSSEOp(64, sseSHUF, true, regOp, arg,1); Write8(shuffle);}
|
||||
|
||||
void XEmitter::COMISS(X64Reg regOp, OpArg arg) {WriteSSEOp(32, sseCOMIS, true, regOp, arg);} //weird that these should be packed
|
||||
void XEmitter::COMISD(X64Reg regOp, OpArg arg) {WriteSSEOp(64, sseCOMIS, true, regOp, arg);} //ordered
|
||||
@ -1300,7 +1300,7 @@ void XEmitter::UNPCKHPS(X64Reg dest, OpArg arg) {WriteSSEOp(32, 0x15, true, dest
|
||||
void XEmitter::UNPCKLPD(X64Reg dest, OpArg arg) {WriteSSEOp(64, 0x14, true, dest, arg);}
|
||||
void XEmitter::UNPCKHPD(X64Reg dest, OpArg arg) {WriteSSEOp(64, 0x15, true, dest, arg);}
|
||||
|
||||
void XEmitter::MOVDDUP(X64Reg regOp, OpArg arg)
|
||||
void XEmitter::MOVDDUP(X64Reg regOp, OpArg arg)
|
||||
{
|
||||
if (cpu_info.bSSE3)
|
||||
{
|
||||
@ -1456,7 +1456,7 @@ void XEmitter::FWAIT()
|
||||
}
|
||||
|
||||
void XEmitter::RTDSC() { Write8(0x0F); Write8(0x31); }
|
||||
|
||||
|
||||
// helper routines for setting pointers
|
||||
void XEmitter::CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2)
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ enum X64Reg
|
||||
{
|
||||
EAX = 0, EBX = 3, ECX = 1, EDX = 2,
|
||||
ESI = 6, EDI = 7, EBP = 5, ESP = 4,
|
||||
|
||||
|
||||
RAX = 0, RBX = 3, RCX = 1, RDX = 2,
|
||||
RSI = 6, RDI = 7, RBP = 5, RSP = 4,
|
||||
R8 = 8, R9 = 9, R10 = 10,R11 = 11,
|
||||
@ -30,7 +30,7 @@ enum X64Reg
|
||||
AX = 0, BX = 3, CX = 1, DX = 2,
|
||||
SI = 6, DI = 7, BP = 5, SP = 4,
|
||||
|
||||
XMM0=0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
|
||||
XMM0=0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7,
|
||||
XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
|
||||
|
||||
INVALID_REG = 0xFFFFFFFF
|
||||
@ -43,7 +43,7 @@ enum CCFlags
|
||||
CC_B = 2, CC_C = 2, CC_NAE = 2,
|
||||
CC_NB = 3, CC_NC = 3, CC_AE = 3,
|
||||
CC_Z = 4, CC_E = 4,
|
||||
CC_NZ = 5, CC_NE = 5,
|
||||
CC_NZ = 5, CC_NE = 5,
|
||||
CC_BE = 6, CC_NA = 6,
|
||||
CC_NBE = 7, CC_A = 7,
|
||||
CC_S = 8,
|
||||
@ -264,7 +264,7 @@ public:
|
||||
u8 *GetWritableCodePtr();
|
||||
|
||||
// Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU
|
||||
// INC, DEC, LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XCHG, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr.,
|
||||
// INC, DEC, LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XCHG, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr.,
|
||||
// INC and DEC are slow on Intel Core, but not on AMD. They create a
|
||||
// false flag dependency because they only update a subset of the flags.
|
||||
// XCHG is SLOW and should be avoided.
|
||||
@ -353,7 +353,7 @@ public:
|
||||
void DIV(int bits, OpArg src);
|
||||
void IDIV(int bits, OpArg src);
|
||||
|
||||
// Shift
|
||||
// Shift
|
||||
void ROL(int bits, OpArg dest, OpArg shift);
|
||||
void ROR(int bits, OpArg dest, OpArg shift);
|
||||
void RCL(int bits, OpArg dest, OpArg shift);
|
||||
@ -408,7 +408,7 @@ public:
|
||||
|
||||
// Sign/zero extension
|
||||
void MOVSX(int dbits, int sbits, X64Reg dest, OpArg src); //automatically uses MOVSXD if necessary
|
||||
void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src);
|
||||
void MOVZX(int dbits, int sbits, X64Reg dest, OpArg src);
|
||||
|
||||
// WARNING - These two take 11-13 cycles and are VectorPath! (AMD64)
|
||||
void STMXCSR(OpArg memloc);
|
||||
@ -422,40 +422,40 @@ public:
|
||||
void FWAIT();
|
||||
|
||||
// SSE/SSE2: Floating point arithmetic
|
||||
void ADDSS(X64Reg regOp, OpArg arg);
|
||||
void ADDSD(X64Reg regOp, OpArg arg);
|
||||
void SUBSS(X64Reg regOp, OpArg arg);
|
||||
void SUBSD(X64Reg regOp, OpArg arg);
|
||||
void MULSS(X64Reg regOp, OpArg arg);
|
||||
void MULSD(X64Reg regOp, OpArg arg);
|
||||
void DIVSS(X64Reg regOp, OpArg arg);
|
||||
void DIVSD(X64Reg regOp, OpArg arg);
|
||||
void MINSS(X64Reg regOp, OpArg arg);
|
||||
void MINSD(X64Reg regOp, OpArg arg);
|
||||
void MAXSS(X64Reg regOp, OpArg arg);
|
||||
void MAXSD(X64Reg regOp, OpArg arg);
|
||||
void SQRTSS(X64Reg regOp, OpArg arg);
|
||||
void SQRTSD(X64Reg regOp, OpArg arg);
|
||||
void ADDSS(X64Reg regOp, OpArg arg);
|
||||
void ADDSD(X64Reg regOp, OpArg arg);
|
||||
void SUBSS(X64Reg regOp, OpArg arg);
|
||||
void SUBSD(X64Reg regOp, OpArg arg);
|
||||
void MULSS(X64Reg regOp, OpArg arg);
|
||||
void MULSD(X64Reg regOp, OpArg arg);
|
||||
void DIVSS(X64Reg regOp, OpArg arg);
|
||||
void DIVSD(X64Reg regOp, OpArg arg);
|
||||
void MINSS(X64Reg regOp, OpArg arg);
|
||||
void MINSD(X64Reg regOp, OpArg arg);
|
||||
void MAXSS(X64Reg regOp, OpArg arg);
|
||||
void MAXSD(X64Reg regOp, OpArg arg);
|
||||
void SQRTSS(X64Reg regOp, OpArg arg);
|
||||
void SQRTSD(X64Reg regOp, OpArg arg);
|
||||
void RSQRTSS(X64Reg regOp, OpArg arg);
|
||||
|
||||
// SSE/SSE2: Floating point bitwise (yes)
|
||||
void CMPSS(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void CMPSD(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void ANDSS(X64Reg regOp, OpArg arg);
|
||||
void ANDSD(X64Reg regOp, OpArg arg);
|
||||
void ANDNSS(X64Reg regOp, OpArg arg);
|
||||
void ANDNSD(X64Reg regOp, OpArg arg);
|
||||
void ORSS(X64Reg regOp, OpArg arg);
|
||||
void ORSD(X64Reg regOp, OpArg arg);
|
||||
void XORSS(X64Reg regOp, OpArg arg);
|
||||
void XORSD(X64Reg regOp, OpArg arg);
|
||||
void CMPSS(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void CMPSD(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void ANDSS(X64Reg regOp, OpArg arg);
|
||||
void ANDSD(X64Reg regOp, OpArg arg);
|
||||
void ANDNSS(X64Reg regOp, OpArg arg);
|
||||
void ANDNSD(X64Reg regOp, OpArg arg);
|
||||
void ORSS(X64Reg regOp, OpArg arg);
|
||||
void ORSD(X64Reg regOp, OpArg arg);
|
||||
void XORSS(X64Reg regOp, OpArg arg);
|
||||
void XORSD(X64Reg regOp, OpArg arg);
|
||||
|
||||
// SSE/SSE2: Floating point packed arithmetic (x4 for float, x2 for double)
|
||||
void ADDPS(X64Reg regOp, OpArg arg);
|
||||
void ADDPD(X64Reg regOp, OpArg arg);
|
||||
void SUBPS(X64Reg regOp, OpArg arg);
|
||||
void SUBPD(X64Reg regOp, OpArg arg);
|
||||
void CMPPS(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void ADDPS(X64Reg regOp, OpArg arg);
|
||||
void ADDPD(X64Reg regOp, OpArg arg);
|
||||
void SUBPS(X64Reg regOp, OpArg arg);
|
||||
void SUBPD(X64Reg regOp, OpArg arg);
|
||||
void CMPPS(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void CMPPD(X64Reg regOp, OpArg arg, u8 compare);
|
||||
void MULPS(X64Reg regOp, OpArg arg);
|
||||
void MULPD(X64Reg regOp, OpArg arg);
|
||||
@ -470,8 +470,8 @@ public:
|
||||
void RSQRTPS(X64Reg regOp, OpArg arg);
|
||||
|
||||
// SSE/SSE2: Floating point packed bitwise (x4 for float, x2 for double)
|
||||
void ANDPS(X64Reg regOp, OpArg arg);
|
||||
void ANDPD(X64Reg regOp, OpArg arg);
|
||||
void ANDPS(X64Reg regOp, OpArg arg);
|
||||
void ANDPD(X64Reg regOp, OpArg arg);
|
||||
void ANDNPS(X64Reg regOp, OpArg arg);
|
||||
void ANDNPD(X64Reg regOp, OpArg arg);
|
||||
void ORPS(X64Reg regOp, OpArg arg);
|
||||
@ -480,9 +480,9 @@ public:
|
||||
void XORPD(X64Reg regOp, OpArg arg);
|
||||
|
||||
// SSE/SSE2: Shuffle components. These are tricky - see Intel documentation.
|
||||
void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle);
|
||||
void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle);
|
||||
|
||||
void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle);
|
||||
void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle);
|
||||
|
||||
// SSE/SSE2: Useful alternative to shuffle in some cases.
|
||||
void MOVDDUP(X64Reg regOp, OpArg arg);
|
||||
|
||||
@ -554,51 +554,51 @@ public:
|
||||
void PUNPCKLDQ(X64Reg dest, const OpArg &arg);
|
||||
|
||||
void PAND(X64Reg dest, OpArg arg);
|
||||
void PANDN(X64Reg dest, OpArg arg);
|
||||
void PXOR(X64Reg dest, OpArg arg);
|
||||
void POR(X64Reg dest, OpArg arg);
|
||||
void PANDN(X64Reg dest, OpArg arg);
|
||||
void PXOR(X64Reg dest, OpArg arg);
|
||||
void POR(X64Reg dest, OpArg arg);
|
||||
|
||||
void PADDB(X64Reg dest, OpArg arg);
|
||||
void PADDW(X64Reg dest, OpArg arg);
|
||||
void PADDD(X64Reg dest, OpArg arg);
|
||||
void PADDQ(X64Reg dest, OpArg arg);
|
||||
void PADDW(X64Reg dest, OpArg arg);
|
||||
void PADDD(X64Reg dest, OpArg arg);
|
||||
void PADDQ(X64Reg dest, OpArg arg);
|
||||
|
||||
void PADDSB(X64Reg dest, OpArg arg);
|
||||
void PADDSW(X64Reg dest, OpArg arg);
|
||||
void PADDUSB(X64Reg dest, OpArg arg);
|
||||
void PADDUSW(X64Reg dest, OpArg arg);
|
||||
void PADDSB(X64Reg dest, OpArg arg);
|
||||
void PADDSW(X64Reg dest, OpArg arg);
|
||||
void PADDUSB(X64Reg dest, OpArg arg);
|
||||
void PADDUSW(X64Reg dest, OpArg arg);
|
||||
|
||||
void PSUBB(X64Reg dest, OpArg arg);
|
||||
void PSUBW(X64Reg dest, OpArg arg);
|
||||
void PSUBD(X64Reg dest, OpArg arg);
|
||||
void PSUBQ(X64Reg dest, OpArg arg);
|
||||
void PSUBB(X64Reg dest, OpArg arg);
|
||||
void PSUBW(X64Reg dest, OpArg arg);
|
||||
void PSUBD(X64Reg dest, OpArg arg);
|
||||
void PSUBQ(X64Reg dest, OpArg arg);
|
||||
|
||||
void PSUBSB(X64Reg dest, OpArg arg);
|
||||
void PSUBSW(X64Reg dest, OpArg arg);
|
||||
void PSUBUSB(X64Reg dest, OpArg arg);
|
||||
void PSUBUSW(X64Reg dest, OpArg arg);
|
||||
void PSUBSB(X64Reg dest, OpArg arg);
|
||||
void PSUBSW(X64Reg dest, OpArg arg);
|
||||
void PSUBUSB(X64Reg dest, OpArg arg);
|
||||
void PSUBUSW(X64Reg dest, OpArg arg);
|
||||
|
||||
void PAVGB(X64Reg dest, OpArg arg);
|
||||
void PAVGW(X64Reg dest, OpArg arg);
|
||||
void PAVGB(X64Reg dest, OpArg arg);
|
||||
void PAVGW(X64Reg dest, OpArg arg);
|
||||
|
||||
void PCMPEQB(X64Reg dest, OpArg arg);
|
||||
void PCMPEQW(X64Reg dest, OpArg arg);
|
||||
void PCMPEQD(X64Reg dest, OpArg arg);
|
||||
void PCMPEQB(X64Reg dest, OpArg arg);
|
||||
void PCMPEQW(X64Reg dest, OpArg arg);
|
||||
void PCMPEQD(X64Reg dest, OpArg arg);
|
||||
|
||||
void PCMPGTB(X64Reg dest, OpArg arg);
|
||||
void PCMPGTW(X64Reg dest, OpArg arg);
|
||||
void PCMPGTD(X64Reg dest, OpArg arg);
|
||||
void PCMPGTB(X64Reg dest, OpArg arg);
|
||||
void PCMPGTW(X64Reg dest, OpArg arg);
|
||||
void PCMPGTD(X64Reg dest, OpArg arg);
|
||||
|
||||
void PEXTRW(X64Reg dest, OpArg arg, u8 subreg);
|
||||
void PINSRW(X64Reg dest, OpArg arg, u8 subreg);
|
||||
|
||||
void PMADDWD(X64Reg dest, OpArg arg);
|
||||
void PSADBW(X64Reg dest, OpArg arg);
|
||||
void PMADDWD(X64Reg dest, OpArg arg);
|
||||
void PSADBW(X64Reg dest, OpArg arg);
|
||||
|
||||
void PMAXSW(X64Reg dest, OpArg arg);
|
||||
void PMAXUB(X64Reg dest, OpArg arg);
|
||||
void PMINSW(X64Reg dest, OpArg arg);
|
||||
void PMINUB(X64Reg dest, OpArg arg);
|
||||
void PMAXSW(X64Reg dest, OpArg arg);
|
||||
void PMAXUB(X64Reg dest, OpArg arg);
|
||||
void PMINSW(X64Reg dest, OpArg arg);
|
||||
void PMINUB(X64Reg dest, OpArg arg);
|
||||
|
||||
void PMOVMSKB(X64Reg dest, OpArg arg);
|
||||
void PSHUFB(X64Reg dest, OpArg arg);
|
||||
@ -625,7 +625,7 @@ public:
|
||||
|
||||
void ABI_CallFunctionC16(void *func, u16 param1);
|
||||
void ABI_CallFunctionCC16(void *func, u32 param1, u16 param2);
|
||||
|
||||
|
||||
// These only support u32 parameters, but that's enough for a lot of uses.
|
||||
// These will destroy the 1 or 2 first "parameter regs".
|
||||
void ABI_CallFunctionC(void *func, u32 param1);
|
||||
@ -666,12 +666,12 @@ public:
|
||||
void CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
|
||||
void CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5);
|
||||
|
||||
#if defined(_M_IX86)
|
||||
#if defined(_M_IX86)
|
||||
|
||||
#define CallCdeclFunction3_I(a,b,c,d) CallCdeclFunction3((void *)(a), (b), (c), (d))
|
||||
#define CallCdeclFunction4_I(a,b,c,d,e) CallCdeclFunction4((void *)(a), (b), (c), (d), (e))
|
||||
#define CallCdeclFunction5_I(a,b,c,d,e,f) CallCdeclFunction5((void *)(a), (b), (c), (d), (e), (f))
|
||||
#define CallCdeclFunction6_I(a,b,c,d,e,f,g) CallCdeclFunction6((void *)(a), (b), (c), (d), (e), (f), (g))
|
||||
#define CallCdeclFunction4_I(a,b,c,d,e) CallCdeclFunction4((void *)(a), (b), (c), (d), (e))
|
||||
#define CallCdeclFunction5_I(a,b,c,d,e,f) CallCdeclFunction5((void *)(a), (b), (c), (d), (e), (f))
|
||||
#define CallCdeclFunction6_I(a,b,c,d,e,f,g) CallCdeclFunction6((void *)(a), (b), (c), (d), (e), (f), (g))
|
||||
|
||||
#define DECLARE_IMPORT(x)
|
||||
|
||||
@ -722,7 +722,7 @@ public:
|
||||
|
||||
// Always clear code space with breakpoints, so that if someone accidentally executes
|
||||
// uninitialized, it just breaks into the debugger.
|
||||
void ClearCodeSpace()
|
||||
void ClearCodeSpace()
|
||||
{
|
||||
// x86/64: 0xCC = breakpoint
|
||||
memset(region, 0xCC, region_size);
|
||||
|
@ -30,7 +30,7 @@ namespace FPURoundMode
|
||||
#ifdef _M_IX86
|
||||
// This shouldn't really be needed anymore since we use SSE
|
||||
#ifdef _WIN32
|
||||
const int table[4] =
|
||||
const int table[4] =
|
||||
{
|
||||
_RC_NEAR,
|
||||
_RC_CHOP,
|
||||
@ -39,7 +39,7 @@ namespace FPURoundMode
|
||||
};
|
||||
_set_controlfp(_MCW_RC, table[mode]);
|
||||
#else
|
||||
const unsigned short table[4] =
|
||||
const unsigned short table[4] =
|
||||
{
|
||||
FPU_ROUND_NEAR,
|
||||
FPU_ROUND_CHOP,
|
||||
@ -81,7 +81,7 @@ namespace FPURoundMode
|
||||
}
|
||||
void SetSIMDMode(u32 mode)
|
||||
{
|
||||
static const u32 ssetable[4] =
|
||||
static const u32 ssetable[4] =
|
||||
{
|
||||
(0 << 13) | MASKS,
|
||||
(3 << 13) | MASKS,
|
||||
|
Reference in New Issue
Block a user