Fix messed up indentation from the last commit, turning spaces back into tabs.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2408 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-01-02 14:25:04 +00:00
parent a38a27aa9c
commit d48067acb6
2 changed files with 267 additions and 267 deletions

View File

@ -140,94 +140,94 @@ static uint parseCommandLine( const wxString& filename )
// All of ElfObjects functions. // All of ElfObjects functions.
ElfObject::ElfObject(const wxString& srcfile, IsoFile isofile) ElfObject::ElfObject(const wxString& srcfile, IsoFile isofile)
: filename( srcfile ) : filename( srcfile )
, data( wxULongLong(isofile.getLength()).GetLo(), L"ELF headers" ) , data( wxULongLong(isofile.getLength()).GetLo(), L"ELF headers" )
, header( *(ELF_HEADER*)data.GetPtr() ) , header( *(ELF_HEADER*)data.GetPtr() )
, proghead( NULL ) , proghead( NULL )
, secthead( NULL ) , secthead( NULL )
{ {
isCdvd = true; isCdvd = true;
checkElfSize(data.GetSizeInBytes()); checkElfSize(data.GetSizeInBytes());
readIso(isofile); readIso(isofile);
initElfHeaders(); initElfHeaders();
} }
ElfObject::ElfObject( const wxString& srcfile, uint hdrsize ) ElfObject::ElfObject( const wxString& srcfile, uint hdrsize )
: filename( srcfile ) : filename( srcfile )
, data( wxULongLong(hdrsize).GetLo(), L"ELF headers" ) , data( wxULongLong(hdrsize).GetLo(), L"ELF headers" )
, header( *(ELF_HEADER*)data.GetPtr() ) , header( *(ELF_HEADER*)data.GetPtr() )
, proghead( NULL ) , proghead( NULL )
, secthead( NULL ) , secthead( NULL )
{ {
isCdvd = false; isCdvd = false;
checkElfSize(data.GetSizeInBytes()); checkElfSize(data.GetSizeInBytes());
readFile(); readFile();
initElfHeaders(); initElfHeaders();
} }
void ElfObject::initElfHeaders() void ElfObject::initElfHeaders()
{ {
Console.WriteLn( L"Initializing Elf: %d bytes", data.GetSizeInBytes()); Console.WriteLn( L"Initializing Elf: %d bytes", data.GetSizeInBytes());
if ( header.e_phnum > 0 ) if ( header.e_phnum > 0 )
proghead = (ELF_PHR*)&data[header.e_phoff]; proghead = (ELF_PHR*)&data[header.e_phoff];
if ( header.e_shnum > 0 ) if ( header.e_shnum > 0 )
secthead = (ELF_SHR*)&data[header.e_shoff]; secthead = (ELF_SHR*)&data[header.e_shoff];
if ( ( header.e_shnum > 0 ) && ( header.e_shentsize != sizeof(ELF_SHR) ) ) if ( ( header.e_shnum > 0 ) && ( header.e_shentsize != sizeof(ELF_SHR) ) )
Console.Error( "(ELF) Size of section headers is not standard" ); Console.Error( "(ELF) Size of section headers is not standard" );
if ( ( header.e_phnum > 0 ) && ( header.e_phentsize != sizeof(ELF_PHR) ) ) if ( ( header.e_phnum > 0 ) && ( header.e_phentsize != sizeof(ELF_PHR) ) )
Console.Error( "(ELF) Size of program headers is not standard" ); Console.Error( "(ELF) Size of program headers is not standard" );
const char* elftype = NULL; const char* elftype = NULL;
switch( header.e_type ) switch( header.e_type )
{ {
default: default:
ELF_LOG( "type: unknown = %x", header.e_type ); ELF_LOG( "type: unknown = %x", header.e_type );
break;
case 0x0: elftype = "no file type"; break;
case 0x1: elftype = "relocatable"; break;
case 0x2: elftype = "executable"; break;
}
if (elftype != NULL) ELF_LOG( "type: %s", elftype );
const char* machine = NULL;
switch(header.e_machine)
{
case 1: machine = "AT&T WE 32100"; break;
case 2: machine = "SPARC"; break;
case 3: machine = "Intel 80386"; break;
case 4: machine = "Motorola 68000"; break;
case 5: machine = "Motorola 88000"; break;
case 7: machine = "Intel 80860"; break;
case 8: machine = "mips_rs3000"; break;
default:
ELF_LOG( "machine: unknown = %x", header.e_machine );
break; break;
}
if (machine != NULL) ELF_LOG( "machine: %s", machine ); case 0x0: elftype = "no file type"; break;
case 0x1: elftype = "relocatable"; break;
case 0x2: elftype = "executable"; break;
}
ELF_LOG("version: %d",header.e_version); if (elftype != NULL) ELF_LOG( "type: %s", elftype );
ELF_LOG("entry: %08x",header.e_entry);
ELF_LOG("flags: %08x",header.e_flags);
ELF_LOG("eh size: %08x",header.e_ehsize);
ELF_LOG("ph off: %08x",header.e_phoff);
ELF_LOG("ph entsiz: %08x",header.e_phentsize);
ELF_LOG("ph num: %08x",header.e_phnum);
ELF_LOG("sh off: %08x",header.e_shoff);
ELF_LOG("sh entsiz: %08x",header.e_shentsize);
ELF_LOG("sh num: %08x",header.e_shnum);
ELF_LOG("sh strndx: %08x",header.e_shstrndx);
ELF_LOG("\n"); const char* machine = NULL;
switch(header.e_machine)
{
case 1: machine = "AT&T WE 32100"; break;
case 2: machine = "SPARC"; break;
case 3: machine = "Intel 80386"; break;
case 4: machine = "Motorola 68000"; break;
case 5: machine = "Motorola 88000"; break;
case 7: machine = "Intel 80860"; break;
case 8: machine = "mips_rs3000"; break;
default:
ELF_LOG( "machine: unknown = %x", header.e_machine );
break;
}
if (machine != NULL) ELF_LOG( "machine: %s", machine );
ELF_LOG("version: %d",header.e_version);
ELF_LOG("entry: %08x",header.e_entry);
ELF_LOG("flags: %08x",header.e_flags);
ELF_LOG("eh size: %08x",header.e_ehsize);
ELF_LOG("ph off: %08x",header.e_phoff);
ELF_LOG("ph entsiz: %08x",header.e_phentsize);
ELF_LOG("ph num: %08x",header.e_phnum);
ELF_LOG("sh off: %08x",header.e_shoff);
ELF_LOG("sh entsiz: %08x",header.e_shentsize);
ELF_LOG("sh num: %08x",header.e_shnum);
ELF_LOG("sh strndx: %08x",header.e_shstrndx);
ELF_LOG("\n");
} }
bool ElfObject::hasProgramHeaders() { return (proghead != NULL); } bool ElfObject::hasProgramHeaders() { return (proghead != NULL); }
@ -236,179 +236,179 @@ bool ElfObject::hasHeaders() { return (hasProgramHeaders() && hasSectionHeaders(
void ElfObject::readIso(IsoFile file) void ElfObject::readIso(IsoFile file)
{ {
int rsize = file.read(data.GetPtr(), data.GetSizeInBytes()); int rsize = file.read(data.GetPtr(), data.GetSizeInBytes());
if (rsize < data.GetSizeInBytes()) throw Exception::EndOfStream( filename ); if (rsize < data.GetSizeInBytes()) throw Exception::EndOfStream( filename );
} }
void ElfObject::readFile() void ElfObject::readFile()
{ {
int rsize = 0; int rsize = 0;
FILE *f; FILE *f;
f = fopen( filename.ToUTF8(), "rb" ); f = fopen( filename.ToUTF8(), "rb" );
if (f == NULL) Exception::FileNotFound( filename ); if (f == NULL) Exception::FileNotFound( filename );
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
rsize = fread(data.GetPtr(), 1, data.GetSizeInBytes(), f); rsize = fread(data.GetPtr(), 1, data.GetSizeInBytes(), f);
fclose( f ); fclose( f );
if (rsize < data.GetSizeInBytes()) throw Exception::EndOfStream( filename ); if (rsize < data.GetSizeInBytes()) throw Exception::EndOfStream( filename );
} }
void ElfObject::checkElfSize(s64 elfsize) void ElfObject::checkElfSize(s64 elfsize)
{ {
if (elfsize > 0xfffffff) if (elfsize > 0xfffffff)
throw Exception::BadStream( filename, wxLt("Illegal ELF file size, over 2GB!") ); throw Exception::BadStream( filename, wxLt("Illegal ELF file size, over 2GB!") );
if (elfsize == -1) if (elfsize == -1)
throw Exception::BadStream( filename, wxLt("Elf file does not exist! ") ); throw Exception::BadStream( filename, wxLt("Elf file does not exist! ") );
if (elfsize == 0) if (elfsize == 0)
throw Exception::BadStream( filename, wxLt("Unexpected end of ELF file: ") ); throw Exception::BadStream( filename, wxLt("Unexpected end of ELF file: ") );
} }
u32 ElfObject::getCRC() const u32 ElfObject::getCRC() const
{ {
u32 CRC = 0; u32 CRC = 0;
const u32* srcdata = (u32*)data.GetPtr(); const u32* srcdata = (u32*)data.GetPtr();
for(u32 i=data.GetSizeInBytes()/4; i; --i, ++srcdata) for(u32 i=data.GetSizeInBytes()/4; i; --i, ++srcdata)
CRC ^= *srcdata; CRC ^= *srcdata;
return CRC; return CRC;
} }
void ElfObject::loadProgramHeaders() void ElfObject::loadProgramHeaders()
{ {
if (proghead == NULL) return; if (proghead == NULL) return;
for( int i = 0 ; i < header.e_phnum ; i++ ) for( int i = 0 ; i < header.e_phnum ; i++ )
{ {
ELF_LOG( "Elf32 Program Header" ); ELF_LOG( "Elf32 Program Header" );
ELF_LOG( "type: " ); ELF_LOG( "type: " );
switch(proghead[ i ].p_type) switch(proghead[ i ].p_type)
{ {
default: default:
ELF_LOG( "unknown %x", (int)proghead[ i ].p_type ); ELF_LOG( "unknown %x", (int)proghead[ i ].p_type );
break; break;
case 0x1: case 0x1:
{ {
ELF_LOG("load"); ELF_LOG("load");
const uint elfsize = data.GetLength(); const uint elfsize = data.GetLength();
if (proghead[ i ].p_offset < elfsize) if (proghead[ i ].p_offset < elfsize)
{ {
int size; int size;
if ((proghead[ i ].p_filesz + proghead[ i ].p_offset) > elfsize) if ((proghead[ i ].p_filesz + proghead[ i ].p_offset) > elfsize)
size = elfsize - proghead[ i ].p_offset; size = elfsize - proghead[ i ].p_offset;
else else
size = proghead[ i ].p_filesz; size = proghead[ i ].p_filesz;
if (proghead[ i ].p_vaddr != proghead[ i ].p_paddr) if (proghead[ i ].p_vaddr != proghead[ i ].p_paddr)
Console.Warning( "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x", Console.Warning( "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x",
proghead[ i ].p_paddr, proghead[ i ].p_vaddr); proghead[ i ].p_paddr, proghead[ i ].p_vaddr);
// used to be paddr // used to be paddr
memcpy_fast( memcpy_fast(
&PS2MEM_BASE[proghead[ i ].p_vaddr & 0x1ffffff], &PS2MEM_BASE[proghead[ i ].p_vaddr & 0x1ffffff],
data.GetPtr(proghead[ i ].p_offset), size data.GetPtr(proghead[ i ].p_offset), size
); );
ELF_LOG("\t*LOADED*"); ELF_LOG("\t*LOADED*");
} }
} }
break; break;
} }
ELF_LOG("\n"); ELF_LOG("\n");
ELF_LOG("offset: %08x",proghead[i].p_offset); ELF_LOG("offset: %08x",proghead[i].p_offset);
ELF_LOG("vaddr: %08x",proghead[i].p_vaddr); ELF_LOG("vaddr: %08x",proghead[i].p_vaddr);
ELF_LOG("paddr: %08x",proghead[i].p_paddr); ELF_LOG("paddr: %08x",proghead[i].p_paddr);
ELF_LOG("file size: %08x",proghead[i].p_filesz); ELF_LOG("file size: %08x",proghead[i].p_filesz);
ELF_LOG("mem size: %08x",proghead[i].p_memsz); ELF_LOG("mem size: %08x",proghead[i].p_memsz);
ELF_LOG("flags: %08x",proghead[i].p_flags); ELF_LOG("flags: %08x",proghead[i].p_flags);
ELF_LOG("palign: %08x",proghead[i].p_align); ELF_LOG("palign: %08x",proghead[i].p_align);
ELF_LOG("\n"); ELF_LOG("\n");
} }
} }
void ElfObject::loadSectionHeaders() void ElfObject::loadSectionHeaders()
{ {
if (secthead == NULL || header.e_shoff > (u32)data.GetLength()) return; if (secthead == NULL || header.e_shoff > (u32)data.GetLength()) return;
const u8* sections_names = data.GetPtr( secthead[ (header.e_shstrndx == 0xffff ? 0 : header.e_shstrndx) ].sh_offset ); const u8* sections_names = data.GetPtr( secthead[ (header.e_shstrndx == 0xffff ? 0 : header.e_shstrndx) ].sh_offset );
int i_st = -1, i_dt = -1; int i_st = -1, i_dt = -1;
for( int i = 0 ; i < header.e_shnum ; i++ ) for( int i = 0 ; i < header.e_shnum ; i++ )
{ {
ELF_LOG( "ELF32 Section Header [%x] %s", i, &sections_names[ secthead[ i ].sh_name ] ); ELF_LOG( "ELF32 Section Header [%x] %s", i, &sections_names[ secthead[ i ].sh_name ] );
// used by parseCommandLine // used by parseCommandLine
//if ( secthead[i].sh_flags & 0x2 ) //if ( secthead[i].sh_flags & 0x2 )
// args_ptr = min( args_ptr, secthead[ i ].sh_addr & 0x1ffffff ); // args_ptr = min( args_ptr, secthead[ i ].sh_addr & 0x1ffffff );
ELF_LOG("\n"); ELF_LOG("\n");
const char* sectype = NULL; const char* sectype = NULL;
switch(secthead[ i ].sh_type) switch(secthead[ i ].sh_type)
{ {
case 0x0: sectype = "null"; break; case 0x0: sectype = "null"; break;
case 0x1: sectype = "progbits"; break; case 0x1: sectype = "progbits"; break;
case 0x2: sectype = "symtab"; break; case 0x2: sectype = "symtab"; break;
case 0x3: sectype = "strtab"; break; case 0x3: sectype = "strtab"; break;
case 0x4: sectype = "rela"; break; case 0x4: sectype = "rela"; break;
case 0x8: sectype = "no bits"; break; case 0x8: sectype = "no bits"; break;
case 0x9: sectype = "rel"; break; case 0x9: sectype = "rel"; break;
default: default:
ELF_LOG("type: unknown %08x",secthead[i].sh_type); ELF_LOG("type: unknown %08x",secthead[i].sh_type);
break; break;
} }
ELF_LOG("type: %s", sectype); ELF_LOG("type: %s", sectype);
ELF_LOG("flags: %08x", secthead[i].sh_flags); ELF_LOG("flags: %08x", secthead[i].sh_flags);
ELF_LOG("addr: %08x", secthead[i].sh_addr); ELF_LOG("addr: %08x", secthead[i].sh_addr);
ELF_LOG("offset: %08x", secthead[i].sh_offset); ELF_LOG("offset: %08x", secthead[i].sh_offset);
ELF_LOG("size: %08x", secthead[i].sh_size); ELF_LOG("size: %08x", secthead[i].sh_size);
ELF_LOG("link: %08x", secthead[i].sh_link); ELF_LOG("link: %08x", secthead[i].sh_link);
ELF_LOG("info: %08x", secthead[i].sh_info); ELF_LOG("info: %08x", secthead[i].sh_info);
ELF_LOG("addralign: %08x", secthead[i].sh_addralign); ELF_LOG("addralign: %08x", secthead[i].sh_addralign);
ELF_LOG("entsize: %08x", secthead[i].sh_entsize); ELF_LOG("entsize: %08x", secthead[i].sh_entsize);
// dump symbol table // dump symbol table
if (secthead[ i ].sh_type == 0x02) if (secthead[ i ].sh_type == 0x02)
{ {
i_st = i; i_st = i;
i_dt = secthead[i].sh_link; i_dt = secthead[i].sh_link;
} }
} }
if ((i_st >= 0) && (i_dt >= 0)) if ((i_st >= 0) && (i_dt >= 0))
{ {
const char * SymNames; const char * SymNames;
Elf32_Sym * eS; Elf32_Sym * eS;
SymNames = (char*)data.GetPtr(secthead[i_dt].sh_offset); SymNames = (char*)data.GetPtr(secthead[i_dt].sh_offset);
eS = (Elf32_Sym*)data.GetPtr(secthead[i_st].sh_offset); eS = (Elf32_Sym*)data.GetPtr(secthead[i_st].sh_offset);
Console.WriteLn("found %d symbols", secthead[i_st].sh_size / sizeof(Elf32_Sym)); Console.WriteLn("found %d symbols", secthead[i_st].sh_size / sizeof(Elf32_Sym));
for(uint i = 1; i < (secthead[i_st].sh_size / sizeof(Elf32_Sym)); i++) { for(uint i = 1; i < (secthead[i_st].sh_size / sizeof(Elf32_Sym)); i++) {
if ((eS[i].st_value != 0) && (ELF32_ST_TYPE(eS[i].st_info) == 2)) if ((eS[i].st_value != 0) && (ELF32_ST_TYPE(eS[i].st_info) == 2))
{ {
R5900::disR5900AddSym(eS[i].st_value, &SymNames[eS[i].st_name]); R5900::disR5900AddSym(eS[i].st_value, &SymNames[eS[i].st_name]);
} }
} }
} }
} }
void ElfObject::loadHeaders() void ElfObject::loadHeaders()
{ {
loadProgramHeaders(); loadProgramHeaders();
loadSectionHeaders(); loadSectionHeaders();
} }
void ElfApplyPatches() void ElfApplyPatches()
@ -424,13 +424,13 @@ void ElfApplyPatches()
// Fetches the CRC of the game bound to the CDVD plugin. // Fetches the CRC of the game bound to the CDVD plugin.
u32 loadElfCRC( const wxString filename ) u32 loadElfCRC( const wxString filename )
{ {
// Note: calling loadElfFile here causes bad things to happen. // Note: calling loadElfFile here causes bad things to happen.
u32 crcval = 0; u32 crcval = 0;
IsoFSCDVD isofs; IsoFSCDVD isofs;
IsoFile file(isofs, filename); IsoFile file(isofs, filename);
crcval = ElfObject(filename, file).getCRC(); crcval = ElfObject(filename, file).getCRC();
Console.WriteLn(wxsFormat(L"loadElfCRC(" + filename + L") = %8.8X", crcval)); Console.WriteLn(wxsFormat(L"loadElfCRC(" + filename + L") = %8.8X", crcval));
return crcval; return crcval;
@ -450,7 +450,7 @@ u32 loadElfCRC( const wxString filename )
// //
void loadElfFile(const wxString& filename) void loadElfFile(const wxString& filename)
{ {
ElfObject *elfptr; ElfObject *elfptr;
if (filename.IsEmpty()) return; if (filename.IsEmpty()) return;
@ -461,19 +461,19 @@ void loadElfFile(const wxString& filename)
if (filename.StartsWith(L"cdrom:") || filename.StartsWith(L"cdrom0:") || filename.StartsWith(L"cdrom1:")) if (filename.StartsWith(L"cdrom:") || filename.StartsWith(L"cdrom0:") || filename.StartsWith(L"cdrom1:"))
{ {
// It's a game disc. // It's a game disc.
DevCon.WriteLn(L"Loading from a CD rom or CD image."); DevCon.WriteLn(L"Loading from a CD rom or CD image.");
IsoFSCDVD isofs; IsoFSCDVD isofs;
IsoFile file(isofs, filename); IsoFile file(isofs, filename);
elfptr = new ElfObject(filename, file); elfptr = new ElfObject(filename, file);
} }
else else
{ {
// It's an elf file. // It's an elf file.
DevCon.WriteLn("Loading from a file (or non-cd image)"); DevCon.WriteLn("Loading from a file (or non-cd image)");
elfptr = new ElfObject(filename, Path::GetFileSize(filename)); elfptr = new ElfObject(filename, Path::GetFileSize(filename));
} }
if (!elfptr->hasProgramHeaders()) if (!elfptr->hasProgramHeaders())
@ -518,7 +518,7 @@ void loadElfFile(const wxString& filename)
// 2 - PS2 CD // 2 - PS2 CD
int GetPS2ElfName( wxString& name ) int GetPS2ElfName( wxString& name )
{ {
int retype = 0; int retype = 0;
try { try {
IsoFSCDVD isofs; IsoFSCDVD isofs;

View File

@ -28,29 +28,29 @@ extern unsigned int args_ptr;
struct ELF_HEADER { struct ELF_HEADER {
u8 e_ident[16]; //0x7f,"ELF" (ELF file identifier) u8 e_ident[16]; //0x7f,"ELF" (ELF file identifier)
u16 e_type; //ELF type: 0=NONE, 1=REL, 2=EXEC, 3=SHARED, 4=CORE u16 e_type; //ELF type: 0=NONE, 1=REL, 2=EXEC, 3=SHARED, 4=CORE
u16 e_machine; //Processor: 8=MIPS R3000 u16 e_machine; //Processor: 8=MIPS R3000
u32 e_version; //Version: 1=current u32 e_version; //Version: 1=current
u32 e_entry; //Entry point address u32 e_entry; //Entry point address
u32 e_phoff; //Start of program headers (offset from file start) u32 e_phoff; //Start of program headers (offset from file start)
u32 e_shoff; //Start of section headers (offset from file start) u32 e_shoff; //Start of section headers (offset from file start)
u32 e_flags; //Processor specific flags = 0x20924001 noreorder, mips u32 e_flags; //Processor specific flags = 0x20924001 noreorder, mips
u16 e_ehsize; //ELF header size (0x34 = 52 bytes) u16 e_ehsize; //ELF header size (0x34 = 52 bytes)
u16 e_phentsize; //Program headers entry size u16 e_phentsize; //Program headers entry size
u16 e_phnum; //Number of program headers u16 e_phnum; //Number of program headers
u16 e_shentsize; //Section headers entry size u16 e_shentsize; //Section headers entry size
u16 e_shnum; //Number of section headers u16 e_shnum; //Number of section headers
u16 e_shstrndx; //Section header stringtable index u16 e_shstrndx; //Section header stringtable index
}; };
struct ELF_PHR { struct ELF_PHR {
u32 p_type; //see notes1 u32 p_type; //see notes1
u32 p_offset; //Offset from file start to program segment. u32 p_offset; //Offset from file start to program segment.
u32 p_vaddr; //Virtual address of the segment u32 p_vaddr; //Virtual address of the segment
u32 p_paddr; //Physical address of the segment u32 p_paddr; //Physical address of the segment
u32 p_filesz; //Number of bytes in the file image of the segment u32 p_filesz; //Number of bytes in the file image of the segment
u32 p_memsz; //Number of bytes in the memory image of the segment u32 p_memsz; //Number of bytes in the memory image of the segment
u32 p_flags; //Flags for segment u32 p_flags; //Flags for segment
u32 p_align; //Alignment. The address of 0x08 and 0x0C must fit this alignment. 0=no alignment u32 p_align; //Alignment. The address of 0x08 and 0x0C must fit this alignment. 0=no alignment
}; };
/* /*
@ -66,16 +66,16 @@ notes1
*/ */
struct ELF_SHR { struct ELF_SHR {
u32 sh_name; //No. to the index of the Section header stringtable index u32 sh_name; //No. to the index of the Section header stringtable index
u32 sh_type; //See notes2 u32 sh_type; //See notes2
u32 sh_flags; //see notes3 u32 sh_flags; //see notes3
u32 sh_addr; //Section start address u32 sh_addr; //Section start address
u32 sh_offset; //Offset from start of file to section u32 sh_offset; //Offset from start of file to section
u32 sh_size; //Size of section u32 sh_size; //Size of section
u32 sh_link; //Section header table index link u32 sh_link; //Section header table index link
u32 sh_info; //Info u32 sh_info; //Info
u32 sh_addralign; //Alignment. The adress of 0x0C must fit this alignment. 0=no alignment. u32 sh_addralign; //Alignment. The adress of 0x0C must fit this alignment. 0=no alignment.
u32 sh_entsize; //Fixed size entries. u32 sh_entsize; //Fixed size entries.
}; };
/* /*
@ -125,37 +125,37 @@ struct Elf32_Rel {
class ElfObject class ElfObject
{ {
private: private:
SafeArray<u8> data; SafeArray<u8> data;
ELF_PHR* proghead; ELF_PHR* proghead;
ELF_SHR* secthead; ELF_SHR* secthead;
wxString filename; wxString filename;
void initElfHeaders(); void initElfHeaders();
void readIso(IsoFile file); void readIso(IsoFile file);
void readFile(); void readFile();
void checkElfSize(s64 elfsize); void checkElfSize(s64 elfsize);
public: public:
bool isCdvd; bool isCdvd;
ELF_HEADER& header; ELF_HEADER& header;
// Destructor! // Destructor!
// C++ does all the cleanup automagically for us. // C++ does all the cleanup automagically for us.
virtual ~ElfObject() throw() { } virtual ~ElfObject() throw() { }
ElfObject(const wxString& srcfile, IsoFile isofile); ElfObject(const wxString& srcfile, IsoFile isofile);
ElfObject( const wxString& srcfile, uint hdrsize ); ElfObject( const wxString& srcfile, uint hdrsize );
void loadProgramHeaders(); void loadProgramHeaders();
void loadSectionHeaders(); void loadSectionHeaders();
void loadHeaders(); void loadHeaders();
bool hasProgramHeaders(); bool hasProgramHeaders();
bool hasSectionHeaders(); bool hasSectionHeaders();
bool hasHeaders(); bool hasHeaders();
u32 getCRC() const; u32 getCRC() const;
}; };
//------------------- //-------------------