From 143cb7e941e2baeeb96d730f4a5f42e5357cdf99 Mon Sep 17 00:00:00 2001 From: Fledge68 Date: Sat, 3 Nov 2018 12:10:34 -0500 Subject: [PATCH] -now using compiler directives to make it easy to compile wiiflow lite or wfl_as wiiiflow. just uncomment line 5 in sys.h to compile as wfl as wiiflow. --- data/wfstub.bin | Bin 0 -> 4044 bytes source/defines.h | 6 ++++++ source/homebrew/homebrew.cpp | 10 ++++++++++ source/loader/sys.h | 2 ++ source/menu/menu.cpp | 5 +++++ source/menu/menu_home.cpp | 8 +++++--- 6 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 data/wfstub.bin diff --git a/data/wfstub.bin b/data/wfstub.bin new file mode 100644 index 0000000000000000000000000000000000000000..28710afbdf5e3ce58779113d02e9fe988f2b02ae GIT binary patch literal 4044 zcmb7HZ)_9i8Gp_;iIXOq+j+>408WWyn`8>xGRb{kUp0L#YOf~rcH$OlRiZolX5 z>{u?W%+gQq-E+^s_xbm}ju5$i6y38U((&ALgrATp7mYbyh-S*(5t>xrO;Te>)<{-7 zk*Gqm;)p%RJVA}N3&pF7m+iT3qF6|#$7Q7|Ci<80E;R-j4k25vT<=1Fl!_9dHBd0S~Yds0B8^V(1Q$MuMbsLIP}n9dH2afHI&QZ~_%TCGZ$f z1yloH1HLYuGklcE7Sgb{%obf7g6%9Y1e{5mb`%$dGA+FR z5y-q=BJ(nMU$^{~M@S4T=gc^6IF^s0tRRL~{31lVBP4BzQ1uYj!zQoqeZ-kU)9~@F zMoqlw?*ZQ*&2P=L_U&D=zRg6a>Hv5s$dCcZ2d9BKV1cNG051>*WIzMvfCZwb2=D@7 zKn65m8khqXh*}Bo0%1S~G+-K-0~X+?7k<{gOTjvQB`Xn~s?+}*3KPjYG-?B1-`g7f zP$O?NSDuQ#wKyA8^c68<&z(w>V+ZLg{xYJD5pqqWNoxL+u7^kTyUZ_~wjA_1pl@;f zpHwCK@8zPh!|Nxa@CZ2(uX&61(={4h5kt&JWYMa?cQrz`4VpymH1q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CujyjgLWZnxw2LG{~A+5Jl&UAAA;+D*$ zr4MuKKK^$Z|5XY#!}k)7cS~o@31bb^^d~ENc4MB`8?$&<%}Y%03p}PLE9|+Gl_X78 zki_?G_D#{NthZ_b7f|D$I@Idc_f`?>*3$IOq>l!WBxqG_Y6MAMZPOxZj{O i#p1tciVskHU~l4JV$h)Bd4J#GgUY_a#Nht8DfnLvepr?O literal 0 HcmV?d00001 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;