Debian Codegraph @

src/dosbox.cpp

raw symbols SCIP
1 /*
2 * Copyright (C) 2002-2010 The DOSBox Team
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18
19 /* $Id: dosbox.cpp,v 1.150 2009-11-03 20:17:42 qbix79 Exp $ */
20
21 #include <stdlib.h>
22 #include <stdarg.h>
23 #include <stdio.h>
24 #include <string.h>
25 #include <unistd.h>
26 #include "dosbox.h"
27 #include "debug.h"
28 #include "cpu.h"
29 #include "video.h"
30 #include "pic.h"
31 #include "cpu.h"
32 #include "callback.h"
33 #include "inout.h"
34 #include "mixer.h"
35 #include "timer.h"
36 #include "dos_inc.h"
37 #include "setup.h"
38 #include "control.h"
39 #include "cross.h"
40 #include "programs.h"
41 #include "support.h"
42 #include "mapper.h"
43 #include "ints/int10.h"
44 #include "render.h"
45
46 Config * control;
47 MachineType machine;
48 SVGACards svgaCard;
49
50 /* The whole load of startups for all the subfunctions */
51 void MSG_Init(Section_prop *);
52 void LOG_StartUp(void);
53 void MEM_Init(Section *);
54 void PAGING_Init(Section *);
55 void IO_Init(Section * );
56 void CALLBACK_Init(Section*);
57 void PROGRAMS_Init(Section*);
58 //void CREDITS_Init(Section*);
59 void RENDER_Init(Section*);
60 void VGA_Init(Section*);
61
62 void DOS_Init(Section*);
63
64
65 void CPU_Init(Section*);
66
67 #if C_FPU
68 void FPU_Init(Section*);
69 #endif
70
71 void DMA_Init(Section*);
72
73 void MIXER_Init(Section*);
74 void MIDI_Init(Section*);
75 void HARDWARE_Init(Section*);
76
77
78 void KEYBOARD_Init(Section*); //TODO This should setup INT 16 too but ok ;)
79 void JOYSTICK_Init(Section*);
80 void MOUSE_Init(Section*);
81 void SBLASTER_Init(Section*);
82 void GUS_Init(Section*);
83 void MPU401_Init(Section*);
84 void PCSPEAKER_Init(Section*);
85 void TANDYSOUND_Init(Section*);
86 void DISNEY_Init(Section*);
87 void SERIAL_Init(Section*);
88
89
90 #if C_IPX
91 void IPX_Init(Section*);
92 #endif
93
94 void SID_Init(Section* sec);
95
96 void PIC_Init(Section*);
97 void TIMER_Init(Section*);
98 void BIOS_Init(Section*);
99 void DEBUG_Init(Section*);
100 void CMOS_Init(Section*);
101
102 void MSCDEX_Init(Section*);
103 void DRIVES_Init(Section*);
104 void CDROM_Image_Init(Section*);
105
106 /* Dos Internal mostly */
107 void EMS_Init(Section*);
108 void XMS_Init(Section*);
109
110 void DOS_KeyboardLayout_Init(Section*);
111
112 void AUTOEXEC_Init(Section*);
113 void SHELL_Init(void);
114
115 void INT10_Init(Section*);
116
117 static LoopHandler * loop;
118
119 bool SDLNetInited;
120
121 static Bit32u ticksRemain;
122 static Bit32u ticksLast;
123 static Bit32u ticksAdded;
124 Bit32s ticksDone;
125 Bit32u ticksScheduled;
126 bool ticksLocked;
127 void increaseticks();
128
129 static Bitu Normal_Loop(void) {
130 Bits ret;
131 while (1) {
132 if (PIC_RunQueue()) {
133 ret = (*cpudecoder)();
134 if (GCC_UNLIKELY(ret<0)) return 1;
135 if (ret>0) {
136 if (GCC_UNLIKELY(ret >= CB_MAX)) return 0;
137 Bitu blah = (*CallBack_Handlers[ret])();
138 if (GCC_UNLIKELY(blah)) return blah;
139 }
140 #if C_DEBUG
141 if (DEBUG_ExitLoop()) return 0;
142 #endif
143 } else {
144 GFX_Events();
145 if (ticksRemain>0) {
146 TIMER_AddTick();
147 ticksRemain--;
148 } else {increaseticks();return 0;}
149 }
150 }
151 }
152
153 //For trying other delays
154 #define wrap_delay(a) SDL_Delay(a)
155
156 void increaseticks() { //Make it return ticksRemain and set it in the function above to remove the global variable.
157 if (GCC_UNLIKELY(ticksLocked)) { // For Fast Forward Mode
158 ticksRemain=5;
159 /* Reset any auto cycle guessing for this frame */
160 ticksLast = GetTicks();
161 ticksAdded = 0;
162 ticksDone = 0;
163 ticksScheduled = 0;
164 return;
165 }
166
167 static Bit32s lastsleepDone = -1;
168 static Bitu sleep1count = 0;
169
170 Bit32u ticksNew;
171 ticksNew = GetTicks();
172 ticksScheduled += ticksAdded;
173 if (ticksNew <= ticksLast) { //lower should not be possible, only equal.
174 ticksAdded = 0;
175
176 if (!CPU_CycleAutoAdjust || CPU_SkipCycleAutoAdjust || sleep1count < 3) {
177 wrap_delay(1);
178 } else {
179 /* Certain configurations always give an exact sleepingtime of 1, this causes problems due to the fact that
180 dosbox keeps track of full blocks.
181 This code introduces some randomness to the time slept, which improves stability on those configurations
182 */
183 static const Bit32u sleeppattern[] = { 2, 2, 3, 2, 2, 4, 2};
184 static Bit32u sleepindex = 0;
185 if (ticksDone != lastsleepDone) sleepindex = 0;
186 wrap_delay(sleeppattern[sleepindex++]);
187 sleepindex %= sizeof(sleeppattern) / sizeof(sleeppattern[0]);
188 }
189 Bit32s timeslept = GetTicks() - ticksNew;
190 // Count how many times in the current block (of 250 ms) the time slept was 1 ms
191 if (CPU_CycleAutoAdjust && !CPU_SkipCycleAutoAdjust && timeslept == 1) sleep1count++;
192 lastsleepDone = ticksDone;
193
194 // Update ticksDone with the time spent sleeping
195 ticksDone -= timeslept;
196 if (ticksDone < 0)
197 ticksDone = 0;
198 return; //0
199
200 // If we do work this tick and sleep till the next tick, then ticksDone is decreased,
201 // despite the fact that work was done as well in this tick. Maybe make it depend on an extra parameter.
202 // What do we know: ticksRemain = 0 (condition to enter this function)
203 // ticksNew = time before sleeping
204
205 // maybe keep track of sleeped time in this frame, and use sleeped and done as indicators. (and take care of the fact there
206 // are frames that have both.
207 }
208
209 //TicksNew > ticksLast
210 ticksRemain = ticksNew-ticksLast;
211 ticksLast = ticksNew;
212 ticksDone += ticksRemain;
213 if ( ticksRemain > 20 ) {
214 // LOG(LOG_MISC,LOG_ERROR)("large remain %d",ticksRemain);
215 ticksRemain = 20;
216 }
217 ticksAdded = ticksRemain;
218
219 // Is the system in auto cycle mode guessing ? If not just exit. (It can be temporary disabled)
220 if (!CPU_CycleAutoAdjust || CPU_SkipCycleAutoAdjust) return;
221
222 if (ticksScheduled >= 250 || ticksDone >= 250 || (ticksAdded > 15 && ticksScheduled >= 5) ) {
223 if(ticksDone < 1) ticksDone = 1; // Protect against div by zero
224 /* ratio we are aiming for is around 90% usage*/
225 Bit32s ratio = (ticksScheduled * (CPU_CyclePercUsed*90*1024/100/100)) / ticksDone;
226 Bit32s new_cmax = CPU_CycleMax;
227 Bit64s cproc = (Bit64s)CPU_CycleMax * (Bit64s)ticksScheduled;
228 double ratioremoved = 0.0; //increase scope for logging
229 if (cproc > 0) {
230 /* ignore the cycles added due to the IO delay code in order
231 to have smoother auto cycle adjustments */
232 ratioremoved = (double) CPU_IODelayRemoved / (double) cproc;
233 if (ratioremoved < 1.0) {
234 double ratio_not_removed = 1 - ratioremoved;
235 ratio = (Bit32s)((double)ratio * ratio_not_removed);
236
237 /* Don't allow very high ratio which can cause us to lock as we don't scale down
238 * for very low ratios. High ratio might result because of timing resolution */
239 if (ticksScheduled >= 250 && ticksDone < 10 && ratio > 16384)
240 ratio = 16384;
241
242 // Limit the ratio even more when the cycles are already way above the realmode default.
243 if (ticksScheduled >= 250 && ticksDone < 10 && ratio > 5120 && CPU_CycleMax > 50000)
244 ratio = 5120;
245
246 // When downscaling multiple times in a row, ensure a minimum amount of downscaling
247 if (ticksAdded > 15 && ticksScheduled >= 5 && ticksScheduled <= 20 && ratio > 800)
248 ratio = 800;
249
250 if (ratio <= 1024) {
251 // ratio_not_removed = 1.0; //enabling this restores the old formula
252 double r = (1.0 + ratio_not_removed) /(ratio_not_removed + 1024.0/(static_cast<double>(ratio)));
253 new_cmax = 1 + static_cast<Bit32s>(CPU_CycleMax * r);
254 } else {
255 Bit64s ratio_with_removed = (Bit64s) ((((double)ratio - 1024.0) * ratio_not_removed) + 1024.0);
256 Bit64s cmax_scaled = (Bit64s)CPU_CycleMax * ratio_with_removed;
257 new_cmax = (Bit32s)(1 + (CPU_CycleMax >> 1) + cmax_scaled / (Bit64s)2048);
258 }
259 }
260 }
261
262 if (new_cmax < CPU_CYCLES_LOWER_LIMIT)
263 new_cmax = CPU_CYCLES_LOWER_LIMIT;
264 /*
265 LOG(LOG_MISC,LOG_ERROR)("cyclelog: current %06d cmax %06d ratio %05d done %03d sched %03d Add %d rr %4.2f",
266 CPU_CycleMax,
267 new_cmax,
268 ratio,
269 ticksDone,
270 ticksScheduled,
271 ticksAdded,
272 ratioremoved);
273 */
274
275 /* ratios below 1% are considered to be dropouts due to
276 temporary load imbalance, the cycles adjusting is skipped */
277 if (ratio > 10) {
278 /* ratios below 12% along with a large time since the last update
279 has taken place are most likely caused by heavy load through a
280 different application, the cycles adjusting is skipped as well */
281 if ((ratio > 120) || (ticksDone < 700)) {
282 CPU_CycleMax = new_cmax;
283 if (CPU_CycleLimit > 0) {
284 if (CPU_CycleMax > CPU_CycleLimit) CPU_CycleMax = CPU_CycleLimit;
285 } else if (CPU_CycleMax > 2000000) CPU_CycleMax = 2000000; //Hardcoded limit, if no limit was specified.
286 }
287 }
288
289 //Reset cycleguessing parameters.
290 CPU_IODelayRemoved = 0;
291 ticksDone = 0;
292 ticksScheduled = 0;
293 lastsleepDone = -1;
294 sleep1count = 0;
295 } else if (ticksAdded > 15) {
296 /* ticksAdded > 15 but ticksScheduled < 5, lower the cycles
297 but do not reset the scheduled/done ticks to take them into
298 account during the next auto cycle adjustment */
299 CPU_CycleMax /= 3;
300 if (CPU_CycleMax < CPU_CYCLES_LOWER_LIMIT)
301 CPU_CycleMax = CPU_CYCLES_LOWER_LIMIT;
302 } //if (ticksScheduled >= 250 || ticksDone >= 250 || (ticksAdded > 15 && ticksScheduled >= 5) )
303 }
304
305 void DOSBOX_SetLoop(LoopHandler * handler) {
306 loop=handler;
307 }
308
309 void DOSBOX_SetNormalLoop() {
310 loop=Normal_Loop;
311 }
312
313 void DOSBOX_RunMachine(void){
314 Bitu ret;
315 do {
316 ret=(*loop)();
317 } while (!ret);
318 }
319
320 static void DOSBOX_UnlockSpeed( bool pressed ) {
321 static bool autoadjust = false;
322 if (pressed) {
323 LOG_MSG("Fast Forward ON");
324 ticksLocked = true;
325 if (CPU_CycleAutoAdjust) {
326 autoadjust = true;
327 CPU_CycleAutoAdjust = false;
328 CPU_CycleMax /= 3;
329 if (CPU_CycleMax<1000) CPU_CycleMax=1000;
330 }
331 } else {
332 LOG_MSG("Fast Forward OFF");
333 ticksLocked = false;
334 if (autoadjust) {
335 autoadjust = false;
336 CPU_CycleAutoAdjust = true;
337 }
338 }
339 }
340
341 static void DOSBOX_RealInit(Section * sec) {
342 Section_prop * section=static_cast<Section_prop *>(sec);
343 /* Initialize some dosbox internals */
344
345 ticksRemain=0;
346 ticksLast=GetTicks();
347 ticksLocked = false;
348 DOSBOX_SetLoop(&Normal_Loop);
349 MSG_Init(section);
350
351 MAPPER_AddHandler(DOSBOX_UnlockSpeed, MK_f12, MMOD2,"speedlock","Speedlock");
352 std::string cmd_machine;
353 if (control->cmdline->FindString("-machine",cmd_machine,true)){
354 //update value in config (else no matching against suggested values
355 section->HandleInputline(std::string("machine=") + cmd_machine);
356 }
357
358 std::string mtype(section->Get_string("machine"));
359 svgaCard = SVGA_None;
360 machine = MCH_VGA;
361 int10.vesa_nolfb = false;
362 int10.vesa_oldvbe = false;
363 if (mtype == "cga") { machine = MCH_CGA; }
364 else if (mtype == "tandy") { machine = MCH_TANDY; }
365 else if (mtype == "pcjr") { machine = MCH_PCJR; }
366 else if (mtype == "hercules") { machine = MCH_HERC; }
367 else if (mtype == "ega") { machine = MCH_EGA; }
368 // else if (mtype == "vga") { svgaCard = SVGA_S3Trio; }
369 else if (mtype == "svga_s3") { svgaCard = SVGA_S3Trio; }
370 else if (mtype == "vesa_nolfb") { svgaCard = SVGA_S3Trio; int10.vesa_nolfb = true;}
371 else if (mtype == "vesa_oldvbe") { svgaCard = SVGA_S3Trio; int10.vesa_oldvbe = true;}
372 else if (mtype == "svga_et4000") { svgaCard = SVGA_TsengET4K; }
373 else if (mtype == "svga_et3000") { svgaCard = SVGA_TsengET3K; }
374 // else if (mtype == "vga_pvga1a") { svgaCard = SVGA_ParadisePVGA1A; }
375 else if (mtype == "svga_paradise") { svgaCard = SVGA_ParadisePVGA1A; }
376 else if (mtype == "vgaonly") { svgaCard = SVGA_None; }
377 else E_Exit("DOSBOX:Unknown machine type %s",mtype.c_str());
378 }
379
380
381 void DOSBOX_Init(void) {
382 Section_prop * secprop;
383 Section_line * secline;
384 Prop_int* Pint;
385 Prop_hex* Phex;
386 Prop_string* Pstring;
387 Prop_bool* Pbool;
388 Prop_multival* Pmulti;
389 Prop_multival_remain* Pmulti_remain;
390
391 SDLNetInited = false;
392
393 // Some frequently used option sets
394 const char *rates[] = { "44100", "48000", "32000","22050", "16000", "11025", "8000", "49716", 0 };
395 const char *oplrates[] = { "44100", "49716", "48000", "32000","22050", "16000", "11025", "8000", 0 };
396 const char *ios[] = { "220", "240", "260", "280", "2a0", "2c0", "2e0", "300", 0 };
397 const char *irqssb[] = { "7", "5", "3", "9", "10", "11", "12", 0 };
398 const char *dmassb[] = { "1", "5", "0", "3", "6", "7", 0 };
399 const char *iosgus[] = { "240", "220", "260", "280", "2a0", "2c0", "2e0", "300", 0 };
400 const char *irqsgus[] = { "5", "3", "7", "9", "10", "11", "12", 0 };
401 const char *dmasgus[] = { "3", "0", "1", "5", "6", "7", 0 };
402
403
404 /* Setup all the different modules making up DOSBox */
405 const char* machines[] = {
406 "hercules", "cga", "tandy", "pcjr", "ega",
407 "vgaonly", "svga_s3", "svga_et3000", "svga_et4000",
408 "svga_paradise", "vesa_nolfb", "vesa_oldvbe", 0 };
409 secprop=control->AddSection_prop("dosbox",&DOSBOX_RealInit);
410 Pstring = secprop->Add_path("language",Property::Changeable::Always,"");
411 Pstring->Set_help("Select another language file.");
412
413 Pstring = secprop->Add_string("machine",Property::Changeable::OnlyAtStart,"svga_s3");
414 Pstring->Set_values(machines);
415 Pstring->Set_help("The type of machine DOSBox tries to emulate.");
416
417 Pstring = secprop->Add_path("captures",Property::Changeable::Always,"capture");
418 Pstring->Set_help("Directory where things like wave, midi, screenshot get captured.");
419
420 #if C_DEBUG
421 LOG_StartUp();
422 #endif
423
424 secprop->AddInitFunction(&IO_Init);//done
425 secprop->AddInitFunction(&PAGING_Init);//done
426 secprop->AddInitFunction(&MEM_Init);//done
427 secprop->AddInitFunction(&HARDWARE_Init);//done
428 Pint = secprop->Add_int("memsize", Property::Changeable::WhenIdle,16);
429 Pint->SetMinMax(1,63);
430 Pint->Set_help(
431 "Amount of memory DOSBox has in megabytes.\n"
432 " This value is best left at its default to avoid problems with some games,\n"
433 " though few games might require a higher value.\n"
434 " There is generally no speed advantage when raising this value.");
435 secprop->AddInitFunction(&CALLBACK_Init);
436 secprop->AddInitFunction(&PIC_Init);//done
437 secprop->AddInitFunction(&PROGRAMS_Init);
438 secprop->AddInitFunction(&TIMER_Init);//done
439 secprop->AddInitFunction(&CMOS_Init);//done
440
441 secprop=control->AddSection_prop("render",&RENDER_Init,true);
442 Pint = secprop->Add_int("frameskip",Property::Changeable::Always,0);
443 Pint->SetMinMax(0,10);
444 Pint->Set_help("How many frames DOSBox skips before drawing one.");
445
446 Pbool = secprop->Add_bool("aspect",Property::Changeable::Always,false);
447 Pbool->Set_help("Do aspect correction, if your output method doesn't support scaling this can slow things down!");
448
449 Pmulti = secprop->Add_multi("scaler",Property::Changeable::Always," ");
450 Pmulti->SetValue("normal2x");
451 Pmulti->Set_help("Scaler used to enlarge/enhance low resolution modes. If 'forced' is appended,\n"
452 " then the scaler will be used even if the result might not be desired.\n"
453 " To fit a scaler in the resolution used at full screen may require a border or side bars,\n"
454 " to fill the screen entirely, depending on your hardware, a different scaler/fullresolution might work.");
455 Pstring = Pmulti->GetSection()->Add_string("type",Property::Changeable::Always,"normal2x");
456
457 const char *scalers[] = {
458 "none", "normal2x", "normal3x",
459 #if RENDER_USE_ADVANCED_SCALERS>2
460 "advmame2x", "advmame3x", "advinterp2x", "advinterp3x", "hq2x", "hq3x", "2xsai", "super2xsai", "supereagle",
461 #endif
462 #if RENDER_USE_ADVANCED_SCALERS>0
463 "tv2x", "tv3x", "rgb2x", "rgb3x", "scan2x", "scan3x",
464 #endif
465 0 };
466 Pstring->Set_values(scalers);
467
468 const char* force[] = { "", "forced", 0 };
469 Pstring = Pmulti->GetSection()->Add_string("force",Property::Changeable::Always,"");
470 Pstring->Set_values(force);
471
472 secprop=control->AddSection_prop("cpu",&CPU_Init,true);//done
473 const char* cores[] = { "auto",
474 #if (C_DYNAMIC_X86) || (C_DYNREC)
475 "dynamic",
476 #endif
477 "normal", "simple",0 };
478 Pstring = secprop->Add_string("core",Property::Changeable::WhenIdle,"auto");
479 Pstring->Set_values(cores);
480 Pstring->Set_help("CPU Core used in emulation. auto will switch to dynamic if available and\n"
481 "appropriate.");
482
483 const char* cputype_values[] = { "auto", "386", "386_slow", "486_slow", "pentium_slow", "386_prefetch", 0};
484 Pstring = secprop->Add_string("cputype",Property::Changeable::Always,"auto");
485 Pstring->Set_values(cputype_values);
486 Pstring->Set_help("CPU Type used in emulation. auto is the fastest choice.");
487
488
489 Pmulti_remain = secprop->Add_multiremain("cycles",Property::Changeable::Always," ");
490 Pmulti_remain->Set_help(
491 "Amount of instructions DOSBox tries to emulate each millisecond.\n"
492 "Setting this value too high results in sound dropouts and lags.\n"
493 "Cycles can be set in 3 ways:\n"
494 " 'auto' tries to guess what a game needs.\n"
495 " It usually works, but can fail for certain games.\n"
496 " 'fixed #number' will set a fixed amount of cycles. This is what you usually\n"
497 " need if 'auto' fails. (Example: fixed 4000).\n"
498 " 'max' will allocate as much cycles as your computer is able to\n"
499 " handle.");
500
501 const char* cyclest[] = { "auto","fixed","max","%u",0 };
502 Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::Always,"auto");
503 Pmulti_remain->SetValue("auto");
504 Pstring->Set_values(cyclest);
505
506 Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::Always,"");
507
508 Pint = secprop->Add_int("cycleup",Property::Changeable::Always,10);
509 Pint->SetMinMax(1,1000000);
510 Pint->Set_help("Amount of cycles to decrease/increase with keycombos.(CTRL-F11/CTRL-F12)");
511
512 Pint = secprop->Add_int("cycledown",Property::Changeable::Always,20);
513 Pint->SetMinMax(1,1000000);
514 Pint->Set_help("Setting it lower than 100 will be a percentage.");
515
516 #if C_FPU
517 secprop->AddInitFunction(&FPU_Init);
518 #endif
519 secprop->AddInitFunction(&DMA_Init);//done
520 secprop->AddInitFunction(&VGA_Init);
521 secprop->AddInitFunction(&KEYBOARD_Init);
522
523 secprop=control->AddSection_prop("mixer",&MIXER_Init);
524 Pbool = secprop->Add_bool("nosound",Property::Changeable::OnlyAtStart,false);
525 Pbool->Set_help("Enable silent mode, sound is still emulated though.");
526
527 Pint = secprop->Add_int("rate",Property::Changeable::OnlyAtStart,44100);
528 Pint->Set_values(rates);
529 Pint->Set_help("Mixer sample rate, setting any device's rate higher than this will probably lower their sound quality.");
530
531 const char *blocksizes[] = {
532 "1024", "2048", "4096", "8192", "512", "256", 0};
533 Pint = secprop->Add_int("blocksize",Property::Changeable::OnlyAtStart,1024);
534 Pint->Set_values(blocksizes);
535 Pint->Set_help("Mixer block size, larger blocks might help sound stuttering but sound will also be more lagged.");
536
537 Pint = secprop->Add_int("prebuffer",Property::Changeable::OnlyAtStart,25);
538 Pint->SetMinMax(0,100);
539 Pint->Set_help("How many milliseconds of data to keep on top of the blocksize.");
540
541 secprop=control->AddSection_prop("midi",&MIDI_Init,true);//done
542 secprop->AddInitFunction(&MPU401_Init,true);//done
543
544 const char* mputypes[] = { "intelligent", "uart", "none",0};
545 // FIXME: add some way to offer the actually available choices.
546 const char *devices[] = { "default", "win32", "alsa", "oss", "coreaudio", "coremidi","none", 0};
547 Pstring = secprop->Add_string("mpu401",Property::Changeable::WhenIdle,"intelligent");
548 Pstring->Set_values(mputypes);
549 Pstring->Set_help("Type of MPU-401 to emulate.");
550
551 Pstring = secprop->Add_string("mididevice",Property::Changeable::WhenIdle,"default");
552 Pstring->Set_values(devices);
553 Pstring->Set_help("Device that will receive the MIDI data from MPU-401.");
554
555 Pstring = secprop->Add_string("midiconfig",Property::Changeable::WhenIdle,"");
556 Pstring->Set_help("Special configuration options for the device driver. This is usually the id of the device you want to use\n"
557 " (find the id with mixer/listmidi).\n"
558 " Or in the case of coreaudio, you can specify a soundfont here.\n"
559 " See the README/Manual for more details.");
560
561 #if C_DEBUG
562 secprop=control->AddSection_prop("debug",&DEBUG_Init);
563 #endif
564
565 secprop=control->AddSection_prop("sblaster",&SBLASTER_Init,true);//done
566
567 const char* sbtypes[] = { "sb1", "sb2", "sbpro1", "sbpro2", "sb16", "gb", "none", 0 };
568 Pstring = secprop->Add_string("sbtype",Property::Changeable::WhenIdle,"sb16");
569 Pstring->Set_values(sbtypes);
570 Pstring->Set_help("Type of Soundblaster to emulate. gb is Gameblaster.");
571
572 Phex = secprop->Add_hex("sbbase",Property::Changeable::WhenIdle,0x220);
573 Phex->Set_values(ios);
574 Phex->Set_help("The IO address of the soundblaster.");
575
576 Pint = secprop->Add_int("irq",Property::Changeable::WhenIdle,7);
577 Pint->Set_values(irqssb);
578 Pint->Set_help("The IRQ number of the soundblaster.");
579
580 Pint = secprop->Add_int("dma",Property::Changeable::WhenIdle,1);
581 Pint->Set_values(dmassb);
582 Pint->Set_help("The DMA number of the soundblaster.");
583
584 Pint = secprop->Add_int("hdma",Property::Changeable::WhenIdle,5);
585 Pint->Set_values(dmassb);
586 Pint->Set_help("The High DMA number of the soundblaster.");
587
588 Pbool = secprop->Add_bool("sbmixer",Property::Changeable::WhenIdle,true);
589 Pbool->Set_help("Allow the soundblaster mixer to modify the DOSBox mixer.");
590
591 const char* oplmodes[]={ "auto", "cms", "opl2", "dualopl2", "opl3", "none", 0};
592 Pstring = secprop->Add_string("oplmode",Property::Changeable::WhenIdle,"auto");
593 Pstring->Set_values(oplmodes);
594 Pstring->Set_help("Type of OPL emulation. On 'auto' the mode is determined by sblaster type. All OPL modes are Adlib-compatible, except for 'cms'.");
595
596 const char* oplemus[]={ "default", "compat", "fast", 0};
597 Pstring = secprop->Add_string("oplemu",Property::Changeable::WhenIdle,"default");
598 Pstring->Set_values(oplemus);
599 Pstring->Set_help("Provider for the OPL emulation. compat might provide better quality (see oplrate as well).");
600
601 Pint = secprop->Add_int("oplrate",Property::Changeable::WhenIdle,44100);
602 Pint->Set_values(oplrates);
603 Pint->Set_help("Sample rate of OPL music emulation. Use 49716 for highest quality (set the mixer rate accordingly).");
604
605
606 secprop=control->AddSection_prop("gus",&GUS_Init,true); //done
607 Pbool = secprop->Add_bool("gus",Property::Changeable::WhenIdle,false);
608 Pbool->Set_help("Enable the Gravis Ultrasound emulation.");
609
610 Pint = secprop->Add_int("gusrate",Property::Changeable::WhenIdle,44100);
611 Pint->Set_values(rates);
612 Pint->Set_help("Sample rate of Ultrasound emulation.");
613
614 Phex = secprop->Add_hex("gusbase",Property::Changeable::WhenIdle,0x240);
615 Phex->Set_values(iosgus);
616 Phex->Set_help("The IO base address of the Gravis Ultrasound.");
617
618 Pint = secprop->Add_int("gusirq",Property::Changeable::WhenIdle,5);
619 Pint->Set_values(irqsgus);
620 Pint->Set_help("The IRQ number of the Gravis Ultrasound.");
621
622 Pint = secprop->Add_int("gusdma",Property::Changeable::WhenIdle,3);
623 Pint->Set_values(dmasgus);
624 Pint->Set_help("The DMA channel of the Gravis Ultrasound.");
625
626 Pstring = secprop->Add_string("ultradir",Property::Changeable::WhenIdle,"C:\\ULTRASND");
627 Pstring->Set_help(
628 "Path to Ultrasound directory. In this directory\n"
629 "there should be a MIDI directory that contains\n"
630 "the patch files for GUS playback. Patch sets used\n"
631 "with Timidity should work fine.");
632
633 secprop = control->AddSection_prop("speaker",&PCSPEAKER_Init,true);//done
634 Pbool = secprop->Add_bool("pcspeaker",Property::Changeable::WhenIdle,true);
635 Pbool->Set_help("Enable PC-Speaker emulation.");
636
637 Pint = secprop->Add_int("pcrate",Property::Changeable::WhenIdle,44100);
638 Pint->Set_values(rates);
639 Pint->Set_help("Sample rate of the PC-Speaker sound generation.");
640
641 secprop->AddInitFunction(&TANDYSOUND_Init,true);//done
642 const char* tandys[] = { "auto", "on", "off", 0};
643 Pstring = secprop->Add_string("tandy",Property::Changeable::WhenIdle,"auto");
644 Pstring->Set_values(tandys);
645 Pstring->Set_help("Enable Tandy Sound System emulation. For 'auto', emulation is present only if machine is set to 'tandy'.");
646
647 Pint = secprop->Add_int("tandyrate",Property::Changeable::WhenIdle,44100);
648 Pint->Set_values(rates);
649 Pint->Set_help("Sample rate of the Tandy 3-Voice generation.");
650
651 secprop->AddInitFunction(&DISNEY_Init,true);//done
652
653 Pbool = secprop->Add_bool("disney",Property::Changeable::WhenIdle,true);
654 Pbool->Set_help("Enable Disney Sound Source emulation. (Covox Voice Master and Speech Thing compatible).");
655
656 secprop=control->AddSection_prop("joystick",&BIOS_Init,false);//done
657 secprop->AddInitFunction(&INT10_Init);
658 secprop->AddInitFunction(&MOUSE_Init); //Must be after int10 as it uses CurMode
659 secprop->AddInitFunction(&JOYSTICK_Init);
660 const char* joytypes[] = { "auto", "2axis", "4axis", "4axis_2", "fcs", "ch", "none",0};
661 Pstring = secprop->Add_string("joysticktype",Property::Changeable::WhenIdle,"auto");
662 Pstring->Set_values(joytypes);
663 Pstring->Set_help(
664 "Type of joystick to emulate: auto (default), none,\n"
665 "2axis (supports two joysticks),\n"
666 "4axis (supports one joystick, first joystick used),\n"
667 "4axis_2 (supports one joystick, second joystick used),\n"
668 "fcs (Thrustmaster), ch (CH Flightstick).\n"
669 "none disables joystick emulation.\n"
670 "auto chooses emulation depending on real joystick(s).\n"
671 "(Remember to reset dosbox's mapperfile if you saved it earlier)");
672
673 Pbool = secprop->Add_bool("timed",Property::Changeable::WhenIdle,true);
674 Pbool->Set_help("enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).");
675
676 Pbool = secprop->Add_bool("autofire",Property::Changeable::WhenIdle,false);
677 Pbool->Set_help("continuously fires as long as you keep the button pressed.");
678
679 Pbool = secprop->Add_bool("swap34",Property::Changeable::WhenIdle,false);
680 Pbool->Set_help("swap the 3rd and the 4th axis. Can be useful for certain joysticks.");
681
682 Pbool = secprop->Add_bool("buttonwrap",Property::Changeable::WhenIdle,false);
683 Pbool->Set_help("enable button wrapping at the number of emulated buttons.");
684
685 secprop=control->AddSection_prop("serial",&SERIAL_Init,true);
686 const char* serials[] = { "dummy", "disabled", "modem", "nullmodem",
687 "directserial",0 };
688
689 Pmulti_remain = secprop->Add_multiremain("serial1",Property::Changeable::WhenIdle," ");
690 Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::WhenIdle,"dummy");
691 Pmulti_remain->SetValue("dummy");
692 Pstring->Set_values(serials);
693 Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::WhenIdle,"");
694 Pmulti_remain->Set_help(
695 "set type of device connected to com port.\n"
696 "Can be disabled, dummy, modem, nullmodem, directserial.\n"
697 "Additional parameters must be in the same line in the form of\n"
698 "parameter:value. Parameter for all types is irq (optional).\n"
699 "for directserial: realport (required), rxdelay (optional).\n"
700 " (realport:COM1 realport:ttyS0).\n"
701 "for modem: listenport (optional).\n"
702 "for nullmodem: server, rxdelay, txdelay, telnet, usedtr,\n"
703 " transparent, port, inhsocket (all optional).\n"
704 "Example: serial1=modem listenport:5000");
705
706 Pmulti_remain = secprop->Add_multiremain("serial2",Property::Changeable::WhenIdle," ");
707 Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::WhenIdle,"dummy");
708 Pmulti_remain->SetValue("dummy");
709 Pstring->Set_values(serials);
710 Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::WhenIdle,"");
711 Pmulti_remain->Set_help("see serial1");
712
713 Pmulti_remain = secprop->Add_multiremain("serial3",Property::Changeable::WhenIdle," ");
714 Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::WhenIdle,"disabled");
715 Pmulti_remain->SetValue("disabled");
716 Pstring->Set_values(serials);
717 Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::WhenIdle,"");
718 Pmulti_remain->Set_help("see serial1");
719
720 Pmulti_remain = secprop->Add_multiremain("serial4",Property::Changeable::WhenIdle," ");
721 Pstring = Pmulti_remain->GetSection()->Add_string("type",Property::Changeable::WhenIdle,"disabled");
722 Pmulti_remain->SetValue("disabled");
723 Pstring->Set_values(serials);
724 Pstring = Pmulti_remain->GetSection()->Add_string("parameters",Property::Changeable::WhenIdle,"");
725 Pmulti_remain->Set_help("see serial1");
726
727
728 /* All the DOS Related stuff, which will eventually start up in the shell */
729 secprop=control->AddSection_prop("dos",&DOS_Init,false);//done
730 secprop->AddInitFunction(&XMS_Init,true);//done
731 Pbool = secprop->Add_bool("xms",Property::Changeable::WhenIdle,true);
732 Pbool->Set_help("Enable XMS support.");
733
734 secprop->AddInitFunction(&EMS_Init,true);//done
735 Pbool = secprop->Add_bool("ems",Property::Changeable::WhenIdle,true);
736 Pbool->Set_help("Enable EMS support.");
737
738 Pbool = secprop->Add_bool("umb",Property::Changeable::WhenIdle,true);
739 Pbool->Set_help("Enable UMB support.");
740
741 secprop->AddInitFunction(&DOS_KeyboardLayout_Init,true);
742 Pstring = secprop->Add_string("keyboardlayout",Property::Changeable::WhenIdle, "auto");
743 Pstring->Set_help("Language code of the keyboard layout (or none).");
744
745 // Mscdex
746 secprop->AddInitFunction(&MSCDEX_Init);
747 secprop->AddInitFunction(&DRIVES_Init);
748 secprop->AddInitFunction(&CDROM_Image_Init);
749 #if C_IPX
750 secprop=control->AddSection_prop("ipx",&IPX_Init,true);
751 Pbool = secprop->Add_bool("ipx",Property::Changeable::WhenIdle, false);
752 Pbool->Set_help("Enable ipx over UDP/IP emulation.");
753 #endif
754 // secprop->AddInitFunction(&CREDITS_Init);
755
756 //TODO ?
757 secline=control->AddSection_line("autoexec",&AUTOEXEC_Init);
758 MSG_Add("AUTOEXEC_CONFIGFILE_HELP",
759 "Lines in this section will be run at startup.\n"
760 "You can put your MOUNT lines here.\n"
761 );
762 MSG_Add("CONFIGFILE_INTRO",
763 "# This is the configuration file for DOSBox %s. (Please use the latest version of DOSBox)\n"
764 "# Lines starting with a # are comment lines and are ignored by DOSBox.\n"
765 "# They are used to (briefly) document the effect of each option.\n");
766 MSG_Add("CONFIG_SUGGESTED_VALUES", "Possible values");
767
768 control->SetStartUp(&SHELL_Init);
769 }