mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-25 07:44:38 +01:00
Write new code for loading title sequence ZIPs
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <initializer_list>
|
||||
#include "../common.h"
|
||||
#include "Memory.hpp"
|
||||
#include "String.hpp"
|
||||
|
||||
namespace Collections
|
||||
@@ -100,5 +101,24 @@ namespace Collections
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TCollection>
|
||||
static typename TCollection::value_type * ToArray(const TCollection &collection)
|
||||
{
|
||||
size_t count = collection.size();
|
||||
if (count == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto * items = Memory::AllocateArray<TCollection::value_type>(count);
|
||||
size_t i = 0;
|
||||
for (const auto &item : collection)
|
||||
{
|
||||
items[i] = item;
|
||||
i++;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
}
|
||||
|
||||
@@ -71,6 +71,16 @@ namespace Path
|
||||
lastPathSeperator + 1;
|
||||
}
|
||||
|
||||
utf8 * GetFileNameWithoutExtension(const utf8 * path)
|
||||
{
|
||||
size_t maxSize = String::SizeOf(path) + 1;
|
||||
utf8 * result = Memory::Allocate<utf8>(maxSize);
|
||||
GetFileNameWithoutExtension(result, maxSize, path);
|
||||
size_t reducedSize = String::SizeOf(path) + 1;
|
||||
result = Memory::Reallocate(result, reducedSize);
|
||||
return result;
|
||||
}
|
||||
|
||||
utf8 * GetFileNameWithoutExtension(utf8 * buffer, size_t bufferSize, const utf8 * path)
|
||||
{
|
||||
path = GetFileName(path);
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace Path
|
||||
utf8 * Append(utf8 * buffer, size_t bufferSize, const utf8 * src);
|
||||
utf8 * GetDirectory(utf8 * buffer, size_t bufferSize, const utf8 * path);
|
||||
const utf8 * GetFileName(const utf8 * path);
|
||||
utf8 * GetFileNameWithoutExtension(const utf8 * path);
|
||||
utf8 * GetFileNameWithoutExtension(utf8 * buffer, size_t bufferSize, const utf8 * path);
|
||||
const utf8 * GetExtension(const utf8 * path);
|
||||
utf8 * GetAbsolute(utf8 * buffer, size_t bufferSize, const utf8 * relativePath);
|
||||
|
||||
Reference in New Issue
Block a user