Ejemplo n.º 1
0
        private static LibmGBA.OverrideInfo GetOverrideInfo(SyncSettings syncSettings)
        {
            var ret = new LibmGBA.OverrideInfo
            {
                Savetype = syncSettings.OverrideSaveType,
                Hardware = LibmGBA.Hardware.None
            };

            if (syncSettings.OverrideRtc is SyncSettings.HardwareSelection.Autodetect)
            {
                ret.Hardware |= LibmGBA.Hardware.AutodetectRtc;
            }
            else if (syncSettings.OverrideRtc is SyncSettings.HardwareSelection.True)
            {
                ret.Hardware |= LibmGBA.Hardware.Rtc;
            }

            if (syncSettings.OverrideRumble is SyncSettings.HardwareSelection.Autodetect)
            {
                ret.Hardware |= LibmGBA.Hardware.AutodetectRumble;
            }
            else if (syncSettings.OverrideRumble is SyncSettings.HardwareSelection.True)
            {
                ret.Hardware |= LibmGBA.Hardware.Rumble;
            }

            if (syncSettings.OverrideLightSensor is SyncSettings.HardwareSelection.Autodetect)
            {
                ret.Hardware |= LibmGBA.Hardware.AutodetectLightSensor;
            }
            else if (syncSettings.OverrideLightSensor is SyncSettings.HardwareSelection.True)
            {
                ret.Hardware |= LibmGBA.Hardware.LightSensor;
            }

            if (syncSettings.OverrideGyro is SyncSettings.HardwareSelection.Autodetect)
            {
                ret.Hardware |= LibmGBA.Hardware.AutodetectGyro;
            }
            else if (syncSettings.OverrideGyro is SyncSettings.HardwareSelection.True)
            {
                ret.Hardware |= LibmGBA.Hardware.Gyro;
            }

            if (syncSettings.OverrideTilt is SyncSettings.HardwareSelection.Autodetect)
            {
                ret.Hardware |= LibmGBA.Hardware.AutodetectTilt;
            }
            else if (syncSettings.OverrideTilt is SyncSettings.HardwareSelection.True)
            {
                ret.Hardware |= LibmGBA.Hardware.Tilt;
            }

            if (syncSettings.OverrideGbPlayerDetect is true)
            {
                ret.Hardware |= LibmGBA.Hardware.GbPlayerDetect;
            }

            return(ret);
        }
Ejemplo n.º 2
0
        private static LibmGBA.OverrideInfo GetOverrideInfo(GameInfo game)
        {
            if (!game.OptionPresent("mgbaNeedsOverrides"))
            {
                // the gba game db predates the mgba core in bizhawk, but was never used by the mgba core,
                // which had its own handling for overrides
                // to avoid possible regressions, we don't want to be overriding things that we already
                // know work in mgba, so unless this parameter is set, we do nothing
                return(null);
            }

            var ret = new LibmGBA.OverrideInfo();

            if (game.OptionPresent("flashSize"))
            {
                switch (game.GetIntValue("flashSize"))
                {
                case 65536: ret.Savetype = LibmGBA.SaveType.Flash512; break;

                case 131072: ret.Savetype = LibmGBA.SaveType.Flash1m; break;

                default: throw new InvalidOperationException("Unknown flashSize");
                }
            }
            else if (game.OptionPresent("saveType"))
            {
                switch (game.GetIntValue("saveType"))
                {
                // 3 specifies either flash 512 or 1024, but in vba-over.ini, the latter will have a flashSize as well
                case 3: ret.Savetype = LibmGBA.SaveType.Flash512; break;

                case 4: ret.Savetype = LibmGBA.SaveType.Eeprom; break;

                default: throw new InvalidOperationException("Unknown saveType");
                }
            }

            if (game.GetInt("rtcEnabled", 0) == 1)
            {
                ret.Hardware |= LibmGBA.Hardware.Rtc;
            }
            if (game.GetInt("mirroringEnabled", 0) == 1)
            {
                throw new InvalidOperationException("Don't know what to do with mirroringEnabled!");
            }
            if (game.OptionPresent("idleLoop"))
            {
                ret.IdleLoop = (uint)game.GetHexValue("idleLoop");
            }
            return(ret);
        }