2016-11-12 18:12:11 +01:00
|
|
|
/*****************************************************************************
|
2024-01-01 12:52:28 +01:00
|
|
|
* Copyright (c) 2014-2024 OpenRCT2 developers
|
2016-11-12 18:12:11 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-11-12 18:12:11 +01:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-11-12 18:12:11 +01:00
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "TitleSequenceManager.h"
|
|
|
|
|
2024-04-23 21:31:05 +02:00
|
|
|
#include "../../Context.h"
|
|
|
|
#include "../../OpenRCT2.h"
|
|
|
|
#include "../../PlatformEnvironment.h"
|
|
|
|
#include "../../core/Collections.hpp"
|
|
|
|
#include "../../core/File.h"
|
|
|
|
#include "../../core/FileScanner.h"
|
|
|
|
#include "../../core/Memory.hpp"
|
|
|
|
#include "../../core/Path.hpp"
|
|
|
|
#include "../../core/String.hpp"
|
|
|
|
#include "../../localisation/Localisation.h"
|
|
|
|
#include "../../platform/Platform.h"
|
2018-06-22 23:15:14 +02:00
|
|
|
#include "TitleSequence.h"
|
|
|
|
|
|
|
|
#include <algorithm>
|
2018-11-21 23:16:04 +01:00
|
|
|
#include <iterator>
|
2018-06-22 23:15:14 +02:00
|
|
|
#include <vector>
|
2016-11-12 18:12:11 +01:00
|
|
|
|
|
|
|
namespace TitleSequenceManager
|
|
|
|
{
|
|
|
|
struct PredefinedSequence
|
|
|
|
{
|
2018-06-22 23:15:14 +02:00
|
|
|
const utf8* ConfigId;
|
|
|
|
const utf8* Filename;
|
2022-07-31 15:04:08 +02:00
|
|
|
::StringId StringId;
|
2016-11-12 18:12:11 +01:00
|
|
|
};
|
|
|
|
|
2020-09-27 13:58:04 +02:00
|
|
|
static constexpr PredefinedSequence PredefinedSequences[] = {
|
2018-06-22 23:15:14 +02:00
|
|
|
{ "*RCT1", "rct1.parkseq", STR_TITLE_SEQUENCE_RCT1 },
|
|
|
|
{ "*RCT1AA", "rct1aa.parkseq", STR_TITLE_SEQUENCE_RCT1_AA },
|
|
|
|
{ "*RCT1AALL", "rct1aall.parkseq", STR_TITLE_SEQUENCE_RCT1_AA_LL },
|
|
|
|
{ "*RCT2", "rct2.parkseq", STR_TITLE_SEQUENCE_RCT2 },
|
|
|
|
{ "*OPENRCT2", "openrct2.parkseq", STR_TITLE_SEQUENCE_OPENRCT2 },
|
2016-11-12 18:12:11 +01:00
|
|
|
};
|
|
|
|
|
2017-10-09 17:13:14 +02:00
|
|
|
static std::vector<TitleSequenceManagerItem> _items;
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
static std::string GetNewTitleSequencePath(const std::string& name, bool isZip);
|
2020-09-28 16:27:54 +02:00
|
|
|
static size_t FindItemIndexByPath(const std::string& path);
|
|
|
|
static void Scan(const std::string& directory);
|
|
|
|
static void AddSequence(const std::string& scanPath);
|
2016-11-29 14:22:11 +01:00
|
|
|
static void SortSequences();
|
2018-06-22 23:15:14 +02:00
|
|
|
static std::string GetNameFromSequencePath(const std::string& path);
|
2020-04-30 18:50:26 +02:00
|
|
|
static std::string GetDataSequencesPath();
|
|
|
|
static std::string GetUserSequencesPath();
|
2018-06-22 23:15:14 +02:00
|
|
|
static bool IsNameReserved(const std::string& name);
|
2016-11-12 18:12:11 +01:00
|
|
|
|
|
|
|
size_t GetCount()
|
|
|
|
{
|
|
|
|
return _items.size();
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
const TitleSequenceManagerItem* GetItem(size_t i)
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2017-02-15 22:10:53 +01:00
|
|
|
if (i >= _items.size())
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
return &_items[i];
|
|
|
|
}
|
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
static size_t FindItemIndexByPath(const std::string& path)
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
2018-06-22 23:15:14 +02:00
|
|
|
size_t index = Collections::IndexOf(
|
2020-09-28 16:27:54 +02:00
|
|
|
_items, [path](const TitleSequenceManagerItem& item) -> bool { return path == item.Path; });
|
2016-11-29 14:22:11 +01:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2016-11-27 17:16:17 +01:00
|
|
|
void DeleteItem(size_t i)
|
|
|
|
{
|
|
|
|
auto item = GetItem(i);
|
2017-01-28 22:13:36 +01:00
|
|
|
if (item == nullptr)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
2018-06-22 23:15:14 +02:00
|
|
|
const utf8* path = item->Path.c_str();
|
2016-11-27 17:16:17 +01:00
|
|
|
if (item->IsZip)
|
|
|
|
{
|
2022-01-08 13:57:29 +01:00
|
|
|
File::Delete(path);
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-10 12:52:33 +01:00
|
|
|
Path::DeleteDirectory(path);
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
_items.erase(_items.begin() + i);
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
size_t RenameItem(size_t i, const utf8* newName)
|
2016-11-27 17:16:17 +01:00
|
|
|
{
|
|
|
|
auto item = &_items[i];
|
2020-09-27 13:58:04 +02:00
|
|
|
const auto& oldPath = item->Path;
|
2016-11-27 17:16:17 +01:00
|
|
|
|
2020-09-27 13:58:04 +02:00
|
|
|
auto newPath = Path::Combine(Path::GetDirectory(oldPath), newName);
|
2016-11-27 17:16:17 +01:00
|
|
|
if (item->IsZip)
|
|
|
|
{
|
2022-06-19 00:18:18 +02:00
|
|
|
newPath += OpenRCT2::Title::TITLE_SEQUENCE_EXTENSION;
|
2022-01-08 13:57:29 +01:00
|
|
|
File::Move(oldPath, newPath);
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2022-01-08 13:57:29 +01:00
|
|
|
File::Move(oldPath, newPath);
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
item->Name = newName;
|
|
|
|
item->Path = newPath;
|
2016-11-29 14:22:11 +01:00
|
|
|
|
|
|
|
SortSequences();
|
2020-09-28 16:27:54 +02:00
|
|
|
size_t index = FindItemIndexByPath(newPath);
|
2016-11-29 14:22:11 +01:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
size_t DuplicateItem(size_t i, const utf8* name)
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
|
|
|
auto item = &_items[i];
|
2020-09-27 13:58:04 +02:00
|
|
|
const auto& srcPath = item->Path;
|
2016-11-29 14:22:11 +01:00
|
|
|
|
2016-12-05 00:51:34 +01:00
|
|
|
std::string dstPath = GetNewTitleSequencePath(std::string(name), item->IsZip);
|
2022-01-08 13:57:29 +01:00
|
|
|
if (!File::Copy(srcPath, dstPath, true))
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
|
|
|
return SIZE_MAX;
|
|
|
|
}
|
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
AddSequence(dstPath);
|
2016-11-29 14:22:11 +01:00
|
|
|
SortSequences();
|
2020-09-28 16:27:54 +02:00
|
|
|
size_t index = FindItemIndexByPath(dstPath);
|
2016-11-29 14:22:11 +01:00
|
|
|
return index;
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
size_t CreateItem(const utf8* name)
|
2016-11-29 14:42:24 +01:00
|
|
|
{
|
2022-06-19 00:18:18 +02:00
|
|
|
auto seq = OpenRCT2::Title::CreateTitleSequence();
|
2020-09-28 15:50:11 +02:00
|
|
|
seq->Name = name;
|
2020-09-28 16:27:54 +02:00
|
|
|
seq->Path = GetNewTitleSequencePath(seq->Name, true);
|
2016-11-29 14:42:24 +01:00
|
|
|
seq->IsZip = true;
|
|
|
|
|
|
|
|
size_t index = SIZE_MAX;
|
2020-09-28 16:27:54 +02:00
|
|
|
if (TitleSequenceSave(*seq))
|
2016-11-29 14:42:24 +01:00
|
|
|
{
|
2020-09-28 16:27:54 +02:00
|
|
|
AddSequence(seq->Path);
|
2016-11-29 14:42:24 +01:00
|
|
|
SortSequences();
|
2020-09-28 16:27:54 +02:00
|
|
|
index = FindItemIndexByPath(seq->Path);
|
2016-11-29 14:42:24 +01:00
|
|
|
}
|
2020-09-28 16:27:54 +02:00
|
|
|
|
2016-11-29 18:54:57 +01:00
|
|
|
return index;
|
2016-11-29 14:42:24 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
static std::string GetNewTitleSequencePath(const std::string& name, bool isZip)
|
2016-12-05 00:51:34 +01:00
|
|
|
{
|
2020-04-30 18:50:26 +02:00
|
|
|
auto path = Path::Combine(GetUserSequencesPath(), name);
|
2016-12-05 00:51:34 +01:00
|
|
|
if (isZip)
|
|
|
|
{
|
2022-06-19 00:18:18 +02:00
|
|
|
path += OpenRCT2::Title::TITLE_SEQUENCE_EXTENSION;
|
2016-12-05 00:51:34 +01:00
|
|
|
}
|
2020-04-30 18:50:26 +02:00
|
|
|
return path;
|
2016-12-05 00:51:34 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
static size_t GetPredefinedIndex(const std::string& path)
|
2016-11-12 19:38:30 +01:00
|
|
|
{
|
2020-09-28 16:27:54 +02:00
|
|
|
auto filename = Path::GetFileName(path);
|
2018-11-21 23:16:04 +01:00
|
|
|
for (size_t i = 0; i < std::size(PredefinedSequences); i++)
|
2016-11-12 19:38:30 +01:00
|
|
|
{
|
2023-07-05 21:34:29 +02:00
|
|
|
if (String::IEquals(filename, PredefinedSequences[i].Filename))
|
2016-11-12 19:38:30 +01:00
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return PREDEFINED_INDEX_CUSTOM;
|
|
|
|
}
|
|
|
|
|
2016-11-29 14:22:11 +01:00
|
|
|
static void SortSequences()
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2016-11-12 19:53:01 +01:00
|
|
|
// Sort sequences by predefined index and then name
|
2018-06-22 23:15:14 +02:00
|
|
|
std::sort(
|
|
|
|
_items.begin(), _items.end(), [](const TitleSequenceManagerItem& a, const TitleSequenceManagerItem& b) -> bool {
|
2022-07-03 16:20:23 +02:00
|
|
|
if (a.PredefinedIndex != b.PredefinedIndex)
|
2018-06-22 23:15:14 +02:00
|
|
|
{
|
2022-07-03 16:20:23 +02:00
|
|
|
return a.PredefinedIndex < b.PredefinedIndex;
|
2018-06-22 23:15:14 +02:00
|
|
|
}
|
2023-07-02 11:59:20 +02:00
|
|
|
return String::Compare(a.Name, b.Name, true) < 0;
|
2018-06-22 23:15:14 +02:00
|
|
|
});
|
2016-11-12 19:53:01 +01:00
|
|
|
}
|
|
|
|
|
2016-12-14 13:07:48 +01:00
|
|
|
void Scan()
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
|
|
|
_items.clear();
|
|
|
|
|
|
|
|
// Scan data path
|
2020-09-28 16:27:54 +02:00
|
|
|
Scan(GetDataSequencesPath());
|
2016-11-29 14:22:11 +01:00
|
|
|
|
|
|
|
// Scan user path
|
2020-09-28 16:27:54 +02:00
|
|
|
Scan(GetUserSequencesPath());
|
2016-11-29 14:22:11 +01:00
|
|
|
|
|
|
|
SortSequences();
|
|
|
|
}
|
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
static void Scan(const std::string& directory)
|
2016-11-12 19:53:01 +01:00
|
|
|
{
|
2022-02-27 22:23:35 +01:00
|
|
|
auto pattern = Path::Combine(directory, u8"script.txt;*.parkseq");
|
2021-05-20 17:06:53 +02:00
|
|
|
auto fileScanner = Path::ScanDirectory(pattern, true);
|
2016-11-12 18:12:11 +01:00
|
|
|
while (fileScanner->Next())
|
|
|
|
{
|
2020-09-28 16:27:54 +02:00
|
|
|
AddSequence(fileScanner->GetPath());
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
2016-11-12 19:38:30 +01:00
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
static void AddSequence(const std::string& scanPath)
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
2020-09-28 16:27:54 +02:00
|
|
|
TitleSequenceManagerItem item{};
|
2016-12-24 01:06:42 +01:00
|
|
|
|
2023-07-05 21:34:29 +02:00
|
|
|
if (String::IEquals(Path::GetExtension(scanPath), u8".txt"))
|
2016-11-29 14:22:11 +01:00
|
|
|
{
|
|
|
|
// If we are given a .txt file, set the path to the containing directory
|
2020-09-28 16:27:54 +02:00
|
|
|
item.Path = Path::GetDirectory(scanPath);
|
|
|
|
item.Name = Path::GetFileName(item.Path);
|
|
|
|
item.IsZip = false;
|
2016-11-29 14:22:11 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-09-28 16:27:54 +02:00
|
|
|
item.Path = scanPath;
|
|
|
|
item.Name = GetNameFromSequencePath(item.Path);
|
|
|
|
item.IsZip = true;
|
2016-11-29 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
2020-09-28 16:27:54 +02:00
|
|
|
item.PredefinedIndex = GetPredefinedIndex(item.Path);
|
|
|
|
|
2016-11-29 14:22:11 +01:00
|
|
|
if (item.PredefinedIndex != PREDEFINED_INDEX_CUSTOM)
|
|
|
|
{
|
2022-07-31 14:22:58 +02:00
|
|
|
StringId stringId = PredefinedSequences[item.PredefinedIndex].StringId;
|
2023-01-17 00:12:35 +01:00
|
|
|
item.Name = LanguageGetString(stringId);
|
2016-11-29 14:22:11 +01:00
|
|
|
}
|
2017-10-14 22:43:09 +02:00
|
|
|
else if (IsNameReserved(item.Name))
|
|
|
|
{
|
|
|
|
// Reserved names are not allowed because they map to the
|
|
|
|
// actual predefined names and also prevent editing
|
|
|
|
return;
|
|
|
|
}
|
2020-09-28 16:27:54 +02:00
|
|
|
|
2021-01-08 21:59:55 +01:00
|
|
|
_items.push_back(std::move(item));
|
2016-11-29 14:22:11 +01:00
|
|
|
}
|
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
static std::string GetNameFromSequencePath(const std::string& path)
|
2016-11-12 19:38:30 +01:00
|
|
|
{
|
2020-09-27 13:58:04 +02:00
|
|
|
auto name = Path::GetFileNameWithoutExtension(path);
|
|
|
|
return name;
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
2016-11-12 19:53:01 +01:00
|
|
|
|
2020-04-30 18:50:26 +02:00
|
|
|
static std::string GetDataSequencesPath()
|
2016-11-12 19:53:01 +01:00
|
|
|
{
|
2020-04-30 18:50:26 +02:00
|
|
|
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
|
|
|
|
return env->GetDirectoryPath(OpenRCT2::DIRBASE::OPENRCT2, OpenRCT2::DIRID::SEQUENCE);
|
2016-11-12 19:53:01 +01:00
|
|
|
}
|
|
|
|
|
2020-04-30 18:50:26 +02:00
|
|
|
static std::string GetUserSequencesPath()
|
2016-11-12 19:53:01 +01:00
|
|
|
{
|
2020-04-30 18:50:26 +02:00
|
|
|
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
|
|
|
|
return env->GetDirectoryPath(OpenRCT2::DIRBASE::USER, OpenRCT2::DIRID::SEQUENCE);
|
2016-11-12 19:53:01 +01:00
|
|
|
}
|
2017-10-14 22:43:09 +02:00
|
|
|
|
2018-06-22 23:15:14 +02:00
|
|
|
static bool IsNameReserved(const std::string& name)
|
2017-10-14 22:43:09 +02:00
|
|
|
{
|
2018-06-22 23:15:14 +02:00
|
|
|
for (const auto& pseq : TitleSequenceManager::PredefinedSequences)
|
2017-10-14 22:43:09 +02:00
|
|
|
{
|
2023-07-05 21:34:29 +02:00
|
|
|
if (String::IEquals(name, pseq.ConfigId))
|
2017-10-14 22:43:09 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2018-05-04 22:40:09 +02:00
|
|
|
} // namespace TitleSequenceManager
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerGetCount()
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return TitleSequenceManager::GetCount();
|
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
const utf8* TitleSequenceManagerGetName(size_t index)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
auto item = TitleSequenceManager::GetItem(index);
|
|
|
|
if (item == nullptr)
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return nullptr;
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
2020-09-27 13:58:04 +02:00
|
|
|
return item->Name.c_str();
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
const utf8* TitleSequenceManagerGetPath(size_t index)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
auto item = TitleSequenceManager::GetItem(index);
|
2018-06-22 23:15:14 +02:00
|
|
|
if (item == nullptr)
|
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return nullptr;
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
2020-09-27 13:58:04 +02:00
|
|
|
return item->Path.c_str();
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
const utf8* TitleSequenceManagerGetConfigID(size_t index)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
auto item = TitleSequenceManager::GetItem(index);
|
2018-06-22 23:15:14 +02:00
|
|
|
if (item == nullptr)
|
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return nullptr;
|
|
|
|
}
|
2020-09-27 13:58:04 +02:00
|
|
|
const auto& name = item->Name;
|
2022-07-03 16:19:42 +02:00
|
|
|
const auto filename = Path::GetFileName(item->Path);
|
2018-06-22 23:15:14 +02:00
|
|
|
for (const auto& pseq : TitleSequenceManager::PredefinedSequences)
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2023-07-05 21:34:29 +02:00
|
|
|
if (String::IEquals(filename, pseq.Filename))
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return pseq.ConfigId;
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
|
|
|
}
|
2020-09-27 13:58:04 +02:00
|
|
|
return name.c_str();
|
2018-02-01 18:49:14 +01:00
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerGetPredefinedIndex(size_t index)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
auto item = TitleSequenceManager::GetItem(index);
|
2018-06-22 23:15:14 +02:00
|
|
|
if (item == nullptr)
|
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return 0;
|
2016-11-27 15:47:02 +01:00
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
size_t predefinedIndex = item->PredefinedIndex;
|
|
|
|
return predefinedIndex;
|
|
|
|
}
|
2016-11-27 15:47:02 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerGetIndexForConfigID(const utf8* configId)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
size_t count = TitleSequenceManager::GetCount();
|
|
|
|
for (size_t i = 0; i < count; i++)
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2023-01-17 20:46:55 +01:00
|
|
|
const utf8* cid = TitleSequenceManagerGetConfigID(i);
|
2018-02-01 18:49:14 +01:00
|
|
|
if (String::Equals(cid, configId))
|
2016-11-12 18:12:11 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return i;
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return SIZE_MAX;
|
|
|
|
}
|
2016-11-12 18:12:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerGetIndexForName(const utf8* name)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
size_t count = TitleSequenceManager::GetCount();
|
|
|
|
for (size_t i = 0; i < count; i++)
|
2016-11-27 17:16:17 +01:00
|
|
|
{
|
2023-01-17 20:46:55 +01:00
|
|
|
const utf8* tn = TitleSequenceManagerGetName(i);
|
2018-02-01 18:49:14 +01:00
|
|
|
if (String::Equals(tn, name))
|
2016-11-27 17:16:17 +01:00
|
|
|
{
|
2018-02-01 18:49:14 +01:00
|
|
|
return i;
|
2016-11-27 17:16:17 +01:00
|
|
|
}
|
|
|
|
}
|
2018-02-01 18:49:14 +01:00
|
|
|
return SIZE_MAX;
|
|
|
|
}
|
2016-11-27 17:16:17 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
void TitleSequenceManagerScan()
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
TitleSequenceManager::Scan();
|
|
|
|
}
|
2016-11-27 17:16:17 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
void TitleSequenceManagerDelete(size_t i)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
TitleSequenceManager::DeleteItem(i);
|
|
|
|
}
|
2016-11-27 17:16:17 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerRename(size_t i, const utf8* name)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
return TitleSequenceManager::RenameItem(i, name);
|
|
|
|
}
|
2016-11-29 14:22:11 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerDuplicate(size_t i, const utf8* name)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
return TitleSequenceManager::DuplicateItem(i, name);
|
|
|
|
}
|
2016-11-29 14:42:24 +01:00
|
|
|
|
2023-01-17 20:46:55 +01:00
|
|
|
size_t TitleSequenceManagerCreate(const utf8* name)
|
2018-02-01 18:49:14 +01:00
|
|
|
{
|
|
|
|
return TitleSequenceManager::CreateItem(name);
|
2016-11-12 18:12:11 +01:00
|
|
|
}
|