rpcs3/scetool/elf_inlines.h
Alexandro Sánchez Bach f1b420eb3b SELF decrypter improves & About... dialog added
SELF decrypter improved:
The files 'scetool.exe' and 'zlib1.dll' are no longer needed. Everything
needed is now included in the rpsc3 project. So the only thing you need
in order to load SELF files are the keys. More information about this
matter in my last commit: c1565e55

Warning for devs! There is a lot of spaghetti code in /scetool/. I
fucked up things a bit while trying to include scetool in rpcs3. There
is a lot of unused code there and I need to make sure that everything is
working properly. In any case, the code seems to work stable so
end-users shouldn't be worried about this warning. ;-)

'About...' dialog added:
Well, I have nothing more to say here. I wish you all a nice day!
2013-10-21 23:02:43 +02:00

137 lines
3.4 KiB
C

/*
* Copyright (c) 2011-2013 by naehrwert
* This file is released under the GPLv2.
*/
#ifndef _ELF_INLINES_H_
#define _ELF_INLINES_H_
#include <string.h>
#include "types.h"
#include "elf.h"
static inline void _es_elf32_ehdr(Elf32_Ehdr *h)
{
h->e_type = _Es16(h->e_type);
h->e_machine = _Es16(h->e_machine);
h->e_version = _Es32(h->e_version);
h->e_entry = _Es32(h->e_entry);
h->e_phoff = _Es32(h->e_phoff);
h->e_shoff = _Es32(h->e_shoff);
h->e_flags = _Es32(h->e_flags);
h->e_ehsize = _Es16(h->e_ehsize);
h->e_phentsize = _Es16(h->e_phentsize);
h->e_phnum = _Es16(h->e_phnum);
h->e_shentsize = _Es16(h->e_shentsize);
h->e_shnum = _Es16(h->e_shnum);
h->e_shstrndx = _Es16(h->e_shstrndx);
}
static inline void _copy_es_elf32_ehdr(Elf32_Ehdr *dst, Elf32_Ehdr *src)
{
memcpy(dst, src, sizeof(Elf32_Ehdr));
_es_elf32_ehdr(dst);
}
static inline void _es_elf64_ehdr(Elf64_Ehdr *h)
{
h->e_type = _Es16(h->e_type);
h->e_machine = _Es16(h->e_machine);
h->e_version = _Es32(h->e_version);
h->e_entry = _Es64(h->e_entry);
h->e_phoff = _Es64(h->e_phoff);
h->e_shoff = _Es64(h->e_shoff);
h->e_flags = _Es32(h->e_flags);
h->e_ehsize = _Es16(h->e_ehsize);
h->e_phentsize = _Es16(h->e_phentsize);
h->e_phnum = _Es16(h->e_phnum);
h->e_shentsize = _Es16(h->e_shentsize);
h->e_shnum = _Es16(h->e_shnum);
h->e_shstrndx = _Es16(h->e_shstrndx);
}
static inline void _copy_es_elf64_ehdr(Elf64_Ehdr *dst, Elf64_Ehdr *src)
{
memcpy(dst, src, sizeof(Elf64_Ehdr));
_es_elf64_ehdr(dst);
}
static inline void _es_elf32_shdr(Elf32_Shdr *h)
{
h->sh_name = _Es32(h->sh_name);
h->sh_type = _Es32(h->sh_type);
h->sh_flags = _Es32(h->sh_flags);
h->sh_addr = _Es32(h->sh_addr);
h->sh_offset = _Es32(h->sh_offset);
h->sh_size = _Es32(h->sh_size);
h->sh_link = _Es32(h->sh_link);
h->sh_info = _Es32(h->sh_info);
h->sh_addralign = _Es32(h->sh_addralign);
h->sh_entsize = _Es32(h->sh_entsize);
}
static inline void _copy_es_elf32_shdr(Elf32_Shdr *dst, Elf32_Shdr *src)
{
memcpy(dst, src, sizeof(Elf32_Shdr));
_es_elf32_shdr(dst);
}
static inline void _es_elf64_shdr(Elf64_Shdr *h)
{
h->sh_name = _Es32(h->sh_name);
h->sh_type = _Es32(h->sh_type);
h->sh_flags = _Es64(h->sh_flags);
h->sh_addr = _Es64(h->sh_addr);
h->sh_offset = _Es64(h->sh_offset);
h->sh_size = _Es64(h->sh_size);
h->sh_link = _Es32(h->sh_link);
h->sh_info = _Es32(h->sh_info);
h->sh_addralign = _Es64(h->sh_addralign);
h->sh_entsize = _Es64(h->sh_entsize);
}
static inline void _copy_es_elf64_shdr(Elf64_Shdr *dst, Elf64_Shdr *src)
{
memcpy(dst, src, sizeof(Elf64_Shdr));
_es_elf64_shdr(dst);
}
static inline void _es_elf32_phdr(Elf32_Phdr *h)
{
h->p_type = _Es32(h->p_type);
h->p_offset = _Es32(h->p_offset);
h->p_vaddr = _Es32(h->p_vaddr);
h->p_paddr = _Es32(h->p_paddr);
h->p_filesz = _Es32(h->p_filesz);
h->p_memsz = _Es32(h->p_memsz);
h->p_flags = _Es32(h->p_flags);
h->p_align = _Es32(h->p_align);
}
static inline void _copy_es_elf32_phdr(Elf32_Phdr *dst, Elf32_Phdr *src)
{
memcpy(dst, src, sizeof(Elf32_Phdr));
_es_elf32_phdr(dst);
}
static inline void _es_elf64_phdr(Elf64_Phdr *h)
{
h->p_type = _Es32(h->p_type);
h->p_flags = _Es32(h->p_flags);
h->p_offset = _Es64(h->p_offset);
h->p_vaddr = _Es64(h->p_vaddr);
h->p_paddr = _Es64(h->p_paddr);
h->p_filesz = _Es64(h->p_filesz);
h->p_memsz = _Es64(h->p_memsz);
h->p_align = _Es64(h->p_align);
}
static inline void _copy_es_elf64_phdr(Elf64_Phdr *dst, Elf64_Phdr *src)
{
memcpy(dst, src, sizeof(Elf64_Phdr));
_es_elf64_phdr(dst);
}
#endif