diff --git a/CMakeLists.txt b/CMakeLists.txt index d7e02f23f3..b3dbfd8d2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -825,19 +825,19 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Util/ppge_atlas.h $ Globals.h - git-version.c) + git-version.cpp) target_link_libraries(${CoreLibName} Common native kirk cityhash ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES}) setup_target_project(${CoreLibName} Core) -# Generate git-version.c at build time. +# Generate git-version.cpp at build time. add_custom_target(GitVersion ALL DEPENDS something_that_never_exists) add_custom_command(OUTPUT something_that_never_exists COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake) -set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.c +set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp PROPERTIES GENERATED TRUE) add_dependencies(${CoreLibName} GitVersion) diff --git a/Core/Config.h b/Core/Config.h index e3d4139a19..8468158d46 100644 --- a/Core/Config.h +++ b/Core/Config.h @@ -20,8 +20,7 @@ #include #include -#define PPSSPP_VERSION_STR "0.6.1" - +extern const char *PPSSPP_GIT_VERSION; struct SState { diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 33fef44d59..7b4f9b0247 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -76,7 +76,7 @@ ../Windows/git-version-gen.cmd - Updating git-version.c + Updating git-version.cpp @@ -93,7 +93,7 @@ ../Windows/git-version-gen.cmd - Updating git-version.c + Updating git-version.cpp @@ -115,7 +115,7 @@ ../Windows/git-version-gen.cmd - Updating git-version.c + Updating git-version.cpp @@ -135,14 +135,14 @@ ../Windows/git-version-gen.cmd - Updating git-version.c + Updating git-version.cpp - + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 02fd2be571..fd4a7beda0 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -382,7 +382,7 @@ Font - + diff --git a/Qt/Core.pro b/Qt/Core.pro index feb0bfcda9..f2060f8f24 100755 --- a/Qt/Core.pro +++ b/Qt/Core.pro @@ -4,13 +4,13 @@ TARGET = Core TEMPLATE = lib CONFIG += staticlib -version.target = ../git-version.c +version.target = ../git-version.cpp version.commands = $$PWD/git-version-gen.sh version.depends = ../.git QMAKE_EXTRA_TARGETS += version -PRE_TARGETDEPS += ../git-version.c -SOURCES += ../git-version.c +PRE_TARGETDEPS += ../git-version.cpp +SOURCES += ../git-version.cpp include(Settings.pri) diff --git a/Qt/QtHost.cpp b/Qt/QtHost.cpp index 4295edf126..a5f04cb818 100644 --- a/Qt/QtHost.cpp +++ b/Qt/QtHost.cpp @@ -43,7 +43,7 @@ void QtHost::ShutdownGL() void QtHost::SetWindowTitle(const char *message) { - QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR) + " - " + QString::fromUtf8(message); + QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION) + " - " + QString::fromUtf8(message); mainWindow->setWindowTitle(title); } diff --git a/Qt/git-version-gen.sh b/Qt/git-version-gen.sh index 1f0e259fb9..d441c38379 100755 --- a/Qt/git-version-gen.sh +++ b/Qt/git-version-gen.sh @@ -16,7 +16,7 @@ ## Official git repository and contact information can be found at ## https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. -GIT_VERSION_FILE=$(dirname $0)/../git-version.c +GIT_VERSION_FILE=$(dirname $0)/../git-version.cpp if [ -e "$GIT_VERSION_FILE" ]; then # Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1. @@ -28,7 +28,7 @@ fi GIT_VERSION=$(git describe --always) if [ "$GIT_VERSION" == "" ]; then - echo "Unable to update git-version.c, git not on path." 1>&2 + echo "Unable to update git-version.cpp, git not on path." 1>&2 echo "// This is a generated file." > "$GIT_VERSION_FILE" echo >> "$GIT_VERSION_FILE" diff --git a/Qt/mainwindow.cpp b/Qt/mainwindow.cpp index 498aaf4f41..eaec0249aa 100644 --- a/Qt/mainwindow.cpp +++ b/Qt/mainwindow.cpp @@ -884,7 +884,7 @@ void MainWindow::SetZoom(float zoom) { void MainWindow::SetGameTitle(QString text) { - QString title = "PPSSPP " + QString(PPSSPP_VERSION_STR); + QString title = "PPSSPP " + QString(PPSSPP_GIT_VERSION); if (text != "") title += QString(" - %1").arg(text); diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index cef4e558e6..7f17e86137 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -38,9 +38,7 @@ void WindowsHost::ShutdownGL() void WindowsHost::SetWindowTitle(const char *message) { - // Really need a better way to deal with versions. - std::string title = "PPSSPP " PPSSPP_VERSION_STR " - "; - title += message; + std::string title = std::string("PPSSPP ") + PPSSPP_GIT_VERSION + " - " + message; int size = MultiByteToWideChar(CP_UTF8, 0, message, (int) title.size(), NULL, 0); if (size > 0) diff --git a/Windows/WndMainWindow.cpp b/Windows/WndMainWindow.cpp index 57208e3872..998b21bdb2 100644 --- a/Windows/WndMainWindow.cpp +++ b/Windows/WndMainWindow.cpp @@ -844,14 +844,13 @@ namespace MainWindow void SetPlaying(const char *text) { + char temp[256]; if (text == 0) - SetWindowText(hwndMain, "PPSSPP " PPSSPP_VERSION_STR); + snprintf(temp, 256, "PPSSPP %s", PPSSPP_GIT_VERSION); else - { - char temp[256]; - sprintf(temp, "%s - %s", text, "PPSSPP " PPSSPP_VERSION_STR); - SetWindowText(hwndMain,temp); - } + snprintf(temp, 256, "%s - PPSSPP %s", text, PPSSPP_GIT_VERSION); + temp[255] = '\0'; + SetWindowText(hwndMain, temp); } void SaveStateActionFinished(bool result, void *userdata) diff --git a/Windows/git-version-gen.cmd b/Windows/git-version-gen.cmd index 110e30f343..b5d21bf512 100644 --- a/Windows/git-version-gen.cmd +++ b/Windows/git-version-gen.cmd @@ -18,7 +18,7 @@ rem // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. setlocal -set GIT_VERSION_FILE=%~p0..\git-version.c +set GIT_VERSION_FILE=%~p0..\git-version.cpp if "%GIT%" == "" ( set GIT=git ) @@ -33,7 +33,7 @@ if exist "%GIT_VERSION_FILE%" ( "%GIT%" describe --always > NUL 2> NUL if errorlevel 1 ( - echo Unable to update git-version.c, %GIT% not on path. + echo Unable to update git-version.cpp, %GIT% not on path. echo // This is a generated file. > "%GIT_VERSION_FILE%" echo. >> "%GIT_VERSION_FILE%" diff --git a/android/jni/MenuScreens.cpp b/android/jni/MenuScreens.cpp index f937860ad3..e9efc45834 100644 --- a/android/jni/MenuScreens.cpp +++ b/android/jni/MenuScreens.cpp @@ -168,7 +168,7 @@ void MenuScreen::render() { ui_draw2d.DrawTextShadow(UBUNTU48, "PPSSPP", dp_xres + xoff - w/2, 80, 0xFFFFFFFF, ALIGN_HCENTER | ALIGN_BOTTOM); ui_draw2d.SetFontScale(0.7f, 0.7f); - ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_VERSION_STR, dp_xres + xoff, 80, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM); + ui_draw2d.DrawTextShadow(UBUNTU24, PPSSPP_GIT_VERSION, dp_xres + xoff, 80, 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_BOTTOM); ui_draw2d.SetFontScale(1.0f, 1.0f); VLinear vlinear(dp_xres + xoff, 95, 20); @@ -444,9 +444,9 @@ void CreditsScreen::update(InputState &input_state) { frames_++; } -static const char *credits[] = +static char *credits[] = { - "PPSSPP " PPSSPP_VERSION_STR, + "PPSSPP", "", "", "A fast and portable PSP emulator", @@ -506,6 +506,11 @@ static const char *credits[] = }; void CreditsScreen::render() { + // TODO: This is kinda ugly, done on every frame... + char temp[256]; + snprinf(temp, 256, "PPSSPP %s", PPSSPP_GIT_VERSION); + credits[0] = temp; + UIShader_Prepare(); UIBegin(); DrawBackground(1.0f); diff --git a/git-version.cmake b/git-version.cmake index eca9a4de33..d55f76ae5c 100644 --- a/git-version.cmake +++ b/git-version.cmake @@ -1,4 +1,4 @@ -set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.c") +set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.cpp") set(GIT_VERSION "unknown") set(GIT_VERSION_UPDATE "1")