foxygit / fake-08-xbox360 Log in
commit 6c8212eca701b5137f849e33d26247571f872b3d
Author:     jtothebell <j.to.the.bell@gmail.com>
AuthorDate: Mon Jul 5 08:19:32 2021 -0600
Commit:     jtothebell <j.to.the.bell@gmail.com>
CommitDate: Mon Jul 5 08:19:32 2021 -0600

    Get cart arg from app params on vita
---
 source/main.cpp | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/source/main.cpp b/source/main.cpp
index 162badf..1ac1420 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -10,6 +10,10 @@
 #include "host.h"
 #include "hostVmShared.h"

+#if __VITA__
+#include <vitasdk.h>
+#endif
+


 int main(int argc, char* argv[])
@@ -30,9 +34,26 @@ int main(int argc, char* argv[])

 	vm->SetCartList(host->listcarts());

+	bool loadCart = false;
+	char* cart;
+	char boot_params[1024];
+
+	#if __VITA__
+	sceAppMgrGetAppParam(boot_params);
+	if (strstr(boot_params,"psgm:play") && strstr(boot_params, "&param=")) {
+		loadCart = true;
+		cart = strstr(boot_params, "&param=") + 7;
+	}
+	#else
+	if (argc > 1) {
+		cart = argv[1];
+		loadCart = true;
+	}
+	#endif
+
 	Logger_Write("Loading Bios cart\n");
-	if (argc > 1){
-		vm->LoadCart(argv[1]);
+	if (loadCart){
+		vm->LoadCart(cart);
 	}
 	else {
 		vm->LoadBiosCart();