mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-12-23 11:31:49 +01:00
More fixes and changes
This commit is contained in:
parent
de15764367
commit
9052ecb2b2
@ -50,7 +50,7 @@ WUMS_INITIALIZE() {
|
||||
vpadInput.update(1280, 720);
|
||||
auto buttomComboSafeMode = Input::eButtons::BUTTON_L | Input::eButtons::BUTTON_UP | Input::eButtons::BUTTON_MINUS;
|
||||
if ((vpadInput.data.buttons_h & (buttomComboSafeMode)) == buttomComboSafeMode) {
|
||||
DrawUtils::RenderScreen([] {
|
||||
DrawUtils::RenderScreen([&vpadInput] {
|
||||
DrawUtils::beginDraw();
|
||||
DrawUtils::clear(COLOR_BACKGROUND_WARN);
|
||||
DrawUtils::setFontColor(COLOR_WARNING);
|
||||
@ -69,18 +69,24 @@ WUMS_INITIALIZE() {
|
||||
|
||||
message = "To enable them again, open the plugin config menu (\ue004 + \ue07a + \ue046).";
|
||||
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(message) / 2, SCREEN_HEIGHT / 2 + 24, message, true);
|
||||
message = "Press then \ue002 to manage active plugins";
|
||||
message = "Then press \ue002 to manage active plugins";
|
||||
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(message) / 2, SCREEN_HEIGHT / 2 + 48, message, true);
|
||||
|
||||
// draw bottom bar
|
||||
DrawUtils::drawRectFilled(8, SCREEN_HEIGHT - 24 - 8 - 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_WHITE);
|
||||
DrawUtils::setFontSize(18);
|
||||
const char *exitHints = "The console will continue to boot in 10 seconds.";
|
||||
const char *exitHints = "Continuing in 10 seconds.";
|
||||
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(exitHints) / 2, SCREEN_HEIGHT - 8, exitHints, true);
|
||||
|
||||
DrawUtils::endDraw();
|
||||
|
||||
std::this_thread::sleep_for(10s);
|
||||
for (int i = 0; i < 10000 / 16; i++) {
|
||||
vpadInput.update(1280, 720);
|
||||
if ((vpadInput.data.buttons_d & (ANY_BUTTON_MASK))) {
|
||||
break;
|
||||
}
|
||||
std::this_thread::sleep_for(16ms);
|
||||
}
|
||||
});
|
||||
DEBUG_FUNCTION_LINE_INFO("Safe Mode activated!");
|
||||
auto tobeIgnoredFilePath = getNonBaseAromaPluginFilenames(getPluginPath());
|
||||
|
@ -211,7 +211,7 @@ void ConfigRenderer::RenderStateMain() const {
|
||||
DrawUtils::setFontSize(18);
|
||||
DrawUtils::print(16, SCREEN_HEIGHT - 10, "\ue07d Navigate ");
|
||||
if (mSetActivePluginsMode) {
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, "\ue000 Activate | \uE045 Apply", true);
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, "\ue000 Activate | \uE045 Apply", true);
|
||||
} else if (totalElementSize > 0) {
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, "\ue000 Select | \uE002 Manage plugins", true);
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ void ConfigUtils::displayMenu() {
|
||||
OSTime startTime;
|
||||
bool skipFirstInput = true;
|
||||
|
||||
gOnlyAcceptFromThread = OSGetCurrentThread();
|
||||
gOnlyAcceptFromThread = OSGetCurrentThread();
|
||||
ConfigSubState subStateReturnValue = SUB_STATE_ERROR;
|
||||
while (true) {
|
||||
startTime = OSGetTime();
|
||||
if (gConfigMenuShouldClose) {
|
||||
@ -201,8 +202,8 @@ void ConfigUtils::displayMenu() {
|
||||
complexData.kpad.data[i] = wpadInputs[i].kpad;
|
||||
}
|
||||
|
||||
auto subState = renderer.Update(baseInput, simpleData, complexData);
|
||||
if (subState != SUB_STATE_RUNNING) {
|
||||
subStateReturnValue = renderer.Update(baseInput, simpleData, complexData);
|
||||
if (subStateReturnValue != SUB_STATE_RUNNING) {
|
||||
break;
|
||||
}
|
||||
if (renderer.NeedsRedraw() || baseInput.data.buttons_d || baseInput.data.buttons_r) {
|
||||
@ -220,7 +221,7 @@ void ConfigUtils::displayMenu() {
|
||||
|
||||
std::vector<PluginLoadWrapper> newActivePluginsList;
|
||||
|
||||
if (renderer.GetActivePluginsIfChanged(newActivePluginsList)) {
|
||||
if (subStateReturnValue == SUB_STATE_RETURN_WITH_PLUGIN_RELOAD && renderer.GetActivePluginsIfChanged(newActivePluginsList)) {
|
||||
startTime = OSGetTime();
|
||||
renderBasicScreen("Applying changes, app will now restart...");
|
||||
|
||||
@ -230,9 +231,7 @@ void ConfigUtils::displayMenu() {
|
||||
for (const auto &cur : newActivePluginsList) {
|
||||
if (!cur.isLoadAndLink()) {
|
||||
auto &source = cur.getPluginData()->getSource();
|
||||
// TODO: Make sure to only use plugins from the actual plugin directory?
|
||||
// atm nothing (to my knowledge) is using the WUPS API to load any plugin from a path though
|
||||
if (source.ends_with(".wps")) {
|
||||
if (source.starts_with(getPluginPath()) && source.ends_with(".wps")) {
|
||||
std::size_t found = source.find_last_of("/\\");
|
||||
std::string filename = source.substr(found + 1);
|
||||
newInactivePluginsList.push_back(filename);
|
||||
@ -241,7 +240,9 @@ void ConfigUtils::displayMenu() {
|
||||
}
|
||||
gLoadOnNextLaunch = newActivePluginsList;
|
||||
WUPSBackendSettings::SetInactivePluginFilenames(newInactivePluginsList);
|
||||
WUPSBackendSettings::SaveSettings();
|
||||
if (!WUPSBackendSettings::SaveSettings()) {
|
||||
DEBUG_FUNCTION_LINE_WARN("Failed to save WUPSBackendSettings");
|
||||
}
|
||||
|
||||
_SYSLaunchTitleWithStdArgsInNoSplash(OSGetTitleID(), nullptr);
|
||||
// Make sure to wait at least 2 seconds so user can read the screen and
|
||||
@ -252,18 +253,19 @@ void ConfigUtils::displayMenu() {
|
||||
}
|
||||
} else {
|
||||
renderBasicScreen("Saving configs...");
|
||||
for (const auto &plugin : gLoadedPlugins) {
|
||||
const auto configData = plugin.getConfigData();
|
||||
if (configData) {
|
||||
if (configData->CallMenuClosedCallback() == WUPSCONFIG_API_RESULT_MISSING_CALLBACK) {
|
||||
DEBUG_FUNCTION_LINE_WARN("CallMenuClosedCallback is missing for %s", plugin.getMetaInformation().getName().c_str());
|
||||
}
|
||||
} else {
|
||||
CallHook(plugin, WUPS_LOADER_HOOK_CONFIG_CLOSED_DEPRECATED);
|
||||
}
|
||||
for (const auto &plugin : gLoadedPlugins) {
|
||||
const auto configData = plugin.getConfigData();
|
||||
if (configData) {
|
||||
if (configData->CallMenuClosedCallback() == WUPSCONFIG_API_RESULT_MISSING_CALLBACK) {
|
||||
DEBUG_FUNCTION_LINE_WARN("CallMenuClosedCallback is missing for %s", plugin.getMetaInformation().getName().c_str());
|
||||
}
|
||||
} else {
|
||||
CallHook(plugin, WUPS_LOADER_HOOK_CONFIG_CLOSED_DEPRECATED);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
WUPSConfigAPIBackend::Intern::CleanAllHandles();
|
||||
|
||||
// we want wait at least 300ms to avoid leaking inputs from the config menu to the application
|
||||
|
@ -45,6 +45,19 @@ public:
|
||||
STICK_L_DOWN = 0x08000000
|
||||
};
|
||||
|
||||
#define ANY_BUTTON_MASK (Input::eButtons::BUTTON_L | \
|
||||
Input::eButtons::BUTTON_R | \
|
||||
Input::eButtons::BUTTON_PLUS | \
|
||||
Input::eButtons::BUTTON_MINUS | \
|
||||
Input::eButtons::BUTTON_A | \
|
||||
Input::eButtons::BUTTON_B | \
|
||||
Input::eButtons::BUTTON_X | \
|
||||
Input::eButtons::BUTTON_Y | \
|
||||
Input::eButtons::BUTTON_DOWN | \
|
||||
Input::eButtons::BUTTON_LEFT | \
|
||||
Input::eButtons::BUTTON_RIGHT | \
|
||||
Input::eButtons::BUTTON_UP)
|
||||
|
||||
typedef struct {
|
||||
uint32_t buttons_h;
|
||||
uint32_t buttons_d;
|
||||
|
@ -34,6 +34,7 @@ std::string getEnvironmentPath() {
|
||||
sEnvironmentPath = environmentPath;
|
||||
return sEnvironmentPath;
|
||||
}
|
||||
|
||||
std::string getPluginPath() {
|
||||
if (!sPluginPath.empty()) {
|
||||
return sPluginPath;
|
||||
|
Loading…
Reference in New Issue
Block a user