News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

makeobj cannot show a list of factory names

Started by poppo, June 28, 2025, 01:35:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

poppo

Hello,

When I try to show a list of factory names from pakfile:
$ makeobj list factory.*.pakI cannot extract names like that:
type              name                            nodes  size
----------------  ------------------------------  -----  ----------
factory                                              4      12140

I read sourcecode and find that node.size is set as uint32, but recorded it as uint16 in pakfile.
Then, makeobj cannot find the factory's name from building node in factory_writer_t::get_node_name().
std::string factory_writer_t::get_node_name(FILE* fp) const
{
    obj_node_info_t node; // Name is inside building (BUIL) node, which is a child of factory (FACT) node
    fread(&node, sizeof(node), 1, fp);  // the sizeof(node) in here is 10 but only 8 in pakfile.
    if (node.type != obj_building) return ""; // If BUIL node not found, return blank to at least not crash
    fseek(fp, node.size, SEEK_CUR);
    return building_writer_t::instance()->get_node_name(fp);
}

But why is node.size defined as uint32 in obj_node_info.h?

ceeac

Should be fixed in r11737, thanks for the report.

Quote from: poppo on June 28, 2025, 01:35:06 PMBut why is node.size defined as uint32 in obj_node_info.h?

Some pak nodes (e.g. images) may be larger than 64 kiB.