Dolphin, the GameCube and Wii emulator - Forums

Full Version: Emulated USB Devices - Transfer Callbacks?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Had some success with the thread now - added a check for if the vector has increased in size when iterating through, and it no longer causes crashes!
int size = m_transfers.size();
for (auto iterator = m_transfers.begin(); iterator != m_transfers.end()Wink
{
int current_size = m_transfers.size();
if (current_size > size){
iterator = m_transfers.end();
continue;
}
auto* command = iterator->get();
if (command->expected_time > timestamp)
{
++iterator;
continue;
}
command->OnTransferComplete(command->expected_count);
iterator = m_transfers.erase(iterator);
}
Now just need to keep filling buffers and replying as a normal device would!
Pages: 1 2