summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorbushing <bushing@gmail.com>2008-12-08 04:46:09 +0000
committerbushing <bushing@gmail.com>2008-12-08 04:46:09 +0000
commit30c883bcfc65761dc9fb61fea16a25fb61a7e220 (patch)
treef0e77927cfb598e860faf386c7c8089c38a9b726 /Source/Core/Common
parente6fe5ec42f025a710918c1aaf8643da36a13bb3e (diff)
set svn:eol-style=native for **.h
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1438 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/ABI.h244
-rw-r--r--Source/Core/Common/Src/CPUDetect.h132
-rw-r--r--Source/Core/Common/Src/ChunkFile.h472
-rw-r--r--Source/Core/Common/Src/Common.h612
-rw-r--r--Source/Core/Common/Src/DriveUtil.h56
-rw-r--r--Source/Core/Common/Src/DynamicLibrary.h94
-rw-r--r--Source/Core/Common/Src/ExtendedTrace.h112
-rw-r--r--Source/Core/Common/Src/FileSearch.h88
-rw-r--r--Source/Core/Common/Src/FileUtil.h120
-rw-r--r--Source/Core/Common/Src/FixedSizeQueue.h160
-rw-r--r--Source/Core/Common/Src/Hash.h56
-rw-r--r--Source/Core/Common/Src/IniFile.h176
-rw-r--r--Source/Core/Common/Src/MappedFile.h102
-rw-r--r--Source/Core/Common/Src/MathUtil.h70
-rw-r--r--Source/Core/Common/Src/MemArena.h104
-rw-r--r--Source/Core/Common/Src/MemoryUtil.h62
-rw-r--r--Source/Core/Common/Src/Plugin.h102
-rw-r--r--Source/Core/Common/Src/StringUtil.h154
-rw-r--r--Source/Core/Common/Src/TestFramework.h200
-rw-r--r--Source/Core/Common/Src/Thread.h234
-rw-r--r--Source/Core/Common/Src/Thunk.h78
-rw-r--r--Source/Core/Common/Src/Timer.h98
-rw-r--r--Source/Core/Common/Src/WaveFile.h110
-rw-r--r--Source/Core/Common/Src/stdafx.h70
-rw-r--r--Source/Core/Common/Src/svnrev_template.h2
-rw-r--r--Source/Core/Common/Src/x64Analyzer.h112
-rw-r--r--Source/Core/Common/Src/x64Emitter.h1126
27 files changed, 2473 insertions, 2473 deletions
diff --git a/Source/Core/Common/Src/ABI.h b/Source/Core/Common/Src/ABI.h
index 2dfbf5aa19..e29c333d5b 100644
--- a/Source/Core/Common/Src/ABI.h
+++ b/Source/Core/Common/Src/ABI.h
@@ -1,122 +1,122 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _JIT_ABI_H
-#define _JIT_ABI_H
-
-#include "x64Emitter.h"
-
-// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code.
-// All convensions return values in EAX (+ possibly EDX).
-
-// Linux 32-bit, Windows 32-bit (cdecl, System V):
-// * Caller pushes left to right
-// * Caller fixes stack after call
-// * function subtract from stack for local storage only.
-// Scratch: EAX ECX EDX
-// Callee-save: EBX ESI EDI EBP
-// Parameters: -
-
-// Windows 64-bit
-// * 4-reg "fastcall" variant, very new-skool stack handling
-// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_
-// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
-// Scratch: RAX RCX RDX R8 R9 R10 R11
-// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
-// Parameters: RCX RDX R8 R9, further MOV-ed
-
-// Linux 64-bit
-// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
-// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
-// Callee-save: RBX RBP R12 R13 R14 R15
-// Parameters: RDI RSI RDX RCX R8 R9
-
-#ifdef _M_IX86
-// 32 bit calling convention, shared by all
-
-// 32-bit don't pass parameters in regs, but these are convenient to have anyway when we have to
-// choose regs to put stuff in.
-#define ABI_PARAM1 RCX
-#define ABI_PARAM2 RDX
-
-// There are no ABI_PARAM* here, since args are pushed.
-
-// === 32-bit bog standard cdecl, shared between linux and windows ============================
-// MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about.
-#else
-// 64 bit calling convention
-
-#ifdef _WIN32
-// === 64-bit Windows - the really exotic calling convention ==================================
-
-#define ABI_PARAM1 RCX
-#define ABI_PARAM2 RDX
-#define ABI_PARAM3 R8
-#define ABI_PARAM4 R9
-#else
-// === 64-bit Unix (hopefully MacOSX too) =====================================================
-
-#define ABI_PARAM1 RDI
-#define ABI_PARAM2 RSI
-#define ABI_PARAM3 RDX
-#define ABI_PARAM4 RCX
-#define ABI_PARAM5 R8
-#define ABI_PARAM6 R9
-
-#endif
-
-#endif
-
-// Utility functions
-// 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);
-void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
-void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2);
-
-// Pass a register as a paremeter.
-void ABI_CallFunctionR(void *func, Gen::X64Reg reg1);
-void ABI_CallFunctionRR(void *func, Gen::X64Reg reg1, Gen::X64Reg reg2);
-
-// A function that doesn't have any control over what it will do to regs,
-// such as the dispatcher, should be surrounded by these.
-void ABI_PushAllCalleeSavedRegsAndAdjustStack();
-void ABI_PopAllCalleeSavedRegsAndAdjustStack();
-
-// A function that doesn't know anything about it's surroundings, should
-// be surrounded by these to establish a safe environment, where it can roam free.
-// An example is a backpatch injected function.
-void ABI_PushAllCallerSavedRegsAndAdjustStack();
-void ABI_PopAllCallerSavedRegsAndAdjustStack();
-
-unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize);
-void ABI_AlignStack(unsigned int frameSize);
-void ABI_RestoreStack(unsigned int frameSize);
-
-// Sets up a __cdecl function.
-// Only x64 really needs the parameter.
-void ABI_EmitPrologue(int maxCallParams);
-void ABI_EmitEpilogue(int maxCallParams);
-
-#ifdef _M_IX86
-inline int ABI_GetNumXMMRegs() { return 8; }
-#else
-inline int ABI_GetNumXMMRegs() { return 16; }
-#endif
-
-#endif // _JIT_ABI_H
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _JIT_ABI_H
+#define _JIT_ABI_H
+
+#include "x64Emitter.h"
+
+// x86/x64 ABI:s, and helpers to help follow them when JIT-ing code.
+// All convensions return values in EAX (+ possibly EDX).
+
+// Linux 32-bit, Windows 32-bit (cdecl, System V):
+// * Caller pushes left to right
+// * Caller fixes stack after call
+// * function subtract from stack for local storage only.
+// Scratch: EAX ECX EDX
+// Callee-save: EBX ESI EDI EBP
+// Parameters: -
+
+// Windows 64-bit
+// * 4-reg "fastcall" variant, very new-skool stack handling
+// * Callee moves stack pointer, to make room for shadow regs for the biggest function _it itself calls_
+// * Parameters passed in RCX, RDX, ... further parameters are MOVed into the allocated stack space.
+// Scratch: RAX RCX RDX R8 R9 R10 R11
+// Callee-save: RBX RSI RDI RBP R12 R13 R14 R15
+// Parameters: RCX RDX R8 R9, further MOV-ed
+
+// Linux 64-bit
+// * 6-reg "fastcall" variant, old skool stack handling (parameters are pushed)
+// Scratch: RAX RCX RDX RSI RDI R8 R9 R10 R11
+// Callee-save: RBX RBP R12 R13 R14 R15
+// Parameters: RDI RSI RDX RCX R8 R9
+
+#ifdef _M_IX86
+// 32 bit calling convention, shared by all
+
+// 32-bit don't pass parameters in regs, but these are convenient to have anyway when we have to
+// choose regs to put stuff in.
+#define ABI_PARAM1 RCX
+#define ABI_PARAM2 RDX
+
+// There are no ABI_PARAM* here, since args are pushed.
+
+// === 32-bit bog standard cdecl, shared between linux and windows ============================
+// MacOSX 32-bit is same as System V with a few exceptions that we probably don't care much about.
+#else
+// 64 bit calling convention
+
+#ifdef _WIN32
+// === 64-bit Windows - the really exotic calling convention ==================================
+
+#define ABI_PARAM1 RCX
+#define ABI_PARAM2 RDX
+#define ABI_PARAM3 R8
+#define ABI_PARAM4 R9
+#else
+// === 64-bit Unix (hopefully MacOSX too) =====================================================
+
+#define ABI_PARAM1 RDI
+#define ABI_PARAM2 RSI
+#define ABI_PARAM3 RDX
+#define ABI_PARAM4 RCX
+#define ABI_PARAM5 R8
+#define ABI_PARAM6 R9
+
+#endif
+
+#endif
+
+// Utility functions
+// 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);
+void ABI_CallFunctionCC(void *func, u32 param1, u32 param2);
+void ABI_CallFunctionAC(void *func, const Gen::OpArg &arg1, u32 param2);
+
+// Pass a register as a paremeter.
+void ABI_CallFunctionR(void *func, Gen::X64Reg reg1);
+void ABI_CallFunctionRR(void *func, Gen::X64Reg reg1, Gen::X64Reg reg2);
+
+// A function that doesn't have any control over what it will do to regs,
+// such as the dispatcher, should be surrounded by these.
+void ABI_PushAllCalleeSavedRegsAndAdjustStack();
+void ABI_PopAllCalleeSavedRegsAndAdjustStack();
+
+// A function that doesn't know anything about it's surroundings, should
+// be surrounded by these to establish a safe environment, where it can roam free.
+// An example is a backpatch injected function.
+void ABI_PushAllCallerSavedRegsAndAdjustStack();
+void ABI_PopAllCallerSavedRegsAndAdjustStack();
+
+unsigned int ABI_GetAlignedFrameSize(unsigned int frameSize);
+void ABI_AlignStack(unsigned int frameSize);
+void ABI_RestoreStack(unsigned int frameSize);
+
+// Sets up a __cdecl function.
+// Only x64 really needs the parameter.
+void ABI_EmitPrologue(int maxCallParams);
+void ABI_EmitEpilogue(int maxCallParams);
+
+#ifdef _M_IX86
+inline int ABI_GetNumXMMRegs() { return 8; }
+#else
+inline int ABI_GetNumXMMRegs() { return 16; }
+#endif
+
+#endif // _JIT_ABI_H
+
diff --git a/Source/Core/Common/Src/CPUDetect.h b/Source/Core/Common/Src/CPUDetect.h
index 03f379d978..810f1eef2d 100644
--- a/Source/Core/Common/Src/CPUDetect.h
+++ b/Source/Core/Common/Src/CPUDetect.h
@@ -1,66 +1,66 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _CPUDETECT_H
-#define _CPUDETECT_H
-
-#include <string>
-
-enum CPUVendor
-{
- VENDOR_INTEL = 0,
- VENDOR_AMD = 1,
- VENDOR_OTHER = 2,
-};
-
-struct CPUInfo
-{
- CPUVendor vendor;
-
- char cpu_string[0x21];
- char brand_string[0x41];
- bool OS64bit;
- bool CPU64bit;
- bool Mode64bit;
-
- bool hyper_threaded;
- int num_cores;
-
- bool bSSE;
- bool bSSE2;
- bool bSSE3;
- bool bSSSE3;
- bool bPOPCNT;
- bool bSSE4_1;
- bool bSSE4_2;
- bool bLZCNT;
- bool bSSE4A;
- bool bLAHFSAHF64;
- bool bLongMode;
-
- void Detect();
- std::string Summarize();
-};
-
-
-extern CPUInfo cpu_info;
-
-inline void DetectCPU() {cpu_info.Detect();}
-
-
-#endif
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _CPUDETECT_H
+#define _CPUDETECT_H
+
+#include <string>
+
+enum CPUVendor
+{
+ VENDOR_INTEL = 0,
+ VENDOR_AMD = 1,
+ VENDOR_OTHER = 2,
+};
+
+struct CPUInfo
+{
+ CPUVendor vendor;
+
+ char cpu_string[0x21];
+ char brand_string[0x41];
+ bool OS64bit;
+ bool CPU64bit;
+ bool Mode64bit;
+
+ bool hyper_threaded;
+ int num_cores;
+
+ bool bSSE;
+ bool bSSE2;
+ bool bSSE3;
+ bool bSSSE3;
+ bool bPOPCNT;
+ bool bSSE4_1;
+ bool bSSE4_2;
+ bool bLZCNT;
+ bool bSSE4A;
+ bool bLAHFSAHF64;
+ bool bLongMode;
+
+ void Detect();
+ std::string Summarize();
+};
+
+
+extern CPUInfo cpu_info;
+
+inline void DetectCPU() {cpu_info.Detect();}
+
+
+#endif
+
diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h
index 96ffc21f02..972e888c4b 100644
--- a/Source/Core/Common/Src/ChunkFile.h
+++ b/Source/Core/Common/Src/ChunkFile.h
@@ -1,236 +1,236 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _POINTERWRAP_H
-#define _POINTERWRAP_H
-
-// Extremely simple serialization framework.
-
-// (mis)-features:
-// + Super fast
-// + Very simple
-// + Same code is used for serialization and deserializaition (in most cases)
-// - Zero backwards/forwards compatibility
-// - Serialization code for anything complex has to be manually written.
-
-#include <stdio.h>
-
-#include <map>
-#include <vector>
-#include <string>
-
-#include "Common.h"
-
-template <class T>
-struct LinkedListItem : public T
-{
- LinkedListItem<T> *next;
-};
-
-
-class PointerWrap
-{
-public:
- enum Mode // also defined in pluginspecs.h. Didn't want to couple them.
- {
- MODE_READ = 1,
- MODE_WRITE,
- MODE_MEASURE,
- };
-
- u8 **ptr;
- Mode mode;
-
-public:
- PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {}
- PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {}
-
- void SetMode(Mode mode_) {mode = mode_;}
- Mode GetMode() const {return mode;}
- u8 **GetPPtr() {return ptr;}
-
- void DoVoid(void *data, int size)
- {
- switch (mode)
- {
- case MODE_READ: memcpy(data, *ptr, size); break;
- case MODE_WRITE: memcpy(*ptr, data, size); break;
- case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
- default: break; // throw an error?
- }
- (*ptr) += size;
- }
-
- // Store maps to file. Very useful.
- template<class T>
- void Do(std::map<unsigned int, T> &x) {
- // TODO
- PanicAlert("Do(map<>) does not yet work.");
- }
-
- // Store vectors.
- template<class T>
- void Do(std::vector<T> &x) {
- // TODO
- PanicAlert("Do(vector<>) does not yet work.");
- }
-
- // Store strings.
- void Do(std::string &x)
- {
- int stringLen = (int)x.length() + 1;
- Do(stringLen);
-
- switch (mode)
- {
- case MODE_READ: x = (char*)*ptr; break;
- case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
- case MODE_MEASURE: break;
- }
- (*ptr) += stringLen;
- }
-
- void DoBuffer(u8** pBuffer, u32& _Size)
- {
- Do(_Size);
-
- if (_Size > 0)
- {
- switch (mode)
- {
- case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break;
- case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break;
- case MODE_MEASURE: break;
- }
- }
- else
- {
- *pBuffer = NULL;
- }
- (*ptr) += _Size;
- }
-
- template<class T>
- void DoArray(T *x, int count) {
- DoVoid((void *)x, sizeof(T) * count);
- }
-
- template<class T>
- void Do(T &x) {
- DoVoid((void *)&x, sizeof(x));
- }
-
- template<class T>
- void DoLinkedList(LinkedListItem<T> **list_start) {
- // TODO
- PanicAlert("Do(vector<>) does not yet work.");
- }
-};
-
-
-class CChunkFileReader
-{
-public:
- template<class T>
- static bool Load(const std::string& _rFilename, int _Revision, T& _class)
- {
- FILE* pFile = fopen(_rFilename.c_str(), "rb");
- if (pFile)
- {
- // get size
- fseek(pFile, 0, SEEK_END);
- size_t FileSize = ftell(pFile);
- fseek(pFile, 0, SEEK_SET);
-
- if (FileSize < sizeof(SChunkHeader))
- {
- fclose(pFile);
- return false;
- }
-
- // read the header
- SChunkHeader Header;
- fread(&Header, sizeof(SChunkHeader), 1, pFile);
- if (Header.Revision != _Revision)
- {
- fclose(pFile);
- return false;
- }
-
- // get size
- int sz = FileSize - sizeof(SChunkHeader);
- if (Header.ExpectedSize != sz)
- {
- fclose(pFile);
- return false;
- }
-
- // read the state
- u8* buffer = new u8[sz];
- fread(buffer, 1, sz, pFile);
- fclose(pFile);
-
- u8 *ptr = buffer;
- PointerWrap p(&ptr, PointerWrap::MODE_READ);
- _class.DoState(p);
- delete [] buffer;
-
- return true;
- }
-
- return false;
- }
-
- template<class T>
- static bool Save(const std::string& _rFilename, int _Revision, T& _class)
- {
- FILE* pFile = fopen(_rFilename.c_str(), "wb");
- if (pFile)
- {
- u8 *ptr = 0;
- PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
- _class.DoState(p);
- size_t sz = (size_t)ptr;
- u8 *buffer = new u8[sz];
- ptr = buffer;
- p.SetMode(PointerWrap::MODE_WRITE);
- _class.DoState(p);
-
- SChunkHeader Header;
- Header.Compress = 0;
- Header.Revision = _Revision;
- Header.ExpectedSize = sz;
-
- fwrite(&Header, sizeof(SChunkHeader), 1, pFile);
- fwrite(buffer, sz, 1, pFile);
- fclose(pFile);
-
- return true;
- }
-
- return false;
- }
-private:
- struct SChunkHeader
- {
- int Revision;
- int Compress;
- int ExpectedSize;
- };
-};
-
-#endif // _POINTERWRAP_H
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _POINTERWRAP_H
+#define _POINTERWRAP_H
+
+// Extremely simple serialization framework.
+
+// (mis)-features:
+// + Super fast
+// + Very simple
+// + Same code is used for serialization and deserializaition (in most cases)
+// - Zero backwards/forwards compatibility
+// - Serialization code for anything complex has to be manually written.
+
+#include <stdio.h>
+
+#include <map>
+#include <vector>
+#include <string>
+
+#include "Common.h"
+
+template <class T>
+struct LinkedListItem : public T
+{
+ LinkedListItem<T> *next;
+};
+
+
+class PointerWrap
+{
+public:
+ enum Mode // also defined in pluginspecs.h. Didn't want to couple them.
+ {
+ MODE_READ = 1,
+ MODE_WRITE,
+ MODE_MEASURE,
+ };
+
+ u8 **ptr;
+ Mode mode;
+
+public:
+ PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {}
+ PointerWrap(unsigned char **ptr_, int mode_) : ptr((u8**)ptr_), mode((Mode)mode_) {}
+
+ void SetMode(Mode mode_) {mode = mode_;}
+ Mode GetMode() const {return mode;}
+ u8 **GetPPtr() {return ptr;}
+
+ void DoVoid(void *data, int size)
+ {
+ switch (mode)
+ {
+ case MODE_READ: memcpy(data, *ptr, size); break;
+ case MODE_WRITE: memcpy(*ptr, data, size); break;
+ case MODE_MEASURE: break; // MODE_MEASURE - don't need to do anything
+ default: break; // throw an error?
+ }
+ (*ptr) += size;
+ }
+
+ // Store maps to file. Very useful.
+ template<class T>
+ void Do(std::map<unsigned int, T> &x) {
+ // TODO
+ PanicAlert("Do(map<>) does not yet work.");
+ }
+
+ // Store vectors.
+ template<class T>
+ void Do(std::vector<T> &x) {
+ // TODO
+ PanicAlert("Do(vector<>) does not yet work.");
+ }
+
+ // Store strings.
+ void Do(std::string &x)
+ {
+ int stringLen = (int)x.length() + 1;
+ Do(stringLen);
+
+ switch (mode)
+ {
+ case MODE_READ: x = (char*)*ptr; break;
+ case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break;
+ case MODE_MEASURE: break;
+ }
+ (*ptr) += stringLen;
+ }
+
+ void DoBuffer(u8** pBuffer, u32& _Size)
+ {
+ Do(_Size);
+
+ if (_Size > 0)
+ {
+ switch (mode)
+ {
+ case MODE_READ: *pBuffer = new u8[_Size]; memcpy(*pBuffer, *ptr, _Size); break;
+ case MODE_WRITE: memcpy(*ptr, *pBuffer, _Size); break;
+ case MODE_MEASURE: break;
+ }
+ }
+ else
+ {
+ *pBuffer = NULL;
+ }
+ (*ptr) += _Size;
+ }
+
+ template<class T>
+ void DoArray(T *x, int count) {
+ DoVoid((void *)x, sizeof(T) * count);
+ }
+
+ template<class T>
+ void Do(T &x) {
+ DoVoid((void *)&x, sizeof(x));
+ }
+
+ template<class T>
+ void DoLinkedList(LinkedListItem<T> **list_start) {
+ // TODO
+ PanicAlert("Do(vector<>) does not yet work.");
+ }
+};
+
+
+class CChunkFileReader
+{
+public:
+ template<class T>
+ static bool Load(const std::string& _rFilename, int _Revision, T& _class)
+ {
+ FILE* pFile = fopen(_rFilename.c_str(), "rb");
+ if (pFile)
+ {
+ // get size
+ fseek(pFile, 0, SEEK_END);
+ size_t FileSize = ftell(pFile);
+ fseek(pFile, 0, SEEK_SET);
+
+ if (FileSize < sizeof(SChunkHeader))
+ {
+ fclose(pFile);
+ return false;
+ }
+
+ // read the header
+ SChunkHeader Header;
+ fread(&Header, sizeof(SChunkHeader), 1, pFile);
+ if (Header.Revision != _Revision)
+ {
+ fclose(pFile);
+ return false;
+ }
+
+ // get size
+ int sz = FileSize - sizeof(SChunkHeader);
+ if (Header.ExpectedSize != sz)
+ {
+ fclose(pFile);
+ return false;
+ }
+
+ // read the state
+ u8* buffer = new u8[sz];
+ fread(buffer, 1, sz, pFile);
+ fclose(pFile);
+
+ u8 *ptr = buffer;
+ PointerWrap p(&ptr, PointerWrap::MODE_READ);
+ _class.DoState(p);
+ delete [] buffer;
+
+ return true;
+ }
+
+ return false;
+ }
+
+ template<class T>
+ static bool Save(const std::string& _rFilename, int _Revision, T& _class)
+ {
+ FILE* pFile = fopen(_rFilename.c_str(), "wb");
+ if (pFile)
+ {
+ u8 *ptr = 0;
+ PointerWrap p(&ptr, PointerWrap::MODE_MEASURE);
+ _class.DoState(p);
+ size_t sz = (size_t)ptr;
+ u8 *buffer = new u8[sz];
+ ptr = buffer;
+ p.SetMode(PointerWrap::MODE_WRITE);
+ _class.DoState(p);
+
+ SChunkHeader Header;
+ Header.Compress = 0;
+ Header.Revision = _Revision;
+ Header.ExpectedSize = sz;
+
+ fwrite(&Header, sizeof(SChunkHeader), 1, pFile);
+ fwrite(buffer, sz, 1, pFile);
+ fclose(pFile);
+
+ return true;
+ }
+
+ return false;
+ }
+private:
+ struct SChunkHeader
+ {
+ int Revision;
+ int Compress;
+ int ExpectedSize;
+ };
+};
+
+#endif // _POINTERWRAP_H
diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h
index c8ef3c8092..b23d75d548 100644
--- a/Source/Core/Common/Src/Common.h
+++ b/Source/Core/Common/Src/Common.h
@@ -1,306 +1,306 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _COMMON_H
-#define _COMMON_H
-
-#define _CRTDBG_MAP_ALLOC
-#define _CRTDBG_MAP_ALLOC_NEW
-
-#ifdef OSX64
-#define MAP_32BIT 0
-#endif
-
-#define CHECK_HEAP_INTEGRITY()
-
-#ifdef _WIN32
-#ifdef _DEBUG
-#include <crtdbg.h>
-#undef CHECK_HEAP_INTEGRITY
-#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");}
-#endif
-
-#include "../../../PluginSpecs/CommonTypes.h"
-#define HAVE_WIIUSE 1
-#define HAVE_WX 1
-#else
-#include "CommonTypes.h"
-#include "Config.h"
-#endif
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "Paths.h"
-
-// Function Cross-Compatibility
-#ifdef _WIN32
-#define strcasecmp _stricmp
-#define unlink _unlink
-#else
-#define _stricmp strcasecmp
-#define _unlink unlink
-#endif
-
-#ifdef _WIN32
-
-// By default, MS' stdio implementation does not support 64-bit offsets.
-// This little hack fixes that, keeping the code portable to linux where fseek and fread
-// do support 64-bit offsets in modern distributions.
-#define fseek _fseeki64
-#define ftell _ftelli64
-
-#define atoll _atoi64
-
-#define POSIX 0
-#define NOMINMAX
-
-#if _M_IX86
-#define Crash() {__asm int 3}
-#else
-#if _MSC_VER > 1000
-extern "C" {
- __declspec(dllimport) void __stdcall DebugBreak(void);
-}
-#define Crash() {DebugBreak();}
-#else
-#error fixme
-#endif
-#endif
-
-#elif __GNUC__
-#define POSIX 1
-#define MAX_PATH 260
-#define stricmp strcasecmp
-#define Crash() {asm ("int $3");}
-#ifdef _LP64
-#define _M_X64 1
-#else
-#define _M_IX86 1
-#endif
-#endif
-
-// Alignment
-
-#if defined(_MSC_VER)
-
-#define GC_ALIGNED16(x) __declspec(align(16)) x
-#define GC_ALIGNED32(x) __declspec(align(32)) x
-#define GC_ALIGNED64(x) __declspec(align(64)) x
-#define GC_ALIGNED16_DECL(x) __declspec(align(16)) x
-#define GC_ALIGNED64_DECL(x) __declspec(align(64)) x
-
-#else
-
-#define GC_ALIGNED16(x) __attribute((aligned(16))) x
-#define GC_ALIGNED32(x) __attribute((aligned(16))) x
-#define GC_ALIGNED64(x) __attribute((aligned(64))) x
-#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x
-#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x
-
-#endif
-
-// Various Windows compatibility
-
-#if !defined(_WIN32)
-inline u32 _rotl(u32 x, int shift) {
- return (x << shift) | (x >> (32 - shift));
-}
-
-inline u32 _rotr(u32 x, int shift) {
- return (x >> shift) | (x << (32 - shift));
-}
-
-#define LONG int
-#ifdef __LINUX__
-typedef union _LARGE_INTEGER
-{
- long long QuadPart;
-} LARGE_INTEGER;
-#endif
-
-#ifndef __forceinline
-#define __forceinline inline
-#endif
-#endif
-
-#if defined (_M_IX86) && defined (_WIN32)
-#define HWCALL __cdecl
-#else
-#define HWCALL
-#endif
-
-#undef min
-#undef max
-
-template<class T>
-inline T min(const T& a, const T& b) {return a > b ? b : a;}
-template<class T>
-inline T max(const T& a, const T& b) {return a > b ? a : b;}
-
-// Byte ordering
-
-namespace Common
-{
-inline u8 swap8(u8 _data) {return(_data);}
-
-
-#ifdef _WIN32
-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 __linux__
-}
-#include <byteswap.h>
-namespace Common
-{
-inline u16 swap16(u16 _data) {return(bswap_16(_data));}
-inline u32 swap32(u32 _data) {return(bswap_32(_data));}
-inline u64 swap64(u64 _data) {return(bswap_64(_data));}
-
-
-#else
-inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));}
-inline u32 swap32(u32 data) {return((swap16(data) << 16) | swap16(data >> 16));}
-inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 32));}
-#endif
-
-} // end of namespace Common
-
-// Utility functions
-
-void PanicAlert(const char* text, ...);
-bool PanicYesNo(const char* text, ...);
-bool AskYesNo(const char* text, ...);
-
-extern void __Log(int logNumber, const char* text, ...);
-extern void __Logv(int log, int v, const char *format, ...);
-
-
-// dummy class
-class LogTypes
-{
- public:
- enum LOG_TYPE
- {
- MASTER_LOG,
- BOOT,
- PIXELENGINE,
- COMMANDPROCESSOR,
- VIDEOINTERFACE,
- SERIALINTERFACE,
- PERIPHERALINTERFACE,
- MEMMAP,
- DSPINTERFACE,
- STREAMINGINTERFACE,
- DVDINTERFACE,
- GPFIFO,
- EXPANSIONINTERFACE,
- AUDIO_INTERFACE,
- GEKKO,
- HLE,
- DSPHLE,
- VIDEO,
- AUDIO,
- DYNA_REC,
- CONSOLE,
- OSREPORT,
- WII_IOB,
- WII_IPC,
- WII_IPC_HLE,
- WII_IPC_DVD,
- WII_IPC_ES,
- WII_IPC_FILEIO,
- WII_IPC_SD,
- WII_IPC_NET,
- WII_IPC_WIIMOTE,
- ACTIONREPLAY,
- NUMBER_OF_LOGS
- };
-};
-
-typedef bool (*PanicAlertHandler)(const char* text, bool yes_no);
-void RegisterPanicAlertHandler(PanicAlertHandler handler);
-
-void Host_UpdateLogDisplay();
-
-// Logging macros
-#ifdef LOGGING
-
-#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
-#define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__);
-
-#define _dbg_assert_(_t_, _a_) \
- if (!(_a_)){\
- LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
- __LINE__, __FILE__, __TIME__); \
- if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \
- }
-#define _dbg_assert_msg_(_t_, _a_, ...)\
- if (!(_a_)){\
- LOG(_t_, __VA_ARGS__); \
- if (!PanicYesNo(__VA_ARGS__)){Crash();} \
- }
-#define _dbg_update_() Host_UpdateLogDisplay();
-
-#else
-
-#define LOG(_t_, ...)
-#define LOGV(_t_,_v_, ...)
-#define _dbg_clear_()
-#ifndef _dbg_assert_
-#define _dbg_assert_(_t_, _a_) ;
-#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
-#endif
-#define _dbg_update_() ;
-
-#endif
-
-#ifdef _WIN32
-#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
-#define _assert_msg_(_t_, _a_, _fmt_, ...)\
- if (!(_a_)){\
- if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \
- }
-#else
-#define _assert_(a)
-#define _assert_msg_(...)
-#endif
-
-// compile time asserts
-namespace
-{
-
-// it is very risky to mix _SECURE_SCL=0 and _SECURE_SCL=1 compiled libraries
-// it is possible that you overwrite memory if you do it
-#ifdef _WIN32
- #ifndef _SECURE_SCL
- #error Please define _SECURE_SCL=0 in the project settings
- #else
- template <bool> struct CompileTimeAssert;
- template<> struct CompileTimeAssert<true> {};
- CompileTimeAssert<_SECURE_SCL==0> x;
- #endif
-#endif
-
-}
-
-#endif // #ifndef _COMMON_H
-
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _COMMON_H
+#define _COMMON_H
+
+#define _CRTDBG_MAP_ALLOC
+#define _CRTDBG_MAP_ALLOC_NEW
+
+#ifdef OSX64
+#define MAP_32BIT 0
+#endif
+
+#define CHECK_HEAP_INTEGRITY()
+
+#ifdef _WIN32
+#ifdef _DEBUG
+#include <crtdbg.h>
+#undef CHECK_HEAP_INTEGRITY
+#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");}
+#endif
+
+#include "../../../PluginSpecs/CommonTypes.h"
+#define HAVE_WIIUSE 1
+#define HAVE_WX 1
+#else
+#include "CommonTypes.h"
+#include "Config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "Paths.h"
+
+// Function Cross-Compatibility
+#ifdef _WIN32
+#define strcasecmp _stricmp
+#define unlink _unlink
+#else
+#define _stricmp strcasecmp
+#define _unlink unlink
+#endif
+
+#ifdef _WIN32
+
+// By default, MS' stdio implementation does not support 64-bit offsets.
+// This little hack fixes that, keeping the code portable to linux where fseek and fread
+// do support 64-bit offsets in modern distributions.
+#define fseek _fseeki64
+#define ftell _ftelli64
+
+#define atoll _atoi64
+
+#define POSIX 0
+#define NOMINMAX
+
+#if _M_IX86
+#define Crash() {__asm int 3}
+#else
+#if _MSC_VER > 1000
+extern "C" {
+ __declspec(dllimport) void __stdcall DebugBreak(void);
+}
+#define Crash() {DebugBreak();}
+#else
+#error fixme
+#endif
+#endif
+
+#elif __GNUC__
+#define POSIX 1
+#define MAX_PATH 260
+#define stricmp strcasecmp
+#define Crash() {asm ("int $3");}
+#ifdef _LP64
+#define _M_X64 1
+#else
+#define _M_IX86 1
+#endif
+#endif
+
+// Alignment
+
+#if defined(_MSC_VER)
+
+#define GC_ALIGNED16(x) __declspec(align(16)) x
+#define GC_ALIGNED32(x) __declspec(align(32)) x
+#define GC_ALIGNED64(x) __declspec(align(64)) x
+#define GC_ALIGNED16_DECL(x) __declspec(align(16)) x
+#define GC_ALIGNED64_DECL(x) __declspec(align(64)) x
+
+#else
+
+#define GC_ALIGNED16(x) __attribute((aligned(16))) x
+#define GC_ALIGNED32(x) __attribute((aligned(16))) x
+#define GC_ALIGNED64(x) __attribute((aligned(64))) x
+#define GC_ALIGNED16_DECL(x) __attribute((aligned(16))) x
+#define GC_ALIGNED64_DECL(x) __attribute((aligned(64))) x
+
+#endif
+
+// Various Windows compatibility
+
+#if !defined(_WIN32)
+inline u32 _rotl(u32 x, int shift) {
+ return (x << shift) | (x >> (32 - shift));
+}
+
+inline u32 _rotr(u32 x, int shift) {
+ return (x >> shift) | (x << (32 - shift));
+}
+
+#define LONG int
+#ifdef __LINUX__
+typedef union _LARGE_INTEGER
+{
+ long long QuadPart;
+} LARGE_INTEGER;
+#endif
+
+#ifndef __forceinline
+#define __forceinline inline
+#endif
+#endif
+
+#if defined (_M_IX86) && defined (_WIN32)
+#define HWCALL __cdecl
+#else
+#define HWCALL
+#endif
+
+#undef min
+#undef max
+
+template<class T>
+inline T min(const T& a, const T& b) {return a > b ? b : a;}
+template<class T>
+inline T max(const T& a, const T& b) {return a > b ? a : b;}
+
+// Byte ordering
+
+namespace Common
+{
+inline u8 swap8(u8 _data) {return(_data);}
+
+
+#ifdef _WIN32
+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 __linux__
+}
+#include <byteswap.h>
+namespace Common
+{
+inline u16 swap16(u16 _data) {return(bswap_16(_data));}
+inline u32 swap32(u32 _data) {return(bswap_32(_data));}
+inline u64 swap64(u64 _data) {return(bswap_64(_data));}
+
+
+#else
+inline u16 swap16(u16 data) {return((data >> 8) | (data << 8));}
+inline u32 swap32(u32 data) {return((swap16(data) << 16) | swap16(data >> 16));}
+inline u64 swap64(u64 data) {return(((u64)swap32(data) << 32) | swap32(data >> 32));}
+#endif
+
+} // end of namespace Common
+
+// Utility functions
+
+void PanicAlert(const char* text, ...);
+bool PanicYesNo(const char* text, ...);
+bool AskYesNo(const char* text, ...);
+
+extern void __Log(int logNumber, const char* text, ...);
+extern void __Logv(int log, int v, const char *format, ...);
+
+
+// dummy class
+class LogTypes
+{
+ public:
+ enum LOG_TYPE
+ {
+ MASTER_LOG,
+ BOOT,
+ PIXELENGINE,
+ COMMANDPROCESSOR,
+ VIDEOINTERFACE,
+ SERIALINTERFACE,
+ PERIPHERALINTERFACE,
+ MEMMAP,
+ DSPINTERFACE,
+ STREAMINGINTERFACE,
+ DVDINTERFACE,
+ GPFIFO,
+ EXPANSIONINTERFACE,
+ AUDIO_INTERFACE,
+ GEKKO,
+ HLE,
+ DSPHLE,
+ VIDEO,
+ AUDIO,
+ DYNA_REC,
+ CONSOLE,
+ OSREPORT,
+ WII_IOB,
+ WII_IPC,
+ WII_IPC_HLE,
+ WII_IPC_DVD,
+ WII_IPC_ES,
+ WII_IPC_FILEIO,
+ WII_IPC_SD,
+ WII_IPC_NET,
+ WII_IPC_WIIMOTE,
+ ACTIONREPLAY,
+ NUMBER_OF_LOGS
+ };
+};
+
+typedef bool (*PanicAlertHandler)(const char* text, bool yes_no);
+void RegisterPanicAlertHandler(PanicAlertHandler handler);
+
+void Host_UpdateLogDisplay();
+
+// Logging macros
+#ifdef LOGGING
+
+#define LOG(t, ...) __Log(LogTypes::t, __VA_ARGS__);
+#define LOGV(t,v, ...) __Logv(LogTypes::t, v, __VA_ARGS__);
+
+#define _dbg_assert_(_t_, _a_) \
+ if (!(_a_)){\
+ LOG(_t_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
+ __LINE__, __FILE__, __TIME__); \
+ if (!PanicYesNo("*** Assertion (see log)***\n")){Crash();} \
+ }
+#define _dbg_assert_msg_(_t_, _a_, ...)\
+ if (!(_a_)){\
+ LOG(_t_, __VA_ARGS__); \
+ if (!PanicYesNo(__VA_ARGS__)){Crash();} \
+ }
+#define _dbg_update_() Host_UpdateLogDisplay();
+
+#else
+
+#define LOG(_t_, ...)
+#define LOGV(_t_,_v_, ...)
+#define _dbg_clear_()
+#ifndef _dbg_assert_
+#define _dbg_assert_(_t_, _a_) ;
+#define _dbg_assert_msg_(_t_, _a_, _desc_, ...) ;
+#endif
+#define _dbg_update_() ;
+
+#endif
+
+#ifdef _WIN32
+#define _assert_(_a_) _dbg_assert_(MASTER_LOG, _a_)
+#define _assert_msg_(_t_, _a_, _fmt_, ...)\
+ if (!(_a_)){\
+ if (!PanicYesNo(_fmt_, __VA_ARGS__)){Crash();} \
+ }
+#else
+#define _assert_(a)
+#define _assert_msg_(...)
+#endif
+
+// compile time asserts
+namespace
+{
+
+// it is very risky to mix _SECURE_SCL=0 and _SECURE_SCL=1 compiled libraries
+// it is possible that you overwrite memory if you do it
+#ifdef _WIN32
+ #ifndef _SECURE_SCL
+ #error Please define _SECURE_SCL=0 in the project settings
+ #else
+ template <bool> struct CompileTimeAssert;
+ template<> struct CompileTimeAssert<true> {};
+ CompileTimeAssert<_SECURE_SCL==0> x;
+ #endif
+#endif
+
+}
+
+#endif // #ifndef _COMMON_H
+
+
diff --git a/Source/Core/Common/Src/DriveUtil.h b/Source/Core/Common/Src/DriveUtil.h
index 987d0a937f..675484f247 100644
--- a/Source/Core/Common/Src/DriveUtil.h
+++ b/Source/Core/Common/Src/DriveUtil.h
@@ -1,28 +1,28 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _DRIVEUTIL_H
-#define _DRIVEUTIL_H
-
-#include <string>
-#include <vector>
-
-// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
-
-void GetAllRemovableDrives(std::vector<std::string> *drives);
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _DRIVEUTIL_H
+#define _DRIVEUTIL_H
+
+#include <string>
+#include <vector>
+
+// Tools to enumerate drives (HDD, DVD, CD) in a platform-independent manner.
+
+void GetAllRemovableDrives(std::vector<std::string> *drives);
+
+#endif
diff --git a/Source/Core/Common/Src/DynamicLibrary.h b/Source/Core/Common/Src/DynamicLibrary.h
index c2cd2cc5f4..9564b10d9d 100644
--- a/Source/Core/Common/Src/DynamicLibrary.h
+++ b/Source/Core/Common/Src/DynamicLibrary.h
@@ -1,47 +1,47 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _DYNAMICLIBRARY_H
-#define _DYNAMICLIBRARY_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include <string>
-
-class DynamicLibrary
-{
- public:
-
- DynamicLibrary();
- int Load(const char* filename);
- void Unload();
- void* Get(const char* funcname) const;
-
- bool IsLoaded() const {return(library != 0);}
-
- private:
- std::string library_file;
-#ifdef _WIN32
- HINSTANCE library;
-#else
- void* library;
-#endif
-};
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _DYNAMICLIBRARY_H
+#define _DYNAMICLIBRARY_H
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include <string>
+
+class DynamicLibrary
+{
+ public:
+
+ DynamicLibrary();
+ int Load(const char* filename);
+ void Unload();
+ void* Get(const char* funcname) const;
+
+ bool IsLoaded() const {return(library != 0);}
+
+ private:
+ std::string library_file;
+#ifdef _WIN32
+ HINSTANCE library;
+#else
+ void* library;
+#endif
+};
+
+#endif
diff --git a/Source/Core/Common/Src/ExtendedTrace.h b/Source/Core/Common/Src/ExtendedTrace.h
index 853d2b4f18..29459cf547 100644
--- a/Source/Core/Common/Src/ExtendedTrace.h
+++ b/Source/Core/Common/Src/ExtendedTrace.h
@@ -1,56 +1,56 @@
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com
-// For companies(Austin,TX): If you would like to get my resume, send an email.
-//
-// The source is free, but if you want to use it, mention my name and e-mail address
-//
-// History:
-// 1.0 Initial version Zoltan Csizmadia
-// 1.1 WhineCube version Masken
-// 1.2 Dolphin version Masken
-//
-//////////////////////////////////////////////////////////////////////////////////////
-//
-// ExtendedTrace.h
-//
-
-#ifndef EXTENDEDTRACE_H_INCLUDED
-#define EXTENDEDTRACE_H_INCLUDED
-
-#if defined(WIN32)
-
-#include <windows.h>
-#include <tchar.h>
-
-#include <string>
-
-#pragma comment( lib, "imagehlp.lib" )
-
-#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
-#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
-#define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file)
-#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp)
-//class File;
-
-BOOL InitSymInfo( PCSTR );
-BOOL UninitSymInfo();
-void StackTrace( HANDLE, LPCTSTR, FILE *file);
-void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
-
-//functions by Masken
-void etfprintf(FILE *file, const char *format, ...);
-void etfprint(FILE *file, const std::string &text);
-#define UEFBUFSIZE 2048
-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)
-
-#endif //WIN32
-
-#endif //EXTENDEDTRACE_H_INCLUDED
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com
+// For companies(Austin,TX): If you would like to get my resume, send an email.
+//
+// The source is free, but if you want to use it, mention my name and e-mail address
+//
+// History:
+// 1.0 Initial version Zoltan Csizmadia
+// 1.1 WhineCube version Masken
+// 1.2 Dolphin version Masken
+//
+//////////////////////////////////////////////////////////////////////////////////////
+//
+// ExtendedTrace.h
+//
+
+#ifndef EXTENDEDTRACE_H_INCLUDED
+#define EXTENDEDTRACE_H_INCLUDED
+
+#if defined(WIN32)
+
+#include <windows.h>
+#include <tchar.h>
+
+#include <string>
+
+#pragma comment( lib, "imagehlp.lib" )
+
+#define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
+#define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
+#define STACKTRACE(file) StackTrace( GetCurrentThread(), _T(""), file)
+#define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), _T(""), file, eip, esp, ebp)
+//class File;
+
+BOOL InitSymInfo( PCSTR );
+BOOL UninitSymInfo();
+void StackTrace( HANDLE, LPCTSTR, FILE *file);
+void StackTrace( HANDLE, LPCTSTR, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
+
+//functions by Masken
+void etfprintf(FILE *file, const char *format, ...);
+void etfprint(FILE *file, const std::string &text);
+#define UEFBUFSIZE 2048
+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)
+
+#endif //WIN32
+
+#endif //EXTENDEDTRACE_H_INCLUDED
diff --git a/Source/Core/Common/Src/FileSearch.h b/Source/Core/Common/Src/FileSearch.h
index 4f0d7f7c09..fec300bfbe 100644
--- a/Source/Core/Common/Src/FileSearch.h
+++ b/Source/Core/Common/Src/FileSearch.h
@@ -1,44 +1,44 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef __FILESEARCH_H_
-#define __FILESEARCH_H_
-
-#include <string>
-#include <vector>
-
-class CFileSearch
-{
- public:
-
- typedef std::vector<std::string>XStringVector;
-
- CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
-
- const XStringVector& GetFileNames() const;
-
-
- private:
-
- void FindFiles(const std::string& _searchString, const std::string& _strPath);
-
-
- XStringVector m_FileNames;
-};
-
-#endif
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef __FILESEARCH_H_
+#define __FILESEARCH_H_
+
+#include <string>
+#include <vector>
+
+class CFileSearch
+{
+ public:
+
+ typedef std::vector<std::string>XStringVector;
+
+ CFileSearch(const XStringVector& _rSearchStrings, const XStringVector& _rDirectories);
+
+ const XStringVector& GetFileNames() const;
+
+
+ private:
+
+ void FindFiles(const std::string& _searchString, const std::string& _strPath);
+
+
+ XStringVector m_FileNames;
+};
+
+#endif
+
diff --git a/Source/Core/Common/Src/FileUtil.h b/Source/Core/Common/Src/FileUtil.h
index 9a0ef8ffbf..52c99d660b 100644
--- a/Source/Core/Common/Src/FileUtil.h
+++ b/Source/Core/Common/Src/FileUtil.h
@@ -1,60 +1,60 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _FILEUTIL_H
-#define _FILEUTIL_H
-
-#include <string>
-#include <vector>
-
-#include "Common.h"
-
-namespace File
-{
-
-struct FSTEntry
-{
- bool isDirectory;
- u32 size; // file length or number of entries from children
- std::string physicalName; // name on disk
- std::string virtualName; // name in FST names table
- std::vector<FSTEntry> children;
-};
-
-std::string SanitizePath(const char *filename);
-bool Exists(const char *filename);
-void Launch(const char *filename);
-void Explore(const char *path);
-bool IsDirectory(const char *filename);
-bool CreateDir(const char *filename);
-bool CreateDirectoryStructure(const std::string& _rFullPath);
-bool Delete(const char *filename);
-bool DeleteDir(const char *filename);
-bool Rename(const char *srcFilename, const char *destFilename);
-bool Copy(const char *srcFilename, const char *destFilename);
-u64 GetSize(const char *filename);
-std::string GetUserDirectory();
-bool CreateEmptyFile(const char *filename);
-
-u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry);
-
-bool DeleteDirRecursively(const std::string& _Directory);
-void GetCurrentDirectory(std::string& _rDirectory);
-
-} // namespace
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _FILEUTIL_H
+#define _FILEUTIL_H
+
+#include <string>
+#include <vector>
+
+#include "Common.h"
+
+namespace File
+{
+
+struct FSTEntry
+{
+ bool isDirectory;
+ u32 size; // file length or number of entries from children
+ std::string physicalName; // name on disk
+ std::string virtualName; // name in FST names table
+ std::vector<FSTEntry> children;
+};
+
+std::string SanitizePath(const char *filename);
+bool Exists(const char *filename);
+void Launch(const char *filename);
+void Explore(const char *path);
+bool IsDirectory(const char *filename);
+bool CreateDir(const char *filename);
+bool CreateDirectoryStructure(const std::string& _rFullPath);
+bool Delete(const char *filename);
+bool DeleteDir(const char *filename);
+bool Rename(const char *srcFilename, const char *destFilename);
+bool Copy(const char *srcFilename, const char *destFilename);
+u64 GetSize(const char *filename);
+std::string GetUserDirectory();
+bool CreateEmptyFile(const char *filename);
+
+u32 ScanDirectoryTree(const std::string& _Directory, FSTEntry& parentEntry);
+
+bool DeleteDirRecursively(const std::string& _Directory);
+void GetCurrentDirectory(std::string& _rDirectory);
+
+} // namespace
+
+#endif
diff --git a/Source/Core/Common/Src/FixedSizeQueue.h b/Source/Core/Common/Src/FixedSizeQueue.h
index cb51b5c11c..cdfad71349 100644
--- a/Source/Core/Common/Src/FixedSizeQueue.h
+++ b/Source/Core/Common/Src/FixedSizeQueue.h
@@ -1,81 +1,81 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _FIXED_SIZE_QUEUE_H
-#define _FIXED_SIZE_QUEUE_H
-
-// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
-// real STL classes.
-
-// Not fully featured, no safety checking yet. Add features as needed.
-
-// TODO: "inline" storage?
-
-template <class T, int N>
-class FixedSizeQueue
-{
- T *storage;
- int head;
- int tail;
- int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
-
- // Make copy constructor private for now.
- FixedSizeQueue(FixedSizeQueue &other) { }
-
-public:
- FixedSizeQueue()
- {
- head = 0;
- tail = 0;
- storage = new T[N];
- }
-
- ~FixedSizeQueue()
- {
- delete [] storage;
- }
-
- void push(T t) {
- storage[tail] = t;
- tail++;
- if (tail == N)
- tail = 0;
- count++;
- }
-
- void pop() {
- head++;
- if (head == N)
- head = 0;
- count--;
- }
-
- T pop_front() {
- const T &temp = storage[head];
- pop();
- return temp;
- }
-
- T &front() { return storage[head]; }
- const T &front() const { return storage[head]; }
-
- size_t size() const {
- return count;
- }
-};
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _FIXED_SIZE_QUEUE_H
+#define _FIXED_SIZE_QUEUE_H
+
+// STL-look-a-like interface, but name is mixed case to distinguish it clearly from the
+// real STL classes.
+
+// Not fully featured, no safety checking yet. Add features as needed.
+
+// TODO: "inline" storage?
+
+template <class T, int N>
+class FixedSizeQueue
+{
+ T *storage;
+ int head;
+ int tail;
+ int count; // sacrifice 4 bytes for a simpler implementation. may optimize away in the future.
+
+ // Make copy constructor private for now.
+ FixedSizeQueue(FixedSizeQueue &other) { }
+
+public:
+ FixedSizeQueue()
+ {
+ head = 0;
+ tail = 0;
+ storage = new T[N];
+ }
+
+ ~FixedSizeQueue()
+ {
+ delete [] storage;
+ }
+
+ void push(T t) {
+ storage[tail] = t;
+ tail++;
+ if (tail == N)
+ tail = 0;
+ count++;
+ }
+
+ void pop() {
+ head++;
+ if (head == N)
+ head = 0;
+ count--;
+ }
+
+ T pop_front() {
+ const T &temp = storage[head];
+ pop();
+ return temp;
+ }
+
+ T &front() { return storage[head]; }
+ const T &front() const { return storage[head]; }
+
+ size_t size() const {
+ return count;
+ }
+};
+
#endif // _FIXED_SIZE_QUEUE_H \ No newline at end of file
diff --git a/Source/Core/Common/Src/Hash.h b/Source/Core/Common/Src/Hash.h
index f2e1df42da..2b4a323a5e 100644
--- a/Source/Core/Common/Src/Hash.h
+++ b/Source/Core/Common/Src/Hash.h
@@ -1,28 +1,28 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#ifndef _HASH_H
-#define _HASH_H
-
-#include "Common.h"
-
-u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
-u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
-u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
-u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
-
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+#ifndef _HASH_H
+#define _HASH_H
+
+#include "Common.h"
+
+u32 HashFletcher(const u8* data_u8, size_t length); // FAST. Length & 1 == 0.
+u32 HashAdler32(const u8* data, size_t len); // Fairly accurate, slightly slower
+u32 HashFNV(const u8* ptr, int length); // Another fast and decent hash
+u32 HashEctor(const u8* ptr, int length); // JUNK. DO NOT USE FOR NEW THINGS
+
+
+#endif
diff --git a/Source/Core/Common/Src/IniFile.h b/Source/Core/Common/Src/IniFile.h
index 9614bf8b46..767f554c3b 100644
--- a/Source/Core/Common/Src/IniFile.h
+++ b/Source/Core/Common/Src/IniFile.h
@@ -1,88 +1,88 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _INIFILE_H
-#define _INIFILE_H
-
-#include <string>
-#include <vector>
-
-#include "StringUtil.h"
-
-class Section
-{
-public:
- Section();
- Section(const std::string& _name);
- Section(const Section& other);
- std::vector<std::string>lines;
- std::string name;
- std::string comment;
-
- bool operator<(const Section& other) const
- {
- return(name < other.name);
- }
-};
-
-class IniFile
-{
-public:
- IniFile();
- ~IniFile();
-
- bool Load(const char* filename);
- bool Save(const char* filename);
-
- void Set(const char* sectionName, const char* key, const char* newValue);
- void Set(const char* sectionName, const char* key, int newValue);
- void Set(const char* sectionName, const char* key, u32 newValue);
- void Set(const char* sectionName, const char* key, bool newValue);
- void Set(const char* sectionName, const char* key, const std::string& newValue) {Set(sectionName, key, newValue.c_str());}
- void Set(const char* sectionName, const char* key, const std::vector<std::string>& newValues);
-
- void SetLines(const char* sectionName, const std::vector<std::string> &lines);
-
- // getter should be const
- bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
- bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);
- bool Get(const char* sectionName, const char* key, u32* value, u32 defaultValue = 0);
- bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false);
- bool Get(const char* sectionName, const char* key, std::vector<std::string>& values);
-
- bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
- bool GetLines(const char* sectionName, std::vector<std::string>& lines) const;
-
- bool DeleteKey(const char* sectionName, const char* key);
- bool DeleteSection(const char* sectionName);
-
- void SortSections();
-
- void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const;
- std::string* GetLine(Section* section, const char* key, std::string* valueOut, std::string* commentOut);
-
-private:
- std::vector<Section>sections;
-
- const Section* GetSection(const char* section) const;
- Section* GetSection(const char* section);
- Section* GetOrCreateSection(const char* section);
- std::string* GetLine(const char* section, const char* key);
- void CreateSection(const char* section);
-};
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _INIFILE_H
+#define _INIFILE_H
+
+#include <string>
+#include <vector>
+
+#include "StringUtil.h"
+
+class Section
+{
+public:
+ Section();
+ Section(const std::string& _name);
+ Section(const Section& other);
+ std::vector<std::string>lines;
+ std::string name;
+ std::string comment;
+
+ bool operator<(const Section& other) const
+ {
+ return(name < other.name);
+ }
+};
+
+class IniFile
+{
+public:
+ IniFile();
+ ~IniFile();
+
+ bool Load(const char* filename);
+ bool Save(const char* filename);
+
+ void Set(const char* sectionName, const char* key, const char* newValue);
+ void Set(const char* sectionName, const char* key, int newValue);
+ void Set(const char* sectionName, const char* key, u32 newValue);
+ void Set(const char* sectionName, const char* key, bool newValue);
+ void Set(const char* sectionName, const char* key, const std::string& newValue) {Set(sectionName, key, newValue.c_str());}
+ void Set(const char* sectionName, const char* key, const std::vector<std::string>& newValues);
+
+ void SetLines(const char* sectionName, const std::vector<std::string> &lines);
+
+ // getter should be const
+ bool Get(const char* sectionName, const char* key, std::string* value, const char* defaultValue = "");
+ bool Get(const char* sectionName, const char* key, int* value, int defaultValue = 0);
+ bool Get(const char* sectionName, const char* key, u32* value, u32 defaultValue = 0);
+ bool Get(const char* sectionName, const char* key, bool* value, bool defaultValue = false);
+ bool Get(const char* sectionName, const char* key, std::vector<std::string>& values);
+
+ bool GetKeys(const char* sectionName, std::vector<std::string>& keys) const;
+ bool GetLines(const char* sectionName, std::vector<std::string>& lines) const;
+
+ bool DeleteKey(const char* sectionName, const char* key);
+ bool DeleteSection(const char* sectionName);
+
+ void SortSections();
+
+ void ParseLine(const std::string& line, std::string* keyOut, std::string* valueOut, std::string* commentOut) const;
+ std::string* GetLine(Section* section, const char* key, std::string* valueOut, std::string* commentOut);
+
+private:
+ std::vector<Section>sections;
+
+ const Section* GetSection(const char* section) const;
+ Section* GetSection(const char* section);
+ Section* GetOrCreateSection(const char* section);
+ std::string* GetLine(const char* section, const char* key);
+ void CreateSection(const char* section);
+};
+
+#endif
diff --git a/Source/Core/Common/Src/MappedFile.h b/Source/Core/Common/Src/MappedFile.h
index 1536672f81..fe1ddd704a 100644
--- a/Source/Core/Common/Src/MappedFile.h
+++ b/Source/Core/Common/Src/MappedFile.h
@@ -1,51 +1,51 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-// Handles giant memory mapped files
-// Through some trickery, allows lock on byte boundaries
-// instead of allocation granularity boundaries
-// for ease of use
-//
-
-#ifndef _MAPPED_FILE_H
-#define _MAPPED_FILE_H
-
-// #pragma warning (disable: 4786)
-
-#include <map>
-
-namespace Common
-{
-class IMappedFile
-{
- public:
-
- virtual ~IMappedFile() {}
-
-
- virtual bool Open(const char* _szFilename) = 0;
- virtual bool IsOpen(void) = 0;
- virtual void Close(void) = 0;
- virtual u64 GetSize(void) = 0;
- virtual u8* Lock(u64 _offset, u64 _size) = 0;
- virtual void Unlock(u8* ptr) = 0;
-
- static IMappedFile* CreateMappedFileDEPRECATED();
-};
-} // end of namespace DiscIO
-
-#endif
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+// Handles giant memory mapped files
+// Through some trickery, allows lock on byte boundaries
+// instead of allocation granularity boundaries
+// for ease of use
+//
+
+#ifndef _MAPPED_FILE_H
+#define _MAPPED_FILE_H
+
+// #pragma warning (disable: 4786)
+
+#include <map>
+
+namespace Common
+{
+class IMappedFile
+{
+ public:
+
+ virtual ~IMappedFile() {}
+
+
+ virtual bool Open(const char* _szFilename) = 0;
+ virtual bool IsOpen(void) = 0;
+ virtual void Close(void) = 0;
+ virtual u64 GetSize(void) = 0;
+ virtual u8* Lock(u64 _offset, u64 _size) = 0;
+ virtual void Unlock(u8* ptr) = 0;
+
+ static IMappedFile* CreateMappedFileDEPRECATED();
+};
+} // end of namespace DiscIO
+
+#endif
+
diff --git a/Source/Core/Common/Src/MathUtil.h b/Source/Core/Common/Src/MathUtil.h
index 9d3aa0d91d..b42c4553ff 100644
--- a/Source/Core/Common/Src/MathUtil.h
+++ b/Source/Core/Common/Src/MathUtil.h
@@ -1,35 +1,35 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _MATH_UTIL_H
-#define _MATH_UTIL_H
-
-#include <xmmintrin.h>
-
-/*
- 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 SaveSSEState();
-void LoadSSEState();
-void LoadDefaultSSEState();
-
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _MATH_UTIL_H
+#define _MATH_UTIL_H
+
+#include <xmmintrin.h>
+
+/*
+ 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 SaveSSEState();
+void LoadSSEState();
+void LoadDefaultSSEState();
+
+
+#endif
diff --git a/Source/Core/Common/Src/MemArena.h b/Source/Core/Common/Src/MemArena.h
index 6a4ae6f3c6..a6651ea8bf 100644
--- a/Source/Core/Common/Src/MemArena.h
+++ b/Source/Core/Common/Src/MemArena.h
@@ -1,52 +1,52 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _MEMARENA_H
-#define _MEMARENA_H
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
-#include "Common.h"
-
-// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
-// Multiple views can mirror the same section of the block, which makes it very convient for emulating
-// memory mirrors.
-// Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB.
-
-class MemArena
-{
-public:
- void GrabLowMemSpace(size_t size);
- void ReleaseSpace();
- void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false);
- void* CreateViewAt(s64 offset, size_t size, void* base);
- void ReleaseView(void* view, size_t size);
-
- // This only finds 1 GB in 32-bit
- static u8* Find4GBBase();
-private:
-
-#ifdef _WIN32
- HANDLE hMemoryMapping;
-#else
- int fd;
-#endif
-};
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _MEMARENA_H
+#define _MEMARENA_H
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "Common.h"
+
+// This class lets you create a block of anonymous RAM, and then arbitrarily map views into it.
+// Multiple views can mirror the same section of the block, which makes it very convient for emulating
+// memory mirrors.
+// Pass ensure_low_mem = true to CreateView if you want arbitrarily positioned views to end up in the low 2GB.
+
+class MemArena
+{
+public:
+ void GrabLowMemSpace(size_t size);
+ void ReleaseSpace();
+ void* CreateView(s64 offset, size_t size, bool ensure_low_mem = false);
+ void* CreateViewAt(s64 offset, size_t size, void* base);
+ void ReleaseView(void* view, size_t size);
+
+ // This only finds 1 GB in 32-bit
+ static u8* Find4GBBase();
+private:
+
+#ifdef _WIN32
+ HANDLE hMemoryMapping;
+#else
+ int fd;
+#endif
+};
+
+#endif
diff --git a/Source/Core/Common/Src/MemoryUtil.h b/Source/Core/Common/Src/MemoryUtil.h
index e3415a9e33..a59fe2dc29 100644
--- a/Source/Core/Common/Src/MemoryUtil.h
+++ b/Source/Core/Common/Src/MemoryUtil.h
@@ -1,31 +1,31 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _MEMORYUTIL_H
-#define _MEMORYUTIL_H
-
-void* AllocateExecutableMemory(int size, bool low = true);
-void* AllocateMemoryPages(int size);
-void FreeMemoryPages(void* ptr, int size);
-void WriteProtectMemory(void* ptr, int size, bool executable = false);
-void UnWriteProtectMemory(void* ptr, int size, bool allowExecute);
-
-
-inline int GetPageSize() {return(4096);}
-
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _MEMORYUTIL_H
+#define _MEMORYUTIL_H
+
+void* AllocateExecutableMemory(int size, bool low = true);
+void* AllocateMemoryPages(int size);
+void FreeMemoryPages(void* ptr, int size);
+void WriteProtectMemory(void* ptr, int size, bool executable = false);
+void UnWriteProtectMemory(void* ptr, int size, bool allowExecute);
+
+
+inline int GetPageSize() {return(4096);}
+
+
+#endif
diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h
index ce022ddbe8..0ae7fc26c5 100644
--- a/Source/Core/Common/Src/Plugin.h
+++ b/Source/Core/Common/Src/Plugin.h
@@ -1,51 +1,51 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _PLUGIN_H
-#define _PLUGIN_H
-
-#include "Common.h"
-#include "../../../PluginSpecs/PluginSpecs.h"
-#include "DynamicLibrary.h"
-
-namespace Common
-{
-class CPlugin
-{
- public:
-
- static void Release(void);
- static bool Load(const char* _szName);
-
- static bool GetInfo(PLUGIN_INFO& _pluginInfo);
-
- static void Config(HWND _hwnd);
- static void About(HWND _hwnd);
- static void Debug(HWND _hwnd, bool Show);
-
-
- private:
-
- static DynamicLibrary m_hInstLib;
-
- static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
- static void (__cdecl * m_DllConfig)(HWND _hParent);
- static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show);
-};
-} // end of namespace Common
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _PLUGIN_H
+#define _PLUGIN_H
+
+#include "Common.h"
+#include "../../../PluginSpecs/PluginSpecs.h"
+#include "DynamicLibrary.h"
+
+namespace Common
+{
+class CPlugin
+{
+ public:
+
+ static void Release(void);
+ static bool Load(const char* _szName);
+
+ static bool GetInfo(PLUGIN_INFO& _pluginInfo);
+
+ static void Config(HWND _hwnd);
+ static void About(HWND _hwnd);
+ static void Debug(HWND _hwnd, bool Show);
+
+
+ private:
+
+ static DynamicLibrary m_hInstLib;
+
+ static void (__cdecl * m_GetDllInfo)(PLUGIN_INFO* _PluginInfo);
+ static void (__cdecl * m_DllConfig)(HWND _hParent);
+ static void (__cdecl * m_DllDebugger)(HWND _hParent, bool Show);
+};
+} // end of namespace Common
+
+#endif
diff --git a/Source/Core/Common/Src/StringUtil.h b/Source/Core/Common/Src/StringUtil.h
index acea52101c..7840b036fc 100644
--- a/Source/Core/Common/Src/StringUtil.h
+++ b/Source/Core/Common/Src/StringUtil.h
@@ -1,77 +1,77 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _STRINGUTIL_H
-#define _STRINGUTIL_H
-
-#include <stdarg.h>
-
-#include <vector>
-#include <string>
-
-#include "Common.h"
-
-std::string StringFromFormat(const char* format, ...);
-void ToStringFromFormat(std::string* out, const char* format, ...);
-
-
-// Expensive!
-void StringFromFormatV(std::string* out, const char* format, va_list args);
-
-
-// Cheap!
-bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
-
-
-template<size_t Count>
-inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
-{
- va_list args;
- va_start(args, format);
- CharArrayFromFormatV(out, Count, format, args);
- va_end(args);
-}
-
-
-std::string StripSpaces(const std::string &s);
-std::string StripQuotes(const std::string &s);
-std::string StripNewline(const std::string &s);
-std::string ThS(int a, bool b = true); // thousand separator
-
-
-std::string StringFromInt(int value);
-std::string StringFromBool(bool value);
-
-bool TryParseInt(const char* str, int* outVal);
-bool TryParseBool(const char* str, bool* output);
-bool TryParseUInt(const std::string& str, u32* output);
-
-
-// TODO: kill this
-bool AsciiToHex(const char* _szValue, u32& result);
-
-void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
-int ChooseStringFrom(const char* str, const char* * items);
-
-
-// filehelper
-bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
-void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);
-
-
-#endif
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _STRINGUTIL_H
+#define _STRINGUTIL_H
+
+#include <stdarg.h>
+
+#include <vector>
+#include <string>
+
+#include "Common.h"
+
+std::string StringFromFormat(const char* format, ...);
+void ToStringFromFormat(std::string* out, const char* format, ...);
+
+
+// Expensive!
+void StringFromFormatV(std::string* out, const char* format, va_list args);
+
+
+// Cheap!
+bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list args);
+
+
+template<size_t Count>
+inline void CharArrayFromFormat(char (& out)[Count], const char* format, ...)
+{
+ va_list args;
+ va_start(args, format);
+ CharArrayFromFormatV(out, Count, format, args);
+ va_end(args);
+}
+
+
+std::string StripSpaces(const std::string &s);
+std::string StripQuotes(const std::string &s);
+std::string StripNewline(const std::string &s);
+std::string ThS(int a, bool b = true); // thousand separator
+
+
+std::string StringFromInt(int value);
+std::string StringFromBool(bool value);
+
+bool TryParseInt(const char* str, int* outVal);
+bool TryParseBool(const char* str, bool* output);
+bool TryParseUInt(const std::string& str, u32* output);
+
+
+// TODO: kill this
+bool AsciiToHex(const char* _szValue, u32& result);
+
+void SplitString(const std::string& str, const std::string& delim, std::vector<std::string>& output);
+int ChooseStringFrom(const char* str, const char* * items);
+
+
+// filehelper
+bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename, std::string* _pExtension);
+void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path, const std::string& _Filename);
+
+
+#endif
+
diff --git a/Source/Core/Common/Src/TestFramework.h b/Source/Core/Common/Src/TestFramework.h
index f5472884bc..66d635e905 100644
--- a/Source/Core/Common/Src/TestFramework.h
+++ b/Source/Core/Common/Src/TestFramework.h
@@ -1,100 +1,100 @@
-// Stupidly simple automated testing framework
-// by ector
-
-// licence: Public Domain
-
-// If TESTING_ENABLE is true, all tests across the project will run before main().
-// If it's false, all tests will be destroyed by the linker, hopefully.
-
-// Unfortunately, MSVC:s library linker seems to kill off unreferenced objects, even if the
-// initialization has side effects. This makes this framework not work properly :(
-// TODO(ector): Find solution.
-
-// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P
-
-#define TESTING_ENABLE
-
-#ifndef _TEST_FRAMEWORK_H
-#define _TEST_FRAMEWORK_H
-
-#include "Common.h"
-#include <stdio.h>
-
-#ifdef TESTING_ENABLE
-
-namespace __test
-{
-extern int numTests;
-extern int numTestsFailed;
-}
-
-struct TestRunnah
-{
- const char* filename;
- const char* function;
- TestRunnah(const char* _filename, const char* _function)
- : filename(_filename), function(_function) {}
-
-
- bool AssertTrue(bool value, int line)
- {
- if (!value)
- {
- char string[256];
- sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
- PanicAlert("Test Results: %s", string);
- TestFailed();
- return(false);
- }
-
- return(true);
- }
-
-
- template<class T>
- bool AssertEqual(T a, T b, int line)
- {
- if (!(a == b))
- {
- // TODO(ector) : better output
- char string[256];
- sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
- PanicAlert("Test Results: %s", string);
- TestFailed();
- return(false);
- }
- }
-
-
- void TestFailed()
- {
- __test::numTestsFailed++;
- }
-};
-
-
-#define TEST(a) \
- void TEST_ ## a(TestRunnah * __tr); \
- struct DUMMY_ ## a \
- : public TestRunnah { \
- DUMMY_ ## a() \
- : TestRunnah(__FILE__, # a) {\
- TEST_ ## a(this); __test::numTests++;} }; \
- DUMMY_ ## a ddummy_ ## a; \
- void TEST_ ## a(TestRunnah * __tr)
-
-#else // TESTING_ENABLE
-
-#define TEST(a) \
- void TEST_ ## a(TestRunnah * __tr) \
-
-#endif
-
-#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;}
-#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;}
-
-int GetNumTests();
-int GetNumTestsFailed();
-
-
-#endif
+// Stupidly simple automated testing framework
+// by ector
+
+// licence: Public Domain
+
+// If TESTING_ENABLE is true, all tests across the project will run before main().
+// If it's false, all tests will be destroyed by the linker, hopefully.
+
+// Unfortunately, MSVC:s library linker seems to kill off unreferenced objects, even if the
+// initialization has side effects. This makes this framework not work properly :(
+// TODO(ector): Find solution.
+
+// TODO(ector): make sure tests are destroyed and that things compile without TESTING_ENABLE :P
+
+#define TESTING_ENABLE
+
+#ifndef _TEST_FRAMEWORK_H
+#define _TEST_FRAMEWORK_H
+
+#include "Common.h"
+#include <stdio.h>
+
+#ifdef TESTING_ENABLE
+
+namespace __test
+{
+extern int numTests;
+extern int numTestsFailed;
+}
+
+struct TestRunnah
+{
+ const char* filename;
+ const char* function;
+ TestRunnah(const char* _filename, const char* _function)
+ : filename(_filename), function(_function) {}
+
+
+ bool AssertTrue(bool value, int line)
+ {
+ if (!value)
+ {
+ char string[256];
+ sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
+ PanicAlert("Test Results: %s", string);
+ TestFailed();
+ return(false);
+ }
+
+ return(true);
+ }
+
+
+ template<class T>
+ bool AssertEqual(T a, T b, int line)
+ {
+ if (!(a == b))
+ {
+ // TODO(ector) : better output
+ char string[256];
+ sprintf(string, "%s:%s:%i: %s", filename, function, line, "failed");
+ PanicAlert("Test Results: %s", string);
+ TestFailed();
+ return(false);
+ }
+ }
+
+
+ void TestFailed()
+ {
+ __test::numTestsFailed++;
+ }
+};
+
+
+#define TEST(a) \
+ void TEST_ ## a(TestRunnah * __tr); \
+ struct DUMMY_ ## a \
+ : public TestRunnah { \
+ DUMMY_ ## a() \
+ : TestRunnah(__FILE__, # a) {\
+ TEST_ ## a(this); __test::numTests++;} }; \
+ DUMMY_ ## a ddummy_ ## a; \
+ void TEST_ ## a(TestRunnah * __tr)
+
+#else // TESTING_ENABLE
+
+#define TEST(a) \
+ void TEST_ ## a(TestRunnah * __tr) \
+
+#endif
+
+#define CHECK(a) if (!__tr->AssertTrue(a, __LINE__)){return;}
+#define CHECK_EQ(a, b) if (!__tr->AssertEqual(a, b, __LINE__)){return;}
+
+int GetNumTests();
+int GetNumTestsFailed();
+
+
+#endif
diff --git a/Source/Core/Common/Src/Thread.h b/Source/Core/Common/Src/Thread.h
index 43e64595ff..e1cc4895b8 100644
--- a/Source/Core/Common/Src/Thread.h
+++ b/Source/Core/Common/Src/Thread.h
@@ -1,117 +1,117 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _THREAD_H
-#define _THREAD_H
-
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <pthread.h>
-#endif
-
-#ifdef _WIN32
-#define THREAD_RETURN DWORD WINAPI
-#else
-#define THREAD_RETURN void*
-#endif
-
-#include "Common.h"
-
-
-namespace Common
-{
-class CriticalSection
-{
-#ifdef _WIN32
- CRITICAL_SECTION section;
-#elif __GNUC__
- pthread_mutex_t mutex;
-#endif
-public:
-
- CriticalSection(int spincount = 1000);
- ~CriticalSection();
- void Enter();
- bool TryEnter();
- void Leave();
-};
-
-#ifdef _WIN32
-typedef DWORD (WINAPI * ThreadFunc)(void* arg);
-#elif __GNUC__
-typedef void* (*ThreadFunc)(void* arg);
-#endif
-
-class Thread
-{
-public:
- Thread(ThreadFunc entry, void* arg);
- ~Thread();
-
- void WaitForDeath();
- void SetAffinity(int mask);
- static void SetCurrentThreadAffinity(int mask);
-
-
-private:
-
-#ifdef _WIN32
- HANDLE m_hThread;
- DWORD m_threadId;
-#elif __GNUC__
- pthread_t thread_id;
-#endif
-};
-
-
-class Event
-{
- public:
-
- Event();
-
- void Init();
- void Shutdown();
-
- void Set();
- void Wait();
-
-
- private:
-
-#ifdef _WIN32
- HANDLE m_hEvent;
-#elif __GNUC__
- bool is_set_;
- pthread_cond_t event_;
- pthread_mutex_t mutex_;
-#endif
-};
-
-void SleepCurrentThread(int ms);
-
-void SetCurrentThreadName(const char *name);
-
-LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val);
-LONG SyncInterlockedExchange(LONG *Dest, LONG Val);
-LONG SyncInterlockedIncrement(LONG *Dest);
-
-} // end of namespace Common
-
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _THREAD_H
+#define _THREAD_H
+
+#ifdef _WIN32
+#include <windows.h>
+#else
+#include <pthread.h>
+#endif
+
+#ifdef _WIN32
+#define THREAD_RETURN DWORD WINAPI
+#else
+#define THREAD_RETURN void*
+#endif
+
+#include "Common.h"
+
+
+namespace Common
+{
+class CriticalSection
+{
+#ifdef _WIN32
+ CRITICAL_SECTION section;
+#elif __GNUC__
+ pthread_mutex_t mutex;
+#endif
+public:
+
+ CriticalSection(int spincount = 1000);
+ ~CriticalSection();
+ void Enter();
+ bool TryEnter();
+ void Leave();
+};
+
+#ifdef _WIN32
+typedef DWORD (WINAPI * ThreadFunc)(void* arg);
+#elif __GNUC__
+typedef void* (*ThreadFunc)(void* arg);
+#endif
+
+class Thread
+{
+public:
+ Thread(ThreadFunc entry, void* arg);
+ ~Thread();
+
+ void WaitForDeath();
+ void SetAffinity(int mask);
+ static void SetCurrentThreadAffinity(int mask);
+
+
+private:
+
+#ifdef _WIN32
+ HANDLE m_hThread;
+ DWORD m_threadId;
+#elif __GNUC__
+ pthread_t thread_id;
+#endif
+};
+
+
+class Event
+{
+ public:
+
+ Event();
+
+ void Init();
+ void Shutdown();
+
+ void Set();
+ void Wait();
+
+
+ private:
+
+#ifdef _WIN32
+ HANDLE m_hEvent;
+#elif __GNUC__
+ bool is_set_;
+ pthread_cond_t event_;
+ pthread_mutex_t mutex_;
+#endif
+};
+
+void SleepCurrentThread(int ms);
+
+void SetCurrentThreadName(const char *name);
+
+LONG SyncInterlockedExchangeAdd(LONG *Dest, LONG Val);
+LONG SyncInterlockedExchange(LONG *Dest, LONG Val);
+LONG SyncInterlockedIncrement(LONG *Dest);
+
+} // end of namespace Common
+
+
+#endif
diff --git a/Source/Core/Common/Src/Thunk.h b/Source/Core/Common/Src/Thunk.h
index 5ce19a9ef1..5d438e15e8 100644
--- a/Source/Core/Common/Src/Thunk.h
+++ b/Source/Core/Common/Src/Thunk.h
@@ -1,39 +1,39 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _THUNK_H
-#define _THUNK_H
-
-// This simple class creates a wrapper around a C/C++ function that saves all fp state
-// before entering it, and restores it upon exit. This is required to be able to selectively
-// call functions from generated code, without inflicting the performance hit and increase
-// of complexity that it means to protect the generated code from this problem.
-
-// This process is called thunking.
-
-// There will only ever be one level of thunking on the stack, plus,
-// we don't want to pollute the stack, so we store away regs somewhere global.
-// NOT THREAD SAFE. This may only be used from the CPU thread.
-// Any other thread using this stuff will be FATAL.
-
-void Thunk_Init();
-void Thunk_Reset();
-void Thunk_Shutdown();
-
-void *ProtectFunction(void *function, int num_params);
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _THUNK_H
+#define _THUNK_H
+
+// This simple class creates a wrapper around a C/C++ function that saves all fp state
+// before entering it, and restores it upon exit. This is required to be able to selectively
+// call functions from generated code, without inflicting the performance hit and increase
+// of complexity that it means to protect the generated code from this problem.
+
+// This process is called thunking.
+
+// There will only ever be one level of thunking on the stack, plus,
+// we don't want to pollute the stack, so we store away regs somewhere global.
+// NOT THREAD SAFE. This may only be used from the CPU thread.
+// Any other thread using this stuff will be FATAL.
+
+void Thunk_Init();
+void Thunk_Reset();
+void Thunk_Shutdown();
+
+void *ProtectFunction(void *function, int num_params);
+
+#endif
diff --git a/Source/Core/Common/Src/Timer.h b/Source/Core/Common/Src/Timer.h
index b591dad7c3..4be5ab07d1 100644
--- a/Source/Core/Common/Src/Timer.h
+++ b/Source/Core/Common/Src/Timer.h
@@ -1,49 +1,49 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#ifndef _TIMER_H
-#define _TIMER_H
-
-#include "Common.h"
-
-namespace Common
-{
-class Timer
-{
- public:
-
- Timer();
-
- void Update();
-
-
- // Always in milliseconds, regardless of alternative internal representation
- s64 GetTimeDifference(void);
-
- static void IncreaseResolution();
- static void RestoreResolution();
- static u64 GetTimeSinceJan1970();
-
-
- public:
-
- u64 m_LastTime;
- u64 m_frequency;
-};
-} // end of namespace Common
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#ifndef _TIMER_H
+#define _TIMER_H
+
+#include "Common.h"
+
+namespace Common
+{
+class Timer
+{
+ public:
+
+ Timer();
+
+ void Update();
+
+
+ // Always in milliseconds, regardless of alternative internal representation
+ s64 GetTimeDifference(void);
+
+ static void IncreaseResolution();
+ static void RestoreResolution();
+ static u64 GetTimeSinceJan1970();
+
+
+ public:
+
+ u64 m_LastTime;
+ u64 m_frequency;
+};
+} // end of namespace Common
+
+#endif
diff --git a/Source/Core/Common/Src/WaveFile.h b/Source/Core/Common/Src/WaveFile.h
index 8f3a8057fe..b9a6528155 100644
--- a/Source/Core/Common/Src/WaveFile.h
+++ b/Source/Core/Common/Src/WaveFile.h
@@ -1,55 +1,55 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-// WaveFileWriter
-
-// Simple utility class to make it easy to write long 16-bit stereo
-// audio streams to disk.
-// Use Start() to start recording to a file, and AddStereoSamples to add wave data.
-// The float variant will convert from -1.0-1.0 range and clamp.
-// Alternatively, AddSamplesBE for big endian wave data.
-// If Stop is not called when it destructs, the destructor will call Stop().
-
-#ifndef _WAVEFILE_H
-#define _WAVEFILE_H
-
-#include <stdio.h>
-
-class WaveFileWriter
-{
- FILE *file;
- bool skip_silence;
- u32 audio_size;
- short *conv_buffer;
- void Write(u32 value);
- void Write4(const char *ptr);
-
-public:
- WaveFileWriter();
- ~WaveFileWriter();
-
- bool Start(const char *filename);
- void Stop();
-
- void SetSkipSilence(bool skip) { skip_silence = skip; }
-
- void AddStereoSamples(const short *sample_data, int count);
- void AddStereoSamplesBE(const short *sample_data, int count); // big endian
- u32 GetAudioSize() { return audio_size; }
-};
-
-#endif // _WAVEFILE_H
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+// WaveFileWriter
+
+// Simple utility class to make it easy to write long 16-bit stereo
+// audio streams to disk.
+// Use Start() to start recording to a file, and AddStereoSamples to add wave data.
+// The float variant will convert from -1.0-1.0 range and clamp.
+// Alternatively, AddSamplesBE for big endian wave data.
+// If Stop is not called when it destructs, the destructor will call Stop().
+
+#ifndef _WAVEFILE_H
+#define _WAVEFILE_H
+
+#include <stdio.h>
+
+class WaveFileWriter
+{
+ FILE *file;
+ bool skip_silence;
+ u32 audio_size;
+ short *conv_buffer;
+ void Write(u32 value);
+ void Write4(const char *ptr);
+
+public:
+ WaveFileWriter();
+ ~WaveFileWriter();
+
+ bool Start(const char *filename);
+ void Stop();
+
+ void SetSkipSilence(bool skip) { skip_silence = skip; }
+
+ void AddStereoSamples(const short *sample_data, int count);
+ void AddStereoSamplesBE(const short *sample_data, int count); // big endian
+ u32 GetAudioSize() { return audio_size; }
+};
+
+#endif // _WAVEFILE_H
diff --git a/Source/Core/Common/Src/stdafx.h b/Source/Core/Common/Src/stdafx.h
index 3df0d4afa6..546a643aae 100644
--- a/Source/Core/Common/Src/stdafx.h
+++ b/Source/Core/Common/Src/stdafx.h
@@ -1,35 +1,35 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-#pragma once
-
-#ifndef _WIN32_WINNT
- #define _WIN32_WINNT 0x501
-#endif
-#ifndef _WIN32_IE
-#define _WIN32_IE 0x0500 // Default value is 0x0400
-#endif
-
-#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
-
-#define _CRT_SECURE_NO_DEPRECATE 1
-#define _CRT_NONSTDC_NO_DEPRECATE 1
-
-#include <windows.h>
-#include <tchar.h>
-#include <vector>
-
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+#pragma once
+
+#ifndef _WIN32_WINNT
+ #define _WIN32_WINNT 0x501
+#endif
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0500 // Default value is 0x0400
+#endif
+
+#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
+
+#define _CRT_SECURE_NO_DEPRECATE 1
+#define _CRT_NONSTDC_NO_DEPRECATE 1
+
+#include <windows.h>
+#include <tchar.h>
+#include <vector>
+
diff --git a/Source/Core/Common/Src/svnrev_template.h b/Source/Core/Common/Src/svnrev_template.h
index d7a944d4b0..442eb8e3f5 100644
--- a/Source/Core/Common/Src/svnrev_template.h
+++ b/Source/Core/Common/Src/svnrev_template.h
@@ -1,2 +1,2 @@
-#define SVN_REV $WCREV$
+#define SVN_REV $WCREV$
#define SVN_REV_STR "$WCREV$" \ No newline at end of file
diff --git a/Source/Core/Common/Src/x64Analyzer.h b/Source/Core/Common/Src/x64Analyzer.h
index 68c52ca932..e65a0d4319 100644
--- a/Source/Core/Common/Src/x64Analyzer.h
+++ b/Source/Core/Common/Src/x64Analyzer.h
@@ -1,56 +1,56 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-#ifndef _X64ANALYZER_H
-#define _X64ANALYZER_H
-
-#include "Common.h"
-
-struct InstructionInfo
-{
- int operandSize; //8, 16, 32, 64
- int instructionSize;
- int regOperandReg;
- int otherReg;
- int scaledReg;
- bool zeroExtend;
- bool signExtend;
- bool hasImmediate;
- bool isMemoryWrite;
- u64 immediate;
- s32 displacement;
-};
-
-struct ModRM
-{
- int mod, reg, rm;
- ModRM(u8 modRM, u8 rex)
- {
- mod = modRM >> 6;
- reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0);
- rm = modRM & 7;
- }
-};
-
-
-enum AccessType{
- OP_ACCESS_READ = 0,
- OP_ACCESS_WRITE = 1
-};
-
-bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType);
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+#ifndef _X64ANALYZER_H
+#define _X64ANALYZER_H
+
+#include "Common.h"
+
+struct InstructionInfo
+{
+ int operandSize; //8, 16, 32, 64
+ int instructionSize;
+ int regOperandReg;
+ int otherReg;
+ int scaledReg;
+ bool zeroExtend;
+ bool signExtend;
+ bool hasImmediate;
+ bool isMemoryWrite;
+ u64 immediate;
+ s32 displacement;
+};
+
+struct ModRM
+{
+ int mod, reg, rm;
+ ModRM(u8 modRM, u8 rex)
+ {
+ mod = modRM >> 6;
+ reg = ((modRM >> 3) & 7) | ((rex & 4)?8:0);
+ rm = modRM & 7;
+ }
+};
+
+
+enum AccessType{
+ OP_ACCESS_READ = 0,
+ OP_ACCESS_WRITE = 1
+};
+
+bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int accessType);
+
+#endif
diff --git a/Source/Core/Common/Src/x64Emitter.h b/Source/Core/Common/Src/x64Emitter.h
index 0238569a28..c96b20b4cf 100644
--- a/Source/Core/Common/Src/x64Emitter.h
+++ b/Source/Core/Common/Src/x64Emitter.h
@@ -1,563 +1,563 @@
-// Copyright (C) 2003-2008 Dolphin Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official SVN repository and contact information can be found at
-// http://code.google.com/p/dolphin-emu/
-
-// WARNING - THIS LIBRARY IS NOT THREAD SAFE!!!
-
-#ifndef _DOLPHIN_INTEL_CODEGEN
-#define _DOLPHIN_INTEL_CODEGEN
-
-#include "Common.h"
-
-namespace Gen
-{
- 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,
- R12 = 12,R13 = 13,R14 = 14,R15 = 15,
-
- AL = 0, BL = 3, CL = 1, DL = 2,
- AH = 4, BH = 7, CH = 5, DH = 6,
-
- 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,
- XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
-
- INVALID_REG = 0xFFFFFFFF
- };
-
- enum CCFlags
- {
- CC_O = 0,
- CC_NO = 1,
- 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_BE = 6, CC_NA = 6,
- CC_NBE = 7, CC_A = 7,
- CC_S = 8,
- CC_NS = 9,
- CC_P = 0xA, CC_PE = 0xA,
- CC_NP = 0xB, CC_PO = 0xB,
- CC_L = 0xC, CC_NGE = 0xC,
- CC_NL = 0xD, CC_GE = 0xD,
- CC_LE = 0xE, CC_NG = 0xE,
- CC_NLE = 0xF, CC_G = 0xF
- };
-
- enum
- {
- NUMGPRs = 16,
- NUMXMMs = 16,
- };
-
- enum
- {
- SCALE_NONE = 0,
- SCALE_1 = 1,
- SCALE_2 = 2,
- SCALE_4 = 4,
- SCALE_8 = 8,
- SCALE_ATREG = 16,
- SCALE_RIP = 0xFF,
- SCALE_IMM8 = 0xF0,
- SCALE_IMM16 = 0xF1,
- SCALE_IMM32 = 0xF2,
- SCALE_IMM64 = 0xF3,
- };
-
- void SetCodePtr(u8 *ptr);
- void ReserveCodeSpace(int bytes);
- const u8 *AlignCode4();
- const u8 *AlignCode16();
- const u8 *AlignCodePage();
- const u8 *GetCodePtr();
- u8 *GetWritableCodePtr();
-
-
- // Safe way to temporarily redirect the code generator.
- class GenContext
- {
- u8 **code_ptr_ptr;
- u8 *saved_ptr;
- public:
- GenContext(u8 **code_ptr_ptr_)
- {
- saved_ptr = GetWritableCodePtr();
- code_ptr_ptr = code_ptr_ptr_;
- SetCodePtr(*code_ptr_ptr);
- }
- ~GenContext()
- {
- *code_ptr_ptr = GetWritableCodePtr();
- SetCodePtr(saved_ptr);
- }
- };
-
- enum NormalOp {
- nrmADD,
- nrmADC,
- nrmSUB,
- nrmSBB,
- nrmAND,
- nrmOR ,
- nrmXOR,
- nrmMOV,
- nrmTEST,
- nrmCMP,
- nrmXCHG,
- };
-
- // Make the generation routine examine which direction to go
- // probably has to be a static
-
- // RIP addressing does not benefit from micro op fusion on Core arch
- struct OpArg
- {
- OpArg() {} //dummy op arg, used for storage
- OpArg(u64 _offset, int _scale, X64Reg rmReg = RAX, X64Reg scaledReg = RAX)
- {
- operandReg = 0;
- scale = (u8)_scale;
- offsetOrBaseReg = (u8)rmReg;
- indexReg = (u8)scaledReg;
- //if scale == 0 never mind offseting
- offset = _offset;
- }
- void WriteRex(bool op64, int customOp = -1) const;
- void WriteRest(int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF) const;
- void WriteSingleByteOp(u8 op, X64Reg operandReg, int bits);
- //This one is public - must be written to
- u64 offset; //use RIP-relative as much as possible - avoid 64-bit immediates at all costs
- u8 operandReg;
-
- void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const;
- bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;}
- bool IsSimpleReg() const {return scale == SCALE_NONE;}
- bool IsSimpleReg(X64Reg reg) const {
- if (!IsSimpleReg())
- return false;
- return GetSimpleReg() == reg;
- }
- bool CanDoOpWith(const OpArg &other) const
- {
- if (IsSimpleReg()) return true;
- if (!IsSimpleReg() && !other.IsSimpleReg() && !other.IsImm()) return false;
- return true;
- }
-
- int GetImmBits() const
- {
- switch (scale)
- {
- case SCALE_IMM8: return 8;
- case SCALE_IMM16: return 16;
- case SCALE_IMM32: return 32;
- case SCALE_IMM64: return 64;
- default: return -1;
- }
- }
- X64Reg GetSimpleReg() const
- {
- if (scale == SCALE_NONE)
- return (X64Reg)offsetOrBaseReg;
- else
- return INVALID_REG;
- }
- private:
- u8 scale;
- u8 offsetOrBaseReg;
- u8 indexReg;
- };
-
- inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);}
- inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);}
- inline OpArg MatR(X64Reg value) {return OpArg(0, SCALE_ATREG, value);}
- inline OpArg MDisp(X64Reg value, int offset) {
- return OpArg((u32)offset, SCALE_ATREG, value); }
- inline OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset)
- {
- return OpArg(offset, scale, base, scaled);
- }
- inline OpArg Imm8 (u8 imm) {return OpArg(imm, SCALE_IMM8);}
- inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used
- inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);}
- inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);}
-#ifdef _M_X64
- inline OpArg ImmPtr(void* imm) {return Imm64((u64)imm);}
-#else
- inline OpArg ImmPtr(void* imm) {return Imm32((u32)imm);}
-#endif
-
- void INT3();
- void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals)
- void PAUSE();
- void RET();
- void STC();
- void CLC();
- void CMC();
- void PUSH(X64Reg reg);
- void POP(X64Reg reg);
- void PUSH(int bits, const OpArg &reg);
- void POP(int bits, const OpArg &reg);
- void PUSHF();
- void POPF();
-
- typedef const u8* JumpTarget;
-
- struct FixupBranch
- {
- u8 *ptr;
- int type; //0 = 8bit 1 = 32bit
- };
-
- FixupBranch J(bool force5bytes = false);
-
- void JMP(const u8 * addr, bool force5Bytes = false);
- void JMP(OpArg arg);
- void JMPptr(const OpArg &arg);
- void JMPself(); //infinite loop!
-
- void CALL(void *fnptr);
- void CALLptr(OpArg arg);
-
- FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
- void J_CC(CCFlags conditionCode, JumpTarget target);
- void J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes = false);
-
- void SetJumpTarget(const FixupBranch &branch);
-
- //WARNING - INC and DEC slow on Intel Core, but not on AMD, since it creates
- //false flags dependencies because they only update a subset of the flags
-
- // ector - I hereby BAN inc and dec due to their horribleness :P
- // void INC(int bits, OpArg arg);
- // void DEC(int bits, OpArg arg);
-
- void SETcc(CCFlags flag, OpArg dest);
- // Note: CMOV brings small if any benefit on current cpus, unfortunately.
- void CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag);
-
- void LFENCE();
- void MFENCE();
- void SFENCE();
-
- void BSF(int bits, X64Reg dest, OpArg src); //bottom bit to top bit
- void BSR(int bits, X64Reg dest, OpArg src); //top bit to bottom bit
-
- //These two can not be executed on early Intel 64-bit CPU:s, only on AMD!
-
- void LAHF(); // 3 cycle vector path
- void SAHF(); // direct path fast
-
- //Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU
- //LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr.,
-
- //Actually REP MOVSD could be useful :P
-
- void MOVNTI(int bits, OpArg dest, X64Reg src);
-
- void MUL(int bits, OpArg src); //UNSIGNED
- void DIV(int bits, OpArg src);
- void IMUL(int bits, OpArg src); //SIGNED
- void IDIV(int bits, OpArg src);
- void IMUL(int bits, X64Reg regOp, OpArg src);
- void IMUL(int bits, X64Reg regOp, OpArg src, OpArg imm);
-
-
- void NEG(int bits, OpArg src);
- void NOT(int bits, OpArg src);
-
- void ROL(int bits, OpArg dest, OpArg shift);
- void ROR(int bits, OpArg dest, OpArg shift);
- void RCL(int bits, OpArg dest, OpArg shift);
- void RCR(int bits, OpArg dest, OpArg shift);
- void SHL(int bits, OpArg dest, OpArg shift);
- void SHR(int bits, OpArg dest, OpArg shift);
- void SAR(int bits, OpArg dest, OpArg shift);
-
-
- void CWD(int bits = 16);
- inline void CDQ() {CWD(32);}
- inline void CQO() {CWD(64);}
- void CBW(int bits = 8);
- inline void CWDE() {CBW(16);}
- inline void CDQE() {CBW(32);}
-
- void LEA(int bits, X64Reg dest, OpArg src);
-
-
- enum PrefetchLevel
- {
- PF_NTA, //Non-temporal (data used once and only once)
- PF_T0, //All cache levels
- PF_T1, //Levels 2+ (aliased to T0 on AMD)
- PF_T2, //Levels 3+ (aliased to T0 on AMD)
- };
- void PREFETCH(PrefetchLevel level, OpArg arg);
-
-
- void ADD (int bits, const OpArg &a1, const OpArg &a2);
- void ADC (int bits, const OpArg &a1, const OpArg &a2);
- void SUB (int bits, const OpArg &a1, const OpArg &a2);
- void SBB (int bits, const OpArg &a1, const OpArg &a2);
- void AND (int bits, const OpArg &a1, const OpArg &a2);
- void OR (int bits, const OpArg &a1, const OpArg &a2);
- void XOR (int bits, const OpArg &a1, const OpArg &a2);
- void MOV (int bits, const OpArg &a1, const OpArg &a2);
- void TEST(int bits, const OpArg &a1, const OpArg &a2);
- void CMP (int bits, const OpArg &a1, const OpArg &a2);
-
- // XCHG is SLOW and should be avoided.
- //void XCHG(int bits, const OpArg &a1, const OpArg &a2);
-
- void XCHG_AHAL();
- void BSWAP(int bits, X64Reg reg);
- 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);
-
- enum SSECompare
- {
- EQ = 0,
- LT,
- LE,
- UNORD,
- NEQ,
- NLT,
- NLE,
- ORD,
- };
-
- // WARNING - These two take 11-13 cycles and are VectorPath! (AMD64)
- void STMXCSR(OpArg memloc);
- void LDMXCSR(OpArg memloc);
-
- // Regular SSE/SSE2 instructions
- 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 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 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);
- void RSQRTSD(X64Reg regOp, OpArg arg);
-
- void COMISS(X64Reg regOp, OpArg arg);
- void COMISD(X64Reg regOp, OpArg arg);
-
- 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 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);
- void ORPD(X64Reg regOp, OpArg arg);
- void XORPS(X64Reg regOp, OpArg arg);
- void XORPD(X64Reg regOp, OpArg arg);
- void MULPS(X64Reg regOp, OpArg arg);
- void MULPD(X64Reg regOp, OpArg arg);
- void DIVPS(X64Reg regOp, OpArg arg);
- void DIVPD(X64Reg regOp, OpArg arg);
- void MINPS(X64Reg regOp, OpArg arg);
- void MINPD(X64Reg regOp, OpArg arg);
- void MAXPS(X64Reg regOp, OpArg arg);
- void MAXPD(X64Reg regOp, OpArg arg);
- void SQRTPS(X64Reg regOp, OpArg arg);
- void SQRTPD(X64Reg regOp, OpArg arg);
- void RSQRTPS(X64Reg regOp, OpArg arg);
- void RSQRTPD(X64Reg regOp, OpArg arg);
- void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle);
- void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle);
-
- void MOVDDUP(X64Reg regOp, OpArg arg);
-
- void COMISS(X64Reg regOp, OpArg arg);
- void COMISD(X64Reg regOp, OpArg arg);
- void UCOMISS(X64Reg regOp, OpArg arg);
- void UCOMISD(X64Reg regOp, OpArg arg);
-
- void MOVAPS(X64Reg regOp, OpArg arg);
- void MOVAPD(X64Reg regOp, OpArg arg);
- void MOVAPS(OpArg arg, X64Reg regOp);
- void MOVAPD(OpArg arg, X64Reg regOp);
-
- void MOVUPS(X64Reg regOp, OpArg arg);
- void MOVUPD(X64Reg regOp, OpArg arg);
- void MOVUPS(OpArg arg, X64Reg regOp);
- void MOVUPD(OpArg arg, X64Reg regOp);
-
- void MOVSS(X64Reg regOp, OpArg arg);
- void MOVSD(X64Reg regOp, OpArg arg);
- void MOVSS(OpArg arg, X64Reg regOp);
- void MOVSD(OpArg arg, X64Reg regOp);
-
- void MOVMSKPS(X64Reg dest, OpArg arg);
- void MOVMSKPD(X64Reg dest, OpArg arg);
-
- void MOVD_xmm(X64Reg dest, const OpArg &arg);
- void MOVQ_xmm(X64Reg dest, OpArg arg);
- void MOVD_xmm(const OpArg &arg, X64Reg src);
- void MOVQ_xmm(OpArg arg, X64Reg src);
-
- void MASKMOVDQU(X64Reg dest, X64Reg src);
- void LDDQU(X64Reg dest, OpArg src);
-
- void UNPCKLPD(X64Reg dest, OpArg src);
- void UNPCKHPD(X64Reg dest, OpArg src);
-
- void CVTPS2PD(X64Reg dest, OpArg src);
- void CVTPD2PS(X64Reg dest, OpArg src);
- void CVTSS2SD(X64Reg dest, OpArg src);
- void CVTSD2SS(X64Reg dest, OpArg src);
- void CVTSD2SI(X64Reg dest, OpArg src);
- void CVTDQ2PD(X64Reg regOp, OpArg arg);
- void CVTPD2DQ(X64Reg regOp, OpArg arg);
- void CVTDQ2PS(X64Reg regOp, const OpArg &arg);
-
- //Integer SSE instructions
- void PACKSSDW(X64Reg dest, OpArg arg);
- void PACKSSWB(X64Reg dest, OpArg arg);
- //void PACKUSDW(X64Reg dest, OpArg arg);
- void PACKUSWB(X64Reg dest, OpArg arg);
-
- void PUNPCKLBW(X64Reg dest, const OpArg &arg);
- void PUNPCKLWD(X64Reg dest, const OpArg &arg);
- void PUNPCKLDQ(X64Reg dest, const OpArg &arg);
-
- void PSRAD(X64Reg dest, int shift);
-
- 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 PADDB(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 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 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 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 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);
-
- void RTDSC();
-
-void CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2);
-void CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
-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) || !defined(_WIN32)
-
-#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 DECLARE_IMPORT(x)
-
-#else
-
-// Comments from VertexLoader.cpp about these horrors:
-
-// This is a horrible hack that is necessary in 64-bit mode because Opengl32.dll is based way, way above the 32-bit
-// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
-// want to grab the function pointers from the import table instead.
-
-void ___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2);
-void ___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
-void ___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
-void ___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5);
-
-#define CallCdeclFunction3_I(a,b,c,d) ___CallCdeclImport3(&__imp_##a,b,c,d)
-#define CallCdeclFunction4_I(a,b,c,d,e) ___CallCdeclImport4(&__imp_##a,b,c,d,e)
-#define CallCdeclFunction5_I(a,b,c,d,e,f) ___CallCdeclImport5(&__imp_##a,b,c,d,e,f)
-#define CallCdeclFunction6_I(a,b,c,d,e,f,g) ___CallCdeclImport6(&__imp_##a,b,c,d,e,f,g)
-
-#define DECLARE_IMPORT(x) extern "C" void *__imp_##x
-
-#endif
-
-}
-
-#endif
+// Copyright (C) 2003-2008 Dolphin Project.
+
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, version 2.0.
+
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License 2.0 for more details.
+
+// A copy of the GPL 2.0 should have been included with the program.
+// If not, see http://www.gnu.org/licenses/
+
+// Official SVN repository and contact information can be found at
+// http://code.google.com/p/dolphin-emu/
+
+// WARNING - THIS LIBRARY IS NOT THREAD SAFE!!!
+
+#ifndef _DOLPHIN_INTEL_CODEGEN
+#define _DOLPHIN_INTEL_CODEGEN
+
+#include "Common.h"
+
+namespace Gen
+{
+ 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,
+ R12 = 12,R13 = 13,R14 = 14,R15 = 15,
+
+ AL = 0, BL = 3, CL = 1, DL = 2,
+ AH = 4, BH = 7, CH = 5, DH = 6,
+
+ 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,
+ XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15,
+
+ INVALID_REG = 0xFFFFFFFF
+ };
+
+ enum CCFlags
+ {
+ CC_O = 0,
+ CC_NO = 1,
+ 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_BE = 6, CC_NA = 6,
+ CC_NBE = 7, CC_A = 7,
+ CC_S = 8,
+ CC_NS = 9,
+ CC_P = 0xA, CC_PE = 0xA,
+ CC_NP = 0xB, CC_PO = 0xB,
+ CC_L = 0xC, CC_NGE = 0xC,
+ CC_NL = 0xD, CC_GE = 0xD,
+ CC_LE = 0xE, CC_NG = 0xE,
+ CC_NLE = 0xF, CC_G = 0xF
+ };
+
+ enum
+ {
+ NUMGPRs = 16,
+ NUMXMMs = 16,
+ };
+
+ enum
+ {
+ SCALE_NONE = 0,
+ SCALE_1 = 1,
+ SCALE_2 = 2,
+ SCALE_4 = 4,
+ SCALE_8 = 8,
+ SCALE_ATREG = 16,
+ SCALE_RIP = 0xFF,
+ SCALE_IMM8 = 0xF0,
+ SCALE_IMM16 = 0xF1,
+ SCALE_IMM32 = 0xF2,
+ SCALE_IMM64 = 0xF3,
+ };
+
+ void SetCodePtr(u8 *ptr);
+ void ReserveCodeSpace(int bytes);
+ const u8 *AlignCode4();
+ const u8 *AlignCode16();
+ const u8 *AlignCodePage();
+ const u8 *GetCodePtr();
+ u8 *GetWritableCodePtr();
+
+
+ // Safe way to temporarily redirect the code generator.
+ class GenContext
+ {
+ u8 **code_ptr_ptr;
+ u8 *saved_ptr;
+ public:
+ GenContext(u8 **code_ptr_ptr_)
+ {
+ saved_ptr = GetWritableCodePtr();
+ code_ptr_ptr = code_ptr_ptr_;
+ SetCodePtr(*code_ptr_ptr);
+ }
+ ~GenContext()
+ {
+ *code_ptr_ptr = GetWritableCodePtr();
+ SetCodePtr(saved_ptr);
+ }
+ };
+
+ enum NormalOp {
+ nrmADD,
+ nrmADC,
+ nrmSUB,
+ nrmSBB,
+ nrmAND,
+ nrmOR ,
+ nrmXOR,
+ nrmMOV,
+ nrmTEST,
+ nrmCMP,
+ nrmXCHG,
+ };
+
+ // Make the generation routine examine which direction to go
+ // probably has to be a static
+
+ // RIP addressing does not benefit from micro op fusion on Core arch
+ struct OpArg
+ {
+ OpArg() {} //dummy op arg, used for storage
+ OpArg(u64 _offset, int _scale, X64Reg rmReg = RAX, X64Reg scaledReg = RAX)
+ {
+ operandReg = 0;
+ scale = (u8)_scale;
+ offsetOrBaseReg = (u8)rmReg;
+ indexReg = (u8)scaledReg;
+ //if scale == 0 never mind offseting
+ offset = _offset;
+ }
+ void WriteRex(bool op64, int customOp = -1) const;
+ void WriteRest(int extraBytes=0, X64Reg operandReg=(X64Reg)0xFF) const;
+ void WriteSingleByteOp(u8 op, X64Reg operandReg, int bits);
+ //This one is public - must be written to
+ u64 offset; //use RIP-relative as much as possible - avoid 64-bit immediates at all costs
+ u8 operandReg;
+
+ void WriteNormalOp(bool toRM, NormalOp op, const OpArg &operand, int bits) const;
+ bool IsImm() const {return scale == SCALE_IMM8 || scale == SCALE_IMM16 || scale == SCALE_IMM32 || scale == SCALE_IMM64;}
+ bool IsSimpleReg() const {return scale == SCALE_NONE;}
+ bool IsSimpleReg(X64Reg reg) const {
+ if (!IsSimpleReg())
+ return false;
+ return GetSimpleReg() == reg;
+ }
+ bool CanDoOpWith(const OpArg &other) const
+ {
+ if (IsSimpleReg()) return true;
+ if (!IsSimpleReg() && !other.IsSimpleReg() && !other.IsImm()) return false;
+ return true;
+ }
+
+ int GetImmBits() const
+ {
+ switch (scale)
+ {
+ case SCALE_IMM8: return 8;
+ case SCALE_IMM16: return 16;
+ case SCALE_IMM32: return 32;
+ case SCALE_IMM64: return 64;
+ default: return -1;
+ }
+ }
+ X64Reg GetSimpleReg() const
+ {
+ if (scale == SCALE_NONE)
+ return (X64Reg)offsetOrBaseReg;
+ else
+ return INVALID_REG;
+ }
+ private:
+ u8 scale;
+ u8 offsetOrBaseReg;
+ u8 indexReg;
+ };
+
+ inline OpArg M(void *ptr) {return OpArg((u64)ptr, (int)SCALE_RIP);}
+ inline OpArg R(X64Reg value) {return OpArg(0, SCALE_NONE, value);}
+ inline OpArg MatR(X64Reg value) {return OpArg(0, SCALE_ATREG, value);}
+ inline OpArg MDisp(X64Reg value, int offset) {
+ return OpArg((u32)offset, SCALE_ATREG, value); }
+ inline OpArg MComplex(X64Reg base, X64Reg scaled, int scale, int offset)
+ {
+ return OpArg(offset, scale, base, scaled);
+ }
+ inline OpArg Imm8 (u8 imm) {return OpArg(imm, SCALE_IMM8);}
+ inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used
+ inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);}
+ inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);}
+#ifdef _M_X64
+ inline OpArg ImmPtr(void* imm) {return Imm64((u64)imm);}
+#else
+ inline OpArg ImmPtr(void* imm) {return Imm32((u32)imm);}
+#endif
+
+ void INT3();
+ void NOP(int count = 1); //nop padding - TODO: fast nop slides, for amd and intel (check their manuals)
+ void PAUSE();
+ void RET();
+ void STC();
+ void CLC();
+ void CMC();
+ void PUSH(X64Reg reg);
+ void POP(X64Reg reg);
+ void PUSH(int bits, const OpArg &reg);
+ void POP(int bits, const OpArg &reg);
+ void PUSHF();
+ void POPF();
+
+ typedef const u8* JumpTarget;
+
+ struct FixupBranch
+ {
+ u8 *ptr;
+ int type; //0 = 8bit 1 = 32bit
+ };
+
+ FixupBranch J(bool force5bytes = false);
+
+ void JMP(const u8 * addr, bool force5Bytes = false);
+ void JMP(OpArg arg);
+ void JMPptr(const OpArg &arg);
+ void JMPself(); //infinite loop!
+
+ void CALL(void *fnptr);
+ void CALLptr(OpArg arg);
+
+ FixupBranch J_CC(CCFlags conditionCode, bool force5bytes = false);
+ void J_CC(CCFlags conditionCode, JumpTarget target);
+ void J_CC(CCFlags conditionCode, const u8 * addr, bool force5Bytes = false);
+
+ void SetJumpTarget(const FixupBranch &branch);
+
+ //WARNING - INC and DEC slow on Intel Core, but not on AMD, since it creates
+ //false flags dependencies because they only update a subset of the flags
+
+ // ector - I hereby BAN inc and dec due to their horribleness :P
+ // void INC(int bits, OpArg arg);
+ // void DEC(int bits, OpArg arg);
+
+ void SETcc(CCFlags flag, OpArg dest);
+ // Note: CMOV brings small if any benefit on current cpus, unfortunately.
+ void CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag);
+
+ void LFENCE();
+ void MFENCE();
+ void SFENCE();
+
+ void BSF(int bits, X64Reg dest, OpArg src); //bottom bit to top bit
+ void BSR(int bits, X64Reg dest, OpArg src); //top bit to bottom bit
+
+ //These two can not be executed on early Intel 64-bit CPU:s, only on AMD!
+
+ void LAHF(); // 3 cycle vector path
+ void SAHF(); // direct path fast
+
+ //Looking for one of these? It's BANNED!! Some instructions are slow on modern CPU
+ //LOOP, LOOPNE, LOOPE, ENTER, LEAVE, XLAT, REP MOVSB/MOVSD, REP SCASD + other string instr.,
+
+ //Actually REP MOVSD could be useful :P
+
+ void MOVNTI(int bits, OpArg dest, X64Reg src);
+
+ void MUL(int bits, OpArg src); //UNSIGNED
+ void DIV(int bits, OpArg src);
+ void IMUL(int bits, OpArg src); //SIGNED
+ void IDIV(int bits, OpArg src);
+ void IMUL(int bits, X64Reg regOp, OpArg src);
+ void IMUL(int bits, X64Reg regOp, OpArg src, OpArg imm);
+
+
+ void NEG(int bits, OpArg src);
+ void NOT(int bits, OpArg src);
+
+ void ROL(int bits, OpArg dest, OpArg shift);
+ void ROR(int bits, OpArg dest, OpArg shift);
+ void RCL(int bits, OpArg dest, OpArg shift);
+ void RCR(int bits, OpArg dest, OpArg shift);
+ void SHL(int bits, OpArg dest, OpArg shift);
+ void SHR(int bits, OpArg dest, OpArg shift);
+ void SAR(int bits, OpArg dest, OpArg shift);
+
+
+ void CWD(int bits = 16);
+ inline void CDQ() {CWD(32);}
+ inline void CQO() {CWD(64);}
+ void CBW(int bits = 8);
+ inline void CWDE() {CBW(16);}
+ inline void CDQE() {CBW(32);}
+
+ void LEA(int bits, X64Reg dest, OpArg src);
+
+
+ enum PrefetchLevel
+ {
+ PF_NTA, //Non-temporal (data used once and only once)
+ PF_T0, //All cache levels
+ PF_T1, //Levels 2+ (aliased to T0 on AMD)
+ PF_T2, //Levels 3+ (aliased to T0 on AMD)
+ };
+ void PREFETCH(PrefetchLevel level, OpArg arg);
+
+
+ void ADD (int bits, const OpArg &a1, const OpArg &a2);
+ void ADC (int bits, const OpArg &a1, const OpArg &a2);
+ void SUB (int bits, const OpArg &a1, const OpArg &a2);
+ void SBB (int bits, const OpArg &a1, const OpArg &a2);
+ void AND (int bits, const OpArg &a1, const OpArg &a2);
+ void OR (int bits, const OpArg &a1, const OpArg &a2);
+ void XOR (int bits, const OpArg &a1, const OpArg &a2);
+ void MOV (int bits, const OpArg &a1, const OpArg &a2);
+ void TEST(int bits, const OpArg &a1, const OpArg &a2);
+ void CMP (int bits, const OpArg &a1, const OpArg &a2);
+
+ // XCHG is SLOW and should be avoided.
+ //void XCHG(int bits, const OpArg &a1, const OpArg &a2);
+
+ void XCHG_AHAL();
+ void BSWAP(int bits, X64Reg reg);
+ 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);
+
+ enum SSECompare
+ {
+ EQ = 0,
+ LT,
+ LE,
+ UNORD,
+ NEQ,
+ NLT,
+ NLE,
+ ORD,
+ };
+
+ // WARNING - These two take 11-13 cycles and are VectorPath! (AMD64)
+ void STMXCSR(OpArg memloc);
+ void LDMXCSR(OpArg memloc);
+
+ // Regular SSE/SSE2 instructions
+ 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 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 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);
+ void RSQRTSD(X64Reg regOp, OpArg arg);
+
+ void COMISS(X64Reg regOp, OpArg arg);
+ void COMISD(X64Reg regOp, OpArg arg);
+
+ 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 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);
+ void ORPD(X64Reg regOp, OpArg arg);
+ void XORPS(X64Reg regOp, OpArg arg);
+ void XORPD(X64Reg regOp, OpArg arg);
+ void MULPS(X64Reg regOp, OpArg arg);
+ void MULPD(X64Reg regOp, OpArg arg);
+ void DIVPS(X64Reg regOp, OpArg arg);
+ void DIVPD(X64Reg regOp, OpArg arg);
+ void MINPS(X64Reg regOp, OpArg arg);
+ void MINPD(X64Reg regOp, OpArg arg);
+ void MAXPS(X64Reg regOp, OpArg arg);
+ void MAXPD(X64Reg regOp, OpArg arg);
+ void SQRTPS(X64Reg regOp, OpArg arg);
+ void SQRTPD(X64Reg regOp, OpArg arg);
+ void RSQRTPS(X64Reg regOp, OpArg arg);
+ void RSQRTPD(X64Reg regOp, OpArg arg);
+ void SHUFPS(X64Reg regOp, OpArg arg, u8 shuffle);
+ void SHUFPD(X64Reg regOp, OpArg arg, u8 shuffle);
+
+ void MOVDDUP(X64Reg regOp, OpArg arg);
+
+ void COMISS(X64Reg regOp, OpArg arg);
+ void COMISD(X64Reg regOp, OpArg arg);
+ void UCOMISS(X64Reg regOp, OpArg arg);
+ void UCOMISD(X64Reg regOp, OpArg arg);
+
+ void MOVAPS(X64Reg regOp, OpArg arg);
+ void MOVAPD(X64Reg regOp, OpArg arg);
+ void MOVAPS(OpArg arg, X64Reg regOp);
+ void MOVAPD(OpArg arg, X64Reg regOp);
+
+ void MOVUPS(X64Reg regOp, OpArg arg);
+ void MOVUPD(X64Reg regOp, OpArg arg);
+ void MOVUPS(OpArg arg, X64Reg regOp);
+ void MOVUPD(OpArg arg, X64Reg regOp);
+
+ void MOVSS(X64Reg regOp, OpArg arg);
+ void MOVSD(X64Reg regOp, OpArg arg);
+ void MOVSS(OpArg arg, X64Reg regOp);
+ void MOVSD(OpArg arg, X64Reg regOp);
+
+ void MOVMSKPS(X64Reg dest, OpArg arg);
+ void MOVMSKPD(X64Reg dest, OpArg arg);
+
+ void MOVD_xmm(X64Reg dest, const OpArg &arg);
+ void MOVQ_xmm(X64Reg dest, OpArg arg);
+ void MOVD_xmm(const OpArg &arg, X64Reg src);
+ void MOVQ_xmm(OpArg arg, X64Reg src);
+
+ void MASKMOVDQU(X64Reg dest, X64Reg src);
+ void LDDQU(X64Reg dest, OpArg src);
+
+ void UNPCKLPD(X64Reg dest, OpArg src);
+ void UNPCKHPD(X64Reg dest, OpArg src);
+
+ void CVTPS2PD(X64Reg dest, OpArg src);
+ void CVTPD2PS(X64Reg dest, OpArg src);
+ void CVTSS2SD(X64Reg dest, OpArg src);
+ void CVTSD2SS(X64Reg dest, OpArg src);
+ void CVTSD2SI(X64Reg dest, OpArg src);
+ void CVTDQ2PD(X64Reg regOp, OpArg arg);
+ void CVTPD2DQ(X64Reg regOp, OpArg arg);
+ void CVTDQ2PS(X64Reg regOp, const OpArg &arg);
+
+ //Integer SSE instructions
+ void PACKSSDW(X64Reg dest, OpArg arg);
+ void PACKSSWB(X64Reg dest, OpArg arg);
+ //void PACKUSDW(X64Reg dest, OpArg arg);
+ void PACKUSWB(X64Reg dest, OpArg arg);
+
+ void PUNPCKLBW(X64Reg dest, const OpArg &arg);
+ void PUNPCKLWD(X64Reg dest, const OpArg &arg);
+ void PUNPCKLDQ(X64Reg dest, const OpArg &arg);
+
+ void PSRAD(X64Reg dest, int shift);
+
+ 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 PADDB(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 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 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 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 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);
+
+ void RTDSC();
+
+void CallCdeclFunction3(void* fnptr, u32 arg0, u32 arg1, u32 arg2);
+void CallCdeclFunction4(void* fnptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
+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) || !defined(_WIN32)
+
+#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 DECLARE_IMPORT(x)
+
+#else
+
+// Comments from VertexLoader.cpp about these horrors:
+
+// This is a horrible hack that is necessary in 64-bit mode because Opengl32.dll is based way, way above the 32-bit
+// address space that is within reach of a CALL, and just doing &fn gives us these high uncallable addresses. So we
+// want to grab the function pointers from the import table instead.
+
+void ___CallCdeclImport3(void* impptr, u32 arg0, u32 arg1, u32 arg2);
+void ___CallCdeclImport4(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3);
+void ___CallCdeclImport5(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4);
+void ___CallCdeclImport6(void* impptr, u32 arg0, u32 arg1, u32 arg2, u32 arg3, u32 arg4, u32 arg5);
+
+#define CallCdeclFunction3_I(a,b,c,d) ___CallCdeclImport3(&__imp_##a,b,c,d)
+#define CallCdeclFunction4_I(a,b,c,d,e) ___CallCdeclImport4(&__imp_##a,b,c,d,e)
+#define CallCdeclFunction5_I(a,b,c,d,e,f) ___CallCdeclImport5(&__imp_##a,b,c,d,e,f)
+#define CallCdeclFunction6_I(a,b,c,d,e,f,g) ___CallCdeclImport6(&__imp_##a,b,c,d,e,f,g)
+
+#define DECLARE_IMPORT(x) extern "C" void *__imp_##x
+
+#endif
+
+}
+
+#endif