diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index c58fe96446..0ef1a7f392 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -120,6 +120,7 @@
+
@@ -246,6 +247,7 @@
+
@@ -357,4 +359,4 @@
-
+
\ No newline at end of file
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index 160903d172..22eb1f25cd 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -282,6 +282,9 @@
Core
+
+ ELF
+
@@ -515,6 +518,9 @@
Core
+
+ ELF
+
diff --git a/Core/ELF/PrxDecrypter.cpp b/Core/ELF/PrxDecrypter.cpp
index 0767e787e1..ed7a0f3ab3 100644
--- a/Core/ELF/PrxDecrypter.cpp
+++ b/Core/ELF/PrxDecrypter.cpp
@@ -297,7 +297,11 @@ static TAG_INFO const* GetTagInfo(u32 tagFind)
static void ExtraV2Mangle(u8* buffer1, u8 codeExtra)
{
+#ifdef _MSC_VER
+ static u8 __declspec(align(64)) g_dataTmp[20+0xA0];
+#else
static u8 g_dataTmp[20+0xA0] __attribute__((aligned(0x40)));
+#endif
u8* buffer2 = g_dataTmp; // aligned
memcpy(buffer2+20, buffer1, 0xA0);
diff --git a/Core/ELF/PrxDecrypter.h b/Core/ELF/PrxDecrypter.h
index 0e38ff02a7..19f41dc8a7 100644
--- a/Core/ELF/PrxDecrypter.h
+++ b/Core/ELF/PrxDecrypter.h
@@ -19,6 +19,9 @@
#include "../../Globals.h"
+#ifdef _MSC_VER
+#pragma pack(push, 1)
+#endif
typedef struct
{
u32 signature; // 0
@@ -50,7 +53,15 @@ typedef struct
u32 key_data2; // 12C
u32 oe_tag; // 130
u8 key_data3[0x1C]; // 134
+#ifdef _MSC_VER
+} PSP_Header;
+#else
} __attribute__((packed)) PSP_Header;
+#endif
+
+#ifdef _MSC_VER
+#pragma pack(pop)
+#endif
int pspDecryptPRX(const u8 *inbuf, u8 *outbuf, u32 size);
diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp
index 86453deab5..871fb9cf05 100644
--- a/Core/HLE/sceKernelModule.cpp
+++ b/Core/HLE/sceKernelModule.cpp
@@ -16,6 +16,8 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include
+#include
+
#include "HLE.h"
#include "Common/FileUtil.h"
@@ -143,20 +145,20 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
u8 *newptr = 0;
if (*(u32*)ptr == 0x5053507e) { // "~PSP"
- // Decrypt module! YAY!
- INFO_LOG(HLE, "Decrypting ~PSP file");
- PSP_Header *head = (PSP_Header*)ptr;
- const u8 *in = ptr;
- newptr = new u8[head->elf_size + 0x40];
- ptr = (u8*)(((size_t)newptr & ~0x3C) + 0x40);
- pspDecryptPRX(in, (u8*)ptr, head->psp_size);
+ // Decrypt module! YAY!
+ INFO_LOG(HLE, "Decrypting ~PSP file");
+ PSP_Header *head = (PSP_Header*)ptr;
+ const u8 *in = ptr;
+ newptr = new u8[std::max(head->elf_size, head->psp_size) + 0x40];
+ ptr = (u8*)(((size_t)(newptr + 0x3F) & ~0x3F));
+ pspDecryptPRX(in, (u8*)ptr, head->psp_size);
}
if (*(u32*)ptr != 0x464c457f)
{
ERROR_LOG(HLE, "Wrong magic number %08x",*(u32*)ptr);
*error_string = "File corrupt";
- delete newptr;
+ delete [] newptr;
kernelObjects.Destroy(module->GetUID());
return 0;
}
@@ -166,7 +168,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
if (!reader.LoadInto(loadAddress))
{
ERROR_LOG(HLE, "LoadInto failed");
- delete newptr;
+ delete [] newptr;
kernelObjects.Destroy(module->GetUID());
return 0;
}
@@ -341,7 +343,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
module->entry_addr = reader.GetEntryPoint();
- delete newptr;
+ delete [] newptr;
return module;
}
diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp
index fbdfa2914e..b6738aa05e 100644
--- a/Core/MemMap.cpp
+++ b/Core/MemMap.cpp
@@ -149,7 +149,7 @@ void Memset(const u32 _Address, const u8 _iValue, const u32 _iLength)
else
{
for (size_t i = 0; i < _iLength; i++)
- Write_U8(_iValue, _Address + i);
+ Write_U8(_iValue, (u32)(_Address + i));
}
}
diff --git a/Windows/PPSSPP.sln b/Windows/PPSSPP.sln
index 5d18f942e8..2647de4ef7 100644
--- a/Windows/PPSSPP.sln
+++ b/Windows/PPSSPP.sln
@@ -1,5 +1,5 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPSSPPWindows", "PPSSPP.vcxproj", "{567AF8DB-42C1-4D08-96CD-D70A2DFEFC6B}"
ProjectSection(ProjectDependencies) = postProject
{E8B58922-9827-493D-81E0-4B6E6BD77171} = {E8B58922-9827-493D-81E0-4B6E6BD77171}
@@ -29,6 +29,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "native", "..\native\native.
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PPSSPPHeadless", "..\headless\Headless.vcxproj", "{EE9BD869-CAA3-447D-8328-294D90DE2C1F}"
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libkirk", "..\ext\libkirk\libkirk.vcxproj", "{3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@@ -123,6 +125,18 @@ Global
{EE9BD869-CAA3-447D-8328-294D90DE2C1F}.Release|Win32.Build.0 = Release|Win32
{EE9BD869-CAA3-447D-8328-294D90DE2C1F}.Release|x64.ActiveCfg = Release|x64
{EE9BD869-CAA3-447D-8328-294D90DE2C1F}.Release|x64.Build.0 = Release|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Debug|Win32.ActiveCfg = Debug|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Debug|Win32.Build.0 = Debug|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Debug|x64.ActiveCfg = Debug|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Debug|x64.Build.0 = Debug|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.DebugFast|Win32.ActiveCfg = Debug|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.DebugFast|Win32.Build.0 = Debug|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.DebugFast|x64.ActiveCfg = Debug|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.DebugFast|x64.Build.0 = Debug|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Release|Win32.ActiveCfg = Release|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Release|Win32.Build.0 = Release|Win32
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Release|x64.ActiveCfg = Release|x64
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Windows/PPSSPP.vcxproj b/Windows/PPSSPP.vcxproj
index 592b057dfa..4a9074e9de 100644
--- a/Windows/PPSSPP.vcxproj
+++ b/Windows/PPSSPP.vcxproj
@@ -437,6 +437,9 @@
{533f1d30-d04d-47cc-ad71-20f658907e36}
+
+ {3baae095-e0ab-4b0e-b5df-ce39c8ae31de}
+
{457f45d2-556f-47bc-a31d-aff0d15beaed}
@@ -455,4 +458,4 @@
-
+
\ No newline at end of file
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
index f94cdb3161..0284d25f08 100644
--- a/android/jni/Android.mk
+++ b/android/jni/Android.mk
@@ -48,6 +48,11 @@ LOCAL_SRC_FILES := \
GamepadEmu.cpp \
ui_atlas.cpp \
$(SRC)/native/android/app-android.cpp \
+ $(SRC)/ext/libkirk/AES.c \
+ $(SRC)/ext/libkirk/SHA1.c \
+ $(SRC)/ext/libkirk/bn.c \
+ $(SRC)/ext/libkirk/ec.c \
+ $(SRC)/ext/libkirk/kirk_engine.c \
$(SRC)/Globals.cpp \
$(SRC)/Common/ArmABI.cpp \
$(SRC)/Common/ArmEmitter.cpp \
@@ -72,6 +77,7 @@ LOCAL_SRC_FILES := \
$(SRC)/GPU/GLES/VertexShaderGenerator.cpp \
$(SRC)/GPU/GLES/FragmentShaderGenerator.cpp \
$(SRC)/Core/ELF/ElfReader.cpp \
+ $(SRC)/Core/ELF/PrxDecrypter.cpp \
$(SRC)/Core/Core.cpp \
$(SRC)/Core/Config.cpp \
$(SRC)/Core/CoreTiming.cpp \
diff --git a/ext/libkirk/libkirk.vcxproj b/ext/libkirk/libkirk.vcxproj
new file mode 100644
index 0000000000..03cc26bc5c
--- /dev/null
+++ b/ext/libkirk/libkirk.vcxproj
@@ -0,0 +1,132 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+
+ {3BAAE095-E0AB-4B0E-B5DF-CE39C8AE31DE}
+ libkirk
+
+
+
+ StaticLibrary
+ true
+ v100
+ MultiByte
+
+
+ StaticLibrary
+ true
+ v100
+ MultiByte
+
+
+ StaticLibrary
+ false
+ v100
+ true
+ MultiByte
+
+
+ StaticLibrary
+ false
+ v100
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Level3
+ Disabled
+ Default
+
+
+ true
+
+
+
+
+ Level3
+ Disabled
+
+
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+
+
+ true
+ true
+ true
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+
+
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ext/libkirk/libkirk.vcxproj.filters b/ext/libkirk/libkirk.vcxproj.filters
new file mode 100644
index 0000000000..b43b401d6d
--- /dev/null
+++ b/ext/libkirk/libkirk.vcxproj.filters
@@ -0,0 +1,48 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hpp;hxx;hm;inl;inc;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+
+
+
+
\ No newline at end of file
diff --git a/headless/Headless.vcxproj b/headless/Headless.vcxproj
index aae4a16163..083b005eb1 100644
--- a/headless/Headless.vcxproj
+++ b/headless/Headless.vcxproj
@@ -82,6 +82,7 @@
Disabled
WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
../Common;..;../Core;../native/ext/glew;
+ Default
Console
@@ -158,6 +159,9 @@
{533f1d30-d04d-47cc-ad71-20f658907e36}
+
+ {3baae095-e0ab-4b0e-b5df-ce39c8ae31de}
+
{457f45d2-556f-47bc-a31d-aff0d15beaed}
@@ -171,4 +175,4 @@
-
+
\ No newline at end of file
diff --git a/native b/native
index b80e99726b..8288c307cc 160000
--- a/native
+++ b/native
@@ -1 +1 @@
-Subproject commit b80e99726b5bda47f4a3165111295dc35337870d
+Subproject commit 8288c307cc896b40f9ad000db8f6b00c2b76ad0f