From 69f5dd283eb3e015b7dd7e1fb9511a26796e5e2e Mon Sep 17 00:00:00 2001 From: josemam Date: Sun, 9 Oct 2016 22:42:52 +0200 Subject: [PATCH] Welcome message Also, a release is incoming! --- Makefile | 14 +++++++++++++- include/io.h | 2 ++ include/strings.h | 7 +++++-- src/io.cpp | 5 +++++ src/iv-pid.cpp | 2 ++ src/strings_eng.cpp | 4 +++- src/strings_esp.cpp | 4 +++- 7 files changed, 33 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 844dc5a..e8f9130 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,31 @@ CXX = g++ +VERSION = v0.1.0 CHARSET = UTF-8 +PROGRAM_NAME = IV⇆\ PID # If Windows, sets the Western Europe charset ifdef SystemRoot CHARSET = CP850 + PROGRAM_NAME = IV-PID endif -CXXFLAGS = -O3 -m32 -static -s -Wall -Iinclude -flto -fexec-charset=$(CHARSET) +CXXFLAGS = -O3 -m32 -static -s -Wall -Iinclude -flto +STRINGSFLAGS = -fexec-charset=$(CHARSET) +IOFLAGS = $(STRINGFLAGS) -DPROGRAM_NAME=\"$(PROGRAM_NAME)\" -DVERSION=\"$(VERSION)\" OBJ = obj SRC = src +.INTERMEDIATE: $(OBJ)/io.o all: iv-pid_eng iv-pid_esp $(OBJ): mkdir $@ +$(OBJ)/strings%.o: $(SRC)/strings%.cpp $(OBJ) + $(CXX) $(CXXFLAGS) $(STRINGSFLAGS) -c $< -o $@ + +$(OBJ)/io.o: $(SRC)/io.cpp $(OBJ) + $(CXX) $(CXXFLAGS) $(IOFLAGS) -c $< -o $@ + $(OBJ)/%.o: $(SRC)/%.cpp $(OBJ) $(CXX) $(CXXFLAGS) -c $< -o $@ diff --git a/include/io.h b/include/io.h index 5c77f52..6832254 100644 --- a/include/io.h +++ b/include/io.h @@ -45,4 +45,6 @@ void NoPIDMsg(); void NoIVMsg(); void EndOfResults(); +void WelcomeMessage(); + #endif diff --git a/include/strings.h b/include/strings.h index 807b249..38c2dcb 100644 --- a/include/strings.h +++ b/include/strings.h @@ -6,7 +6,8 @@ #ifndef __STRINGS_H__ #define __STRINGS_H__ -const char* BAR = "\n=============================\n"; +const char* BAR = "\n=================================\n"; +const char* LINK = "https://github.com/josemam/IV-PID"; extern const char* CHAINED_SHINY_METHOD; const char* METHOD_[] = {CHAINED_SHINY_METHOD, "A-B-C-D", "A-B-D-E", "A-B-C-E", "A-B-D-F", "A-B-E-F"}; const char** METHOD = METHOD_ + 1; @@ -34,6 +35,8 @@ extern const char *NO_PID_MSG, *IMPOSSIBLE_PID_MSG, *END_OF_RESULTS_MSG, -*PAUSE_MSG; +*PAUSE_MSG, +*LICENSE, +*TEXT_BEFORE_GH_LINK; #endif diff --git a/src/io.cpp b/src/io.cpp index 65357bf..f7e6fc9 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -177,3 +177,8 @@ void NoIVMsg() { void EndOfResults() { cout << "\n" << END_OF_RESULTS_MSG << ". "; } + +void WelcomeMessage() { + cout << BAR << "\n" << PROGRAM_NAME << " " << VERSION << " - " + << LICENSE << " GPLv2\n" << TEXT_BEFORE_GH_LINK << ":\n" << LINK; +} diff --git a/src/iv-pid.cpp b/src/iv-pid.cpp index 0319f8f..646e292 100644 --- a/src/iv-pid.cpp +++ b/src/iv-pid.cpp @@ -125,6 +125,8 @@ modefunc modes[] = { int nmodes = sizeof(modes)/sizeof(modefunc); int main() { + WelcomeMessage(); + char mode; do { mode = AskMode(); diff --git a/src/strings_eng.cpp b/src/strings_eng.cpp index c7e437a..9ed3efe 100644 --- a/src/strings_eng.cpp +++ b/src/strings_eng.cpp @@ -43,4 +43,6 @@ const char *NO_PID_MSG = "No valid PID found", *IMPOSSIBLE_PID_MSG = "That PID is impossible due to RNG mechanism", *END_OF_RESULTS_MSG = "End of results", -*PAUSE_MSG = "Press any key to continue or Esc to exit..."; +*PAUSE_MSG = "Press any key to continue or Esc to exit...", +*LICENSE = "License", +*TEXT_BEFORE_GH_LINK = "You can read the code, make\nsuggestions and report bugs at"; diff --git a/src/strings_esp.cpp b/src/strings_esp.cpp index 9df840f..09f31b9 100644 --- a/src/strings_esp.cpp +++ b/src/strings_esp.cpp @@ -43,4 +43,6 @@ const char *NO_PID_MSG = "No se encontraron PID válidos", *IMPOSSIBLE_PID_MSG = "Este PID es imposible debido a la naturaleza del RNG", *END_OF_RESULTS_MSG = "Fin de los resultados", -*PAUSE_MSG = "Pulsa una tecla para seguir o Esc para salir..."; +*PAUSE_MSG = "Pulsa una tecla para seguir o Esc para salir...", +*LICENSE = "Licencia", +*TEXT_BEFORE_GH_LINK = "Puedes ver el código, sugerir\ncambios y reportar errores en";