Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/27/19 in all areas

  1. M2 Download Center Download Here ( Internal ) Download Here ( GitHub ) Before: After:
    4 points
  2. function say_item(name, vnum, desc) say("[INSERT_IMAGE image_type;item|idx;"..vnum.."|title;"..name.."|desc;"..desc.."|index;".. 0 .."|total;".. 1 .."]") end
    2 points
  3. First one, thanks for release and good idea, here are some advices for the next time, how you should use zip method and lambda instead of __mem__func__ and others empty functions. Since the loadStepList is declared with ascending numbers from 0 to 100 (by default), we don't have to use min and max method for get the values for range, just the first value and the last value from list. __mem_func__ and the function 'bos' are useless in that case, we can replace it with a null lambda, will do the same job too. Using an list comprehension with conditions inside, isn't so readable. Good idea for zip method to get all the progresses values, but we don't need to initialize like that, you can acces the first reference by using index [0] from iterator. Should look like this: [Hidden Content]
    1 point
  4. M2 Download Center Download Here ( Internal ) Hello guys ! I want to share an old set of weapons whose i changed their gloss. The file contains : Icons Textures Models Before the modification : After the modification :
    1 point
  5. M2 Download Center Download Here ( Internal ) Hello, I want share a simple addon for more effective debugging crashes and exceptions on Windows. Technical details about mini dump: [Hidden Content] winminidump.c #define __LIBTHECORE__ #include "stdafx.h" #include "winminidump.h" #ifdef __WIN32__ #include <DbgHelp.h> #pragma comment(lib, "dbghelp.lib") // Custom minidump callback BOOL CALLBACK MiniDumpCallback(PVOID pParam, const PMINIDUMP_CALLBACK_INPUT pInput, PMINIDUMP_CALLBACK_OUTPUT pOutput) { BOOL bRet = FALSE; if (!pInput || !pOutput) return FALSE; switch (pInput->CallbackType) { case IncludeModuleCallback: { bRet = TRUE; } break; case IncludeThreadCallback: { bRet = TRUE; } break; case ModuleCallback: { if (!(pOutput->ModuleWriteFlags & ModuleReferencedByMemory)) { pOutput->ModuleWriteFlags &= (~ModuleWriteModule); } bRet = TRUE; } break; case ThreadCallback: { bRet = TRUE; } break; case ThreadExCallback: { bRet = TRUE; } break; case MemoryCallback: { bRet = FALSE; } break; case CancelCallback: break; } return bRet; } bool CreateMiniDump(EXCEPTION_POINTERS* pExceptionInfo) { fprintf(stderr, "Exception handled: %p", pExceptionInfo); if (IsDebuggerPresent()) DebugBreak(); char szProcessName[MAX_PATH]; GetModuleFileNameA(NULL, szProcessName, MAX_PATH); std::string strFileName = std::string(szProcessName); if (strFileName.size() > 0) { size_t iLastSlash = strFileName.find_last_of("\\/"); strFileName = strFileName.substr(iLastSlash + 1, strFileName.length() - iLastSlash); } time_t t; time(&t); struct tm *tinfo; tinfo = localtime(&t); char szDumpName[128]; strftime(szDumpName, sizeof(szDumpName), "dump%Y%m%d_%H%M%S.dmp", tinfo); char szDumpPath[256]; sprintf(szDumpPath, "%s_%s", strFileName.c_str(), szDumpName); HANDLE hFile = CreateFileA(szDumpPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); if (!hFile || hFile == INVALID_HANDLE_VALUE) { fprintf(stderr, "Exception dump file is not created. Error code: %u Path: %s", GetLastError(), szDumpPath); return false; } // Create the minidump MINIDUMP_EXCEPTION_INFORMATION mdei; mdei.ThreadId = GetCurrentThreadId(); mdei.ExceptionPointers = pExceptionInfo; mdei.ClientPointers = FALSE; MINIDUMP_CALLBACK_INFORMATION mci; mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MiniDumpCallback; mci.CallbackParam = 0; MINIDUMP_TYPE mdt = (MINIDUMP_TYPE)(MiniDumpWithIndirectlyReferencedMemory | MiniDumpScanMemory); BOOL rv = MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, mdt, (pExceptionInfo != 0) ? &mdei : 0, 0, &mci); if (!rv) { fprintf(stderr, "Exception dump can not created. Error code: %u", GetLastError()); } else { fprintf(stderr, "Exception dump successfully created."); } // Close the file CloseHandle(hFile); return true; } LONG WINAPI ExceptionFilter(EXCEPTION_POINTERS * pExceptionInfo) { if (pExceptionInfo && pExceptionInfo->ExceptionRecord) { if (pExceptionInfo->ExceptionRecord->ExceptionCode == EXCEPTION_STACK_OVERFLOW) { HANDLE hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CreateMiniDump, pExceptionInfo, 0, NULL); if (hThread && hThread != INVALID_HANDLE_VALUE) { WaitForSingleObject(hThread, INFINITE); CloseHandle(hThread); } } else { CreateMiniDump(pExceptionInfo); } } return EXCEPTION_EXECUTE_HANDLER; } bool setup_minidump_generator() { if (SetUnhandledExceptionFilter(ExceptionFilter)) { fprintf(stderr, "Mini dump generator succesfully created!"); return true; } fprintf(stderr, "Mini dump generator can NOT created! Error code: %u", GetLastError()); return false; } #else bool setup_minidump_generator() { return true; } #endif winminidump.h #ifndef __INC_LIBTHECORE_WINMINIDUMP_H__ #define __INC_LIBTHECORE_WINMINIDUMP_H__ #ifdef __cplusplus extern "C" { #endif extern bool setup_minidump_generator(); #ifdef __cplusplus }; #endif #endif Copy .c file to ServerSrc\libthecore\src and .h file to ServerSrc\libthecore\include. Define new files to your Makefile or CMakeLists.txt, and to libthecore project from your server's visual studio solution Open game\src\main.cpp and call new header file #include "../../libthecore/include/winminidump.h" Now search for your entrypoint int main(int argc, char **argv) Add new lines at the beginning of the function if (setup_minidump_generator() == false) return 1; Open your db\src\main.cpp and call new header file #include "../../libthecore/include/winminidump.h" Now search for your entrypoint int main() Add new lines at the beginning of the function if (setup_minidump_generator() == false) return 1; If you are using rubinum's auth core you can implement same routine to "int main(int argc, char** argv)" function from auth\src\main.cpp If you take any exceptions after making these edits, The core will create a memory dump with the file name like CORE_FILE_NAME_dump_DATE.dmp and you can easily analyze this file via visual studio just like freebsd ".core" files.
    1 point
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.