-
Notifications
You must be signed in to change notification settings - Fork 0
/
Startup.cpp
68 lines (53 loc) · 1.49 KB
/
Startup.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// comment out the below line to minimize engine initialization
//#define USE_SAKURAGL_INITIALIZER 1
#include <exception>
#include <iostream>
#include <string_view>
#include <sakura/sakura.h>
#include <sakuragl/sakuragl.h>
#if !USE_SAKURAGL_INITIALIZER
# include <sakuragl/sgl_erisa_lib.h>
# include <sakuragl/sgl_media.h>
# include <sakuragl/sgl2d_image.h>
# include <sakuragl/sgl3d_image.h>
#endif
int xwmain(int argc, wchar_t* argv[]);
using namespace std::literals;
int wmain(int argc, wchar_t* argv[]) {
// see also
// - Source/common/sakuragl/sakuragl.cpp
// - Source/win32/sakuragl/sakuragl_startup_con.cpp
int ret = 0;
#if USE_SAKURAGL_INITIALIZER
SakuraGL::Initialize();
#else
SSystem::Initialize();
ERISA::sclfInitializeMatrix();
SakuraGL::SGLImageDecoderManager::Initialzie();
SakuraGL::SGLImageEncoderManager::Initialzie();
SakuraGL::SGLAudioDecoderManager::Initialzie();
#endif
SSystem::SetMemoryAllocationMode(SSystem::mallocModeGlobal);
#ifdef NDEBUG
try {
ret = xwmain(argc, argv);
} catch (std::exception exception) {
std::cerr << exception.what() << std::endl;
ret = 11;
} catch (...) {
std::wcerr << L"an error occurred"sv << std::endl;
ret = 11;
}
#else
ret = xwmain(argc, argv);
#endif
#if USE_SAKURAGL_INITIALIZER
SakuraGL::Finalize();
#else
SakuraGL::SGLImageDecoderManager::Finalize();
SakuraGL::SGLImageEncoderManager::Finalize();
SakuraGL::SGLAudioDecoderManager::Finalize();
SSystem::Finalize();
#endif
return ret;
}