MCPcopy Create free account
hub / github.com/EasyRPG/Player / GetExFont

Method GetExFont

src/exe_reader.cpp:218–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

216}
217
218std::vector<uint8_t> EXEReader::GetExFont() {
219 corefile.clear();
220
221 auto bitmapDBase = ResOffsetByType(2);
222 if (bitmapDBase == 0) {
223 Output::Debug("EXEReader: BITMAP not found.");
224 return {};
225 }
226
227 // Looking for a named entry.
228 uint16_t resourcesNDEs = GetU16(bitmapDBase + 0x0C) + (uint32_t) GetU16(bitmapDBase + 0x0E);
229 uint32_t resourcesNDEbase = bitmapDBase + 0x10;
230 while (resourcesNDEs) {
231 uint32_t name = GetU32(resourcesNDEbase);
232 // Actually a name?
233 if (name & 0x80000000) {
234 name = exe_reader_roffset(resource_ofs, name);
235
236 if (ResNameCheck(name, "EXFONT")) {
237 uint32_t dataent = GetU32(resourcesNDEbase + 4);
238 if (dataent & 0x80000000) {
239 dataent = exe_reader_roffset(resource_ofs, dataent);
240 dataent = resource_ofs + GetU32(dataent + 0x14);
241 }
242 uint32_t filebase = (GetU32(dataent) - resource_rva) + resource_ofs;
243 uint32_t filesize = GetU32(dataent + 0x04);
244 Output::Debug("EXEReader: EXFONT resource found (DE {:#x}; {:#x}; len {:#x})", dataent, filebase, filesize);
245 return ExtractExFont(corefile, filebase, filesize);
246 }
247 }
248 resourcesNDEbase += 8;
249 resourcesNDEs--;
250 }
251 Output::Debug("EXEReader: EXFONT not found in dbase at {:#x}", bitmapDBase);
252 return {};
253}
254
255std::vector<std::vector<uint8_t>> EXEReader::GetLogos() {
256 corefile.clear();

Callers 1

CreateGameObjectsMethod · 0.80

Calls 3

exe_reader_roffsetFunction · 0.85
ExtractExFontFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected