Changeset View
Changeset View
Standalone View
Standalone View
source/ps/GameSetup/HWDetect.cpp
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | |||||
static void ReportGLLimits(const ScriptInterface& scriptInterface, JS::HandleValue settings); | static void ReportGLLimits(const ScriptInterface& scriptInterface, JS::HandleValue settings); | ||||
#if ARCH_X86_X64 | #if ARCH_X86_X64 | ||||
void ConvertCaches(const ScriptInterface& scriptInterface, x86_x64::IdxCache idxCache, JS::MutableHandleValue ret) | void ConvertCaches(const ScriptInterface& scriptInterface, x86_x64::IdxCache idxCache, JS::MutableHandleValue ret) | ||||
{ | { | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
scriptInterface.CreateArray(ret); | ScriptInterface::CreateArray(cx, ret); | ||||
for (size_t idxLevel = 0; idxLevel < x86_x64::Cache::maxLevels; ++idxLevel) | for (size_t idxLevel = 0; idxLevel < x86_x64::Cache::maxLevels; ++idxLevel) | ||||
{ | { | ||||
const x86_x64::Cache* pcache = x86_x64::Caches(idxCache+idxLevel); | const x86_x64::Cache* pcache = x86_x64::Caches(idxCache+idxLevel); | ||||
if (pcache->m_Type == x86_x64::Cache::kNull || pcache->m_NumEntries == 0) | if (pcache->m_Type == x86_x64::Cache::kNull || pcache->m_NumEntries == 0) | ||||
continue; | continue; | ||||
JS::RootedValue cache(cx); | JS::RootedValue cache(cx); | ||||
scriptInterface.CreateObject( | ScriptInterface::CreateObject( | ||||
cx, | |||||
&cache, | &cache, | ||||
"type", static_cast<u32>(pcache->m_Type), | "type", static_cast<u32>(pcache->m_Type), | ||||
"level", static_cast<u32>(pcache->m_Level), | "level", static_cast<u32>(pcache->m_Level), | ||||
"associativity", static_cast<u32>(pcache->m_Associativity), | "associativity", static_cast<u32>(pcache->m_Associativity), | ||||
"linesize", static_cast<u32>(pcache->m_EntrySize), | "linesize", static_cast<u32>(pcache->m_EntrySize), | ||||
"sharedby", static_cast<u32>(pcache->m_SharedBy), | "sharedby", static_cast<u32>(pcache->m_SharedBy), | ||||
"totalsize", static_cast<u32>(pcache->TotalSize())); | "totalsize", static_cast<u32>(pcache->TotalSize())); | ||||
scriptInterface.SetPropertyInt(ret, idxLevel, cache); | scriptInterface.SetPropertyInt(ret, idxLevel, cache); | ||||
} | } | ||||
} | } | ||||
void ConvertTLBs(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret) | void ConvertTLBs(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret) | ||||
{ | { | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
scriptInterface.CreateArray(ret); | ScriptInterface::CreateArray(cx, ret); | ||||
for(size_t i = 0; ; i++) | for(size_t i = 0; ; i++) | ||||
{ | { | ||||
const x86_x64::Cache* ptlb = x86_x64::Caches(x86_x64::TLB+i); | const x86_x64::Cache* ptlb = x86_x64::Caches(x86_x64::TLB+i); | ||||
if (!ptlb) | if (!ptlb) | ||||
break; | break; | ||||
JS::RootedValue tlb(cx); | JS::RootedValue tlb(cx); | ||||
scriptInterface.CreateObject( | ScriptInterface::CreateObject( | ||||
cx, | |||||
&tlb, | &tlb, | ||||
"type", static_cast<u32>(ptlb->m_Type), | "type", static_cast<u32>(ptlb->m_Type), | ||||
"level", static_cast<u32>(ptlb->m_Level), | "level", static_cast<u32>(ptlb->m_Level), | ||||
"associativity", static_cast<u32>(ptlb->m_Associativity), | "associativity", static_cast<u32>(ptlb->m_Associativity), | ||||
"pagesize", static_cast<u32>(ptlb->m_EntrySize), | "pagesize", static_cast<u32>(ptlb->m_EntrySize), | ||||
"entries", static_cast<u32>(ptlb->m_NumEntries)); | "entries", static_cast<u32>(ptlb->m_NumEntries)); | ||||
scriptInterface.SetPropertyInt(ret, i, tlb); | scriptInterface.SetPropertyInt(ret, i, tlb); | ||||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | void RunHardwareDetection() | ||||
std::string code = file.DecodeUTF8(); // assume it's UTF-8 | std::string code = file.DecodeUTF8(); // assume it's UTF-8 | ||||
scriptInterface.LoadScript(scriptName, code); | scriptInterface.LoadScript(scriptName, code); | ||||
// Collect all the settings we'll pass to the script: | // Collect all the settings we'll pass to the script: | ||||
// (We'll use this same data for the opt-in online reporting system, so it | // (We'll use this same data for the opt-in online reporting system, so it | ||||
// includes some fields that aren't directly useful for the hwdetect script) | // includes some fields that aren't directly useful for the hwdetect script) | ||||
JS::RootedValue settings(cx); | JS::RootedValue settings(cx); | ||||
scriptInterface.CreateObject(&settings); | ScriptInterface::CreateObject(cx, &settings); | ||||
scriptInterface.SetProperty(settings, "os_unix", OS_UNIX); | scriptInterface.SetProperty(settings, "os_unix", OS_UNIX); | ||||
scriptInterface.SetProperty(settings, "os_bsd", OS_BSD); | scriptInterface.SetProperty(settings, "os_bsd", OS_BSD); | ||||
scriptInterface.SetProperty(settings, "os_linux", OS_LINUX); | scriptInterface.SetProperty(settings, "os_linux", OS_LINUX); | ||||
scriptInterface.SetProperty(settings, "os_android", OS_ANDROID); | scriptInterface.SetProperty(settings, "os_android", OS_ANDROID); | ||||
scriptInterface.SetProperty(settings, "os_macosx", OS_MACOSX); | scriptInterface.SetProperty(settings, "os_macosx", OS_MACOSX); | ||||
scriptInterface.SetProperty(settings, "os_win", OS_WIN); | scriptInterface.SetProperty(settings, "os_win", OS_WIN); | ||||
▲ Show 20 Lines • Show All 518 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator