Add list devices for Wii, list NAND.

This commit is contained in:
2019-10-20 23:05:34 +01:00
parent 8a5d710283
commit 924ad15fb0
4 changed files with 58 additions and 1 deletions

View File

@@ -19,6 +19,8 @@
#if defined(__linux__) && !defined(__ANDROID__)
#include "linux/linux.h"
#elif defined(GEKKO)
#include "wii/wii.h"
#endif
#include <stdlib.h>
@@ -27,6 +29,8 @@ DeviceInfoList* ListDevices()
{
#if defined(__linux__) && !defined(__ANDROID__)
return LinuxListDevices();
#elif defined(GEKKO)
return WiiListDevices();
#else
return NULL;
#endif

View File

@@ -4,7 +4,7 @@ if (NOT WII)
return()
endif ()
set(PLATFORM_SOURCES wii.c hello.c network.c wii.h)
set(PLATFORM_SOURCES wii.c hello.c network.c wii.h list_devices.c)
add_executable(dicremote-wii ${PLATFORM_SOURCES})
set_target_properties(dicremote-wii PROPERTIES LINK_FLAGS -L$ENV{DEVKITPRO}/libogc/lib/wii/)

49
wii/list_devices.c Normal file
View File

@@ -0,0 +1,49 @@
/*
* This file is part of the DiscImageChef Remote Server.
* Copyright (c) 2019 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/>.
*/
#include "../dicmote.h"
#include <gccore.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
DeviceInfoList* WiiListDevices()
{
DeviceInfoList *list_start = NULL, *list_current = NULL, *list_next = NULL;
u32 deviceId = 0;
list_next = malloc(sizeof(DeviceInfoList));
memset(list_next, 0, sizeof(DeviceInfoList));
// All Wiis do have flash
strncpy(list_next->this.path, "/dev/flash", 1024);
strncpy(list_next->this.vendor, "Nintendo", 256);
strncpy(list_next->this.model, "Wii NAND", 256);
strncpy(list_next->this.bus, "NAND", 256);
list_next->this.supported = false; // TODO: Implement NAND reading
if(ES_GetDeviceID(&deviceId) < 0) snprintf(list_next->this.serial, 256, "%d", deviceId);
list_start = list_next;
list_current = list_start;
return list_start;
}

View File

@@ -18,10 +18,14 @@
#ifndef DICREMOTE_WII_WII_H_
#define DICREMOTE_WII_WII_H_
#include "../dicmote.h"
#define DICREMOTE_WII_DEVICE_FD_NAND 1
#define DICREMOTE_WII_DEVICE_FD_DVD 2
#define DICREMOTE_WII_DEVICE_FD_SD 3
#define DICREMOTE_WII_DEVICE_FD_GCMM_A 4
#define DICREMOTE_WII_DEVICE_FD_GCMM_B 5
DeviceInfoList* WiiListDevices();
#endif // DICREMOTE_WII_WII_H_