This commit is contained in:
Nanolx 2012-12-22 18:57:23 +01:00
parent c1eaa348e4
commit 0ea5a873c8
7 changed files with 1805 additions and 1805 deletions

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="1"> <app version="1">
<name>Yet Another Wad Manager Mod - Deutsch</name> <name>Yet Another Wad Manager Mod - Deutsch</name>
<version>rev5c</version> <version>rev5c</version>
<coder>various</coder> <coder>various</coder>
<short_description>Installiere/Deinstalliere WADs</short_description> <short_description>Installiere/Deinstalliere WADs</short_description>
<long_description>Drücken Sie die Taste "A" zum (de)installieren von WADs. <long_description>Drücken Sie die Taste "A" zum (de)installieren von WADs.
Wenn keine Datei markiert ist, erscheint das normale einzelne (De)Installations-Menü. Wenn keine Datei markiert ist, erscheint das normale einzelne (De)Installations-Menü.
Wenn mindestens eine Datei markiert ist, erscheint eine Liste im (De)Installations-Menü. Wenn mindestens eine Datei markiert ist, erscheint eine Liste im (De)Installations-Menü.
Drücken Sie die "+"-Taste, um die ausgewählten WAD für die Batch-Installation zu (de)markieren Drücken Sie die "+"-Taste, um die ausgewählten WAD für die Batch-Installation zu (de)markieren
Drücken Sie die "-"-Taste, um die ausgewählten WAD für die Batch-Deinstallation zu (de)markieren Drücken Sie die "-"-Taste, um die ausgewählten WAD für die Batch-Deinstallation zu (de)markieren
Drücken Sie die "1"-Taste, um in das Erweiterungs-Menü zu gelangen Drücken Sie die "1"-Taste, um in das Erweiterungs-Menü zu gelangen
Ein "+" wird vor dem Namen der zu installierenden WAD angezeigt Ein "+" wird vor dem Namen der zu installierenden WAD angezeigt
Ein "-" wird vor dem Namen der zu deinstallierenden WAD angezeigt</long_description> Ein "-" wird vor dem Namen der zu deinstallierenden WAD angezeigt</long_description>
<ahb_access/> <ahb_access/>
</app> </app>

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +1,171 @@
/******************************************************************************************** /********************************************************************************************
PNGU Version : 0.2a PNGU Version : 0.2a
Coder : frontier Coder : frontier
More info : http://frontier-dev.net More info : http://frontier-dev.net
********************************************************************************************/ ********************************************************************************************/
#ifndef __PNGU__ #ifndef __PNGU__
#define __PNGU__ #define __PNGU__
// Return codes // Return codes
#define PNGU_OK 0 #define PNGU_OK 0
#define PNGU_ODD_WIDTH 1 #define PNGU_ODD_WIDTH 1
#define PNGU_ODD_STRIDE 2 #define PNGU_ODD_STRIDE 2
#define PNGU_INVALID_WIDTH_OR_HEIGHT 3 #define PNGU_INVALID_WIDTH_OR_HEIGHT 3
#define PNGU_FILE_IS_NOT_PNG 4 #define PNGU_FILE_IS_NOT_PNG 4
#define PNGU_UNSUPPORTED_COLOR_TYPE 5 #define PNGU_UNSUPPORTED_COLOR_TYPE 5
#define PNGU_NO_FILE_SELECTED 6 #define PNGU_NO_FILE_SELECTED 6
#define PNGU_CANT_OPEN_FILE 7 #define PNGU_CANT_OPEN_FILE 7
#define PNGU_CANT_READ_FILE 8 #define PNGU_CANT_READ_FILE 8
#define PNGU_LIB_ERROR 9 #define PNGU_LIB_ERROR 9
// Color types // Color types
#define PNGU_COLOR_TYPE_GRAY 1 #define PNGU_COLOR_TYPE_GRAY 1
#define PNGU_COLOR_TYPE_GRAY_ALPHA 2 #define PNGU_COLOR_TYPE_GRAY_ALPHA 2
#define PNGU_COLOR_TYPE_PALETTE 3 #define PNGU_COLOR_TYPE_PALETTE 3
#define PNGU_COLOR_TYPE_RGB 4 #define PNGU_COLOR_TYPE_RGB 4
#define PNGU_COLOR_TYPE_RGB_ALPHA 5 #define PNGU_COLOR_TYPE_RGB_ALPHA 5
#define PNGU_COLOR_TYPE_UNKNOWN 6 #define PNGU_COLOR_TYPE_UNKNOWN 6
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
// Types // Types
typedef unsigned char PNGU_u8; typedef unsigned char PNGU_u8;
typedef unsigned short PNGU_u16; typedef unsigned short PNGU_u16;
typedef unsigned int PNGU_u32; typedef unsigned int PNGU_u32;
typedef unsigned long long PNGU_u64; typedef unsigned long long PNGU_u64;
typedef struct typedef struct
{ {
PNGU_u8 r; PNGU_u8 r;
PNGU_u8 g; PNGU_u8 g;
PNGU_u8 b; PNGU_u8 b;
} PNGUCOLOR; } PNGUCOLOR;
typedef struct typedef struct
{ {
PNGU_u32 imgWidth; // In pixels PNGU_u32 imgWidth; // In pixels
PNGU_u32 imgHeight; // In pixels PNGU_u32 imgHeight; // In pixels
PNGU_u32 imgBitDepth; // In bitx PNGU_u32 imgBitDepth; // In bitx
PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_* PNGU_u32 imgColorType; // PNGU_COLOR_TYPE_*
PNGU_u32 validBckgrnd; // Non zero if there is a background color PNGU_u32 validBckgrnd; // Non zero if there is a background color
PNGUCOLOR bckgrnd; // Backgroun color PNGUCOLOR bckgrnd; // Backgroun color
PNGU_u32 numTrans; // Number of transparent colors PNGU_u32 numTrans; // Number of transparent colors
PNGUCOLOR *trans; // Transparent colors PNGUCOLOR *trans; // Transparent colors
} PNGUPROP; } PNGUPROP;
// Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext // Image context, always initialize with SelectImageFrom* and free with ReleaseImageContext
struct _IMGCTX; struct _IMGCTX;
typedef struct _IMGCTX *IMGCTX; typedef struct _IMGCTX *IMGCTX;
/**************************************************************************** /****************************************************************************
* Pixel conversion * * Pixel conversion *
****************************************************************************/ ****************************************************************************/
// Macro to convert RGB8 values to RGB565 // Macro to convert RGB8 values to RGB565
#define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) ) #define PNGU_RGB8_TO_RGB565(r,g,b) ( ((((PNGU_u16) r) & 0xF8U) << 8) | ((((PNGU_u16) g) & 0xFCU) << 3) | (((PNGU_u16) b) >> 3) )
// Macro to convert RGBA8 values to RGB5A3 // Macro to convert RGBA8 values to RGB5A3
#define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \ #define PNGU_RGB8_TO_RGB5A3(r,g,b,a) (PNGU_u16) (((a & 0xE0U) == 0xE0U) ? \
(0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \ (0x8000U | ((((PNGU_u16) r) & 0xF8U) << 7) | ((((PNGU_u16) g) & 0xF8U) << 2) | (((PNGU_u16) b) >> 3)) : \
(((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4))) (((((PNGU_u16) a) & 0xE0U) << 7) | ((((PNGU_u16) r) & 0xF0U) << 4) | (((PNGU_u16) g) & 0xF0U) | ((((PNGU_u16) b) & 0xF0U) >> 4)))
// Function to convert two RGB8 values to YCbYCr // Function to convert two RGB8 values to YCbYCr
PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2); PNGU_u32 PNGU_RGB8_TO_YCbYCr (PNGU_u8 r1, PNGU_u8 g1, PNGU_u8 b1, PNGU_u8 r2, PNGU_u8 g2, PNGU_u8 b2);
// Function to convert an YCbYCr to two RGB8 values. // Function to convert an YCbYCr to two RGB8 values.
void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2); void PNGU_YCbYCr_TO_RGB8 (PNGU_u32 ycbycr, PNGU_u8 *r1, PNGU_u8 *g1, PNGU_u8 *b1, PNGU_u8 *r2, PNGU_u8 *g2, PNGU_u8 *b2);
/**************************************************************************** /****************************************************************************
* Image context handling * * Image context handling *
****************************************************************************/ ****************************************************************************/
// Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing. // Selects a PNG file, previosly loaded into a buffer, and creates an image context for subsequent procesing.
IMGCTX PNGU_SelectImageFromBuffer (const void *buffer); IMGCTX PNGU_SelectImageFromBuffer (const void *buffer);
// Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing. // Selects a PNG file, from any devoptab device, and creates an image context for subsequent procesing.
IMGCTX PNGU_SelectImageFromDevice (const char *filename); IMGCTX PNGU_SelectImageFromDevice (const char *filename);
// Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX. // Frees resources associated with an image context. Always call this function when you no longer need the IMGCTX.
void PNGU_ReleaseImageContext (IMGCTX ctx); void PNGU_ReleaseImageContext (IMGCTX ctx);
/**************************************************************************** /****************************************************************************
* Miscelaneous * * Miscelaneous *
****************************************************************************/ ****************************************************************************/
// Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors. // Retrieves info from selected PNG file, including image dimensions, color format, background and transparency colors.
int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties); int PNGU_GetImageProperties (IMGCTX ctx, PNGUPROP *fileproperties);
/**************************************************************************** /****************************************************************************
* Image conversion * * Image conversion *
****************************************************************************/ ****************************************************************************/
// Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions, // Expands selected image into an YCbYCr buffer. You need to specify context, image dimensions,
// destination address and stride in pixels (stride = buffer width - image width). // destination address and stride in pixels (stride = buffer width - image width).
int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); int PNGU_DecodeToYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
// Macro for decoding an image inside a buffer at given coordinates. // Macro for decoding an image inside a buffer at given coordinates.
#define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ #define PNGU_DECODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
\ \
PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ PNGU_DecodeToYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
(coordX) * 2, (bufferWidth) - (imgWidth)) (coordX) * 2, (bufferWidth) - (imgWidth))
// Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions, // Expands selected image into a linear RGB565 buffer. You need to specify context, image dimensions,
// destination address and stride in pixels (stride = buffer width - image width). // destination address and stride in pixels (stride = buffer width - image width).
int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); int PNGU_DecodeToRGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
// Macro for decoding an image inside a buffer at given coordinates. // Macro for decoding an image inside a buffer at given coordinates.
#define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ #define PNGU_DECODE_TO_COORDS_RGB565(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
\ \
PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ PNGU_DecodeToRGB565 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
(coordX) * 2, (bufferWidth) - (imgWidth)) (coordX) * 2, (bufferWidth) - (imgWidth))
// Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions, // Expands selected image into a linear RGBA8 buffer. You need to specify context, image dimensions,
// destination address, stride in pixels and default alpha value, which is used if the source image // destination address, stride in pixels and default alpha value, which is used if the source image
// doesn't have an alpha channel. // doesn't have an alpha channel.
int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha); int PNGU_DecodeToRGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride, PNGU_u8 default_alpha);
// Macro for decoding an image inside a buffer at given coordinates. // Macro for decoding an image inside a buffer at given coordinates.
#define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \ #define PNGU_DECODE_TO_COORDS_RGBA8(ctx,coordX,coordY,imgWidth,imgHeight,default_alpha,bufferWidth,bufferHeight,buffer) \
\ \
PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ PNGU_DecodeToRGBA8 (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
(coordX) * 2, (bufferWidth) - (imgWidth), default_alpha) (coordX) * 2, (bufferWidth) - (imgWidth), default_alpha)
// Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions // Expands selected image into a 4x4 tiled RGB565 buffer. You need to specify context, image dimensions
// and destination address. // and destination address.
int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer); int PNGU_DecodeTo4x4RGB565 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer);
// Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions, // Expands selected image into a 4x4 tiled RGB5A3 buffer. You need to specify context, image dimensions,
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel. // destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha); int PNGU_DecodeTo4x4RGB5A3 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
// Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions, // Expands selected image into a 4x4 tiled RGBA8 buffer. You need to specify context, image dimensions,
// destination address and default alpha value, which is used if the source image doesn't have an alpha channel. // destination address and default alpha value, which is used if the source image doesn't have an alpha channel.
int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha); int PNGU_DecodeTo4x4RGBA8 (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u8 default_alpha);
// Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to // Encodes an YCbYCr image in PNG format and stores it in the selected device or memory buffer. You need to
// specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width). // specify context, image dimensions, destination address and stride in pixels (stride = buffer width - image width).
int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride); int PNGU_EncodeFromYCbYCr (IMGCTX ctx, PNGU_u32 width, PNGU_u32 height, void *buffer, PNGU_u32 stride);
// Macro for encoding an image stored into an YCbYCr buffer at given coordinates. // Macro for encoding an image stored into an YCbYCr buffer at given coordinates.
#define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \ #define PNGU_ENCODE_TO_COORDS_YCbYCr(ctx,coordX,coordY,imgWidth,imgHeight,bufferWidth,bufferHeight,buffer) \
\ \
PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \ PNGU_EncodeFromYCbYCr (ctx, imgWidth, imgHeight, ((void *) buffer) + (coordY) * (bufferWidth) * 2 + \
(coordX) * 2, (bufferWidth) - (imgWidth)) (coordX) * 2, (bufferWidth) - (imgWidth))
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@ -365,8 +365,8 @@ void Menu_FatDevice(void)
return; return;
err: err:
if(gConfig.fatDeviceIndex >= 0) gConfig.fatDeviceIndex = -1; if(gConfig.fatDeviceIndex >= 0) gConfig.fatDeviceIndex = -1;
WiiLightControl (WII_LIGHT_OFF); WiiLightControl (WII_LIGHT_OFF);
printf("\n"); printf("\n");

