mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-30 16:17:46 +00:00
correctly load all lgb entries even if there's no struct for them
This commit is contained in:
parent
d22557cc1c
commit
caf8297633
2 changed files with 84 additions and 9 deletions
7
deps/datReader/DatCategories/bg/lgb.h
vendored
7
deps/datReader/DatCategories/bg/lgb.h
vendored
|
@ -252,7 +252,7 @@ public:
|
||||||
|
|
||||||
struct LGB_GROUP_HEADER
|
struct LGB_GROUP_HEADER
|
||||||
{
|
{
|
||||||
uint32_t unknown;
|
uint32_t id;
|
||||||
int32_t groupNameOffset;
|
int32_t groupNameOffset;
|
||||||
int32_t entriesOffset;
|
int32_t entriesOffset;
|
||||||
int32_t entryCount;
|
int32_t entryCount;
|
||||||
|
@ -310,12 +310,11 @@ struct LGB_GROUP
|
||||||
{
|
{
|
||||||
entries.push_back( std::make_shared< LGB_MAPRANGE_ENTRY >( buf, entryOffset ) );
|
entries.push_back( std::make_shared< LGB_MAPRANGE_ENTRY >( buf, entryOffset ) );
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
entries[i] = nullptr;
|
entries.push_back( std::make_shared< LGB_ENTRY >( buf, entryOffset ) );
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
|
|
|
@ -56,6 +56,49 @@ void exportFile( const std::string& path )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string getTypeString( uint32_t type )
|
||||||
|
{
|
||||||
|
switch( type )
|
||||||
|
{
|
||||||
|
case 1: return "BgParts";
|
||||||
|
case 3: return "Light";
|
||||||
|
case 4: return "Vfx";
|
||||||
|
case 5: return "PositionMarker";
|
||||||
|
case 6: return "Gimmick/SharedGroup6";
|
||||||
|
case 7: return "Sound";
|
||||||
|
case 8: return "EventNpc";
|
||||||
|
case 9: return "BattleNpc";
|
||||||
|
case 12: return "Aetheryte";
|
||||||
|
case 13: return "EnvSpace";
|
||||||
|
case 14: return "Gathering";
|
||||||
|
case 15: return "SharedGroup15";
|
||||||
|
case 16: return "Treasure";
|
||||||
|
case 39: return "Weapon";
|
||||||
|
case 40: return "PopRange";
|
||||||
|
case 41: return "ExitRange";
|
||||||
|
case 43: return "MapRange";
|
||||||
|
case 44: return "NaviMeshRange";
|
||||||
|
case 45: return "EventObject";
|
||||||
|
case 47: return "EnvLocation";
|
||||||
|
case 49: return "EventRange";
|
||||||
|
case 51: return "QuestMarker";
|
||||||
|
case 57: return "CollisionBox";
|
||||||
|
case 58: return "DoorRange";
|
||||||
|
case 59: return "LineVfx";
|
||||||
|
case 65: return "ClientPath";
|
||||||
|
case 66: return "ServerPath";
|
||||||
|
case 67: return "GimmickRange";
|
||||||
|
case 68: return "TargetMarker";
|
||||||
|
case 69: return "ChairMarker";
|
||||||
|
case 70: return "ClickableRange";
|
||||||
|
case 71: return "PrefetchRange";
|
||||||
|
case 72: return "FateRange";
|
||||||
|
case 75: return "SphereCastRange";
|
||||||
|
|
||||||
|
default: return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct DupeResult
|
struct DupeResult
|
||||||
{
|
{
|
||||||
std::string groupName;
|
std::string groupName;
|
||||||
|
@ -93,6 +136,7 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
std::vector< uint32_t > lgbGroupIds;
|
std::vector< uint32_t > lgbGroupIds;
|
||||||
std::vector< DupeResult > lgbGroupDupes;
|
std::vector< DupeResult > lgbGroupDupes;
|
||||||
|
std::vector< uint32_t > foundTypes;
|
||||||
|
|
||||||
paths.emplace_back( "level/bg.lgb" );
|
paths.emplace_back( "level/bg.lgb" );
|
||||||
paths.emplace_back( "level/planmap.lgb" );
|
paths.emplace_back( "level/planmap.lgb" );
|
||||||
|
@ -137,15 +181,36 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
for( const auto& group : lgb.groups )
|
for( const auto& group : lgb.groups )
|
||||||
{
|
{
|
||||||
Logger::info( " - {:<7} {:<25} children: {}", group.header.unknown, group.name, group.header.entryCount );
|
std::vector< uint32_t > types;
|
||||||
|
|
||||||
if( std::find( lgbGroupIds.begin(), lgbGroupIds.end(), group.header.unknown ) == lgbGroupIds.end() )
|
for( const auto& entry : group.entries )
|
||||||
{
|
{
|
||||||
lgbGroupIds.emplace_back( group.header.unknown );
|
types.emplace_back( static_cast< uint32_t >( entry->getType() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string typeStr;
|
||||||
|
|
||||||
|
std::sort( types.begin(), types.end() );
|
||||||
|
auto end = std::unique( types.begin(), types.end() );
|
||||||
|
types.erase( end, types.end() );
|
||||||
|
|
||||||
|
foundTypes.insert( foundTypes.end(), types.begin(), types.end() );
|
||||||
|
|
||||||
|
for( auto type : types )
|
||||||
|
{
|
||||||
|
typeStr.append( " " + std::to_string( type ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::info( " - {:<7} {:<25} groups: {:<3} types:{}",
|
||||||
|
group.header.id, group.name, group.header.entryCount, typeStr );
|
||||||
|
|
||||||
|
if( std::find( lgbGroupIds.begin(), lgbGroupIds.end(), group.header.id ) == lgbGroupIds.end() )
|
||||||
|
{
|
||||||
|
lgbGroupIds.emplace_back( group.header.id );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lgbGroupDupes.push_back( { group.name, filePath, group.header.unknown } );
|
lgbGroupDupes.push_back( { group.name, filePath, group.header.id } );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logger::info( "" );
|
Logger::info( "" );
|
||||||
|
@ -163,9 +228,20 @@ int main( int argc, char* argv[] )
|
||||||
|
|
||||||
for( const auto& result : lgbGroupDupes )
|
for( const auto& result : lgbGroupDupes )
|
||||||
{
|
{
|
||||||
Logger::info( " - file: {:<50} group: {:<30} id: {}", result.lgb, result.groupName, result.id );
|
Logger::info( " - id: {:<7} group: {:<30} file: {} ", result.id, result.groupName, result.lgb );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger::info( "Found LGB entry types:" );
|
||||||
|
|
||||||
|
std::sort( foundTypes.begin(), foundTypes.end() );
|
||||||
|
auto end = std::unique( foundTypes.begin(), foundTypes.end() );
|
||||||
|
foundTypes.erase( end, foundTypes.end() );
|
||||||
|
|
||||||
|
for( auto type : foundTypes )
|
||||||
|
{
|
||||||
|
Logger::info( " - {:<3} {}", type, getTypeString( type ) );
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue