mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-20 03:37:46 +00:00
Update to latest libphysis
This commit is contained in:
parent
0e1fcebd63
commit
b6c2f2eb73
8 changed files with 57 additions and 44 deletions
|
@ -42,6 +42,7 @@ private:
|
||||||
void exdFinished(int index);
|
void exdFinished(int index);
|
||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
|
physis_EXH *exh;
|
||||||
QFutureWatcher<physis_EXD> *exdFuture;
|
QFutureWatcher<physis_EXD> *exdFuture;
|
||||||
|
|
||||||
std::vector<GearInfo> gears;
|
std::vector<GearInfo> gears;
|
||||||
|
|
|
@ -43,7 +43,8 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
||||||
|
|
||||||
auto buffer = physis_read_file(fileName.toStdString().c_str());
|
auto buffer = physis_read_file(fileName.toStdString().c_str());
|
||||||
|
|
||||||
auto charDat = physis_chardat_parse(buffer);
|
// TODO: Add back
|
||||||
|
/*auto charDat = physis_chardat_parse(buffer);
|
||||||
|
|
||||||
gearView->setRace(charDat.race);
|
gearView->setRace(charDat.race);
|
||||||
gearView->setGender(charDat.gender);
|
gearView->setGender(charDat.gender);
|
||||||
|
@ -51,7 +52,7 @@ FullModelViewer::FullModelViewer(GameData *data, FileCache &cache, QWidget *pare
|
||||||
gearView->setFace(charDat.head);
|
gearView->setFace(charDat.head);
|
||||||
gearView->setHair(charDat.hair);
|
gearView->setHair(charDat.hair);
|
||||||
updateBustScaling((float)charDat.bust / 100.0f);
|
updateBustScaling((float)charDat.bust / 100.0f);
|
||||||
updateHeightScaling((float)charDat.height / 100.0f);
|
updateHeightScaling((float)charDat.height / 100.0f);*/
|
||||||
});
|
});
|
||||||
|
|
||||||
cmp = physis_cmp_parse(physis_gamedata_extract_file(data, "chara/xls/charamake/human.cmp"));
|
cmp = physis_cmp_parse(physis_gamedata_extract_file(data, "chara/xls/charamake/human.cmp"));
|
||||||
|
|
|
@ -29,7 +29,7 @@ GearListModel::GearListModel(GameData *data, QObject *parent)
|
||||||
gears.push_back(info);
|
gears.push_back(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto exh = physis_parse_excel_sheet_header(physis_gamedata_extract_file(data, "exd/item.exh"));
|
exh = physis_parse_excel_sheet_header(physis_gamedata_extract_file(data, "exd/item.exh"));
|
||||||
|
|
||||||
exdFuture = new QFutureWatcher<physis_EXD>(this);
|
exdFuture = new QFutureWatcher<physis_EXD>(this);
|
||||||
connect(exdFuture, &QFutureWatcher<physis_EXD>::resultReadyAt, this, &GearListModel::exdFinished);
|
connect(exdFuture, &QFutureWatcher<physis_EXD>::resultReadyAt, this, &GearListModel::exdFinished);
|
||||||
|
@ -40,7 +40,7 @@ GearListModel::GearListModel(GameData *data, QObject *parent)
|
||||||
pages.push_back(i);
|
pages.push_back(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::function<physis_EXD(int)> loadEXD = [data, exh](const int page) -> physis_EXD {
|
std::function<physis_EXD(int)> loadEXD = [this, data](const int page) -> physis_EXD {
|
||||||
return physis_gamedata_read_excel_sheet(data, "Item", exh, Language::English, page);
|
return physis_gamedata_read_excel_sheet(data, "Item", exh, Language::English, page);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,18 +174,19 @@ void GearListModel::exdFinished(int index)
|
||||||
{
|
{
|
||||||
auto exd = exdFuture->resultAt(index);
|
auto exd = exdFuture->resultAt(index);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < exd.row_count; i++) {
|
for (unsigned int i = 0; i < exh->row_count; i++) {
|
||||||
const auto row = exd.row_data[i];
|
const auto row = physis_exd_read_row(&exd, exh, i); // TODO: use all rows, free
|
||||||
auto primaryModel = row.column_data[47].u_int64._0;
|
|
||||||
|
auto primaryModel = row.row_data[0].column_data[47].u_int64._0;
|
||||||
// auto secondaryModel = row.column_data[48].u_int64._0;
|
// auto secondaryModel = row.column_data[48].u_int64._0;
|
||||||
|
|
||||||
int16_t parts[4];
|
int16_t parts[4];
|
||||||
memcpy(parts, &primaryModel, sizeof(int16_t) * 4);
|
memcpy(parts, &primaryModel, sizeof(int16_t) * 4);
|
||||||
|
|
||||||
GearInfo info = {};
|
GearInfo info = {};
|
||||||
info.name = row.column_data[9].string._0;
|
info.name = row.row_data[0].column_data[9].string._0;
|
||||||
info.icon = row.column_data[10].u_int16._0;
|
info.icon = row.row_data[0].column_data[10].u_int16._0;
|
||||||
info.slot = physis_slot_from_id(row.column_data[17].u_int8._0);
|
info.slot = physis_slot_from_id(row.row_data[0].column_data[17].u_int8._0);
|
||||||
info.modelInfo.primaryID = parts[0];
|
info.modelInfo.primaryID = parts[0];
|
||||||
|
|
||||||
gears.push_back(info);
|
gears.push_back(info);
|
||||||
|
|
|
@ -43,21 +43,28 @@ MapListWidget::MapListWidget(GameData *data, QWidget *parent)
|
||||||
auto nameExd = physis_gamedata_read_excel_sheet(data, "PlaceName", nameExh, Language::English, 0);
|
auto nameExd = physis_gamedata_read_excel_sheet(data, "PlaceName", nameExh, Language::English, 0);
|
||||||
auto territoryExd = physis_gamedata_read_excel_sheet(data, "TerritoryType", territoryExh, Language::None, 0);
|
auto territoryExd = physis_gamedata_read_excel_sheet(data, "TerritoryType", territoryExh, Language::None, 0);
|
||||||
|
|
||||||
for (uint32_t i = 0; i < exd.row_count; i++) {
|
for (uint32_t i = 0; i < exh->row_count; i++) {
|
||||||
const char *id = exd.row_data[i].column_data[6].string._0;
|
auto rows = physis_exd_read_row(&exd, exh, i); // TODO: free, use all rows
|
||||||
|
|
||||||
const uint16_t territoryTypeKey = exd.row_data[i].column_data[15].u_int16._0;
|
const char *id = rows.row_data[0].column_data[6].string._0;
|
||||||
if (territoryTypeKey > 0 && territoryTypeKey < territoryExd.row_count) {
|
|
||||||
const char *bg = territoryExd.row_data[territoryTypeKey].column_data[1].string._0;
|
|
||||||
|
|
||||||
int placeRegionKey = territoryExd.row_data[territoryTypeKey].column_data[3].u_int16._0;
|
const uint16_t territoryTypeKey = rows.row_data[0].column_data[15].u_int16._0;
|
||||||
const char *placeRegion = nameExd.row_data[placeRegionKey].column_data[0].string._0;
|
if (territoryTypeKey > 0 && territoryTypeKey < territoryExh->row_count) {
|
||||||
|
auto territoryExdRow = physis_exd_read_row(&territoryExd, territoryExh, territoryTypeKey); // TODO: free, use all rows
|
||||||
|
|
||||||
int placeZoneKey = territoryExd.row_data[territoryTypeKey].column_data[4].u_int16._0;
|
const char *bg = territoryExdRow.row_data[0].column_data[1].string._0;
|
||||||
const char *placeZone = nameExd.row_data[placeZoneKey].column_data[0].string._0;
|
|
||||||
|
|
||||||
int placeNameKey = territoryExd.row_data[territoryTypeKey].column_data[5].u_int16._0;
|
int placeRegionKey = territoryExdRow.row_data[0].column_data[3].u_int16._0;
|
||||||
const char *placeName = nameExd.row_data[placeNameKey].column_data[0].string._0;
|
auto regionExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
||||||
|
const char *placeRegion = regionExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
|
int placeZoneKey = territoryExdRow.row_data[0].column_data[4].u_int16._0;
|
||||||
|
auto zoneExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
||||||
|
const char *placeZone = zoneExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
|
int placeNameKey = territoryExdRow.row_data[0].column_data[5].u_int16._0;
|
||||||
|
auto nameExdRow = physis_exd_read_row(&nameExd, nameExh, placeRegionKey); // TODO: free, use all rows
|
||||||
|
const char *placeName = nameExdRow.row_data[0].column_data[0].string._0;
|
||||||
|
|
||||||
QStandardItem *item = new QStandardItem();
|
QStandardItem *item = new QStandardItem();
|
||||||
item->setData(QString::fromStdString(bg));
|
item->setData(QString::fromStdString(bg));
|
||||||
|
|
|
@ -109,8 +109,9 @@ void MainWindow::refreshParts(const QString &path)
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
std::string filenameStd = info.fileName().toStdString();
|
std::string filenameStd = info.fileName().toStdString();
|
||||||
|
|
||||||
auto crcHash = physis_calculate_hash(filenameStd.c_str());
|
// FIXME: add back once hashes are f igured out
|
||||||
m_hashLabel->setText(i18n("Hash: 0x%1", QString::number(crcHash, 16).toUpper().rightJustified(8, QLatin1Char('0'))));
|
// auto crcHash = physis_calculate_hash(filenameStd.c_str());
|
||||||
|
// m_hashLabel->setText(i18n("Hash: 0x%1", QString::number(crcHash, 16).toUpper().rightJustified(8, QLatin1Char('0'))));
|
||||||
|
|
||||||
// FIXME: this is terrible, we should not be recalculating this. it isn't a huge deal with the file + index caching, but still
|
// FIXME: this is terrible, we should not be recalculating this. it isn't a huge deal with the file + index caching, but still
|
||||||
auto datOffset = physis_gamedata_find_offset(data, pathStd.c_str());
|
auto datOffset = physis_gamedata_find_offset(data, pathStd.c_str());
|
||||||
|
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -6,7 +6,7 @@ add_compile_options(-w)
|
||||||
|
|
||||||
find_package(Corrosion REQUIRED)
|
find_package(Corrosion REQUIRED)
|
||||||
|
|
||||||
corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/Cargo.toml)
|
corrosion_import_crate(MANIFEST_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/Cargo.toml FEATURES logging)
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libphysis/logger)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libphysis/logger)
|
||||||
|
|
||||||
target_include_directories(physis INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/target/public)
|
target_include_directories(physis INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/libphysis/target/public)
|
||||||
|
|
2
extern/libphysis
vendored
2
extern/libphysis
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit e4251ed59f7d7d4c0ad5f028044d27486f45844f
|
Subproject commit 464fe20833554e80cfb052b40393245faac6e5cb
|
|
@ -88,44 +88,44 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
||||||
|
|
||||||
auto exd = physis_gamedata_read_excel_sheet(data, name.toStdString().c_str(), exh, getSuitableLanguage(exh), i);
|
auto exd = physis_gamedata_read_excel_sheet(data, name.toStdString().c_str(), exh, getSuitableLanguage(exh), i);
|
||||||
|
|
||||||
tableWidget->setRowCount(exd.row_count);
|
tableWidget->setRowCount(exh->row_count);
|
||||||
|
|
||||||
for (unsigned int z = 0; z < exd.column_count; z++) {
|
for (unsigned int z = 0; z < exd.column_count; z++) {
|
||||||
auto columnData = exd.row_data[0].column_data[z];
|
auto columnData = exh->column_types[z];
|
||||||
|
|
||||||
QString columnType;
|
QString columnType;
|
||||||
switch (columnData.tag) {
|
switch (columnData) {
|
||||||
case physis_ColumnData::Tag::String:
|
case ColumnDataType::String:
|
||||||
columnType = i18n("String");
|
columnType = i18n("String");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Bool:
|
case ColumnDataType::Bool:
|
||||||
columnType = i18n("Bool");
|
columnType = i18n("Bool");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Int8:
|
case ColumnDataType::Int8:
|
||||||
columnType = i18n("Int8");
|
columnType = i18n("Int8");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::UInt8:
|
case ColumnDataType::UInt8:
|
||||||
columnType = i18n("UInt8");
|
columnType = i18n("UInt8");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Int16:
|
case ColumnDataType::Int16:
|
||||||
columnType = i18n("Int16");
|
columnType = i18n("Int16");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::UInt16:
|
case ColumnDataType::UInt16:
|
||||||
columnType = i18n("UInt16");
|
columnType = i18n("UInt16");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Int32:
|
case ColumnDataType::Int32:
|
||||||
columnType = i18n("Int32");
|
columnType = i18n("Int32");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::UInt32:
|
case ColumnDataType::UInt32:
|
||||||
columnType = i18n("UInt32");
|
columnType = i18n("UInt32");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Float32:
|
case ColumnDataType::Float32:
|
||||||
columnType = i18n("Float32");
|
columnType = i18n("Float32");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::Int64:
|
case ColumnDataType::Int64:
|
||||||
columnType = i18n("Int64");
|
columnType = i18n("Int64");
|
||||||
break;
|
break;
|
||||||
case physis_ColumnData::Tag::UInt64:
|
case ColumnDataType::UInt64:
|
||||||
columnType = i18n("UInt64");
|
columnType = i18n("UInt64");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +141,11 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
||||||
tableWidget->setHorizontalHeaderItem(z, headerItem);
|
tableWidget->setHorizontalHeaderItem(z, headerItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned int j = 0; j < exd.row_count; j++) {
|
for (unsigned int j = 0; j < exh->row_count; j++) {
|
||||||
|
auto rows = physis_exd_read_row(&exd, exh, j); // TODO: free, use other rows
|
||||||
|
|
||||||
for (unsigned int z = 0; z < exd.column_count; z++) {
|
for (unsigned int z = 0; z < exd.column_count; z++) {
|
||||||
auto columnData = exd.row_data[j].column_data[z];
|
auto columnData = rows.row_data[0].column_data[z];
|
||||||
|
|
||||||
auto [columnString, columnRow] = getColumnData(columnData);
|
auto [columnString, columnRow] = getColumnData(columnData);
|
||||||
|
|
||||||
|
@ -155,9 +157,9 @@ void EXDPart::loadSheet(const QString &name, physis_Buffer buffer, const QString
|
||||||
|
|
||||||
if (cachedExcelSheets.contains(linkName)) {
|
if (cachedExcelSheets.contains(linkName)) {
|
||||||
auto cachedExcel = cachedExcelSheets[linkName];
|
auto cachedExcel = cachedExcelSheets[linkName];
|
||||||
if (static_cast<unsigned int>(columnRow) < cachedExcel.exd.row_count) {
|
if (static_cast<unsigned int>(columnRow) < cachedExcel.exh->row_count) {
|
||||||
auto [colString, _] = getColumnData(*cachedExcel.exd.row_data[columnRow].column_data);
|
// auto [colString, _] = getColumnData(*cachedExcel.exh->row_data[columnRow].column_data);
|
||||||
columnString = colString;
|
// columnString = colString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue