예제 #1
0
파일: UnCore.cpp 프로젝트: gildor2/UModel
void PrintStringHashDistribution()
{
	int hashCounts[1024];
	int totalCount = 0;
	memset(hashCounts, 0, sizeof(hashCounts));
	for (int hash = 0; hash < STRING_HASH_SIZE; hash++)
	{
		int count = 0;
		for (CStringPoolEntry* info = StringHashTable[hash]; info; info = info->HashNext)
			count++;
		assert(count < ARRAY_COUNT(hashCounts));
		hashCounts[count]++;
		totalCount += count;
	}
	appPrintf("String hash distribution: collision count -> num chains\n");
	int totalCount2 = 0;
	for (int i = 0; i < ARRAY_COUNT(hashCounts); i++)
	{
		int count = hashCounts[i];
		if (count > 0)
		{
			totalCount2 += count * i;
			float percent = totalCount2 * 100.0f / totalCount;
			appPrintf("%d -> %d [%.1f%%]\n", i, count, percent);
		}
	}
	assert(totalCount == totalCount2);
}
예제 #2
0
byte *FindXprData(const char *Name, int *DataSize)
{
	// scan xprs
	static bool ready = false;
	if (!ready)
	{
		ready = true;
		appEnumGameFiles(ReadXprFile, "xpr");
	}
	// find a file
	for (int i = 0; i < xprFiles.Num(); i++)
	{
		XprInfo *Info = &xprFiles[i];
		for (int j = 0; j < Info->Items.Num(); j++)
		{
			XprEntry *File = &Info->Items[j];
			if (strcmp(File->Name, Name) == 0)
			{
				// found
				appPrintf("Loading stream %s from %s (%d bytes)\n", Name, Info->File->RelativeName, File->DataSize);
				FArchive *Reader = appCreateFileReader(Info->File);
				Reader->Seek(File->DataOffset);
				byte *buf = (byte*)appMalloc(File->DataSize);
				Reader->Serialize(buf, File->DataSize);
				delete Reader;
				if (DataSize) *DataSize = File->DataSize;
				return buf;
			}
		}
	}
	appPrintf("WARNING: external stream %s was not found\n", Name);
	if (DataSize) *DataSize = 0;
	return NULL;
}
예제 #3
0
static void Modellist_f(bool usage, int argc, char **argv)
{
	static const char *types[] = {"unk",	"inl",	"spr",		"md3"};		// see modelType_t
	static const char *colors[] = {S_RED,	"",		S_MAGENTA, S_GREEN};	// ...

	if (argc > 2 || usage)
	{
		appPrintf("Usage: modellist [mask]\n");
		return;
	}
	const char *mask = (argc == 2) ? argv[1] : NULL;

	int totalSize = 0;
	int totalCount = 0;
	appPrintf("-----type-size----name---------\n");
	for (int i = 0; i < modelCount; i++)
	{
		//?? skip inline model from list, or compact (print somethink like this: "0-96 inl *1..*97")
		model_t *m = modelsArray[i];
		if (mask && !appMatchWildcard(m->Name, mask, true)) continue;
		totalCount++;
		appPrintf("%-3d  %3s  %-7d %s%s\n", i, types[m->type], m->size, colors[m->type], *m->Name);
		totalSize += m->size;
	}
	appPrintf("Displayed %d/%d models, used %d bytes\n", totalCount, modelCount, totalSize);
}
예제 #4
0
void ReleaseAllObjects()
{
	guard(ReleaseAllObjects);

#if 0
	appPrintf("Memory: allocated " FORMAT_SIZE("d") " bytes in %d blocks\n", GTotalAllocationSize, GTotalAllocationCount);
	appDumpMemoryAllocations();
#endif
	for (int i = UObject::GObjObjects.Num() - 1; i >= 0; i--)
		delete UObject::GObjObjects[i];
	UObject::GObjObjects.Empty();

	GFullyLoadedPackages.Empty();

#if 0
	// verify that all object pointers were set to NULL
	for (int i = 0; i < UnPackage::PackageMap.Num(); i++)
	{
		UnPackage* p = UnPackage::PackageMap[i];
		for (int j = 0; j < p->Summary.ExportCount; j++)
		{
			FObjectExport& Exp = p->ExportTable[j];
			if (Exp.Object) printf("! %s %d\n", p->Name, j);
		}
	}
#endif
	appPrintf("Memory: allocated " FORMAT_SIZE("d") " bytes in %d blocks\n", GTotalAllocationSize, GTotalAllocationCount);
//	appDumpMemoryAllocations();

	unguard;
}
예제 #5
0
파일: GLBind.cpp 프로젝트: RMiB/UModel
void QGL_PrintExtensionsString(const char *label, const char *str, const char *mask)
{
	char	name[256];

	// display label
	appPrintf(S_RED"%s extensions: ", label);
	// display extension names
	int i = 0;
	while (true)
	{
		char c = *str++;
		if ((c == ' ' || c == 0) && i)
		{
			name[i] = 0;
			i = 0;
			// name[] now contains current extension name
			// check display mask
			if (mask && !appMatchWildcard(name, mask, true)) continue;
			// determine color for name display
			const char *color = NULL;
			int j;
			unsigned m;
			extInfo_t *ext;
			for (j = 0, m = 1, ext = extInfo; j < NUM_EXTENSIONS; j++, ext++, m <<= 1)
			{
				const char *s = ext->names;
				while (s[0])				// while aliases present
				{
					if (!strcmp(s, name)) break;
					s = strchr(s, 0) + 1;
				}
				if (!s[0]) continue;
				// here: current name is one of aliases of extInfo[j]
				if (gl_config.disabledExt & m)
					color = S_CYAN;			// disabled by cvar
				else if (gl_config.ignoredExt & m)
					color = S_BLUE;			// ignored in a favor of different extension
				else if (gl_config.extensionMask & m)
					color = S_GREEN;		// used
				else
					color = S_RED;			// switched off by another reason
				appPrintf("%s%s "S_WHITE, color, name);
				break;
			}
			if (!color) appPrintf("%s ", name);		// unsupported extension
		}
		else
		{
			if (i >= sizeof(name)-1)
			{
				appWPrintf("Bad extension string\n");
				return;
			}
			name[i++] = c;
		}
		if (!c) break;
	}
	// EOLN
	appPrintf("\n");
}
예제 #6
0
파일: gl_font.cpp 프로젝트: RkShaRkz/Quake2
static void Fontlist_f(bool usage, int argc, char **argv)
{
	appPrintf("--w---h---name---------\n");
	for (int i = 0; i < fontCount; i++)
	{
		const CFont &font = fontArray[i];
		appPrintf("%3d %3d   %s\n", font.charWidth, font.charHeight, *font.Name);
	}
}
예제 #7
0
파일: snd_dma.cpp 프로젝트: RkShaRkz/Quake2
// Called once each time through the main loop
void S_Update(const CVec3 &origin, const CVec3 &right)
{
	int		i;

	if (!sound_started) return;

	// rebuild scale tables if volume is modified
	if (s_volume->modified)
		S_InitScaletable();

	listener_origin = origin;
	listener_right  = right;

	// update spatialization for dynamic sounds
	channel_t *ch = channels;
	for (i = 0; i < MAX_CHANNELS; i++, ch++)
	{
		if (!ch->sfx)
			continue;
		if (ch->autosound)
		{	// autosounds are regenerated fresh each frame
			memset(ch, 0, sizeof(*ch));
			continue;
		}
		S_Spatialize(ch);         // respatialize channel
		if (!ch->leftvol && !ch->rightvol)
		{
			memset(ch, 0, sizeof(*ch));
			continue;
		}
	}

	// add loopsounds
	AddLoopSounds();

	// debugging output
	if (s_show->integer == 2)
	{
		int total = 0;
		for (i = 0, ch = channels; i < MAX_CHANNELS; i++, ch++)
			if (ch->sfx && (ch->leftvol || ch->rightvol) )
			{
				appPrintf("%3i %3i %s\n", ch->leftvol, ch->rightvol, *ch->sfx->Name);
				total++;
			}

		appPrintf("----(%i)---- painted: %i\n", total, paintedtime);
	}

// mix some sound
	S_Update_();
}
예제 #8
0
파일: sv_main.cpp 프로젝트: RkShaRkz/Quake2
// Execute command on server from remove client with redirected console output
// Output will be sent back to client as "svc_print" command
static void cRemoteCommand(int argc, char **argv)
{
	guard(SVC_RemoteCommand);

	if (!rcon_password->string[0] || strcmp(argv[1], rcon_password->string))
	{
		appPrintf("Bad rcon from %s:\n%s\n", NET_AdrToString(&net_from), net_message.data+4);
		Netchan_OutOfBandPrint(NS_SERVER, net_from, "print\nBad rcon password\n");
	}
	else
	{
		appPrintf("Rcon from %s:\n%s\n", NET_AdrToString(&net_from), net_message.data+4);

		// fill line with a rest of command string (cut "rcon")
		TString<256> Cmd; Cmd[0] = 0;
		for (int i = 2; i < argc; i++)
		{
			if (i > 2) Cmd += " ";
			Cmd += argv[i];
		}

		// execute command with a redirected output
		//?? may be, if message is longer, than MAX_MSGLEN_OLD, flush and continue
		//?? buffering output
		COutputDeviceMem *Mem = new COutputDeviceMem(MAX_MSGLEN_OLD-16);
		Mem->NoColors = true;		// client may not support colored texts ...
		HookOutput(Mem);
		TRY {
			if (!ExecuteCommand(Cmd))
				appWPrintf("Bad remote command \"%s\"\n", *Cmd);
			//?? move code to Mem->Flush(); call Flush() implicitly at end too
			// if server will be restarted during active redirection, drop data
			if (sv_client && sv_client->netchan.message.maxsize)
			{
				// send redirected text
				MSG_WriteByte(&sv_client->netchan.message, svc_print);
				MSG_WriteByte(&sv_client->netchan.message, PRINT_HIGH);
				MSG_WriteString(&sv_client->netchan.message, Mem->GetText());
			}
		} CATCH {
			UnhookOutput;
			delete Mem;
			THROW_AGAIN;
		} END_CATCH
		UnhookOutput;
		delete Mem;
	}

	unguard;
}
예제 #9
0
void FArchive::OverrideVersion()
{
	int OldVer  = ArVer;
	int OldLVer = ArLicenseeVer;

	for (int i = 0; i < ARRAY_COUNT(ueVersions); i++)
	{
		if (ueVersions[i].GameTag == Game)
		{
			ArVer = ueVersions[i].PackageVersion;
			break;
		}
	}

#if MASSEFF
	if (Game == GAME_MassEffect) ArLicenseeVer = OVERRIDE_ME1_LVER;
#endif
#if TRANSFORMERS
	if (Game == GAME_Transformers && ArLicenseeVer >= 181) ArVer = OVERRIDE_TRANSFORMERS3; // Transformers: Fall of Cybertron
#endif
#if SPECIALFORCE2
	if (Game == GAME_SpecialForce2)
	{
		// engine for this game is upgraded without changing ArVer, they have ArVer set too high and changind ArLicenseeVer only
		if (ArLicenseeVer >= 14)
			ArVer = OVERRIDE_SF2_VER2;
		else if (ArLicenseeVer == 9)
			ArVer = OVERRIDE_SF2_VER;
	}
#endif // SPECIALFORCE2
#if ALICE
	if (Game == GAME_Alice && GForceGame == GAME_UNKNOWN)
	{
		appPrintf("Forcing game set to Alice2\n");
		GForceGame = GAME_Alice;
	}
#endif // ALICE
#if REMEMBER_ME
	if (Game == GAME_RememberMe)
	{
		if (ArVer > 832) // 832 = Remember Me, higher - Life is Strange
			ArVer = OVERRIDE_LIS_VER;
	}
#endif // REMEMBER_ME

	if ((ArVer != OldVer || ArLicenseeVer != OldLVer) && Game < GAME_UE4)
		appPrintf("Overrided version %d/%d -> %d/%d\n", OldVer, OldLVer, ArVer, ArLicenseeVer);
}
예제 #10
0
파일: cl_view.cpp 프로젝트: RkShaRkz/Quake2
static void Gun_Prev_f()
{
	gun_frame--;
	if (gun_frame < 0)
		gun_frame = 0;
	appPrintf("frame %i\n", gun_frame);
}
예제 #11
0
파일: gl_win.cpp 프로젝트: RkShaRkz/Quake2
void GLimp_Shutdown(bool complete)
{
	RestoreGamma();

	appPrintf("Performing GL shutdown\n");
	DestoryGLcontext();
	if (gl_hDC)
	{
		if (!ReleaseDC(gl_hWnd, gl_hDC))
			ErrFail("ReleaseDC()");
		gl_hDC = NULL;
	}

	Vid_DestroyWindow(true); //?? (gl_bitdepth->modified);
	gl_hWnd = NULL;

	if (gl_config.fullscreen)
	{
		if (complete)
		{
			Com_DPrintf("...restore display mode\n");
			MSGLOG(("CDS(NULL)\n"));
			ChangeDisplaySettings(NULL, 0);
		}
		gl_config.fullscreen = false;
	}
}
예제 #12
0
파일: sv_main.cpp 프로젝트: RkShaRkz/Quake2
static void Master_Heartbeat()
{
	if (!DEDICATED)
		return;		// only dedicated servers send heartbeats

	if (!public_server->integer)
		return;		// a private dedicated game

	// check for time wraparound
	if (svs.last_heartbeat > svs.realtime)
		svs.last_heartbeat = svs.realtime;

	if (svs.realtime - svs.last_heartbeat < HEARTBEAT_SECONDS*1000)
		return;		// not time to send yet

	svs.last_heartbeat = svs.realtime;

	// send the same string that we would give for a status OOB command
	const char *string = SV_StatusString();

	// send to group master
	for (int i = 0; i < MAX_MASTERS; i++)
		if (master_adr[i].port)
		{
			appPrintf("Sending heartbeat to %s\n", NET_AdrToString(&master_adr[i]));
			Netchan_OutOfBandPrint(NS_SERVER, master_adr[i], "heartbeat\n%s", string);
		}
}
예제 #13
0
파일: UnMesh4.cpp 프로젝트: lynxluna/UModel
void USkeleton::Serialize(FArchive &Ar)
{
	guard(USkeleton::Serialize);

	Super::Serialize(Ar);

	if (Ar.ArVer >= VER_UE4_REFERENCE_SKELETON_REFACTOR)
		Ar << ReferenceSkeleton;

	if (Ar.ArVer >= VER_UE4_FIX_ANIMATIONBASEPOSE_SERIALIZATION)
	{
		Ar << AnimRetargetSources;
	}
	else
	{
		appPrintf("USkeleton has old AnimRetargetSources format, skipping\n");
		DROP_REMAINING_DATA(Ar);
		return;
	}

	if (Ar.ArVer >= VER_UE4_SKELETON_GUID_SERIALIZATION)
		Ar << Guid;

	if (Ar.ArVer >= VER_UE4_SKELETON_ADD_SMARTNAMES)
		Ar << SmartNames;

	unguard;
}
예제 #14
0
int FindGameTag(const char *name)
{
	int Count = ARRAY_COUNT(GListOfGames) - 1;	// exclude TABLE_END marker
	for (int i = 0; i < Count; i++)
	{
		const char *key = GListOfGames[i].Switch;
		if (!key) continue;
		if (!stricmp(key, name)) return GListOfGames[i].Enum;
	}
#if UNREAL4
	// For UE4 games we use procedurally generated tags
	if (!strnicmp(name, "ue4.", 4))
	{
		const char* ver = name + 4;
		for (const char* s = ver; *s; s++)
		{
			if (!isdigit(*s))
				return -1;
		}
		int nVer = atoi(ver);
		if (nVer > LATEST_SUPPORTED_UE4_VERSION)
		{
			appPrintf("ERROR: provided game tag for UE4 version %d (%s), latest supported version is %d\n", nVer, name, LATEST_SUPPORTED_UE4_VERSION);
			exit(1);
		}
		return GAME_UE4(nVer);
	}
#endif // UNREAL4
	return -1;
}
예제 #15
0
static void SaveSound(const UObject *Obj, void *Data, int DataSize, const char *DefExt)
{
	// check for enough place for header
	if (DataSize < 16)
	{
		appPrintf("... empty sound %s ?\n", Obj->Name);
		return;
	}

	const char *ext = DefExt;

	if (!memcmp(Data, "OggS", 4))
		ext = "ogg";
	else if (!memcmp(Data, "RIFF", 4))
		ext = "wav";
	else if (!memcmp(Data, "FSB4", 4))
		ext = "fsb";		// FMOD sound bank
	else if (!memcmp(Data, "MSFC", 4))
		ext = "mp3";		// PS3 MP3 codec

	FArchive *Ar = CreateExportArchive(Obj, "%s.%s", Obj->Name, ext);
	if (Ar)
	{
		Ar->Serialize(Data, DataSize);
		delete Ar;
	}
}
예제 #16
0
static void PrintHashDistribution()
{
	int hashCounts[1024];
	memset(hashCounts, 0, sizeof(hashCounts));
	for (int hash = 0; hash < GAME_FILE_HASH_SIZE; hash++)
	{
		int count = 0;
		for (CGameFileInfo* info = GGameFileHash[hash]; info; info = info->HashNext)
			count++;
		assert(count < ARRAY_COUNT(hashCounts));
		hashCounts[count]++;
	}
	appPrintf("Filename hash distribution:\n");
	for (int i = 0; i < ARRAY_COUNT(hashCounts); i++)
		if (hashCounts[i] > 0)
			appPrintf("%d -> %d\n", i, hashCounts[i]);
}
예제 #17
0
static void BioReadBulkCatalog()
{
	static bool ready = false;
	if (ready) return;
	ready = true;
	appEnumGameFiles(BioReadBulkCatalogFile, "bdc");
	if (!bioCatalog.Num()) appPrintf("WARNING: no *.bdc files found\n");
}
예제 #18
0
void PrintStringHashDistribution()
{
	int hashCounts[1024];
	memset(hashCounts, 0, sizeof(hashCounts));
	for (int hash = 0; hash < STRING_HASH_SIZE; hash++)
	{
		int count = 0;
		for (CStringPoolEntry* item = StringHashTable[hash]; item; item = item->HashNext)
			count++;
		assert(count < ARRAY_COUNT(hashCounts));
		hashCounts[count]++;
	}
	appPrintf("String hash distribution:\n");
	for (int i = 0; i < ARRAY_COUNT(hashCounts); i++)
		if (hashCounts[i] > 0)
			appPrintf("%d -> %d\n", i, hashCounts[i]);
}
예제 #19
0
파일: snd_dma.cpp 프로젝트: RkShaRkz/Quake2
static void S_SoundList_f(bool usage, int argc, char **argv)
{
	if (argc > 2 || usage)
	{
		appPrintf("Usage: soundlist [<mask>]\n");
		return;
	}

	const char *mask = (argc == 2) ? argv[1] : NULL;

	appPrintf("---lp-bit-size----name----------\n");

	int n = 0, total = 0;
	int		i;
	sfx_t	*sfx;
	for (i = 0, sfx = known_sfx; i < num_sfx; i++, sfx++)
	{
		if (!sfx->Name[0])
			continue;

		if (mask && !appMatchWildcard(sfx->Name, mask, true)) continue;
		n++;

		sfxcache_t *sc = sfx->cache;
		if (sc)
		{
			int size = sc->length*sc->width*(sc->stereo+1);
			total += size;
			appPrintf("%-3d %c %2d  %-7d %s\n", i, sc->loopstart >= 0 ? 'L' : ' ', sc->width*8, size, *sfx->Name);
		}
		else
		{
			char *status;

			if (sfx->Name[0] == '*')
				status = "placeholder  ";
			else if (sfx->absent)
				status = S_RED"not found    "S_WHITE;
			else
				status = "not loaded   ";
			appPrintf("%-3d %s %s\n", i, status, *sfx->Name);
		}
	}
	appPrintf("Displayed %d/%d sounds; resident: %d bytes\n", n, num_sfx, total);
}
예제 #20
0
static void LoadModel_f(bool usage, int argc, char **argv)
{
	if (argc != 2 || usage)
	{
		appPrintf("Usage: loadmodel <filename>\n");
		return;
	}
	FindModel(argv[1]);
}
예제 #21
0
파일: CoreWin32.cpp 프로젝트: UIKit0/UModel
void appDumpStackTrace(const address_t* buffer, int depth)
{
	for (int i = 0; i < depth; i++)
	{
		if (!buffer[i]) break;
		const char *symbol = appSymbolName(buffer[i]);
		appPrintf("    %s\n", symbol);
	}
}
예제 #22
0
파일: snd_dma.cpp 프로젝트: RkShaRkz/Quake2
void S_Init(void)
{
	cvar_t *cv = Cvar_Get("nosound", "0", 0);
	if (cv->integer)
		appPrintf(S_CYAN"Sound disabled\n");
	else
	{
CVAR_BEGIN(vars)
		CVAR_VAR(s_volume, 0.7, CVAR_ARCHIVE),
		CVAR_VAR(s_khz, 22, CVAR_ARCHIVE),
		CVAR_VAR(s_loadas8bit, 0, CVAR_ARCHIVE),
		CVAR_VAR(s_reverse_stereo, 0, CVAR_ARCHIVE),
		CVAR_VAR(s_mixahead, 0.2, CVAR_ARCHIVE),
		CVAR_VAR(s_show, 0, 0),
		CVAR_VAR(s_testsound, 0, 0),
		CVAR_VAR(s_primary, 0, CVAR_ARCHIVE)		//?? win32 specific
CVAR_END

		Cvar_GetVars(ARRAY_ARG(vars));

		appPrintf("\n------- Sound initialization -------\n");

		if (!SNDDMA_Init()) return;

		RegisterCommand("play", S_Play_f);
		RegisterCommand("stopsound", S_StopAllSounds_f);
		RegisterCommand("soundlist", S_SoundList_f);
		RegisterCommand("soundinfo", S_SoundInfo_f);

		S_InitScaletable();

		sound_started = true;
		num_sfx = 0;

		soundtime   = 0;
		paintedtime = 0;

		appPrintf("sound sampling rate: %d\n", dma.speed);

		S_StopAllSounds_f();

		appPrintf("------------------------------------\n");
	}
}
예제 #23
0
void PrintGameList(bool tags)
{
	const char *oldTitle = NULL;
	int pos = 0;
#define LINEFEED 80

	int Count = ARRAY_COUNT(GListOfGames) - 1;	// exclude TABLE_END marker
	bool out = false;
	for (int i = 0; i < Count; i++)
	{
		const GameInfo &info = GListOfGames[i];
		if (tags && !info.Switch) continue;
		// engine title
		const char *title = GetEngineName(info.Enum);
		if (title != oldTitle)
		{
			appPrintf("%s%s:", out ? "\n\n" : "", title);
			pos = LINEFEED;
		}
		oldTitle = title;
		out = true;
		// game info
		if (tags)
		{
			appPrintf("\n %8s  %s", info.Switch ? info.Switch : "", info.Name);
			continue;
		}
		// simple game list
		if (!(info.Enum & ~GAME_ENGINE) && info.Switch) continue;	// skip simple GAME_UEn
		const char *name = info.Name;
		int len = strlen(name);
		bool needComma = (i < Count - 1) && (GetEngineName(GListOfGames[i+1].Enum) == title);
		if (needComma) len += 2;
		if (pos >= LINEFEED - len)
		{
			appPrintf("\n  ");
			pos = 2;
		}
		appPrintf("%s%s", name, needComma ? ", " : "");
		pos += len;
	}
	appPrintf("\n");
}
예제 #24
0
void appPrintProfiler()
{
	if (ProfileStartTime == -1) return;
	float timeDelta = (appMilliseconds() - ProfileStartTime) / 1000.0f;
	if (timeDelta < 0.001f && !GNumAllocs && !GSerializeBytes && !GNumSerialize)
		return;		// perhaps already printed?
	appPrintf("Loaded in %.2g sec, %d allocs, %.2f MBytes serialized in %d calls.\n",
		timeDelta, GNumAllocs, GSerializeBytes / (1024.0f * 1024.0f), GNumSerialize);
	appResetProfiler();
}
예제 #25
0
	friend FArchive& operator<<(FArchive &Ar, BioBulkCatalogItem &S)
	{
		Ar << S.ObjectName << S.PackageName << S.f10 << S.DataOffset << S.DataSize << S.DataSize2 << S.f20;
		assert(S.f10 == 0);
//		assert(S.DataSize == S.DataSize2);	-- the same on PC, but not the same on XBox360
#if DUMP_BIO_CATALOG
		appPrintf("  %s / %s - %08X:%08X %X %X %X\n", *S.ObjectName, *S.PackageName, S.f10, S.DataOffset, S.DataSize, S.DataSize2, S.f20);
#endif
		return Ar;
	}
