1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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.
*
*/
/*
* This code is based on original Soltys source code
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
#include "cge/startup.h"
#include "cge/text.h"
#include "cge/sound.h"
#include "cge/cfile.h"
#include "cge/snddrv.h"
namespace CGE {
extern char _copr[];
#define id (*(Ident*)_copr)
Emm _miniEmm = MINI_EMM_SIZE;
// static Startup _startUp;
int Startup::_mode = 0;
int Startup::_core;
int Startup::_soundOk = 0;
uint16 Startup::_summa;
void quitNow(int ref) {
error("%s", _text->getText(ref));
}
bool Startup::getParms() {
_summa = 0;
/*
int i = _argc;
while (i > 1)
{
static char *PrmTab[] = { "NEW", "MK0SVG", "QUIET", "SB", "GUS", "MIDI",
"P", "D", "I", "M" };
int n = takeEnum(PrmTab, strtok(_argv[--i], " =:("));
uint16 p = xtow(strtok(NULL, " h,)"));
switch (n)
{
case 0 : if (Mode != 2) Mode = 1; break;
case 1 : Mode = 2; break;
case 2 : SNDDrvInfo.DDEV = DEV_QUIET; break;
case 3 : SNDDrvInfo.DDEV = DEV_SB; break;
case 4 : SNDDrvInfo.DDEV = DEV_GUS; break;
case 5 : SNDDrvInfo.MDEV = DEV_GM; break;
case 6 : SNDDrvInfo.DBASE = p; break;
case 7 : SNDDrvInfo.DDMA = p; break;
case 8 : SNDDrvInfo.DIRQ = p; break;
case 9 : SNDDrvInfo.MBASE = p;
SNDDrvInfo.MDEV = DEV_GM; break;
default: return false;
}
if (n >= 2) SoundOk = 2;
}
#ifdef DEMO
// protection disabled
Summa = 0;
#else
#ifdef EVA
{
union { dosdate_t d; uint32 n; } today;
_dos_getdate(&today.d);
id.disk += (id.disk < today.n);
}
#endif
#ifdef CD
Summa = 0;
#else
// disk signature checksum
Summa = ChkSum(Copr, sizeof(Ident));
#endif
#endif
if (SNDDrvInfo.MDEV != DEV_GM) SNDDrvInfo.MDEV = SNDDrvInfo.DDEV;
return true;
*/
warning("STUB: Startup::get_parms");
return true;
}
Startup::Startup() {
/*
uint32 m = farcoreleft() >> 10;
if (m < 0x7FFF)
Core = (int) m;
else
Core = 0x7FFF;
if (! IsVga())
quit_now(NOT_VGA_TEXT);
if (Cpu() < _80286)
quit_now(BAD_CHIP_TEXT);
if (100 * _osmajor + _osminor < 330)
quit_now(BAD_DOS_TEXT);
if (! get_parms())
quit_now(BAD_ARG_TEXT);
//--- load sound configuration
const char * fn = usrPath(ProgName(CFG_EXT));
if (!Startup::_soundOk && CFILE::Exist(fn)) {
CFILE cfg(fn, REA);
if (! cfg.Error) {
cfg.Read(&SNDDrvInfo, sizeof(SNDDrvInfo)-sizeof(SNDDrvInfo.VOL2));
if (! cfg.Error)
Startup::_soundOk = 1;
}
}
*/
warning("STUB: Startup::Startup");
}
const char *usrPath(const char *nam) {
static char buf[MAXPATH] = ".\\", *p = buf + 2;
#if defined(CD)
if (DriveCD(0)) {
bool ok = false;
CFILE ini = Text[CDINI_FNAME];
if (!ini.Error) {
char *key = Text[GAME_ID];
int i = strlen(key);
while (ini.Read(buf) && !ok) {
int j = strlen(buf);
if (j)
if (buf[--j] == '\n')
buf[j] = '\0';
if (scumm_strnicmp((const char *) buf, (const char*) key, i) == 0)
ok = true;
}
if (ok) {
strcpy(buf, buf + i);
p = buf + strlen(buf);
if (*(p - 1) != '\\')
*(p++) = '\\';
strcpy(p, "NUL");
if (_dos_open(buf, 0, &i) == 0)
_dos_close(i);
else
ok = false;
}
}
if (!ok)
quit_now(BADCD_TEXT);
}
#endif
strcpy(p, nam);
return buf;
}
} // End of namespace CGE
|