mirror of
https://github.com/afska/gba-link-connection.git
synced 2026-10-01 21:36:53 -05:00
Removing standard library usage from C bindings
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
#include "C_LinkRawCable.h"
|
||||
#include <string.h>
|
||||
#include "../LinkRawCable.hpp"
|
||||
|
||||
extern "C" {
|
||||
@@ -30,7 +29,8 @@ C_LinkRawCable_Response C_LinkRawCable_transfer(C_LinkRawCableHandle handle,
|
||||
u16 data) {
|
||||
auto response = static_cast<LinkRawCable*>(handle)->transfer(data);
|
||||
C_LinkRawCable_Response cResponse;
|
||||
memcpy(cResponse.data, response.data, sizeof(response.data));
|
||||
for (u32 i = 0; i < C_LINK_RAW_CABLE_MAX_PLAYERS; i++)
|
||||
cResponse.data[i] = response.data[i];
|
||||
cResponse.playerId = response.playerId;
|
||||
return cResponse;
|
||||
}
|
||||
@@ -41,7 +41,8 @@ C_LinkRawCable_Response C_LinkRawCable_transferWithCancel(
|
||||
bool (*cancel)()) {
|
||||
auto response = static_cast<LinkRawCable*>(handle)->transfer(data, cancel);
|
||||
C_LinkRawCable_Response cResponse;
|
||||
memcpy(cResponse.data, response.data, sizeof(response.data));
|
||||
for (u32 i = 0; i < C_LINK_RAW_CABLE_MAX_PLAYERS; i++)
|
||||
cResponse.data[i] = response.data[i];
|
||||
cResponse.playerId = response.playerId;
|
||||
return cResponse;
|
||||
}
|
||||
@@ -60,7 +61,8 @@ C_LinkRawCable_Response C_LinkRawCable_getAsyncData(
|
||||
C_LinkRawCableHandle handle) {
|
||||
auto response = static_cast<LinkRawCable*>(handle)->getAsyncData();
|
||||
C_LinkRawCable_Response cResponse;
|
||||
memcpy(cResponse.data, response.data, sizeof(response.data));
|
||||
for (u32 i = 0; i < C_LINK_RAW_CABLE_MAX_PLAYERS; i++)
|
||||
cResponse.data[i] = response.data[i];
|
||||
cResponse.playerId = response.playerId;
|
||||
return cResponse;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ typedef enum {
|
||||
} C_LinkRawCable_AsyncState;
|
||||
|
||||
typedef struct {
|
||||
u16 data[4];
|
||||
u16 data[C_LINK_RAW_CABLE_MAX_PLAYERS];
|
||||
int playerId;
|
||||
} C_LinkRawCable_Response;
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#include "C_LinkRawWireless.h"
|
||||
#include "../LinkRawWireless.hpp"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
extern "C" {
|
||||
C_LinkRawWireless_CommandResult fromCppResult(
|
||||
LinkRawWireless::CommandResult cppResult);
|
||||
|
||||
Reference in New Issue
Block a user