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