From bbe51e86249114cac4716c391e267c499a52847a Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 3 Jun 2025 16:21:58 +0800 Subject: Revert "Promote seh_catcher() et al. to llexception.{h,cpp} for general use." This reverts commit 71d777ea126e7f02cb46c11bdb606094ca06f75c. --- indra/newview/llappviewerwin32.cpp | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index ef609026ad..4f5fa53312 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -396,10 +396,17 @@ void ll_nvapi_init(NvDRSSessionHandle hSession) } } -int APIENTRY wWinMain(HINSTANCE hInstance, - HINSTANCE hPrevInstance, - PWSTR pCmdLine, - int nCmdShow) +//#define DEBUGGING_SEH_FILTER 1 +#if DEBUGGING_SEH_FILTER +# define WINMAIN DebuggingWinMain +#else +# define WINMAIN wWinMain +#endif + +int APIENTRY WINMAIN(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + PWSTR pCmdLine, + int nCmdShow) { // Call Tracy first thing to have it allocate memory // https://github.com/wolfpld/tracy/issues/196 @@ -548,6 +555,27 @@ int APIENTRY wWinMain(HINSTANCE hInstance, return 0; } +#if DEBUGGING_SEH_FILTER +// The compiler doesn't like it when you use __try/__except blocks +// in a method that uses object destructors. Go figure. +// This winmain just calls the real winmain inside __try. +// The __except calls our exception filter function. For debugging purposes. +int APIENTRY wWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + PWSTR lpCmdLine, + int nCmdShow) +{ + __try + { + WINMAIN(hInstance, hPrevInstance, lpCmdLine, nCmdShow); + } + __except( viewer_windows_exception_handler( GetExceptionInformation() ) ) + { + _tprintf( _T("Exception handled.\n") ); + } +} +#endif + void LLAppViewerWin32::disableWinErrorReporting() { std::string executable_name = gDirUtilp->getExecutableFilename(); -- cgit v1.2.3 From ce7feccefb41764546a840d8e1abca12ea6e68c7 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 23 Jun 2025 10:23:36 +0800 Subject: No NVAPI on Windows ARM64 --- indra/newview/llappviewerwin32.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 4f5fa53312..3e51a900ce 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -47,8 +47,10 @@ #include "llviewercontrol.h" #include "lldxhardware.h" +#if !_M_ARM64 #include "nvapi/nvapi.h" #include "nvapi/NvApiDriverSettings.h" +#endif #include @@ -206,6 +208,7 @@ LONG WINAPI catchallCrashHandler(EXCEPTION_POINTERS * /*ExceptionInfo*/) const std::string LLAppViewerWin32::sWindowClass = "Second Life"; +#if !_M_ARM64 /* This function is used to print to the command line a text message describing the nvapi error and quits @@ -219,6 +222,7 @@ void nvapi_error(NvAPI_Status status) //should always trigger when asserts are enabled //llassert(status == NVAPI_OK); } +#endif // Create app mutex creates a unique global windows object. // If the object can be created it returns true, otherwise @@ -241,6 +245,7 @@ bool create_app_mutex() return result; } +#if !_M_ARM64 void ll_nvapi_init(NvDRSSessionHandle hSession) { // (2) load all the system settings into the session @@ -395,6 +400,7 @@ void ll_nvapi_init(NvDRSSessionHandle hSession) return; } } +#endif //#define DEBUGGING_SEH_FILTER 1 #if DEBUGGING_SEH_FILTER @@ -464,6 +470,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, return -1; } +#if !_M_ARM64 NvDRSSessionHandle hSession = 0; static LLCachedControl use_nv_api(gSavedSettings, "NvAPICreateApplicationProfile", true); if (use_nv_api) @@ -488,6 +495,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, } } } +#endif // Have to wait until after logging is initialized to display LFH info if (num_heaps > 0) @@ -545,12 +553,14 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, delete viewer_app_ptr; viewer_app_ptr = NULL; +#if !_M_ARM64 // (NVAPI) (6) We clean up. This is analogous to doing a free() if (hSession) { NvAPI_DRS_DestroySession(hSession); hSession = 0; } +#endif return 0; } -- cgit v1.2.3 From d2936affe3cf357e1402eca1d9a871a432893266 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Thu, 3 Jul 2025 15:22:59 +0800 Subject: No setDPIAwareness or gIconResource if using SDL for now, and if we do have to use SDL for Windows ARM64. --- indra/newview/llappviewerwin32.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'indra/newview/llappviewerwin32.cpp') diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 3e51a900ce..67a44cfb27 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -31,7 +31,9 @@ #endif #include "llwin32headers.h" +#if !LL_SDL #include "llwindowwin32.h" // *FIX: for setting gIconResource. +#endif #include "llappviewerwin32.h" @@ -423,7 +425,9 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, DWORD heap_enable_lfh_error[MAX_HEAPS]; S32 num_heaps = 0; +#if !LL_SDL LLWindowWin32::setDPIAwareness(); +#endif #if WINDOWS_CRT_MEM_CHECKS && !INCLUDE_VLD _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); // dump memory leaks on exit @@ -452,8 +456,10 @@ int APIENTRY WINMAIN(HINSTANCE hInstance, #endif #endif +#if !LL_SDL // *FIX: global gIconResource = MAKEINTRESOURCE(IDI_LL_ICON); +#endif LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str()); -- cgit v1.2.3