-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include "../../common/Version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "#include ""../common/version.h""\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "FileDescription", "SwiftShader libEGL Dynamic Link Library"
- VALUE "FileVersion", VERSION_STRING
- VALUE "InternalName", "libEGL"
- VALUE "LegalCopyright", "Copyright (C) 2012 TransGaming Inc."
- VALUE "OriginalFilename", "libEGL.dll"
- VALUE "PrivateBuild", VERSION_STRING
- VALUE "ProductName", "SwiftShader libEGL Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
+// Microsoft Visual C++ generated resource script.\r
+//\r
+#include "resource.h"\r
+\r
+#define APSTUDIO_READONLY_SYMBOLS\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 2 resource.\r
+//\r
+#include <windows.h>\r
+#include "../../common/Version.h"\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#undef APSTUDIO_READONLY_SYMBOLS\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+// English (United States) resources\r
+\r
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US\r
+#pragma code_page(1252)\r
+\r
+#ifdef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// TEXTINCLUDE\r
+//\r
+\r
+1 TEXTINCLUDE \r
+BEGIN\r
+ "resource.h\0"\r
+END\r
+\r
+2 TEXTINCLUDE \r
+BEGIN\r
+ "#include ""afxres.h""\r\n"\r
+ "#include ""../common/version.h""\0"\r
+END\r
+\r
+3 TEXTINCLUDE \r
+BEGIN\r
+ "\r\n"\r
+ "\0"\r
+END\r
+\r
+#endif // APSTUDIO_INVOKED\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Version\r
+//\r
+\r
+VS_VERSION_INFO VERSIONINFO\r
+ FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION\r
+ PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION\r
+ FILEFLAGSMASK 0x17L\r
+#ifdef _DEBUG\r
+ FILEFLAGS 0x1L\r
+#else\r
+ FILEFLAGS 0x0L\r
+#endif\r
+ FILEOS 0x4L\r
+ FILETYPE 0x2L\r
+ FILESUBTYPE 0x0L\r
+BEGIN\r
+ BLOCK "StringFileInfo"\r
+ BEGIN\r
+ BLOCK "040904b0"\r
+ BEGIN\r
+ VALUE "FileDescription", "SwiftShader libEGL Dynamic Link Library"\r
+ VALUE "FileVersion", VERSION_STRING\r
+ VALUE "InternalName", "libEGL"\r
+ VALUE "LegalCopyright", "Copyright (C) 2012 TransGaming Inc."\r
+ VALUE "OriginalFilename", "libEGL.dll"\r
+ VALUE "PrivateBuild", VERSION_STRING\r
+ VALUE "ProductName", "SwiftShader libEGL Dynamic Link Library"\r
+ VALUE "ProductVersion", VERSION_STRING\r
+ END\r
+ END\r
+ BLOCK "VarFileInfo"\r
+ BEGIN\r
+ VALUE "Translation", 0x409, 1200\r
+ END\r
+END\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Dialog\r
+//\r
+\r
+IDD_DIALOG1 DIALOGEX 0, 0, 129, 47\r
+STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
+CAPTION "Waiting for debugger"\r
+FONT 8, "MS Shell Dlg", 400, 0, 0x1\r
+BEGIN\r
+ PUSHBUTTON "Cancel",IDCANCEL,72,26,50,14\r
+ LTEXT "Attach a debugger or ESC to cancel",IDC_STATIC,7,7,115,8\r
+END\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// DESIGNINFO\r
+//\r
+\r
+#ifdef APSTUDIO_INVOKED\r
+GUIDELINES DESIGNINFO\r
+BEGIN\r
+ IDD_DIALOG1, DIALOG\r
+ BEGIN\r
+ LEFTMARGIN, 7\r
+ RIGHTMARGIN, 122\r
+ TOPMARGIN, 7\r
+ BOTTOMMARGIN, 40\r
+ END\r
+END\r
+#endif // APSTUDIO_INVOKED\r
+\r
+#endif // English (United States) resources\r
+/////////////////////////////////////////////////////////////////////////////\r
+\r
+\r
+\r
+#ifndef APSTUDIO_INVOKED\r
+/////////////////////////////////////////////////////////////////////////////\r
+//\r
+// Generated from the TEXTINCLUDE 3 resource.\r
+//\r
+\r
+\r
+/////////////////////////////////////////////////////////////////////////////\r
+#endif // not APSTUDIO_INVOKED\r
+\r
\r
#include "main.h"\r
\r
+#include "resource.h"\r
#include "Common/Thread.hpp"\r
#include "Common/SharedLibrary.hpp"\r
#include "common/debug.h"\r
}\r
\r
#if defined(_WIN32)\r
+static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)\r
+{\r
+ RECT rect;\r
+\r
+ switch(uMsg)\r
+ {\r
+ case WM_INITDIALOG:\r
+ GetWindowRect(GetDesktopWindow(), &rect);\r
+ SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE);\r
+ SetTimer(hwnd, 1, 100, NULL);\r
+ return TRUE;\r
+ case WM_COMMAND:\r
+ if(LOWORD(wParam) == IDCANCEL)\r
+ {\r
+ EndDialog(hwnd, 0);\r
+ }\r
+ break;\r
+ case WM_TIMER:\r
+ if(IsDebuggerPresent())\r
+ {\r
+ EndDialog(hwnd, 0);\r
+ }\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+static void WaitForDebugger(HINSTANCE instance)\r
+{\r
+ if(!IsDebuggerPresent())\r
+ {\r
+ HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);\r
+ DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog);\r
+ DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);\r
+ }\r
+}\r
+\r
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)\r
{\r
switch(reason)\r
{\r
case DLL_PROCESS_ATTACH:\r
- // MessageBoxA(0, "Attach debugger now and press OK", "SwiftShader loaded", MB_OK);\r
+ if(false)\r
+ {\r
+ WaitForDebugger(instance);\r
+ }\r
return eglAttachProcess();\r
break;\r
case DLL_THREAD_ATTACH:\r