Skip to content

Commit 6bce824

Browse files
committed
RE BSResource::ArchiveStream
1 parent b41d280 commit 6bce824

File tree

8 files changed

+104
-1
lines changed

8 files changed

+104
-1
lines changed

cmake/sourcelist.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ set(SOURCES
3535
include/RE/A/AnimationFileManagerSingleton.h
3636
include/RE/A/AnimationObjects.h
3737
include/RE/A/Archive.h
38+
include/RE/A/ArchiveStream.h
3839
include/RE/A/ArmorRatingVisitor.h
3940
include/RE/A/ArmorRatingVisitorBase.h
4041
include/RE/A/Array.h
@@ -503,6 +504,7 @@ set(SOURCES
503504
include/RE/C/CommonTypeTraits.h
504505
include/RE/C/CompactingStore.h
505506
include/RE/C/CompiledScriptLoader.h
507+
include/RE/C/CompressedArchiveStream.h
506508
include/RE/C/ConcreteFormFactory.h
507509
include/RE/C/ConcreteObjectFormFactory.h
508510
include/RE/C/ConcussionEffect.h

include/RE/A/ArchiveStream.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#pragma once
2+
3+
#include "RE/S/Stream.h"
4+
5+
namespace RE
6+
{
7+
namespace BSResource
8+
{
9+
class ArchiveStream : public Stream
10+
{
11+
public:
12+
inline static constexpr auto RTTI = RTTI_BSResource__ArchiveStream;
13+
inline static constexpr auto VTABLE = VTABLE_BSResource__ArchiveStream;
14+
15+
~ArchiveStream() override; // 00
16+
17+
// override (Stream)
18+
ErrorCode DoOpen() override; // 01
19+
void DoClose() override; // 02
20+
[[nodiscard]] std::uint64_t DoGetKey() const override; // 03
21+
void DoClone(BSTSmartPointer<Stream>& a_out) const override; // 05
22+
ErrorCode DoRead(void* a_buffer, std::uint64_t a_toRead, std::uint64_t& a_read) const override; // 06
23+
ErrorCode DoWrite(const void* a_buffer, std::uint64_t a_toWrite, std::uint64_t& a_written) const override; // 07
24+
ErrorCode DoSeek(std::uint64_t a_toSeek, SeekMode a_mode, std::uint64_t& a_sought) const override; // 08
25+
bool DoGetName(BSFixedString& a_dst) const override; // 0A
26+
ErrorCode DoCreateAsync(BSTSmartPointer<AsyncStream>& a_streamOut) const override; // 0B
27+
28+
// add
29+
virtual std::uint32_t DoGetSize() const; // 0C
30+
31+
// members
32+
BSTSmartPointer<Stream> source; // 10
33+
std::uint32_t startOffset; // 18
34+
std::uint32_t currentOffset; // 1C
35+
BSFixedString name; // 20
36+
};
37+
#ifdef SKYRIM_SUPPORT_AE
38+
static_assert(sizeof(ArchiveStream) == 0x30);
39+
#else
40+
static_assert(sizeof(ArchiveStream) == 0x28);
41+
#endif
42+
}
43+
}

include/RE/A/AsyncStream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ namespace RE
2626
std::uint32_t minPacketSize; // 10
2727
std::uint32_t pad14; // 14
2828
};
29+
#ifdef SKYRIM_SUPPORT_AE
30+
static_assert(sizeof(AsyncStream) == 0x20);
31+
#else
2932
static_assert(sizeof(AsyncStream) == 0x18);
33+
#endif
3034
}
3135
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#pragma once
2+
3+
#include "RE/A/ArchiveStream.h"
4+
5+
namespace RE
6+
{
7+
namespace BSResource
8+
{
9+
class CompressedArchiveStream : public ArchiveStream
10+
{
11+
public:
12+
inline static constexpr auto RTTI = RTTI_BSResource__CompressedArchiveStream;
13+
inline static constexpr auto VTABLE = VTABLE_BSResource__CompressedArchiveStream;
14+
15+
~CompressedArchiveStream() override; // 00
16+
17+
// override (ArchiveStream)
18+
ErrorCode DoOpen() override; // 01
19+
void DoClose() override; // 02
20+
void DoClone(BSTSmartPointer<Stream>& a_out) const override; // 05
21+
ErrorCode DoRead(void* a_buffer, std::uint64_t a_toRead, std::uint64_t& a_read) const override; // 06
22+
ErrorCode DoSeek(std::uint64_t a_toSeek, SeekMode a_mode, std::uint64_t& a_sought) const override; // 08
23+
ErrorCode DoCreateAsync(BSTSmartPointer<AsyncStream>& a_streamOut) const override; // 0B
24+
std::uint32_t DoGetSize() const override; // 0C
25+
26+
// members
27+
std::uint64_t unk28; // 28
28+
std::uint32_t unk30; // 30
29+
std::uint32_t unk34; // 34
30+
};
31+
#ifdef SKYRIM_SUPPORT_AE
32+
static_assert(sizeof(CompressedArchiveStream) == 0x40);
33+
#else
34+
static_assert(sizeof(CompressedArchiveStream) == 0x38);
35+
#endif
36+
}
37+
}

include/RE/D/DevNull.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ namespace RE
3030
ErrorCode DoWrite(const void* a_buffer, std::uint64_t a_toWrite, std::uint64_t& a_written) const override; // 07
3131
ErrorCode DoSeek(std::uint64_t a_toSeek, SeekMode a_mode, std::uint64_t& a_sought) const override; // 08
3232
};
33+
#ifdef SKYRIM_SUPPORT_AE
34+
static_assert(sizeof(NullStream) == 0x18);
35+
#else
3336
static_assert(sizeof(NullStream) == 0x10);
37+
#endif
3438

3539
~DevNull() override; // 00
3640

include/RE/S/Stream.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ namespace RE
3838
virtual bool DoGetName(BSFixedString& a_dst) const; // 0A - { a_dst = ""; return false; }
3939
virtual ErrorCode DoCreateAsync(BSTSmartPointer<AsyncStream>& a_streamOut) const; // 0B - { return ErrorCode::kUnsupported; }
4040
};
41+
#ifdef SKYRIM_SUPPORT_AE
42+
static_assert(sizeof(Stream) == 0x18);
43+
#else
4144
static_assert(sizeof(Stream) == 0x10);
45+
#endif
4246
}
4347
}

include/RE/S/StreamBase.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ namespace RE
4242

4343
// members
4444
std::uint32_t totalSize; // 08
45-
std::uint32_t flags; // 0C
45+
#ifdef SKYRIM_SUPPORT_AE
46+
std::uint32_t unk0C; // 0C
47+
#endif
48+
std::uint32_t flags; // 10
4649
};
50+
#ifdef SKYRIM_SUPPORT_AE
51+
static_assert(sizeof(StreamBase) == 0x18);
52+
#else
4753
static_assert(sizeof(StreamBase) == 0x10);
54+
#endif
4855
}
4956
}

include/RE/Skyrim.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "RE/A/AnimationFileManagerSingleton.h"
3939
#include "RE/A/AnimationObjects.h"
4040
#include "RE/A/Archive.h"
41+
#include "RE/A/ArchiveStream.h"
4142
#include "RE/A/ArmorRatingVisitor.h"
4243
#include "RE/A/ArmorRatingVisitorBase.h"
4344
#include "RE/A/Array.h"
@@ -505,6 +506,7 @@
505506
#include "RE/C/CommonTypeTraits.h"
506507
#include "RE/C/CompactingStore.h"
507508
#include "RE/C/CompiledScriptLoader.h"
509+
#include "RE/C/CompressedArchiveStream.h"
508510
#include "RE/C/ConcreteFormFactory.h"
509511
#include "RE/C/ConcreteObjectFormFactory.h"
510512
#include "RE/C/ConcussionEffect.h"

0 commit comments

Comments
 (0)