irs connect to first available handle, irs display connected pad in the title.
This commit is contained in:
@@ -34,12 +34,14 @@ struct Menu final : MenuBase {
|
|||||||
void Draw(NVGcontext* vg, Theme* theme) override;
|
void Draw(NVGcontext* vg, Theme* theme) override;
|
||||||
void OnFocusGained() override;
|
void OnFocusGained() override;
|
||||||
|
|
||||||
|
private:
|
||||||
void PollCameraStatus(bool statup = false);
|
void PollCameraStatus(bool statup = false);
|
||||||
void LoadDefaultConfig();
|
void LoadDefaultConfig();
|
||||||
void UpdateConfig(const IrsImageTransferProcessorExConfig* config);
|
void UpdateConfig(const IrsImageTransferProcessorExConfig* config);
|
||||||
void ResetImage();
|
void ResetImage();
|
||||||
void UpdateImage();
|
void UpdateImage();
|
||||||
void updateColourArray();
|
void updateColourArray();
|
||||||
|
auto GetEntryName(s64 i) -> std::string;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Result m_init_rc{};
|
Result m_init_rc{};
|
||||||
|
|||||||
@@ -86,20 +86,7 @@ Menu::Menu() : MenuBase{"Irs"_i18n} {
|
|||||||
|
|
||||||
SidebarEntryArray::Items controller_str;
|
SidebarEntryArray::Items controller_str;
|
||||||
for (u32 i = 0; i < IRS_MAX_CAMERAS; i++) {
|
for (u32 i = 0; i < IRS_MAX_CAMERAS; i++) {
|
||||||
const auto& e = m_entries[i];
|
controller_str.emplace_back(GetEntryName(i));
|
||||||
std::string text = "Pad "_i18n + (i == 8 ? "HandHeld"_i18n : std::to_string(i));
|
|
||||||
switch (e.status) {
|
|
||||||
case IrsIrCameraStatus_Available:
|
|
||||||
text += " (Available)"_i18n;
|
|
||||||
break;
|
|
||||||
case IrsIrCameraStatus_Unsupported:
|
|
||||||
text += " (Unsupported)"_i18n;
|
|
||||||
break;
|
|
||||||
case IrsIrCameraStatus_Unconnected:
|
|
||||||
text += " (Unconnected)"_i18n;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
controller_str.emplace_back(text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SidebarEntryArray::Items rotation_str;
|
SidebarEntryArray::Items rotation_str;
|
||||||
@@ -217,6 +204,17 @@ Menu::Menu() : MenuBase{"Irs"_i18n} {
|
|||||||
PollCameraStatus(true);
|
PollCameraStatus(true);
|
||||||
// load default config
|
// load default config
|
||||||
LoadDefaultConfig();
|
LoadDefaultConfig();
|
||||||
|
// poll to get first available handle.
|
||||||
|
PollCameraStatus(false);
|
||||||
|
|
||||||
|
// find the first available entry and connect to that.
|
||||||
|
for (s64 i = 0; i < std::size(m_entries); i++) {
|
||||||
|
if (m_entries[i].status == IrsIrCameraStatus_Available) {
|
||||||
|
m_index = i;
|
||||||
|
UpdateConfig(&m_config);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu::~Menu() {
|
Menu::~Menu() {
|
||||||
@@ -233,6 +231,7 @@ Menu::~Menu() {
|
|||||||
void Menu::Update(Controller* controller, TouchInfo* touch) {
|
void Menu::Update(Controller* controller, TouchInfo* touch) {
|
||||||
MenuBase::Update(controller, touch);
|
MenuBase::Update(controller, touch);
|
||||||
PollCameraStatus();
|
PollCameraStatus();
|
||||||
|
SetTitleSubHeading(GetEntryName(m_index));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
void Menu::Draw(NVGcontext* vg, Theme* theme) {
|
||||||
@@ -530,4 +529,21 @@ void Menu::updateColourArray() {
|
|||||||
UpdateImage();
|
UpdateImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Menu::GetEntryName(s64 i) -> std::string {
|
||||||
|
const auto& e = m_entries[i];
|
||||||
|
std::string text = "Pad "_i18n + (i == 8 ? "HandHeld"_i18n : std::to_string(i));
|
||||||
|
switch (e.status) {
|
||||||
|
case IrsIrCameraStatus_Available:
|
||||||
|
text += " (Available)"_i18n;
|
||||||
|
break;
|
||||||
|
case IrsIrCameraStatus_Unsupported:
|
||||||
|
text += " (Unsupported)"_i18n;
|
||||||
|
break;
|
||||||
|
case IrsIrCameraStatus_Unconnected:
|
||||||
|
text += " (Unconnected)"_i18n;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace sphaira::ui::menu::irs
|
} // namespace sphaira::ui::menu::irs
|
||||||
|
|||||||
Reference in New Issue
Block a user