Changeset View
Changeset View
Standalone View
Standalone View
source/ps/GameSetup/HWDetect.cpp
Show All 38 Lines | |||||
#include "ps/ConfigDB.h" | #include "ps/ConfigDB.h" | ||||
#include "ps/Filesystem.h" | #include "ps/Filesystem.h" | ||||
#include "ps/GameSetup/Config.h" | #include "ps/GameSetup/Config.h" | ||||
#include "ps/Profile.h" | #include "ps/Profile.h" | ||||
#include "ps/scripting/JSInterface_ConfigDB.h" | #include "ps/scripting/JSInterface_ConfigDB.h" | ||||
#include "ps/scripting/JSInterface_Debug.h" | #include "ps/scripting/JSInterface_Debug.h" | ||||
#include "ps/UserReport.h" | #include "ps/UserReport.h" | ||||
#include "ps/VideoMode.h" | #include "ps/VideoMode.h" | ||||
#include "scriptinterface/FunctionWrapper.h" | |||||
// TODO: Support OpenGL platforms which don’t use GLX as well. | // TODO: Support OpenGL platforms which don’t use GLX as well. | ||||
#if defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES | #if defined(SDL_VIDEO_DRIVER_X11) && !CONFIG2_GLES | ||||
#include <GL/glx.h> | #include <GL/glx.h> | ||||
#include <SDL_syswm.h> | #include <SDL_syswm.h> | ||||
// Define the GLX_MESA_query_renderer macros if built with | // Define the GLX_MESA_query_renderer macros if built with | ||||
// an old Mesa (<10.0) that doesn't provide them | // an old Mesa (<10.0) that doesn't provide them | ||||
▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
// has explicitly set a config variable to override that. | // has explicitly set a config variable to override that. | ||||
// (TODO: This is an ugly abuse of the config system) | // (TODO: This is an ugly abuse of the config system) | ||||
static bool IsOverridden(const char* setting) | static bool IsOverridden(const char* setting) | ||||
{ | { | ||||
EConfigNamespace ns = g_ConfigDB.GetValueNamespace(CFG_COMMAND, setting); | EConfigNamespace ns = g_ConfigDB.GetValueNamespace(CFG_COMMAND, setting); | ||||
return !(ns == CFG_LAST || ns == CFG_DEFAULT); | return !(ns == CFG_LAST || ns == CFG_DEFAULT); | ||||
} | } | ||||
void SetDisableAudio(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool disabled) | void SetDisableAudio(bool disabled) | ||||
{ | { | ||||
g_DisableAudio = disabled; | g_DisableAudio = disabled; | ||||
} | } | ||||
void RunHardwareDetection() | void RunHardwareDetection() | ||||
{ | { | ||||
TIMER(L"RunHardwareDetection"); | TIMER(L"RunHardwareDetection"); | ||||
ScriptInterface scriptInterface("Engine", "HWDetect", g_ScriptRuntime); | ScriptInterface scriptInterface("Engine", "HWDetect", g_ScriptRuntime); | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JSI_Debug::RegisterScriptFunctions(scriptInterface); // Engine.DisplayErrorDialog | JSI_Debug::RegisterScriptFunctions(scriptInterface); // Engine.DisplayErrorDialog | ||||
JSI_ConfigDB::RegisterScriptFunctions(scriptInterface); | JSI_ConfigDB::RegisterScriptFunctions(scriptInterface); | ||||
scriptInterface.RegisterFunction<void, bool, &SetDisableAudio>("SetDisableAudio"); | ScriptWrapper::WrapAndRegister<decltype(&SetDisableAudio), &SetDisableAudio>(scriptInterface, "SetDisableAudio"); | ||||
// Load the detection script: | // Load the detection script: | ||||
const wchar_t* scriptName = L"hwdetect/hwdetect.js"; | const wchar_t* scriptName = L"hwdetect/hwdetect.js"; | ||||
CVFSFile file; | CVFSFile file; | ||||
if (file.Load(g_VFS, scriptName) != PSRETURN_OK) | if (file.Load(g_VFS, scriptName) != PSRETURN_OK) | ||||
{ | { | ||||
LOGERROR("Failed to load hardware detection script"); | LOGERROR("Failed to load hardware detection script"); | ||||
▲ Show 20 Lines • Show All 558 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator