mirror of
https://github.com/wiiu-env/WiiUPluginSystem.git
synced 2024-12-25 01:21:57 +01:00
[Loader] Now show config GUI when entering Mii Maker
- Added for methods to the plugin loader.
This commit is contained in:
parent
41da4db58c
commit
869b3bc391
@ -56,8 +56,6 @@ void CallHook(wups_loader_hook_type_t hook_type);
|
||||
static void RestorePatches();
|
||||
s32 isInMiiMakerHBL();
|
||||
|
||||
u8 isFirstBoot __attribute__((section(".data"))) = 1;
|
||||
|
||||
/* Entry point */
|
||||
extern "C" int Menu_Main(int argc, char **argv){
|
||||
if(gAppStatus == 2){
|
||||
@ -86,8 +84,12 @@ extern "C" int Menu_Main(int argc, char **argv){
|
||||
DEBUG_FUNCTION_LINE("Mount SD partition\n");
|
||||
Init_SD_USB();
|
||||
|
||||
if(isFirstBoot){
|
||||
memset((void*)&gbl_replacement_data,0,sizeof(gbl_replacement_data));
|
||||
s32 result = 0;
|
||||
|
||||
//Reset everything when were going back to the Mii Maker
|
||||
if(isInMiiMakerHBL()){
|
||||
// Restore patches as the patched functions could change.
|
||||
RestorePatches();
|
||||
|
||||
PluginLoader * pluginLoader = PluginLoader::getInstance();
|
||||
std::vector<PluginInformation *> pluginList = pluginLoader->getPluginInformation("sd:/wiiu/plugins/");
|
||||
@ -100,50 +102,33 @@ extern "C" int Menu_Main(int argc, char **argv){
|
||||
memoryInitialize();
|
||||
|
||||
DEBUG_FUNCTION_LINE("Start main application\n");
|
||||
s32 result = Application::instance()->exec();
|
||||
result = Application::instance()->exec();
|
||||
DEBUG_FUNCTION_LINE("Main application stopped result: %d\n",result);
|
||||
Application::destroyInstance();
|
||||
|
||||
DEBUG_FUNCTION_LINE("Release memory\n");
|
||||
memoryRelease();
|
||||
CSettings::destroyInstance();
|
||||
if(result == APPLICATION_CLOSE_MIIMAKER){
|
||||
DeInit();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
PluginLoader::destroyInstance();
|
||||
}
|
||||
|
||||
|
||||
//Reset everything when were going back to the Mii Maker
|
||||
if(!isFirstBoot && isInMiiMakerHBL()){
|
||||
DEBUG_FUNCTION_LINE("Returing to the Homebrew Launcher!\n");
|
||||
isFirstBoot = 0;
|
||||
DeInit();
|
||||
RestorePatches();
|
||||
return EXIT_SUCCESS;
|
||||
} else {
|
||||
DEBUG_FUNCTION_LINE("Apply patches.\n");
|
||||
ApplyPatches();
|
||||
}
|
||||
|
||||
if(!isInMiiMakerHBL()){ //Starting the application
|
||||
DEBUG_FUNCTION_LINE("Calling init hook.\n");
|
||||
if(!isInMiiMakerHBL()){
|
||||
CallHook(WUPS_LOADER_HOOK_INIT_FUNCTION);
|
||||
return EXIT_RELAUNCH_ON_LOAD;
|
||||
}
|
||||
|
||||
if(isFirstBoot){ // First boot back to SysMenu
|
||||
DEBUG_FUNCTION_LINE("Loading the System Menu\n");
|
||||
isFirstBoot = 0;
|
||||
if(result == APPLICATION_CLOSE_APPLY){
|
||||
DEBUG_FUNCTION_LINE("Loading the system menu.\n");
|
||||
SYSLaunchMenu();
|
||||
return EXIT_RELAUNCH_ON_LOAD;
|
||||
}
|
||||
|
||||
DEBUG_FUNCTION_LINE("Application is ending now.\n");
|
||||
|
||||
DeInit();
|
||||
DEBUG_FUNCTION_LINE("Going back to the Homebrew Launcher\n");
|
||||
RestorePatches();
|
||||
|
||||
DeInit();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,7 @@ MainWindow::MainWindow(s32 w, s32 h)
|
||||
: width(w)
|
||||
, height(h)
|
||||
{
|
||||
for(s32 i = 0; i < 4; i++)
|
||||
{
|
||||
for(s32 i = 0; i < 4; i++) {
|
||||
std::string filename = StringTools::strfmt("player%i_point.png", i+1);
|
||||
pointerImgData[i] = Resources::GetImageData(filename.c_str());
|
||||
pointerImg[i] = new GuiImage(pointerImgData[i]);
|
||||
|
@ -38,6 +38,7 @@ struct rpl_handling {
|
||||
#define DYNAMIC_FUNCTION 1
|
||||
|
||||
#define FUNCTION_PATCHER_METHOD_STORE_SIZE 7
|
||||
#define MAXIMUM_PLUGIN_PATH_NAME_LENGTH 256
|
||||
#define MAXIMUM_PLUGIN_NAME_LENGTH 51
|
||||
#define MAXIMUM_FUNCTION_NAME_LENGTH 51
|
||||
|
||||
@ -66,6 +67,7 @@ struct replacement_data_hook_t{
|
||||
#define MAXIMUM_FUNCTION_PER_PLUGIN 100
|
||||
|
||||
struct replacement_data_plugin_t{
|
||||
char path[MAXIMUM_PLUGIN_PATH_NAME_LENGTH];
|
||||
char plugin_name[MAXIMUM_PLUGIN_NAME_LENGTH] = ""; // Name of this plugin
|
||||
int priority; // Priority of this plugin
|
||||
int number_used_functions; // Number of used function. Maximum is MAXIMUM_FUNCTION_PER_PLUGIN
|
||||
|
@ -77,6 +77,18 @@ std::vector<PluginInformation *> PluginLoader::getPluginInformation(const char *
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<PluginInformation *> PluginLoader::getPluginsLoadedInMemory(){
|
||||
std::vector<PluginInformation *> pluginInformation;
|
||||
for(s32 i = 0; i < gbl_replacement_data.number_used_plugins; i++){
|
||||
replacement_data_plugin_t * pluginInfo = &gbl_replacement_data.plugin_data[i];
|
||||
PluginInformation * curPlugin = PluginInformation::loadPluginInformation(pluginInfo->path);
|
||||
if(curPlugin != NULL){
|
||||
pluginInformation.push_back(curPlugin);
|
||||
}
|
||||
}
|
||||
return pluginInformation;
|
||||
}
|
||||
|
||||
void PluginLoader::loadAndLinkPlugins(std::vector<PluginInformation *> pluginInformation){
|
||||
std::vector<PluginData *> loadedPlugins;
|
||||
for(size_t i = 0;i < pluginInformation.size(); i++){
|
||||
@ -104,6 +116,14 @@ void PluginLoader::clearPluginData(std::vector<PluginData *> pluginData){
|
||||
}
|
||||
}
|
||||
|
||||
void PluginLoader::clearPluginInformation(std::vector<PluginInformation *> pluginInformation){
|
||||
for(size_t i = 0;i < pluginInformation.size(); i++){
|
||||
PluginInformation * curPluginInformation = pluginInformation[i];
|
||||
if(curPluginInformation != NULL){
|
||||
delete curPluginInformation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PluginData * PluginLoader::loadAndLinkPlugin(PluginInformation * pluginInformation){
|
||||
DEBUG_FUNCTION_LINE("\n");
|
||||
@ -376,6 +396,7 @@ void PluginLoader::copyPluginDataIntoGlobalStruct(std::vector<PluginData *> plug
|
||||
replacement_data_plugin_t * plugin_data = &gbl_replacement_data.plugin_data[plugin_index];
|
||||
|
||||
strncpy(plugin_data->plugin_name,cur_pluginInformation->getName().c_str(),MAXIMUM_PLUGIN_NAME_LENGTH-1);
|
||||
strncpy(plugin_data->path,cur_pluginInformation->getPath().c_str(),MAXIMUM_PLUGIN_PATH_NAME_LENGTH-1);
|
||||
|
||||
for(size_t j = 0; j < entry_data_list.size();j++){
|
||||
replacement_data_function_t * function_data = &plugin_data->functions[j];
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <vector>
|
||||
#include "PluginInformation.h"
|
||||
#include "PluginData.h"
|
||||
#include "dynamic_libs/os_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -75,7 +76,7 @@ public:
|
||||
\return a list of MetaInformation objects for all plugins currently loaded and linked (relocated). Will only contain
|
||||
plugin which are still on the sd card.
|
||||
**/
|
||||
//std::vector<PluginInformation *> getPluginsLoadedInMemory();
|
||||
std::vector<PluginInformation *> getPluginsLoadedInMemory();
|
||||
|
||||
/**
|
||||
\brief Takes a list of plugins that should be linked (relocated) loaded into the memory.
|
||||
@ -86,6 +87,26 @@ public:
|
||||
\param A list of plugin that should be linked (relocated) an loaded into memory
|
||||
**/
|
||||
void loadAndLinkPlugins(std::vector<PluginInformation *> pluginInformation);
|
||||
|
||||
/**
|
||||
\brief Iterates through the vector and delete all it's elements
|
||||
|
||||
\param A list of PluginInformation* that should be deleted.
|
||||
**/
|
||||
void clearPluginInformation(std::vector<PluginInformation*> PluginInformation);
|
||||
|
||||
size_t getTotalSpace(){
|
||||
return ((u32) this->endAddress - (u32) this->startAddress);
|
||||
}
|
||||
|
||||
size_t getAvailableSpace(){
|
||||
return ((u32) this->currentStoreAddress - (u32) this->startAddress);
|
||||
}
|
||||
|
||||
size_t getUsedSpace(){
|
||||
return getTotalSpace() - getAvailableSpace();
|
||||
}
|
||||
|
||||
private:
|
||||
PluginLoader(void * startAddress, void * endAddress){
|
||||
// TODO: Check if endAddress > startAddress.
|
||||
|
Loading…
Reference in New Issue
Block a user