Fix Vsync

This commit is contained in:
GabsPuNs
2026-05-20 16:40:07 -04:00
parent bbba35362d
commit 3d802ef86b
7 changed files with 212 additions and 257 deletions

View File

@@ -24,7 +24,107 @@ void CConsoleMinecraftApp::ExitGame()
{
m_bShutdown = true;
}
void CConsoleMinecraftApp::FatalLoadError() {}
void CConsoleMinecraftApp::FatalLoadError()
{
ExitGame();
}
LONG WINAPI CConsoleMinecraftApp::UnhandledExceptionFilter(EXCEPTION_POINTERS* pExceptionInfo)
{
/*
SYSTEMTIME st;
GetLocalTime(&st);
char exeName[MAX_PATH];
GetModuleFileNameA(nullptr, exeName, MAX_PATH);
PathStripPath(exeName);
PathRemoveExtension(exeName);
char dumpFilePath[MAX_PATH];
sprintf(dumpFilePath, "%s_crash_%02d_%02d_%04d_%02d_%02d_%02d.dmp", exeName, st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
HANDLE hDumpFile = CreateFile(dumpFilePath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hDumpFile != INVALID_HANDLE_VALUE)
{
MINIDUMP_EXCEPTION_INFORMATION mei{};
mei.ThreadId = GetCurrentThreadId();
mei.ExceptionPointers = pExceptionInfo;
mei.ClientPointers = FALSE;
MINIDUMP_TYPE dumpType =
#ifdef _DEBUG
MiniDumpWithFullMemory;
#else
(MINIDUMP_TYPE)(MiniDumpWithDataSegs | MiniDumpWithHandleData | MiniDumpWithThreadInfo);
#endif
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, dumpType, pExceptionInfo ? &mei : nullptr, nullptr, nullptr);
CloseHandle(hDumpFile);
}
auto ExceptionName = [](DWORD code) -> const wchar_t*
{
switch (code)
{
case EXCEPTION_ACCESS_VIOLATION:
return L"Access Violation";
case EXCEPTION_STACK_OVERFLOW:
return L"Stack Overflow";
case EXCEPTION_INT_DIVIDE_BY_ZERO:
return L"Integer Divide by Zero";
case EXCEPTION_ILLEGAL_INSTRUCTION:
return L"Illegal Instruction";
case EXCEPTION_IN_PAGE_ERROR:
return L"In-Page Error";
case EXCEPTION_BREAKPOINT:
return L"Breakpoint";
default:
return L"Unknown Exception Name";
}
};
char logPath[MAX_PATH];
sprintf_s(logPath, "%s_crash_%02d_%02d_%04d_%02d_%02d_%02d.txt", exeName, st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
HANDLE hLogFile = CreateFile(logPath, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
if (hLogFile != INVALID_HANDLE_VALUE)
{
char buf[1024];
int len = sprintf_s(buf, "Exception Code: 0x%08X (%ls)\nException Address: 0x%p", pExceptionInfo->ExceptionRecord->ExceptionCode, ExceptionName(pExceptionInfo->ExceptionRecord->ExceptionCode), pExceptionInfo->ExceptionRecord->ExceptionAddress);
DWORD written;
WriteFile(hLogFile, buf, len, &written, nullptr);
CloseHandle(hLogFile);
}
char msg[1024];
if (pExceptionInfo && pExceptionInfo->ExceptionRecord)
{
DWORD code = pExceptionInfo->ExceptionRecord->ExceptionCode;
void* addr = pExceptionInfo->ExceptionRecord->ExceptionAddress;
sprintf_s(msg, "%s has run into a fatal error and must be closed.\n\nException: 0x%08X (%s)\nAddress: 0x%p\n\nA crash dump and log file have been written.", exeName, code, ExceptionName(code), addr);
}
else
{
sprintf_s(msg, "%s has run into a fatal error and must be closed.\n\nNo exception information was available.\n", exeName);
}
char title[1024];
sprintf_s(title, "%s - Fatal Error", exeName);
MessageBox(nullptr, msg, title, MB_OK | MB_ICONERROR);
return EXCEPTION_EXECUTE_HANDLER;
*/
}
void CConsoleMinecraftApp::CaptureSaveThumbnail()
{
@@ -50,7 +150,11 @@ void CConsoleMinecraftApp::GetSaveThumbnail(PBYTE *pbData,DWORD *pdwSize)
if (pdwSize) *pdwSize = 0;
}
}
void CConsoleMinecraftApp::ReleaseSaveThumbnail() {}
void CConsoleMinecraftApp::ReleaseSaveThumbnail()
{
if (m_ThumbnailBuffer.Allocated())
m_ThumbnailBuffer.Release();
}
void CConsoleMinecraftApp::GetScreenshot(int iPad,PBYTE *pbData,DWORD *pdwSize) {}