From 219b311e40ab543dda42a3c08baf8a9c4c325c15 Mon Sep 17 00:00:00 2001 From: Ash Logan Date: Mon, 19 Dec 2022 23:25:26 +1100 Subject: [PATCH] Add LaunchHomebrewWrapperEx Add library call to pass arguments between different homebrew apps, which is something that RetroArch needs to pass the content path to cores. --- include/mocha/mocha.h | 17 ++++++++++++++++- source/utils.cpp | 8 ++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/mocha/mocha.h b/include/mocha/mocha.h index 66b96f8..da99d2e 100644 --- a/include/mocha/mocha.h +++ b/include/mocha/mocha.h @@ -4,6 +4,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -215,6 +216,20 @@ MochaUtilsStatus Mocha_PrepareRPXLaunch(MochaRPXLoadInfo *loadInfo); */ MochaUtilsStatus Mocha_LaunchHomebrewWrapper(); +/** + * Launches the wrapper app for launching .rpx, with custom SYS args.
+ * To launch a RPX call `Mocha_PrepareRPXLaunch` before this function.
+ *
+ * see: `Mocha_LaunchRPX` to prepare and launch a RPX in one command. + * + * @param args sysapp args to pass to the homebrew app. + * @return MOCHA_RESULT_SUCCESS: App is launching
+ * MOCHA_RESULT_LIB_UNINITIALIZED: Library was not initialized. Call Mocha_InitLibrary() before using this function.
+ * MOCHA_RESULT_UNSUPPORTED_COMMAND: Command not supported by the currently loaded mocha version.
+ * MOCHA_RESULT_NOT_FOUND: Not application that can be used as homebrew wrapper found. + */ +MochaUtilsStatus Mocha_LaunchHomebrewWrapperEx(SYSStandardArgsIn *args); + /** * Launches a given RPX by launching a wrapper application and replacing the RPX on the fly.
* See Mocha_PrepareRPXLaunch for more information.
@@ -289,4 +304,4 @@ MochaUtilsStatus Mocha_UnmountFS(const char *virt_name); #ifdef __cplusplus } // extern "C" -#endif \ No newline at end of file +#endif diff --git a/source/utils.cpp b/source/utils.cpp index c848d3e..a9cbf3d 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -420,7 +420,7 @@ MochaUtilsStatus Mocha_LaunchRPX(MochaRPXLoadInfo *loadInfo) { return res; } -MochaUtilsStatus Mocha_LaunchHomebrewWrapper() { +MochaUtilsStatus Mocha_LaunchHomebrewWrapperEx(SYSStandardArgsIn *args) { if (!mochaInitDone) { return MOCHA_RESULT_LIB_UNINITIALIZED; } @@ -435,11 +435,15 @@ MochaUtilsStatus Mocha_LaunchHomebrewWrapper() { return MOCHA_RESULT_NOT_FOUND; } - _SYSLaunchTitleWithStdArgsInNoSplash(titleID, nullptr); + _SYSLaunchTitleWithStdArgsInNoSplash(titleID, args); return MOCHA_RESULT_SUCCESS; } +MochaUtilsStatus Mocha_LaunchHomebrewWrapper() { + return Mocha_LaunchHomebrewWrapperEx(nullptr); +} + MochaUtilsStatus Mocha_ODMGetDiscKey(WUDDiscKey *discKey) { if (!mochaInitDone) { return MOCHA_RESULT_LIB_UNINITIALIZED;