usio: impl fake board name

This commit is contained in:
Hay1tsme 2023-12-10 18:46:56 -05:00
parent 77aa77496d
commit 5a130705d3
1 changed files with 17 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include "util/dump.h"
static const wchar_t usio_path[] = L"$usio";
static const wchar_t usio_name[] = L"NBGI.REAL_USIO";
static int my_bnusio_Open();
static int my_bnusio_Close();
@ -43,6 +44,7 @@ static int my_bnusio_GetCoin(uint8_t id);
static int my_bnusio_GetCoinError(uint8_t id);
static int my_bnusio_GetService(uint8_t id);
static int my_bnusio_GetServiceError(uint8_t id);
static intptr_t my_bnusio_GetIoBoardName();
static struct hook_symbol usio_syms[] = {
{
@ -113,6 +115,10 @@ static struct hook_symbol usio_syms[] = {
.name = "bnusio_GetServiceError",
.patch = my_bnusio_GetServiceError
},
{
.name = "bnusio_GetIoBoardName",
.patch = my_bnusio_GetIoBoardName
},
{
.name = "Open",
.patch = my_bnusio_Open
@ -180,6 +186,10 @@ static struct hook_symbol usio_syms[] = {
{
.name = "GetServiceError",
.patch = my_bnusio_GetServiceError
},
{
.name = "GetIoBoardName",
.patch = my_bnusio_GetIoBoardName
}
};
@ -356,4 +366,11 @@ static int my_bnusio_GetSwIn()
opbtn_out = (state.p2_btns << 16) | (state.p1_btns << 8) | state.op_btns;
return opbtn_out;
}
static intptr_t my_bnusio_GetIoBoardName()
{
intptr_t ret = (intptr_t)malloc(sizeof(usio_name) / 2);
wcstombs((char *)ret, usio_name, sizeof(usio_name) / 2);
return ret;
}