htc: implement htclow listener thread

This commit is contained in:
Michael Scire 2021-02-08 05:45:23 -08:00 committed by SciresM
parent c9c41e0e8d
commit 2341f18edd
21 changed files with 669 additions and 11 deletions

View file

@ -15,6 +15,7 @@
*/
#include <stratosphere.hpp>
#include "htclow_mux.hpp"
#include "../ctrl/htclow_ctrl_state_machine.hpp"
namespace ams::htclow::mux {
@ -37,4 +38,28 @@ namespace ams::htclow::mux {
}
}
void Mux::UpdateChannelState() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
/* Update the state of all channels in our map. */
/* NOTE: Nintendo does this highly inefficiently... */
for (auto pair : m_channel_impl_map.GetMap()) {
m_channel_impl_map[pair.first].UpdateState();
}
}
void Mux::UpdateMuxState() {
/* Lock ourselves. */
std::scoped_lock lk(m_mutex);
/* Update whether we're sleeping. */
if (m_state_machine->IsSleeping()) {
m_is_sleeping = true;
} else {
m_is_sleeping = false;
m_wake_event.Signal();
}
}
}