/[projet1]/public/pc/tools/oric/Bin2Tap/CommandLine.cpp
Defence Force logotype

Contents of /public/pc/tools/oric/Bin2Tap/CommandLine.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 315 - (show annotations)
Tue Apr 27 13:27:38 2010 UTC (9 years, 6 months ago) by Vampire
File size: 2551 byte(s)


1 #include "StdAfx.h"
2 #include "CommandLine.h"
3
4 CCommandLine::CCommandLine(void)
5 {
6 m_BitFormat = eBF_8Bit;
7 m_SampleRate = eSR_10000;
8 m_AutoRun = false;
9 m_TapeExport = false;
10 }
11
12 CCommandLine::~CCommandLine(void)
13 {
14 }
15
16 void CCommandLine::Usage( void)
17 {
18 _tprintf(_T("Bin2Wav V1.0a by Paul Carpenter (Vampire^TZT)\n"));
19 _tprintf(_T("Usage:\n"));
20 _tprintf(_T(" Bin2Wav [-a] [-w] [-8bit|-16bit] [-4k|-9K|-44k|-48k] [-o <outname>] <o68file>\n\n"));
21 _tprintf(_T(" -a - Enable binary autorun\n\n"));
22 _tprintf(_T(" -w - Output a .WAV (8bit,10k)\n\n"));
23 _tprintf(_T(" -8bit|-16bit - Select a bit depth (implies -w)\n\n"));
24 _tprintf(_T(" -4k|-10K|-44k|-48k - Select a wave frequency (implies -w)\n\n"));
25 _tprintf(_T(" -o <filename> - Specify an output filename\n\n"));
26 }
27
28 bool CCommandLine::Parse( int argc, TCHAR* argv[])
29 {
30 CStringArray args;
31
32 bool args_good = true;
33
34 // We default to tape now unless a wave switch is added
35 m_TapeExport = true;
36
37 for ( int i = 1; i < argc; i++)
38 {
39 if ( argv[i][0] == '-' ||
40 argv[i][0] == '/')
41 {
42 if ( CString(argv[i]).CompareNoCase( _T("-a")) == 0)
43 {
44 m_AutoRun = true;
45 }
46 else if ( CString(argv[i]).CompareNoCase( _T("-w")) == 0)
47 {
48 m_TapeExport = false;
49 }
50 else if ( CString(argv[i]).CompareNoCase( _T("-8bit")) == 0)
51 {
52 m_BitFormat = eBF_8Bit;
53 m_TapeExport = false;
54 }
55 else if ( CString(argv[i]).CompareNoCase( _T("-16bit")) == 0)
56 {
57 m_BitFormat = eBF_16Bit;
58 m_TapeExport = false;
59 }
60 else if ( CString(argv[i]).CompareNoCase( _T("-4k")) == 0)
61 {
62 m_SampleRate = eSR_4800;
63 m_TapeExport = false;
64 }
65 else if ( CString(argv[i]).CompareNoCase( _T("-10k")) == 0)
66 {
67 m_SampleRate = eSR_10000;
68 m_TapeExport = false;
69 }
70 else if ( CString(argv[i]).CompareNoCase( _T("-44k")) == 0)
71 {
72 m_SampleRate = eSR_44100;
73 m_TapeExport = false;
74 }
75 else if ( CString(argv[i]).CompareNoCase( _T("-48k")) == 0)
76 {
77 m_SampleRate = eSR_48000;
78 m_TapeExport = false;
79 }
80 else if ( CString(argv[i]).CompareNoCase( _T("-o")) == 0)
81 {
82 i++;
83 if ( i == argc)
84 {
85 args_good = false;
86 break;
87 }
88 m_OutputName = argv[i];
89 }
90 else
91 {
92 args_good = false;
93 break;
94 }
95 }
96 else
97 {
98 args.Add( argv[i]);
99 }
100 }
101
102 if ( args.GetCount() != 1 || !args_good)
103 {
104 Usage();
105
106 return false;
107 }
108
109 m_InputName = args[0];
110
111 return true;
112 }
113

  ViewVC Help
Powered by ViewVC 1.1.26