فهرست منبع

Implemented apply changes logic
Updated autodetect graphics to complete to new apply changes rules
Made it so gamepad can activate key rebinds

Areloch 1 سال پیش
والد
کامیت
df00543502

+ 190 - 80
Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript

@@ -71,6 +71,7 @@ new SimGroup(VideoSettingsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Display API";
          OptionName = "Display API";
+         requiresRestart = true;
       };
       };
       
       
       new SimGroup( DisplayDevicesGroup )
       new SimGroup( DisplayDevicesGroup )
@@ -693,7 +694,7 @@ new SimGroup(VideoSettingsGroup)
       class = "SubOptionsGroup";
       class = "SubOptionsGroup";
       displayName = "Effects";
       displayName = "Effects";
      
      
-      new SimGroup()
+      new SimGroup(ShaderQualityOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Shader Quality";
          OptionName = "Shader Quality";
@@ -723,7 +724,7 @@ new SimGroup(VideoSettingsGroup)
          
          
       }; 
       }; 
       
       
-      new SimGroup()
+      new SimGroup(AnisotropicFilterOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Anisotropic Filtering";
          OptionName = "Anisotropic Filtering";
@@ -759,7 +760,7 @@ new SimGroup(VideoSettingsGroup)
          };
          };
       }; 
       }; 
       
       
-      new SimGroup()
+      new SimGroup(AntiAliasingOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Anti-Aliasing";
          OptionName = "Anti-Aliasing";
@@ -771,6 +772,7 @@ new SimGroup(VideoSettingsGroup)
             displayName = "None";
             displayName = "None";
             
             
             key["$pref::Video::AAMode"] = "None";
             key["$pref::Video::AAMode"] = "None";
+            key["$pref::Video::AA"] = 0;            
          };
          };
          new ArrayObject()
          new ArrayObject()
          {
          {
@@ -778,6 +780,7 @@ new SimGroup(VideoSettingsGroup)
             displayName = "FXAA";
             displayName = "FXAA";
             
             
             key["$pref::Video::AAMode"] = "FXAA";
             key["$pref::Video::AAMode"] = "FXAA";
+            key["$pref::Video::AA"] = 0;
          };
          };
          new ArrayObject()
          new ArrayObject()
          {
          {
@@ -785,6 +788,7 @@ new SimGroup(VideoSettingsGroup)
             displayName = "SMAA";
             displayName = "SMAA";
             
             
             key["$pref::Video::AAMode"] = "SMAA";
             key["$pref::Video::AAMode"] = "SMAA";
+            key["$pref::Video::AA"] = 4;
          };
          };
          new ArrayObject()
          new ArrayObject()
          {
          {
@@ -792,10 +796,11 @@ new SimGroup(VideoSettingsGroup)
             displayName = "SMAA High";
             displayName = "SMAA High";
             
             
             key["$pref::Video::AAMode"] ="SMAA High";
             key["$pref::Video::AAMode"] ="SMAA High";
+            key["$pref::Video::AA"] = 4;
          };
          };
       }; 
       }; 
       
       
-      new SimGroup()
+      new SimGroup(ParallaxOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Parallax";
          OptionName = "Parallax";
@@ -818,7 +823,7 @@ new SimGroup(VideoSettingsGroup)
          
          
       }; 
       }; 
       
       
-      new SimGroup()
+      new SimGroup(TrueWaterReflectionsOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "True Water Reflections";
          OptionName = "True Water Reflections";
@@ -840,7 +845,7 @@ new SimGroup(VideoSettingsGroup)
          };
          };
       }; 
       }; 
    
    
-      new SimGroup()
+      new SimGroup(PostFXSSAOOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "SSAO";
          OptionName = "SSAO";
@@ -862,7 +867,7 @@ new SimGroup(VideoSettingsGroup)
          };
          };
       }; 
       }; 
    
    
-      new SimGroup()
+      new SimGroup(PostFXDOFOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Depth of Field";
          OptionName = "Depth of Field";
@@ -883,7 +888,7 @@ new SimGroup(VideoSettingsGroup)
          };
          };
       };       
       };       
       
       
-      new SimGroup()
+      new SimGroup(PostFXVignetteOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Vignette";
          OptionName = "Vignette";
@@ -904,7 +909,7 @@ new SimGroup(VideoSettingsGroup)
          };
          };
       }; 
       }; 
       
       
-      new SimGroup()
+      new SimGroup(PostFXLightRayOptionsGroup)
       {
       {
          class = "OptionsSettings";
          class = "OptionsSettings";
          OptionName = "Light Rays";
          OptionName = "Light Rays";
@@ -1008,6 +1013,126 @@ function VideoSettingsGroup::populateDisplaySettings(%this)
       DisplayRefreshSettingsGroup.add(%entry);
       DisplayRefreshSettingsGroup.add(%entry);
    }
    }
 }
 }
+
+function DisplayDevicesGroup::onApply(%this)
+{
+   updateDisplayOptionsSettings();
+}
+
+function DisplayModeGroup::onApply(%this)
+{
+   updateDisplayOptionsSettings();
+}
+
+function DisplayResSettingsGroup::onApply(%this)
+{
+   updateDisplayOptionsSettings();
+}
+
+function VSyncSettingsGroup::onApply(%this)
+{
+   updateDisplayOptionsSettings();
+}
+
+function DisplayRefreshSettingsGroup::onApply(%this)
+{
+   updateDisplayOptionsSettings();
+}
+
+function updateDisplayOptionsSettings()
+{
+   //Update the display settings now
+   %deviceName = getDisplayDeviceName();
+   %newDeviceID = getWord(%deviceName, 0) - 1;
+   
+   %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode);
+   %newDeviceMode = 0;
+   foreach$(%modeName in $Video::ModeTags)
+   {
+      if (%deviceModeName $= %modeName)
+         break;
+      else
+         %newDeviceMode++;
+   }
+   
+   if($pref::Video::deviceMode == $Video::ModeBorderless)
+   {
+      //if we're changing to borderless, we swap to the full resolution of the desktop  
+      $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode);
+      
+      $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y;
+   }
+
+   %newRes = $pref::Video::Resolution;
+   %newBpp = 32; // ... its not 1997 anymore.
+	%newFullScreen = %deviceModeName $= "Fullscreen" ? true : false;
+	%newRefresh    = $pref::Video::RefreshRate;
+	%newVsync = $pref::Video::enableVerticalSync;	
+	%newAA = $pref::Video::AA;
+	
+   // Build the final mode string.
+	%newMode = $pref::Video::Resolution SPC %newFullScreen SPC %newBpp SPC %newRefresh SPC %newAA;
+	
+   // Change the video mode.   
+   if (  %newMode !$= $pref::Video::mode || %newDeviceID != $pref::Video::deviceId ||
+         %newVsync != $pref::Video::enableVerticalSync || %newDeviceMode != $pref::Video::deviceMode)
+   {
+      //****Edge Case Hack
+      // If we're in fullscreen mode and switching to a different monitor at the
+      // same resolution and maintaining fullscreen, GFX...WindowTarget::resetMode()
+      // will early-out because there is no "mode change" and the monitor change
+      // will not get applied. Instead of modifying platform code, we're going to
+      // move onto the new monitor in borderless and immediately switch to FS.
+      if (%newFullScreen && $pref::Video::FullScreen &&
+         ($pref::Video::Resolution $= %newRes) && ($pref::Video::deviceId != %newDeviceID))
+      {
+         $pref::Video::deviceId = %newDeviceID;
+         $pref::Video::deviceMode = $Video::ModeBorderless;
+         %tmpModeStr = Canvas.getMonitorMode(%newDeviceID, 0);
+         Canvas.setVideoMode(%tmpModeStr.x, %tmpModeStr.y, false, 32, getWord(%tmpModeStr, $WORD::REFRESH), %newAA);
+      }
+
+      $pref::Video::mode = %newMode;
+      $pref::Video::enableVerticalSync = %newVsync;
+      $pref::Video::deviceId = %newDeviceID;
+      $pref::Video::deviceMode = %newDeviceMode;
+      $pref::Video::Resolution = %newRes;
+      $pref::Video::FullScreen = %newFullScreen;
+      $pref::Video::RefreshRate = %newRefresh;
+      $pref::Video::AA = %newAA;
+      configureCanvas();
+   }
+}
+
+function TextureQualityGroup::onApply(%this)
+{
+   reloadTextures();  
+}
+
+function PostFXSSAOOptionsGroup::onApply(%this)
+{
+   %currentLevel = %this.getCurrentQualityLevel();
+   PostFXManager.settingsEffectSetEnabled(SSAOPostFx, %currentLevel.getKey(0));
+}
+
+function PostFXDOFOptionsGroup::onApply(%this)
+{
+   %currentLevel = %this.getCurrentQualityLevel();
+   PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, %currentLevel.getKey(0));
+}
+
+function PostFXVignetteOptionsGroup::onApply(%this)
+{
+   %currentLevel = %this.getCurrentQualityLevel();
+   PostFXManager.settingsEffectSetEnabled(vignettePostFX, %currentLevel.getKey(0));
+}
+
+function PostFXLightRayOptionsGroup::onApply(%this)
+{
+   %currentLevel = %this.getCurrentQualityLevel();
+   PostFXManager.settingsEffectSetEnabled(LightRayPostFX, %currentLevel.getKey(0));
+}
+
 function getCurrentQualityLevel(%qualityGroup)
 function getCurrentQualityLevel(%qualityGroup)
 {
 {
    for ( %i=0; %i < %qualityGroup.getCount(); %i++ )
    for ( %i=0; %i < %qualityGroup.getCount(); %i++ )
@@ -1046,11 +1171,6 @@ function AutodetectGraphics()
    %intel = ( strstr( strupr( getDisplayDeviceInformation() ), "INTEL" ) != -1 ) ? true : false;
    %intel = ( strstr( strupr( getDisplayDeviceInformation() ), "INTEL" ) != -1 ) ? true : false;
    %videoMem = GFXCardProfilerAPI::getVideoMemoryMB();
    %videoMem = GFXCardProfilerAPI::getVideoMemoryMB();
    
    
-   return AutodetectGraphics_Apply( %shaderVer, %intel, %videoMem );
-}
-
-function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
-{
    if ( %shaderVer < 2.0 )
    if ( %shaderVer < 2.0 )
    {      
    {      
       echo("Your video card does not meet the minimum requirment of shader model 2.0.");
       echo("Your video card does not meet the minimum requirment of shader model 2.0.");
@@ -1074,17 +1194,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
          
          
          $pref::Shadows::useShadowCaching = true;
          $pref::Shadows::useShadowCaching = true;
          
          
-         $pref::Water::enableTrueReflections = false;
-         $pref::Video::enableParallaxMapping = false;
-         $pref::PostFX::EnableSSAO = false;
-         $pref::PostFX::EnableHDR = false;
-         $pref::PostFX::EnableDOF = false;
-         $pref::PostFX::EnableLightRays = false;
-         $pref::PostFX::EnableVignette = false;
-         
-         $pref::Video::AAMode = "None";
-         $pref::Video::AA = 0;
-         $pref::Video::defaultAnisotropy = 0;
+         AnisotropicFilterOptionsGroup.applySetting("None");
+         AntiAliasingOptionsGroup.applySetting("Off");
+         ParallaxOptionsGroup.applySetting("Off");
+         TrueWaterReflectionsOptionsGroup.applySetting("Off");
+         PostFXSSAOOptionsGroup.applySetting("Off");
+         PostFXDOFOptionsGroup.applySetting("Off");
+         PostFXVignetteOptionsGroup.applySetting("Off");
+         PostFXLightRayOptionsGroup.applySetting("Off");
       }
       }
       else
       else
       {
       {
@@ -1101,17 +1218,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
          
          
          $pref::Shadows::useShadowCaching = true;
          $pref::Shadows::useShadowCaching = true;
          
          
-         $pref::Water::enableTrueReflections = false;
-         $pref::Video::enableParallaxMapping = false;
-         $pref::PostFX::EnableSSAO = false;
-         $pref::PostFX::EnableHDR = false;
-         $pref::PostFX::EnableDOF = false;
-         $pref::PostFX::EnableLightRays = false;
-         $pref::PostFX::EnableVignette = false;
-         
-         $pref::Video::AAMode = "None";
-         $pref::Video::AA = 0;
-         $pref::Video::defaultAnisotropy = 0;
+         AnisotropicFilterOptionsGroup.applySetting("None");
+         AntiAliasingOptionsGroup.applySetting("Off");
+         ParallaxOptionsGroup.applySetting("Off");
+         TrueWaterReflectionsOptionsGroup.applySetting("Off");
+         PostFXSSAOOptionsGroup.applySetting("Off");
+         PostFXDOFOptionsGroup.applySetting("Off");
+         PostFXVignetteOptionsGroup.applySetting("Off");
+         PostFXLightRayOptionsGroup.applySetting("Off");
       }
       }
    }   
    }   
    else
    else
@@ -1132,17 +1246,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
          //Should this default to on in ultra settings?
          //Should this default to on in ultra settings?
          $pref::Shadows::useShadowCaching = true;
          $pref::Shadows::useShadowCaching = true;
          
          
-         $pref::Water::enableTrueReflections = true;
-         $pref::Video::enableParallaxMapping = true;
-         $pref::PostFX::EnableSSAO = true;
-         $pref::PostFX::EnableHDR = true;
-         $pref::PostFX::EnableDOF = true;
-         $pref::PostFX::EnableLightRays = true;
-         $pref::PostFX::EnableVignette = true;
-         
-         $pref::Video::AAMode = "SMAA High";
-         $pref::Video::AA = 4;
-         $pref::Video::defaultAnisotropy = 16;
+         AnisotropicFilterOptionsGroup.applySetting("16x");
+         AntiAliasingOptionsGroup.applySetting("SMAA High");
+         ParallaxOptionsGroup.applySetting("On");
+         TrueWaterReflectionsOptionsGroup.applySetting("On");
+         PostFXSSAOOptionsGroup.applySetting("On");
+         PostFXDOFOptionsGroup.applySetting("On");
+         PostFXVignetteOptionsGroup.applySetting("On");
+         PostFXLightRayOptionsGroup.applySetting("On");
       }
       }
       else if ( %videoMem > 400 || %videoMem == 0 )
       else if ( %videoMem > 400 || %videoMem == 0 )
       {
       {
@@ -1159,17 +1270,14 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
          
          
          $pref::Shadows::useShadowCaching = true;
          $pref::Shadows::useShadowCaching = true;
          
          
-         $pref::Water::enableTrueReflections = true;
-         $pref::Video::enableParallaxMapping = true;
-         $pref::PostFX::EnableSSAO = false;
-         $pref::PostFX::EnableHDR = true;
-         $pref::PostFX::EnableDOF = true;
-         $pref::PostFX::EnableLightRays = true;
-         $pref::PostFX::EnableVignette = true;
-         
-         $pref::Video::AAMode = "SMAA";
-         $pref::Video::AA = 4;
-         $pref::Video::defaultAnisotropy = 4;
+         AnisotropicFilterOptionsGroup.applySetting("4x");
+         AntiAliasingOptionsGroup.applySetting("SMAA");
+         ParallaxOptionsGroup.applySetting("On");
+         TrueWaterReflectionsOptionsGroup.applySetting("On");
+         PostFXSSAOOptionsGroup.applySetting("Off");
+         PostFXDOFOptionsGroup.applySetting("On");
+         PostFXVignetteOptionsGroup.applySetting("On");
+         PostFXLightRayOptionsGroup.applySetting("On");
          
          
          if ( %videoMem == 0 )
          if ( %videoMem == 0 )
             echo("Torque was unable to detect available video memory. Applying 'Medium' quality.");
             echo("Torque was unable to detect available video memory. Applying 'Medium' quality.");
@@ -1189,31 +1297,17 @@ function AutodetectGraphics_Apply(%shaderVer, %intel, %videoMem )
          
          
          $pref::Shadows::useShadowCaching = true;
          $pref::Shadows::useShadowCaching = true;
          
          
-         $pref::Water::enableTrueReflections = true;
-         $pref::Video::enableParallaxMapping = true;
-         $pref::PostFX::EnableSSAO = false;
-         $pref::PostFX::EnableHDR = false;
-         $pref::PostFX::EnableDOF = false;
-         $pref::PostFX::EnableLightRays = false;
-         $pref::PostFX::EnableVignette = false;
-         
-         $pref::Video::AAMode = "FXAA";
-         $pref::Video::AA = 0;
-         $pref::Video::defaultAnisotropy = 0;
+         AnisotropicFilterOptionsGroup.applySetting("None");
+         AntiAliasingOptionsGroup.applySetting("FXAA");
+         ParallaxOptionsGroup.applySetting("On");
+         TrueWaterReflectionsOptionsGroup.applySetting("On");
+         PostFXSSAOOptionsGroup.applySetting("Off");
+         PostFXDOFOptionsGroup.applySetting("Off");
+         PostFXVignetteOptionsGroup.applySetting("Off");
+         PostFXLightRayOptionsGroup.applySetting("Off");
       }
       }
    }
    }
    
    
-   //%this.refresh();
-   
-   //%this.apply();
-   
-   //force postFX updates
-   PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO);
-   PostFXManager.settingsEffectSetEnabled(HDRPostFX, $pref::PostFX::EnableHDR);
-   PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF);
-   PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays);
-   PostFXManager.settingsEffectSetEnabled(VignettePostFX, $pref::PostFX::EnableVignette);
-   
    echo("Graphics quality settings have been auto detected.");
    echo("Graphics quality settings have been auto detected.");
 }
 }
 
 
