Skip to content

Commit df1405d

Browse files
author
Marcos Del Sol Vives
committed
Improved versioning stuff
1 parent d7dd307 commit df1405d

File tree

3 files changed

+11
-29
lines changed

3 files changed

+11
-29
lines changed

amiitool.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static char * self;
1919

2020
void usage() {
2121
fprintf(stderr,
22-
"amiitool v%s (commit %08x)\n"
22+
"amiitool build %i (commit %s-%08x)\n"
2323
"by Marcos Del Sol Vives <[email protected]>\n"
2424
"\n"
2525
"Usage: %s (-e|-d) -k keyfile [-i input] [-o output]\n"
@@ -29,7 +29,7 @@ void usage() {
2929
" -i input file. If not specified, stdin will be used.\n"
3030
" -o output file. If not specified, stdout will be used.\n"
3131
" -l decrypt files with invalid signatures.\n",
32-
nfc3d_version(), nfc3d_commit_id(), self
32+
nfc3d_version_build(), nfc3d_version_fork(), nfc3d_version_commit(), self
3333
);
3434
}
3535

include/nfc3d/version.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99

1010
#include <stdint.h>
1111

12-
const char * nfc3d_version();
13-
uint32_t nfc3d_version_code();
14-
uint32_t nfc3d_commit_id();
15-
uint32_t nfc3d_commit_count();
12+
const char * nfc3d_version_fork();
13+
uint32_t nfc3d_version_build();
14+
uint32_t nfc3d_version_commit();
1615

1716
#endif

version.c

+6-23
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
2-
* (c) 2015-2017 Marcos Del Sol Vives
3-
* (c) 2016 javiMaD
2+
* (c) 2017 Marcos Del Sol Vives
43
*
54
* SPDX-License-Identifier: MIT
65
*/
@@ -9,31 +8,15 @@
98
#include <stdio.h>
109
#include "gitversion.h"
1110

12-
static char vstr[16] = { 0 };
13-
14-
const char * nfc3d_version() {
15-
if (vstr[0]) {
16-
return vstr;
17-
}
18-
19-
uint32_t version = nfc3d_version_code();
20-
uint32_t major = version >> 24;
21-
uint32_t minor = version >> 12 & 0xFFF;
22-
uint32_t revision = version & 0xFFF;
23-
24-
snprintf(vstr, sizeof(vstr) - 1, "%x.%x.%x", major, minor, revision);
25-
return vstr;
26-
}
27-
28-
uint32_t nfc3d_version_code() {
29-
// TODO: can we get this from Git tags somehow?
30-
return 0x01000000;
11+
const char * nfc3d_version_fork() {
12+
// TODO: maybe this should go in another file?
13+
return "socram";
3114
}
3215

33-
uint32_t nfc3d_commit_id() {
16+
uint32_t nfc3d_version_commit() {
3417
return GIT_COMMIT_ID;
3518
}
3619

37-
uint32_t nfc3d_commit_count() {
20+
uint32_t nfc3d_version_build() {
3821
return GIT_COMMIT_COUNT;
3922
}

0 commit comments

Comments
 (0)