Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x64] x64 版でバージョン情報にアルファ版の表示を行う (再作成) #182

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion sakura_core/config/app_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
#ifndef SAKURA_APP_CONSTANTS_AD36E2CE_B62E_497D_806F_6B9738310127_H_
#define SAKURA_APP_CONSTANTS_AD36E2CE_B62E_497D_806F_6B9738310127_H_

#include "version.h"

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// 名前 //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
Expand All @@ -41,7 +43,14 @@
#define _APP_NAME_2_(TYPE) TYPE("")
#endif

#define _GSTR_APPNAME_(TYPE) _APP_NAME_(TYPE) _APP_NAME_2_(TYPE) //例:UNICODEデバッグ→_T("sakura(デバッグ版)")
#ifdef ALPHA_VERSION
#define _APP_NAME_3_(TYPE) TYPE("(Alpha Version)")
#else
#define _APP_NAME_3_(TYPE) TYPE("")
#endif

//例:UNICODEデバッグ→_T("sakura(デバッグ版)")
#define _GSTR_APPNAME_(TYPE) _APP_NAME_(TYPE) _APP_NAME_2_(TYPE) _APP_NAME_3_(TYPE)

#define GSTR_APPNAME (_GSTR_APPNAME_(_T) )
#define GSTR_APPNAME_A (_GSTR_APPNAME_(ATEXT))
Expand Down
35 changes: 22 additions & 13 deletions sakura_core/dlg/CDlgAbout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,26 +165,35 @@ BOOL CDlgAbout::OnInitDialog( HWND hwndDlg, WPARAM wParam, LPARAM lParam )

// バージョン情報・コンフィグ情報 //
#ifdef GIT_COMMIT_HASH
#define VER_GITHASH "(GitHash " GIT_COMMIT_HASH ")\r\n"
#else
#define VER_GITHASH ""
#define VER_GITHASH "(GitHash " GIT_COMMIT_HASH ")"
#endif
DWORD dwVersionMS, dwVersionLS;
GetAppVersionInfo( NULL, VS_VERSION_INFO, &dwVersionMS, &dwVersionLS );
auto_sprintf(szMsg,
_T(
"v%d.%d.%d.%d %hs %hs\r\n"
"%hs"
),
HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS), // e.g. {2, 3, 2, 0}
VER_PLATFORM, // e.g. "64bit", "32bit"
VER_CONFIG, // e.g. "DEBUG", ""
VER_GITHASH // e.g. "(GitHash 4a0de5798394409af14ec69c310ba0c86efdfc05)\r\n", ""
_T("v%d.%d.%d.%d"),
HIWORD(dwVersionMS), LOWORD(dwVersionMS), HIWORD(dwVersionLS), LOWORD(dwVersionLS) // e.g. {2, 3, 2, 0}
);

// 1行目
cmemMsg.AppendString( szMsg );
#if defined(GIT_URL)
cmemMsg.AppendString(_T("(GitURL " GIT_URL ")\r\n"));
cmemMsg.AppendString( _T(" ") _T(VER_PLATFORM) );
cmemMsg.AppendString( _T(SPACE_WHEN_DEBUG) _T(VER_CONFIG) );
#ifdef ALPHA_VERSION
cmemMsg.AppendString( _T(" ") _T(ALPHA_VERSION_STR));
#endif
cmemMsg.AppendString( _T("\r\n") );

// 2行目
#ifdef VER_GITHASH
cmemMsg.AppendString( _T(VER_GITHASH) _T("\r\n"));
#endif

// 3行目
#ifdef GIT_URL
cmemMsg.AppendString( _T("(GitURL ") _T(GIT_URL) _T(")\r\n"));
#endif

// 段落区切り
Copy link
Member

@kobake kobake Jun 26, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#179 の対応ここでやったんですね…。

個人的にはこれだとバージョン文字列の全体の書式がぱっと見でわかりにくいのであまり好きではないですが、目的が達成できているのであれば構わないといえば構わないです。x64 マージを優先してレビューします。

以下のような文字列としてまとめていたほうが、どのような出力になるのかぱっと見でわかって良いと思っていました。

"v%d.%d.%d.%d  %hs  %hs\r\n"
"%hs"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

その書き方は条件コンパイルがない場合には
いいですが、条件コンパイルによって各要素が
増えたり減ったりする場合には難しいと思います

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

そこは工夫次第ですね。将来どういう条件が加わるか分からない状態で将来のことを考えすぎることは自分はしないです。

cmemMsg.AppendString( _T("\r\n") );

// 共有メモリ情報
Expand Down
19 changes: 18 additions & 1 deletion sakura_core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,24 @@
#define SPACE_WHEN_DEBUG ""
#endif

#if _WIN64
#define ALPHA_VERSION
#endif

#if defined(ALPHA_VERSION)
#pragma message("----------------------------------------------------------------------------------------")
#pragma message("--- This is an alpha version and under development. Be careful to use this version. ---")
#pragma message("----------------------------------------------------------------------------------------")
#endif

#ifdef ALPHA_VERSION
#define ALPHA_VERSION_STR "Alpha Version"
#define ALPHA_VERSION_STR_WITH_SPACE " " ALPHA_VERSION_STR
#else
#define ALPHA_VERSION_STR_WITH_SPACE ""
#endif

// リソース埋め込み用バージョン文字列
// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit DEBUG"
// e.g. "2.3.2.0 (4a0de579) UNICODE 64bit"
#define RESOURCE_VERSION_STRING(_VersionString) _VersionString " (" GIT_SHORT_COMMIT_HASH ") " VER_CHARSET " " VER_PLATFORM SPACE_WHEN_DEBUG VER_CONFIG
#define RESOURCE_VERSION_STRING(_VersionString) _VersionString " (" GIT_SHORT_COMMIT_HASH ") " VER_CHARSET " " VER_PLATFORM SPACE_WHEN_DEBUG VER_CONFIG ALPHA_VERSION_STR_WITH_SPACE