From deb64b1da4a0385c0c5b39f982eafc0fc48dc017 Mon Sep 17 00:00:00 2001 From: "[-=KILL MAN=-]" Date: Sun, 28 Jun 2026 06:38:38 +0300 Subject: [PATCH] Update amlmod.h Little helpers --- mod/amlmod.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mod/amlmod.h b/mod/amlmod.h index 2cd3260..ecbe017 100644 --- a/mod/amlmod.h +++ b/mod/amlmod.h @@ -6,6 +6,7 @@ #include #include #include +#include #if defined(__arm__) || defined(_WIN32) #define AML32 @@ -129,6 +130,25 @@ inline char *strxcpy(char* __restrict__ dst, const char* __restrict__ src, int l } return dst; } +inline int strindexof(const char* haystack, const char* needle) +{ + const char* ptr = strstr(haystack, needle); + return ptr ? (int)(ptr - haystack) : -1; +} +inline bool strcontains(const char* str, const char* sub) +{ + return (strstr(str, sub) != NULL); +} +inline bool strstarts(const char* str, const char* prefix) +{ + size_t lenstr = strlen(str), lenpre = strlen(prefix); + return (lenstr >= lenpre && strncmp(str, prefix, lenpre) == 0); +} +inline bool strends(const char* str, const char* suffix) +{ + size_t lenstr = strlen(str), lensuf = strlen(suffix); + return (lenstr >= lensuf && strcmp(str + lenstr - lensuf, suffix) == 0); +} inline int clampint(int min, int max, int v) { @@ -154,6 +174,8 @@ inline void clampfloat(float min, float max, float* v) } #define ARRAY_SIZE(__aVar) ((size_t)( sizeof(__aVar) / sizeof(__aVar[0]) )) +#define RAD_TO_DEG(__f) ( (__f) * (180.0f / M_PI) ) +#define DEG_TO_RAD(__f) ( (__f) * (M_PI / 180.0f) ) class ModInfo {