FontLib(u32 paramPtr) : fontHRes_(128.0f), fontVRes_(128.0f) { Memory::ReadStruct(paramPtr, ¶ms_); // We use the same strange scheme that JPCSP uses. u32 allocSize = 4 + 4 * params_.numFonts; PostAllocCallback *action = (PostAllocCallback *) __KernelCreateAction(actionPostAllocCallback); action->SetFontLib(GetListID()); u32 args[2] = { params_.userDataAddr, allocSize }; __KernelDirectMipsCall(params_.allocFuncAddr, action, args, 2, true); }
StdStrBuf C4ObjectList::GetNameList(C4DefList &rDefs) const { int cpos,idcount; C4ID c_id; C4Def *cdef; StdStrBuf Buf; for (cpos=0; (c_id=GetListID(C4D_All,cpos)); cpos++) if ((cdef=rDefs.ID2Def(c_id))) { idcount=ObjectCount(c_id); if (cpos>0) Buf.Append(", "); Buf.AppendFormat("%dx %s",idcount,cdef->GetName()); } return Buf; }
LoadedFont *OpenFont(Font *font) { int freeFontIndex = -1; for (size_t i = 0; i < fonts_.size(); i++) { if (isfontopen_[i] == 0) { freeFontIndex = (int)i; break; } } if (freeFontIndex < 0) { ERROR_LOG(HLE, "Too many fonts opened in FontLib"); return 0; } LoadedFont *loadedFont = new LoadedFont(font, GetListID(), fonts_[freeFontIndex]); isfontopen_[freeFontIndex] = 1; return loadedFont; }