View File

@ -1,400 +1,400 @@
/*------------------------------------------------------------- /*-------------------------------------------------------------
usbstorage_starlet.c -- USB mass storage support, inside starlet usbstorage_starlet.c -- USB mass storage support, inside starlet
Copyright (C) 2009 Kwiirk Copyright (C) 2009 Kwiirk
If this driver is linked before libogc, this will replace the original If this driver is linked before libogc, this will replace the original
usbstorage driver by svpe from libogc usbstorage driver by svpe from libogc
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any warranty. In no event will the authors be held liable for any
damages arising from the use of this software. damages arising from the use of this software.
Permission is granted to anyone to use this software for any Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions: redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you 1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required. documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and 2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software. must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source 3. This notice may not be removed or altered from any source
distribution. distribution.
-------------------------------------------------------------*/ -------------------------------------------------------------*/
#include <gccore.h> #include <gccore.h>
#include <malloc.h> #include <malloc.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
/* IOCTL commands */ /* IOCTL commands */
#define UMS_BASE (('U'<<24)|('M'<<16)|('S'<<8)) #define UMS_BASE (('U'<<24)|('M'<<16)|('S'<<8))
#define USB_IOCTL_UMS_INIT (UMS_BASE+0x1) #define USB_IOCTL_UMS_INIT (UMS_BASE+0x1)
#define USB_IOCTL_UMS_GET_CAPACITY (UMS_BASE+0x2) #define USB_IOCTL_UMS_GET_CAPACITY (UMS_BASE+0x2)
#define USB_IOCTL_UMS_READ_SECTORS (UMS_BASE+0x3) #define USB_IOCTL_UMS_READ_SECTORS (UMS_BASE+0x3)
#define USB_IOCTL_UMS_WRITE_SECTORS (UMS_BASE+0x4) #define USB_IOCTL_UMS_WRITE_SECTORS (UMS_BASE+0x4)
#define USB_IOCTL_UMS_READ_STRESS (UMS_BASE+0x5) #define USB_IOCTL_UMS_READ_STRESS (UMS_BASE+0x5)
#define USB_IOCTL_UMS_SET_VERBOSE (UMS_BASE+0x6) #define USB_IOCTL_UMS_SET_VERBOSE (UMS_BASE+0x6)
#define USB_IOCTL_UMS_UNMOUNT (UMS_BASE+0x10) #define USB_IOCTL_UMS_UNMOUNT (UMS_BASE+0x10)
#define USB_IOCTL_UMS_WATCHDOG (UMS_BASE+0x80) #define USB_IOCTL_UMS_WATCHDOG (UMS_BASE+0x80)
#define WBFS_BASE (('W'<<24)|('F'<<16)|('S'<<8)) #define WBFS_BASE (('W'<<24)|('F'<<16)|('S'<<8))
#define USB_IOCTL_WBFS_OPEN_DISC (WBFS_BASE+0x1) #define USB_IOCTL_WBFS_OPEN_DISC (WBFS_BASE+0x1)
#define USB_IOCTL_WBFS_READ_DISC (WBFS_BASE+0x2) #define USB_IOCTL_WBFS_READ_DISC (WBFS_BASE+0x2)
#define USB_IOCTL_WBFS_READ_DEBUG (WBFS_BASE+0x3) #define USB_IOCTL_WBFS_READ_DEBUG (WBFS_BASE+0x3)
#define USB_IOCTL_WBFS_SET_DEVICE (WBFS_BASE+0x4) #define USB_IOCTL_WBFS_SET_DEVICE (WBFS_BASE+0x4)
#define USB_IOCTL_WBFS_SET_FRAGLIST (WBFS_BASE+0x5) #define USB_IOCTL_WBFS_SET_FRAGLIST (WBFS_BASE+0x5)
#define UMS_HEAPSIZE 0x1000 #define UMS_HEAPSIZE 0x1000
/* Variables */ /* Variables */
static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2"; static char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2";
static char fs2[] ATTRIBUTE_ALIGN(32) = "/dev/usb/ehc"; static char fs2[] ATTRIBUTE_ALIGN(32) = "/dev/usb/ehc";
static char fs3[] ATTRIBUTE_ALIGN(32) = "/dev/usb/usb123"; static char fs3[] ATTRIBUTE_ALIGN(32) = "/dev/usb/usb123";
static s32 hid = -1, fd = -1; static s32 hid = -1, fd = -1;
static u32 sector_size; static u32 sector_size;
s32 USBStorage_GetCapacity(u32 *_sector_size) { s32 USBStorage_GetCapacity(u32 *_sector_size) {
if (fd > 0) { if (fd > 0) {
s32 ret; s32 ret;
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", &sector_size); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_GET_CAPACITY, ":i", &sector_size);
if (ret && _sector_size) if (ret && _sector_size)
*_sector_size = sector_size; *_sector_size = sector_size;
return ret; return ret;
} }
return IPC_ENOENT; return IPC_ENOENT;
} }
s32 USBStorage_Init(void) { s32 USBStorage_Init(void) {
s32 ret; s32 ret;
/* Already open */ /* Already open */
if (fd > 0) if (fd > 0)
return 0; return 0;
/* Create heap */ /* Create heap */
if (hid < 0) { if (hid < 0) {
hid = iosCreateHeap(UMS_HEAPSIZE); hid = iosCreateHeap(UMS_HEAPSIZE);
if (hid < 0) if (hid < 0)
return IPC_ENOMEM; return IPC_ENOMEM;
} }
/* Open USB device */ /* Open USB device */
fd = IOS_Open(fs, 0); fd = IOS_Open(fs, 0);
if (fd < 0) if (fd < 0)
fd = IOS_Open(fs2, 0); fd = IOS_Open(fs2, 0);
if (fd < 0) if (fd < 0)
fd = IOS_Open(fs3, 0); fd = IOS_Open(fs3, 0);
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Initialize USB storage */ /* Initialize USB storage */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_INIT, ":"); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_INIT, ":");
if (ret<0) goto err; if (ret<0) goto err;
/* Get device capacity */ /* Get device capacity */
ret = USBStorage_GetCapacity(NULL); ret = USBStorage_GetCapacity(NULL);
if (!ret) if (!ret)
goto err; goto err;
return 0; return 0;
err: err:
/* Close USB device */ /* Close USB device */
if (fd > 0) { if (fd > 0) {
IOS_Close(fd); IOS_Close(fd);
fd = -1; fd = -1;
} }
return -1; return -1;
} }
/** Hermes **/ /** Hermes **/
s32 USBStorage_Watchdog(u32 on_off) { s32 USBStorage_Watchdog(u32 on_off) {
if (fd >= 0) { if (fd >= 0) {
s32 ret; s32 ret;
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WATCHDOG, "i:", on_off); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WATCHDOG, "i:", on_off);
return ret; return ret;
} }
return IPC_ENOENT; return IPC_ENOENT;
} }
s32 USBStorage_Umount(void) { s32 USBStorage_Umount(void) {
if (fd >= 0) { if (fd >= 0) {
s32 ret; s32 ret;
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":"); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_UNMOUNT, ":");
return ret; return ret;
} }
return IPC_ENOENT; return IPC_ENOENT;
} }
void USBStorage_Deinit(void) { void USBStorage_Deinit(void) {
/* Close USB device */ /* Close USB device */
if (fd > 0) { if (fd > 0) {
IOS_Close(fd); IOS_Close(fd);
fd = -1; fd = -1;
} }
} }
s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) { s32 USBStorage_ReadSectors(u32 sector, u32 numSectors, void *buffer) {
// void *buf = (void *)buffer; // void *buf = (void *)buffer;
u32 len = (sector_size * numSectors); u32 len = (sector_size * numSectors);
s32 ret; s32 ret;
/* Device not opened */ /* Device not opened */
if (fd < 0) if (fd < 0)
return fd; return fd;
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, numSectors, buffer, len); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_READ_SECTORS, "ii:d", sector, numSectors, buffer, len);
return ret; return ret;
} }
s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) { s32 USBStorage_WriteSectors(u32 sector, u32 numSectors, const void *buffer) {
u32 len = (sector_size * numSectors); u32 len = (sector_size * numSectors);
s32 ret; s32 ret;
/* Device not opened */ /* Device not opened */
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Write data */ /* Write data */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buffer, len); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_UMS_WRITE_SECTORS, "ii:d", sector, numSectors, buffer, len);
return ret; return ret;
} }
static bool __io_usb_Startup(void) static bool __io_usb_Startup(void)
{ {
return USBStorage_Init() >= 0; return USBStorage_Init() >= 0;
} }
static bool __io_usb_IsInserted(void) static bool __io_usb_IsInserted(void)
{ {
s32 ret; s32 ret;
if (fd < 0) return false; if (fd < 0) return false;
ret = USBStorage_GetCapacity(NULL); ret = USBStorage_GetCapacity(NULL);
if (ret == 0) return false; if (ret == 0) return false;
return true; return true;
} }
bool __io_usb_ReadSectors(u32 sector, u32 count, void *buffer) bool __io_usb_ReadSectors(u32 sector, u32 count, void *buffer)
{ {
s32 ret = USBStorage_ReadSectors(sector, count, buffer); s32 ret = USBStorage_ReadSectors(sector, count, buffer);
return ret > 0; return ret > 0;
} }
bool __io_usb_WriteSectors(u32 sector, u32 count, void *buffer) bool __io_usb_WriteSectors(u32 sector, u32 count, void *buffer)
{ {
s32 ret = USBStorage_WriteSectors(sector, count, buffer); s32 ret = USBStorage_WriteSectors(sector, count, buffer);
return ret > 0; return ret > 0;
} }
static bool __io_usb_ClearStatus(void) static bool __io_usb_ClearStatus(void)
{ {
return true; return true;
} }
static bool __io_usb_Shutdown(void) static bool __io_usb_Shutdown(void)
{ {
// do nothing // do nothing
return true; return true;
} }
static bool __io_usb_NOP(void) static bool __io_usb_NOP(void)
{ {
// do nothing // do nothing
return true; return true;
} }
const DISC_INTERFACE __io_usbstorage_ro = { const DISC_INTERFACE __io_usbstorage_ro = {
DEVICE_TYPE_WII_USB, DEVICE_TYPE_WII_USB,
FEATURE_MEDIUM_CANREAD | FEATURE_WII_USB, FEATURE_MEDIUM_CANREAD | FEATURE_WII_USB,
(FN_MEDIUM_STARTUP) &__io_usb_Startup, (FN_MEDIUM_STARTUP) &__io_usb_Startup,
(FN_MEDIUM_ISINSERTED) &__io_usb_IsInserted, (FN_MEDIUM_ISINSERTED) &__io_usb_IsInserted,
(FN_MEDIUM_READSECTORS) &__io_usb_ReadSectors, (FN_MEDIUM_READSECTORS) &__io_usb_ReadSectors,
(FN_MEDIUM_WRITESECTORS) &__io_usb_NOP, //&__io_usb_WriteSectors, (FN_MEDIUM_WRITESECTORS) &__io_usb_NOP, //&__io_usb_WriteSectors,
(FN_MEDIUM_CLEARSTATUS) &__io_usb_ClearStatus, (FN_MEDIUM_CLEARSTATUS) &__io_usb_ClearStatus,
(FN_MEDIUM_SHUTDOWN) &__io_usb_Shutdown (FN_MEDIUM_SHUTDOWN) &__io_usb_Shutdown
}; };
s32 USBStorage_WBFS_Open(char *buffer) s32 USBStorage_WBFS_Open(char *buffer)
{ {
u32 len = 8; u32 len = 8;
s32 ret; s32 ret;
/* Device not opened */ /* Device not opened */
if (fd < 0) if (fd < 0)
return fd; return fd;
extern u32 wbfs_part_lba; extern u32 wbfs_part_lba;
u32 part = wbfs_part_lba; u32 part = wbfs_part_lba;
/* Read data */ /* Read data */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_OPEN_DISC, "dd:", buffer, len, &part, 4); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_OPEN_DISC, "dd:", buffer, len, &part, 4);
return ret; return ret;
} }
// woffset is in 32bit words, len is in bytes // woffset is in 32bit words, len is in bytes
s32 USBStorage_WBFS_Read(u32 woffset, u32 len, void *buffer) s32 USBStorage_WBFS_Read(u32 woffset, u32 len, void *buffer)
{ {
s32 ret; s32 ret;
USBStorage_Init(); USBStorage_Init();
/* Device not opened */ /* Device not opened */
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Read data */ /* Read data */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_READ_DISC, "ii:d", woffset, len, buffer, len); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_READ_DISC, "ii:d", woffset, len, buffer, len);
return ret; return ret;
} }
s32 USBStorage_WBFS_ReadDebug(u32 off, u32 size, void *buffer) s32 USBStorage_WBFS_ReadDebug(u32 off, u32 size, void *buffer)
{ {
s32 ret; s32 ret;
USBStorage_Init(); USBStorage_Init();
/* Device not opened */ /* Device not opened */
if (fd < 0) if (fd < 0)
return fd; return fd;
/* Read data */ /* Read data */
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_READ_DEBUG, "ii:d", off, size, buffer, size); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_READ_DEBUG, "ii:d", off, size, buffer, size);
return ret; return ret;
} }
s32 USBStorage_WBFS_SetDevice(int dev) s32 USBStorage_WBFS_SetDevice(int dev)
{ {
s32 ret; s32 ret;
static s32 retval = 0; static s32 retval = 0;
retval = 0; retval = 0;
USBStorage_Init(); USBStorage_Init();
// Device not opened // Device not opened
if (fd < 0) return fd; if (fd < 0) return fd;
// ioctl // ioctl
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_SET_DEVICE, "i:i", dev, &retval); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_SET_DEVICE, "i:i", dev, &retval);
if (retval) return retval; if (retval) return retval;
return ret; return ret;
} }
s32 USBStorage_WBFS_SetFragList(void *p, int size) s32 USBStorage_WBFS_SetFragList(void *p, int size)
{ {
s32 ret; s32 ret;
USBStorage_Init(); USBStorage_Init();
// Device not opened // Device not opened
if (fd < 0) return fd; if (fd < 0) return fd;
// ioctl // ioctl
ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_SET_FRAGLIST, "d:", p, size); ret = IOS_IoctlvFormat(hid, fd, USB_IOCTL_WBFS_SET_FRAGLIST, "d:", p, size);
return ret; return ret;
} }
#define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S') #define DEVICE_TYPE_WII_UMS (('W'<<24)|('U'<<16)|('M'<<8)|'S')
bool umsio_Startup() { bool umsio_Startup() {
return USBStorage_Init() == 0; return USBStorage_Init() == 0;
} }
bool umsio_IsInserted() { bool umsio_IsInserted() {
return true; // allways true return true; // allways true
} }
bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer) { bool umsio_ReadSectors(sec_t sector, sec_t numSectors, u8 *buffer) {
u32 cnt = 0; u32 cnt = 0;
s32 ret; s32 ret;
/* Do reads */ /* Do reads */
while (cnt < numSectors) { while (cnt < numSectors) {
u32 sectors = (numSectors - cnt); u32 sectors = (numSectors - cnt);
/* Read sectors is too big */ /* Read sectors is too big */
if (sectors > 32) if (sectors > 32)
sectors = 32; sectors = 32;
/* USB read */ /* USB read */
ret = USBStorage_ReadSectors(sector + cnt, sectors, &buffer[cnt*512]); ret = USBStorage_ReadSectors(sector + cnt, sectors, &buffer[cnt*512]);
if (ret < 0) if (ret < 0)
return false; return false;
/* Increment counter */ /* Increment counter */
cnt += sectors; cnt += sectors;
} }
return true; return true;
} }
bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer) { bool umsio_WriteSectors(sec_t sector, sec_t numSectors, const u8* buffer) {
u32 cnt = 0; u32 cnt = 0;
s32 ret; s32 ret;
/* Do writes */ /* Do writes */
while (cnt < numSectors) { while (cnt < numSectors) {
u32 sectors = (numSectors - cnt); u32 sectors = (numSectors - cnt);
/* Write sectors is too big */ /* Write sectors is too big */
if (sectors > 32) if (sectors > 32)
sectors = 32; sectors = 32;
/* USB write */ /* USB write */
ret = USBStorage_WriteSectors(sector + cnt, sectors, &buffer[cnt * 512]); ret = USBStorage_WriteSectors(sector + cnt, sectors, &buffer[cnt * 512]);
if (ret < 0) if (ret < 0)
return false; return false;
/* Increment counter */ /* Increment counter */
cnt += sectors; cnt += sectors;
} }
return true; return true;
} }
bool umsio_ClearStatus(void) { bool umsio_ClearStatus(void) {
return true; return true;
} }
bool umsio_Shutdown() { bool umsio_Shutdown() {
USBStorage_Deinit(); USBStorage_Deinit();
return true; return true;
} }
const DISC_INTERFACE __io_wiiums = { const DISC_INTERFACE __io_wiiums = {
DEVICE_TYPE_WII_UMS, DEVICE_TYPE_WII_UMS,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB, FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
(FN_MEDIUM_STARTUP) &umsio_Startup, (FN_MEDIUM_STARTUP) &umsio_Startup,
(FN_MEDIUM_ISINSERTED) &umsio_IsInserted, (FN_MEDIUM_ISINSERTED) &umsio_IsInserted,
(FN_MEDIUM_READSECTORS) &umsio_ReadSectors, (FN_MEDIUM_READSECTORS) &umsio_ReadSectors,
(FN_MEDIUM_WRITESECTORS) &umsio_WriteSectors, (FN_MEDIUM_WRITESECTORS) &umsio_WriteSectors,
(FN_MEDIUM_CLEARSTATUS) &umsio_ClearStatus, (FN_MEDIUM_CLEARSTATUS) &umsio_ClearStatus,
(FN_MEDIUM_SHUTDOWN) &umsio_Shutdown (FN_MEDIUM_SHUTDOWN) &umsio_Shutdown
}; };
const DISC_INTERFACE __io_wiiums_ro = { const DISC_INTERFACE __io_wiiums_ro = {
DEVICE_TYPE_WII_UMS, DEVICE_TYPE_WII_UMS,
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB, FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_WII_USB,
(FN_MEDIUM_STARTUP) &umsio_Startup, (FN_MEDIUM_STARTUP) &umsio_Startup,
(FN_MEDIUM_ISINSERTED) &umsio_IsInserted, (FN_MEDIUM_ISINSERTED) &umsio_IsInserted,
(FN_MEDIUM_READSECTORS) &umsio_ReadSectors, (FN_MEDIUM_READSECTORS) &umsio_ReadSectors,
(FN_MEDIUM_WRITESECTORS) &__io_usb_NOP, (FN_MEDIUM_WRITESECTORS) &__io_usb_NOP,
(FN_MEDIUM_CLEARSTATUS) &umsio_ClearStatus, (FN_MEDIUM_CLEARSTATUS) &umsio_ClearStatus,
(FN_MEDIUM_SHUTDOWN) &umsio_Shutdown (FN_MEDIUM_SHUTDOWN) &umsio_Shutdown
}; };

