2021-05-03 09:07:26 -07:00
|
|
|
/* Copyright (C) 2021 Wildfire Games.
|
2015-09-21 10:14:26 -07:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
2018-04-27 09:48:44 -07:00
|
|
|
#include "JSInterface_VisualReplay.h"
|
2016-08-02 09:58:30 -07:00
|
|
|
|
|
|
|
|
#include "ps/CStr.h"
|
2015-09-21 10:14:26 -07:00
|
|
|
#include "ps/VisualReplay.h"
|
2021-03-02 12:01:14 -08:00
|
|
|
#include "scriptinterface/FunctionWrapper.h"
|
2021-05-03 09:07:26 -07:00
|
|
|
#include "scriptinterface/ScriptRequest.h"
|
2015-09-21 10:14:26 -07:00
|
|
|
|
2021-03-02 12:01:14 -08:00
|
|
|
namespace JSI_VisualReplay
|
2015-09-21 10:14:26 -07:00
|
|
|
{
|
2021-03-02 12:01:14 -08:00
|
|
|
CStrW GetReplayDirectoryName(const CStrW& directoryName)
|
2015-09-21 10:14:26 -07:00
|
|
|
{
|
2021-11-19 03:34:26 -08:00
|
|
|
// The string conversion is added to account for non-latin characters.
|
|
|
|
|
return wstring_from_utf8(OsPath(VisualReplay::GetDirectoryPath() / directoryName).string8());
|
2015-09-21 10:14:26 -07:00
|
|
|
}
|
|
|
|
|
|
2021-03-02 12:01:14 -08:00
|
|
|
void RegisterScriptFunctions(const ScriptRequest& rq)
|
2015-09-21 10:14:26 -07:00
|
|
|
{
|
2021-03-02 12:01:14 -08:00
|
|
|
ScriptFunction::Register<&VisualReplay::GetReplays>(rq, "GetReplays");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::DeleteReplay>(rq, "DeleteReplay");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::StartVisualReplay>(rq, "StartVisualReplay");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::GetReplayAttributes>(rq, "GetReplayAttributes");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::GetReplayMetadata>(rq, "GetReplayMetadata");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::HasReplayMetadata>(rq, "HasReplayMetadata");
|
|
|
|
|
ScriptFunction::Register<&VisualReplay::AddReplayToCache>(rq, "AddReplayToCache");
|
|
|
|
|
ScriptFunction::Register<&GetReplayDirectoryName>(rq, "GetReplayDirectoryName");
|
2015-09-21 10:14:26 -07:00
|
|
|
}
|
|
|
|
|
}
|