From 1df926938011ddbb25164c85844df826259c0ca0 Mon Sep 17 00:00:00 2001 From: Antonio Maiorano Date: Tue, 27 Jan 2015 00:31:21 -0500 Subject: [PATCH] Add version info: v1.0 --- src/Base.h | 4 ++++ src/Nes.cpp | 4 +++- src/main.cpp | 13 +++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Base.h b/src/Base.h index 5a4c677..661b178 100644 --- a/src/Base.h +++ b/src/Base.h @@ -45,6 +45,10 @@ static_assert(sizeof(int64)==8, "Invalid type size"); static_assert(sizeof(float32)==4, "Invalid type size"); static_assert(sizeof(float64)==8, "Invalid type size"); +// Use to make a macro value into a string +#define STRINGIZE(v) __STRINGIZE(v) +#define __STRINGIZE(v) #v + #define KB(n) (n*1024) #define MB(n) (n*1024*1024) diff --git a/src/Nes.cpp b/src/Nes.cpp index 944cfa8..6319235 100644 --- a/src/Nes.cpp +++ b/src/Nes.cpp @@ -52,7 +52,9 @@ void Nes::ExecuteFrame() // PPU just rendered a screen; FrameTimer will wait until we hit 60 FPS (if machine is too fast) m_frameTimer.Update(minFrameTime); - Renderer::SetWindowTitle( FormattedString<>("nes-emu [FPS: %2.2f]", m_frameTimer.GetFps()).Value() ); + + extern const char* kVersionString; + Renderer::SetWindowTitle( FormattedString<>("nes-emu %s [FPS: %2.2f]", kVersionString, m_frameTimer.GetFps()).Value() ); // Auto-save sram at fixed intervals const float64 saveInterval = 5.0; diff --git a/src/main.cpp b/src/main.cpp index 304d75f..19852b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3,17 +3,26 @@ #include "System.h" #include "Input.h" +#define kVersionMajor 1 +#define kVersionMinor 0 +#if CONFIG_DEBUG + #define kVersionConfig "d" +#else + #define kVersionConfig "" +#endif +const char* kVersionString = "v" STRINGIZE(kVersionMajor) "." STRINGIZE(kVersionMinor) kVersionConfig; + namespace { void PrintAppInfo() { const char* text = - "### nes-emu - Nintendo Entertainment System Emulator\n" + "### nes-emu %s - Nintendo Entertainment System Emulator\n" "### Author: Antonio Maiorano (amaiorano at gmail dot com)\n" "### Source code available at http://github.com/amaiorano/nes-emu/ \n" "\n"; - printf(text); + printf(text, kVersionString); } inline size_t BytesToKB(size_t bytes) { return bytes / 1024; }