/Client/Debug
/client/resourse.aps
/client/bin/resources/textures
+/client/buildversion.hpp
+/client/get_auto_ver_client.vbs
+/server/get_auto_ver_server.vbs
+/server/buildversion.hpp
#include "ServerLauncher.hpp"
#include "ConfigManager.hpp"
#include "../common/Logger.hpp"
+#include "version.hpp"
const TCHAR* Core::CONFIG_PATH = _T("config.json");
-const TCHAR* Core::WINDOW_TITILE = _T("Miku Miku Online");
const TCHAR* Core::FONT_FILE_PATH = _T("resources/fonts/umeplus-p-gothic.ttf");
+#ifdef _DEBUG
+#define EXCEPTION_LOG(e) (e)
+#else
+#define EXCEPTION_LOG(e) try { \
+ (e); \
+ } catch (std::exception& e) { \
+ Logger::Error(_T("%s"), unicode::ToTString(e.what())); \
+ }
+#endif
+
Core::Core()
{
}
int Core::Run()
{
+ Logger::Info(_T("%s"), unicode::ToTString(MMO_VERSION_TEXT));
+
if (SetUpDxLib() == -1) {
return -1;
}
LoadFont();
SceneInit();
- MainLoop();
+
+ EXCEPTION_LOG(MainLoop());
if (current_scene_) {
current_scene_ = scene::BasePtr();
int Core::SetUpDxLib()
{
//TCHAR title[] = WINDOW_TITILE;
- const TCHAR* title = WINDOW_TITILE;
- SetMainWindowText(title);
+ SetMainWindowText(unicode::ToTString(MMO_VERSION_TEXT).c_str());
SetWindowIconID(100);
private:
const static TCHAR* CONFIG_PATH;
- const static TCHAR* WINDOW_TITILE;
const static TCHAR* FONT_FILE_PATH;
};
--- /dev/null
+#pragma once
+
+#include "buildversion.hpp"
+
+#define MMO_VERSION_TOSTRING_(val) #val
+#define MMO_VERSION_TOSTRING(val) MMO_VERSION_TOSTRING_(val)
+
+#define MMO_VERSION_MAJOR 0
+#define MMO_VERSION_MINOR 1
+#define MMO_VERSION_REVISION 1
+
+#ifdef MMO_VERSION_BUILD
+#define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD)
+#else
+#define MMO_VERSION_BUILD_TEXT
+#endif
+
+#define MMO_VERSION_TITLE "Miku Miku Online"
+
+#define MMO_VERSION_TEXT (MMO_VERSION_TITLE " " MMO_VERSION_TOSTRING(MMO_VERSION_MAJOR) "." \
+ MMO_VERSION_TOSTRING(MMO_VERSION_MINOR) "." MMO_VERSION_TOSTRING(MMO_VERSION_REVISION)\
+ MMO_VERSION_BUILD_TEXT)
class Logger {
// Singleton
private:
- Logger() {}
+ Logger() : ofs_("mmo_log.txt") {}
Logger(const Logger& logger) {}
virtual ~Logger() {}
}
void Log(const tstring& prefix, const tstring& format) {
- auto out = prefix + format + _T("\r\n");
- OutputDebugString(prefix.c_str());
- OutputDebugString(format.c_str());
- OutputDebugString(_T("\r\n"));
+ auto out = prefix + format + _T("\n");
+ OutputDebugString(out.c_str());
+ ofs_ << unicode::ToString(out);
}
template<class T1>
void Log(const tstring& prefix, const tstring& format, const T1& t1) {
- OutputDebugString(prefix.c_str());
- OutputDebugString((tformat(format) % t1).str().c_str());
- OutputDebugString(_T("\r\n"));
+ auto out = prefix + (tformat(format) % t1).str() + _T("\n");
+ OutputDebugString(out.c_str());
+ ofs_ << unicode::ToString(out);
}
template<class T1, class T2>
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2) {
- OutputDebugString(prefix.c_str());
- OutputDebugString((tformat(format) % t1 % t2).str().c_str());
- OutputDebugString(_T("\r\n"));
+ auto out = prefix + (tformat(format) % t1 % t2).str() + _T("\n");
+ OutputDebugString(out.c_str());
+ ofs_ << unicode::ToString(out);
}
template<class T1, class T2, class T3>
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3) {
- OutputDebugString(prefix.c_str());
- OutputDebugString((tformat(format) % t1 % t2 % t3).str().c_str());
- OutputDebugString(_T("\r\n"));
+ auto out = prefix + (tformat(format) % t1 % t2 % t3).str() + _T("\n");
+ OutputDebugString(out.c_str());
+ ofs_ << unicode::ToString(out);
}
template<class T1, class T2, class T3, class T4>
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
- OutputDebugString(prefix.c_str());
- OutputDebugString((tformat(format) % t1 % t2 % t3 % t4).str().c_str());
- OutputDebugString(_T("\r\n"));
+ auto out = prefix + (tformat(format) % t1 % t2 % t3 % t4).str() + _T("\n");
+ OutputDebugString(out.c_str());
+ ofs_ << unicode::ToString(out);
}
+
+ std::ofstream ofs_;
};
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/foreach.hpp>
+#include "version.hpp"
#include "Server.hpp"
#include "../common/network/Encrypter.hpp"
#include "../common/network/Signature.hpp"
int main(int argc, char* argv[])
{
+ Logger::Info(_T("%s"), unicode::ToTString(MMO_VERSION_TEXT));
try {
--- /dev/null
+#pragma once
+
+#include "buildversion.hpp"
+
+#define MMO_VERSION_TOSTRING_(val) #val
+#define MMO_VERSION_TOSTRING(val) MMO_VERSION_TOSTRING_(val)
+
+#define MMO_VERSION_MAJOR 0
+#define MMO_VERSION_MINOR 1
+#define MMO_VERSION_REVISION 1
+
+#ifdef MMO_VERSION_BUILD
+#define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD)
+#else
+#define MMO_VERSION_BUILD_TEXT
+#endif
+
+#define MMO_VERSION_TITLE "Miku Miku Online Server"
+
+#define MMO_VERSION_TEXT (MMO_VERSION_TITLE " " MMO_VERSION_TOSTRING(MMO_VERSION_MAJOR) "." \
+ MMO_VERSION_TOSTRING(MMO_VERSION_MINOR) "." MMO_VERSION_TOSTRING(MMO_VERSION_REVISION)\
+ MMO_VERSION_BUILD_TEXT)