@@ -1352,4 +1446,20 @@ function getDisplayDeviceId(%displayDeviceName)
    }
    }
    
    
    return -1;
    return -1;
+}
+
+function getDisplayDeviceName()
+{
+   %numDevices = Canvas.getMonitorCount();
+   %devicesList = "";
+   for(%i = 0; %i < %numDevices; %i++)
+   {
+      %device = (%i+1) @ " - " @ Canvas.getMonitorName(%i);
+      if(%i==0)
+         %devicesList = %device;
+      else
+         %devicesList = %devicesList @ "\t" @ %device;
+   }
+   
+   return getField(%devicesList, $pref::Video::deviceId);  
 }
 }

+ 21 - 0
Templates/BaseGame/game/core/sfx/scripts/audioOptions.tscript

@@ -80,3 +80,24 @@ function AudioSettingsGroup::populateSettings(%this)
       AudioSettingsDeviceGroup.add(%deviceEntry);
       AudioSettingsDeviceGroup.add(%deviceEntry);
    }
    }
 }
 }
+
+function AudioSettingsProviderGroup::onApply(%this)
+{
+   updateAudioOptionsSettings();
+}
+
+function AudioSettingsDeviceGroup::onApply(%this)
+{
+   updateAudioOptionsSettings(); 
+}
+
+function updateAudioOptionsSettings()
+{
+   if ( !sfxCreateDevice(  $pref::SFX::provider, 
+                           $pref::SFX::device, 
+                           $pref::SFX::useHardware,
+                           -1 ) )                              
+      error( "Unable to create SFX device: " @ $pref::SFX::provider 
+                                             SPC $pref::SFX::device 
+                                             SPC $pref::SFX::useHardware );
+}

+ 81 - 516
Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript

@@ -115,6 +115,9 @@ if(!isObject( OptionsMenuActionMap ) )
    
    
    OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
    OptionsMenuActionMap.bind( keyboard, R, OptionsMenuReset );
    OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
    OptionsMenuActionMap.bind( gamepad, btn_x, OptionsMenuReset );
+   
+   OptionsMenuActionMap.bind( keyboard, Enter, OptionsMenuActivateOption );
+   OptionsMenuActionMap.bind( gamepad, btn_a, OptionsMenuActivateOption );
 }
 }
 
 
 function OptionsMenuList::syncGui(%this)
 function OptionsMenuList::syncGui(%this)
@@ -178,6 +181,49 @@ function OptionsMenuList::syncGui(%this)
    }
    }
 }
 }
 
 
+function OptionsMenuList::checkForUnappliedChanges(%this)
+{
+   %unappliedChanges = false;
+   
+   foreach(%option in %this)
+   {
+      if(%option.class $= "OptionsListEntry")
+      {
+         if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
+         {
+            %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
+            
+            if(!%targetOptionLevel.isCurrent())
+               %unappliedChanges = true;
+            
+            if(%option.optionsObject.requiresRestart)
+               $optionsChangeRequiresRestart = true;
+         }
+      }
+   }
+   
+   return %unappliedChanges;
+}
+
+function OptionsMenuList::applyChanges(%this)
+{
+   foreach(%option in %this)
+   {
+      if(%option.class $= "OptionsListEntry")
+      {
+         //If it's custom or nonsensical index, there's some kind of external factor going on, so we're
+         //just going to skip applying it because we don't know what we'd be applying
+         if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
+         {
+            %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
+
+            if(!%targetOptionLevel.isCurrent())
+               %targetOptionLevel.apply();
+         }
+      }
+   }
+}
+
 function OptionsMenu::openOptionsCategory(%this, %categoryName)
 function OptionsMenu::openOptionsCategory(%this, %categoryName)
 {
 {
    VideoSettingsList.setVisible(%categoryName $= "Video");
    VideoSettingsList.setVisible(%categoryName $= "Video");
@@ -343,7 +389,7 @@ function OptionMenuPrevSetting(%val)
       
       
       %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
       %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
       
       
-      echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
+      //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
    }
    }
       
       
    $MenuList.syncGUI();
    $MenuList.syncGUI();
@@ -368,7 +414,7 @@ function OptionMenuNextSetting(%val)
       
       
       %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
       %newOptionLevel = %optionObject.getObject(%option.currentOptionIndex);
       
       
-      echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
+      //echo("Changed option: " @ %optionObject.optionName @ " from level: " @ %currentOptionLevel.displayName @ " to level: " @ %newOptionLevel.displayName);
    }
    }
       
       
    $MenuList.syncGUI();
    $MenuList.syncGUI();
@@ -379,6 +425,23 @@ function OptionMenuStickChangeSetting(%val)
    
    
 }
 }
  
  
+function OptionsMenuActivateOption(%val)
+{
+   if(!%val)
+      return;
+      
+   %option = $MenuList.getObject($MenuList.listPosition);
+   
+   if(!isObject(%option))
+      return;
+      
+      echo(%option.class);
+      
+   if(%option.class $= "OptionsKeybindEntry")
+   {
+      eval(%option-->button.altCommand);
+   }
+}
 //
 //
 //
 //
 //
 //
@@ -584,53 +647,12 @@ function tryCloseOptionsMenu(%val)
    if(!%val)
    if(!%val)
       return;
       return;
       
       
