parent
82c1f36b14
commit
ac8ed08e43
@ -1,28 +1,36 @@
|
||||
#include <coff/archive.hpp>
|
||||
#include <coff/image.hpp>
|
||||
#include <llodctor/llodctor_base.hpp>
|
||||
|
||||
namespace llo::s1
|
||||
{
|
||||
class dctor_lib_t : public dctor_base_t
|
||||
{
|
||||
struct obj_t
|
||||
{
|
||||
std::string_view name;
|
||||
std::vector< std::uint8_t > raw;
|
||||
|
||||
coff::image_t *operator->()
|
||||
{
|
||||
return reinterpret_cast< coff::image_t * >( raw.data() );
|
||||
}
|
||||
};
|
||||
|
||||
std::vector< obj_t > objs;
|
||||
|
||||
public:
|
||||
explicit dctor_lib_t( const std::vector< std::uint8_t > &image,
|
||||
llo::s1::symbol_loader_base_t *symbol_loader = nullptr )
|
||||
: dctor_base_t( image, symbol_loader )
|
||||
{
|
||||
const auto lib_header = reinterpret_cast< const ar::header_t * >( image.data() );
|
||||
auto lib_entry = &lib_header->first_entry;
|
||||
ar::entry_t *string_table = nullptr;
|
||||
ar::view lib( image.data(), image.size() );
|
||||
|
||||
do
|
||||
for ( auto itr = lib.begin(); itr != lib.end(); ++itr )
|
||||
{
|
||||
// TODO...
|
||||
// BROKE!
|
||||
if ( lib_entry->is_string_table() )
|
||||
string_table = ( ar::entry_t * )lib_entry;
|
||||
|
||||
std::printf( "> object name = %s\n", lib_entry->to_string( string_table ) );
|
||||
} while ( ( lib_entry = lib_header->first_entry.next() ) );
|
||||
std::vector obj_data( itr->begin(), itr->end() );
|
||||
objs.push_back( { itr->to_string( lib.string_table ), obj_data } );
|
||||
}
|
||||
}
|
||||
void generate( lloiff_t &iff ) override;
|
||||
};
|
||||
|
Loading…
Reference in new issue