diff --git a/.gitignore b/.gitignore
index ce3a06d2d1..3f4019915c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,9 @@ Release
Windows/x64
Windows/ipch
+# For Mac
+.DS_Store
+
# For ppsspp.ini, etc.
*.ini
@@ -37,6 +40,7 @@ gen
libs
obj
build*/
+/git-version.cpp
.pspsh.hist
__testoutput.txt
@@ -46,5 +50,6 @@ __testfailure.bmp
GameLogNotes.txt
android/ui_atlas.zim
+android/assets/flash0
ppge_atlas.zim.png
local.properties
diff --git a/Blackberry/bar-descriptor.xml b/Blackberry/bar-descriptor.xml
index 47adeae27f..1a90a982cb 100644
--- a/Blackberry/bar-descriptor.xml
+++ b/Blackberry/bar-descriptor.xml
@@ -3,8 +3,8 @@
com.Qtness.PPSSPP
PPSSPP
PPSSPPBlackberry
- 0.6.1
- 2
+ 0.7.0
+ 1
Playstation portable emulator.
Qtness
@@ -20,6 +20,7 @@
PPSSPPBlackberry
icon-114.png
assets
+ assets/flash
core.games
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 960e9f6f0b..ed7d97f5fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,10 @@ if(BLACKBERRY)
set(ARM ON)
endif()
+if(LOONGSON)
+ set(MIPS ON) # MIPS + x86 for now
+endif()
+
if(ARM)
set(USING_GLES2 ON)
else() # Assume x86
@@ -30,6 +34,7 @@ endif()
# User-editable options (go into CMakeCache.txt)
option(ARM "Set to ON if targeting an ARM processor" ${ARM})
+option(MIPS "Set to ON if targeting a MIPS processor" ${MIPS})
option(X86 "Set to ON if targeting an X86 processor" ${X86})
option(ANDROID "Set to ON if targeting an Android device" ${ANDROID})
option(BLACKBERRY "Set to ON if targeting a Blackberry device" ${BLACKBERRY})
@@ -105,6 +110,10 @@ if(USING_GLES2)
add_definitions(-DUSING_GLES2)
endif()
+if(MIPS)
+ add_definitions(-DMIPS)
+endif()
+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG")
@@ -127,7 +136,7 @@ if(NOT MSVC)
add_definitions(-D_QNX_SOURCE=1 -D_C99=1)
endif()
- if(X86)
+ if(X86 AND NOT MIPS)
# enable sse2 code generation
add_definitions(-msse2)
endif()
@@ -136,6 +145,7 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++")
elseif(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
+ set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
@@ -618,6 +628,8 @@ if(ARM)
Core/MIPS/ARM/ArmJitCache.h
Core/MIPS/ARM/ArmRegCache.cpp
Core/MIPS/ARM/ArmRegCache.h
+ Core/MIPS/ARM/ArmRegCacheFPU.cpp
+ Core/MIPS/ARM/ArmRegCacheFPU.h
ext/disarm.cpp)
elseif(X86)
set(CoreExtra ${CoreExtra}
@@ -684,6 +696,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/FileSystems/ISOFileSystem.h
Core/FileSystems/MetaFileSystem.cpp
Core/FileSystems/MetaFileSystem.h
+ Core/Font/PGF.cpp
+ Core/Font/PGF.h
Core/HLE/FunctionWrappers.h
Core/HLE/HLE.cpp
Core/HLE/HLE.h
@@ -747,6 +761,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/HLE/sceNet.h
Core/HLE/sceOpenPSID.cpp
Core/HLE/sceOpenPSID.h
+ Core/HLE/sceP3da.cpp
+ Core/HLE/sceP3da.h
Core/HLE/sceParseHttp.cpp
Core/HLE/sceParseHttp.h
Core/HLE/sceParseUri.cpp
@@ -810,6 +826,8 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/PSPLoaders.h
Core/PSPMixer.cpp
Core/PSPMixer.h
+ Core/Reporting.cpp
+ Core/Reporting.h
Core/SaveState.cpp
Core/SaveState.h
Core/System.cpp
@@ -818,15 +836,26 @@ add_library(${CoreLibName} ${CoreLinkType}
Core/Util/BlockAllocator.h
Core/Util/PPGeDraw.cpp
Core/Util/PPGeDraw.h
- Core/Util/Pool.h
Core/Util/ppge_atlas.cpp
Core/Util/ppge_atlas.h
$
- Globals.h)
+ Globals.h
+ git-version.cpp)
target_link_libraries(${CoreLibName} Common native kirk cityhash
${GLEW_LIBRARIES} ${OPENGL_LIBRARIES})
setup_target_project(${CoreLibName} Core)
+# Generate git-version.cpp at build time.
+add_custom_target(GitVersion ALL
+ DEPENDS something_that_never_exists)
+add_custom_command(OUTPUT something_that_never_exists
+ COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake)
+
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
+ PROPERTIES GENERATED TRUE)
+add_dependencies(${CoreLibName} GitVersion)
+
add_library(GPU OBJECT
GPU/GLES/DisplayListInterpreter.cpp
GPU/GLES/DisplayListInterpreter.h
@@ -944,6 +973,7 @@ endif()
set(NativeAppSource
android/jni/NativeApp.cpp
android/jni/EmuScreen.cpp
+ android/jni/TestRunner.cpp
android/jni/MenuScreens.cpp
android/jni/GamepadEmu.cpp
android/jni/UIShader.cpp
@@ -970,13 +1000,21 @@ file(INSTALL ${NativeAssets} DESTINATION assets)
# packaging and code signing
if (IOS)
+ file(GLOB IOSAssets ios/assets/*.png)
+ file(INSTALL
+ ${IOSAssets}
+ DESTINATION assets)
+ file(INSTALL flash0 DESTINATION assets)
set(RSRC_XIB_FILES assets/Icon@2x.png)
SET_SOURCE_FILES_PROPERTIES(${RSRC_XIB_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
set(APP_DIR_NAME \${TARGET_BUILD_DIR}/\${FULL_PRODUCT_NAME})
add_custom_command(TARGET PPSSPP POST_BUILD
- COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H `find assets` | tar -x -C ${APP_DIR_NAME}
+ COMMAND tar -c -C . --exclude .DS_Store --exclude .git -H `find assets` | tar -x -C '${APP_DIR_NAME}'
+ )
+ set_target_properties(${TargetBin} PROPERTIES
+ MACOSX_BUNDLE_INFO_PLIST "../ios/PPSSPP-Info.plist"
+ XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "iPhone/iPad"
)
- set_target_properties(${TargetBin} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "../ios/PPSSPP-Info.plist" XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: My Name")
endif()
#include(CPack)
diff --git a/Common/ArmCPUDetect.cpp b/Common/ArmCPUDetect.cpp
index afaf6b777b..eabeee915c 100644
--- a/Common/ArmCPUDetect.cpp
+++ b/Common/ArmCPUDetect.cpp
@@ -139,8 +139,10 @@ void CPUInfo::Detect()
bVFPv3 = CheckCPUFeature("vfpv3");
bTLS = CheckCPUFeature("tls");
bVFPv4 = CheckCPUFeature("vfpv4");
- bIDIVa = CheckCPUFeature("idiva");
- bIDIVt = CheckCPUFeature("idivt");
+ // On some buggy kernels(Qualcomm) they show that they support VFPv4 but not IDIVa
+ // All VFPv4 CPUs will support IDIVa
+ bIDIVa = bVFPv4 || CheckCPUFeature("idiva");
+ bIDIVt = bVFPv4 || CheckCPUFeature("idivt");
// These two require ARMv8 or higher
bFP = CheckCPUFeature("fp");
bASIMD = CheckCPUFeature("asimd");
@@ -155,11 +157,12 @@ void CPUInfo::Detect()
#ifdef __SYMBIAN32__
bThumbEE = false;
bNEON = false;
+ bVFPv3 = false;
#else
bThumbEE = true;
bNEON = true;
-#endif
bVFPv3 = true;
+#endif
bTLS = true;
bVFPv4 = false;
bIDIVa = false;
diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp
index e4306c0324..7cdc3b4045 100644
--- a/Common/ArmEmitter.cpp
+++ b/Common/ArmEmitter.cpp
@@ -83,65 +83,104 @@ bool TryMakeOperand2_AllowNegation(s32 imm, Operand2 &op2, bool *negated)
}
}
+void ARMXEmitter::MOVI2F(ARMReg dest, float val, ARMReg tempReg)
+{
+ union {float f; u32 u;} conv;
+ conv.f = val;
+ MOVI2R(tempReg, conv.u);
+ VMOV(dest, tempReg);
+ // TODO: VMOV an IMM directly if possible
+ // Otherwise, use a literal pool and VLDR directly (+- 1020)
+}
+
+void ARMXEmitter::ANDI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
+{
+ Operand2 op2;
+ bool inverse;
+ if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
+ if (!inverse) {
+ AND(rd, rs, op2);
+ } else {
+ BIC(rd, rs, op2);
+ }
+ } else {
+ MOVI2R(scratch, val);
+ AND(rd, rs, scratch);
+ }
+}
+
+void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
+{
+ Operand2 op2;
+ if (TryMakeOperand2(val, op2)) {
+ ORR(rd, rs, op2);
+ } else {
+ MOVI2R(scratch, val);
+ ORR(rd, rs, scratch);
+ }
+}
+
+void ARMXEmitter::FlushLitPool()
+{
+ for(std::vector::iterator it = currentLitPool.begin(); it != currentLitPool.end(); ++it) {
+ // Search for duplicates
+ for(std::vector::iterator old_it = currentLitPool.begin(); old_it != it; ++old_it) {
+ if ((*old_it).val == (*it).val)
+ (*it).loc = (*old_it).loc;
+ }
+
+ // Write the constant to Literal Pool
+ if (!(*it).loc)
+ {
+ (*it).loc = (s32)code;
+ Write32((*it).val);
+ }
+ s32 offset = (*it).loc - (s32)(*it).ldr_address - 8;
+
+ // Backpatch the LDR
+ *(u32*)(*it).ldr_address |= (offset >= 0) << 23 | abs(offset);
+ }
+ // TODO: Save a copy of previous pools in case they are still in range.
+ currentLitPool.clear();
+}
+
+void ARMXEmitter::AddNewLit(u32 val)
+{
+ LiteralPool pool_item;
+ pool_item.loc = 0;
+ pool_item.val = val;
+ pool_item.ldr_address = code;
+ currentLitPool.push_back(pool_item);
+}
+
void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
{
Operand2 op2;
bool inverse;
- if (!optimize)
+
+ if (cpu_info.bArmV7 && !optimize)
{
- // Only used in backpatch atm
- // Only support ARMv7 right now
- if (cpu_info.bArmV7) {
- MOVW(reg, val & 0xFFFF);
- MOVT(reg, val, true);
- }
- else
- {
- // ARMv6 version won't use backpatch for now
- // Run again with optimizations
- MOVI2R(reg, val);
- }
- } else if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
- if (!inverse)
- MOV(reg, op2);
- else
- MVN(reg, op2);
+ // For backpatching on ARMv7
+ MOVW(reg, val & 0xFFFF);
+ MOVT(reg, val, true);
+ }
+ else if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
+ inverse ? MVN(reg, op2) : MOV(reg, op2);
} else {
- if (cpu_info.bArmV7) {
- // ARMv7 - can use MOVT/MOVW, best choice
+ if (cpu_info.bArmV7)
+ {
+ // Use MOVW+MOVT for ARMv7+
MOVW(reg, val & 0xFFFF);
if(val & 0xFFFF0000)
MOVT(reg, val, true);
} else {
- // ARMv6 - fallback sequence.
- // TODO: Optimize further. Can for example choose negation etc.
- // Literal pools is another way to do this but much more complicated
- // so I can't really be bothered for an outdated CPU architecture like ARMv6.
- bool first = true;
- int shift = 16;
- for (int i = 0; i < 4; i++) {
- if (val & 0xFF) {
- if (first) {
- MOV(reg, Operand2((u8)val, (u8)(shift & 0xF)));
- first = false;
- } else {
- ORR(reg, reg, Operand2((u8)val, (u8)(shift & 0xF)));
- }
- }
- shift -= 4;
- val >>= 8;
- }
+ // Use literal pool for ARMv6.
+ AddNewLit(val);
+ LDR(reg, _PC); // To be backpatched later
}
}
}
-// Moves IMM to memory location
-void ARMXEmitter::ARMABI_MOVI2M(Operand2 op, Operand2 val)
-{
- // This moves imm to a memory location
- MOVW(R14, val); MOVT(R14, val, true);
- MOVW(R12, op); MOVT(R12, op, true);
- STR(R12, R14); // R10 is what we want to store
-}
+
void ARMXEmitter::QuickCallFunction(ARMReg reg, void *func) {
MOVI2R(reg, (u32)(func));
BL(reg);
@@ -151,9 +190,7 @@ void ARMXEmitter::SetCodePtr(u8 *ptr)
{
code = ptr;
startcode = code;
-#ifdef IOS
lastCacheFlushEnd = ptr;
-#endif
}
const u8 *ARMXEmitter::GetCodePtr() const
@@ -197,8 +234,8 @@ void ARMXEmitter::FlushIcacheSection(u8 *start, u8 *end)
#elif defined(BLACKBERRY)
msync(start, end - start, MS_SYNC | MS_INVALIDATE_ICACHE);
#elif defined(IOS)
- if (start != NULL)
- sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
+ // Header file says this is equivalent to: sys_icache_invalidate(start, end - start);
+ sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
#elif !defined(_WIN32)
__builtin___clear_cache(start, end);
#endif
@@ -475,6 +512,7 @@ void ARMXEmitter::LSL (ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedData
void ARMXEmitter::LSLS(ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedDataOp(0, true, dest, src, op2);}
void ARMXEmitter::LSL (ARMReg dest, ARMReg src, ARMReg op2) { WriteShiftedDataOp(1, false, dest, src, op2);}
void ARMXEmitter::LSLS(ARMReg dest, ARMReg src, ARMReg op2) { WriteShiftedDataOp(1, true, dest, src, op2);}
+void ARMXEmitter::LSR (ARMReg dest, ARMReg src, Operand2 op2) { WriteShiftedDataOp(3, false, dest, src, op2);}
void ARMXEmitter::MUL (ARMReg dest, ARMReg src, ARMReg op2)
{
Write32(condition | (dest << 16) | (src << 8) | (9 << 4) | op2);
@@ -498,10 +536,38 @@ void ARMXEmitter::SMULL(ARMReg destLo, ARMReg destHi, ARMReg rm, ARMReg rn)
Write4OpMultiply(0xC, destLo, destHi, rn, rm);
}
+void ARMXEmitter::UMLAL(ARMReg destLo, ARMReg destHi, ARMReg rm, ARMReg rn)
+{
+ Write4OpMultiply(0xA, destLo, destHi, rn, rm);
+}
+
+void ARMXEmitter::SMLAL(ARMReg destLo, ARMReg destHi, ARMReg rm, ARMReg rn)
+{
+ Write4OpMultiply(0xE, destLo, destHi, rn, rm);
+}
+
+void ARMXEmitter::UBFX(ARMReg dest, ARMReg rn, u8 lsb, u8 width)
+{
+ Write32(condition | (0x7E0 << 16) | ((width - 1) << 16) | (dest << 12) | (lsb << 7) | (5 << 4) | rn);
+}
+
+void ARMXEmitter::CLZ(ARMReg rd, ARMReg rm)
+{
+ Write32(condition | (0x16F << 16) | (rd << 12) | (0xF1 << 4) | rm);
+}
+
+void ARMXEmitter::BFI(ARMReg rd, ARMReg rn, u8 lsb, u8 width)
+{
+ u32 msb = (lsb + width - 1);
+ if (msb > 31) msb = 31;
+ Write32(condition | (0x7C0 << 16) | (msb << 16) | (rd << 12) | (lsb << 7) | (1 << 4) | rn);
+}
+
void ARMXEmitter::SXTB (ARMReg dest, ARMReg op2)
{
Write32(condition | (0x6AF << 16) | (dest << 12) | (7 << 4) | op2);
}
+
void ARMXEmitter::SXTH (ARMReg dest, ARMReg op2, u8 rotation)
{
SXTAH(dest, (ARMReg)15, op2, rotation);
@@ -512,9 +578,13 @@ void ARMXEmitter::SXTAH(ARMReg dest, ARMReg src, ARMReg op2, u8 rotation)
// information
Write32(condition | (0x6B << 20) | (src << 16) | (dest << 12) | (rotation << 10) | (7 << 4) | op2);
}
-void ARMXEmitter::REV (ARMReg dest, ARMReg src )
+void ARMXEmitter::RBIT(ARMReg dest, ARMReg src)
{
- Write32(condition | (107 << 20) | (15 << 16) | (dest << 12) | (243 << 4) | src);
+ Write32(condition | (0x6F << 20) | (0xF << 16) | (dest << 12) | (0xF3 << 4) | src);
+}
+void ARMXEmitter::REV (ARMReg dest, ARMReg src)
+{
+ Write32(condition | (0x6B << 20) | (0xF << 16) | (dest << 12) | (0xF3 << 4) | src);
}
void ARMXEmitter::REV16(ARMReg dest, ARMReg src)
{
@@ -534,27 +604,14 @@ void ARMXEmitter::MRS (ARMReg dest)
Write32(condition | (16 << 20) | (15 << 16) | (dest << 12));
}
-void ARMXEmitter::WriteStoreOp(u32 op, ARMReg dest, ARMReg src, Operand2 op2)
-{
- if (op2.GetData() == 0) // set the preindex bit, but not the W bit!
- Write32(condition | 0x01800000 | (op << 20) | (dest << 16) | (src << 12) | op2.Imm12());
- else
- Write32(condition | (op << 20) | (3 << 23) | (dest << 16) | (src << 12) | op2.Imm12());
-}
-void ARMXEmitter::STR (ARMReg dest, ARMReg src, Operand2 op) { WriteStoreOp(0x40, dest, src, op);}
-void ARMXEmitter::STRB(ARMReg dest, ARMReg src, Operand2 op) { WriteStoreOp(0x44, dest, src, op);}
-void ARMXEmitter::STR (ARMReg dest, ARMReg base, ARMReg offset, bool Index, bool Add)
-{
- Write32(condition | (0x60 << 20) | (Index << 24) | (Add << 23) | (dest << 16) | (base << 12) | offset);
-}
void ARMXEmitter::LDREX(ARMReg dest, ARMReg base)
{
Write32(condition | (25 << 20) | (base << 16) | (dest << 12) | 0xF9F);
}
-void ARMXEmitter::STREX(ARMReg dest, ARMReg base, ARMReg op)
+void ARMXEmitter::STREX(ARMReg result, ARMReg base, ARMReg op)
{
- _assert_msg_(DYNA_REC, (dest != base && dest != op), "STREX dest can't be other two registers");
- Write32(condition | (24 << 20) | (base << 16) | (dest << 12) | (0xF9 << 4) | op);
+ _assert_msg_(DYNA_REC, (result != base && result != op), "STREX dest can't be other two registers");
+ Write32(condition | (24 << 20) | (base << 16) | (result << 12) | (0xF9 << 4) | op);
}
void ARMXEmitter::DMB ()
{
@@ -564,19 +621,120 @@ void ARMXEmitter::SVC(Operand2 op)
{
Write32(condition | (0x0F << 24) | op.Imm24());
}
+// IMM, REG, IMMSREG, RSR
+// -1 for invalid if the instruction doesn't support that
+const s32 LoadStoreOps[][4] = {
+ {0x40, 0x60, 0x60, -1}, // STR
+ {0x41, 0x61, 0x61, -1}, // LDR
+ {0x44, 0x64, 0x64, -1}, // STRB
+ {0x45, 0x65, 0x65, -1}, // LDRB
+ // Special encodings
+ { 0x4, 0x0, -1, -1}, // STRH
+ { 0x5, 0x1, -1, -1}, // LDRH
+ { 0x5, 0x1, -1, -1}, // LDRSB
+ { 0x5, 0x1, -1, -1}, // LDRSH
+};
+const char *LoadStoreNames[] = {
+ "STR",
+ "LDR",
+ "STRB",
+ "LDRB",
+ "STRH",
+ "LDRH",
+ "LDRSB",
+ "LDRSH",
+};
-void ARMXEmitter::LDR (ARMReg dest, ARMReg src, Operand2 op) { WriteStoreOp(0x41, src, dest, op);}
-void ARMXEmitter::LDRH(ARMReg dest, ARMReg src, Operand2 op)
+void ARMXEmitter::WriteStoreOp(u32 Op, ARMReg Rt, ARMReg Rn, Operand2 Rm, bool RegAdd)
{
- u8 Imm = op.Imm8();
- Write32(condition | (0x05 << 20) | (src << 16) | (dest << 12) | ((Imm >> 4) << 8) | (0xB << 4) | (Imm & 0x0F));
-}
-void ARMXEmitter::LDRB(ARMReg dest, ARMReg src, Operand2 op) { WriteStoreOp(0x45, src, dest, op);}
+ s32 op = LoadStoreOps[Op][Rm.GetType()]; // Type always decided by last operand
+ u32 Data;
-void ARMXEmitter::LDR (ARMReg dest, ARMReg base, ARMReg offset, bool Index, bool Add)
-{
- Write32(condition | (0x61 << 20) | (Index << 24) | (Add << 23) | (base << 16) | (dest << 12) | offset);
+ // Qualcomm chipsets get /really/ angry if you don't use index, even if the offset is zero.
+ // Some of these encodings require Index at all times anyway. Doesn't really matter.
+ // bool Index = op2 != 0 ? true : false;
+ bool Index = true;
+ bool Add = false;
+
+ // Special Encoding (misc addressing mode)
+ bool SpecialOp = false;
+ bool Half = false;
+ bool SignedLoad = false;
+
+ if (op == -1)
+ _assert_msg_(DYNA_REC, false, "%s does not support %d", LoadStoreNames[Op], Rm.GetType());
+
+ switch (Op)
+ {
+ case 4: // STRH
+ SpecialOp = true;
+ Half = true;
+ SignedLoad = false;
+ break;
+ case 5: // LDRH
+ SpecialOp = true;
+ Half = true;
+ SignedLoad = false;
+ break;
+ case 6: // LDRSB
+ SpecialOp = true;
+ Half = false;
+ SignedLoad = true;
+ break;
+ case 7: // LDRSH
+ SpecialOp = true;
+ Half = true;
+ SignedLoad = true;
+ break;
+ }
+ switch (Rm.GetType())
+ {
+ case TYPE_IMM:
+ {
+ s32 Temp = (s32)Rm.Value;
+ Data = abs(Temp);
+ // The offset is encoded differently on this one.
+ if (SpecialOp)
+ Data = (Data & 0xF0 << 4) | (Data & 0xF);
+ if (Temp >= 0) Add = true;
+ }
+ break;
+ case TYPE_REG:
+ Data = Rm.GetData();
+ Add = RegAdd;
+ break;
+ case TYPE_IMMSREG:
+ if (!SpecialOp)
+ {
+ Data = Rm.GetData();
+ Add = RegAdd;
+ break;
+ }
+ // Intentional fallthrough: TYPE_IMMSREG not supported for misc addressing.
+ default:
+ // RSR not supported for any of these
+ // We already have the warning above
+ BKPT(0x2);
+ return;
+ break;
+ }
+ if (SpecialOp)
+ {
+ // Add SpecialOp things
+ Data = (0x9 << 4) | (SignedLoad << 6) | (Half << 5) | Data;
+ }
+ Write32(condition | (op << 20) | (Index << 24) | (Add << 23) | (Rn << 16) | (Rt << 12) | Data);
}
+
+void ARMXEmitter::LDR (ARMReg dest, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(1, dest, base, op2, RegAdd);}
+void ARMXEmitter::LDRB(ARMReg dest, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(3, dest, base, op2, RegAdd);}
+void ARMXEmitter::LDRH(ARMReg dest, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(5, dest, base, op2, RegAdd);}
+void ARMXEmitter::LDRSB(ARMReg dest, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(6, dest, base, op2, RegAdd);}
+void ARMXEmitter::LDRSH(ARMReg dest, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(7, dest, base, op2, RegAdd);}
+void ARMXEmitter::STR (ARMReg result, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(0, result, base, op2, RegAdd);}
+void ARMXEmitter::STRH (ARMReg result, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(4, result, base, op2, RegAdd);}
+void ARMXEmitter::STRB (ARMReg result, ARMReg base, Operand2 op2, bool RegAdd) { WriteStoreOp(2, result, base, op2, RegAdd);}
+
void ARMXEmitter::WriteRegStoreOp(u32 op, ARMReg dest, bool WriteBack, u16 RegList)
{
Write32(condition | (op << 20) | (WriteBack << 21) | (dest << 16) | RegList);
@@ -626,19 +784,22 @@ ARMReg ARMXEmitter::SubBase(ARMReg Reg)
}
return Reg;
}
+
// NEON Specific
void ARMXEmitter::VADD(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm)
{
- _assert_msg_(DYNA_REC, Vd >= Q0, "Pass invalid register to VADD(integer)");
+ _assert_msg_(DYNA_REC, Vd >= D0, "Pass invalid register to VADD(integer)");
_assert_msg_(DYNA_REC, cpu_info.bNEON, "Can't use VADD(integer) when CPU doesn't support it");
+ bool register_quad = Vd >= Q0;
+
// Gets encoded as a double register
Vd = SubBase(Vd);
Vn = SubBase(Vn);
Vm = SubBase(Vm);
Write32((0xF2 << 24) | ((Vd & 0x10) << 18) | (Size << 20) | ((Vn & 0xF) << 16) \
- | ((Vd & 0xF) << 12) | (0x8 << 8) | ((Vn & 0x10) << 3) | (1 << 6) \
+ | ((Vd & 0xF) << 12) | (0x8 << 8) | ((Vn & 0x10) << 3) | (register_quad << 6) \
| ((Vm & 0x10) << 2) | (Vm & 0xF));
}
@@ -655,54 +816,66 @@ void ARMXEmitter::VSUB(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm)
Write32((0xF3 << 24) | ((Vd & 0x10) << 18) | (Size << 20) | ((Vn & 0xF) << 16) \
| ((Vd & 0xF) << 12) | (0x8 << 8) | ((Vn & 0x10) << 3) | (1 << 6) \
| ((Vm & 0x10) << 2) | (Vm & 0xF));
-
}
// VFP Specific
-void ARMXEmitter::VLDR(ARMReg Dest, ARMReg Base, Operand2 op)
+void ARMXEmitter::VLDR(ARMReg Dest, ARMReg Base, u16 offset)
{
_assert_msg_(DYNA_REC, Dest >= S0 && Dest <= D31, "Passed Invalid dest register to VLDR");
_assert_msg_(DYNA_REC, Base <= R15, "Passed invalid Base register to VLDR");
- _assert_msg_(DYNA_REC, !(op.Imm12() & 4), "Offset needs to be word aligned");
+ _assert_msg_(DYNA_REC, (offset & 0xC03) == 0, "VLDR: Offset needs to be word aligned and small enough");
+
+ if (offset & 0xC03) {
+ ERROR_LOG(DYNA_REC, "VLDR: Bad offset %08x", offset);
+ }
+
+ // ERROR_LOG(DYNA_REC, "VLDR: s%i, r%i + %i", Dest - S0, Base, offset);
+
bool single_reg = Dest < D0;
Dest = SubBase(Dest);
if (single_reg)
{
- Write32(NO_COND | (0x1B << 23) | ((Dest & 0x1) << 22) | (1 << 20) | (Base << 16) \
- | ((Dest & 0x1E) << 11) | (10 << 8) | (op.Imm12() >> 2));
+ Write32(condition | (0x1B << 23) | ((Dest & 0x1) << 22) | (1 << 20) | (Base << 16) \
+ | ((Dest & 0x1E) << 11) | (10 << 8) | (offset >> 2));
}
else
{
- Write32(NO_COND | (0x1B << 23) | ((Dest & 0x10) << 18) | (1 << 20) | (Base << 16) \
- | ((Dest & 0xF) << 12) | (11 << 8) | (op.Imm12() >> 2));
+ Write32(condition | (0x1B << 23) | ((Dest & 0x10) << 18) | (1 << 20) | (Base << 16) \
+ | ((Dest & 0xF) << 12) | (11 << 8) | (offset >> 2));
}
}
-void ARMXEmitter::VSTR(ARMReg Src, ARMReg Base, Operand2 op)
+void ARMXEmitter::VSTR(ARMReg Src, ARMReg Base, u16 offset)
{
_assert_msg_(DYNA_REC, Src >= S0 && Src <= D31, "Passed invalid src register to VSTR");
_assert_msg_(DYNA_REC, Base <= R15, "Passed invalid base register to VSTR");
- _assert_msg_(DYNA_REC, !(op.Imm12() & 4), "Offset needs to be word aligned");
+ _assert_msg_(DYNA_REC, (offset & 0xC03) == 0, "VSTR: Offset needs to be word aligned");
+
+ if (offset & 0xC03) {
+ ERROR_LOG(DYNA_REC, "VSTR: Bad offset %08x", offset);
+ }
+ // ERROR_LOG(DYNA_REC, "VSTR: s%i, r%i + %i", Src - S0, Base, offset);
+
bool single_reg = Src < D0;
Src = SubBase(Src);
if (single_reg)
{
- Write32(NO_COND | (0x1B << 23) | ((Src & 0x1) << 22) | (Base << 16) \
- | ((Src & 0x1E) << 11) | (10 << 8) | (op.Imm12() >> 2));
+ Write32(condition | (0x1B << 23) | ((Src & 0x1) << 22) | (Base << 16) \
+ | ((Src & 0x1E) << 11) | (10 << 8) | (offset >> 2));
}
else
{
- Write32(NO_COND | (0x1B << 23) | ((Src & 0x10) << 18) | (Base << 16) \
- | ((Src & 0xF) << 12) | (11 << 8) | (op.Imm12() >> 2));
+ Write32(condition | (0x1B << 23) | ((Src & 0x10) << 18) | (Base << 16) \
+ | ((Src & 0xF) << 12) | (11 << 8) | (offset >> 2));
}
}
-void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm)
+void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm, bool E)
{
_assert_msg_(DYNA_REC, Vd < Q0, "Passed invalid Vd to VCMP");
bool single_reg = Vd < D0;
@@ -712,16 +885,16 @@ void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm)
if (single_reg)
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x34 << 16) | ((Vd & 0x1E) << 11) \
- | (0x2B << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x34 << 16) | ((Vd & 0x1E) << 11) \
+ | (E << 7) | (0x29 << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
}
else
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x34 << 16) | ((Vd & 0xF) << 12) \
- | (0x2F << 6) | ((Vm & 0x10) << 1) | (Vm & 0xF));
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x34 << 16) | ((Vd & 0xF) << 12) \
+ | (E << 7) | (0x2C << 6) | ((Vm & 0x10) << 1) | (Vm & 0xF));
}
}
-void ARMXEmitter::VCMP(ARMReg Vd)
+void ARMXEmitter::VCMP(ARMReg Vd, bool E)
{
_assert_msg_(DYNA_REC, Vd < Q0, "Passed invalid Vd to VCMP");
bool single_reg = Vd < D0;
@@ -730,15 +903,26 @@ void ARMXEmitter::VCMP(ARMReg Vd)
if (single_reg)
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x35 << 16) | ((Vd & 0x1E) << 11) \
- | (0x2B << 6));
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x35 << 16) | ((Vd & 0x1E) << 11) \
+ | (E << 7) | (0x29 << 6));
}
else
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x35 << 16) | ((Vd & 0xF) << 12) \
- | (0x2F << 6));
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x35 << 16) | ((Vd & 0xF) << 12) \
+ | (E << 7) | (0x2C << 6));
}
}
+
+void ARMXEmitter::VMRS_APSR() {
+ Write32(condition | 0xEF10A10 | (15 << 12));
+}
+void ARMXEmitter::VMRS(ARMReg Rt) {
+ Write32(condition | (0xEF << 20) | (1 << 16) | (Rt << 12) | 0xA10);
+}
+void ARMXEmitter::VMSR(ARMReg Rt) {
+ Write32(condition | (0xEE << 20) | (1 << 16) | (Rt << 12) | 0xA10);
+}
+
void ARMXEmitter::VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm)
{
_assert_msg_(DYNA_REC, Vd < Q0, "Pased invalid dest register to VSQRT");
@@ -752,13 +936,13 @@ void ARMXEmitter::VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm)
if (single_reg)
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | ((Vn & 0x1E) << 16) \
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | ((Vn & 0x1E) << 15) \
| ((Vd & 0x1E) << 11) | (0xA << 8) | ((Vn & 0x1) << 7) | ((Vm & 0x1) << 5) \
| (Vm >> 1));
}
else
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | ((Vn & 0xF) << 16) \
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | ((Vn & 0xF) << 16) \
| ((Vd & 0xF) << 12) | (0xB << 8) | ((Vn & 0x10) << 3) | ((Vm & 0x10) << 2) \
| (Vm & 0xF));
}
@@ -774,15 +958,16 @@ void ARMXEmitter::VSQRT(ARMReg Vd, ARMReg Vm)
if (single_reg)
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x31 << 16) \
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x31 << 16) \
| ((Vd & 0x1E) << 11) | (0x2B << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
}
else
{
- Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x31 << 16) \
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x31 << 16) \
| ((Vd & 0xF) << 12) | (0x2F << 6) | ((Vm & 0x10) << 2) | (Vm & 0xF));
}
}
+
// VFP and ASIMD
void ARMXEmitter::VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm)
{
@@ -798,15 +983,15 @@ void ARMXEmitter::VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm)
if (single_reg)
{
- Write32(NO_COND | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x3 << 20) \
- | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 12) | (0x5 << 9) \
+ Write32(condition | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x3 << 20) \
+ | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 11) | (0x5 << 9) \
| ((Vn & 0x1) << 7) | ((Vm & 0x1) << 5) | (Vm >> 1));
}
else
{
if (double_reg)
{
- Write32(NO_COND | (0x1C << 23) | ((Vd & 0x10) << 18) | (0x3 << 20) \
+ Write32(condition | (0x1C << 23) | ((Vd & 0x10) << 18) | (0x3 << 20) \
| ((Vn & 0xF) << 16) | ((Vd & 0xF) << 12) | (0xB << 8) \
| ((Vn & 0x10) << 3) | ((Vm & 0x10) << 2) | (Vm & 0xF));
}
@@ -833,15 +1018,15 @@ void ARMXEmitter::VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm)
if (single_reg)
{
- Write32(NO_COND | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x3 << 20) \
- | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 12) | (0x5 << 9) \
+ Write32(condition | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x3 << 20) \
+ | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 11) | (0x5 << 9) \
| ((Vn & 0x1) << 7) | (1 << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
}
else
{
if (double_reg)
{
- Write32(NO_COND | (0x1C << 23) | ((Vd & 0x10) << 18) | (0x3 << 20) \
+ Write32(condition | (0x1C << 23) | ((Vd & 0x10) << 18) | (0x3 << 20) \
| ((Vn & 0xF) << 16) | ((Vd & 0xF) << 12) | (0xB << 8) \
| ((Vn & 0x10) << 3) | (1 << 6) | ((Vm & 0x10) << 2) | (Vm & 0xF));
}
@@ -854,6 +1039,112 @@ void ARMXEmitter::VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm)
}
}
}
+// VFP and ASIMD
+void ARMXEmitter::VMUL(ARMReg Vd, ARMReg Vn, ARMReg Vm)
+{
+ _assert_msg_(DYNA_REC, Vd >= S0, "Passed invalid dest register to VADD");
+ _assert_msg_(DYNA_REC, Vn >= S0, "Passed invalid Vn to VADD");
+ _assert_msg_(DYNA_REC, Vm >= S0, "Passed invalid Vm to VADD");
+ bool single_reg = Vd < D0;
+ bool double_reg = Vd < Q0;
+
+ Vd = SubBase(Vd);
+ Vn = SubBase(Vn);
+ Vm = SubBase(Vm);
+
+ if (single_reg)
+ {
+ Write32(condition | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x2 << 20) \
+ | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 11) | (0x5 << 9) \
+ | ((Vn & 0x1) << 7) | ((Vm & 0x1) << 5) | (Vm >> 1));
+ }
+ else
+ {
+ if (double_reg)
+ {
+ Write32(condition | (0x1C << 23) | ((Vd & 0x10) << 18) | (0x2 << 20) \
+ | ((Vn & 0xF) << 16) | ((Vd & 0xF) << 12) | (0xB << 8) \
+ | ((Vn & 0x10) << 3) | ((Vm & 0x10) << 2) | (Vm & 0xF));
+ }
+ else
+ {
+ _assert_msg_(DYNA_REC, cpu_info.bNEON, "Trying to use VMUL with Quad Reg without support!");
+ }
+ }
+}
+
+void ARMXEmitter::VMLA(ARMReg Vd, ARMReg Vn, ARMReg Vm)
+{
+ _assert_msg_(DYNA_REC, Vd >= S0, "Passed invalid dest register to VMLA");
+ _assert_msg_(DYNA_REC, Vn >= S0, "Passed invalid Vn to VMLA");
+ _assert_msg_(DYNA_REC, Vm >= S0, "Passed invalid Vm to VMLA");
+ bool single_reg = Vd < D0;
+ bool double_reg = Vd < Q0;
+
+ Vd = SubBase(Vd);
+ Vn = SubBase(Vn);
+ Vm = SubBase(Vm);
+
+ if (single_reg)
+ {
+ Write32(condition | (0x1C << 23) | ((Vd & 0x1) << 22) | (0x0 << 20) \
+ | ((Vn & 0x1E) << 15) | ((Vd & 0x1E) << 11) | (0x5 << 9) \
+ | ((Vn & 0x1) << 7) | ((Vm & 0x1) << 5) | (Vm >> 1));
+ }
+ else
+ {
+ _assert_msg_(DYNA_REC, false, "VMLA: Please implement!");
+ }
+}
+
+void ARMXEmitter::VABS(ARMReg Vd, ARMReg Vm)
+{
+ bool single_reg = Vd < D0;
+
+ Vd = SubBase(Vd);
+ Vm = SubBase(Vm);
+
+ if (single_reg)
+ {
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x30 << 16) \
+ | ((Vd & 0x1E) << 11) | (0x2B << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
+ }
+ else
+ {
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x30 << 16) \
+ | ((Vd & 0xF) << 12) | (0x2F << 6) | ((Vm & 0x10) << 2) | (Vm & 0xF));
+ }
+}
+
+void ARMXEmitter::VNEG(ARMReg Vd, ARMReg Vm)
+{
+ bool single_reg = Vd < D0;
+
+ Vd = SubBase(Vd);
+ Vm = SubBase(Vm);
+
+ if (single_reg)
+ {
+ Write32(condition | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x31 << 16) \
+ | ((Vd & 0x1E) << 11) | (0x29 << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
+ }
+ else
+ {
+ Write32(condition | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x31 << 16) \
+ | ((Vd & 0xF) << 12) | (0x2D << 6) | ((Vm & 0x10) << 2) | (Vm & 0xF));
+ }
+}
+
+void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src, bool high)
+{
+ _assert_msg_(DYNA_REC, Src < S0, "This VMOV doesn't support SRC other than ARM Reg");
+ _assert_msg_(DYNA_REC, Dest >= D0, "This VMOV doesn't support DEST other than VFP");
+
+ Dest = SubBase(Dest);
+
+ Write32(condition | (0xE << 24) | (high << 21) | ((Dest & 0xF) << 16) | (Src << 12) \
+ | (11 << 8) | ((Dest & 0x10) << 3) | (1 << 4));
+}
void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
{
@@ -865,7 +1156,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
{
// Moving to a Neon register FROM ARM Reg
Dest = (ARMReg)(Dest - S0);
- Write32(NO_COND | (0xE0 << 20) | ((Dest & 0x1E) << 15) | (Src << 12) \
+ Write32(condition | (0xE0 << 20) | ((Dest & 0x1E) << 15) | (Src << 12) \
| (0xA << 8) | ((Dest & 0x1) << 7) | (1 << 4));
return;
}
@@ -885,7 +1176,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
{
// Moving to ARM Reg from Neon Register
Src = (ARMReg)(Src - S0);
- Write32(NO_COND | (0xE1 << 20) | ((Src & 0x1E) << 15) | (Dest << 12) \
+ Write32(condition | (0xE1 << 20) | ((Src & 0x1E) << 15) | (Dest << 12) \
| (0xA << 8) | ((Src & 0x1) << 7) | (1 << 4));
return;
}
@@ -915,7 +1206,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
if (Single)
{
- Write32(NO_COND | (0x1D << 23) | ((Dest & 0x1) << 22) | (0x3 << 20) | ((Dest & 0x1E) << 11) \
+ Write32(condition | (0x1D << 23) | ((Dest & 0x1) << 22) | (0x3 << 20) | ((Dest & 0x1E) << 11) \
| (0x5 << 9) | (1 << 6) | ((Src & 0x1) << 5) | ((Src & 0x1E) >> 1));
}
else
@@ -932,10 +1223,28 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
}
else
{
- Write32(NO_COND | (0x1D << 23) | ((Dest & 0x10) << 18) | (0x3 << 20) | ((Dest & 0xF) << 12) \
+ Write32(condition | (0x1D << 23) | ((Dest & 0x10) << 18) | (0x3 << 20) | ((Dest & 0xF) << 12) \
| (0x2D << 6) | ((Src & 0x10) << 1) | (Src & 0xF));
}
}
}
+void ARMXEmitter::VCVT(ARMReg Dest, ARMReg Source, int flags)
+{
+ bool single_reg = (Dest < D0) && (Source < D0);
+ int op = ((flags & TO_INT) ? (flags & ROUND_TO_ZERO) : (flags & IS_SIGNED)) ? 1 : 0;
+ int op2 = ((flags & TO_INT) ? (flags & IS_SIGNED) : 0) ? 1 : 0;
+ Dest = SubBase(Dest);
+ Source = SubBase(Source);
+
+ if (single_reg)
+ {
+ Write32(condition | (0x1D << 23) | ((Dest & 0x1) << 22) | (0x7 << 19) | ((flags & TO_INT) << 18) | (op2 << 16) \
+ | ((Dest & 0x1E) << 11) | (op << 7) | (0x29 << 6) | ((Source & 0x1) << 5) | (Source >> 1));
+ } else {
+ Write32(condition | (0x1D << 23) | ((Dest & 0x10) << 18) | (0x7 << 19) | ((flags & TO_INT) << 18) | (op2 << 16) \
+ | ((Dest & 0xF) << 12) | (1 << 8) | (op << 7) | (0x29 << 6) | ((Source & 0x10) << 1) | (Source & 0xF));
+ }
+}
+
}
diff --git a/Common/ArmEmitter.h b/Common/ArmEmitter.h
index e050cd53f4..a31e1753a2 100644
--- a/Common/ArmEmitter.h
+++ b/Common/ArmEmitter.h
@@ -25,6 +25,7 @@
#if defined(__SYMBIAN32__) || defined(PANDORA)
#include
#endif
+#include
#undef _IP
#undef R0
@@ -32,6 +33,12 @@
#undef _LR
#undef _PC
+// VCVT flags
+#define TO_FLOAT 0
+#define TO_INT 1 << 0
+#define IS_SIGNED 1 << 1
+#define ROUND_TO_ZERO 1 << 2
+
namespace ArmGen
{
enum ARMReg
@@ -171,7 +178,7 @@ public:
Value = base;
}
- Operand2(u8 shift, ShiftType type, ARMReg base)// For IMM shifted register
+ Operand2(ARMReg base, ShiftType type, u8 shift)// For IMM shifted register
{
if(shift == 32) shift = 0;
switch (type)
@@ -327,6 +334,13 @@ struct FixupBranch
int type; //0 = B 1 = BL
};
+struct LiteralPool
+{
+ s32 loc;
+ u8* ldr_address;
+ u32 val;
+};
+
typedef const u8* JumpTarget;
class ARMXEmitter
@@ -336,8 +350,9 @@ private:
u8 *code, *startcode;
u8 *lastCacheFlushEnd;
u32 condition;
+ std::vector currentLitPool;
- void WriteStoreOp(u32 op, ARMReg dest, ARMReg src, Operand2 op2);
+ void WriteStoreOp(u32 Op, ARMReg Rt, ARMReg Rn, Operand2 op2, bool RegAdd);
void WriteRegStoreOp(u32 op, ARMReg dest, bool WriteBack, u16 RegList);
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, ARMReg op2);
void WriteShiftedDataOp(u32 op, bool SetFlags, ARMReg dest, ARMReg src, Operand2 op2);
@@ -373,6 +388,10 @@ public:
void FlushIcacheSection(u8 *start, u8 *end);
u8 *GetWritableCodePtr();
+ void FlushLitPool();
+ void AddNewLit(u32 val);
+
+ CCFlags GetCC() { return CCFlags(condition >> 28); }
void SetCC(CCFlags cond = CC_AL);
// Special purpose instructions
@@ -425,8 +444,10 @@ public:
void LSL (ARMReg dest, ARMReg src, ARMReg op2);
void LSLS(ARMReg dest, ARMReg src, Operand2 op2);
void LSLS(ARMReg dest, ARMReg src, ARMReg op2);
+ void LSR (ARMReg dest, ARMReg src, Operand2 op2);
void SBC (ARMReg dest, ARMReg src, Operand2 op2);
void SBCS(ARMReg dest, ARMReg src, Operand2 op2);
+ void RBIT(ARMReg dest, ARMReg src);
void REV (ARMReg dest, ARMReg src);
void REV16 (ARMReg dest, ARMReg src);
void RSC (ARMReg dest, ARMReg src, Operand2 op2);
@@ -457,33 +478,39 @@ public:
void UMULL(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
void SMULL(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
+ void UMLAL(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
+ void SMLAL(ARMReg destLo, ARMReg destHi, ARMReg rn, ARMReg rm);
+
void SXTB(ARMReg dest, ARMReg op2);
void SXTH(ARMReg dest, ARMReg op2, u8 rotation = 0);
void SXTAH(ARMReg dest, ARMReg src, ARMReg op2, u8 rotation = 0);
+ void BFI(ARMReg rd, ARMReg rn, u8 lsb, u8 width);
+ void UBFX(ARMReg dest, ARMReg op2, u8 lsb, u8 width);
+ void CLZ(ARMReg rd, ARMReg rm);
+
// Using just MSR here messes with our defines on the PPC side of stuff (when this code was in dolphin...)
// Just need to put an underscore here, bit annoying.
void _MSR (bool nzcvq, bool g, Operand2 op2);
- void _MSR (bool nzcvq, bool g, ARMReg src );
+ void _MSR (bool nzcvq, bool g, ARMReg src);
void MRS (ARMReg dest);
// Memory load/store operations
- void LDR (ARMReg dest, ARMReg src, Operand2 op2 = 0);
- // Offset adds to the base register in LDR
- void LDR (ARMReg dest, ARMReg base, ARMReg offset, bool Index, bool Add);
- void LDRH(ARMReg dest, ARMReg src, Operand2 op = 0);
- void LDRB(ARMReg dest, ARMReg src, Operand2 op2 = 0);
- void STR (ARMReg dest, ARMReg src, Operand2 op2 = 0);
- // Offset adds on to the destination register in STR
- void STR (ARMReg dest, ARMReg base, ARMReg offset, bool Index, bool Add);
+ void LDR (ARMReg dest, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void LDRB (ARMReg dest, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void LDRH (ARMReg dest, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void LDRSB(ARMReg dest, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void LDRSH(ARMReg dest, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void STR (ARMReg result, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void STRB (ARMReg result, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
+ void STRH (ARMReg result, ARMReg base, Operand2 op2 = 0, bool RegAdd = true);
- void STRB(ARMReg dest, ARMReg src, Operand2 op2 = 0);
void STMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
void LDMFD(ARMReg dest, bool WriteBack, const int Regnum, ...);
// Exclusive Access operations
void LDREX(ARMReg dest, ARMReg base);
- // dest contains the result if the instruction managed to store the value
- void STREX(ARMReg dest, ARMReg base, ARMReg op);
+ // result contains the result if the instruction managed to store the value
+ void STREX(ARMReg result, ARMReg base, ARMReg op);
void DMB ();
void SVC(Operand2 op);
@@ -499,23 +526,39 @@ public:
void VSUB(IntegerSize Size, ARMReg Vd, ARMReg Vn, ARMReg Vm);
// VFP Only
- void VLDR(ARMReg Dest, ARMReg Base, Operand2 op);
- void VSTR(ARMReg Src, ARMReg Base, Operand2 op);
- void VCMP(ARMReg Vd, ARMReg Vm);
+ void VLDR(ARMReg Dest, ARMReg Base, u16 offset);
+ void VSTR(ARMReg Src, ARMReg Base, u16 offset);
+ void VCMP(ARMReg Vd, ARMReg Vm, bool E);
// Compares against zero
- void VCMP(ARMReg Vd);
+ void VCMP(ARMReg Vd, bool E);
void VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSQRT(ARMReg Vd, ARMReg Vm);
// NEON and VFP
void VADD(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSUB(ARMReg Vd, ARMReg Vn, ARMReg Vm);
+ void VABS(ARMReg Vd, ARMReg Vm);
+ void VNEG(ARMReg Vd, ARMReg Vm);
+ void VMUL(ARMReg Vd, ARMReg Vn, ARMReg Vm);
+ void VMLA(ARMReg Vd, ARMReg Vn, ARMReg Vm);
+ void VMOV(ARMReg Dest, ARMReg Src, bool high);
void VMOV(ARMReg Dest, ARMReg Src);
+ void VCVT(ARMReg Dest, ARMReg Src, int flags);
+
+ void VMRS_APSR();
+ void VMRS(ARMReg Rt);
+ void VMSR(ARMReg Rt);
void QuickCallFunction(ARMReg scratchreg, void *func);
- // Utility functions
+
+ // Wrapper around MOVT/MOVW with fallbacks.
void MOVI2R(ARMReg reg, u32 val, bool optimize = true);
- void ARMABI_MOVI2M(Operand2 op, Operand2 val);
+ void MOVI2F(ARMReg dest, float val, ARMReg tempReg);
+
+ void ANDI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch);
+ void ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch);
+
+
}; // class ARMXEmitter
@@ -568,7 +611,11 @@ public:
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
void WriteProtect()
{
- WriteProtectMemory(region, region_size, true);
+ WriteProtectMemory(region, region_size, true);
+ }
+ void UnWriteProtect()
+ {
+ UnWriteProtectMemory(region, region_size, false);
}
void ResetCodePtr()
diff --git a/Common/ArmThunk.cpp b/Common/ArmThunk.cpp
index 98cee1683d..207676dca5 100644
--- a/Common/ArmThunk.cpp
+++ b/Common/ArmThunk.cpp
@@ -52,4 +52,6 @@ void ThunkManager::Shutdown()
void *ThunkManager::ProtectFunction(void *function, int num_params)
{
+ _dbg_assert_msg_(JIT, false, "Arm ThunkManager not implemented? Will crash.");
+ return NULL;
}
diff --git a/Common/CPUDetect.cpp b/Common/CPUDetect.cpp
index c43c7fc5d7..62176d6c17 100644
--- a/Common/CPUDetect.cpp
+++ b/Common/CPUDetect.cpp
@@ -29,14 +29,14 @@
#undef _interlockedbittestandreset64
#else
-#ifndef _M_GENERIC
+#if !defined(_M_GENERIC) && !defined(MIPS)
#include
#endif
#if defined __FreeBSD__
#include
#include
-#else
+#elif !defined(MIPS)
static inline void do_cpuid(unsigned int *eax, unsigned int *ebx,
unsigned int *ecx, unsigned int *edx)
{
diff --git a/Common/Common.h b/Common/Common.h
index d87443e3f9..16b0fd342f 100644
--- a/Common/Common.h
+++ b/Common/Common.h
@@ -25,6 +25,10 @@
#include
#include
+#ifdef _MSC_VER
+#pragma warning (disable:4100)
+#endif
+
#if defined(ARM)
#define _M_ARM32
#endif
@@ -77,7 +81,9 @@ private:
#error needs at least version 1000 of MSC
#endif
+#ifndef NOMINMAX
#define NOMINMAX
+#endif
// Memory leak checks
#define CHECK_HEAP_INTEGRITY()
diff --git a/Common/CommonFuncs.h b/Common/CommonFuncs.h
index e256aab5dd..89631e5e74 100644
--- a/Common/CommonFuncs.h
+++ b/Common/CommonFuncs.h
@@ -24,7 +24,7 @@
#define SLEEP(x) usleep(x*1000)
#endif
-#ifdef IOS
+#if defined(IOS) || defined(MIPS)
#include
#endif
@@ -51,8 +51,8 @@ template<> struct CompileTimeAssert {};
#ifdef GEKKO
#define Crash()
#else
-// Assume !ARM = x86
-#if !defined(ARM)
+// Assume !ARM && !MIPS = x86
+#if !defined(ARM) && !defined(MIPS)
#define Crash() {asm ("int $3");}
#else
#define Crash() {kill( getpid(), SIGINT ) ; }
diff --git a/Common/Crypto/aes.h b/Common/Crypto/aes.h
index 8d5059e1be..c3006a775c 100644
--- a/Common/Crypto/aes.h
+++ b/Common/Crypto/aes.h
@@ -89,9 +89,9 @@ int AES_set_encrypt_key(const unsigned char* userKey, const int bits,
int AES_set_decrypt_key(const unsigned char* userKey, const int bits,
AES_KEY* key);
-void AES_encrypt(const unsigned char* in, unsigned char* out,
+void AES_encrypt1(const unsigned char* in, unsigned char* out,
const AES_KEY* key);
-void AES_decrypt(const unsigned char* in, unsigned char* out,
+void AES_decrypt1(const unsigned char* in, unsigned char* out,
const AES_KEY* key);
void AES_ecb_encrypt(const unsigned char* in, unsigned char* out,
diff --git a/Common/Crypto/aes_cbc.cpp b/Common/Crypto/aes_cbc.cpp
index 780c35a88d..954878a5bb 100644
--- a/Common/Crypto/aes_cbc.cpp
+++ b/Common/Crypto/aes_cbc.cpp
@@ -75,7 +75,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
while (len >= AES_BLOCK_SIZE) {
for(n=0; n < AES_BLOCK_SIZE; ++n)
out[n] = in[n] ^ iv[n];
- AES_encrypt(out, out, key);
+ AES_encrypt1(out, out, key);
iv = out;
len -= AES_BLOCK_SIZE;
in += AES_BLOCK_SIZE;
@@ -86,13 +86,13 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
out[n] = in[n] ^ iv[n];
for(n=len; n < AES_BLOCK_SIZE; ++n)
out[n] = iv[n];
- AES_encrypt(out, out, key);
+ AES_encrypt1(out, out, key);
iv = out;
}
memcpy(ivec,iv,AES_BLOCK_SIZE);
} else if (in != out) {
while (len >= AES_BLOCK_SIZE) {
- AES_decrypt(in, out, key);
+ AES_decrypt1(in, out, key);
for(n=0; n < AES_BLOCK_SIZE; ++n)
out[n] ^= iv[n];
iv = in;
@@ -101,7 +101,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
out += AES_BLOCK_SIZE;
}
if (len) {
- AES_decrypt(in,tmp,key);
+ AES_decrypt1(in,tmp,key);
for(n=0; n < len; ++n)
out[n] = tmp[n] ^ iv[n];
iv = in;
@@ -110,7 +110,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
} else {
while (len >= AES_BLOCK_SIZE) {
memcpy(tmp, in, AES_BLOCK_SIZE);
- AES_decrypt(in, out, key);
+ AES_decrypt1(in, out, key);
for(n=0; n < AES_BLOCK_SIZE; ++n)
out[n] ^= ivec[n];
memcpy(ivec, tmp, AES_BLOCK_SIZE);
@@ -120,7 +120,7 @@ void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
}
if (len) {
memcpy(tmp, in, AES_BLOCK_SIZE);
- AES_decrypt(tmp, out, key);
+ AES_decrypt1(tmp, out, key);
for(n=0; n < len; ++n)
out[n] ^= ivec[n];
for(n=len; n < AES_BLOCK_SIZE; ++n)
diff --git a/Common/Crypto/aes_core.cpp b/Common/Crypto/aes_core.cpp
index ad54bc6006..2bce4429a9 100644
--- a/Common/Crypto/aes_core.cpp
+++ b/Common/Crypto/aes_core.cpp
@@ -778,7 +778,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
* Encrypt a single block
* in and out can overlap
*/
-void AES_encrypt(const unsigned char *in, unsigned char *out,
+void AES_encrypt1(const unsigned char *in, unsigned char *out,
const AES_KEY *key) {
const u32 *rk;
@@ -969,7 +969,7 @@ void AES_encrypt(const unsigned char *in, unsigned char *out,
* Decrypt a single block
* in and out can overlap
*/
-void AES_decrypt(const unsigned char *in, unsigned char *out,
+void AES_decrypt1(const unsigned char *in, unsigned char *out,
const AES_KEY *key) {
const u32 *rk;
diff --git a/Common/Log.h b/Common/Log.h
index b027fc2962..c01835df7d 100644
--- a/Common/Log.h
+++ b/Common/Log.h
@@ -22,6 +22,7 @@
#define WARNING_LEVEL 3 // Something is suspicious.
#define INFO_LEVEL 4 // General information.
#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
+#define VERBOSE_LEVEL 6 // Noisy debugging - sometimes needed but usually unimportant.
#if !defined(_WIN32) && !defined(PANDORA)
#include
@@ -64,6 +65,7 @@ enum LOG_LEVELS {
LWARNING = WARNING_LEVEL,
LINFO = INFO_LEVEL,
LDEBUG = DEBUG_LEVEL,
+ LVERBOSE = VERBOSE_LEVEL,
};
#define LOGTYPES_LEVELS LogTypes::LOG_LEVELS
@@ -92,11 +94,12 @@ void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
}
-#define ERROR_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) }
-#define WARN_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) }
-#define NOTICE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) }
-#define INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) }
-#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) }
+#define ERROR_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) }
+#define WARN_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) }
+#define NOTICE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) }
+#define INFO_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) }
+#define DEBUG_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) }
+#define VERBOSE_LOG(t,...) { GENERIC_LOG(LogTypes::t, LogTypes::LVERBOSE, __VA_ARGS__) }
#if MAX_LOGLEVEL >= DEBUG_LEVEL
#define _dbg_assert_(_t_, _a_) \
diff --git a/Common/LogManager.cpp b/Common/LogManager.cpp
index 69d0b3ce01..421a37c1d2 100644
--- a/Common/LogManager.cpp
+++ b/Common/LogManager.cpp
@@ -26,9 +26,12 @@
#include
#endif
+// Don't need to savestate this.
+const char *hleCurrentThreadName = NULL;
+
// Unfortunately this is quite slow.
-// #define LOG_MSC_OUTPUTDEBUG true
#define LOG_MSC_OUTPUTDEBUG false
+// #define LOG_MSC_OUTPUTDEBUG true
void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
const char *file, int line, const char* fmt, ...)
@@ -165,15 +168,42 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const
if (!log || !log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
return;
- static const char level_to_char[7] = "-NEWID";
+ static const char level_to_char[8] = "-NEWIDV";
char formattedTime[13];
Common::Timer::GetTimeFormatted(formattedTime);
+#ifdef _DEBUG
+#ifdef _WIN32
+ static const char sep = '\\';
+#else
+ static const char sep = '/';
+#endif
+ const char *fileshort = strrchr(file, sep);
+ if (fileshort != NULL) {
+ do
+ --fileshort;
+ while (fileshort > file && *fileshort != sep);
+ if (fileshort != file)
+ file = fileshort + 1;
+ }
+#endif
+
char *msgPos = msg;
- msgPos += sprintf(msgPos, "%s %s:%d %c[%s]: ",
- formattedTime,
- file, line, level_to_char[(int)level],
- log->GetShortName());
+ if (hleCurrentThreadName != NULL)
+ {
+ msgPos += sprintf(msgPos, "%s %-12.12s %c[%s]: %s:%d ",
+ formattedTime,
+ hleCurrentThreadName, level_to_char[(int)level],
+ log->GetShortName(),
+ file, line);
+ }
+ else
+ {
+ msgPos += sprintf(msgPos, "%s %s:%d %c[%s]: ",
+ formattedTime,
+ file, line, level_to_char[(int)level],
+ log->GetShortName());
+ }
msgPos += vsnprintf(msgPos, MAX_MSGLEN, format, args);
// This will include the null terminator.
diff --git a/Common/LogManager.h b/Common/LogManager.h
index 20b9130c47..faf94f798a 100644
--- a/Common/LogManager.h
+++ b/Common/LogManager.h
@@ -30,6 +30,7 @@
#define MAX_MESSAGES 8000
#define MAX_MSGLEN 1024
+extern const char *hleCurrentThreadName;
// pure virtual interface
class LogListener
diff --git a/Common/MathUtil.h b/Common/MathUtil.h
index 99e6d77a5c..1f594e4a6a 100644
--- a/Common/MathUtil.h
+++ b/Common/MathUtil.h
@@ -20,7 +20,7 @@
#include "Common.h"
-#ifndef ARM
+#if !defined(ARM) && !defined(MIPS)
#define USE_SSE
#endif
diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp
index a7119b307c..d474ed633e 100644
--- a/Common/MemoryUtil.cpp
+++ b/Common/MemoryUtil.cpp
@@ -86,7 +86,7 @@ void* AllocateExecutableMemory(size_t size, bool low)
if (low && (!map_hint))
map_hint = (char*)round_page(512*1024*1024); /* 0.5 GB rounded up to the next page */
#endif
- void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
+ void* ptr = mmap(map_hint, size, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANON | MAP_PRIVATE
#if defined(__x86_64__) && defined(MAP_32BIT)
| (low ? MAP_32BIT : 0)
diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt
index 3706931498..982b314f03 100644
--- a/Core/CMakeLists.txt
+++ b/Core/CMakeLists.txt
@@ -21,6 +21,7 @@ set(SRCS
ELF/ElfReader.cpp
ELF/ParamSFO.cpp
ELF/PrxDecrypter.cpp
+ Font/PGF.cpp
HLE/HLE.cpp
HLE/HLETables.cpp
HLE/sceAtrac.cpp
@@ -51,6 +52,7 @@ set(SRCS
HLE/sceKernelVTimer.cpp
HLE/sceMpeg.cpp
HLE/sceNet.cpp
+ HLE/sceP3da.cpp
HLE/scePower.cpp
HLE/scePsmf.cpp
HLE/sceRtc.cpp
@@ -84,6 +86,7 @@ set(SRCS
PSPMixer.cpp
System.cpp
Core.cpp
+ ../git-version.cpp
)
if(ARM)
@@ -114,6 +117,17 @@ add_library(core STATIC ${SRCS})
target_link_libraries(core general common)
target_link_libraries(core general base)
+# Generate git-version.cpp at build time.
+add_custom_target(GitVersion ALL
+ DEPENDS something_that_never_exists)
+add_custom_command(OUTPUT something_that_never_exists
+ COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}/..
+ -P ${CMAKE_CURRENT_SOURCE_DIR}/../git-version.cmake)
+
+set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../git-version.cpp
+ PROPERTIES GENERATED TRUE)
+add_dependencies(core GitVersion)
+
if(UNIX)
add_definitions(-fPIC)
add_definitions(-std=gnu++0x)
diff --git a/Core/Config.cpp b/Core/Config.cpp
index 1352c3fb0c..f3bdc009c3 100644
--- a/Core/Config.cpp
+++ b/Core/Config.cpp
@@ -54,6 +54,8 @@ void CConfig::Load(const char *iniFileName)
general->Get("IgnoreBadMemAccess", &bIgnoreBadMemAccess, true);
general->Get("CurrentDirectory", ¤tDirectory, "");
general->Get("ShowDebuggerOnLoad", &bShowDebuggerOnLoad, false);
+ // "default" means let emulator decide, "" means disable.
+ general->Get("ReportHost", &sReportHost, "default");
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Get("Jit", &bJit, true);
@@ -70,12 +72,12 @@ void CConfig::Load(const char *iniFileName)
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("FrameSkip", &iFrameSkip, 0);
+ graphics->Get("UseMediaEngine", &bUseMediaEngine, true);
#ifdef USING_GLES2
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 0);
#else
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 8);
#endif
- graphics->Get("DisableG3DLog", &bDisableG3DLog, false);
graphics->Get("VertexCache", &bVertexCache, true);
graphics->Get("FullScreen", &bFullScreen, false);
graphics->Get("StretchToDisplay", &bStretchToDisplay, false);
@@ -94,6 +96,7 @@ void CConfig::Load(const char *iniFileName)
#endif
control->Get("LargeControls", &bLargeControls, false);
control->Get("KeyMapping",iMappingMap);
+ control->Get("AccelerometerToAnalogHoriz", &bAccelerometerToAnalogHoriz, false);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Get("Language", &ilanguage, PSP_SYSTEMPARAM_LANGUAGE_ENGLISH);
@@ -121,6 +124,8 @@ void CConfig::Save()
general->Set("IgnoreBadMemAccess", bIgnoreBadMemAccess);
general->Set("CurrentDirectory", currentDirectory);
general->Set("ShowDebuggerOnLoad", bShowDebuggerOnLoad);
+ general->Set("ReportHost", sReportHost);
+
IniFile::Section *cpu = iniFile.GetOrCreateSection("CPU");
cpu->Set("Jit", bJit);
cpu->Set("FastMemory", bFastMemory);
@@ -135,8 +140,8 @@ void CConfig::Save()
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("FrameSkip", iFrameSkip);
+ graphics->Set("UseMediaEngine", bUseMediaEngine);
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
- graphics->Set("DisableG3DLog", bDisableG3DLog);
graphics->Set("VertexCache", bVertexCache);
graphics->Set("FullScreen", bFullScreen);
graphics->Set("StretchToDisplay", bStretchToDisplay);
@@ -150,6 +155,7 @@ void CConfig::Save()
control->Set("ShowTouchControls", bShowTouchControls);
control->Set("LargeControls", bLargeControls);
control->Set("KeyMapping",iMappingMap);
+ control->Set("AccelerometerToAnalogHoriz", bAccelerometerToAnalogHoriz);
IniFile::Section *pspConfig = iniFile.GetOrCreateSection("SystemParam");
pspConfig->Set("Language", ilanguage);
diff --git a/Core/Config.h b/Core/Config.h
index 842a93b10c..214addab08 100644
--- a/Core/Config.h
+++ b/Core/Config.h
@@ -20,8 +20,7 @@
#include
#include