diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2025-04-28 15:39:22 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-28 09:39:22 +0200 |
| commit | a221d50c1712849f4435cb9937c58f51fa71066f (patch) | |
| tree | c050f7fbca83c424d60f8656ca47f3e64548222e /src | |
| parent | 4441be7a020e1fe3a0a7ebf6701402c135aa4edd (diff) | |
| download | box64-a221d50c1712849f4435cb9937c58f51fa71066f.tar.gz box64-a221d50c1712849f4435cb9937c58f51fa71066f.zip | |
Show Dynarec architecture in version string (#2580)
Diffstat (limited to 'src')
| -rw-r--r-- | src/build_info.c | 32 | ||||
| -rw-r--r-- | src/build_info.h | 22 | ||||
| -rw-r--r-- | src/core.c | 23 |
3 files changed, 43 insertions, 34 deletions
diff --git a/src/build_info.c b/src/build_info.c index 69cebbee..612a8871 100644 --- a/src/build_info.c +++ b/src/build_info.c @@ -1,27 +1,25 @@ #include <stdio.h> #include "debug.h" #include "box64version.h" -#ifdef NOGIT -#define GITREV "nogit" +#include "build_info.h" + +#if defined(DYNAREC) +#define WITH_DYNAREC_STR " with Dynarec" +#else +#define WITH_DYNAREC_STR "" +#endif + +#ifdef HAVE_TRACE +#define WITH_TRACE_STR " with trace" #else -#include "git_head.h" +#define WITH_TRACE_STR "" #endif -void PrintBox64Version() +void PrintBox64Version(int prefix) { - printf_ftrace(1, "Box64%s%s v%d.%d.%d %s built on %s %s\n", - #ifdef HAVE_TRACE - " with trace", - #else - "", - #endif - #ifdef DYNAREC - " with Dynarec", - #else - "", - #endif - BOX64_MAJOR, BOX64_MINOR, BOX64_REVISION, - GITREV, + printf_ftrace(prefix, BOX64_BUILD_INFO_STRING WITH_DYNAREC_STR WITH_TRACE_STR " built on %s %s\n", __DATE__, __TIME__); } +#undef WITH_TRACE +#undef WITH_DYNAREC diff --git a/src/build_info.h b/src/build_info.h index 17a02bb1..90272703 100644 --- a/src/build_info.h +++ b/src/build_info.h @@ -8,14 +8,26 @@ #ifndef __BUILD_INFO_H__ #define __BUILD_INFO_H__ -void PrintBox64Version(void); + +#if defined(DYNAREC) && (defined(ARM64) || defined(RV64) || defined(LA64)) +#if defined(ARM64) +#define ARCH_STR " arm64" +#elif defined(RV64) +#define ARCH_STR " riscv64" +#elif defined(LA64) +#define ARCH_STR " loongarch64" +#endif +#else +#define ARCH_STR "" +#endif + +void PrintBox64Version(int prefix); #define BOX64_BUILD_INFO_STR_HELPER(x) #x #define BOX64_BUILD_INFO_STR(x) BOX64_BUILD_INFO_STR_HELPER(x) #define BOX64_BUILD_INFO_STRING \ - "Box64" \ - " v" BOX64_BUILD_INFO_STR(BOX64_MAJOR) "." BOX64_BUILD_INFO_STR(BOX64_MINOR) "." BOX64_BUILD_INFO_STR(BOX64_REVISION) \ - " " GITREV + "Box64" ARCH_STR \ + " v" BOX64_BUILD_INFO_STR(BOX64_MAJOR) "." BOX64_BUILD_INFO_STR(BOX64_MINOR) "." BOX64_BUILD_INFO_STR(BOX64_REVISION) " " GITREV -#endif //__BUILD_INFO_H__ \ No newline at end of file +#endif //__BUILD_INFO_H__ diff --git a/src/core.c b/src/core.c index 7d76d2fe..f94042c9 100644 --- a/src/core.c +++ b/src/core.c @@ -186,7 +186,7 @@ void openFTrace(int reopen) printf("BOX64 Trace %s to \"%s\"\n", append?"appended":"redirected", p); box64_stdout_no_w = 1; } - PrintBox64Version(); + PrintBox64Version(0); } } } @@ -570,11 +570,11 @@ void AddNewLibs(const char* list) } void PrintHelp() { - printf_ftrace(1, "This is Box64, the Linux x86_64 emulator with a twist.\n"); - printf_ftrace(1, "Usage is 'box64 [options] path/to/software [args]' to launch x86_64 software.\n"); - printf_ftrace(1, " options are:\n"); - printf_ftrace(1, " '-v'|'--version' to print box64 version and quit\n"); - printf_ftrace(1, " '-h'|'--help' to print this and quit\n"); + printf_ftrace(0, "This is Box64, the Linux x86_64 emulator with a twist.\n"); + printf_ftrace(0, "Usage is 'box64 [options] path/to/software [args]' to launch x86_64 software.\n"); + printf_ftrace(0, " options are:\n"); + printf_ftrace(0, " '-v'|'--version' to print box64 version and quit\n"); + printf_ftrace(0, " '-h'|'--help' to print this and quit\n"); } static void addLibPaths(box64context_t* context) @@ -895,12 +895,12 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf init_auxval(argc, argv, environ?environ:env); // analogue to QEMU_VERSION in qemu-user-mode emulation if(getenv("BOX64_VERSION")) { - PrintBox64Version(); + PrintBox64Version(0); exit(0); } // trying to open and load 1st arg if(argc==1) { - /*PrintBox64Version(); + /*PrintBox64Version(1); PrintHelp(); return 1;*/ printf("[BOX64] Missing operand after 'box64'\n"); @@ -921,15 +921,12 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf LoadEnvVariables(); InitializeEnvFiles(); - if (!BOX64ENV(nobanner)) PrintBox64Version(); - - const char* prog = argv[1]; int nextarg = 1; // check if some options are passed while(prog && prog[0]=='-') { if(!strcmp(prog, "-v") || !strcmp(prog, "--version")) { - if (BOX64ENV(nobanner)) PrintBox64Version(); + PrintBox64Version(0); exit(0); } if(!strcmp(prog, "-h") || !strcmp(prog, "--help")) { @@ -949,6 +946,8 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf exit(0); } + if (!BOX64ENV(nobanner)) PrintBox64Version(1); + displayMiscInfo(); hookMangoHud(); |