mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
(RGL PS3) Slim down headers
This commit is contained in:
parent
7b9b87c284
commit
ab0d1a2e65
@ -1,17 +1,6 @@
|
||||
#ifndef _CGC_CGBIO_CGBDEFS_HPP
|
||||
#define _CGC_CGBIO_CGBDEFS_HPP
|
||||
|
||||
// Platform depended definitions:
|
||||
typedef unsigned int Elf32_Addr;
|
||||
typedef unsigned short Elf32_Half;
|
||||
typedef short Elf32_Shalf;
|
||||
typedef unsigned int Elf32_Off;
|
||||
typedef signed int Elf32_Sword;
|
||||
typedef unsigned int Elf32_Word;
|
||||
|
||||
typedef unsigned short Elf64_Half;
|
||||
typedef short Elf64_Shalf;
|
||||
|
||||
///////////////////////
|
||||
// ELF Header Constants
|
||||
|
||||
@ -248,21 +237,24 @@ typedef short Elf64_Shalf;
|
||||
#define R_RSX_FLOAT4 1
|
||||
|
||||
/* Note header in a PT_NOTE section */
|
||||
struct Elf32_Note {
|
||||
Elf32_Word n_namesz; /* Name size */
|
||||
Elf32_Word n_descsz; /* Content size */
|
||||
Elf32_Word n_type; /* Content type */
|
||||
struct Elf32_Note
|
||||
{
|
||||
unsigned int n_namesz; /* Name size */
|
||||
unsigned int n_descsz; /* Content size */
|
||||
unsigned int n_type; /* Content type */
|
||||
};
|
||||
|
||||
|
||||
// Relocation entries
|
||||
|
||||
// Dynamic structure
|
||||
struct Elf32_Dyn {
|
||||
Elf32_Sword d_tag;
|
||||
union {
|
||||
Elf32_Word d_val;
|
||||
Elf32_Addr d_ptr;
|
||||
struct Elf32_Dyn
|
||||
{
|
||||
signed int d_tag;
|
||||
union
|
||||
{
|
||||
unsigned int d_val;
|
||||
unsigned int d_ptr;
|
||||
} d_un;
|
||||
};
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
LIBRARY cgbu
|
||||
EXPORTS
|
||||
;?CreateCGBI@CGBIO@@QBE?AW4CGBIO_Err@@PAPAVCGBI@@@Z
|
||||
;?instance@CGBIO@@SAPBV1@XZ
|
||||
;?get_revision@CGBIImpl@@UBEHXZ
|
||||
get_revision
|
||||
instance
|
||||
CreateCGBI
|
||||
|
@ -5,18 +5,19 @@
|
||||
* format.
|
||||
*/
|
||||
|
||||
#if !defined(CGC_CGBIO_CGBIO_HPP)
|
||||
#define CGC_CGBIO_CGBIO_HPP 1
|
||||
#ifndef CGC_CGBIO_CGBIO_HPP
|
||||
#define CGC_CGBIO_CGBIO_HPP
|
||||
|
||||
#include "cgbdefs.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace cgc {
|
||||
namespace bio {
|
||||
|
||||
enum CGBIO_ERROR {
|
||||
namespace cgc
|
||||
{
|
||||
namespace bio
|
||||
{
|
||||
enum CGBIO_ERROR
|
||||
{
|
||||
CGBIO_ERROR_NO_ERROR,
|
||||
CGBIO_ERROR_LOADED,
|
||||
CGBIO_ERROR_FILEIO,
|
||||
@ -26,16 +27,17 @@ enum CGBIO_ERROR {
|
||||
CGBIO_ERROR_RELOC,
|
||||
CGBIO_ERROR_SYMBOL,
|
||||
CGBIO_ERROR_UNKNOWN_TYPE
|
||||
};
|
||||
};
|
||||
|
||||
} // bio namespace
|
||||
} // bio namespace
|
||||
} // cgc namespace
|
||||
|
||||
#include "nvbi.hpp"
|
||||
|
||||
namespace cgc {
|
||||
namespace bio {
|
||||
|
||||
namespace cgc
|
||||
{
|
||||
namespace bio
|
||||
{
|
||||
class bin_io
|
||||
{
|
||||
public:
|
||||
@ -51,9 +53,9 @@ namespace bio {
|
||||
bin_io( const bin_io& );
|
||||
|
||||
static bin_io* instance_;
|
||||
}; // bin_io
|
||||
}; // bin_io
|
||||
|
||||
} // bio namespace
|
||||
} // bio namespace
|
||||
} // cgc namespace
|
||||
|
||||
#endif // CGC_CGBIO_CGBIO_HPP
|
||||
|
@ -2,7 +2,8 @@
|
||||
#define CGBTYPES_HEADER
|
||||
|
||||
// parameter structure
|
||||
typedef struct _Elf32_cgParameter {
|
||||
typedef struct _Elf32_cgParameter
|
||||
{
|
||||
uint32_t cgp_name; // index of name in strtab
|
||||
uint32_t cgp_semantic; // index of semantic string in strtab
|
||||
uint16_t cgp_default; // index of default data in const //Reduced to half
|
||||
|
@ -1,48 +1,46 @@
|
||||
#if !defined(CGC_CGBIO_CGBUTILS_HPP)
|
||||
#define CGC_CGBIO_CGBUTILS_HPP 1
|
||||
#ifndef CGC_CGBIO_CGBUTILS_HPP
|
||||
#define CGC_CGBIO_CGBUTILS_HPP
|
||||
|
||||
#include "cgbdefs.hpp"
|
||||
|
||||
namespace cgc {
|
||||
namespace bio {
|
||||
#define ELF32_ST_BIND(idx) ( idx >> 4 )
|
||||
#define ELF32_ST_TYPE(idx) ( idx & 0xf )
|
||||
#define ELF32_ST_INFO(b, t) (( b << 4 ) + ( t & 0xf ))
|
||||
#define ELF32_ST_VISIBILITY(o) ( o & 0x3 )
|
||||
|
||||
typedef enum {
|
||||
namespace cgc
|
||||
{
|
||||
namespace bio
|
||||
{
|
||||
typedef enum
|
||||
{
|
||||
CGBIODATANONE = ELFDATANONE,
|
||||
CGBIODATALSB = ELFDATA2LSB,
|
||||
CGBIODATAMSB = ELFDATA2MSB
|
||||
} HOST_ENDIANNESS; // endianness
|
||||
} HOST_ENDIANNESS; // endianness
|
||||
|
||||
inline HOST_ENDIANNESS
|
||||
host_endianness()
|
||||
{
|
||||
inline HOST_ENDIANNESS host_endianness(void)
|
||||
{
|
||||
const int ii = 1;
|
||||
const char* cp = (const char*) ⅈ
|
||||
return ( 1 == cp[0] ) ? CGBIODATALSB : CGBIODATAMSB;
|
||||
}
|
||||
return ( cp[0] == 1 ) ? CGBIODATALSB : CGBIODATAMSB;
|
||||
}
|
||||
|
||||
template< typename T > inline T
|
||||
convert_endianness( const T value, unsigned char endianness )
|
||||
{
|
||||
template< typename T > inline T convert_endianness( const T value, unsigned char endianness )
|
||||
{
|
||||
if ( host_endianness() == endianness )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if ( sizeof( T ) == 1 )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
if ( sizeof( T ) == 2 )
|
||||
{
|
||||
return ( ((value & 0x00FF) << 8)
|
||||
| ((value & 0xFF00) >> 8) );
|
||||
}
|
||||
return ( ((value & 0x00FF) << 8) | ((value & 0xFF00) >> 8) );
|
||||
|
||||
if ( sizeof( T ) == 4 )
|
||||
{
|
||||
return ( ((value & 0x000000FF) << 24)
|
||||
| ((value & 0x0000FF00) << 8)
|
||||
| ((value & 0x00FF0000) >> 8)
|
||||
| ((value & 0xFF000000) >> 24) );
|
||||
}
|
||||
return ( ((value & 0x000000FF) << 24) | ((value & 0x0000FF00) << 8)
|
||||
| ((value & 0x00FF0000) >> 8) | ((value & 0xFF000000) >> 24) );
|
||||
|
||||
if ( sizeof( T ) == 8 )
|
||||
{
|
||||
T result = value;
|
||||
@ -54,49 +52,11 @@ convert_endianness( const T value, unsigned char endianness )
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// exception
|
||||
return value;
|
||||
}
|
||||
|
||||
template< typename T > inline T
|
||||
ELF32_ST_BIND( const T idx )
|
||||
{
|
||||
return ( idx >> 4 );
|
||||
}
|
||||
|
||||
template< typename T > inline T
|
||||
ELF32_ST_TYPE( const T idx )
|
||||
{
|
||||
return ( idx & 0xf );
|
||||
}
|
||||
|
||||
template< typename T > inline T
|
||||
ELF32_ST_INFO( const T b, const T t )
|
||||
{
|
||||
return ( ( b << 4 ) + ( t & 0xf ) );
|
||||
}
|
||||
|
||||
template< typename T > inline T
|
||||
ELF32_ST_VISIBILITY( const T o )
|
||||
{
|
||||
return ( o & 0x3 );
|
||||
}
|
||||
|
||||
// these are not used in our relocations, will be replaced by the ones
|
||||
// we design, will be defined as templates.
|
||||
#ifndef ELF32_R_SYM
|
||||
#define ELF32_R_SYM(i) ((i)>>8)
|
||||
#endif
|
||||
|
||||
#ifndef ELF32_R_TYPE
|
||||
#define ELF32_R_TYPE(i) ((unsigned char)(i))
|
||||
#endif
|
||||
|
||||
#ifndef ELF32_R_INFO
|
||||
#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t))
|
||||
#endif
|
||||
|
||||
} // bio namespace
|
||||
}
|
||||
} // bio namespace
|
||||
} // cgc namespace
|
||||
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
#ifndef CGNV2ELF_VERSION
|
||||
#define CGNV2ELF_VERSION 6365
|
||||
#define CGNV2ELF_PRODUCT_STRING "SCE cgnv2elf"
|
||||
#define CGNV2ELF_VERSION_NOTE_TYPE 0
|
||||
#endif
|
@ -7,8 +7,6 @@
|
||||
#define CNV2END(val) convert_endianness((val), elfEndianness)
|
||||
#define ENDSWAP(val) convert_endianness((val), (host_endianness() == 1) ? 2 : 1)
|
||||
|
||||
int convertNvToElfFromFile(const char *sourceFile, int endianness, int constTableOffset, void **binaryShader, int *size,
|
||||
std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
||||
int convertNvToElfFromMemory(const void *sourceData, size_t size, int endianness, int constTableOffset, void **binaryShader, int *binarySize,
|
||||
std::vector<char> &stringTable, std::vector<float> &defaultValues);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#if !defined(CGC_CGBIO_NVBI_HPP)
|
||||
#define CGC_CGBIO_NVBI_HPP 1
|
||||
#ifndef CGC_CGBIO_NVBI_HPP
|
||||
#define CGC_CGBIO_NVBI_HPP
|
||||
|
||||
#include "cgbdefs.hpp"
|
||||
|
||||
@ -11,11 +11,12 @@
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgBinary.h>
|
||||
|
||||
|
||||
namespace cgc {
|
||||
namespace bio {
|
||||
|
||||
class nvb_reader {
|
||||
namespace cgc
|
||||
{
|
||||
namespace bio
|
||||
{
|
||||
class nvb_reader
|
||||
{
|
||||
public:
|
||||
virtual ~nvb_reader() {}
|
||||
|
||||
@ -25,14 +26,6 @@ class nvb_reader {
|
||||
virtual ptrdiff_t
|
||||
release() const = 0;
|
||||
|
||||
#ifndef __CELLOS_LV2__
|
||||
virtual CGBIO_ERROR
|
||||
load( std::istream* stream, int start, bool owner = false ) = 0;
|
||||
|
||||
virtual CGBIO_ERROR
|
||||
load( const char *filename ) = 0;
|
||||
#endif
|
||||
|
||||
virtual CGBIO_ERROR
|
||||
loadFromString( const char* source, size_t length ) = 0;
|
||||
|
||||
@ -83,10 +76,8 @@ class nvb_reader {
|
||||
|
||||
virtual CGBIO_ERROR get_param_name( unsigned int index, const char** name, bool& is_referenced) const = 0;
|
||||
|
||||
}; // nvb_reader
|
||||
|
||||
|
||||
} // bio namespace
|
||||
}; // nvb_reader
|
||||
} // bio namespace
|
||||
} // cgc namespace
|
||||
|
||||
#endif // CGC_CGBIO_NVBI_HPP
|
||||
|
@ -1,7 +1,6 @@
|
||||
#if !defined(CGC_CGBIO_NVBIIMPL_HPP)
|
||||
#define CGC_CGBIO_NVBIIMPL_HPP 1
|
||||
#ifndef CGC_CGBIO_NVBIIMPL_HPP
|
||||
#define CGC_CGBIO_NVBIIMPL_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
@ -11,11 +10,12 @@
|
||||
|
||||
#include "cgbio.hpp"
|
||||
|
||||
namespace cgc {
|
||||
namespace bio {
|
||||
|
||||
class nvb_reader_impl : public nvb_reader
|
||||
namespace cgc
|
||||
{
|
||||
namespace bio
|
||||
{
|
||||
class nvb_reader_impl : public nvb_reader
|
||||
{
|
||||
public:
|
||||
nvb_reader_impl();
|
||||
|
||||
@ -28,14 +28,6 @@ class nvb_reader_impl : public nvb_reader
|
||||
virtual ptrdiff_t
|
||||
release() const;
|
||||
|
||||
#ifndef __CELLOS_LV2__
|
||||
virtual CGBIO_ERROR
|
||||
load( std::istream* stream, int start ,bool owner = false);
|
||||
|
||||
virtual CGBIO_ERROR
|
||||
load( const char* filename );
|
||||
#endif
|
||||
|
||||
virtual CGBIO_ERROR
|
||||
loadFromString( const char* source, size_t length);
|
||||
|
||||
@ -95,9 +87,9 @@ class nvb_reader_impl : public nvb_reader
|
||||
CgBinaryProgram header_;
|
||||
unsigned char endianness_;
|
||||
char* image_;
|
||||
}; // nvb_reader_impl
|
||||
}; // nvb_reader_impl
|
||||
|
||||
} // bio namespace
|
||||
} // bio namespace
|
||||
} // cgc namespace
|
||||
|
||||
#endif // CGC_CGBIO_NVBIIMPL_HPP
|
||||
|
@ -1,10 +1,6 @@
|
||||
#ifndef ELF_H
|
||||
#define ELF_H
|
||||
|
||||
/*
|
||||
* Data Representation
|
||||
*/
|
||||
|
||||
/*
|
||||
* ELF header
|
||||
*/
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include "cg/cgbtypes.h"
|
||||
#include "cg/cgnv2rt.h"
|
||||
#include "cg/cgnv2elfversion.h"
|
||||
|
||||
#include "cg/cgbio.hpp"
|
||||
#include "cg/nvbiimpl.hpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user