-   //scan through all our options and see if any are any unapplied changes. If
-   //so we need to prompt to apply or discard them
-   %unappliedChanges = false;
+   $optionsChangeRequiresRestart = false;
    
    
-   foreach(%option in VideoSettingsList)
-   {
-      if(%option.class $= "OptionsListEntry")
-      {
-         if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
-         {
-            %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
-            
-            echo("tryCloseOptionsMenu() - testing option: " @ %option.optionsObject.optionName @ " target level of: " @ %targetOptionLevel.displayName);
-            
-            if(!%targetOptionLevel.isCurrent())
-            {
-               %unappliedChanges = true;
-               break;
-            }
-         }
-      }
-   }
+   %unappliedVideoChanges = VideoSettingsList.checkForUnappliedChanges();
+   %unappliedAudioChanges = AudioSettingsList.checkForUnappliedChanges();
    
    
-   //check if we already have unapplied changes, so we can skip further iterating
-   if(!%unappliedChanges)
-   {
-      foreach(%option in AudioSettingsList)
-      {
-         if(%option.class $= "OptionsListEntry")
-         {
-            if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
-            {
-               %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
-               
-               echo("tryCloseOptionsMenu() - testing option: " @ %option.optionsObject.optionName @ " target level of: " @ %targetOptionLevel.displayName);
-               
-               if(!%targetOptionLevel.isCurrent())
-               {
-                  %unappliedChanges = true;
-                  break;
-               }
-            }
-         }
-      }
-   }
-   
-   if(%unappliedChanges)
+   if(%unappliedVideoChanges || %unappliedAudioChanges)
    {
    {
       MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", 
       MessageBoxOKCancel("Discard Changes?", "You have unapplied changes to your settings, do you wish to apply or discard them?", 
                         "OptionsMenu.applyChangedOptions();", "Canvas.popDialog(OptionsMenu);", 
                         "OptionsMenu.applyChangedOptions();", "Canvas.popDialog(OptionsMenu);", 
@@ -640,53 +662,27 @@ function tryCloseOptionsMenu(%val)
    {
    {
       Canvas.popDialog(OptionsMenu);
       Canvas.popDialog(OptionsMenu);
    }
    }
-}
+} 
 
 
 function OptionsMenu::applyChangedOptions(%this)
 function OptionsMenu::applyChangedOptions(%this)
 {
 {
-   foreach(%option in VideoSettingsList)
-   {
-      if(%option.class $= "OptionsListEntry")
-      {
-         //If it's custom or nonsensical index, there's some kind of external factor going on, so we're
-         //just going to skip applying it because we don't know what we'd be applying
-         if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
-         {
-            %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
-
-            if(!%targetOptionLevel.isCurrent())
-            {
-               echo("Applying setting of " @ %option.optionsObject.optionName);
-               %targetOptionLevel.apply();
-            }
-         }
-      }
-   }
+   VideoSettingsList.applyChanges();
+   AudioSettingsList.applyChanges();
    
    
-   foreach(%option in AudioSettingsList)
-   {
-      if(%option.class $= "OptionsListEntry")
-      {
-         //If it's custom or nonsensical index, there's some kind of external factor going on, so we're
-         //just going to skip applying it because we don't know what we'd be applying
-         if(%option.currentOptionIndex >= 0 && %option.currentOptionIndex < %option.optionsObject.getCount())
-         {
-            %targetOptionLevel = %option.optionsObject.getObject(%option.currentOptionIndex);
-
-            if(!%targetOptionLevel.isCurrent())
-            {
-               echo("Applying setting of " @ %option.optionsObject.optionName);
-               %targetOptionLevel.apply();
-            }
-         }
-      }
-   }
+   //$pref::SFX::masterVolume = OptionsMenuSettingsList.getValue(2);
+   sfxSetMasterVolume( $pref::SFX::masterVolume );
+   sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] );
+   sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
+   sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] );
    
    
    //Finally, write our prefs to file
    //Finally, write our prefs to file
    %prefPath = getPrefpath();
    %prefPath = getPrefpath();
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false);
    
    
    Canvas.popDialog(OptionsMenu);
    Canvas.popDialog(OptionsMenu);
+   
+   if($optionsChangeRequiresRestart)
+      MessageBoxOK("Restart Required", "Some of your changes require the game to be restarted.");
 }
 }
 
 
 function doKeyRemap( %optionEntry )
 function doKeyRemap( %optionEntry )
@@ -841,442 +837,11 @@ function OptionsMenu::apply(%this)
    OptionsMenu.unappliedChanges.empty();
    OptionsMenu.unappliedChanges.empty();
 }
 }
 
 
-function OptionsMenu::resetToDefaults(%this)
+function OptionsMenu::resetSettings(%this)
 {
 {
    MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", "");
    MessageBoxOKCancel("", "This will set the graphical settings back to the auto-detected defaults. Do you wish to continue?", "AutodetectGraphics();", "");
 }
 }
 
 
