コード例 #1
0
        /// <summary>
        /// Cast the configuration to string format
        /// </summary>
        /// <returns>String DosBox configuration format</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(SDL?.ToString());
            sb.AppendLine(DosBox?.ToString());
            sb.AppendLine(Render?.ToString());
            sb.AppendLine(CPU?.ToString());
            sb.AppendLine(Mixer?.ToString());
            sb.AppendLine(Midi?.ToString());
            sb.AppendLine(SoundBlaster?.ToString());
            sb.AppendLine(GUS?.ToString());
            sb.AppendLine(Speaker?.ToString());
            sb.AppendLine(Joystick?.ToString());
            sb.AppendLine(Serial?.ToString());
            sb.AppendLine(DOS?.ToString());
            sb.AppendLine(IPX?.ToString());
            sb.Append(Autoexec?.ToString());

            return(sb.ToString());
        }
コード例 #2
0
        void draw_hips(CCfgtype cfg)
        {
            //zt = 0.0;
            textrotn = 0.0;

            double dVcl, dK;

            double dLead = 1.2; // gap between lines

            if (IPX != last_IPX && IPY != last_IPY)
            {
                if (index == false) // Start HIP
                {
                    xt = xst - xlate_x;
                    yt = yst - xlate_y;


                    plan_form(ref xt, ref yt);
                    textstring = "Start chainage / Level: " + xst.ToString("0.000") + ", " + yst.ToString("0.000") + " m.";
                    textwrite();
                }
            }
            if (eltype == 3)
            {
                xt = IPX - xlate_x;
                yt = IPY - xlate_y;
                plan_form(ref xt, ref yt);

                textstring = "VIP Chainage = " + IPX.ToString("0.000") + " m";
                xstor      = xt;
                ystor      = yt;
                textwrite();
                xt = xstor;
                yt = ystor;

                yt -= textsize / cfg.YMetric * dLead;

                textstring = "VIP Level = " + IPY.ToString("0.000") + " m";
                xstor      = xt;
                ystor      = yt;
                textwrite();
                xt = xstor;
                yt = ystor;

                yt -= textsize / cfg.YMetric * dLead;

                dVcl = R + L;
                if (Math.Abs(R - L) < 0.001)
                {
                    textstring = "VCL = " + dVcl.ToString("0.000") + " m";
                }
                else
                {
                    textstring = "VCL1 = " + R.ToString("0.000") + " m, VCL2 = " + L.ToString("0.000") + " m";
                }

                xstor = xt;
                ystor = yt;
                textwrite();
                xt = xstor;
                yt = ystor;

                yt -= textsize / cfg.YMetric * dLead;

                textstring = "g1 = " + B1.ToString("0.000") + " %, g2 = " + B2.ToString("0.000") + " % ";
                xstor      = xt;
                ystor      = yt;
                textwrite();
                yt = ystor;
                xt = xstor;

                yt -= textsize / cfg.YMetric * dLead;

                if (turn1 == 1)
                {
                    R = 0.0 - R;
                }
                textstring = "Grade Difference = " + DEL.ToString("0.000") + " %";

                xstor = xt;
                ystor = yt;
                textwrite();
                xt = xstor;
                yt = ystor;

                yt -= textsize / cfg.YMetric * dLead;

                dK = Math.Abs(dVcl / (B2 - B1));

                if (turn1 == 2)
                {
                    dK *= -1;
                }

                textstring = "K = " + dK.ToString("0.000");
                xstor      = xt;
                ystor      = yt;
                textwrite();
                xt = xstor;
                yt = ystor;
            }
            last_IPX = IPX;
            last_IPY = IPY;
        }
コード例 #3
0
        /// <summary>
        /// Load configuration from dictionary
        /// </summary>
        /// <param name="dictionary">Dictionary with dosbox configuration data.</param>
        /// <returns>DosBoxConfiguration data</returns>
        public DosBoxConfiguration LoadDictionary(IDictionary <string, object> dictionary)
        {
            foreach (var keyValue in dictionary)
            {
                switch (keyValue.Key)
                {
                case "sdl":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        SDL.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "dosbox":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        DosBox.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "render":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Render.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "cpu":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        CPU.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "mixer":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Mixer.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "midi":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Midi.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "sblaster":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        SoundBlaster.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "gus":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        GUS.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "speaker":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Speaker.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "joystick":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Joystick.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "serial":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Serial.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "dos":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        DOS.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "ipx":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        IPX.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                case "autoexec":
                    if (keyValue.Value is IDictionary <string, object> )
                    {
                        Autoexec.LoadDictionary(keyValue.Value as IDictionary <string, object>);
                    }
                    break;

                default:
                    break;
                }
            }

            return(this);
        }
コード例 #4
0
        /// <summary>
        /// Load the default DosBox configuration
        /// </summary>
        /// <returns>DosBoxConfiguration data</returns>
        public DosBoxConfiguration LoadDeafult()
        {
            SDL.AddAutoLock()
            .AddFullDouble()
            .AddFullResolution(Resolution.Original)
            .AddFullScreen()
            .AddOutput(VideoOutput.Surface)
            .AddPriorityFocused()
            .AddPriorityMinimized()
            .AddSensitivity()
            .AddUseScanCodes()
            .AddWaitOnError()
            .AddWindowResolution(Resolution.Original);

            DosBox.AddCaptures()
            .AddMachine()
            .AddMemSize();

            Render.AddAspect()
            .AddFrameskip()
            .AddScaler(ScalerType.Normal2x);

            CPU.AddCore()
            .AddCPUType()
            .AddCycles(new CPUCycles("auto"))
            .AddCycleUp()
            .AddCycleDown();

            Mixer.AddNoSound()
            .AddRate()
            .AddBlockSize()
            .AddPreBuffer();

            Midi.AddMPU401()
            .AddMidiDevice();

            SoundBlaster.AddSBType()
            .AddSBBase()
            .AddIRQ()
            .AddDMA()
            .AddHDMA()
            .AddSoundMixer()
            .AddOplMode()
            .AddOplEmu()
            .AddOplRate();

            GUS.AddGUS()
            .AddGusRate()
            .AddGusBase()
            .AddGusIRQ()
            .AddGusDMA()
            .AddUltraDir();

            Speaker.AddPCSpeaker()
            .AddPCRate()
            .AddTandy()
            .AddTandyRate()
            .AddDisney();

            Joystick.AddJoystickType()
            .AddTimed()
            .AddAutoFire()
            .AddSwap34()
            .AddButtonWrap();

            Serial.AddSerial1(Options.Serial.CreateDummy())
            .AddSerial2(Options.Serial.CreateDummy())
            .AddSerial3(Options.Serial.CreateDisabled())
            .AddSerial4(Options.Serial.CreateDisabled());

            DOS.AddXMS()
            .AddEMS()
            .AddUMB()
            .AddKeyboardLayout(KeyboardLayout.Auto);

            IPX.AddIPX();

            return(this);
        }