MCPcopy Create free account
hub / github.com/aldelaro5/dolphin-memory-engine / loadStruct

Method loadStruct

Source/GUI/StructEditor/StructDetailModel.cpp:358–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358void StructDetailModel::loadStruct(StructTreeNode* baseNode)
359{
360 if (m_baseNode)
361 {
362 unloadStruct();
363 }
364
365 beginResetModel();
366 m_baseNode = baseNode;
367 m_curSize = m_baseNode->getStructDef()->getLength();
368
369 u32 cur_offset = 0;
370 for (FieldDef* field : m_baseNode->getStructDef()->getFields())
371 {
372 while (cur_offset < field->getOffset())
373 {
374 m_fields.push_back(new FieldDef(cur_offset, 1, true));
375 cur_offset += 1;
376 }
377 FieldDef* newField = new FieldDef(field);
378 m_fields.push_back(newField);
379 cur_offset = field->getOffset() + field->getFieldSize();
380 }
381 while (cur_offset < m_curSize)
382 {
383 m_fields.push_back(new FieldDef(cur_offset, 1, true));
384 cur_offset += 1;
385 }
386 endResetModel();
387}
388
389void StructDetailModel::saveStruct()
390{

Callers 1

onEditStructMethod · 0.80

Calls 5

getStructDefMethod · 0.80
getFieldsMethod · 0.80
getOffsetMethod · 0.80
getFieldSizeMethod · 0.80
getLengthMethod · 0.45

Tested by

no test coverage detected