mirror of https://github.com/WerWolv/ImHex.git
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include "test_pattern.hpp"
|
|
|
|
namespace hex::test {
|
|
|
|
class TestPatternStructs : public TestPattern {
|
|
public:
|
|
TestPatternStructs() : TestPattern("Structs") {
|
|
auto testStruct = create<PatternDataStruct>("TestStruct", "testStruct", 0x100, sizeof(s32) + sizeof(u8[0x10]), nullptr);
|
|
|
|
auto variable = create<PatternDataSigned>("s32", "variable", 0x100, sizeof(s32), nullptr);
|
|
auto array = create<PatternDataStaticArray>("u8", "array", 0x100 + sizeof(s32), sizeof(u8[0x10]), nullptr);
|
|
array->setEntries(create<PatternDataUnsigned>("u8", "", 0x100 + sizeof(s32), sizeof(u8), nullptr), 0x10);
|
|
|
|
testStruct->setMembers({ variable, array });
|
|
|
|
addPattern(testStruct);
|
|
}
|
|
~TestPatternStructs() override = default;
|
|
|
|
[[nodiscard]]
|
|
std::string getSourceCode() const override {
|
|
return R"(
|
|
struct TestStruct {
|
|
s32 variable;
|
|
u8 array[0x10];
|
|
};
|
|
|
|
TestStruct testStruct @ 0x100;
|
|
)";
|
|
}
|
|
|
|
};
|
|
|
|
} |