From 96a22063e312c9264b6275ec15133a9c8e41d19a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 01:31:37 -0800 Subject: [PATCH 1/9] Add custom step for Windows for git-version.c. --- .gitignore | 1 + Core/Core.vcxproj | 18 +++++++++++ Core/Core.vcxproj.filters | 1 + Windows/git-version-gen.cmd | 61 +++++++++++++++++++++++++++++++++++++ 4 files changed, 81 insertions(+) create mode 100644 Windows/git-version-gen.cmd diff --git a/.gitignore b/.gitignore index 86e02e32ae..e0896a6bcb 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ gen libs obj build*/ +/git-version.c .pspsh.hist __testoutput.txt diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index c744df54b3..33fef44d59 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -74,6 +74,10 @@ true + + ../Windows/git-version-gen.cmd + Updating git-version.c + @@ -87,6 +91,10 @@ true + + ../Windows/git-version-gen.cmd + Updating git-version.c + @@ -104,6 +112,11 @@ true true + + + ../Windows/git-version-gen.cmd + Updating git-version.c + @@ -120,11 +133,16 @@ true true + + ../Windows/git-version-gen.cmd + Updating git-version.c + + diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index 04d25d780a..02fd2be571 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -382,6 +382,7 @@ Font + diff --git a/Windows/git-version-gen.cmd b/Windows/git-version-gen.cmd new file mode 100644 index 0000000000..110e30f343 --- /dev/null +++ b/Windows/git-version-gen.cmd @@ -0,0 +1,61 @@ +@echo off +rem // Copyright (c) 2012- PPSSPP Project. + +rem // This program is free software: you can redistribute it and/or modify +rem // it under the terms of the GNU General Public License as published by +rem // the Free Software Foundation, version 2.0 or later versions. + +rem // This program is distributed in the hope that it will be useful, +rem // but WITHOUT ANY WARRANTY; without even the implied warranty of +rem // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +rem // GNU General Public License 2.0 for more details. + +rem // A copy of the GPL 2.0 should have been included with the program. +rem // If not, see http://www.gnu.org/licenses/ + +rem // Official git repository and contact information can be found at +rem // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +setlocal + +set GIT_VERSION_FILE=%~p0..\git-version.c +if "%GIT%" == "" ( + set GIT=git +) + +if exist "%GIT_VERSION_FILE%" ( + rem // Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1. + findstr /B /C:"#define PPSSPP_GIT_VERSION_NO_UPDATE 1" "%GIT_VERSION_FILE%" > NUL + if not errorlevel 1 ( + goto done + ) +) + +"%GIT%" describe --always > NUL 2> NUL +if errorlevel 1 ( + echo Unable to update git-version.c, %GIT% not on path. + + echo // This is a generated file. > "%GIT_VERSION_FILE%" + echo. >> "%GIT_VERSION_FILE%" + echo const char *PPSSPP_GIT_VERSION = "unknown"; >> "%GIT_VERSION_FILE%" + goto done +) + +for /F %%I IN ('"%GIT%" describe --always') do set GIT_VERSION=%%I + +rem // Don't modify the file if it already has the current version. +if exist "%GIT_VERSION_FILE%" ( + findstr /C:"%GIT_VERSION%" "%GIT_VERSION_FILE%" > NUL + if not errorlevel 1 ( + goto done + ) +) + +echo // This is a generated file. > "%GIT_VERSION_FILE%" +echo. >> "%GIT_VERSION_FILE%" +echo const char *PPSSPP_GIT_VERSION = "%GIT_VERSION%"; >> "%GIT_VERSION_FILE%" +echo. >> "%GIT_VERSION_FILE%" +echo // If you don't want this file to update/recompile, change to 1. >> "%GIT_VERSION_FILE%" +echo #define PPSSPP_GIT_VERSION_NO_UPDATE 0 >> "%GIT_VERSION_FILE%" + +:done From 4694d4f1a3f91b8720ade38c76431c7c8a96d761 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 11:01:08 -0800 Subject: [PATCH 2/9] Add git-version.c generation to CMake. --- CMakeLists.txt | 14 +++++++++++++- git-version.cmake | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 git-version.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index cfabb3510d..dd4d055df7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -823,11 +823,23 @@ add_library(${CoreLibName} ${CoreLinkType} Core/Util/ppge_atlas.cpp Core/Util/ppge_atlas.h $ - Globals.h) + Globals.h + git-version.c) target_link_libraries(${CoreLibName} Common native kirk cityhash ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES}) setup_target_project(${CoreLibName} Core) +# Generate git-version.c 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 + PROPERTIES GENERATED TRUE) +add_dependencies(${CoreLibName} GitVersion) + add_library(GPU OBJECT GPU/GLES/DisplayListInterpreter.cpp GPU/GLES/DisplayListInterpreter.h diff --git a/git-version.cmake b/git-version.cmake new file mode 100644 index 0000000000..eca9a4de33 --- /dev/null +++ b/git-version.cmake @@ -0,0 +1,42 @@ +set(GIT_VERSION_FILE "${SOURCE_DIR}/git-version.c") +set(GIT_VERSION "unknown") +set(GIT_VERSION_UPDATE "1") + +find_package(Git) +if(GIT_FOUND) + execute_process(COMMAND ${GIT_EXECUTABLE} describe --always + RESULT_VARIABLE exit_code + OUTPUT_VARIABLE GIT_VERSION) + if(NOT ${exit_code} EQUAL 0) + message(WARNING "git describe failed, unable to include version.") + endif() + string(STRIP ${GIT_VERSION} GIT_VERSION) +else() + message(WARNING "git not found, unable to include version.") +endif() + +if(EXISTS ${GIT_VERSION_FILE}) + # Don't update if marked not to update. + file(STRINGS ${GIT_VERSION_FILE} match + REGEX "PPSSPP_GIT_VERSION_NO_UPDATE = 1") + if(NOT $[match} EQUAL "") + set(GIT_VERSION_UPDATE "0") + endif() + + # Don't update if it's already the same. + file(STRINGS ${GIT_VERSION_FILE} match + REGEX "${GIT_VERSION}") + if(NOT $[match} EQUAL "") + set(GIT_VERSION_UPDATE "0") + endif() +endif() + +set(code_string "// This is a generated file.\n\n" + "const char *PPSSPP_GIT_VERSION = \"${GIT_VERSION}\"\;\n\n" + "// If you don't want this file to update/recompile, change to 1.\n" + "#define PPSSPP_GIT_VERSION_NO_UPDATE 0\n") + +message(WARNING "UPDATE: ${GIT_VERSION_FILE}") +if ("${GIT_VERSION_UPDATE}" EQUAL "1") + file(WRITE ${GIT_VERSION_FILE} ${code_string}) +endif() \ No newline at end of file From a2aa5fe23eeba8fdd6b25dd3d6b1f0761dcebd2f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 11:19:14 -0800 Subject: [PATCH 3/9] Fix iOS / debug ARM build. --- .gitignore | 3 +++ Core/MIPS/ARM/ArmCompVFPU.cpp | 4 ++-- Core/MIPS/ARM/ArmJit.h | 8 ++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index e0896a6bcb..e01eb254a1 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,9 @@ Release Windows/x64 Windows/ipch +# For Mac +.DS_Store + # For ppsspp.ini, etc. *.ini diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index 19cb4b6bbc..a9da1e75fa 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -120,7 +120,7 @@ namespace MIPSComp } void Jit::GetVectorRegsPrefixD(u8 *regs, VectorSize sz, int vectorReg) { - _assert_(js.prefixDFlag & JitState::PREFIX_KNOWN); + _assert_(js.prefixDFlag & ArmJitState::PREFIX_KNOWN); GetVectorRegs(regs, sz, vectorReg); if (js.prefixD == 0) @@ -136,7 +136,7 @@ namespace MIPSComp } void Jit::ApplyPrefixD(const u8 *vregs, VectorSize sz) { - _assert_(js.prefixDFlag & JitState::PREFIX_KNOWN); + _assert_(js.prefixDFlag & ArmJitState::PREFIX_KNOWN); if (!js.prefixD) return; int n = GetNumVectorElements(sz); diff --git a/Core/MIPS/ARM/ArmJit.h b/Core/MIPS/ARM/ArmJit.h index 358e6a83d1..8d9f4046c1 100644 --- a/Core/MIPS/ARM/ArmJit.h +++ b/Core/MIPS/ARM/ArmJit.h @@ -107,11 +107,11 @@ struct ArmJitState } } u8 VfpuWriteMask() const { - _assert_(prefixDFlag & JitState::PREFIX_KNOWN); + _assert_(prefixDFlag & PREFIX_KNOWN); return (prefixD >> 8) & 0xF; } bool VfpuWriteMask(int i) const { - _assert_(prefixDFlag & JitState::PREFIX_KNOWN); + _assert_(prefixDFlag & PREFIX_KNOWN); return (prefixD >> (8 + i)) & 1; } }; @@ -224,12 +224,12 @@ private: void ApplyPrefixST(u8 *vregs, u32 prefix, VectorSize sz); void ApplyPrefixD(const u8 *vregs, VectorSize sz); void GetVectorRegsPrefixS(u8 *regs, VectorSize sz, int vectorReg) { - _assert_(js.prefixSFlag & JitState::PREFIX_KNOWN); + _assert_(js.prefixSFlag & ArmJitState::PREFIX_KNOWN); GetVectorRegs(regs, sz, vectorReg); ApplyPrefixST(regs, js.prefixS, sz); } void GetVectorRegsPrefixT(u8 *regs, VectorSize sz, int vectorReg) { - _assert_(js.prefixTFlag & JitState::PREFIX_KNOWN); + _assert_(js.prefixTFlag & ArmJitState::PREFIX_KNOWN); GetVectorRegs(regs, sz, vectorReg); ApplyPrefixST(regs, js.prefixT, sz); } From 9170d157ff5cebf95a11f25f5636d0ad657cc7b5 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 11:19:40 -0800 Subject: [PATCH 4/9] Force libc++ on Mac, needed for Xcode 4.6 at least. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd4d055df7..d7e02f23f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,7 @@ if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libstdc++") elseif(APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++") endif() if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") From d2020372d1f33338dce441e8930f067473c6a429 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 11:27:31 -0800 Subject: [PATCH 5/9] Fix small warning. --- Core/HLE/sceKernelVTimer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Core/HLE/sceKernelVTimer.cpp b/Core/HLE/sceKernelVTimer.cpp index 4cb68c4305..eedd35e5fb 100644 --- a/Core/HLE/sceKernelVTimer.cpp +++ b/Core/HLE/sceKernelVTimer.cpp @@ -358,6 +358,8 @@ u32 sceKernelStopVTimer(u32 uid) { __stopVTimer(vt); return 1; } + + return error; } u32 sceKernelSetVTimerHandler(u32 uid, u32 scheduleAddr, u32 handlerFuncAddr, u32 commonAddr) { From fc48fdbd97e43f3bf09633ed52a4bc6c859c2ac4 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 12:03:06 -0800 Subject: [PATCH 6/9] Add git-version.c generation for Qt. --- Qt/Core.pro | 8 +++++++ Qt/git-version-gen.sh | 52 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 Qt/git-version-gen.sh diff --git a/Qt/Core.pro b/Qt/Core.pro index 69f6bb9fc8..feb0bfcda9 100755 --- a/Qt/Core.pro +++ b/Qt/Core.pro @@ -4,6 +4,14 @@ TARGET = Core TEMPLATE = lib CONFIG += staticlib +version.target = ../git-version.c +version.commands = $$PWD/git-version-gen.sh +version.depends = ../.git + +QMAKE_EXTRA_TARGETS += version +PRE_TARGETDEPS += ../git-version.c +SOURCES += ../git-version.c + include(Settings.pri) INCLUDEPATH += ../native ../Core/MIPS ../ diff --git a/Qt/git-version-gen.sh b/Qt/git-version-gen.sh new file mode 100755 index 0000000000..1f0e259fb9 --- /dev/null +++ b/Qt/git-version-gen.sh @@ -0,0 +1,52 @@ +#!/bin/bash +## Copyright (c) 2012- PPSSPP Project. + +## This program is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, version 2.0 or later versions. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License 2.0 for more details. + +## A copy of the GPL 2.0 should have been included with the program. +## If not, see http://www.gnu.org/licenses/ + +## 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 + +if [ -e "$GIT_VERSION_FILE" ]; then + # Skip updating the file if PPSSPP_GIT_VERSION_NO_UPDATE is 1. + results=$(grep '^#define PPSSPP_GIT_VERSION_NO_UPDATE 1' "$GIT_VERSION_FILE") + if [ "$results" != "" ]; then + exit 0 + fi +fi + +GIT_VERSION=$(git describe --always) +if [ "$GIT_VERSION" == "" ]; then + echo "Unable to update git-version.c, git not on path." 1>&2 + + echo "// This is a generated file." > "$GIT_VERSION_FILE" + echo >> "$GIT_VERSION_FILE" + echo 'const char *PPSSPP_GIT_VERSION = "unknown";' >> "$GIT_VERSION_FILE" + exit 0 +fi + +# Don't modify the file if it already has the current version. +if [ -e "$GIT_VERSION_FILE" ]; then + results=$(grep "$GIT_VERSION" "$GIT_VERSION_FILE") + if [ "$results" != "" ]; then + exit 0 + fi +fi + +echo "// This is a generated file." > "$GIT_VERSION_FILE" +echo >> "$GIT_VERSION_FILE" +echo 'const char *PPSSPP_GIT_VERSION = "'"$GIT_VERSION"'";' >> "$GIT_VERSION_FILE" +echo >> "$GIT_VERSION_FILE" +echo "// If you don't want this file to update/recompile, change to 1." >> "$GIT_VERSION_FILE" +echo "#define PPSSPP_GIT_VERSION_NO_UPDATE 0" >> "$GIT_VERSION_FILE" From aadc7db33dfa9f85250b166ccfd548d5cdb31c56 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 12:41:39 -0800 Subject: [PATCH 7/9] And the Android cmake file as well. --- Core/CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Core/CMakeLists.txt b/Core/CMakeLists.txt index 3bbd94a384..6592c9a63c 100644 --- a/Core/CMakeLists.txt +++ b/Core/CMakeLists.txt @@ -85,6 +85,7 @@ set(SRCS PSPMixer.cpp System.cpp Core.cpp + ../git-version.cpp ) if(ARM) @@ -115,6 +116,17 @@ add_library(core STATIC ${SRCS}) target_link_libraries(core general common) target_link_libraries(core general base) +# 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.cpp + PROPERTIES GENERATED TRUE) +add_dependencies(core GitVersion) + if(UNIX) add_definitions(-fPIC) add_definitions(-std=gnu++0x) From 35fe2b4a631ef9385fccb10982de192ebb6a9916 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 12:31:11 -0800 Subject: [PATCH 8/9] Actually use the git version. Also switch to cpp, duh. --- CMakeLists.txt | 6 +++--- Core/Config.h | 3 +-- Core/Core.vcxproj | 10 +++++----- Core/Core.vcxproj.filters | 2 +- Qt/Core.pro | 6 +++--- Qt/QtHost.cpp | 2 +- Qt/git-version-gen.sh | 4 ++-- Qt/mainwindow.cpp | 2 +- Windows/WindowsHost.cpp | 4 +--- Windows/WndMainWindow.cpp | 11 +++++------ Windows/git-version-gen.cmd | 4 ++-- android/jni/MenuScreens.cpp | 11 ++++++++--- git-version.cmake | 2 +- 13 files changed, 34 insertions(+), 33 deletions(-) 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") From 0783e3b0f5316939634ed8c67e2c72fb9a2cd9bf Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 2 Mar 2013 12:34:41 -0800 Subject: [PATCH 9/9] Note the PPSSPP version in the log. Fixes #807. --- Core/System.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/System.cpp b/Core/System.cpp index 11fa6032a6..8a0581b7bf 100644 --- a/Core/System.cpp +++ b/Core/System.cpp @@ -32,6 +32,7 @@ #include "HLE/sceKernel.h" #include "HLE/sceKernelMemory.h" #include "HLE/sceAudio.h" +#include "Config.h" #include "Core.h" #include "CoreTiming.h" #include "CoreParameter.h" @@ -47,6 +48,8 @@ static PSPMixer *mixer; bool PSP_Init(const CoreParameter &coreParam, std::string *error_string) { + INFO_LOG(HLE, "PPSSPP %s", PPSSPP_GIT_VERSION); + coreParameter = coreParam; currentCPU = &mipsr4k; numCPUs = 1;