ConfigMenu: Show wiimote button when the last input was on a wiimote

This commit is contained in:
Maschell 2025-01-06 11:47:23 +01:00
parent 3ec6b3f4a1
commit 94ca12b415
3 changed files with 28 additions and 7 deletions

View File

@ -88,7 +88,7 @@ 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 = "Then press \ue002 to manage active plugins";
message = "Then press \ue002 or \uE048 to manage active plugins";
DrawUtils::print(SCREEN_WIDTH / 2 + DrawUtils::getTextWidth(message) / 2, SCREEN_HEIGHT / 2 + 48, message, true);
// draw bottom bar

View File

@ -25,6 +25,25 @@ ConfigRenderer::ConfigRenderer(std::vector<ConfigDisplayItem> &&vec) : mConfigs(
ConfigRenderer::~ConfigRenderer() = default;
ConfigSubState ConfigRenderer::Update(Input &input, const WUPSConfigSimplePadData &simpleInputData, const WUPSConfigComplexPadData &complexInputData) {
// Check if the last input was on a wiimote
for (uint32_t i = 0; i < std::size(complexInputData.kpad.data); i++) {
const KPADError &kpadError = complexInputData.kpad.kpadError[i];
const KPADStatus &status = complexInputData.kpad.data[i];
const bool isWiimote = status.extensionType == WPAD_EXT_CORE || status.extensionType == WPAD_EXT_NUNCHUK ||
status.extensionType == WPAD_EXT_MPLUS || status.extensionType == WPAD_EXT_MPLUS_NUNCHUK;
if (kpadError == KPAD_ERROR_OK) {
if (isWiimote && status.hold != 0) {
mLastInputWasOnWiimote = true;
} else if (!isWiimote && status.classic.hold != 0) {
mLastInputWasOnWiimote = false;
}
}
}
if (complexInputData.vpad.vpadError == VPAD_READ_SUCCESS && complexInputData.vpad.data.hold != 0) {
mLastInputWasOnWiimote = false;
}
switch (mState) {
case STATE_MAIN:
return UpdateStateMain(input);
@ -183,8 +202,8 @@ void ConfigRenderer::RenderStateMain() const {
uint32_t szNoConfig = DrawUtils::getTextWidth(noConfigText.data());
if (!mAllConfigs.empty()) {
std::string activateHint = "Press \ue002 to activate inactive plugins";
auto szHint = DrawUtils::getTextWidth(activateHint.c_str());
const auto activateHint = string_format("Press %s to activate inactive plugins", mLastInputWasOnWiimote ? "\uE048" : "\uE002");
const auto szHint = DrawUtils::getTextWidth(activateHint.c_str());
DrawUtils::print((SCREEN_WIDTH / 2) - (szNoConfig / 2), (SCREEN_HEIGHT / 2) - 16, noConfigText.data());
DrawUtils::print((SCREEN_WIDTH / 2) - (szHint / 2), (SCREEN_HEIGHT / 2) + 16, activateHint.data());
@ -226,7 +245,8 @@ void ConfigRenderer::RenderStateMain() const {
if (mSetActivePluginsMode) {
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);
const auto text = string_format("\ue000 Select | %s Manage plugins", mLastInputWasOnWiimote ? "\uE048" : "\uE002");
DrawUtils::print(SCREEN_WIDTH - 16, SCREEN_HEIGHT - 10, text.c_str(), true);
}
// draw scroll indicator

View File

@ -63,7 +63,8 @@ private:
int32_t mRenderOffset = 0;
int32_t mCurrentOpen = -1;
bool mNeedRedraw = true;
bool mSetActivePluginsMode = false;
bool mActivePluginsDirty = false;
bool mNeedRedraw = true;
bool mSetActivePluginsMode = false;
bool mActivePluginsDirty = false;
bool mLastInputWasOnWiimote = false;
};