MCPcopy Create free account
hub / github.com/codestation/qcma / loadSfoMetadata

Method loadSfoMetadata

common/cmaobject.cpp:66–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66void CMAObject::loadSfoMetadata(const QString &path)
67{
68 QString sfo = QDir(path).absoluteFilePath("PARAM.SFO");
69 bool skipMetadata = QSettings().value("skipMetadata", false).toBool();
70 SfoReader reader;
71
72 if(!skipMetadata && reader.load(sfo)) {
73 metadata.data.saveData.title = strdup(reader.value("TITLE", ""));
74 //FIXME: disable savedata detail for now
75 //QString detail(reader.value("SAVEDATA_DETAIL", ""));
76
77 // libxml follow the spec and normalizes the newlines (and others) but
78 // the PS Vita chokes on contiguous codes and crashes the CMA app on
79 // the device. Of course, the "fix" would be that libxml doesn't
80 // normalize newlines but that is aganist the XML spec that the PS Vita
81 // doesn't respect >_>
82
83 // convert DOS to UNIX newlines
84 //detail.replace("\r\n", "\n");
85 // separate newlines from quotes
86 //detail.replace("\n\"", "\n \"");
87 //detail.replace("\"\n", "\" \n");
88 // merge consecutive newlines
89 //detail.replace("\n\n", "\n");
90 //while(detail.endsWith('\n')) {
91 // detail.chop(1);
92 //}
93 //metadata.data.saveData.detail = strdup(detail.toStdString().c_str());
94 metadata.data.saveData.detail = strdup("");
95
96 // remove newlines from savedata title
97 QString title(reader.value("SAVEDATA_TITLE", ""));
98 while(title.endsWith('\n')) {
99 title.chop(1);
100 }
101 metadata.data.saveData.savedataTitle = strdup(title.toStdString().c_str());
102 metadata.data.saveData.dateTimeUpdated = QFileInfo(sfo).birthTime().toUTC().toSecsSinceEpoch();
103 } else {
104 metadata.data.saveData.title = strdup(metadata.name);
105 metadata.data.saveData.detail = strdup("");
106 metadata.data.saveData.savedataTitle = strdup("");
107 metadata.data.saveData.dateTimeUpdated = 0;
108 }
109}
110
111void CMAObject::initObject(const QFileInfo &file, int obj_file_type)
112{

Callers

nothing calls this directly

Calls 2

valueMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected