Files
aaruremote/wii/hello.c

49 lines
1.8 KiB
C
Raw Normal View History

/*
2020-03-01 05:44:49 +00:00
* This file is part of the Aaru Remote Server.
2020-12-31 23:12:05 +00:00
* Copyright (c) 2019-2021 Natalia Portillo.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that 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/>.
*/
2019-10-20 22:47:36 +01:00
#include <gccore.h>
2019-10-22 00:44:39 +01:00
#include <malloc.h>
2019-10-20 22:47:36 +01:00
#include <stdio.h>
2019-10-22 00:44:39 +01:00
#include <string.h>
2020-10-24 04:23:01 +01:00
#include "../aaruremote.h"
#include "../endian.h"
2024-04-30 15:42:08 +01:00
AaruPacketHello *GetHello()
{
2024-04-30 15:42:08 +01:00
AaruPacketHello *pkt_server_hello;
2020-03-01 05:52:58 +00:00
pkt_server_hello = malloc(sizeof(AaruPacketHello));
if(!pkt_server_hello) { return 0; }
2020-03-01 05:52:58 +00:00
memset(pkt_server_hello, 0, sizeof(AaruPacketHello));
2020-03-01 05:50:46 +00:00
pkt_server_hello->hdr.remote_id = htole32(AARUREMOTE_REMOTE_ID);
pkt_server_hello->hdr.packet_id = htole32(AARUREMOTE_PACKET_ID);
2020-03-01 05:52:58 +00:00
pkt_server_hello->hdr.len = htole32(sizeof(AaruPacketHello));
2020-03-01 05:50:46 +00:00
pkt_server_hello->hdr.version = AARUREMOTE_PACKET_VERSION;
pkt_server_hello->hdr.packet_type = AARUREMOTE_PACKET_TYPE_HELLO;
strncpy(pkt_server_hello->application, AARUREMOTE_NAME, sizeof(AARUREMOTE_NAME));
strncpy(pkt_server_hello->version, AARUREMOTE_VERSION, sizeof(AARUREMOTE_VERSION));
pkt_server_hello->max_protocol = AARUREMOTE_PROTOCOL_MAX;
2019-10-20 22:47:36 +01:00
snprintf(pkt_server_hello->sysname, 255, "Nintendo Wii IOS %d", IOS_GetVersion());
snprintf(pkt_server_hello->release, 255, "%d", IOS_GetRevision());
strncpy(pkt_server_hello->machine, "ppc", 255);
return pkt_server_hello;
}