build: Update for software defined 128 bit types

This commit is contained in:
WerWolv
2025-01-29 21:37:41 +01:00
parent e981eff1e6
commit 803ebe34ed
30 changed files with 112 additions and 117 deletions

View File

@@ -8,8 +8,8 @@
#include <hex/ui/imgui_imhex_extensions.h>
namespace hex::plugin::visualizers {
std::vector<u32> getIndices(pl::ptrn::Pattern *colorTablePattern, u128 width, u128 height);
ImGuiExt::Texture getTexture(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u128 width, u128 height);
std::vector<u32> getIndices(pl::ptrn::Pattern *colorTablePattern, u64 width, u64 height);
ImGuiExt::Texture getTexture(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u64 width, u64 height);
void drawImageVisualizer(pl::ptrn::Pattern &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
@@ -42,8 +42,8 @@ namespace hex::plugin::visualizers {
if (shouldReset) {
auto pattern = arguments[0].toPattern();
auto width = arguments[1].toUnsigned();
auto height = arguments[2].toUnsigned();
auto width = u64(arguments[1].toUnsigned());
auto height = u64(arguments[2].toUnsigned());
bool hasColorTable = false;
if (arguments.size() == 4) {
@@ -58,7 +58,7 @@ namespace hex::plugin::visualizers {
if (!hasColorTable) {
auto data = pattern->getBytes();
texture = ImGuiExt::Texture::fromBitmap(data.data(), data.size(), width, height,ImGuiExt::Texture::Filter::Nearest);
texture = ImGuiExt::Texture::fromBitmap(data.data(), data.size(), width, height, ImGuiExt::Texture::Filter::Nearest);
}
}
@@ -75,7 +75,7 @@ namespace hex::plugin::visualizers {
}
}
template <typename T> ImGuiExt::Texture unmapColors(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u128 width, u128 height) {
template <typename T> ImGuiExt::Texture unmapColors(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u64 width, u64 height) {
std::vector<T> colorTable = patternToArray<T>(colorTablePattern);
auto colorCount = colorTable.size();
auto indexCount = indices.size();
@@ -94,7 +94,7 @@ namespace hex::plugin::visualizers {
return texture;
}
std::vector<u32> getIndices(pl::ptrn::Pattern *pattern, u128 width, u128 height) {
std::vector<u32> getIndices(pl::ptrn::Pattern *pattern, u64 width, u64 height) {
auto indexCount = 2 * width * height / pattern->getSize();
std::vector<u32> indices;
auto *iterable = dynamic_cast<pl::ptrn::IIterable *>(pattern);
@@ -138,7 +138,7 @@ namespace hex::plugin::visualizers {
return indices;
}
ImGuiExt::Texture getTexture(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u128 width, u128 height) {
ImGuiExt::Texture getTexture(pl::ptrn::Pattern *colorTablePattern, std::vector<u32>& indices, u64 width, u64 height) {
ImGuiExt::Texture texture;
auto iterable = dynamic_cast<pl::ptrn::IIterable *>(colorTablePattern);

View File

@@ -14,8 +14,8 @@ namespace hex::plugin::visualizers {
void drawSoundVisualizer(pl::ptrn::Pattern &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
auto wavePattern = arguments[0].toPattern();
auto channels = arguments[1].toUnsigned();
auto sampleRate = arguments[2].toUnsigned();
auto channels = u64(arguments[1].toUnsigned());
auto sampleRate = u64(arguments[2].toUnsigned());
u32 downSampling = wavePattern->getSize() / 300_scaled / 8 / channels;
static std::vector<i16> waveData;

View File

@@ -15,7 +15,7 @@ namespace hex::plugin::visualizers {
void drawTableVisualizer(pl::ptrn::Pattern &, bool shouldReset, std::span<const pl::core::Token::Literal> arguments) {
static std::vector<std::string> tableContent;
static u128 width = 0, height = 0;
static u64 width = 0, height = 0;
if (shouldReset) {
tableContent.clear();
@@ -29,8 +29,8 @@ namespace hex::plugin::visualizers {
throw std::logic_error("Table visualizer requires an array pattern as the first argument.");
}
width = arguments[1].toUnsigned();
height = arguments[2].toUnsigned();
width = u64(arguments[1].toUnsigned());
height = u64(arguments[2].toUnsigned());
auto iterable = dynamic_cast<pl::ptrn::IIterable*>(pattern.get());
iterable->forEachEntry(0, iterable->getEntryCount(), [&](u64, pl::ptrn::Pattern *entry) {
@@ -42,9 +42,9 @@ namespace hex::plugin::visualizers {
throw std::logic_error(hex::format("Table visualizer cannot have more than {} columns.", IMGUI_TABLE_MAX_COLUMNS));
if (ImGui::BeginTable("##visualizer_table", width, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) {
for (u128 i = 0; i < height; i += 1) {
for (u64 i = 0; i < height; i += 1) {
ImGui::TableNextRow();
for (u128 j = 0; j < width; j += 1) {
for (u64 j = 0; j < width; j += 1) {
ImGui::TableSetColumnIndex(j);
if (i * width + j < tableContent.size())
ImGui::TextUnformatted(tableContent[(i * width) + j].c_str());

View File

@@ -15,7 +15,7 @@
namespace hex::plugin::visualizers {
void drawTimestampVisualizer(pl::ptrn::Pattern &, bool, std::span<const pl::core::Token::Literal> arguments) {
time_t timestamp = arguments[0].toUnsigned();
time_t timestamp = u64(arguments[0].toUnsigned());
auto tm = fmt::gmtime(timestamp);
auto date = std::chrono::year_month_day(std::chrono::year(tm.tm_year + 1900), std::chrono::month(tm.tm_mon + 1), std::chrono::day(tm.tm_mday));