Lazy font loading (to speed up running unit tests...)

This commit is contained in:
Henrik Rydgard 2013-03-06 22:24:30 +01:00
parent 477aeee0ee
commit 43df3c9071
2 changed files with 7 additions and 2 deletions

View File

@ -433,6 +433,10 @@ LoadedFont *GetLoadedFont(u32 handle, bool allowClosed) {
}
void __LoadInternalFonts() {
if (internalFonts.size()) {
// Fonts already loaded.
return;
}
std::string fontPath = "flash0:/font/";
if (!pspFileSystem.GetFileInfo(fontPath).exists) {
pspFileSystem.MkDir(fontPath);
@ -504,7 +508,6 @@ int GetInternalFontIndex(Font *font) {
}
void __FontInit() {
__LoadInternalFonts();
actionPostAllocCallback = __KernelRegisterActionType(PostAllocCallback::Create);
actionPostOpenCallback = __KernelRegisterActionType(PostOpenCallback::Create);
}
@ -540,6 +543,8 @@ void __FontDoState(PointerWrap &p) {
}
u32 sceFontNewLib(u32 paramPtr, u32 errorCodePtr) {
// Lazy load internal fonts, only when font library first inited.
__LoadInternalFonts();
INFO_LOG(HLE, "sceFontNewLib(%08x, %08x)", paramPtr, errorCodePtr);
if (Memory::IsValidAddress(paramPtr) && Memory::IsValidAddress(errorCodePtr)) {

View File

@ -311,7 +311,7 @@ void BlockAllocator::ListBlocks()
for (std::list<Block>::const_iterator iter = blocks.begin(); iter != blocks.end(); iter++)
{
const Block &b = *iter;
INFO_LOG(HLE, "Block: %08x - %08x size %08x taken=%i tag=%s", b.start, b.start+b.size, b.size, b.taken ? 1:0, b.tag);
INFO_LOG(HLE, "Block: %08x - %08x size %08x taken=%i tag=%s", b.start, b.start+b.size, b.size, b.taken ? 1:0, b.tag);
}
}