Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/scripting/JSInterface_Debug.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | void JSI_Debug::DebugWarn(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | ||||
debug_warn(L"Warning at user's request."); | debug_warn(L"Warning at user's request."); | ||||
} | } | ||||
void JSI_Debug::DisplayErrorDialog(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& msg) | void JSI_Debug::DisplayErrorDialog(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& msg) | ||||
{ | { | ||||
debug_DisplayError(msg.c_str(), DE_NO_DEBUG_INFO, NULL, NULL, NULL, 0, NULL, NULL); | debug_DisplayError(msg.c_str(), DE_NO_DEBUG_INFO, NULL, NULL, NULL, 0, NULL, NULL); | ||||
} | } | ||||
JS::Value JSI_Debug::GetProfilerState(ScriptInterface::CxPrivate* pCxPrivate) | |||||
{ | |||||
return g_ProfileViewer.SaveToJS(*(pCxPrivate->pScriptInterface)); | |||||
} | |||||
// Return the date/time at which the current executable was compiled. | // Return the date/time at which the current executable was compiled. | ||||
// params: mode OR an integer specifying | // params: mode OR an integer specifying | ||||
// what to display: -1 for "date time (svn revision)", 0 for date, 1 for time, 2 for svn revision | // what to display: -1 for "date time (svn revision)", 0 for date, 1 for time, 2 for svn revision | ||||
// returns: string with the requested timestamp info | // returns: string with the requested timestamp info | ||||
// notes: | // notes: | ||||
// - Displayed on main menu screen; tells non-programmers which auto-build | // - Displayed on main menu screen; tells non-programmers which auto-build | ||||
// they are running. Could also be determined via .EXE file properties, | // they are running. Could also be determined via .EXE file properties, | ||||
// but that's a bit more trouble. | // but that's a bit more trouble. | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | void JSI_Debug::SetUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled) | ||||
g_UserReporter.SetReportingEnabled(enabled); | g_UserReporter.SetReportingEnabled(enabled); | ||||
} | } | ||||
std::string JSI_Debug::GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | std::string JSI_Debug::GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) | ||||
{ | { | ||||
return g_UserReporter.GetStatus(); | return g_UserReporter.GetStatus(); | ||||
} | } | ||||
void JSI_Debug::SubmitUserReport(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& type, int version, const std::wstring& data) | |||||
{ | |||||
g_UserReporter.SubmitReport(type.c_str(), version, utf8_from_wstring(data)); | |||||
} | |||||
void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface) | ||||
{ | { | ||||
scriptInterface.RegisterFunction<double, &GetMicroseconds>("GetMicroseconds"); | scriptInterface.RegisterFunction<double, &GetMicroseconds>("GetMicroseconds"); | ||||
scriptInterface.RegisterFunction<int, &Crash>("Crash"); | scriptInterface.RegisterFunction<int, &Crash>("Crash"); | ||||
scriptInterface.RegisterFunction<void, &DebugWarn>("DebugWarn"); | scriptInterface.RegisterFunction<void, &DebugWarn>("DebugWarn"); | ||||
scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog"); | scriptInterface.RegisterFunction<void, std::wstring, &DisplayErrorDialog>("DisplayErrorDialog"); | ||||
scriptInterface.RegisterFunction<JS::Value, &GetProfilerState>("GetProfilerState"); | |||||
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp"); | scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp"); | ||||
// User report functions | // User report functions | ||||
scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled"); | scriptInterface.RegisterFunction<bool, &IsUserReportEnabled>("IsUserReportEnabled"); | ||||
scriptInterface.RegisterFunction<void, bool, &SetUserReportEnabled>("SetUserReportEnabled"); | scriptInterface.RegisterFunction<void, bool, &SetUserReportEnabled>("SetUserReportEnabled"); | ||||
scriptInterface.RegisterFunction<std::string, &GetUserReportStatus>("GetUserReportStatus"); | scriptInterface.RegisterFunction<std::string, &GetUserReportStatus>("GetUserReportStatus"); | ||||
scriptInterface.RegisterFunction<void, std::string, int, std::wstring, &SubmitUserReport>("SubmitUserReport"); | |||||
} | } |
Wildfire Games · Phabricator