mirror of
https://github.com/rvtr/TwlIPL.git
synced 2025-10-31 06:01:12 -04:00
git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@402 b08762b0-b915-fc4b-9d8c-17b2551a87ff
112 lines
3.1 KiB
C
112 lines
3.1 KiB
C
/*---------------------------------------------------------------------------*
|
|
Project: TwlFirm - tools - makegcdfirm
|
|
File: makegcdfirm.c
|
|
|
|
Copyright 2007 Nintendo. All rights reserved.
|
|
|
|
These coded instructions, statements, and computer programs contain
|
|
proprietary information of Nintendo of America Inc. and/or Nintendo
|
|
Company Ltd., and are protected by Federal copyright law. They may
|
|
not be disclosed to third parties or copied or duplicated in any form,
|
|
in whole or in part, without the prior written consent of Nintendo.
|
|
|
|
$Date:: 2007-09-06$
|
|
$Rev$
|
|
$Author$
|
|
*---------------------------------------------------------------------------*/
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h> // strcasecmp()
|
|
#include <getopt.h> // getopt()
|
|
#include "makegcdfirm.h"
|
|
#include "format_rom.h"
|
|
#include "path.h"
|
|
#include "defval.h"
|
|
#include "version.h"
|
|
|
|
static int makegcdfirm(const char *specFile, const char *norFile, const char *rhFile);
|
|
|
|
//---------------------------------------------------------------------------
|
|
// Main
|
|
//---------------------------------------------------------------------------
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
int n;
|
|
int narg;
|
|
char *gcdfirmFile;
|
|
char *rhFile = NULL;
|
|
|
|
InitAppName(argv[0]);
|
|
|
|
while ((n = getopt(argc, argv, "D:hvt:pd")) != -1)
|
|
{
|
|
switch (n)
|
|
{
|
|
case 'h':
|
|
case 'v':
|
|
goto usage;
|
|
|
|
case 'D':
|
|
AddDefVal(optarg);
|
|
break;
|
|
|
|
case 't':
|
|
rhFile = optarg;
|
|
break;
|
|
|
|
case 'p':
|
|
PrintMode = TRUE;
|
|
break;
|
|
|
|
case 'd':
|
|
DebugMode = TRUE;
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
narg = argc - optind;
|
|
if (narg > 0)
|
|
{
|
|
// Make SpecFile->GcdfirmFile
|
|
gcdfirmFile =
|
|
strdup(narg >
|
|
1 ? argv[optind + 1] : ChangeSuffix(argv[optind], DEFAULT_NORFIRM_SUFFIX));
|
|
return makegcdfirm(argv[optind], gcdfirmFile, rhFile);
|
|
}
|
|
|
|
usage:
|
|
{
|
|
char *makegcdfirm = GetAppName();
|
|
|
|
fprintf(stderr,
|
|
"NITRO-SDK Development Tool - %s - Make gcdfirm file \n"
|
|
"Build %lu\n\n"
|
|
"Usage: %s [-phv] [-tROMHEADERFILE] [-DNAME=VALUE ...] SPECFILE [NORFIRMFILE]\n\n",
|
|
makegcdfirm, SDK_DATE_OF_LATEST_FILE, makegcdfirm);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
// makegcdfirm
|
|
//---------------------------------------------------------------------------
|
|
|
|
static int makegcdfirm(const char *specFile, const char *norFile, const char *rhFile)
|
|
{
|
|
debug_printf("makegcdfirm(): '%s' -> '%s'\n", specFile, norFile);
|
|
|
|
// Check identical
|
|
if (specFile && norFile && !strcasecmp(specFile, norFile))
|
|
{
|
|
error("gcdfirm spec file is identical '%s'", norFile);
|
|
return 1;
|
|
}
|
|
|
|
return OutputGcdfirmFile(specFile, norFile, rhFile) ? 0 : 1;
|
|
}
|