Files
mandy/third_party/xtaskqueue/Source/Task/StaticArray.h
IAmNotSiob 36bc1200ad Runtime: offline xgameruntime shim (XGameRuntime, XSystem, XTaskQueue, XAsync)
Every GDK title calls XGameRuntimeInitialize first and builds its async work on
XTaskQueue/XAsync. Add an xgameruntime.dll shim table for those, ahead of the
executable: XGameRuntimeInitialize/Uninitialize (reference counted),
XSystemGetDeviceType (Series X; LEONIDA_DEVICE_TYPE overrides) and
XSystemGetConsoleId (placeholder), plus the 23 XTaskQueue/XAsync functions.

XTaskQueue/XAsync come from microsoft/libHttpClient (MIT), copied unmodified
into third_party/xtaskqueue (task queue only, no HTTP stack); a small pch.h
stand-in lets them build alone. xgameruntime_test drives the table through
the shim registry the way a title boots. Nothing goes online.
2026-11-21 23:06:10 +01:00

68 lines
1.4 KiB
C++

// Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
template <typename TData, uint32_t size>
class StaticArray
{
public:
StaticArray()
{
}
StaticArray(const StaticArray& other)
{
m_count = other.m_count;
for(uint32_t idx = 0; idx < m_count; idx++)
{
m_array[idx] = other.m_array[idx];
}
}
StaticArray& operator=(const StaticArray& other)
{
m_count = other.m_count;
for(uint32_t idx = 0; idx < m_count; idx++)
{
m_array[idx] = other.m_array[idx];
}
return *this;
}
uint32_t count() { return m_count; }
uint32_t capacity() { return ARRAYSIZE(m_array) - m_count; }
void clear() { m_count = 0; }
TData* data() { return m_array; }
TData& operator[](size_t idx) { return m_array[idx]; }
void append(const TData& data)
{
ASSERT(m_count != ARRAYSIZE(m_array));
m_array[m_count++] = data;
}
void removeAt(uint32_t idx)
{
if (idx == m_count - 1)
{
m_count --;
}
else
{
for (uint32_t i = idx + 1; i < m_count; i++)
{
m_array[i - 1] = m_array[i];
}
m_count--;
}
}
private:
uint32_t m_count = 0;
TData m_array[size];
};