예제 #26
0
파일: Core.cpp 프로젝트: hui211314dd/UModel
// Unicode appSprintf
int appSprintf(wchar_t *dest, int size, const wchar_t *fmt, ...)
{
	va_list	argptr;
	va_start(argptr, fmt);
	int len = vsnwprintf(dest, size, fmt, argptr);
	va_end(argptr);
	if (len < 0 || len >= size - 1)
		appPrintf("appSprintf: overflow of size %d (fmt=%S)\n", size, fmt);

	return len;
}
예제 #27
0
파일: UnCore.cpp 프로젝트: gildor2/UModel
void appPrintProfiler(const char* label)
{
	if (ProfileStartTime == -1) return;
	float timeDelta = (appMilliseconds() - ProfileStartTime) / 1000.0f;
	if (timeDelta < 0.001f && !GNumAllocs && !GSerializeBytes && !GNumSerialize)
		return;		// nothing to print (perhaps already printed?)
	appPrintf("%s in %.1f sec, %d allocs, %.2f MBytes serialized in %d calls.\n",
		label ? label : "Loaded",
		timeDelta, GNumAllocs, GSerializeBytes / (1024.0f * 1024.0f), GNumSerialize);
	appResetProfiler();
}
예제 #28
0
void appSetRootDirectory(const char *dir, bool recurse)
{
	guard(appSetRootDirectory);
	if (dir[0] == 0) dir = ".";	// using dir="" will cause scanning of "/dir1", "/dir2" etc (i.e. drive root)
	appStrncpyz(RootDirectory, dir, ARRAY_COUNT(RootDirectory));
	ScanGameDirectory(RootDirectory, recurse);
	appPrintf("Found %d game files (%d skipped)\n", GNumGameFiles, GNumForeignFiles);
#if PRINT_HASH_DISTRIBUTION
	PrintHashDistribution();
#endif
	unguardf("dir=%s", dir);
}
예제 #29
0
	friend FArchive& operator<<(FArchive &Ar, BioBulkCatalogFile &S)
	{
		Ar << S.f0 << S.Filename;
#if DUMP_BIO_CATALOG
		appPrintf("<<< %s >>>\n", *S.Filename);
#endif
		Ar << S.Items;
#if DEBUG_BIO_BULK
		int minS2 = 99999999, maxS2 = -99999999, min20 = 99999999, max20 = -99999999;
		for (int i = 0; i < S.Items.Num(); i++)
		{
			int n1 = S.Items[i].DataSize2;
			if (n1 < minS2) minS2 = n1;
			if (n1 > maxS2) maxS2 = n1;
			int n2 = S.Items[i].f20;
			if (n2 < min20) min20 = n1;
			if (n2 > max20) max20 = n1;
		}
		appPrintf("DS2=%X..%X  f20=%X..%X", minS2, maxS2, min20, max20);
#endif // DEBUG_BIO_BULK
		return Ar;
	}
예제 #30
0
파일: snd_dma.cpp 프로젝트: RkShaRkz/Quake2
void S_StartLocalSound(const char *sound)
{
	if (!sound_started)
		return;

	sfx_t *sfx = S_RegisterSound(sound);
	if (!sfx)
	{
		appPrintf("S_StartLocalSound: can't cache %s\n", sound);
		return;
	}
	S_StartSound(NULL, cl.playernum+1, 0, sfx, 1, 1, 0);
}