1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-11-13 21:56:42 +00:00
AIO-switch-updater/source/ams_bpc.c

51 lines
1.4 KiB
C
Raw Normal View History

2021-06-17 21:40:54 +01:00
/*
* Copyright (c) 2018-2020 Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ams_bpc.h"
2021-09-11 14:48:13 +01:00
#include <string.h>
#include <switch.h>
2021-06-17 21:40:54 +01:00
#include "service_guard.h"
static Service g_amsBpcSrv;
NX_GENERATE_SERVICE_GUARD(amsBpc);
2021-09-11 14:48:13 +01:00
Result _amsBpcInitialize(void)
{
2021-06-17 21:40:54 +01:00
Handle h;
Result rc = svcConnectToNamedPort(&h, "bpc:ams"); /* TODO: ams:bpc */
if (R_SUCCEEDED(rc)) serviceCreate(&g_amsBpcSrv, h);
return rc;
}
2021-09-11 14:48:13 +01:00
void _amsBpcCleanup(void)
{
2021-06-17 21:40:54 +01:00
serviceClose(&g_amsBpcSrv);
}
2021-09-11 14:48:13 +01:00
Service* amsBpcGetServiceSession(void)
{
2021-06-17 21:40:54 +01:00
return &g_amsBpcSrv;
}
2021-09-11 14:48:13 +01:00
Result amsBpcSetRebootPayload(const void* src, size_t src_size)
{
2021-06-17 21:40:54 +01:00
return serviceDispatch(&g_amsBpcSrv, 65001,
2021-09-11 14:48:13 +01:00
.buffer_attrs = {SfBufferAttr_In | SfBufferAttr_HipcMapAlias},
.buffers = {{src, src_size}}, );
2021-06-17 21:40:54 +01:00
}