Initrd.gz wrote: |
You could modify cmdman to have a function that gets the list of commands, but perhaps it could be a security breach (not to mention a pain to use on existing servers), and use their helptext. |
Samapico wrote: |
I gave that exact link in my post.... "it doesn't look like it's possible" doesn't answer my question much. ?commands are registered, and has to be a way to get the list of them, even if it involves adding a new interface function to cmdman |
Code: Show/Hide static Icmdman *cmd; static void (*AddCommandOriginal)(const char *cmdname, CommandFunc func, Arena *arena, helptext_t ht); static void (*RemoveCommandOriginal)(const char *cmdname, CommandFunc func, Arena *arena); static void AddCommandInt(const char *cmdname, CommandFunc func, Arena *arena, helptext_t ht) { // ... AddCommandOriginal(cmdname, func, arena, ht); } static void RemoveCommandInt(const char *cmdname, CommandFunc func, Arena *arena) { // ... RemoveCommandOriginal(cmdnam, func, arena); } static void ReleaseInterfaces() { mm->ReleaseInterface(cmd); } EXPORT int MM_cmdlist(int action, Imodman *mm_, Arena *arena) { if (action == MM_LOAD) { mm = mm_; cmd = mm->GetInterface(I_CMDMAN, ALLARENAS); if (!cmd) { ReleaseInterfaces(); return MM_FAIL; } AddCommandOriginal = cmd->AddCommand; RemoveCommandOriginal = cmd->RemoveCommand; cmd->AddCommand = AddCommandInt; cmd->RemoveCommand = RemoveCommandInt; } else if (action == MM_UNLOAD) { if (cmd->AddCommand != AddCommandInt || cmd->RemoveCommand != RemoveCommandInt) return MM_FAIL; cmd->AddCommand = AddCommandOriginal; cmd->RemoveCommand = RemoveCommandOriginal; ReleaseInterfaces(); } } |
Dr Brain wrote: |
D1st0rt made this: https://bitbucket.org/d1st0rt/asss_hostedgame
I'm not very familiar with it, so I'm not sure if it'll do what you need. |
Samapico wrote: |
If I understand what you're doing there, you'd need to add:
cmd->AddCommand = AddCommandOriginal; cmd->RemoveCommand = RemoveCommandOriginal; just before releasing the cmd interface ? Also, you'd need to load that thing right after cmdman... but then, you wouldn't be able to use this to list the core commands? Unless it's another module that adds commands to communicate with the core module?? |