#pragma once
#include <xr_dependencies.h>
#include <openxr/openxr_platform.h>
#ifdef XR_USE_PLATFORM_ANDROID
#include <json/value.h>
#include <android/asset_manager_jni.h>
#include "android_utilities.h"
#endif
#ifdef XR_KHR_LOADER_INIT_SUPPORT
class LoaderInitData {
public:
static LoaderInitData& instance() {
static LoaderInitData obj;
return obj;
}
#if defined(XR_USE_PLATFORM_ANDROID)
using StructType = XrLoaderInitInfoAndroidKHR;
std::string _native_library_path;
AAssetManager* _android_asset_manager;
#else
#error "Platform specific XR_KHR_loader_init structure is not defined for this platform."
#endif
const XrLoaderInitInfoBaseHeaderKHR* getParam() const { return reinterpret_cast<const XrLoaderInitInfoBaseHeaderKHR*>(&_data); }
const StructType& getData() const { return _data; }
bool initialized() const noexcept { return _initialized; }
XrResult initialize(const XrLoaderInitInfoBaseHeaderKHR* info);
private:
LoaderInitData() = default;
StructType _data = {};
bool _initialized = false;
};
XrResult InitializeLoaderInitData(const XrLoaderInitInfoBaseHeaderKHR* loaderInitInfo);
#ifdef XR_USE_PLATFORM_ANDROID
XrResult GetPlatformRuntimeVirtualManifest(Json::Value& out_manifest);
std::string GetAndroidNativeLibraryDir();
void* Android_Get_Asset_Manager();
#endif
#endif