GlosSITarget: create crashdumps

pull/169/head
Peter Repukat 2 years ago
parent 7195207d30
commit 03bc6afd9f

@ -53,8 +53,10 @@
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"></ImportGroup>
<ImportGroup Label="Shared"></ImportGroup>
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
@ -130,7 +132,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;opengl32.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-graphics-d.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;opengl32.lib;sfml-window-d.lib;sfml-system-d.lib;sfml-graphics-d.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
@ -155,7 +157,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;opengl32.lib;sfml-window.lib;sfml-system.lib;sfml-graphics.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>hid.lib;Cfgmgr32.lib;opengl32.lib;sfml-window.lib;sfml-system.lib;sfml-graphics.lib;dwmapi.lib;xinput9_1_0.lib;setupapi.lib;ViGEmClient.lib;Dbghelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
@ -252,5 +254,6 @@
<Image Include="$(SolutionDir)\GloSC_Icon.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"></ImportGroup>
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

@ -192,10 +192,7 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\GloSC_Icon.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="GloSC_Icon.ico">
<Image Include="$(SolutionDir)\GloSC_Icon.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>

@ -16,6 +16,7 @@ limitations under the License.
#ifdef _WIN32
#define NOMINMAX
#include <Windows.h>
#include <DbgHelp.h>
#endif
#include <spdlog/sinks/basic_file_sink.h>
@ -27,14 +28,12 @@ limitations under the License.
#include "OverlayLogSink.h"
#include "Settings.h"
#ifdef _WIN32
// default to high performance GPU
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
LONG Win32FaultHandler(struct _EXCEPTION_POINTERS* ExInfo)
{
@ -49,20 +48,46 @@ LONG Win32FaultHandler(struct _EXCEPTION_POINTERS* ExInfo)
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
FaultTx = "FLT DIVIDE BY ZERO";
break;
default : FaultTx = "(unknown)";
default:
FaultTx = "(unknown)";
break;
}
int wsFault = ExInfo->ExceptionRecord->ExceptionCode;
PVOID CodeAdress = ExInfo->ExceptionRecord->ExceptionAddress;
spdlog::error("*** A Program Fault occurred:");
spdlog::error("*** Error code {:#x}: {}", wsFault, FaultTx);
spdlog::error("*** Address: {:#x}", (int)CodeAdress);
spdlog::error("*** Flags: {:#x}", ExInfo->ExceptionRecord->ExceptionFlags);
MINIDUMP_EXCEPTION_INFORMATION M;
HANDLE hDump_File;
auto path = std::filesystem::temp_directory_path()
.parent_path()
.parent_path()
.parent_path();
path /= "Roaming";
path /= "GlosSI";
if (!std::filesystem::exists(path))
std::filesystem::create_directories(path);
path /= "glossitarget.dmp";
M.ThreadId = GetCurrentThreadId();
M.ExceptionPointers = ExInfo;
M.ClientPointers = 0;
hDump_File = CreateFile(path.wstring().c_str(), GENERIC_WRITE, 0,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
hDump_File, MiniDumpNormal,
(ExInfo) ? &M : NULL, NULL, NULL);
CloseHandle(hDump_File);
/*if(want to continue)
{
ExInfo->ContextRecord->Eip++;
@ -123,26 +148,28 @@ int main(int argc, char* argv[])
auto exit = 1;
try {
#ifdef _WIN32
std::string argsv = "";
if (__argc > 1) {
for (int i = 1; i < __argc; i++)
argsv += i == 1 ? __argv[i] : std::string(" ") + __argv[i];
}
Settings::Parse(argsv);
SteamTarget target(__argc, __argv);
std::string argsv = "";
if (__argc > 1) {
for (int i = 1; i < __argc; i++)
argsv += i == 1 ? __argv[i] : std::string(" ") + __argv[i];
}
Settings::Parse(argsv);
SteamTarget target(__argc, __argv);
#else
std::string argsv = "";
if (argc > 1) {
for (int i = 1; i < argc; i++)
argsv += i == 1 ? argv[i] : std::string(" ") + argv[i];
}
Settings::Parse(argsv);
SteamTarget target(argc, argv);
std::string argsv = "";
if (argc > 1) {
for (int i = 1; i < argc; i++)
argsv += i == 1 ? argv[i] : std::string(" ") + argv[i];
}
Settings::Parse(argsv);
SteamTarget target(argc, argv);
#endif
exit = target.run();
} catch (std::exception& e) {
exit = target.run();
}
catch (std::exception& e) {
spdlog::error("Exception occured: {}", e.what());
} catch (...) {
}
catch (...) {
spdlog::error("Unknown exception occured");
}
spdlog::shutdown();

Loading…
Cancel
Save