View File

@ -1,9 +1,9 @@
#ifndef _USBSTORAGE_H_ #ifndef _USBSTORAGE_H_
#define _USBSTORAGE_H_ #define _USBSTORAGE_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* Prototypes */ /* Prototypes */
s32 USBStorage_GetCapacity(u32 *); s32 USBStorage_GetCapacity(u32 *);
s32 USBStorage_Init(void); s32 USBStorage_Init(void);
@ -11,7 +11,7 @@ extern "C" {
s32 USBStorage_Watchdog(u32 on_off); s32 USBStorage_Watchdog(u32 on_off);
s32 USBStorage_ReadSectors(u32, u32, void *); s32 USBStorage_ReadSectors(u32, u32, void *);
s32 USBStorage_WriteSectors(u32, u32, const void *); s32 USBStorage_WriteSectors(u32, u32, const void *);
s32 USBStorage_WBFS_Open(char *buf_id); s32 USBStorage_WBFS_Open(char *buf_id);
s32 USBStorage_WBFS_Read(u32 woffset, u32 len, void *buffer); s32 USBStorage_WBFS_Read(u32 woffset, u32 len, void *buffer);
s32 USBStorage_WBFS_ReadDebug(u32 off, u32 size, void *buffer); s32 USBStorage_WBFS_ReadDebug(u32 off, u32 size, void *buffer);
@ -23,5 +23,5 @@ extern "C" {
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif

View File

@ -1,74 +1,74 @@
typedef struct typedef struct
{ {
u8 boot1_hash[20]; u8 boot1_hash[20];
u8 common_key[16]; u8 common_key[16];
u32 ng_id; u32 ng_id;
union { union {
struct { struct {
u8 ng_priv[30]; u8 ng_priv[30];
u8 _wtf1[18]; u8 _wtf1[18];
}; };
struct { struct {
u8 _wtf2[28]; u8 _wtf2[28];
u8 nand_hmac[20]; u8 nand_hmac[20];
}; };
}; };
u8 nand_key[16]; u8 nand_key[16];
u8 rng_key[16]; u8 rng_key[16];
u32 unk1; u32 unk1;
u32 unk2; // 0x00000007 u32 unk2; // 0x00000007
} __attribute__((packed)) otp_t; } __attribute__((packed)) otp_t;
typedef struct typedef struct
{ {
u8 boot2version; u8 boot2version;
u8 unknown1; u8 unknown1;
u8 unknown2; u8 unknown2;
u8 pad; u8 pad;
u32 update_tag; u32 update_tag;
u16 checksum; u16 checksum;
} __attribute__((packed)) eep_ctr_t; } __attribute__((packed)) eep_ctr_t;
typedef struct typedef struct
{ {
union { union {
struct { struct {
u32 ms_id; u32 ms_id;
u32 ca_id; u32 ca_id;
u32 ng_key_id; u32 ng_key_id;
u8 ng_sig[60]; u8 ng_sig[60];
eep_ctr_t counters[2]; eep_ctr_t counters[2];
u8 fill[0x18]; u8 fill[0x18];
u8 korean_key[16]; u8 korean_key[16];
}; };
u8 data[256]; u8 data[256];
}; };
} __attribute__((packed)) seeprom_t; } __attribute__((packed)) seeprom_t;
typedef struct { typedef struct {
char text[0x100]; char text[0x100];
u8 boot1Hash[20]; u8 boot1Hash[20];
u8 commonKey[16]; u8 commonKey[16];
u32 consoleID; u32 consoleID;
union { union {
struct { struct {
u8 privateKey[30]; u8 privateKey[30];
u8 _wtf1[18]; u8 _wtf1[18];
}; };
struct { struct {
u8 _wtf2[28]; u8 _wtf2[28];
u8 nandHmac[20]; u8 nandHmac[20];
}; };
}; };
u8 nandKey[16]; u8 nandKey[16];
u8 rngKey[16]; u8 rngKey[16];
u32 unk1; u32 unk1;
u32 unk2; // 0x00000007 u32 unk2; // 0x00000007
char blank[136]; char blank[136];
u32 ngKeyID; u32 ngKeyID;
u8 ngSig[60]; u8 ngSig[60];
char blank2[440]; char blank2[440];
} keys; } keys;
int keydump(); int keydump();