Automatically disable audio on OS X since it's stupid and broken.

This was SVN commit r8788.
This commit is contained in:
Ykkrosh 2010-12-04 19:42:50 +00:00
parent 5df240d97d
commit 819bacd538
3 changed files with 41 additions and 5 deletions

View File

@ -28,7 +28,7 @@
type="text"
sprite="bkTranslucent"
textcolor="255 255 0"
size="4 4 220 210"
size="4 24 220 230"
>[font="serif-bold-16"]Alpha version[/font]
Warning: This is an early development version of the game and many features have not been added yet, but we hope this gives you a glimpse of the game’s vision.

View File

@ -34,13 +34,24 @@ and driver bugs based on experience of particular system configurations.
function RunDetection(settings)
{
// This function should have no side effects, it should just
// set these output properties:
// List of warning strings to display to the user
// in an ugly GUI dialog box
var dialog_warnings = [];
// List of warning strings to log
var warnings = [];
var disable_audio = undefined;
// TODO: add some mechanism for setting config values
// (overriding default.cfg, but overridden by local.cfg)
// Extract all the settings we might use from the argument:
// (This is less error-prone than referring to "settings.foo" directly
// since typos will be caught)
@ -84,11 +95,22 @@ function RunDetection(settings)
// "Fixed a race condition in OpenGL that could cause crashes with multithreaded applications."
if (os_unix && gl_version.match(/NVIDIA 260\.19\.(0[0-9]|1[0-9]|20)$/))
{
warnings.push("You are using 260.19.* series NVIDIA drivers, which may crash the game. Please upgrade to 260.19.21 or later.");
dialog_warnings.push("You are using 260.19.* series NVIDIA drivers, which may crash the game. Please upgrade to 260.19.21 or later.");
}
// http://trac.wildfiregames.com/ticket/685
if (os_macosx)
{
warnings.push("Audio has been disabled, due to problems with OpenAL on OS X.");
disable_audio = true;
}
return { "warnings": warnings };
return {
"dialog_warnings": dialog_warnings,
"warnings": warnings,
"disable_audio": disable_audio,
};
}
global.RunHardwareDetection = function(settings)
@ -99,9 +121,15 @@ global.RunHardwareDetection = function(settings)
//print(uneval(output)+"\n");
if (output.warnings.length)
for (var i = 0; i < output.warnings.length; ++i)
warn(output.warnings[i]);
if (output.dialog_warnings.length)
{
var msg = output.warnings.join("\n\n");
var msg = output.dialog_warnings.join("\n\n");
Engine.DisplayErrorDialog(msg);
}
if (output.disable_audio !== undefined)
Engine.SetDisableAudio(output.disable_audio);
};

View File

@ -28,11 +28,19 @@
#include "ps/CLogger.h"
#include "ps/Filesystem.h"
#include "ps/VideoMode.h"
#include "ps/GameSetup/Config.h"
void SetDisableAudio(void* UNUSED(cbdata), bool disabled)
{
g_DisableAudio = disabled;
}
void RunHardwareDetection()
{
ScriptInterface& scriptInterface = g_ScriptingHost.GetScriptInterface();
scriptInterface.RegisterFunction<void, bool, &SetDisableAudio>("SetDisableAudio");
// Load the detection script:
const wchar_t* scriptName = L"hwdetect/hwdetect.js";