-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Full transfer to native save stream may take a while
- Loading branch information
not_alphanine
committed
Nov 20, 2024
1 parent
0d09903
commit 5c4e8a4
Showing
40 changed files
with
399 additions
and
526 deletions.
There are no files selected for viewing
Submodule archivexl
updated
9 files
+3 −3 | src/App/Extensions/Localization/Module.cpp | |
+23 −0 | src/App/Extensions/WorldStreaming/Module.cpp | |
+3 −0 | src/App/Extensions/WorldStreaming/Module.hpp | |
+4 −1 | src/Red/Addresses/Library.hpp | |
+17 −0 | src/Red/CommunitySystem.hpp | |
+1 −1 | src/Red/Localization.hpp | |
+2 −0 | src/pch.hpp | |
+1 −1 | vendor/RED4ext.SDK | |
+1 −1 | xmake.lua |
Submodule sharedpunk
updated
9 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <Shared/Util/NamePoolRegistrar.hpp> | ||
|
||
#include "Inventory.hpp" | ||
|
||
using namespace parser::node; | ||
using namespace Red; | ||
using namespace shared::raw; | ||
using namespace shared::util; | ||
|
||
bool InventoryNode::OnRead(shared::raw::Save::Stream::LoadStream& aStream) noexcept | ||
{ | ||
static const auto c_itemDataNodeName = NamePoolRegistrar<"itemData">::Get(); | ||
|
||
Save::NodeAccessor node(aStream, GetName(), true, false); | ||
|
||
if (!aStream.IsGood()) | ||
{ | ||
return false; | ||
} | ||
|
||
return aStream.IsGood(); | ||
} | ||
|
||
CName InventoryNode::GetName() noexcept | ||
{ | ||
return NamePoolRegistrar<"inventory">::Get(); | ||
} | ||
|
||
RTTI_DEFINE_CLASS(parser::node::InventoryNode, { RTTI_PARENT(parser::node::SaveNodeData); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#pragma once | ||
#include <RED4ext/RED4ext.hpp> | ||
#include <RedLib.hpp> | ||
|
||
#include <parsing/New/TypeDefinitions/NGPlusSaveNode.hpp> | ||
|
||
#include <Shared/Raw/Save/Save.hpp> | ||
|
||
namespace parser::node | ||
{ | ||
struct ItemLootData | ||
{ | ||
Red::TweakDBID m_lootPoolId{}; | ||
std::uint32_t unk08{}; | ||
float m_requiredLevel{}; | ||
}; | ||
|
||
struct InnerItemDataRepresentation | ||
{ | ||
Red::ItemID m_itemID{}; | ||
Red::CName m_appearanceName{}; | ||
Red::TweakDBID m_attachmentSlotID{}; | ||
|
||
Red::DynArray<InnerItemDataRepresentation> m_children{}; | ||
|
||
std::uint32_t unk30{}; | ||
|
||
ItemLootData m_lootData{}; | ||
}; | ||
|
||
struct UniqueItemDataRepresentation : Red::ISerializable | ||
{ | ||
RTTI_IMPL_TYPEINFO(UniqueItemDataRepresentation); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
|
||
struct BlueprintStackableItemDataRepresentation : Red::ISerializable | ||
{ | ||
RTTI_IMPL_TYPEINFO(BlueprintStackableItemDataRepresentation); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
|
||
struct StackedItemDataRepresentation : Red::ISerializable | ||
{ | ||
RTTI_IMPL_TYPEINFO(StackedItemDataRepresentation); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
|
||
struct ItemRepresentation : Red::ISerializable | ||
{ | ||
Red::ItemID m_itemID{}; | ||
|
||
char m_itemFlags{}; // quest, ETC | ||
|
||
RTTI_IMPL_TYPEINFO(ItemRepresentation); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
|
||
class InventoryNode : public SaveNodeData | ||
{ | ||
private: | ||
|
||
public: | ||
bool OnRead(shared::raw::Save::Stream::LoadStream& aStream) noexcept override; | ||
Red::CName GetName() noexcept override; | ||
|
||
RTTI_IMPL_TYPEINFO(InventoryNode); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
} // namespace parser::node |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,74 @@ | ||
#include <algorithm> | ||
|
||
#include <Shared/Util/BufferCreator.hpp> | ||
#include <Shared/Util/NamePoolRegistrar.hpp> | ||
|
||
#include "ScriptableSystemsContainer.hpp" | ||
|
||
using namespace parser::node; | ||
using namespace Red; | ||
using namespace shared::raw; | ||
using namespace shared::util; | ||
|
||
bool parser::node::ScriptableSystemsContainerNode::OnRead(Save::Stream::LoadStream& aStream) noexcept | ||
bool ScriptableSystemsContainerNode::OnRead(Save::Stream::LoadStream& aStream) noexcept | ||
{ | ||
Save::NodeAccessor node(aStream, GetName(), true, false); | ||
|
||
if (aStream.IsGood()) | ||
if (!aStream.IsGood()) | ||
{ | ||
auto buf = aStream.ReadBuffer(); | ||
return false; | ||
} | ||
|
||
auto buffer = aStream.ReadBuffer(); | ||
|
||
m_reader.Init(std::move(buf)); | ||
// When you're too lazy to go and make a move ctor xD | ||
// Evil code | ||
|
||
m_reader.m_readCruids = true; | ||
std::copy_n(reinterpret_cast<char*>(&buffer), sizeof(RawBuffer), reinterpret_cast<char*>(&m_buffer)); | ||
std::fill_n(reinterpret_cast<char*>(&buffer), sizeof(RawBuffer), 0); | ||
|
||
m_reader.ReadPackage(); | ||
ScriptablePackage::ScriptablePackageReader reader(m_buffer); | ||
|
||
return aStream.IsGood(); | ||
// Yes, the game does this | ||
reader.ReadHeader(m_packageHeader); | ||
reader.ReadHeader(m_packageHeader); | ||
|
||
ScriptablePackage::ScriptablePackageExtractor::InitFromHeader(&m_packageExtractor, m_packageHeader); | ||
|
||
for (auto i = 0u; i < reader.rootChunkTypes.size; i++) | ||
{ | ||
m_systemIndexMap.insert_or_assign(GetClass(reader.rootChunkTypes[i]), i); | ||
} | ||
|
||
return false; | ||
return aStream.IsGood(); | ||
} | ||
|
||
CName parser::node::ScriptableSystemsContainerNode::GetName() noexcept | ||
CName ScriptableSystemsContainerNode::GetName() noexcept | ||
{ | ||
return NamePoolRegistrar<"ScriptableSystemsContainer">::Get(); | ||
} | ||
} | ||
|
||
Handle<IScriptable>& ScriptableSystemsContainerNode::GetScriptableSystem(CClass* aClass) noexcept | ||
{ | ||
static Handle<IScriptable> s_empty; | ||
|
||
if (m_handleCache.contains(aClass)) | ||
{ | ||
return m_handleCache[aClass]; | ||
} | ||
|
||
if (!m_systemIndexMap.contains(aClass)) | ||
{ | ||
return s_empty; | ||
} | ||
|
||
m_handleCache.insert_or_assign(aClass, MakeScriptedHandle(aClass)); | ||
|
||
auto index = m_systemIndexMap[aClass]; | ||
|
||
m_packageExtractor.GetObjectById(m_handleCache[aClass], index); | ||
|
||
return m_handleCache[aClass]; | ||
} | ||
|
||
RTTI_DEFINE_CLASS(parser::node::ScriptableSystemsContainerNode, { RTTI_PARENT(parser::node::SaveNodeData); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
#pragma once | ||
#include <RED4ext/RED4ext.hpp> | ||
#include <RedLib.hpp> | ||
|
||
#include <parsing/New/Readers/PackageReader.hpp> | ||
#include <parsing/New/TypeDefinitions/NGPlusSaveNode.hpp> | ||
|
||
#include <tsl/hopscotch_map.h> | ||
|
||
#include <Shared/Raw/Package/ScriptableSystemsPackage.hpp> | ||
#include <Shared/Raw/Save/Save.hpp> | ||
|
||
namespace parser::node | ||
{ | ||
class ScriptableSystemsContainerNode : public SaveNodeData | ||
{ | ||
private: | ||
reader::PackageReader m_reader{}; | ||
Red::RawBuffer m_buffer{}; | ||
Red::PackageHeader m_packageHeader{}; | ||
shared::raw::ScriptablePackage::ScriptablePackageExtractor m_packageExtractor{}; | ||
|
||
tsl::hopscotch_map<Red::CClass*, std::uint32_t> m_systemIndexMap{}; | ||
tsl::hopscotch_map<Red::CClass*, Red::Handle<Red::IScriptable>> m_handleCache{}; | ||
public: | ||
bool OnRead(shared::raw::Save::Stream::LoadStream& aStream) noexcept override; | ||
Red::CName GetName() noexcept override; | ||
|
||
Red::Handle<Red::IScriptable>& GetScriptableSystem(Red::CClass* aClass) noexcept; | ||
|
||
RTTI_IMPL_TYPEINFO(ScriptableSystemsContainerNode); | ||
RTTI_IMPL_ALLOCATOR(); | ||
}; | ||
} |
Oops, something went wrong.