(PS3 RGL) Remove bloat

This commit is contained in:
twinaphex 2013-11-02 00:28:59 +01:00
parent a6df31479a
commit c06871405d
8 changed files with 1 additions and 887 deletions

View File

@ -20,7 +20,7 @@ INCDIRS = -I. -Ips3/rgl/include
RGL_DIR = ps3/rgl/src
PPU_SRCS = $(RGL_DIR)/libelf/readelf.cpp \
PPU_SRCS = $(RGL_DIR)/libelf/readelf.c \
$(RGL_DIR)/ps3/rgl_ps3_raster.cpp \
$(RGL_DIR)/ps3/rgl_ps3.cpp

View File

@ -32,9 +32,7 @@ enum CGBIO_ERROR {
} // cgc namespace
#include "cgbi.hpp"
#include "cgbo.hpp"
#include "nvbi.hpp"
#include "nvbo.hpp"
namespace cgc {
namespace bio {
@ -46,10 +44,8 @@ namespace bio {
static void delete_instance();
CGBIO_ERROR new_elf_reader( elf_reader** obj ) const;
CGBIO_ERROR new_elf_writer( elf_writer** obj ) const;
CGBIO_ERROR new_nvb_reader( nvb_reader** obj ) const;
CGBIO_ERROR new_nvb_writer( nvb_writer** obj ) const;
const char *error_string( CGBIO_ERROR error ) const;

View File

@ -1,334 +0,0 @@
#if !defined(CGC_CGBIO_CGBO_HPP)
#define CGC_CGBIO_CGBO_HPP 1
#include <cstddef>
#include <fstream>
#include <string>
#include "cgbdefs.hpp"
#include "cgbtypes.h"
using std::ofstream;
using std::streampos;
namespace cgc {
namespace bio {
class osection;
class elf_writer {
public:
enum PRODUCER
{
CGBO_HASH,
CGBO_STR,
CGBO_SYM,
CGBO_REL,
CGBO_PARAM,
CGBO_CONST,
CGBO_VP,
CGBO_FP
};
virtual ~elf_writer() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
save( ofstream& ofs ) = 0;
virtual CGBIO_ERROR
save( const char* filename ) = 0;
virtual CGBIO_ERROR
set_attr( unsigned char file_class,
unsigned char endianness,
unsigned char ELFversion,
unsigned char abi,
unsigned char ABIversion,
Elf32_Half type,
Elf32_Half machine,
Elf32_Word version,
Elf32_Word flags ) = 0;
virtual Elf32_Addr
get_entry() const = 0;
virtual CGBIO_ERROR
set_entry( Elf32_Addr entry ) = 0;
virtual unsigned char
endianness() const = 0;
virtual Elf32_Half
num_of_sections() const = 0;
virtual osection*
get_section( Elf32_Half index ) const = 0;
virtual osection*
get_section( const char* name ) const = 0;
virtual osection*
add_section( const char *name,
Elf32_Word type,
Elf32_Word flags,
Elf32_Word info,
Elf32_Word align,
Elf32_Word esize ) = 0;
virtual streampos
section_offset( Elf32_Half index ) const = 0;
virtual CGBIO_ERROR
new_section_out( PRODUCER producer,
osection* sec,
void** obj ) const = 0;
}; // elf_writer interface class
class osection
{
public:
virtual ~osection() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
save( ofstream& of,
streampos header,
streampos data) = 0;
virtual Elf32_Half
index() const = 0;
virtual const char*
name() const = 0;
virtual Elf32_Word
type() const = 0;
virtual Elf32_Word
flags() const = 0;
virtual Elf32_Word
info() const = 0;
virtual Elf32_Word
addralign() const = 0;
virtual Elf32_Word
entsize() const = 0;
virtual Elf32_Word
size() const = 0;
virtual Elf32_Word
get_name_index() const = 0;
virtual void
set_name_index( Elf32_Word index ) = 0;
virtual Elf32_Addr
get_address() const = 0;
virtual void
set_address( Elf32_Addr addr ) = 0;
virtual Elf32_Word
get_link() const = 0;
virtual void
set_link( Elf32_Word link ) = 0;
virtual char*
get_data() const = 0;
virtual CGBIO_ERROR
set_data( const char* data, Elf32_Word size ) = 0;
virtual CGBIO_ERROR
add_data( const char* data, Elf32_Word size ) = 0;
}; // osection interface class
class ostring_table
{
public:
virtual ~ostring_table() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual const char*
get( Elf32_Word index ) const = 0;
//search the string table for a given string
virtual Elf32_Word
find( const char *) const = 0;
//add the string to the table if it's not already there, return the index of the string
virtual Elf32_Word
addUnique( const char* str ) = 0;
virtual Elf32_Word
add( const char* str ) = 0;
}; // ostring_table
class oconst_table
{
public:
virtual ~oconst_table() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual const Elf32_Word*
get( Elf32_Word index ) const = 0;
virtual Elf32_Word
add( const Elf32_Word *data, Elf32_Word size ) = 0;
};
class osymbol_table
{
public:
virtual ~osymbol_table() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual Elf32_Word
add_entry( Elf32_Word name,
Elf32_Addr value,
Elf32_Word size,
unsigned char info,
unsigned char other,
Elf32_Half shndx ) = 0;
virtual Elf32_Word
add_entry( Elf32_Word name,
Elf32_Addr value,
Elf32_Word size,
unsigned char bind,
unsigned char type,
unsigned char other,
Elf32_Half shndx ) = 0;
virtual Elf32_Word
add_entry( ostring_table* strtab,
const char* str,
Elf32_Addr value,
Elf32_Word size,
unsigned char info,
unsigned char other,
Elf32_Half shndx ) = 0;
virtual Elf32_Word
add_entry( ostring_table* strtab,
const char* str,
Elf32_Addr value,
Elf32_Word size,
unsigned char bind,
unsigned char type,
unsigned char other,
Elf32_Half shndx ) = 0;
}; // osymbol_table
class orelocation_table
{
public:
virtual ~orelocation_table() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word info ) = 0;
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word symbol,
unsigned char type ) = 0;
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word info,
Elf32_Sword addend ) = 0;
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word symbol,
unsigned char type,
Elf32_Sword addend ) = 0;
virtual CGBIO_ERROR
add_entry( ostring_table* strtab,
const char* str,
osymbol_table* symtab,
Elf32_Addr value,
Elf32_Word size,
unsigned char symInfo,
unsigned char other,
Elf32_Half shndx,
Elf32_Addr offset,
unsigned char type ) = 0;
virtual CGBIO_ERROR
add_entry( ostring_table* strtab,
const char* str,
osymbol_table* symtab,
Elf32_Addr value,
Elf32_Word size,
unsigned char symInfo,
unsigned char other,
Elf32_Half shndx,
Elf32_Addr offset,
unsigned char type,
Elf32_Sword addend ) = 0;
}; // orelocation_table
class oparam_table
{
public:
virtual ~oparam_table() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
add_entry( Elf32_cgParameter& cgparam ) = 0;
}; // oparam_table
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_CGBO_HPP

View File

@ -1,378 +0,0 @@
#if !defined(CGC_CGBIO_CGBOIMPL_HPP)
#define CGC_CGBIO_CGBOIMPL_HPP 1
#include <cstddef>
#include <iostream>
#include <string>
#include <vector>
#include "cgbio.hpp"
namespace cgc {
namespace bio {
class osection_impl;
class elf_writer_impl : public elf_writer
{
public:
elf_writer_impl();
virtual
~elf_writer_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
save( ofstream& ofs );
virtual CGBIO_ERROR
save( const char* filename );
virtual CGBIO_ERROR
set_attr( unsigned char file_class,
unsigned char endianness,
unsigned char ELFversion,
unsigned char abi,
unsigned char ABIversion,
Elf32_Half type,
Elf32_Half machine,
Elf32_Word version,
Elf32_Word flags );
virtual Elf32_Addr
get_entry() const;
virtual CGBIO_ERROR
set_entry( Elf32_Addr entry );
virtual unsigned char
endianness() const;
virtual Elf32_Half
num_of_sections() const;
virtual osection*
get_section( Elf32_Half index ) const;
virtual osection*
get_section( const char * name ) const;
virtual osection*
add_section( const char * name,
Elf32_Word type,
Elf32_Word flags,
Elf32_Word info,
Elf32_Word align,
Elf32_Word esize );
virtual streampos
section_offset( Elf32_Half index ) const;
virtual CGBIO_ERROR
new_section_out( PRODUCER, osection*, void** ) const;
private:
ptrdiff_t ref_count_;
Elf32_Ehdr header_;
std::vector<osection_impl*> sections_;
}; // elf_writer_impl
class osection_impl : public osection
{
public:
osection_impl( Elf32_Half index,
elf_writer* cgbo,
const char * name,
Elf32_Word type,
Elf32_Word flags,
Elf32_Word info,
Elf32_Word addrAlign,
Elf32_Word entrySize );
virtual
~osection_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
save( ofstream& of,
streampos header,
streampos data);
virtual Elf32_Half
index() const;
virtual const char *
name() const;
virtual Elf32_Word
type() const;
virtual Elf32_Word
flags() const;
virtual Elf32_Word
info() const;
virtual Elf32_Word
addralign() const;
virtual Elf32_Word
entsize() const;
virtual Elf32_Word
size() const;
virtual Elf32_Word
get_name_index() const;
virtual void
set_name_index( Elf32_Word index );
virtual Elf32_Addr
get_address() const;
virtual void
set_address( Elf32_Addr addr );
virtual Elf32_Word
get_link() const;
virtual void
set_link( Elf32_Word link );
virtual char*
get_data() const;
virtual CGBIO_ERROR
set_data( const char* data, Elf32_Word size );
virtual CGBIO_ERROR
add_data( const char* data, Elf32_Word size );
private:
Elf32_Half index_;
elf_writer* cgbo_;
Elf32_Shdr sh_;
char name_[512];
char* data_;
};
class ostring_table_impl : public ostring_table
{
public:
ostring_table_impl( elf_writer* cgbo, osection* section );
virtual
~ostring_table_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual const char*
get( Elf32_Word index ) const;
//search the string table for a given string
virtual Elf32_Word
find( const char *) const;
//add the string to the table if it's not already there, return the index of the string
virtual Elf32_Word
addUnique( const char* str );
virtual Elf32_Word
add( const char* str );
private:
ptrdiff_t ref_count_;
elf_writer* cgbo_;
osection* section_;
std::vector<char> data_;
};
class oconst_table_impl : public oconst_table
{
public:
oconst_table_impl( elf_writer* cgbo, osection* section );
virtual
~oconst_table_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual const Elf32_Word*
get( Elf32_Word index ) const;
virtual Elf32_Word
add( const Elf32_Word *data, Elf32_Word count );
private:
ptrdiff_t ref_count_;
elf_writer* cgbo_;
osection* section_;
std::vector <Elf32_Word> data_;
};
class osymbol_table_impl : public osymbol_table
{
public:
osymbol_table_impl( elf_writer* cgbo, osection* sec );
virtual
~osymbol_table_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual Elf32_Word
add_entry( Elf32_Word name,
Elf32_Addr value,
Elf32_Word size,
unsigned char info,
unsigned char other,
Elf32_Half shndx );
virtual Elf32_Word
add_entry( Elf32_Word name,
Elf32_Addr value,
Elf32_Word size,
unsigned char bind,
unsigned char type,
unsigned char other,
Elf32_Half shndx );
virtual Elf32_Word
add_entry( ostring_table* strtab,
const char* str,
Elf32_Addr value,
Elf32_Word size,
unsigned char info,
unsigned char other,
Elf32_Half shndx );
virtual Elf32_Word
add_entry( ostring_table* strtab,
const char* str,
Elf32_Addr value,
Elf32_Word size,
unsigned char bind,
unsigned char type,
unsigned char other,
Elf32_Half shndx );
private:
ptrdiff_t ref_count_;
elf_writer* cgbo_;
osection* section_;
};
class orelocation_table_impl : public orelocation_table
{
public:
orelocation_table_impl( elf_writer* cgbo, osection* sec );
virtual
~orelocation_table_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word info );
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word symbol,
unsigned char type );
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word info,
Elf32_Sword addend );
virtual CGBIO_ERROR
add_entry( Elf32_Addr offset,
Elf32_Word symbol,
unsigned char type,
Elf32_Sword addend );
virtual CGBIO_ERROR
add_entry( ostring_table* pStrWriter,
const char* str,
osymbol_table* pSymWriter,
Elf32_Addr value,
Elf32_Word size,
unsigned char symInfo,
unsigned char other,
Elf32_Half shndx,
Elf32_Addr offset,
unsigned char type );
virtual CGBIO_ERROR
add_entry( ostring_table* pStrWriter,
const char* str,
osymbol_table* pSymWriter,
Elf32_Addr value,
Elf32_Word size,
unsigned char symInfo,
unsigned char other,
Elf32_Half shndx,
Elf32_Addr offset,
unsigned char type,
Elf32_Sword addend );
private:
ptrdiff_t ref_count_;
elf_writer* cgbo_;
osection* section_;
}; // CGBORelocationTableImpl
class oparam_table_impl : public oparam_table
{
public:
oparam_table_impl( elf_writer* cgbo, osection* sec );
virtual
~oparam_table_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
add_entry( Elf32_cgParameter& cgparam );
private:
ptrdiff_t ref_count_;
elf_writer* cgbo_;
osection* section_;
};
} } // bio namespace cgc namespace
#endif // CGC_CGBIO_CGBOIMPL_HPP

