diff --git a/apps/mapeditor/src/mainwindow.cpp b/apps/mapeditor/src/mainwindow.cpp index 03177b1..560ab26 100644 --- a/apps/mapeditor/src/mainwindow.cpp +++ b/apps/mapeditor/src/mainwindow.cpp @@ -84,9 +84,11 @@ void MainWindow::openMap(const QString &basePath) std::string bgLgbPathStd = lgbPath.toStdString(); auto bg_buffer = physis_gamedata_extract_file(data, bgLgbPathStd.c_str()); - auto lgb = physis_layergroup_read(bg_buffer); - if (lgb.num_chunks > 0) { - m_appState->lgbFiles.push_back({name, lgb}); + if (bg_buffer.size > 0) { + auto lgb = physis_layergroup_read(bg_buffer); + if (lgb.num_chunks > 0) { + m_appState->lgbFiles.push_back({name, lgb}); + } } }; diff --git a/apps/mapeditor/src/maplistwidget.cpp b/apps/mapeditor/src/maplistwidget.cpp index 64a5981..fed0849 100644 --- a/apps/mapeditor/src/maplistwidget.cpp +++ b/apps/mapeditor/src/maplistwidget.cpp @@ -59,11 +59,11 @@ MapListWidget::MapListWidget(GameData *data, QWidget *parent) 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, placeRegionKey); // TODO: free, use all rows + auto zoneExdRow = physis_exd_read_row(&nameExd, placeZoneKey); // 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, placeRegionKey); // TODO: free, use all rows + auto nameExdRow = physis_exd_read_row(&nameExd, placeNameKey); // TODO: free, use all rows const char *placeName = nameExdRow.row_data[0].column_data[0].string._0; QStandardItem *item = new QStandardItem(); diff --git a/apps/mapeditor/src/mapview.cpp b/apps/mapeditor/src/mapview.cpp index 45d0cda..8e6d87e 100644 --- a/apps/mapeditor/src/mapview.cpp +++ b/apps/mapeditor/src/mapview.cpp @@ -84,11 +84,6 @@ void MapView::reloadMap() // add bg models for (const auto &[name, lgb] : m_appState->lgbFiles) { - // only load the bg models for now - if (name != QStringLiteral("bg")) { - continue; - } - for (int i = 0; i < lgb.num_chunks; i++) { const auto chunk = lgb.chunks[i]; for (int j = 0; j < chunk.num_layers; j++) { @@ -130,6 +125,8 @@ void MapView::reloadMap() // We don't need this, and it will just take up memory physis_mdl_free(&plateMdl); + } else { + qWarning() << "Failed to load" << assetPath; } physis_free_file(&plateMdlFile);