diff --git a/aegisub/auto4_perl.cpp b/aegisub/auto4_perl.cpp index 5b2426d1c..5ff892e87 100644 --- a/aegisub/auto4_perl.cpp +++ b/aegisub/auto4_perl.cpp @@ -547,6 +547,16 @@ namespace Automation4 { PERL_SYS_TERM(); } } + + Script* PerlScriptFactory::Produce(const wxString &filename) const + { + if(filename.EndsWith(_T(PERL_SCRIPT_EXTENSION))) { + return new PerlScript(filename); + } + else { + return 0; + } + } }; diff --git a/aegisub/auto4_perl.h b/aegisub/auto4_perl.h index 9d7273bfb..7fc5cb336 100644 --- a/aegisub/auto4_perl.h +++ b/aegisub/auto4_perl.h @@ -252,17 +252,8 @@ namespace Automation4 { PerlScriptFactory(); ~PerlScriptFactory(); - virtual Script* Produce(const wxString &filename) const - { - if(filename.EndsWith(_T(PERL_SCRIPT_EXTENSION))) { - return new PerlScript(filename); - } - else { - return 0; - } - } + Script* Produce(const wxString &filename) const; }; - }; diff --git a/aegisub/main.cpp b/aegisub/main.cpp index 3eb2400ac..abe021fdf 100644 --- a/aegisub/main.cpp +++ b/aegisub/main.cpp @@ -87,12 +87,38 @@ void StartupLog(const wxString &msg) { #define StartupLog(a) #endif +#ifdef __VISUALC__ +#define MS_VC_EXCEPTION 0x406d1388 + +typedef struct tagTHREADNAME_INFO { + DWORD dwType; // must be 0x1000 + LPCSTR szName; // pointer to name (in same addr space) + DWORD dwThreadID; // thread ID (-1 caller thread) + DWORD dwFlags; // reserved for future use, most be zero +} THREADNAME_INFO; + +void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) { + THREADNAME_INFO info; + info.dwType = 0x1000; + info.szName = szThreadName; + info.dwThreadID = dwThreadID; + info.dwFlags = 0; + __try { + RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(DWORD), (DWORD *)&info); + } + __except (EXCEPTION_CONTINUE_EXECUTION) {} +} +#endif /////////////////////////// // Initialization function // ----------------------- // Gets called when application starts, creates MainFrame bool AegisubApp::OnInit() { +#ifdef __VISUALC__ + SetThreadName(-1,"AegiMain"); +#endif + StartupLog(_T("Inside OnInit")); frame = NULL; try {