1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-12-27 03:46:02 +00:00
TegraExplorer/source/utils/utils.c
suchmememanyskill f1d433e69a Add partitioning
Also add sd mounting/unmounting
Also add vol+/- controls for sideways menus
2020-12-28 20:08:15 +01:00

38 lines
No EOL
756 B
C

#include "utils.h"
#include <string.h>
#include <utils/types.h>
#include <mem/heap.h>
#include <utils/util.h>
char *CpyStr(const char* in){
int len = strlen(in);
char *out = malloc(len + 1);
out[len] = 0;
memcpy(out, in, len);
return out;
}
void MaskIn(char *mod, u32 bitstream, char mask){
u32 len = strlen(mod);
for (int i = 0; i < len; i++){
if (!(bitstream & 1))
*mod = mask;
bitstream >>= 1;
mod++;
}
}
// non-zero is yes, zero is no
bool StrEndsWith(char *begin, char *end){
begin = strrchr(begin, *end);
if (begin != NULL)
return !strcmp(begin, end);
return 0;
}
void WaitFor(u32 ms){
u32 a = get_tmr_ms();
while (a + ms > get_tmr_ms());
}