summaryrefslogtreecommitdiff
path: root/platform/windows/godot_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/windows/godot_win.cpp')
-rw-r--r--platform/windows/godot_win.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp
index 4450cb3670..cff2cbad42 100644
--- a/platform/windows/godot_win.cpp
+++ b/platform/windows/godot_win.cpp
@@ -156,32 +156,36 @@ int widechar_main(int argc, wchar_t **argv) {
return os.get_exit_code();
};
-int main(int _argc, char **_argv) {
-// _argc and _argv are ignored
-// we are going to use the WideChar version of them instead
+int _main() {
+ LPWSTR *wc_argv;
+ int argc;
+ int result;
-#ifdef CRASH_HANDLER_EXCEPTION
- __try {
-#endif
- LPWSTR *wc_argv;
- int argc;
- int result;
+ wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+
+ if (NULL == wc_argv) {
+ wprintf(L"CommandLineToArgvW failed\n");
+ return 0;
+ }
- wc_argv = CommandLineToArgvW(GetCommandLineW(), &argc);
+ result = widechar_main(argc, wc_argv);
- if (NULL == wc_argv) {
- wprintf(L"CommandLineToArgvW failed\n");
- return 0;
- }
+ LocalFree(wc_argv);
+ return result;
+}
- result = widechar_main(argc, wc_argv);
+int main(int _argc, char **_argv) {
+// _argc and _argv are ignored
+// we are going to use the WideChar version of them instead
- LocalFree(wc_argv);
- return result;
#ifdef CRASH_HANDLER_EXCEPTION
+ __try {
+ return _main();
} __except (CrashHandlerException(GetExceptionInformation())) {
return 1;
}
+#else
+ return _main();
#endif
}