bool CNetwork::registerNatives(const AMX_NATIVE_INFO *list) { err = amx_Register(&inimod_amx,list,-1); int num = 0; amx_NumNatives(&inimod_amx,&num); printf("Registered %i native functions.\n",num); return true; }
void BinLog::WritePluginDB(FILE *fp) { int num = g_plugins.getPluginsNum(); fwrite(&num, sizeof(int), 1, fp); CPluginMngr::CPlugin *pl; char c; unsigned char len; for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter) { pl = &(*iter); if (pl->isValid()) c = 1; else c = 0; if (c && pl->isDebug()) c = 2; fwrite(&c, sizeof(char), 1, fp); if (c) { Debugger *pd = NULL; len = (char)strlen(pl->getName()); fwrite(&len, sizeof(char), 1, fp); len++; fwrite(pl->getName(), sizeof(char), len, fp); int natives, publics, files; AMX *amx = pl->getAMX(); // Write the number of Filenames if (c == 2) { pd = static_cast<Debugger *>(amx->userdata[UD_DEBUGGER]); files = pd->m_pAmxDbg->hdr->files; fwrite(&files, sizeof(int), 1, fp); } amx_NumNatives(amx, &natives); amx_NumPublics(amx, &publics); fwrite(&natives, sizeof(int), 1, fp); fwrite(&publics, sizeof(int), 1, fp); char name[34]; // Write the Filenames to the binfile if (c == 2) { AMX_DBG_FILE **ftable = pd->m_pAmxDbg->filetbl; for (int i=0; i<files; i++) { len = (char)strlen(ftable[i]->name); fwrite(&len, sizeof(char), 1, fp); len++; fwrite(ftable[i]->name, sizeof(char), len, fp); } } for (int i=0; i<natives; i++) { amx_GetNative(amx, i, name); len = (char)strlen(name); fwrite(&len, sizeof(char), 1, fp); len++; fwrite(name, sizeof(char), len, fp); } for (int i=0; i<publics; i++) { amx_GetPublic(amx, i, name); len = (char)strlen(name); fwrite(&len, sizeof(char), 1, fp); len++; fwrite(name, sizeof(char), len, fp); } } else { char empty[] = " "; len = 1; fwrite(&len, sizeof(char), 1, fp); fwrite(empty, sizeof(char), len, fp); int no = 0; fwrite(&no, sizeof(int), 1, fp); fwrite(&no, sizeof(int), 1, fp); } } }