mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Merge pull request #90 from Laupetin/feature/iw3-localize
feat: add localize entry loading for IW3
This commit is contained in:
commit
5b087518aa
@ -0,0 +1,36 @@
|
|||||||
|
#include "AssetLoaderLocalizeEntry.h"
|
||||||
|
|
||||||
|
#include "Localize/LocalizeCommonAssetLoader.h"
|
||||||
|
|
||||||
|
using namespace IW3;
|
||||||
|
|
||||||
|
XAssetInfoGeneric* AssetLoaderLocalizeEntry::LoadFromGlobalAssetPools(const std::string& assetName) const
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* AssetLoaderLocalizeEntry::CreateEmptyAsset(const std::string& assetName, MemoryManager* memory)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||||
|
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||||
|
{
|
||||||
|
const LocalizeCommonAssetLoader commonLoader(
|
||||||
|
[memory, manager](const CommonLocalizeEntry& entry)
|
||||||
|
{
|
||||||
|
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||||
|
localizeEntry->name = memory->Dup(entry.m_key.c_str());
|
||||||
|
localizeEntry->value = memory->Dup(entry.m_value.c_str());
|
||||||
|
|
||||||
|
manager->AddAsset(ASSET_TYPE_LOCALIZE_ENTRY, entry.m_key, localizeEntry);
|
||||||
|
});
|
||||||
|
|
||||||
|
return commonLoader.LoadLocalizeAsset(assetName, searchPath, manager, zone);
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "AssetLoading/BasicAssetLoader.h"
|
||||||
|
#include "AssetLoading/IAssetLoadingManager.h"
|
||||||
|
#include "Game/IW3/IW3.h"
|
||||||
|
#include "SearchPath/ISearchPath.h"
|
||||||
|
|
||||||
|
namespace IW3
|
||||||
|
{
|
||||||
|
class AssetLoaderLocalizeEntry final : public BasicAssetLoader<ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
_NODISCARD XAssetInfoGeneric* LoadFromGlobalAssetPools(const std::string& assetName) const override;
|
||||||
|
_NODISCARD void* CreateEmptyAsset(const std::string& assetName, MemoryManager* memory) override;
|
||||||
|
_NODISCARD bool CanLoadFromRaw() const override;
|
||||||
|
bool
|
||||||
|
LoadFromRaw(const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const override;
|
||||||
|
};
|
||||||
|
} // namespace IW3
|
@ -1,6 +1,7 @@
|
|||||||
#include "ObjLoaderIW3.h"
|
#include "ObjLoaderIW3.h"
|
||||||
|
|
||||||
#include "AssetLoaders/AssetLoaderGfxImage.h"
|
#include "AssetLoaders/AssetLoaderGfxImage.h"
|
||||||
|
#include "AssetLoaders/AssetLoaderLocalizeEntry.h"
|
||||||
#include "AssetLoaders/AssetLoaderRawFile.h"
|
#include "AssetLoaders/AssetLoaderRawFile.h"
|
||||||
#include "AssetLoading/AssetLoadingManager.h"
|
#include "AssetLoading/AssetLoadingManager.h"
|
||||||
#include "Game/IW3/GameAssetPoolIW3.h"
|
#include "Game/IW3/GameAssetPoolIW3.h"
|
||||||
@ -43,7 +44,7 @@ ObjLoader::ObjLoader()
|
|||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_FONT, Font_s))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_FONT, Font_s))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_MENULIST, MenuList))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_MENULIST, MenuList))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_MENU, menuDef_t))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_MENU, menuDef_t))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_LOCALIZE_ENTRY, LocalizeEntry))
|
REGISTER_ASSET_LOADER(AssetLoaderLocalizeEntry)
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_WEAPON, WeaponDef))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_WEAPON, WeaponDef))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_SNDDRIVER_GLOBALS, SndDriverGlobals))
|
||||||
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_FX, FxEffectDef))
|
REGISTER_ASSET_LOADER(BASIC_LOADER(ASSET_TYPE_FX, FxEffectDef))
|
||||||
|
@ -22,7 +22,7 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
|||||||
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||||
{
|
{
|
||||||
LocalizeCommonAssetLoader commonLoader(
|
const LocalizeCommonAssetLoader commonLoader(
|
||||||
[memory, manager](const CommonLocalizeEntry& entry)
|
[memory, manager](const CommonLocalizeEntry& entry)
|
||||||
{
|
{
|
||||||
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||||
|
@ -22,7 +22,7 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
|||||||
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||||
{
|
{
|
||||||
LocalizeCommonAssetLoader commonLoader(
|
const LocalizeCommonAssetLoader commonLoader(
|
||||||
[memory, manager](const CommonLocalizeEntry& entry)
|
[memory, manager](const CommonLocalizeEntry& entry)
|
||||||
{
|
{
|
||||||
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||||
|
@ -22,7 +22,7 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
|||||||
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||||
{
|
{
|
||||||
LocalizeCommonAssetLoader commonLoader(
|
const LocalizeCommonAssetLoader commonLoader(
|
||||||
[memory, manager](const CommonLocalizeEntry& entry)
|
[memory, manager](const CommonLocalizeEntry& entry)
|
||||||
{
|
{
|
||||||
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||||
|
@ -22,7 +22,7 @@ bool AssetLoaderLocalizeEntry::CanLoadFromRaw() const
|
|||||||
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
bool AssetLoaderLocalizeEntry::LoadFromRaw(
|
||||||
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
const std::string& assetName, ISearchPath* searchPath, MemoryManager* memory, IAssetLoadingManager* manager, Zone* zone) const
|
||||||
{
|
{
|
||||||
LocalizeCommonAssetLoader commonLoader(
|
const LocalizeCommonAssetLoader commonLoader(
|
||||||
[memory, manager](const CommonLocalizeEntry& entry)
|
[memory, manager](const CommonLocalizeEntry& entry)
|
||||||
{
|
{
|
||||||
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
auto* localizeEntry = memory->Create<LocalizeEntry>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user