mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-02-07 22:21:01 +00:00
- removed the bind command set from the osdcmd files to make sure that they don't get called anympre. All input should be routed through the new console code now.
# Conflicts: # source/blood/src/osdcmd.cpp # source/build/src/osd.cpp # source/common/console/c_cmdline.h # source/common/console/c_dispatch.cpp # source/common/console/c_dispatch.h # source/duke3d/src/osdcmds.cpp # source/rr/src/osdcmds.cpp
This commit is contained in:
parent
44f81ebd56
commit
5b67d653ed
4 changed files with 29 additions and 12 deletions
|
@ -23,7 +23,6 @@
|
|||
#include "opl3.h"
|
||||
|
||||
extern int AL_Stereo;
|
||||
extern int AL_AdditiveMode;
|
||||
|
||||
int AdLibDrv_GetError(void);
|
||||
const char *AdLibDrv_ErrorString(int ErrorNumber);
|
||||
|
|
|
@ -1518,15 +1518,7 @@ void OSD_Puts(const char *tmpstr)
|
|||
//
|
||||
void OSD_DispatchQueued(void)
|
||||
{
|
||||
if (!osd->history.exec)
|
||||
return;
|
||||
|
||||
int cmd = osd->history.exec - 1;
|
||||
|
||||
osd->history.exec = 0;
|
||||
|
||||
for (; cmd >= 0; cmd--)
|
||||
OSD_Dispatch((const char *)osd->history.buf[cmd]);
|
||||
C_RunDelayedCommands();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1537,6 +1529,7 @@ void OSD_Dispatch(const char *cmd)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
//
|
||||
// OSD_RegisterFunction() -- Registers a new function
|
||||
//
|
||||
|
@ -1558,6 +1551,7 @@ int OSD_RegisterFunction(const char *pszName, const char *pszDesc, int (*func)(o
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// OSD_SetVersionString()
|
||||
|
|
|
@ -1027,3 +1027,26 @@ bool C_ExecFile (const char *file)
|
|||
return exec != NULL;
|
||||
}
|
||||
|
||||
#include "osd.h"
|
||||
|
||||
static TArray<FConsoleCommand*> dynccmds; // This needs to be explicitly deleted before shutdown - the names in here may not be valid during the exit handler.
|
||||
//
|
||||
// OSD_RegisterFunction() -- Reroutes a Bulid-style CCMD to the new console.
|
||||
//
|
||||
int OSD_RegisterFunction(const char* pszName, const char* pszDesc, int (*func)(osdcmdptr_t))
|
||||
{
|
||||
FString nname = pszName;
|
||||
auto callback = [nname, pszDesc, func](FCommandLine& args, int key)
|
||||
{
|
||||
if (args.argc() > 0) args.operator[](0);
|
||||
osdfuncparm_t param = { args.argc(), nname.GetChars(), (const char**)args._argv + 1, args.cmd };
|
||||
if (func(¶m) != OSDCMD_OK)
|
||||
{
|
||||
Printf("%s\n", pszDesc);
|
||||
}
|
||||
};
|
||||
auto ccmd = new FConsoleCommand(pszName, callback);
|
||||
dynccmds.Push(ccmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "printf.h"
|
||||
#include "zstring.h"
|
||||
#include "c_commandline.h"
|
||||
#include "zstring.h"
|
||||
|
||||
class FConfigFile;
|
||||
|
||||
|
@ -78,7 +79,7 @@ void C_ClearAliases ();
|
|||
// build a single string out of multiple strings
|
||||
FString BuildString (int argc, FString *argv);
|
||||
|
||||
typedef void (*CCmdRun) (FCommandLine &argv, void *instigator, int key);
|
||||
typedef std::function<void(FCommandLine & argv, void *, int key)> CCmdRun;;
|
||||
|
||||
class FConsoleCommand
|
||||
{
|
||||
|
@ -86,7 +87,7 @@ public:
|
|||
FConsoleCommand (const char *name, CCmdRun RunFunc);
|
||||
virtual ~FConsoleCommand ();
|
||||
virtual bool IsAlias ();
|
||||
void PrintCommand () { Printf ("%s\n", m_Name); }
|
||||
void PrintCommand () { Printf ("%s\n", m_Name.GetChars()); }
|
||||
|
||||
virtual void Run (FCommandLine &args, void *instigator, int key);
|
||||
static FConsoleCommand* FindByName (const char* name);
|
||||
|
|
Loading…
Reference in a new issue