1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-12-24 15:13:45 +00:00

Adjusting to new libnx build

This commit is contained in:
cathery 2019-11-02 12:03:54 +03:00
parent 467541fb6d
commit 82e6eca5ab
5 changed files with 6 additions and 65 deletions

View File

@ -105,7 +105,6 @@ Status XboxOneController::GetInput()
if (S_FAILED(rc))
return rc;
}
//TODO: add ack check and send ack report!
}
return rc;

View File

@ -1,7 +0,0 @@
#pragma once
#include "switch.h"
//This file exists for the sole purpose of fixing existing libnx bugs while the new release isn't out yet
//regular usbHsEpClose incorrectly accesses more memory than it should, causing a crash
void usbHsEpCloseFixed(UsbHsClientEpSession *s);

View File

@ -33,12 +33,12 @@ Result SwitchUSBInterface::Open()
//we're adjusting appropriately
for (int i = 0; i != 15; ++i)
{
m_inEndpoints.push_back(std::make_unique<SwitchUSBEndpoint>(m_session, m_session.inf.inf.output_endpoint_descs[i]));
m_inEndpoints.push_back(std::make_unique<SwitchUSBEndpoint>(m_session, m_session.inf.inf.input_endpoint_descs[i]));
}
for (int i = 0; i != 15; ++i)
{
m_outEndpoints.push_back(std::make_unique<SwitchUSBEndpoint>(m_session, m_session.inf.inf.input_endpoint_descs[i]));
m_outEndpoints.push_back(std::make_unique<SwitchUSBEndpoint>(m_session, m_session.inf.inf.output_endpoint_descs[i]));
}
}
return rc;

View File

@ -1,51 +0,0 @@
#include "libnxFix.h"
#include <cstring>
#include <stdio.h>
#include "malloc.h"
static Result _usbHsCmdNoIO(Service *s, u64 cmd_id)
{
IpcCommand c;
ipcInitialize(&c);
struct Packet
{
u64 magic;
u64 cmd_id;
} * raw;
raw = static_cast<Packet *>(serviceIpcPrepareHeader(s, &c, sizeof(*raw)));
raw->magic = SFCI_MAGIC;
raw->cmd_id = cmd_id;
Result rc = serviceIpcDispatch(s);
if (R_SUCCEEDED(rc))
{
IpcParsedCommand r;
struct Reponse
{
u64 magic;
u64 result;
} * resp;
serviceIpcParse(s, &r, sizeof(*resp));
resp = static_cast<Reponse *>(r.Raw);
rc = resp->result;
}
return rc;
}
void usbHsEpCloseFixed(UsbHsClientEpSession *s)
{
if (!serviceIsActive(&s->s))
return;
_usbHsCmdNoIO(&s->s, hosversionAtLeast(2, 0, 0) ? 1 : 3); //Close
serviceClose(&s->s);
eventClose(&s->eventXfer);
memset(s, 0, sizeof(UsbHsClientEpSession));
}

View File

@ -48,19 +48,19 @@ extern "C"
Result rc = 0;
rc = hiddbgInitialize();
if (R_FAILED(rc))
fatalSimple(rc);
fatalThrow(rc);
rc = hiddbgAttachHdlsWorkBuffer();
if (R_FAILED(rc))
fatalSimple(rc);
fatalThrow(rc);
rc = usbHsInitialize();
if (R_FAILED(rc))
fatalSimple(rc);
fatalThrow(rc);
rc = usbCommsInitialize();
if (R_FAILED(rc))
fatalSimple(rc);
fatalThrow(rc);
}
void __attribute__((weak)) userAppExit(void)