mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-09-17 04:14:15 +00:00
Add support for converting Nintendo GameCube/Wii images: implement convert-ngcw command and usage
This commit is contained in:
@@ -38,10 +38,14 @@ add_executable(aaruformattool
|
||||
wiiu/convert.c
|
||||
wiiu/reader.c
|
||||
wiiu/reader.h
|
||||
ngcw/convert.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/lib/aes128.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/ps3/ps3_crypto.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/ps3/ps3_encryption_map.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/wiiu/wiiu_crypto.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/ngcw/lfg.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/ngcw/ngcw_junk.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src/ngcw/wii_crypto.c
|
||||
termbox2.h
|
||||
)
|
||||
|
||||
|
||||
@@ -46,5 +46,6 @@ int inject_media_tag(const char *tag_type, const char *media_tag_file, c
|
||||
int convert_ps3(const char *input_path, const char *output_path, const char *disc_key_hex, const char *data1_key_hex,
|
||||
const char *ird_path);
|
||||
int convert_wiiu(const char *input_path, const char *output_path, const char *disc_key_hex);
|
||||
int convert_ngcw(const char *input_path, const char *output_path);
|
||||
|
||||
#endif // LIBAARUFORMAT_TOOL_AARUFORMATTOOL_H_
|
||||
|
||||
@@ -266,6 +266,26 @@ int cmd_convert_wiiu(int argc, char *argv[])
|
||||
return result;
|
||||
}
|
||||
|
||||
int cmd_convert_ngcw(int argc, char *argv[])
|
||||
{
|
||||
struct arg_str *input_filename = arg_str1(NULL, NULL, "<input>", "Input ISO or AaruFormat image");
|
||||
struct arg_str *output_filename = arg_str1(NULL, NULL, "<output>", "Output AaruFormat image");
|
||||
struct arg_end *end = arg_end(10);
|
||||
void *argtable[] = {input_filename, output_filename, end};
|
||||
|
||||
if(arg_parse(argc, argv, argtable) > 0)
|
||||
{
|
||||
arg_print_errors(stderr, end, "convert-ngcw");
|
||||
usage_convert_ngcw();
|
||||
arg_freetable(argtable, sizeof(argtable) / sizeof(argtable[0]));
|
||||
return -1;
|
||||
}
|
||||
|
||||
const int result = convert_ngcw(input_filename->sval[0], output_filename->sval[0]);
|
||||
arg_freetable(argtable, sizeof(argtable) / sizeof(argtable[0]));
|
||||
return result;
|
||||
}
|
||||
|
||||
Command commands[] = {
|
||||
{ "identify", cmd_identify},
|
||||
{ "info", cmd_info},
|
||||
@@ -280,6 +300,7 @@ Command commands[] = {
|
||||
{ "inject-media-tag", cmd_inject_media_tag},
|
||||
{ "convert-ps3", cmd_convert_ps3},
|
||||
{ "convert-wiiu", cmd_convert_wiiu},
|
||||
{ "convert-ngcw", cmd_convert_ngcw},
|
||||
};
|
||||
|
||||
const size_t num_commands = sizeof(commands) / sizeof(commands[0]);
|
||||
|
||||
@@ -44,5 +44,6 @@ int cmd_convert(int argc, char *argv[]);
|
||||
int cmd_upgrade_ddt_to_alpha21(int argc, char *argv[]);
|
||||
int cmd_inject_media_tag(int argc, char *argv[]);
|
||||
int cmd_convert_ps3(int argc, char *argv[]);
|
||||
int cmd_convert_ngcw(int argc, char *argv[]);
|
||||
|
||||
#endif // LIBAARUFORMAT_COMMANDS_H
|
||||
|
||||
34
tool/ngcw/convert.c
Normal file
34
tool/ngcw/convert.c
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of the Aaru Data Preservation Suite.
|
||||
* Copyright (c) 2019-2026 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; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* convert-ngcw command: converts Nintendo GameCube/Wii disc ISO or AaruFormat
|
||||
* images to AaruFormat with decrypted sector storage and junk removal.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "../aaruformattool.h"
|
||||
|
||||
int convert_ngcw(const char *input_path, const char *output_path)
|
||||
{
|
||||
(void)input_path;
|
||||
(void)output_path;
|
||||
|
||||
fprintf(stderr, "convert-ngcw: not yet implemented\n");
|
||||
return -1;
|
||||
}
|
||||
15
tool/usage.c
15
tool/usage.c
@@ -40,6 +40,7 @@ void usage()
|
||||
printf(" convert Converts an AaruFormat image to another AaruFormat image.\n");
|
||||
printf(" convert-ps3 Converts a PS3 disc image to AaruFormat with decrypted storage.\n");
|
||||
printf(" convert-wiiu Converts a Wii U disc image to AaruFormat with decrypted storage.\n");
|
||||
printf(" convert-ngcw Converts a GameCube/Wii disc image to AaruFormat.\n");
|
||||
printf(" identify Identifies if the indicated file is a supported AaruFormat image.\n");
|
||||
printf(" info Prints information about a given AaruFormat image.\n");
|
||||
printf(" inject-media-tag Injects a media tag into an AaruFormat image.\n");
|
||||
@@ -199,3 +200,17 @@ void usage_convert_wiiu()
|
||||
printf(" 2. Sidecar files: <input>.disckey, <input>.key\n");
|
||||
printf(" 3. Source AaruFormat image media tags\n");
|
||||
}
|
||||
|
||||
void usage_convert_ngcw()
|
||||
{
|
||||
printf("\nUsage:\n");
|
||||
printf(" aaruformattool convert-ngcw <input> <output>\n\n");
|
||||
printf("Converts a Nintendo GameCube or Wii disc ISO or AaruFormat image to an\n");
|
||||
printf("AaruFormat image with decrypted sectors (Wii) and junk regions removed.\n\n");
|
||||
printf("Arguments:\n");
|
||||
printf(" <input> Path to input ISO or AaruFormat image.\n");
|
||||
printf(" <output> Path to output AaruFormat image.\n\n");
|
||||
printf("The disc type (GameCube or Wii) is auto-detected from the disc header.\n");
|
||||
printf("Wii common keys are hardcoded; no key arguments are needed.\n");
|
||||
printf("A .bca sidecar file will be imported if found alongside the input.\n");
|
||||
}
|
||||
|
||||
@@ -35,5 +35,6 @@ void usage_upgrade_ddt_to_alpha21();
|
||||
void usage_inject_media_tag();
|
||||
void usage_convert_ps3();
|
||||
void usage_convert_wiiu();
|
||||
void usage_convert_ngcw();
|
||||
|
||||
#endif // LIBAARUFORMAT_USAGE_H
|
||||
|
||||
Reference in New Issue
Block a user