diff --git a/data/wfstub.bin b/data/wfstub.bin new file mode 100644 index 00000000..28710afb Binary files /dev/null and b/data/wfstub.bin differ diff --git a/source/defines.h b/source/defines.h index 36220b04..2813e22e 100644 --- a/source/defines.h +++ b/source/defines.h @@ -1,10 +1,16 @@ +#include "loader/sys.h" + #define APP_NAME "WiiFlow Lite" #define APP_VERSION "4.5.0" #define SVN_REV "1162" #define APP_DATA_DIR "wiiflow" +#ifdef APP_WIIFLOW +#define APPS_DIR "apps/wiiflow" +#else #define APPS_DIR "apps/wiiflow_lite" +#endif //#define EMU_NANDS_DIR "nands" #define GAMES_DIR "%s:/wbfs" diff --git a/source/homebrew/homebrew.cpp b/source/homebrew/homebrew.cpp index f3cd6a72..e9d3c2a4 100644 --- a/source/homebrew/homebrew.cpp +++ b/source/homebrew/homebrew.cpp @@ -7,6 +7,7 @@ #include #include #include "homebrew.h" +#include "loader/sys.h" #include "banner/AnimatedBanner.h" #include "fileOps/fileOps.h" #include "gecko/gecko.hpp" @@ -26,8 +27,13 @@ u8 *appbooter_ptr = NULL; u32 appbooter_size = 0; using namespace std; +#ifdef APP_WIIFLOW +extern const u8 wfstub_bin[]; +extern const u32 wfstub_bin_size; +#else extern const u8 stub_bin[]; extern const u32 stub_bin_size; +#endif u8 valid = 0; @@ -136,7 +142,11 @@ void writeStub() /* Extract our stub */ u32 StubSize = 0; +#ifdef APP_WIIFLOW + u8 *Stub = DecompressCopy(wfstub_bin, wfstub_bin_size, &StubSize); +#else u8 *Stub = DecompressCopy(stub_bin, stub_bin_size, &StubSize); +#endif /* Copy our own stub into memory */ memcpy((void*)0x80001800, Stub, StubSize); diff --git a/source/loader/sys.h b/source/loader/sys.h index 2501f7e4..e6fefd94 100644 --- a/source/loader/sys.h +++ b/source/loader/sys.h @@ -2,6 +2,8 @@ #ifndef _SYS_H_ #define _SYS_H_ +//#define APP_WIIFLOW + #include "utils.h" #ifdef __cplusplus diff --git a/source/menu/menu.cpp b/source/menu/menu.cpp index b36208e5..58563725 100644 --- a/source/menu/menu.cpp +++ b/source/menu/menu.cpp @@ -385,8 +385,13 @@ bool CMenu::init() m_locked = m_cfg.getString("GENERAL", "parent_code", "").size() >= 4; /* Switch the WFLA and DWFA when using official wiiflow */ +#ifdef APP_WIIFLOW + if(m_cfg.getString("GENERAL", "returnto", "DWFA") == "WFLA") + m_cfg.setString("GENERAL", "returnto", "DWFA"); +#else if(m_cfg.getString("GENERAL", "returnto", "WFLA") == "DWFA") m_cfg.setString("GENERAL", "returnto", "WFLA"); +#endif /* set WIIFLOW_DEF exit to option */ /* 0 thru 2 of exit to enum (EXIT_TO_MENU, EXIT_TO_HBC, EXIT_TO_WIIU) in sys.h */ diff --git a/source/menu/menu_home.cpp b/source/menu/menu_home.cpp index 1d1e3cbe..9679db73 100644 --- a/source/menu/menu_home.cpp +++ b/source/menu/menu_home.cpp @@ -225,9 +225,11 @@ bool CMenu::_ExitTo(void) } else { - //if(m_cfg.getBool("NEEK2O", "launchwiiflow", true)) - // exitHandler(EXIT_TO_WFNK2O); - //else +#ifdef APP_WIIFLOW + if(m_cfg.getBool("NEEK2O", "launchwiiflow", true)) + exitHandler(EXIT_TO_WFNK2O); + else +#endif exitHandler(EXIT_TO_SMNK2O); /* if exiting to Neek2o we must set the EmuNand Path for sys_exit() in sys.c */ const char *EmuNandPath = NULL;