-//
-// old ones
-//
-function populateDisplaySettingsList()
-{
-   OptionsMenuSettingsList.clear();
-   
-   OptionsMenu.currentCategory = "Display";
-   
-   if(isObject(OptionName))
-   OptionName.setText("");
-   if(isObject(OptionDescription))
-   OptionDescription.setText("");
-   
-   %apiList = "";
-   %apiCount = GFXInit::getAdapterCount();
-   %apiIdx = 0;
-   for(%i=0; %i < %apiCount; %i++)
-   {
-      %api = GFXInit::getAdapterType(%i);
-      
-      if(%api !$= "NullDevice")
-      {
-         if(%apiIdx==0)
-            %apiList = %api;
-         else
-            %apiList = %apiList TAB %api;
-            
-         %apiIdx++;
-      }
-   }   
-   
-   trim(%apiList);
-   
-   %displayDevice = OptionsMenu.getOptionVariableValue("$pref::Video::displayDevice");
-   if(%displayDevice $= "")
-      %displayDevice = getDisplayDeviceType();
-   
-   OptionsMenuSettingsList.addOptionRow("Display API", "$pref::Video::displayDevice", %apiList, false, "",  true, "The display API used for rendering.", %displayDevice);
-   
-   %numDevices = Canvas.getMonitorCount();
- 
-   %devicesList = getDisplayDeviceList();
-   
-   if($pref::Video::displayDeviceId $= "")
-      $pref::Video::displayDeviceId = getField(%devicesList, $pref::Video::deviceId);
-      
-   OptionsMenuSettingsList.addOptionRow("Display Device", "$pref::Video::displayDeviceId", %devicesList, false, "", true, "The display devices the window should be on.");
-      
-   if (%numDevices > 1)
-      OptionsMenuSettingsList.setRowEnabled(1, true);
-   else
-      OptionsMenuSettingsList.setRowEnabled(1, false);
-   
-   %mode = OptionsMenu.getOptionVariableValue("$pref::Video::deviceMode");
-   if(isInt(%mode))
-      %mode = getField($Video::ModeTags, $pref::Video::deviceMode);
-   OptionsMenuSettingsList.addOptionRow("Window Mode", "$pref::Video::deviceMode", $Video::ModeTags, false, "", true, "", %mode);
-   
-   if(%mode !$= "Borderless")
-   {
-      %resolutionList = getScreenResolutionList($pref::Video::deviceId, $Video::Mode[%mode]);
-      %resolution = OptionsMenu.getOptionVariableValue("$pref::Video::Resolution");
-      if(%resolution $= "")
-         %resolution =  $pref::Video::mode;
-         
-      %resolution = _makePrettyResString(%resolution);
-   
-      OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "",  true, "Resolution of the game window", %resolution);
-
-      // If the requested resolution could not be set, mark the control and pref as changed.
-      %resControl = OptionsMenuSettingsList.getObject(OptionsMenuSettingsList.getCount()-1);
-      if (%resControl.getCurrentOption() !$= %resolution)
-         %resControl.onChange();
-   }
-   
-   OptionsMenuSettingsList.addOptionBoolRow("VSync", "$pref::Video::enableVerticalSync", $YesNoList, false, "",  true, "", "");
-
-
-   %refreshList = getScreenRefreshList($pref::Video::mode);
-   OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "",  true, "", OptionsMenu.getOptionVariableValue("$pref::Video::RefreshRate"));
-   
-   //move to gameplay tab
-   //OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", "");
-   
-   //OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", "");
-   //OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", "");
-}
-
-//
-// 
-//
-function populateGraphicsSettingsList()
-{
-   OptionsMenuSettingsList.clear();
-   
-   OptionsMenu.currentCategory = "Graphics";
-   
-   if(isObject(OptionName))
-   OptionName.setText("");
-   if(isObject(OptionDescription))
-   OptionDescription.setText("");
-   
-   %yesNoList = "No\tYes";
-   %onOffList = "Off\tOn";
-   %anisoFilter = "Off\t4\t8\t16";
-   %aaTypeFilter = "None\tFXAA\tSMAA\tSMAA High";
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Lighting Quality", "$pref::Graphics::LightingQuality", 
-      LightingQualityList, false, "",  true, "Amount and drawdistance of local lights");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Shadow Quality", "$pref::Graphics::ShadowQuality", 
-      ShadowQualityList, false, "",  true, "Shadow revolution quality");
-   
-   %shadowQuality = OptionsMenu.getOptionVariableValue("$pref::Graphics::ShadowQuality");
-   if(%shadowQuality !$= "None")
-   {
-      OptionsMenuSettingsList.addOptionQualityLevelRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", 
-         SoftShadowList, false, "",  true, "Amount of softening applied to shadowmaps");
-   }
-   
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Mesh Quality", "$pref::Graphics::MeshQuality", 
-      MeshQualityGroup, false, "",  true, "Fidelity of rendering of mesh objects");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", 
-      MeshDrawDistQualityGroup, false, "",  true, "Dictates if and when static objects fade out in the distance");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Texture Quality", "$pref::Graphics::TextureQuality", 
-      TextureQualityGroup, false, "",  true, "Fidelity of textures");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Terrain Quality", "$pref::Graphics::TerrainQuality", 
-      TerrainQualityGroup, false, "",  true, "Quality level of terrain objects");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", 
-      DecalLifetimeGroup, false, "",  true, "How long decals are rendered");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", 
-      GroundCoverDensityGroup, false, "",  true, "Density of ground cover items, such as grass");
-   OptionsMenuSettingsList.addOptionQualityLevelRow("Shader Quality", "$pref::Graphics::ShaderQuality", 
-      ShaderQualityGroup, false, "",  true, "Dictates the overall shader quality level, adjusting what features are enabled.");
-   OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "",  true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance");
-   
-   OptionsMenuSettingsList.addOptionRow("Anti-Aliasing Type", "$pref::Video::AAMode", %aaTypeFilter, false, "",  true, "The Anti-Aliasing Method applied to rendering");
-
-   OptionsMenuSettingsList.addOptionBoolRow("Parallax", "$pref::Video::enableParallaxMapping", %onOffList, false, "",  true, "Whether the surface parallax shader effect is enabled", "");
-   OptionsMenuSettingsList.addOptionBoolRow("Water Reflections", "$pref::Water::enableTrueReflections", %onOffList, false, "",  true, "Whether water reflections are enabled", "");
-   
-   OptionsMenuSettingsList.addOptionBoolRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "",  true, "Whether Screen-Space Ambient Occlusion is enabled");
-   OptionsMenuSettingsList.addOptionBoolRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "",  true, "Whether the Depth of Field effect is enabled");
-   OptionsMenuSettingsList.addOptionBoolRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "",  true, "Whether the vignette effect is enabled");
-   OptionsMenuSettingsList.addOptionBoolRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "",  true, "Whether the light rays effect is enabled");
-}
-
-function updateGraphicsSettings()
-{
-   if($pref::Graphics::LightingQuality !$= getCurrentQualityLevel(LightingQualityList))
-      LightingQualityList.applySetting($pref::Graphics::LightingQuality);
-   if($pref::Graphics::ShadowQuality !$= getCurrentQualityLevel(ShadowQualityList))
-      ShadowQualityList.applySetting($pref::Graphics::ShadowQuality);
-   if($pref::Graphics::SoftShadowQuality !$= getCurrentQualityLevel(SoftShadowList))
-      SoftShadowList.applySetting($pref::Graphics::SoftShadowQuality);
-      
-   if($pref::Graphics::MeshQuality !$= getCurrentQualityLevel(MeshQualityGroup))
-      MeshQualityGroup.applySetting($pref::Graphics::MeshQuality);
-   if($pref::Graphics::ObjectDrawDistance !$= getCurrentQualityLevel(MeshDrawDistQualityGroup))
-      MeshDrawDistQualityGroup.applySetting($pref::Graphics::ObjectDrawDistance);
-   if($pref::Graphics::TextureQuality !$= getCurrentQualityLevel(TextureQualityGroup))
-   {
-      TextureQualityGroup.applySetting($pref::Graphics::TextureQuality);
-      
-      reloadTextures();
-   }
-   if($pref::Graphics::TerrainQuality !$= getCurrentQualityLevel(TerrainQualityGroup))
-      TerrainQualityGroup.applySetting($pref::Graphics::TerrainQuality);
-   if($pref::Graphics::DecalLifetime !$= getCurrentQualityLevel(DecalLifetimeGroup))
-      DecalLifetimeGroup.applySetting($pref::Graphics::DecalLifetime);
-   if($pref::Graphics::GroundCoverDensity !$= getCurrentQualityLevel(GroundCoverDensityGroup))
-      GroundCoverDensityGroup.applySetting($pref::Graphics::GroundCoverDensity);
-   if($pref::Graphics::ShaderQuality !$= getCurrentQualityLevel(ShaderQualityGroup))
-   {
-      ShaderQualityGroup.applySetting($pref::Graphics::ShaderQuality);
-      //this has ties into postFX behaviors, so we'll force an update to it here
-      updatePostFXSettings();
-   }
-}
-
-/*function updateDisplaySettings()
-{
-   //Update the display settings now
-   %deviceName = getDisplayDeviceName();
-   %newDeviceID = getWord(%deviceName, 0) - 1;
-   
-   if(!isInt($pref::Video::deviceMode))
-   {
-      //probably saved out as the mode name, so just translate it back
-      for(%i=0; %i < getFieldCount($Video::ModeTags); %i++)
-      {
-         if(getField($Video::ModeTags, %i) $= $pref::Video::deviceMode)
-         {
-            $pref::Video::deviceMode = %i;
-            break;
-         }
-      }
-   }
-   
-   %deviceModeName = getField($Video::ModeTags, $pref::Video::deviceMode);
-   %newDeviceMode = 0;
-   foreach$(%modeName in $Video::ModeTags)
-   {
-      if (%deviceModeName $= %modeName)
-         break;
-      else
-         %newDeviceMode++;
-   }
-   
-   if($pref::Video::deviceMode == $Video::ModeBorderless)
-   {
-      //if we're changing to borderless, we swap to the full resolution of the desktop  
-      $pref::Video::mode = Canvas.getBestCanvasRes($pref::Video::deviceId, $pref::Video::deviceMode);
-      
-      $pref::Video::Resolution = $pref::Video::mode.x SPC $pref::Video::mode.y;
-   }
-
-   %newRes = $pref::Video::Resolution;
-   %newBpp = 32; // ... its not 1997 anymore.
-	%newFullScreen = %deviceModeName $= "Fullscreen" ? true : false;
-	%newRefresh    = $pref::Video::RefreshRate;
-	%newVsync = $pref::Video::enableVerticalSync;	
-	%newAA = $pref::Video::AA;
-	
-   // Build the final mode string.
-	%newMode = $pref::Video::Resolution SPC %newFullScreen SPC %newBpp SPC %newRefresh SPC %newAA;
-	
-   // Change the video mode.   
-   if (  %newMode !$= $pref::Video::mode || %newDeviceID != $pref::Video::deviceId ||
-         %newVsync != $pref::Video::enableVerticalSync || %newDeviceMode != $pref::Video::deviceMode)
-   {
-      //****Edge Case Hack
-      // If we're in fullscreen mode and switching to a different monitor at the
-      // same resolution and maintaining fullscreen, GFX...WindowTarget::resetMode()
-      // will early-out because there is no "mode change" and the monitor change
-      // will not get applied. Instead of modifying platform code, we're going to
-      // move onto the new monitor in borderless and immediately switch to FS.
-      if (%newFullScreen && $pref::Video::FullScreen &&
-         ($pref::Video::Resolution $= %newRes) && ($pref::Video::deviceId != %newDeviceID))
-      {
-         $pref::Video::deviceId = %newDeviceID;
-         $pref::Video::deviceMode = $Video::ModeBorderless;
-         %tmpModeStr = Canvas.getMonitorMode(%newDeviceID, 0);
-         Canvas.setVideoMode(%tmpModeStr.x, %tmpModeStr.y, false, 32, getWord(%tmpModeStr, $WORD::REFRESH), %newAA);
-      }
-
-      $pref::Video::mode = %newMode;
-      $pref::Video::enableVerticalSync = %newVsync;
-      $pref::Video::deviceId = %newDeviceID;
-      $pref::Video::deviceMode = %newDeviceMode;
-      $pref::Video::Resolution = %newRes;
-      $pref::Video::FullScreen = %newFullScreen;
-      $pref::Video::RefreshRate = %newRefresh;
-      $pref::Video::AA = %newAA;
-      configureCanvas();
-   }
-}*/
-
-function updatePostFXSettings()
-{
-   PostFXManager.settingsEffectSetEnabled(SSAOPostFx, $pref::PostFX::EnableSSAO);
-   PostFXManager.settingsEffectSetEnabled(DepthOfFieldPostFX, $pref::PostFX::EnableDOF);
-   PostFXManager.settingsEffectSetEnabled(LightRayPostFX, $pref::PostFX::EnableLightRays);
-   PostFXManager.settingsEffectSetEnabled(vignettePostFX, $pref::PostFX::EnableVignette);
-}
-
-//
-//
-//
-function populateAudioSettingsList()
-{
-   OptionsMenuSettingsList.clear();
-   
-   OptionsMenu.currentCategory = "Audio";
-   
-   if(isObject(OptionName))
-   OptionName.setText("");
-   if(isObject(OptionDescription))
-   OptionDescription.setText("");
-   
-   %buffer = sfxGetAvailableDevices();
-   %count = getRecordCount( %buffer );  
-   %audioDriverList = "";
-   %audioProviderList = "";
-   %audioDeviceList = "";
-    
-   $currentAudioProvider = $currentAudioProvider $= "" ? $pref::SFX::provider : $currentAudioProvider;
-   
-   for(%i = 0; %i < %count; %i++)
-   {
-      %record = getRecord(%buffer, %i);
-      %provider = getField(%record, 0);
-      %device = getField(%record, 1);
-      
-      //When the client is actually running, we don't care about null audo devices
-      if(%provider $= "null")
-         continue;
-      
-      if(%audioProviderList $= "")
-         %audioProviderList = %provider;
-      else 
-         %audioProviderList = %audioProviderList @ "\t" @ %provider;
-         
-      if(%provider $= $currentAudioProvider)
-      {
-         if(%audioDeviceList $= "")
-            %audioDeviceList = %device;
-         else 
-            %audioDeviceList = %audioDeviceList @ "\t" @ %device;  
-      }
-   }
-   
-   OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::provider", %audioProviderList, false, "audioProviderChanged", true, "");
-   OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true);
-   
-   OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[" @ $GuiAudioType @ "]", 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[" @ $SimAudioType @ "]", 0.1, "0 1", "");
-   OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[" @ $MusicAudioType @ "]", 0.1, "0 1", "");
-}
-
-function audioProviderChanged()
-{
-   //Get the option we have set for the provider
-   %provider = OptionsMenuSettingsList.getCurrentOption(0);
-   $currentAudioProvider = %provider;
-   
-   //And now refresh the list to get the correct devices
-   populateAudioSettingsList();
-}
-
-function updateAudioSettings()
-{
-   //$pref::SFX::masterVolume = OptionsMenuSettingsList.getValue(2);
-   sfxSetMasterVolume( $pref::SFX::masterVolume );
-   
-   //$pref::SFX::channelVolume[ $GuiAudioType ] = OptionsMenuSettingsList.getValue(3);
-   //$pref::SFX::channelVolume[ $SimAudioType ] = OptionsMenuSettingsList.getValue(4);
-   //$pref::SFX::channelVolume[ $MusicAudioType ] = OptionsMenuSettingsList.getValue(5);
-   
-   sfxSetChannelVolume( $GuiAudioType, $pref::SFX::channelVolume[ $GuiAudioType ] );
-   sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] );
-   sfxSetChannelVolume( $MusicAudioType, $pref::SFX::channelVolume[ $MusicAudioType ] );
-   
-   //$pref::SFX::provider = OptionsMenuSettingsList.getCurrentOption(0);
-   //$pref::SFX::device = OptionsMenuSettingsList.getCurrentOption(1);
-   
-   if ( !sfxCreateDevice(  $pref::SFX::provider, 
-                           $pref::SFX::device, 
-                           $pref::SFX::useHardware,
-                           -1 ) )                              
-      error( "Unable to create SFX device: " @ $pref::SFX::provider 
-                                             SPC $pref::SFX::device 
-                                             SPC $pref::SFX::useHardware );        
-
-   if( !isObject( $AudioTestHandle ) )
-   {
-      sfxPlay(menuButtonPressed);  
-   }
-}
-
-//
-//
-//
-function MenuOptionsButton::onChange(%this)
-{
-   %optionMode = %this.getMode();
-   %optionName = %this.getLabel();
-   %tooltipText = %this.getTooltip();
-   
-   %targetVar = %this.targetPrefVar;
-   
-   OptionName.setText(%optionName);
-   OptionDescription.setText(%tooltipText);
-   
-   if(%optionMode == 0)
-   {
-      %currentValue = %this.getCurrentOption();
-      if(%currentValue !$= "")
-      {
-         if(%currentValue $= "yes" || %currentValue $= "on")
-            %saveReadyValue = 1;
-         else if(%currentValue $= "no" || %currentValue $= "off")
-            %saveReadyValue = 0;
-         else 
-            %saveReadyValue = %currentValue;
-         
-         %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar);
-         if(%prefIndex == -1)
-         {
-            echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %saveReadyValue);
-            OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %saveReadyValue @ "\"" );
-         }
-         else
-         {
-            echo("Setting UnappliedChanges via modify: key:" @ %targetVar @", value: " @ %saveReadyValue);
-            OptionsMenu.unappliedChanges.setValue("\"" @ %saveReadyValue @ "\"", %prefIndex);
-         }
-      }
-   }
-   else if(%optionMode == 1)
-   {
-      %currentValue = %this.getValue();
-      
-      %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetVar);
-      if(%prefIndex == -1)
-      {
-         echo("Setting UnappliedChanges via add: key:" @ %targetVar @", value: " @ %currentValue);
-         OptionsMenu.unappliedChanges.add(%targetVar, "\"" @ %currentValue @ "\"" );
-      }
-      else
-      {
-         OptionsMenu.unappliedChanges.setValue("\"" @ %currentValue @ "\"", %prefIndex);
-      }
-   }
-   
-   //Update the UI in case there's responsive logic
-   OptionsMenu.schedule(32, "refresh");
-}
-
-function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind)
-{
-   %prefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%actionMap);
-   if(%prefIndex == -1)
-      OptionsMenu.unappliedChanges.add(%actionMap, %keybind);
-   else
-      OptionsMenu.unappliedChanges.setValue(%keybind, %prefIndex);
-}
-
-//
-// new
-//
 function addOptionGroup(%displayName)
 function addOptionGroup(%displayName)
 {
 {
    %group = new GuiTextCtrl() {
    %group = new GuiTextCtrl() {