summaryrefslogtreecommitdiff
path: root/testing/misc_tools.c
diff options
context:
space:
mode:
authorendoffile78 <endoffile78@yahoo.com>2018-08-04 15:56:01 -0500
committeriphydf <iphydf@users.noreply.github.com>2018-08-19 10:38:51 +0000
commit30960dcc7e9661f431d58081d79dc88692bdb50d (patch)
tree56724c62ce9605ec49768b57b16e7333b118310f /testing/misc_tools.c
parentfc7a5dc4d80ae065a11fa483e619ead02a88e213 (diff)
Add save file generator, save compatibility test, and generate a save file
Diffstat (limited to 'testing/misc_tools.c')
-rw-r--r--testing/misc_tools.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/testing/misc_tools.c b/testing/misc_tools.c
index af6f6872..c9a73b3e 100644
--- a/testing/misc_tools.c
+++ b/testing/misc_tools.c
@@ -85,6 +85,25 @@ uint8_t *hex_string_to_bin(const char *hex_string)
85 return ret; 85 return ret;
86} 86}
87 87
88void to_hex(char *out, uint8_t *in, int size)
89{
90 while (size--) {
91 if (*in >> 4 < 0xA) {
92 *out++ = '0' + (*in >> 4);
93 } else {
94 *out++ = 'A' + (*in >> 4) - 0xA;
95 }
96
97 if ((*in & 0xf) < 0xA) {
98 *out++ = '0' + (*in & 0xF);
99 } else {
100 *out++ = 'A' + (*in & 0xF) - 0xA;
101 }
102
103 in++;
104 }
105}
106
88/* Reimplementation of strncasecmp() function from strings.h, as strings.h is 107/* Reimplementation of strncasecmp() function from strings.h, as strings.h is
89 * POSIX and not portable. Specifically it doesn't exist on MSVC. 108 * POSIX and not portable. Specifically it doesn't exist on MSVC.
90 */ 109 */