| 142 | } |
| 143 | |
| 144 | void ReceiveOverlay::update(const InputState& input) |
| 145 | { |
| 146 | // While an upload is in flight, B means "cancel the transfer", never "close |
| 147 | // the overlay": the receiver must stay registered until the server thread has |
| 148 | // abandoned the request, so closing waits for the transfer to end. |
| 149 | TransferSnapshot ts = TransferStatus::snapshot(); |
| 150 | if (ts.active && ts.kind == TransferKind::Network) { |
| 151 | if (input.kHeld & HidNpadButton_B) { |
| 152 | if (++mCancelHoldFrames >= CANCEL_HOLD_FRAMES && !TransferStatus::cancelRequested()) { |
| 153 | TransferStatus::requestCancel(); |
| 154 | } |
| 155 | } |
| 156 | else { |
| 157 | mCancelHoldFrames = 0; |
| 158 | } |
| 159 | return; // no close path while active |
| 160 | } |
| 161 | mCancelHoldFrames = 0; |
| 162 | |
| 163 | if (Transfer::receiverHasCompleted() && (input.kDown & HidNpadButton_A)) { |
| 164 | closeReceiver(); |
| 165 | return; |
| 166 | } |
| 167 | if (input.kDown & HidNpadButton_B) { |
| 168 | closeReceiver(); |
| 169 | } |
| 170 | } |
nothing calls this directly
no test coverage detected