2025-09-19 04:42:07 +09:00
|
|
|
#include "pch.h"
|
|
|
|
|
#include "App.xaml.h"
|
|
|
|
|
#include "MainWindow.xaml.h"
|
2025-09-25 21:54:50 +09:00
|
|
|
#include "VavCore/VavCore.h"
|
2025-10-03 19:00:15 +09:00
|
|
|
#include "src/Logger/SimpleLogger.h"
|
2025-09-19 04:42:07 +09:00
|
|
|
|
|
|
|
|
using namespace winrt;
|
2025-09-21 14:52:33 +09:00
|
|
|
using namespace winrt::Microsoft::UI::Xaml;
|
2025-09-19 04:42:07 +09:00
|
|
|
|
|
|
|
|
namespace winrt::Vav2Player::implementation
|
|
|
|
|
{
|
2025-10-03 21:41:18 +09:00
|
|
|
App::App()
|
2025-09-25 21:54:50 +09:00
|
|
|
{
|
2025-10-03 21:41:18 +09:00
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
// Initialize VavCore on startup
|
2025-09-25 21:54:50 +09:00
|
|
|
VavCoreResult result = vavcore_initialize();
|
|
|
|
|
if (result == VAVCORE_SUCCESS)
|
|
|
|
|
{
|
|
|
|
|
const char* version = vavcore_get_version_string();
|
2025-10-03 21:41:18 +09:00
|
|
|
::Vav2Player::SimpleLogger::GetInstance().LogInfoF("[App] VavCore initialized successfully, version: %s", version);
|
2025-09-25 21:54:50 +09:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-10-03 21:41:18 +09:00
|
|
|
::Vav2Player::SimpleLogger::GetInstance().LogErrorF("[App] Failed to initialize VavCore: error code %d", result);
|
2025-09-25 21:54:50 +09:00
|
|
|
}
|
|
|
|
|
|
2025-09-19 04:42:07 +09:00
|
|
|
#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
|
2025-09-21 14:52:33 +09:00
|
|
|
UnhandledException([](IInspectable const&, UnhandledExceptionEventArgs const& e)
|
2025-09-19 04:42:07 +09:00
|
|
|
{
|
|
|
|
|
if (IsDebuggerPresent())
|
|
|
|
|
{
|
|
|
|
|
auto errorMessage = e.Message();
|
|
|
|
|
__debugbreak();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-21 14:52:33 +09:00
|
|
|
void App::OnLaunched(LaunchActivatedEventArgs const&)
|
2025-09-19 04:42:07 +09:00
|
|
|
{
|
2025-09-26 01:32:24 +09:00
|
|
|
window = winrt::make<implementation::MainWindow>();
|
2025-09-19 04:42:07 +09:00
|
|
|
window.Activate();
|
|
|
|
|
}
|
2025-09-21 14:52:33 +09:00
|
|
|
}
|