htc: implement htclow listener thread

This commit is contained in:
Michael Scire authored and SciresM committed 2021-02-24 04:06:54 -08:00
1 parent c9c41e0e8d
commit 2341f18edd
21 files changed
+669 -11

No files matched your search

@@ -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();
}
}
}