1 /*---------------------------------------------------------------------*
2 Project:  TexConv
3 File:     main.c
4 
5 Copyright 1998-2001 Nintendo.  All rights reserved.
6 
7 These coded instructions, statements and computer programs contain
8 proprietary information of Nintendo of America Inc. and/or Nintendo
9 Company Ltd., and are protected by Federal copyright law.  They may
10 not be disclosed to third parties or copied or duplicated in any form,
11 in whole or in part, without the prior written consent of Nintendo.
12 
13 Change History:
14 
15  $Log: main.cpp,v $
16  Revision 1.2  2008/05/23 04:16:03  iwai_yuma
17  Improved for handling of VC2005.
18 
19  Revision 1.1  2006/02/17 09:03:29  mitu
20  1st version
21 
22 
23     3     4/11/01 3:19p John
24     Updated header copyrights and pathname.
25 
26     2     12/06/99 2:03p Ryan
27     changed usage guide message
28 
29     1     12/03/99 3:48p Ryan
30 
31     4     10/28/99 10:01p Yasu
32     Change  main() to return by int
33 
34     3     10/12/99 10:19p Howardc
35 
36     2     10/12/99 7:54p Mikepc
37     changed include io.h to input.h.
38     removed (static) batchConvert function.  It now resides in a separate
39     application.
40 
41     1     10/08/99 3:06p Mikepc
42     changed old .c to .cpp extension.  Required for use of tplConv.h
43     prototypes.
44 
45     1     10/08/99 3:01p Mikepc
46     changed old .c extension to .cpp to make this a cpp project.  This was
47     required for inclusion of tplConv.h prototypes
48 
49     9     9/28/99 3:27p Mikepc
50     removed final 'wait until enter key pressed' command in main to assist
51     MaxConv's batch processing.
52 
53     8     9/16/99 8:46p Mikepc
54     removed quick convert command line option
55 
56     7     8/26/99 4:55p Mikepc
57     -changed #include from tplCon.h to tplConv.h
58     - this includes only the top level CreateTplFile and QuickConvert
59     functions
60 
61     6     8/26/99 11:36a Mikepc
62 
63     5     8/26/99 11:06a Mikepc
64     added batch file processing option to main
65 
66  $NoKeywords: $
67 
68 -----------------------------------------------------------------------*/
69 
70 #include <stdio.h>
71 #include <stdlib.h>
72 #include <string.h>
73 #include <ctype.h>
74 
75 #include <charPipeline/tc.h>
76 #include "input.h"
77 #include "tga.h"
78 
79 //---------------------------------------------------------------------
80 
main(int argc,char ** argv)81 int main(int argc, char** argv)
82 {
83 
84 	char         srcTxtFile[ SRC_TXT_FILE_SIZE ];
85 	char         dstTplFile[ DST_TPL_FILE_SIZE ];
86 	unsigned int done = IO_NOT_DONE;
87 
88 
89 	// install user-defined function to read tga files
90 	TCSetFileCacheSize( 1 );
91 	TCInstallFileReadFn( "TGA", ReadTgaFile );
92 
93 
94 	if(argc == 1)
95 	{
96 		// get source, dest file names from user input, check for a 'quick script'
97 		if( (done = GetFileNames( srcTxtFile, dstTplFile )) == IO_QUIT )
98 		{
99 			printf("program terminated at user's request.\n");
100 			return 1;
101 		}
102 
103 		TCCreateTplFile( srcTxtFile, dstTplFile);
104 		printf("created tpl %s\n\n", dstTplFile );
105 	}
106 
107 	else if(argc == 3)
108 	{
109 		// get source, dest file names from argv
110         strncpy_s( srcTxtFile, 255, argv[1], strlen( argv[1] ) );
111         strncpy_s( dstTplFile, 255, argv[2], strlen( argv[2] ) );
112 //		strcpy(srcTxtFile, argv[1] );
113 //		strcpy(dstTplFile, argv[2] );
114 
115 		TCCreateTplFile( srcTxtFile, dstTplFile);
116 		printf("created tpl %s\n\n", dstTplFile );
117 	}
118 	else
119 	{
120 		//printf( "error: tc requires 1 or 3 command line args to run.\n" );
121 
122 		printf( "\nTexConv [ScriptFile] [OutputFile]\n" );
123 		printf( "   ScriptFile\tfull path to conversion script file\n" );
124 		printf( "   OutputFile\tfull path to destination TPL file\n" );
125 
126 		return 2;
127 	}
128 
129 	return 0;
130 }
131 
132 //--------------------------------------------------------------------
133