mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-10-01 21:36:53 -05:00
Fixing stop method and other stuff
This commit is contained in:
@@ -177,7 +177,7 @@ This version (`LinkCableMultiboot::Async`) allows more advanced use cases like p
|
||||
| `reset()` | - | Deactivates the library, canceling the in-progress transfer, if any. |
|
||||
| `getState()` | **LinkCableMultiboot::Async::State** | Returns the current state. |
|
||||
| `getResult([clear])` | **LinkCableMultiboot::Async::Result** | Returns the result of the last operation. <br/><br/>After this call, the result is cleared if `clear` is `true` (default behavior). |
|
||||
| `playerCount()` | **u8** | Returns the number of connected players (`1~4`). |
|
||||
| `playerCount()` | **u8** _(1~4)_ | Returns the number of connected players. |
|
||||
| `getPercentage()` | **u32** | Returns the completion percentage. |
|
||||
| `isReady()` | **bool** | Returns whether the ready mark is active or not. <br/><br/>This is only useful when using the `waitForReadySignal` parameter. |
|
||||
| `markReady()` | **bool** | Marks the transfer as ready. <br/><br/>This is only useful when using the `waitForReadySignal` parameter. |
|
||||
|
||||
@@ -1015,8 +1015,11 @@ class LinkCableMultiboot {
|
||||
}
|
||||
|
||||
void stop(Result newResult = NONE) {
|
||||
auto mode = fixedData.transferMode;
|
||||
|
||||
resetState(newResult);
|
||||
if (fixedData.transferMode == TransferMode::MULTI_PLAY)
|
||||
|
||||
if (mode == TransferMode::MULTI_PLAY)
|
||||
linkRawCable.deactivate();
|
||||
else
|
||||
linkSPI.deactivate();
|
||||
|
||||
@@ -724,9 +724,9 @@ class LinkRawWireless {
|
||||
rawData[0] = header;
|
||||
for (u32 i = 0; i < dataSize; i++)
|
||||
rawData[i + 1] = data[i];
|
||||
dataSize++;
|
||||
|
||||
bool success = sendCommand(COMMAND_SEND_DATA, rawData, dataSize).success;
|
||||
bool success =
|
||||
sendCommand(COMMAND_SEND_DATA, rawData, 1 + dataSize).success;
|
||||
|
||||
if (!success) {
|
||||
_resetState();
|
||||
@@ -757,9 +757,8 @@ class LinkRawWireless {
|
||||
rawData[0] = header;
|
||||
for (u32 i = 0; i < dataSize; i++)
|
||||
rawData[i + 1] = data[i];
|
||||
dataSize++;
|
||||
|
||||
if (!sendCommand(COMMAND_SEND_DATA_AND_WAIT, rawData, dataSize, true)
|
||||
if (!sendCommand(COMMAND_SEND_DATA_AND_WAIT, rawData, 1 + dataSize, true)
|
||||
.success) {
|
||||
_resetState();
|
||||
return false;
|
||||
|
||||
@@ -194,7 +194,7 @@ class LinkUniversal {
|
||||
[[nodiscard]] bool isConnected() { return state == CONNECTED; }
|
||||
|
||||
/**
|
||||
* @brief Returns the number of connected players (`0~5`).
|
||||
* @brief Returns the number of connected players (`1~5`).
|
||||
*/
|
||||
[[nodiscard]] u8 playerCount() {
|
||||
return mode == LINK_CABLE ? linkCable.playerCount()
|
||||
|
||||
@@ -670,14 +670,14 @@ class LinkWireless {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the number of connected players.
|
||||
* @brief Returns the number of connected players (`1~5`).
|
||||
*/
|
||||
[[nodiscard]] u8 playerCount() {
|
||||
return linkRawWireless.sessionState.playerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the current player ID.
|
||||
* @brief Returns the current player ID (`0~4`).
|
||||
*/
|
||||
[[nodiscard]] u8 currentPlayerId() {
|
||||
return linkRawWireless.sessionState.currentPlayerId;
|
||||
|
||||
@@ -526,7 +526,7 @@ class LinkWirelessMultiboot {
|
||||
u32 _bytes,
|
||||
LinkRawWireless::ReceiveDataResponse& response) {
|
||||
LinkRawWireless::CommandResult remoteCommand;
|
||||
volatile bool success = false;
|
||||
bool success = false;
|
||||
|
||||
success =
|
||||
linkRawWireless.sendDataAndWait(data, dataSize, remoteCommand, _bytes);
|
||||
|
||||
Reference in New Issue
Block a user