View File

@ -1,83 +0,0 @@
#if !defined(CGC_CGBIO_NVBO_HPP)
#define CGC_CGBIO_NVBO_HPP 1
#include <cstddef>
#include <fstream>
#include <string>
#include "cgbdefs.hpp"
using std::ofstream;
using std::streampos;
namespace cgc {
namespace bio {
class nvb_writer {
public:
enum PRODUCER
{
CGBO_HASH,
CGBO_STR,
CGBO_SYM,
CGBO_REL,
CGBO_PARAM,
CGBO_VP,
CGBO_FP
};
virtual ~nvb_writer () {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
save( ofstream& ofs ) = 0;
virtual CGBIO_ERROR
save( const char* filename ) = 0;
virtual CGBIO_ERROR
set_attr( unsigned char file_class,
unsigned char endianness,
unsigned char ELFversion,
unsigned char abi,
unsigned char ABIversion,
Elf32_Half type,
Elf32_Half machine,
Elf32_Word version,
Elf32_Word flags ) = 0;
virtual Elf32_Addr
get_entry() const = 0;
virtual CGBIO_ERROR
set_entry( Elf32_Addr entry ) = 0;
virtual unsigned char
endianness() const = 0;
}; // elf_writer interface class
class oparam_array
{
public:
virtual ~oparam_array() {}
virtual ptrdiff_t
reference() = 0;
virtual ptrdiff_t
release() = 0;
virtual CGBIO_ERROR
add_entry() = 0;
}; // oparam_table
} // bio namespace
} // cgc namespace
#endif // CGC_CGBIO_NVBO_HPP

View File

@ -1,85 +0,0 @@
#if !defined(CGC_CGBIO_NVBOIMPL_HPP)
#define CGC_CGBIO_NVBOIMPL_HPP 1
#include <cstddef>
#include <iostream>
#include <string>
#include <vector>
#include "cgbio.hpp"
namespace cgc {
namespace bio {
class nvb_writer_impl : public nvb_writer
{
public:
nvb_writer_impl();
virtual
~nvb_writer_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
save( ofstream& ofs );
virtual CGBIO_ERROR
save( const char* filename );
virtual CGBIO_ERROR
set_attr( unsigned char file_class,
unsigned char endianness,
unsigned char ELFversion,
unsigned char abi,
unsigned char ABIversion,
Elf32_Half type,
Elf32_Half machine,
Elf32_Word version,
Elf32_Word flags );
virtual Elf32_Addr
get_entry() const;
virtual CGBIO_ERROR
set_entry( Elf32_Addr entry );
virtual unsigned char
endianness() const;
private:
ptrdiff_t ref_count_;
Elf32_Ehdr header_;
}; // elf_writer_impl
class oparam_array_impl : public oparam_array
{
public:
oparam_array_impl( nvb_writer* cgbo );
virtual
~oparam_array_impl();
virtual ptrdiff_t
reference();
virtual ptrdiff_t
release();
virtual CGBIO_ERROR
add_entry();
private:
ptrdiff_t ref_count_;
nvb_writer* cgbo_;
};
} } // bio namespace cgc namespace
#endif // CGC_CGBIO_NVBOIMPL_HPP

View File

@ -45,9 +45,7 @@
#include "cg/cgbio.hpp"
#include "cg/cgbiimpl.hpp"
#include "cg/cgboimpl.hpp"
#include "cg/nvbiimpl.hpp"
#include "cg/nvboimpl.hpp"
#include "cg/cgbutils.hpp"
#include "cg/cgbtypes.h"