Exemplo n.º 1
0
        private void InitializeOptions(SetOptionDelegate setOption)
        {
            var makeByteOption    = ByteOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption);
            var makeBooleanOption = BooleanOption.CreateFactory(BaseAddress, this.onChange, "SoundPlay Settings", setOption);

            PlayMusicWhenMounted         = makeBooleanOption(OptionKind.PlayMusicWhenMounted, OptionOffsets.PlayMusicWhenMounted, null);
            PlayMusicWhenMounted.Hack    = false;
            EnableNormalBattleMusic      = makeBooleanOption(OptionKind.EnableNormalBattleMusic, OptionOffsets.EnableNormalBattleMusic, null);
            EnableNormalBattleMusic.Hack = false;
            EnableCityStateBGM           = makeBooleanOption(OptionKind.EnableCityStateBGM, OptionOffsets.EnableCityStateBGM, null);
            EnableCityStateBGM.Hack      = false;
            PlaySystemSounds             = makeBooleanOption(OptionKind.PlaySystemSounds, OptionOffsets.PlaySystemSounds, null);
            PlaySystemSounds.Hack        = false;

            MasterVolume  = makeByteOption(OptionKind.Master, OptionOffsets.MasterVolume, "SoundMaster");
            Bgm           = makeByteOption(OptionKind.Bgm, OptionOffsets.Bgm, "SoundBgm");
            SoundEffects  = makeByteOption(OptionKind.SoundEffects, OptionOffsets.SoundEffects, "SoundSe");
            Voice         = makeByteOption(OptionKind.Voice, OptionOffsets.Voice, "SoundVoice");
            SystemSounds  = makeByteOption(OptionKind.SystemSounds, OptionOffsets.SystemSounds, "SoundSystem");
            AmbientSounds = makeByteOption(OptionKind.AmbientSounds, OptionOffsets.AmbientSounds, "SoundEnv");
            Performance   = makeByteOption(OptionKind.Performance, OptionOffsets.Performance, "SoundPerform");

            Self     = makeByteOption(OptionKind.Self, OptionOffsets.Self, "SoundPlayer");
            Party    = makeByteOption(OptionKind.Party, OptionOffsets.Party, "SoundParty");
            OtherPCs = makeByteOption(OptionKind.OtherPCs, OptionOffsets.OtherPCs, "SoundOther");

            MasterVolumeMuted  = makeBooleanOption(OptionKind.MasterMuted, OptionOffsets.MasterVolumeMuted, "IsSndMaster");
            BgmMuted           = makeBooleanOption(OptionKind.BgmMuted, OptionOffsets.BgmMuted, "IsSndBgm");
            SoundEffectsMuted  = makeBooleanOption(OptionKind.SoundEffectsMuted, OptionOffsets.SoundEffectsMuted, "IsSndSe");
            VoiceMuted         = makeBooleanOption(OptionKind.VoiceMuted, OptionOffsets.VoiceMuted, "IsSndVoice");
            SystemSoundsMuted  = makeBooleanOption(OptionKind.SystemSoundsMuted, OptionOffsets.SystemSoundsMuted, "IsSndSystem");
            AmbientSoundsMuted = makeBooleanOption(OptionKind.AmbientSoundsMuted, OptionOffsets.AmbientSoundsMuted, "IsSndEnv");
            PerformanceMuted   = makeBooleanOption(OptionKind.PerformanceMuted, OptionOffsets.PerformanceMuted, "IsSndPerform");

            EqualizerMode = new EqualizerModeOption
            {
                BaseAddress = BaseAddress,
                Offset      = OptionOffsets.EqualizerMode,
                Kind        = OptionKind.EqualizerMode,

                CfgSection = "SoundPlay Settings",
                CfgSetting = "SoundEqualizerType",

                OnChange = this.onChange,

                SetFunction = setOption,
            };
        }
Exemplo n.º 2
0
        public static void AdjustVolume(ByteOption option, int volumeTarget, OperationKind interaction)
        {
            var curVol = option.GetValue();

            if (interaction == OperationKind.Add)
            {
                option.SetValue((byte)Math.Min(curVol + volumeTarget, 100));
            }
            else if (interaction == OperationKind.Subtract)
            {
                option.SetValue((byte)Math.Max(curVol - volumeTarget, 0));
            }
            else
            {
                option.SetValue((byte)Math.Min(volumeTarget, 100));
            }
        }