Output Version of Tux Paint and Windows
This enables to know the user's environment easily.
This commit is contained in:
parent
9cc26e6ed6
commit
10a0a34b1b
3 changed files with 65 additions and 1 deletions
8
Makefile
8
Makefile
|
|
@ -166,7 +166,7 @@ macos_BUNDLE:=./TuxPaint.app
|
|||
ios_BUNDLE:=./TuxPaint-$(SDK).app
|
||||
BUNDLE:=$($(OS)_BUNDLE)
|
||||
|
||||
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o obj/win32_trash.o
|
||||
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o obj/win32_trash.o obj/win32_version.o
|
||||
macos_ARCH_LIBS:=src/macos_print.m obj/macos.o
|
||||
ios_ARCH_LIBS:=src/ios_print.m obj/ios.o
|
||||
beos_ARCH_LIBS:=obj/BeOS_print.o
|
||||
|
|
@ -1363,6 +1363,12 @@ obj/win32_trash.o: src/win32_trash.c src/debug.h
|
|||
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) $(ARCH_DEFS) \
|
||||
-c src/win32_trash.c -o obj/win32_trash.o
|
||||
|
||||
obj/win32_version.o: src/win32_version.c src/debug.h
|
||||
@echo
|
||||
@echo "...Compiling win32 version support..."
|
||||
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) $(ARCH_DEFS) \
|
||||
-c src/win32_version.c -o obj/win32_version.o
|
||||
|
||||
obj/postscript_print.o: src/postscript_print.c \
|
||||
src/postscript_print.h src/debug.h
|
||||
@echo
|
||||
|
|
|
|||
|
|
@ -390,6 +390,7 @@ typedef struct safer_dirent
|
|||
#define wcstombs(tok, wtok, size) WideCharToMultiByte(CP_UTF8,0,wtok,-1,tok,size,NULL,NULL)
|
||||
|
||||
extern int win32_trash(const char *path);
|
||||
extern void win32_print_version(void);
|
||||
|
||||
#undef iswprint
|
||||
int iswprint(wchar_t wc)
|
||||
|
|
@ -30579,6 +30580,12 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
printf("Tux Paint Version " VER_VERSION " (" VER_DATE ")\n");
|
||||
printf("Running on ");
|
||||
win32_print_version();
|
||||
#endif
|
||||
|
||||
claim_to_be_ready();
|
||||
|
||||
mainloop();
|
||||
|
|
|
|||
51
src/win32_version.c
Normal file
51
src/win32_version.c
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <windows.h>
|
||||
#include <VersionHelpers.h>
|
||||
#include <stdio.h>
|
||||
#include "debug.h"
|
||||
|
||||
void win32_print_version(void);
|
||||
|
||||
void win32_print_version(void)
|
||||
{
|
||||
char *verStr;
|
||||
unsigned int Version = 0;
|
||||
unsigned int Build = 0;
|
||||
|
||||
Version = GetVersion();
|
||||
if (Version < 0x80000000)
|
||||
Build = (DWORD)(HIWORD(Version));
|
||||
|
||||
if (IsWindows10OrGreater()) {
|
||||
if (Build < 22000){
|
||||
verStr = strdup("Windows 10");
|
||||
}else{
|
||||
verStr = strdup("Windows 11");
|
||||
}
|
||||
}else if (IsWindows8Point1OrGreater()){
|
||||
verStr = strdup("Windows 8.1");
|
||||
}else if (IsWindows8OrGreater()){
|
||||
verStr = strdup("Windows 8");
|
||||
}else if (IsWindows7SP1OrGreater()){
|
||||
verStr = strdup("Windows 7 Service Pack 1");
|
||||
}else if (IsWindows7OrGreater()){
|
||||
verStr = strdup("Windows 7");
|
||||
}else if (IsWindowsVistaSP2OrGreater()){
|
||||
verStr = strdup("Windows Vista Service Pack 2");
|
||||
}else if (IsWindowsVistaSP1OrGreater()){
|
||||
verStr = strdup("Windows Vista Service Pack 1");
|
||||
}else if (IsWindowsVistaOrGreater()){
|
||||
verStr = strdup("Windows Vista");
|
||||
}else{
|
||||
verStr = strdup("unknown");
|
||||
}
|
||||
|
||||
printf ("Microsoft %s", verStr);
|
||||
|
||||
if (IsWindowsServer()){
|
||||
printf(" Server");
|
||||
}
|
||||
|
||||
if (Version < 0x80000000){
|
||||
printf(" (Build %d)\n", Build);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue