mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Clean up more space/tab mismatches in AudioCommon, Common, and VideoCommon.
Not planning to touch Core since it's the most actively changed part of the project.
This commit is contained in:
@ -33,7 +33,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))
|
||||
@ -74,12 +74,12 @@ int GetCoreCount()
|
||||
const char marker[] = "processor\t: ";
|
||||
int cores = 0;
|
||||
char buf[1024];
|
||||
|
||||
|
||||
File::IOFile file(procfile, "r");
|
||||
auto const fp = file.GetHandle();
|
||||
if (!fp)
|
||||
return 0;
|
||||
|
||||
|
||||
while (fgets(buf, sizeof(buf), fp))
|
||||
{
|
||||
if (strncmp(buf, marker, sizeof(marker) - 1))
|
||||
@ -103,12 +103,12 @@ void CPUInfo::Detect()
|
||||
HTT = false;
|
||||
OS64bit = false;
|
||||
CPU64bit = false;
|
||||
Mode64bit = false;
|
||||
Mode64bit = false;
|
||||
vendor = VENDOR_ARM;
|
||||
|
||||
|
||||
// Get the information about the CPU
|
||||
strncpy(cpu_string, GetCPUString(), sizeof(cpu_string));
|
||||
num_cores = GetCoreCount();
|
||||
num_cores = GetCoreCount();
|
||||
bSwp = CheckCPUFeature("swp");
|
||||
bHalf = CheckCPUFeature("half");
|
||||
bThumb = CheckCPUFeature("thumb");
|
||||
@ -122,7 +122,7 @@ void CPUInfo::Detect()
|
||||
bVFPv4 = CheckCPUFeature("vfpv4");
|
||||
bIDIVa = CheckCPUFeature("idiva");
|
||||
bIDIVt = CheckCPUFeature("idivt");
|
||||
|
||||
|
||||
// On some buggy kernels(Qualcomm) they show that they support VFPv4 but not IDIVa
|
||||
// All VFPv4 CPUs will support IDIVa
|
||||
if (bVFPv4)
|
||||
|
@ -157,7 +157,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
|
||||
{
|
||||
Operand2 op2;
|
||||
bool inverse;
|
||||
|
||||
|
||||
if (cpu_info.bArmV7 && !optimize)
|
||||
{
|
||||
// For backpatching on ARMv7
|
||||
|
@ -136,7 +136,7 @@ protected:
|
||||
u32 Value;
|
||||
|
||||
private:
|
||||
OpType Type;
|
||||
OpType Type;
|
||||
|
||||
// IMM types
|
||||
u8 Rotation; // Only for u8 values
|
||||
@ -154,7 +154,7 @@ public:
|
||||
{
|
||||
Type = type;
|
||||
Value = imm;
|
||||
Rotation = 0;
|
||||
Rotation = 0;
|
||||
}
|
||||
|
||||
Operand2(ARMReg Reg)
|
||||
@ -297,7 +297,7 @@ public:
|
||||
u32 Imm24()
|
||||
{
|
||||
_assert_msg_(DYNA_REC, (Type == TYPE_IMM), "Imm16 not IMM");
|
||||
return (Value & 0x0FFFFFFF);
|
||||
return (Value & 0x0FFFFFFF);
|
||||
}
|
||||
// NEON and ASIMD specific
|
||||
u32 Imm8ASIMD()
|
||||
@ -336,9 +336,9 @@ struct FixupBranch
|
||||
|
||||
struct LiteralPool
|
||||
{
|
||||
s32 loc;
|
||||
u8* ldr_address;
|
||||
u32 val;
|
||||
s32 loc;
|
||||
u8* ldr_address;
|
||||
u32 val;
|
||||
};
|
||||
|
||||
typedef const u8* JumpTarget;
|
||||
@ -357,7 +357,7 @@ private:
|
||||
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, ARMReg op2);
|
||||
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, Operand2 op2);
|
||||
void WriteSignedMultiply(u32 Op, u32 Op2, u32 Op3, ARMReg dest, ARMReg r1, ARMReg r2);
|
||||
|
||||
|
||||
u32 EncodeVd(ARMReg Vd);
|
||||
u32 EncodeVn(ARMReg Vn);
|
||||
u32 EncodeVm(ARMReg Vm);
|
||||
@ -407,10 +407,10 @@ public:
|
||||
|
||||
// Hint instruction
|
||||
void YIELD();
|
||||
|
||||
|
||||
// Do nothing
|
||||
void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals)
|
||||
|
||||
|
||||
#ifdef CALL
|
||||
#undef CALL
|
||||
#endif
|
||||
@ -422,7 +422,7 @@ public:
|
||||
FixupBranch BL();
|
||||
FixupBranch BL_CC(CCFlags Cond);
|
||||
void SetJumpTarget(FixupBranch const &branch);
|
||||
|
||||
|
||||
void B (const void *fnptr);
|
||||
void B (ARMReg src);
|
||||
void BL(const void *fnptr);
|
||||
@ -468,7 +468,7 @@ public:
|
||||
void BICS(ARMReg dest, ARMReg src, Operand2 op2);
|
||||
void MVN (ARMReg dest, Operand2 op2);
|
||||
void MVNS(ARMReg dest, Operand2 op2);
|
||||
void MOVW(ARMReg dest, Operand2 op2);
|
||||
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
|
||||
@ -510,7 +510,7 @@ public:
|
||||
|
||||
void STMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
|
||||
void LDMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
|
||||
|
||||
|
||||
// Exclusive Access operations
|
||||
void LDREX(ARMReg dest, ARMReg base);
|
||||
// result contains the result if the instruction managed to store the value
|
||||
@ -528,7 +528,7 @@ public:
|
||||
// NEON Only
|
||||
void VADD(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSUB(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
|
||||
|
||||
// VFP Only
|
||||
void VLDR(ARMReg Dest, ARMReg Base, s16 offset);
|
||||
void VSTR(ARMReg Src, ARMReg Base, s16 offset);
|
||||
@ -539,7 +539,7 @@ public:
|
||||
void VCMPE(ARMReg Vd);
|
||||
void VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSQRT(ARMReg Vd, ARMReg Vm);
|
||||
|
||||
|
||||
// NEON and VFP
|
||||
void VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
void VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm);
|
||||
|
@ -27,9 +27,9 @@ class DebugInterface;
|
||||
|
||||
struct TBreakPoint
|
||||
{
|
||||
u32 iAddress;
|
||||
u32 iAddress;
|
||||
bool bOn;
|
||||
bool bTemporary;
|
||||
bool bTemporary;
|
||||
};
|
||||
|
||||
struct TMemCheck
|
||||
@ -96,9 +96,9 @@ public:
|
||||
typedef std::vector<std::string> TMemChecksStr;
|
||||
|
||||
TMemChecks m_MemChecks;
|
||||
|
||||
|
||||
const TMemChecks& GetMemChecks() { return m_MemChecks; }
|
||||
|
||||
|
||||
TMemChecksStr GetStrings() const;
|
||||
void AddFromStrings(const TMemChecksStr& mcs);
|
||||
|
||||
|
@ -32,13 +32,13 @@ enum CPUVendor
|
||||
struct CPUInfo
|
||||
{
|
||||
CPUVendor vendor;
|
||||
|
||||
|
||||
char cpu_string[0x21];
|
||||
char brand_string[0x41];
|
||||
bool OS64bit;
|
||||
bool CPU64bit;
|
||||
bool Mode64bit;
|
||||
|
||||
|
||||
bool HTT;
|
||||
int num_cores;
|
||||
int logical_cpu_count;
|
||||
@ -56,7 +56,7 @@ struct CPUInfo
|
||||
bool bAES;
|
||||
bool bLAHFSAHF64;
|
||||
bool bLongMode;
|
||||
|
||||
|
||||
// ARM specific CPUInfo
|
||||
bool bSwp;
|
||||
bool bHalf;
|
||||
@ -72,14 +72,14 @@ struct CPUInfo
|
||||
bool bIDIVa;
|
||||
bool bIDIVt;
|
||||
bool bArmV7; // enable MOVT, MOVW etc
|
||||
|
||||
|
||||
// ARMv8 specific
|
||||
bool bFP;
|
||||
bool bASIMD;
|
||||
|
||||
// Call Detect()
|
||||
explicit CPUInfo();
|
||||
|
||||
|
||||
// Turn the cpu info into a string we can show
|
||||
std::string Summarize();
|
||||
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
{
|
||||
u32 count = (u32)x.size();
|
||||
Do(count);
|
||||
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case MODE_READ:
|
||||
@ -81,7 +81,7 @@ public:
|
||||
x.insert(pair);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case MODE_WRITE:
|
||||
case MODE_MEASURE:
|
||||
case MODE_VERIFY:
|
||||
@ -93,14 +93,14 @@ public:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void DoContainer(T& x)
|
||||
{
|
||||
u32 size = (u32)x.size();
|
||||
Do(size);
|
||||
x.resize(size);
|
||||
|
||||
|
||||
for (auto itr = x.begin(); itr != x.end(); ++itr)
|
||||
Do(*itr);
|
||||
}
|
||||
@ -110,32 +110,32 @@ public:
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::list<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::deque<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void Do(std::basic_string<T>& x)
|
||||
{
|
||||
DoContainer(x);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template <typename T>
|
||||
void DoArray(T* x, u32 count)
|
||||
{
|
||||
for (u32 i = 0; i != count; ++i)
|
||||
Do(x[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Do(T& x)
|
||||
{
|
||||
@ -220,7 +220,7 @@ public:
|
||||
{
|
||||
u32 cookie = arbitraryNumber;
|
||||
Do(cookie);
|
||||
|
||||
|
||||
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
|
||||
{
|
||||
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...",
|
||||
@ -228,7 +228,7 @@ public:
|
||||
mode = PointerWrap::MODE_MEASURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
__forceinline void DoByte(u8& x)
|
||||
{
|
||||
@ -237,27 +237,27 @@ private:
|
||||
case MODE_READ:
|
||||
x = **ptr;
|
||||
break;
|
||||
|
||||
|
||||
case MODE_WRITE:
|
||||
**ptr = x;
|
||||
break;
|
||||
|
||||
|
||||
case MODE_MEASURE:
|
||||
break;
|
||||
|
||||
|
||||
case MODE_VERIFY:
|
||||
_dbg_assert_msg_(COMMON, (x == **ptr),
|
||||
"Savestate verification failure: %d (0x%X) (at %p) != %d (0x%X) (at %p).\n",
|
||||
x, x, &x, **ptr, **ptr, *ptr);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
++(*ptr);
|
||||
}
|
||||
|
||||
|
||||
void DoVoid(void *data, u32 size)
|
||||
{
|
||||
for(u32 i = 0; i != size; ++i)
|
||||
@ -300,7 +300,7 @@ public:
|
||||
ERROR_LOG(COMMON,"ChunkReader: Bad header size");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check revision
|
||||
if (header.Revision != _Revision)
|
||||
{
|
||||
@ -308,7 +308,7 @@ public:
|
||||
header.Revision, _Revision);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// get size
|
||||
const u32 sz = (u32)(fileSize - headerSize);
|
||||
if (header.ExpectedSize != sz)
|
||||
@ -317,7 +317,7 @@ public:
|
||||
sz, header.ExpectedSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// read the state
|
||||
std::vector<u8> buffer(sz);
|
||||
if (!pFile.ReadArray(&buffer[0], sz))
|
||||
@ -333,7 +333,7 @@ public:
|
||||
INFO_LOG(COMMON, "ChunkReader: Done loading %s" , _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Save file template
|
||||
template<class T>
|
||||
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
|
||||
@ -355,12 +355,12 @@ public:
|
||||
ptr = &buffer[0];
|
||||
p.SetMode(PointerWrap::MODE_WRITE);
|
||||
_class.DoState(p);
|
||||
|
||||
|
||||
// Create header
|
||||
SChunkHeader header;
|
||||
header.Revision = _Revision;
|
||||
header.ExpectedSize = (u32)sz;
|
||||
|
||||
|
||||
// Write to file
|
||||
if (!pFile.WriteArray(&header, 1))
|
||||
{
|
||||
@ -373,11 +373,11 @@ public:
|
||||
ERROR_LOG(COMMON,"ChunkReader: Failed writing data");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
INFO_LOG(COMMON,"ChunkReader: Done writing %s", _rFilename.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
struct SChunkHeader
|
||||
{
|
||||
|
@ -68,9 +68,9 @@ _mm_shuffle_epi8(__m128i a, __m128i mask)
|
||||
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
|
||||
|
||||
inline u32 _rotl(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x << shift) | (x >> (32 - shift));
|
||||
}
|
||||
|
||||
inline u64 _rotl64(u64 x, unsigned int shift){
|
||||
@ -79,9 +79,9 @@ inline u64 _rotl64(u64 x, unsigned int shift){
|
||||
}
|
||||
|
||||
inline u32 _rotr(u32 x, int shift) {
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
shift &= 31;
|
||||
if (!shift) return x;
|
||||
return (x >> shift) | (x << (32 - shift));
|
||||
}
|
||||
|
||||
inline u64 _rotr64(u64 x, unsigned int shift){
|
||||
|
@ -56,7 +56,7 @@
|
||||
#define SHARED_USER_DIR File::GetBundleDirectory() + \
|
||||
DIR_SEP USERDATA_DIR DIR_SEP
|
||||
#elif defined ANDROID
|
||||
#define SYSDATA_DIR "/sdcard/dolphin-emu"
|
||||
#define SYSDATA_DIR "/sdcard/dolphin-emu"
|
||||
#else
|
||||
#ifdef DATA_DIR
|
||||
#define SYSDATA_DIR DATA_DIR "sys"
|
||||
@ -127,9 +127,9 @@
|
||||
#define GC_MEMCARDA "MemoryCardA"
|
||||
#define GC_MEMCARDB "MemoryCardB"
|
||||
|
||||
#define WII_STATE "state.dat"
|
||||
#define WII_STATE "state.dat"
|
||||
|
||||
#define WII_SETTING "setting.txt"
|
||||
#define WII_SETTING "setting.txt"
|
||||
#define WII_EUR_SETTING "setting-eur.txt"
|
||||
#define WII_USA_SETTING "setting-usa.txt"
|
||||
#define WII_JAP_SETTING "setting-jpn.txt"
|
||||
|
@ -227,7 +227,7 @@ void ConsoleListener::PixelSpace(int Left, int Top, int Width, int Height, bool
|
||||
LetterSpace(LBufWidth, LBufHeight);
|
||||
|
||||
|
||||
ClearScreen(true);
|
||||
ClearScreen(true);
|
||||
coordScreen.Y = 0;
|
||||
coordScreen.X = 0;
|
||||
DWORD cCharsWritten = 0;
|
||||
@ -270,7 +270,7 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
|
||||
*/
|
||||
DWORD cCharsWritten;
|
||||
WORD Color;
|
||||
|
||||
|
||||
switch (Level)
|
||||
{
|
||||
case NOTICE_LEVEL: // light green
|
||||
@ -334,9 +334,9 @@ void ConsoleListener::ClearScreen(bool Cursor)
|
||||
DWORD cCharsWritten;
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
DWORD dwConSize;
|
||||
|
||||
|
||||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
|
||||
GetConsoleScreenBufferInfo(hConsole, &csbi);
|
||||
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
|
||||
// Write space to the entire console
|
||||
|
@ -25,7 +25,7 @@
|
||||
#pragma comment( lib, "imagehlp.lib" )
|
||||
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
|
||||
#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
|
||||
#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
|
||||
#define STACKTRACE(file) StackTrace( GetCurrentThread(), "", file)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), "", file, eip, esp, ebp)
|
||||
// class File;
|
||||
@ -43,10 +43,10 @@ extern char g_uefbuf[UEFBUFSIZE];
|
||||
|
||||
#else // not WIN32
|
||||
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
|
||||
#define EXTENDEDTRACEUNINITIALIZE() ((void)0)
|
||||
#define STACKTRACE(file) ((void)0)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) ((void)0)
|
||||
#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
|
||||
#define EXTENDEDTRACEUNINITIALIZE() ((void)0)
|
||||
#define STACKTRACE(file) ((void)0)
|
||||
#define STACKTRACE2(file, eip, esp, ebp) ((void)0)
|
||||
|
||||
#endif // WIN32
|
||||
|
||||
|
@ -38,11 +38,12 @@ namespace FPURoundMode
|
||||
|
||||
void SetSIMDMode(u32 mode);
|
||||
|
||||
/*
|
||||
There are two different flavors of float to int conversion:
|
||||
_mm_cvtps_epi32() and _mm_cvttps_epi32(). The first rounds
|
||||
according to the MXCSR rounding bits. The second one always
|
||||
uses round towards zero.
|
||||
/*
|
||||
* There are two different flavors of float to int conversion:
|
||||
* _mm_cvtps_epi32() and _mm_cvttps_epi32().
|
||||
*
|
||||
* The first rounds according to the MXCSR rounding bits.
|
||||
* The second one always uses round towards zero.
|
||||
*/
|
||||
void SaveSIMDState();
|
||||
void LoadSIMDState();
|
||||
|
@ -190,7 +190,7 @@ bool CreateFullPath(const std::string &fullPath)
|
||||
{
|
||||
int panicCounter = 100;
|
||||
INFO_LOG(COMMON, "CreateFullPath: path %s", fullPath.c_str());
|
||||
|
||||
|
||||
if (File::Exists(fullPath))
|
||||
{
|
||||
INFO_LOG(COMMON, "CreateFullPath: path exists %s", fullPath.c_str());
|
||||
@ -206,7 +206,7 @@ bool CreateFullPath(const std::string &fullPath)
|
||||
// we're done, yay!
|
||||
if (position == fullPath.npos)
|
||||
return true;
|
||||
|
||||
|
||||
// Include the '/' so the first call is CreateDir("/") rather than CreateDir("")
|
||||
std::string const subPath(fullPath.substr(0, position + 1));
|
||||
if (!File::IsDirectory(subPath))
|
||||
@ -486,7 +486,7 @@ u32 ScanDirectoryTree(const std::string &directory, FSTEntry& parentEntry)
|
||||
return foundEntries;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const std::string &directory)
|
||||
{
|
||||
@ -501,7 +501,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
FindClose(hFind);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// windows loop
|
||||
do
|
||||
{
|
||||
@ -532,7 +532,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#endif
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -543,7 +543,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
#ifndef _WIN32
|
||||
closedir(dirp);
|
||||
#endif
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -605,7 +605,7 @@ std::string GetCurrentDir()
|
||||
if (!(dir = __getcwd(NULL, 0))) {
|
||||
|
||||
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
|
||||
GetLastErrorMsg());
|
||||
GetLastErrorMsg());
|
||||
return NULL;
|
||||
}
|
||||
std::string strDir = dir;
|
||||
@ -849,7 +849,7 @@ bool IOFile::Seek(s64 off, int origin)
|
||||
}
|
||||
|
||||
u64 IOFile::Tell()
|
||||
{
|
||||
{
|
||||
if (IsOpen())
|
||||
return ftello(m_file);
|
||||
else
|
||||
|
@ -119,7 +119,7 @@ u32 HashEctor(const u8* ptr, int length)
|
||||
|
||||
inline u64 getblock(const u64 * p, int i)
|
||||
{
|
||||
return p[i];
|
||||
return p[i];
|
||||
}
|
||||
|
||||
//----------
|
||||
@ -127,25 +127,25 @@ 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 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
k1 *= c1;
|
||||
k1 = _rotl64(k1,23);
|
||||
k1 *= c2;
|
||||
h1 ^= k1;
|
||||
h1 += h2;
|
||||
|
||||
h2 = _rotl64(h2,41);
|
||||
h2 = _rotl64(h2,41);
|
||||
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
k2 *= c2;
|
||||
k2 = _rotl64(k2,23);
|
||||
k2 *= c1;
|
||||
h2 ^= k2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
h1 = h1*3+0x52dce729;
|
||||
h2 = h2*3+0x38495ab5;
|
||||
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
c1 = c1*5+0x7b7d159c;
|
||||
c2 = c2*5+0x6bce6396;
|
||||
}
|
||||
|
||||
//----------
|
||||
@ -153,87 +153,87 @@ inline void bmix64(u64 & h1, u64 & h2, u64 & k1, u64 & k2, u64 & c1, u64 & c2)
|
||||
|
||||
inline u64 fmix64(u64 k)
|
||||
{
|
||||
k ^= k >> 33;
|
||||
k *= 0xff51afd7ed558ccd;
|
||||
k ^= k >> 33;
|
||||
k *= 0xc4ceb9fe1a85ec53;
|
||||
k ^= k >> 33;
|
||||
k ^= k >> 33;
|
||||
k *= 0xff51afd7ed558ccd;
|
||||
k ^= k >> 33;
|
||||
k *= 0xc4ceb9fe1a85ec53;
|
||||
k ^= k >> 33;
|
||||
|
||||
return k;
|
||||
return k;
|
||||
}
|
||||
|
||||
u64 GetMurmurHash3(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u8 * data = (const u8*)src;
|
||||
const int nblocks = len / 16;
|
||||
const u8 * data = (const u8*)src;
|
||||
const int nblocks = len / 16;
|
||||
u32 Step = (len / 8);
|
||||
if(samples == 0) samples = max(Step, 1u);
|
||||
Step = Step / samples;
|
||||
if(Step < 1) Step = 1;
|
||||
|
||||
u64 h1 = 0x9368e53c2f6af274;
|
||||
u64 h2 = 0x586dcd208f7cd3fd;
|
||||
u64 h1 = 0x9368e53c2f6af274;
|
||||
u64 h2 = 0x586dcd208f7cd3fd;
|
||||
|
||||
u64 c1 = 0x87c37b91114253d5;
|
||||
u64 c2 = 0x4cf5ad432745937f;
|
||||
u64 c1 = 0x87c37b91114253d5;
|
||||
u64 c2 = 0x4cf5ad432745937f;
|
||||
|
||||
|
||||
//----------
|
||||
// body
|
||||
//----------
|
||||
// body
|
||||
|
||||
const u64 * blocks = (const u64 *)(data);
|
||||
const u64 * blocks = (const u64 *)(data);
|
||||
|
||||
for(int i = 0; i < nblocks; i+=Step)
|
||||
{
|
||||
u64 k1 = getblock(blocks,i*2+0);
|
||||
u64 k2 = getblock(blocks,i*2+1);
|
||||
for(int i = 0; i < nblocks; i+=Step)
|
||||
{
|
||||
u64 k1 = getblock(blocks,i*2+0);
|
||||
u64 k2 = getblock(blocks,i*2+1);
|
||||
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
}
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
}
|
||||
|
||||
//----------
|
||||
// tail
|
||||
//----------
|
||||
// tail
|
||||
|
||||
const u8 * tail = (const u8*)(data + nblocks*16);
|
||||
const u8 * tail = (const u8*)(data + nblocks*16);
|
||||
|
||||
u64 k1 = 0;
|
||||
u64 k2 = 0;
|
||||
u64 k1 = 0;
|
||||
u64 k2 = 0;
|
||||
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= u64(tail[14]) << 48;
|
||||
case 14: k2 ^= u64(tail[13]) << 40;
|
||||
case 13: k2 ^= u64(tail[12]) << 32;
|
||||
case 12: k2 ^= u64(tail[11]) << 24;
|
||||
case 11: k2 ^= u64(tail[10]) << 16;
|
||||
case 10: k2 ^= u64(tail[ 9]) << 8;
|
||||
case 9: k2 ^= u64(tail[ 8]) << 0;
|
||||
switch(len & 15)
|
||||
{
|
||||
case 15: k2 ^= u64(tail[14]) << 48;
|
||||
case 14: k2 ^= u64(tail[13]) << 40;
|
||||
case 13: k2 ^= u64(tail[12]) << 32;
|
||||
case 12: k2 ^= u64(tail[11]) << 24;
|
||||
case 11: k2 ^= u64(tail[10]) << 16;
|
||||
case 10: k2 ^= u64(tail[ 9]) << 8;
|
||||
case 9: k2 ^= u64(tail[ 8]) << 0;
|
||||
|
||||
case 8: k1 ^= u64(tail[ 7]) << 56;
|
||||
case 7: k1 ^= u64(tail[ 6]) << 48;
|
||||
case 6: k1 ^= u64(tail[ 5]) << 40;
|
||||
case 5: k1 ^= u64(tail[ 4]) << 32;
|
||||
case 4: k1 ^= u64(tail[ 3]) << 24;
|
||||
case 3: k1 ^= u64(tail[ 2]) << 16;
|
||||
case 2: k1 ^= u64(tail[ 1]) << 8;
|
||||
case 1: k1 ^= u64(tail[ 0]) << 0;
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
};
|
||||
case 8: k1 ^= u64(tail[ 7]) << 56;
|
||||
case 7: k1 ^= u64(tail[ 6]) << 48;
|
||||
case 6: k1 ^= u64(tail[ 5]) << 40;
|
||||
case 5: k1 ^= u64(tail[ 4]) << 32;
|
||||
case 4: k1 ^= u64(tail[ 3]) << 24;
|
||||
case 3: k1 ^= u64(tail[ 2]) << 16;
|
||||
case 2: k1 ^= u64(tail[ 1]) << 8;
|
||||
case 1: k1 ^= u64(tail[ 0]) << 0;
|
||||
bmix64(h1,h2,k1,k2,c1,c2);
|
||||
};
|
||||
|
||||
//----------
|
||||
// finalization
|
||||
//----------
|
||||
// finalization
|
||||
|
||||
h2 ^= len;
|
||||
h2 ^= len;
|
||||
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
h1 += h2;
|
||||
h2 += h1;
|
||||
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
h1 = fmix64(h1);
|
||||
h2 = fmix64(h2);
|
||||
|
||||
h1 += h2;
|
||||
h1 += h2;
|
||||
|
||||
return h1;
|
||||
return h1;
|
||||
}
|
||||
|
||||
|
||||
@ -262,11 +262,13 @@ 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
|
||||
changed, make sure this one is still used when the legacy parameter is
|
||||
true. */
|
||||
/*
|
||||
* 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
|
||||
* changed, make sure this one is still used when the legacy parameter is
|
||||
* true.
|
||||
*/
|
||||
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u64 m = 0xc6a4a7935bd1e995;
|
||||
@ -282,11 +284,11 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
u64 k = data[0];
|
||||
data+=Step;
|
||||
k *= m;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
h *= m;
|
||||
}
|
||||
|
||||
const u8 * data2 = (const u8*)end;
|
||||
@ -453,9 +455,11 @@ u64 GetMurmurHash3(const u8* src, int len, u32 samples)
|
||||
return *((u64 *)&out);
|
||||
}
|
||||
|
||||
/* FIXME: The old 32-bit version of this hash made different hashes than the
|
||||
64-bit version. Until someone can make a new version of the 32-bit one that
|
||||
makes identical hashes, this is just a c/p of the 64-bit one. */
|
||||
/*
|
||||
* FIXME: The old 32-bit version of this hash made different hashes than the
|
||||
* 64-bit version. Until someone can make a new version of the 32-bit one that
|
||||
* makes identical hashes, this is just a c/p of the 64-bit one.
|
||||
*/
|
||||
u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
const u64 m = 0xc6a4a7935bd1e995ULL;
|
||||
@ -473,7 +477,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
data+=Step;
|
||||
k *= m;
|
||||
k ^= k >> r;
|
||||
k *= m;
|
||||
k *= m;
|
||||
h ^= k;
|
||||
h *= m;
|
||||
}
|
||||
@ -502,7 +506,7 @@ u64 GetHashHiresTexture(const u8 *src, int len, u32 samples)
|
||||
|
||||
u64 GetHash64(const u8 *src, int len, u32 samples)
|
||||
{
|
||||
return ptrHashFunction(src, len, samples);
|
||||
return ptrHashFunction(src, len, samples);
|
||||
}
|
||||
|
||||
// sets the hash function used for the texture cache
|
||||
|
@ -45,9 +45,9 @@ LogManager::LogManager()
|
||||
m_Log[LogTypes::MASTER_LOG] = new LogContainer("*", "Master Log");
|
||||
m_Log[LogTypes::BOOT] = new LogContainer("BOOT", "Boot");
|
||||
m_Log[LogTypes::COMMON] = new LogContainer("COMMON", "Common");
|
||||
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[LogTypes::DISCIO] = new LogContainer("DIO", "Disc IO");
|
||||
m_Log[LogTypes::FILEMON] = new LogContainer("FileMon", "File Monitor");
|
||||
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[LogTypes::PAD] = new LogContainer("PAD", "Pad");
|
||||
m_Log[LogTypes::PIXELENGINE] = new LogContainer("PE", "PixelEngine");
|
||||
m_Log[LogTypes::COMMANDPROCESSOR] = new LogContainer("CP", "CommandProc");
|
||||
m_Log[LogTypes::VIDEOINTERFACE] = new LogContainer("VI", "VideoInt");
|
||||
@ -63,15 +63,15 @@ LogManager::LogManager()
|
||||
m_Log[LogTypes::AUDIO_INTERFACE] = new LogContainer("AI", "AudioInt");
|
||||
m_Log[LogTypes::POWERPC] = new LogContainer("PowerPC", "IBM CPU");
|
||||
m_Log[LogTypes::OSHLE] = new LogContainer("HLE", "HLE");
|
||||
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
|
||||
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
|
||||
m_Log[LogTypes::DSPHLE] = new LogContainer("DSPHLE", "DSP HLE");
|
||||
m_Log[LogTypes::DSPLLE] = new LogContainer("DSPLLE", "DSP LLE");
|
||||
m_Log[LogTypes::DSP_MAIL] = new LogContainer("DSPMails", "DSP Mails");
|
||||
m_Log[LogTypes::VIDEO] = new LogContainer("Video", "Video Backend");
|
||||
m_Log[LogTypes::AUDIO] = new LogContainer("Audio", "Audio Emulator");
|
||||
m_Log[LogTypes::DYNA_REC] = new LogContainer("JIT", "Dynamic Recompiler");
|
||||
m_Log[LogTypes::CONSOLE] = new LogContainer("CONSOLE", "Dolphin Console");
|
||||
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||
m_Log[LogTypes::OSREPORT] = new LogContainer("OSREPORT", "OSReport");
|
||||
m_Log[LogTypes::WIIMOTE] = new LogContainer("Wiimote", "Wiimote");
|
||||
m_Log[LogTypes::WII_IOB] = new LogContainer("WII_IOB", "WII IO Bridge");
|
||||
m_Log[LogTypes::WII_IPC] = new LogContainer("WII_IPC", "WII IPC");
|
||||
m_Log[LogTypes::WII_IPC_HLE] = new LogContainer("WII_IPC_HLE", "WII IPC HLE");
|
||||
@ -82,7 +82,7 @@ LogManager::LogManager()
|
||||
m_Log[LogTypes::WII_IPC_STM] = new LogContainer("WII_IPC_STM", "WII IPC STM");
|
||||
m_Log[LogTypes::WII_IPC_NET] = new LogContainer("WII_IPC_NET", "WII IPC NET");
|
||||
m_Log[LogTypes::WII_IPC_WIIMOTE] = new LogContainer("WII_IPC_WIIMOTE","WII IPC WIIMOTE");
|
||||
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[LogTypes::ACTIONREPLAY] = new LogContainer("ActionReplay", "ActionReplay");
|
||||
m_Log[LogTypes::MEMCARD_MANAGER] = new LogContainer("MemCard Manager", "MemCard Manager");
|
||||
m_Log[LogTypes::NETPLAY] = new LogContainer("NETPLAY", "Netplay");
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include <set>
|
||||
#include <string.h>
|
||||
|
||||
#define MAX_MESSAGES 8000
|
||||
#define MAX_MESSAGES 8000
|
||||
#define MAX_MSGLEN 1024
|
||||
|
||||
|
||||
|
@ -88,7 +88,7 @@ u32 ClassifyFloat(float fvalue)
|
||||
else
|
||||
{
|
||||
// Denormalized number.
|
||||
return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD;
|
||||
return sign ? PPC_FPCLASS_ND : PPC_FPCLASS_PD;
|
||||
}
|
||||
}
|
||||
else if (exp)
|
||||
@ -101,26 +101,26 @@ u32 ClassifyFloat(float fvalue)
|
||||
//Zero
|
||||
return sign ? PPC_FPCLASS_NZ : PPC_FPCLASS_PZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
inline void MatrixMul(int n, const float *a, const float *b, float *result)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for (int i = 0; i < n; ++i)
|
||||
{
|
||||
for (int j = 0; j < n; ++j)
|
||||
for (int j = 0; j < n; ++j)
|
||||
{
|
||||
float temp = 0;
|
||||
for (int k = 0; k < n; ++k)
|
||||
float temp = 0;
|
||||
for (int k = 0; k < n; ++k)
|
||||
{
|
||||
temp += a[i * n + k] * b[k * n + j];
|
||||
}
|
||||
result[i * n + j] = temp;
|
||||
}
|
||||
}
|
||||
temp += a[i * n + k] * b[k * n + j];
|
||||
}
|
||||
result[i * n + j] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate sum of a float list
|
||||
@ -131,94 +131,94 @@ float MathFloatVectorSum(const std::vector<float>& Vec)
|
||||
|
||||
void Matrix33::LoadIdentity(Matrix33 &mtx)
|
||||
{
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[4] = 1.0f;
|
||||
mtx.data[8] = 1.0f;
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[4] = 1.0f;
|
||||
mtx.data[8] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix33::RotateX(Matrix33 &mtx, float rad)
|
||||
{
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1;
|
||||
mtx.data[4] = c;
|
||||
mtx.data[5] = -s;
|
||||
mtx.data[7] = s;
|
||||
mtx.data[8] = c;
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1;
|
||||
mtx.data[4] = c;
|
||||
mtx.data[5] = -s;
|
||||
mtx.data[7] = s;
|
||||
mtx.data[8] = c;
|
||||
}
|
||||
void Matrix33::RotateY(Matrix33 &mtx, float rad)
|
||||
{
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = c;
|
||||
mtx.data[2] = s;
|
||||
mtx.data[4] = 1;
|
||||
mtx.data[6] = -s;
|
||||
mtx.data[8] = c;
|
||||
float s = sin(rad);
|
||||
float c = cos(rad);
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = c;
|
||||
mtx.data[2] = s;
|
||||
mtx.data[4] = 1;
|
||||
mtx.data[6] = -s;
|
||||
mtx.data[8] = c;
|
||||
}
|
||||
|
||||
void Matrix33::Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result)
|
||||
{
|
||||
MatrixMul(3, a.data, b.data, result.data);
|
||||
MatrixMul(3, a.data, b.data, result.data);
|
||||
}
|
||||
|
||||
void Matrix33::Multiply(const Matrix33 &a, const float vec[3], float result[3])
|
||||
{
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result[i] = 0;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
result[i] += a.data[i * 3 + k] * vec[k];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
result[i] = 0;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
result[i] += a.data[i * 3 + k] * vec[k];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix44::LoadIdentity(Matrix44 &mtx)
|
||||
{
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[5] = 1.0f;
|
||||
mtx.data[10] = 1.0f;
|
||||
mtx.data[15] = 1.0f;
|
||||
memset(mtx.data, 0, sizeof(mtx.data));
|
||||
mtx.data[0] = 1.0f;
|
||||
mtx.data[5] = 1.0f;
|
||||
mtx.data[10] = 1.0f;
|
||||
mtx.data[15] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix44::LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33)
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
for (int j = 0; j < 3; ++j)
|
||||
for (int j = 0; j < 3; ++j)
|
||||
{
|
||||
mtx.data[i * 4 + j] = m33.data[i * 3 + j];
|
||||
}
|
||||
}
|
||||
mtx.data[i * 4 + j] = m33.data[i * 3 + j];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
mtx.data[i * 4 + 3] = 0;
|
||||
mtx.data[i + 12] = 0;
|
||||
}
|
||||
mtx.data[15] = 1.0f;
|
||||
mtx.data[i * 4 + 3] = 0;
|
||||
mtx.data[i + 12] = 0;
|
||||
}
|
||||
mtx.data[15] = 1.0f;
|
||||
}
|
||||
|
||||
void Matrix44::Set(Matrix44 &mtx, const float mtxArray[16])
|
||||
{
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
mtx.data[i] = mtxArray[i];
|
||||
}
|
||||
for(int i = 0; i < 16; ++i) {
|
||||
mtx.data[i] = mtxArray[i];
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix44::Translate(Matrix44 &mtx, const float vec[3])
|
||||
{
|
||||
LoadIdentity(mtx);
|
||||
mtx.data[3] = vec[0];
|
||||
mtx.data[7] = vec[1];
|
||||
mtx.data[11] = vec[2];
|
||||
LoadIdentity(mtx);
|
||||
mtx.data[3] = vec[0];
|
||||
mtx.data[7] = vec[1];
|
||||
mtx.data[11] = vec[2];
|
||||
}
|
||||
|
||||
void Matrix44::Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result)
|
||||
{
|
||||
MatrixMul(4, a.data, b.data, result.data);
|
||||
MatrixMul(4, a.data, b.data, result.data);
|
||||
}
|
||||
|
||||
|
@ -159,12 +159,12 @@ inline u64 Log2(u64 val)
|
||||
{
|
||||
#if defined(__GNUC__)
|
||||
return 63 - __builtin_clzll(val);
|
||||
|
||||
|
||||
#elif defined(_MSC_VER) && defined(_M_X64)
|
||||
unsigned long result = -1;
|
||||
_BitScanReverse64(&result, val);
|
||||
return result;
|
||||
|
||||
|
||||
#else
|
||||
u64 result = -1;
|
||||
while (val != 0)
|
||||
@ -182,32 +182,32 @@ inline u64 Log2(u64 val)
|
||||
class Matrix33
|
||||
{
|
||||
public:
|
||||
static void LoadIdentity(Matrix33 &mtx);
|
||||
static void LoadIdentity(Matrix33 &mtx);
|
||||
|
||||
// set mtx to be a rotation matrix around the x axis
|
||||
static void RotateX(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the y axis
|
||||
static void RotateY(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the x axis
|
||||
static void RotateX(Matrix33 &mtx, float rad);
|
||||
// set mtx to be a rotation matrix around the y axis
|
||||
static void RotateY(Matrix33 &mtx, float rad);
|
||||
|
||||
// set result = a x b
|
||||
static void Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result);
|
||||
static void Multiply(const Matrix33 &a, const float vec[3], float result[3]);
|
||||
// set result = a x b
|
||||
static void Multiply(const Matrix33 &a, const Matrix33 &b, Matrix33 &result);
|
||||
static void Multiply(const Matrix33 &a, const float vec[3], float result[3]);
|
||||
|
||||
float data[9];
|
||||
float data[9];
|
||||
};
|
||||
|
||||
class Matrix44
|
||||
{
|
||||
public:
|
||||
static void LoadIdentity(Matrix44 &mtx);
|
||||
static void LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33);
|
||||
static void Set(Matrix44 &mtx, const float mtxArray[16]);
|
||||
static void LoadIdentity(Matrix44 &mtx);
|
||||
static void LoadMatrix33(Matrix44 &mtx, const Matrix33 &m33);
|
||||
static void Set(Matrix44 &mtx, const float mtxArray[16]);
|
||||
|
||||
static void Translate(Matrix44 &mtx, const float vec[3]);
|
||||
static void Translate(Matrix44 &mtx, const float vec[3]);
|
||||
|
||||
static void Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result);
|
||||
static void Multiply(const Matrix44 &a, const Matrix44 &b, Matrix44 &result);
|
||||
|
||||
float data[16];
|
||||
float data[16];
|
||||
};
|
||||
|
||||
#endif // _MATH_UTIL_H_
|
||||
|
@ -47,10 +47,10 @@ int AshmemCreateFileMapping(const char *name, size_t size)
|
||||
fd = open(ASHMEM_DEVICE, O_RDWR);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
|
||||
// We don't really care if we can't set the name, it is optional
|
||||
ret = ioctl(fd, ASHMEM_SET_NAME, name);
|
||||
|
||||
|
||||
ret = ioctl(fd, ASHMEM_SET_SIZE, size);
|
||||
if (ret < 0)
|
||||
{
|
||||
|
@ -155,9 +155,7 @@ void FreeAlignedMemory(void* ptr)
|
||||
if (ptr)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
||||
_aligned_free(ptr);
|
||||
|
||||
_aligned_free(ptr);
|
||||
#else
|
||||
free(ptr);
|
||||
#endif
|
||||
|
@ -102,15 +102,14 @@ bool MsgAlert(bool yes_no, int Style, const char* format, ...)
|
||||
bool DefaultMsgHandler(const char* caption, const char* text, bool yes_no, int Style)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int STYLE = MB_ICONINFORMATION;
|
||||
if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
|
||||
return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK));
|
||||
|
||||
int STYLE = MB_ICONINFORMATION;
|
||||
if (Style == QUESTION) STYLE = MB_ICONQUESTION;
|
||||
if (Style == WARNING) STYLE = MB_ICONWARNING;
|
||||
|
||||
return IDYES == MessageBox(0, UTF8ToTStr(text).c_str(), UTF8ToTStr(caption).c_str(), STYLE | (yes_no ? MB_YESNO : MB_OK));
|
||||
#else
|
||||
printf("%s\n", text);
|
||||
return true;
|
||||
printf("%s\n", text);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
// bool wait_for(unique_lock<mutex>& lock,
|
||||
// const chrono::duration<Rep, Period>& rel_time,
|
||||
// Predicate pred);
|
||||
|
||||
|
||||
native_handle_type native_handle()
|
||||
{
|
||||
#ifdef USE_EVENTS
|
||||
|
@ -88,7 +88,7 @@ public:
|
||||
{
|
||||
return !(*this == rhs);
|
||||
}
|
||||
|
||||
|
||||
bool operator<(const id& rhs) const
|
||||
{
|
||||
return m_thread < rhs.m_thread;
|
||||
|
@ -435,10 +435,10 @@ template <typename T>
|
||||
std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
|
||||
#if defined(ANDROID)
|
||||
result = "Not implemented on Android!";
|
||||
|
||||
|
||||
#else
|
||||
iconv_t const conv_desc = iconv_open("UTF-8", fromcode);
|
||||
if ((iconv_t)-1 == conv_desc)
|
||||
@ -449,7 +449,7 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
||||
{
|
||||
size_t const in_bytes = sizeof(T) * input.size();
|
||||
size_t const out_buffer_size = 4 * in_bytes;
|
||||
|
||||
|
||||
std::string out_buffer;
|
||||
out_buffer.resize(out_buffer_size);
|
||||
|
||||
@ -457,12 +457,12 @@ std::string CodeToUTF8(const char* fromcode, const std::basic_string<T>& input)
|
||||
size_t src_bytes = in_bytes;
|
||||
auto dst_buffer = &out_buffer[0];
|
||||
size_t dst_bytes = out_buffer.size();
|
||||
|
||||
|
||||
while (src_bytes != 0)
|
||||
{
|
||||
size_t const iconv_result = iconv(conv_desc, (char**)(&src_buffer), &src_bytes,
|
||||
&dst_buffer, &dst_bytes);
|
||||
|
||||
|
||||
if ((size_t)-1 == iconv_result)
|
||||
{
|
||||
if (EILSEQ == errno || EINVAL == errno)
|
||||
@ -512,7 +512,7 @@ std::string UTF16ToUTF8(const std::wstring& input)
|
||||
// CodeToUTF8("UCS-2LE", input);
|
||||
// CodeToUTF8("UTF-16", input);
|
||||
CodeToUTF8("UTF-16LE", input);
|
||||
|
||||
|
||||
// TODO: why is this needed?
|
||||
result.erase(std::remove(result.begin(), result.end(), 0x00), result.end());
|
||||
return result;
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
m_condvar.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Wait()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(m_mutex);
|
||||
|
@ -226,11 +226,11 @@ void XEmitter::ABI_CallFunction(void *func) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -239,11 +239,11 @@ void XEmitter::ABI_CallFunctionC16(void *func, u16 param1) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -266,11 +266,11 @@ void XEmitter::ABI_CallFunctionC(void *func, u32 param1) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -280,11 +280,11 @@ void XEmitter::ABI_CallFunctionCC(void *func, u32 param1, u32 param2) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,11 +295,11 @@ void XEmitter::ABI_CallFunctionCCC(void *func, u32 param1, u32 param2, u32 param
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -310,11 +310,11 @@ void XEmitter::ABI_CallFunctionCCP(void *func, u32 param1, u32 param2, void *par
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -326,11 +326,11 @@ void XEmitter::ABI_CallFunctionCCCP(void *func, u32 param1, u32 param2, u32 para
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -341,11 +341,11 @@ void XEmitter::ABI_CallFunctionPPC(void *func, void *param1, void *param2, u32 p
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,11 +356,11 @@ void XEmitter::ABI_CallFunctionR(void *func, X64Reg reg1) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -380,11 +380,11 @@ void XEmitter::ABI_CallFunctionRR(void *func, X64Reg reg1, X64Reg reg2) {
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,11 +396,11 @@ void XEmitter::ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,11 +411,11 @@ void XEmitter::ABI_CallFunctionA(void *func, const Gen::OpArg &arg1)
|
||||
u64 distance = u64(func) - (u64(code) + 5);
|
||||
if (distance >= 0x0000000080000000ULL
|
||||
&& distance < 0xFFFFFFFF80000000ULL) {
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
// Far call
|
||||
MOV(64, R(RAX), Imm64((u64)func));
|
||||
CALLptr(R(RAX));
|
||||
} else {
|
||||
CALL(func);
|
||||
CALL(func);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,18 +60,18 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
||||
|
||||
codeByte = *codePtr++;
|
||||
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
{
|
||||
twoByte = true;
|
||||
// Skip two-byte opcode byte
|
||||
bool twoByte = false;
|
||||
if(codeByte == 0x0F)
|
||||
{
|
||||
twoByte = true;
|
||||
codeByte2 = *codePtr++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!twoByte)
|
||||
{
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
((codeByte & 0xF8) == 0xC0 && (codeByte & 0x0E) != 0x02))
|
||||
if ((codeByte & 0xF0) == 0x80 ||
|
||||
((codeByte & 0xF8) == 0xC0 && (codeByte & 0x0E) != 0x02))
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
hasModRM = true;
|
||||
@ -79,20 +79,20 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
||||
}
|
||||
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)
|
||||
{
|
||||
// No mod R/M byte
|
||||
}
|
||||
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)
|
||||
{
|
||||
// No mod R/M byte
|
||||
}
|
||||
else
|
||||
{
|
||||
modRMbyte = *codePtr++;
|
||||
hasModRM = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasModRM)
|
||||
@ -130,7 +130,7 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
|
||||
info.displacement = *((s32 *)codePtr);
|
||||
codePtr += displacementSize;
|
||||
|
||||
|
||||
|
||||
if (accessType == 1)
|
||||
{
|
||||
info.isMemoryWrite = true;
|
||||
|
@ -51,7 +51,7 @@ enum{
|
||||
MOVZX_SHORT = 0xB7, //movzx on short
|
||||
MOVSX_BYTE = 0xBE, //movsx on byte
|
||||
MOVSX_SHORT = 0xBF, //movsx on short
|
||||
MOVE_8BIT = 0xC6, //move 8-bit immediate
|
||||
MOVE_8BIT = 0xC6, //move 8-bit immediate
|
||||
MOVE_16_32BIT = 0xC7, //move 16 or 32-bit immediate
|
||||
MOVE_REG_TO_MEM = 0x89, //move reg to memory
|
||||
};
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <machine/cpufunc.h>
|
||||
#else
|
||||
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
unsigned int *ecx, unsigned int *edx)
|
||||
{
|
||||
#if defined _M_GENERIC
|
||||
(*eax) = (*ebx) = (*ecx) = (*edx) = 0;
|
||||
|
@ -51,13 +51,13 @@ static const NormalOpDef nops[11] =
|
||||
|
||||
enum NormalSSEOps
|
||||
{
|
||||
sseCMP = 0xC2,
|
||||
sseADD = 0x58, //ADD
|
||||
sseCMP = 0xC2,
|
||||
sseADD = 0x58, //ADD
|
||||
sseSUB = 0x5C, //SUB
|
||||
sseAND = 0x54, //AND
|
||||
sseANDN = 0x55, //ANDN
|
||||
sseOR = 0x56,
|
||||
sseXOR = 0x57,
|
||||
sseOR = 0x56,
|
||||
sseXOR = 0x57,
|
||||
sseMUL = 0x59, //MUL,
|
||||
sseDIV = 0x5E, //DIV
|
||||
sseMIN = 0x5D, //MIN
|
||||
@ -143,18 +143,18 @@ void OpArg::WriteRex(XEmitter *emit, int opBits, int bits, int customOp) const
|
||||
if (indexReg & 8) op |= 2;
|
||||
if (offsetOrBaseReg & 8) op |= 1; //TODO investigate if this is dangerous
|
||||
if (op != 0x40 ||
|
||||
(bits == 8 && (offsetOrBaseReg & 0x10c) == 4) ||
|
||||
(opBits == 8 && (customOp & 0x10c) == 4)) {
|
||||
(bits == 8 && (offsetOrBaseReg & 0x10c) == 4) ||
|
||||
(opBits == 8 && (customOp & 0x10c) == 4)) {
|
||||
emit->Write8(op);
|
||||
_dbg_assert_(DYNA_REC, (offsetOrBaseReg & 0x100) == 0 || bits != 8);
|
||||
_dbg_assert_(DYNA_REC, (customOp & 0x100) == 0 || opBits != 8);
|
||||
} else {
|
||||
_dbg_assert_(DYNA_REC, (offsetOrBaseReg & 0x10c) == 0 ||
|
||||
(offsetOrBaseReg & 0x10c) == 0x104 ||
|
||||
bits != 8);
|
||||
(offsetOrBaseReg & 0x10c) == 0x104 ||
|
||||
bits != 8);
|
||||
_dbg_assert_(DYNA_REC, (customOp & 0x10c) == 0 ||
|
||||
(customOp & 0x10c) == 0x104 ||
|
||||
opBits != 8);
|
||||
(customOp & 0x10c) == 0x104 ||
|
||||
opBits != 8);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -969,15 +969,15 @@ void OpArg::WriteNormalOp(XEmitter *emit, bool toRM, NormalOp op, const OpArg &o
|
||||
immToWrite = 8;
|
||||
}
|
||||
else if ((operand.scale == SCALE_IMM16 && bits == 16) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 64))
|
||||
(operand.scale == SCALE_IMM32 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM32 && bits == 64))
|
||||
{
|
||||
emit->Write8(nops[op].imm32);
|
||||
immToWrite = bits == 16 ? 16 : 32;
|
||||
}
|
||||
else if ((operand.scale == SCALE_IMM8 && bits == 16) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 64))
|
||||
(operand.scale == SCALE_IMM8 && bits == 32) ||
|
||||
(operand.scale == SCALE_IMM8 && bits == 64))
|
||||
{
|
||||
emit->Write8(nops[op].simm8);
|
||||
immToWrite = 8;
|
||||
@ -1471,142 +1471,142 @@ void XEmitter::RTDSC() { Write8(0x0F); Write8(0x31); }
|
||||
// helper routines for setting pointers
|
||||
void XEmitter::CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(3 * 4);
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(3 * 4);
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(3 * 4);
|
||||
ABI_RestoreStack(3 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(4 * 4);
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(4 * 4);
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(4 * 4);
|
||||
ABI_RestoreStack(4 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction5(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(5 * 4);
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(5 * 4);
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(5 * 4);
|
||||
ABI_RestoreStack(5 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void XEmitter::CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5)
|
||||
{
|
||||
using namespace Gen;
|
||||
using namespace Gen;
|
||||
#ifdef _M_X64
|
||||
|
||||
#ifdef _MSC_VER
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
CALL(fnptr);
|
||||
#else
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
MOV(32, R(R9), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
MOV(32, R(RDI), Imm32(arg0));
|
||||
MOV(32, R(RSI), Imm32(arg1));
|
||||
MOV(32, R(RDX), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg3));
|
||||
MOV(32, R(R8), Imm32(arg4));
|
||||
MOV(32, R(R9), Imm32(arg5));
|
||||
CALL(fnptr);
|
||||
#endif
|
||||
|
||||
#else
|
||||
ABI_AlignStack(6 * 4);
|
||||
PUSH(32, Imm32(arg5));
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
ABI_AlignStack(6 * 4);
|
||||
PUSH(32, Imm32(arg5));
|
||||
PUSH(32, Imm32(arg4));
|
||||
PUSH(32, Imm32(arg3));
|
||||
PUSH(32, Imm32(arg2));
|
||||
PUSH(32, Imm32(arg1));
|
||||
PUSH(32, Imm32(arg0));
|
||||
CALL(fnptr);
|
||||
#ifdef _WIN32
|
||||
// don't inc stack
|
||||
// don't inc stack
|
||||
#else
|
||||
ABI_RestoreStack(6 * 4);
|
||||
ABI_RestoreStack(6 * 4);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -1615,31 +1615,31 @@ void XEmitter::CallCdeclFunction6(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32
|
||||
|
||||
// See header
|
||||
void XEmitter::___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
CALLptr(M(impptr));
|
||||
}
|
||||
void XEmitter::___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5) {
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, R(RCX), Imm32(arg0));
|
||||
MOV(32, R(RDX), Imm32(arg1));
|
||||
MOV(32, R(R8), Imm32(arg2));
|
||||
MOV(32, R(R9), Imm32(arg3));
|
||||
MOV(32, MDisp(RSP, 0x20), Imm32(arg4));
|
||||
MOV(32, MDisp(RSP, 0x28), Imm32(arg5));
|
||||
CALLptr(M(impptr));
|
||||
|
@ -766,7 +766,7 @@ public:
|
||||
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
|
||||
void WriteProtect()
|
||||
{
|
||||
WriteProtectMemory(region, region_size, true);
|
||||
WriteProtectMemory(region, region_size, true);
|
||||
}
|
||||
|
||||
void ResetCodePtr()
|
||||
|
@ -68,7 +68,7 @@ namespace FPURoundMode
|
||||
}
|
||||
|
||||
void SetPrecisionMode(u32 mode)
|
||||
{
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
// sets the floating-point lib to 53-bit
|
||||
// PowerPC has a 53bit floating pipeline only
|
||||
@ -104,7 +104,7 @@ namespace FPURoundMode
|
||||
u32 csr = ssetable[mode];
|
||||
_mm_setcsr(csr);
|
||||
}
|
||||
|
||||
|
||||
void SaveSIMDState()
|
||||
{
|
||||
saved_sse_state = _mm_getcsr();
|
||||
|
Reference in New Issue
Block a user