From caea4544ef06bedd477c3efd654ac7eeead526d9 Mon Sep 17 00:00:00 2001 From: Nik Date: Wed, 14 Sep 2022 14:01:54 +0200 Subject: [PATCH] includes/hex: Added library files --- includes/hex/core.pat | 29 +++++++++++++++++++++++++++++ includes/hex/http.pat | 11 +++++++++++ includes/hex/impl/imhex_check.pat | 3 +++ includes/std/http.pat | 9 --------- 4 files changed, 43 insertions(+), 9 deletions(-) create mode 100644 includes/hex/core.pat create mode 100644 includes/hex/http.pat create mode 100644 includes/hex/impl/imhex_check.pat delete mode 100644 includes/std/http.pat diff --git a/includes/hex/core.pat b/includes/hex/core.pat new file mode 100644 index 0000000..988d38c --- /dev/null +++ b/includes/hex/core.pat @@ -0,0 +1,29 @@ +#pragma once + +#include + +namespace hex::core { + + struct Selection { + bool valid; + u64 address, size; + }; + + fn get_selection() { + u128 result = builtin::hex::core::get_selection(); + + Selection result; + if (result == u128(-1)) { + result.valid = false; + result.address = 0x00; + result.size = 0x00; + } else { + result.valid = true; + result.address = result >> 64; + result.size = result & u64(-1); + } + + return result; + }; + +} \ No newline at end of file diff --git a/includes/hex/http.pat b/includes/hex/http.pat new file mode 100644 index 0000000..e99cd31 --- /dev/null +++ b/includes/hex/http.pat @@ -0,0 +1,11 @@ +#pragma once + +#include + +namespace hex::http { + + fn get(str url) { + return builtin::hex::http::get(url); + }; + +} \ No newline at end of file diff --git a/includes/hex/impl/imhex_check.pat b/includes/hex/impl/imhex_check.pat new file mode 100644 index 0000000..6ed3c88 --- /dev/null +++ b/includes/hex/impl/imhex_check.pat @@ -0,0 +1,3 @@ +#ifndef __IMHEX__ + #error This library is only available in the ImHex Hex editor +#endif \ No newline at end of file diff --git a/includes/std/http.pat b/includes/std/http.pat deleted file mode 100644 index fdeb323..0000000 --- a/includes/std/http.pat +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -namespace std::http { - - fn get(str url) { - return builtin::std::http::get(url); - }; - -} \ No newline at end of file