예제 #1
0
void OSD_Printf(const char *fmt, ...)
{
	char tmpstr[1024], *chp;
	va_list va;
		
	if (!osdinited) OSD_Init();

	va_start(va, fmt);
	Bvsnprintf(tmpstr, 1024, fmt, va);
	va_end(va);

	if (osdlog) Bfputs(tmpstr, osdlog);

#if defined(_DEBUG) && defined(WIN32)
	OutputDebugStringA(tmpstr);
#endif

	for (chp = tmpstr; *chp; chp++) {
		if (*chp == '\r') osdpos=0;
		else if (*chp == '\n') {
			osdpos=0;
			linefeed();
		} else {
			osdtext[osdpos++] = *chp;
			if (osdpos == osdcols) {
				osdpos = 0;
				linefeed();
			}
		}
	}
}
예제 #2
0
//
// OSD_RegisterFunction() -- Registers a new function
//
int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const osdfuncparm_t*))
{
	symbol_t *symb;
	const char *cp;

	if (!osdinited) OSD_Init();

	if (!name) {
		Bprintf("OSD_RegisterFunction(): may not register a function with a null name\n");
		return -1;
	}
	if (!name[0]) {
		Bprintf("OSD_RegisterFunction(): may not register a function with no name\n");
		return -1;
	}

	// check for illegal characters in name
	for (cp = name; *cp; cp++) {
		if ((cp == name) && (*cp >= '0') && (*cp <= '9')) {
			Bprintf("OSD_RegisterFunction(): first character of function name \"%s\" must not be a numeral\n", name);
			return -1;
		}
		if ((*cp < '0') ||
		    (*cp > '9' && *cp < 'A') ||
		    (*cp > 'Z' && *cp < 'a' && *cp != '_') ||
		    (*cp > 'z')) {
			Bprintf("OSD_RegisterFunction(): illegal character in function name \"%s\"\n", name);
			return -1;
		}
	}

	if (!help) help = "(no description for this function)";
	if (!func) {
		Bprintf("OSD_RegisterFunction(): may not register a null function\n");
		return -1;
	}

	symb = findexactsymbol(name);
	if (symb) {
		Bprintf("OSD_RegisterFunction(): \"%s\" is already defined\n", name);
		return -1;
	}
	
	symb = addnewsymbol(name);
	if (!symb) {
		Bprintf("OSD_RegisterFunction(): Failed registering function \"%s\"\n", name);
		return -1;
	}

	symb->name = name;
	symb->help = help;
	symb->func = func;

	return 0;
}
예제 #3
0
void OSD_INIT(int nVGAW, int nVGAH, int nCVBSW, int nCVBSH)
{
	OSD_Init(nVGAW, nVGAH, nCVBSW, nCVBSH);
	OSD_RELOAD(TRUE, TRUE);
}