mirror of
https://github.com/wiiu-env/wut.git
synced 2025-01-06 01:48:14 +01:00
cmake: Rename libgfd target to gfd.
So we get libgfd.a instead of liblibgfd.a
This commit is contained in:
parent
ad35efc97c
commit
91621b39b1
@ -1,7 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.2)
|
cmake_minimum_required(VERSION 3.2)
|
||||||
project(libgfd)
|
project(libgfd)
|
||||||
|
|
||||||
add_library(gfd src/libgfd.c)
|
file(GLOB_RECURSE SOURCE_FILES *.c)
|
||||||
|
file(GLOB_RECURSE HEADER_FILES *.h)
|
||||||
|
|
||||||
|
add_library(gfd STATIC ${SOURCE_FILES} ${HEADER_FILES})
|
||||||
|
|
||||||
target_include_directories(gfd PRIVATE "../../include")
|
target_include_directories(gfd PRIVATE "../../include")
|
||||||
target_include_directories(gfd PUBLIC "include")
|
target_include_directories(gfd PUBLIC "include")
|
||||||
install(TARGETS gfd ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
|
||||||
|
install(TARGETS gfd
|
||||||
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib")
|
||||||
|
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
|
||||||
|
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
|
||||||
|
FILES_MATCHING PATTERN "*.h*")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "libgfd.h"
|
#include "gfd.h"
|
||||||
|
|
||||||
#include <coreinit/debug.h>
|
#include <coreinit/debug.h>
|
||||||
#include <gx2r/surface.h>
|
#include <gx2r/surface.h>
|
||||||
@ -29,6 +29,7 @@ _GFDGetHeaderVersions(uint32_t *majorVersion,
|
|||||||
*gpuVersion = 0;
|
*gpuVersion = 0;
|
||||||
|
|
||||||
if (header->magic != GFD_HEADER_MAGIC) {
|
if (header->magic != GFD_HEADER_MAGIC) {
|
||||||
|
OSReport("%s: header->magic %08X != GFD_HEADER_MAGIC", __FUNCTION__, header->magic);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,14 +49,17 @@ _GFDCheckHeaderVersions(const void *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (majorVersion != GFD_FILE_VERSION_MAJOR) {
|
if (majorVersion != GFD_FILE_VERSION_MAJOR) {
|
||||||
|
OSReport("%s: majorVersion %d != GFD_FILE_VERSION_MAJOR", __FUNCTION__, majorVersion);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minorVersion != GFD_FILE_VERSION_MINOR) {
|
if (minorVersion != GFD_FILE_VERSION_MINOR) {
|
||||||
|
OSReport("%s: minorVersion %d != GFD_FILE_VERSION_MINOR", __FUNCTION__, minorVersion);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gpuVersion != GX2TempGetGPUVersion()) {
|
if (gpuVersion != GX2TempGetGPUVersion()) {
|
||||||
|
OSReport("%s: gpuVersion %d != GX2TempGetGPUVersion()", __FUNCTION__, gpuVersion);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,10 +70,12 @@ static BOOL
|
|||||||
_GFDCheckBlockHeaderMagicVersions(const GFDBlockHeader *header)
|
_GFDCheckBlockHeaderMagicVersions(const GFDBlockHeader *header)
|
||||||
{
|
{
|
||||||
if (header->magic != GFD_BLOCK_HEADER_MAGIC) {
|
if (header->magic != GFD_BLOCK_HEADER_MAGIC) {
|
||||||
|
OSReport("%s: header->magic %08X != GFD_BLOCK_HEADER_MAGIC", __FUNCTION__, header->magic);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header->majorVersion != GFD_BLOCK_VERSION_MAJOR) {
|
if (header->majorVersion != GFD_BLOCK_VERSION_MAJOR) {
|
||||||
|
OSReport("%s: header->majorVersion %d != GFD_BLOCK_VERSION_MAJOR", __FUNCTION__, header->majorVersion);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,12 +285,14 @@ _GFDRelocateBlockEx(const GFDRelocationHeader *relocationHeader,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_GFDCheckTagDAT(offset) && !_GFDCheckTagSTR(offset)) {
|
if (!_GFDCheckTagDAT(offset) && !_GFDCheckTagSTR(offset)) {
|
||||||
|
OSReport("%s: !_GFDCheckTagDAT(offset = %08X) && !_GFDCheckTagSTR(offset = %08X)", __FUNCTION__, offset, offset);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = (uint32_t *)(dst + _GFDCleanTag(offset));
|
target = (uint32_t *)(dst + _GFDCleanTag(offset));
|
||||||
|
|
||||||
if (!_GFDCheckTagDAT(*target) && !_GFDCheckTagSTR(*target)) {
|
if (!_GFDCheckTagDAT(*target) && !_GFDCheckTagSTR(*target)) {
|
||||||
|
OSReport("%s: !_GFDCheckTagDAT(*target = %08X) && !_GFDCheckTagSTR(*target = %08X)", __FUNCTION__, *target, *target);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,21 +314,21 @@ _GFDRelocateBlock(const GFDBlockHeader *blockHeader,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
relocationHeader = (const GFDRelocationHeader *)(blockData
|
relocationHeader = (const GFDRelocationHeader *)(blockData
|
||||||
+ blockHeader->dataSize
|
+ blockHeader->dataSize
|
||||||
- sizeof(GFDRelocationHeader));
|
- sizeof(GFDRelocationHeader));
|
||||||
|
|
||||||
if (relocationHeader->magic != GFD_RELOCATION_HEADER_MAGIC) {
|
if (relocationHeader->magic != GFD_RELOCATION_HEADER_MAGIC) {
|
||||||
|
OSReport("%s: relocationHeader->magic %08X != GFD_RELOCATION_HEADER_MAGIC", __FUNCTION__, relocationHeader->magic);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_GFDCheckTagDAT(relocationHeader->patchOffset)) {
|
if (!_GFDCheckTagDAT(relocationHeader->patchOffset)) {
|
||||||
|
OSReport("%s: !_GFDCheckTagDAT(relocationHeader->patchOffset = %08X)", __FUNCTION__, relocationHeader->patchOffset);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
patchTable = (const uint32_t *)(blockData + relocationHeader->patchOffset);
|
patchTable = (const uint32_t *)(blockData + _GFDCleanTag(relocationHeader->patchOffset));
|
||||||
|
|
||||||
return _GFDRelocateBlockEx(relocationHeader, patchTable, (uint8_t *)dst);
|
return _GFDRelocateBlockEx(relocationHeader, patchTable, (uint8_t *)dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +341,6 @@ _GFDCheckShaderAlign(void *program)
|
|||||||
static BOOL
|
static BOOL
|
||||||
_GFDGetGenericBlock(GFDBlockType blockTypeHeader,
|
_GFDGetGenericBlock(GFDBlockType blockTypeHeader,
|
||||||
void *header,
|
void *header,
|
||||||
uint32_t headerSize,
|
|
||||||
GFDBlockType blockTypeProgram1,
|
GFDBlockType blockTypeProgram1,
|
||||||
void **outProgramPtr1,
|
void **outProgramPtr1,
|
||||||
void *program1,
|
void *program1,
|
||||||
@ -363,11 +370,7 @@ _GFDGetGenericBlock(GFDBlockType blockTypeHeader,
|
|||||||
|
|
||||||
if (blockHeader->type == blockTypeHeader) {
|
if (blockHeader->type == blockTypeHeader) {
|
||||||
if (headerCount == index) {
|
if (headerCount == index) {
|
||||||
if (blockHeader->dataSize < headerSize) {
|
memcpy(header, ptr, blockHeader->dataSize);
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(header, ptr, headerSize);
|
|
||||||
|
|
||||||
// Process relocations for all headers except a texture header.
|
// Process relocations for all headers except a texture header.
|
||||||
if (blockTypeHeader != GFD_BLOCK_TEXTURE_HEADER) {
|
if (blockTypeHeader != GFD_BLOCK_TEXTURE_HEADER) {
|
||||||
@ -509,7 +512,6 @@ GFDGetComputeShader(GX2ComputeShader *shader,
|
|||||||
{
|
{
|
||||||
return _GFDGetGenericBlock(GFD_BLOCK_COMPUTE_SHADER_HEADER,
|
return _GFDGetGenericBlock(GFD_BLOCK_COMPUTE_SHADER_HEADER,
|
||||||
shader,
|
shader,
|
||||||
sizeof(GX2ComputeShader),
|
|
||||||
GFD_BLOCK_COMPUTE_SHADER_PROGRAM,
|
GFD_BLOCK_COMPUTE_SHADER_PROGRAM,
|
||||||
&shader->program,
|
&shader->program,
|
||||||
program,
|
program,
|
||||||
@ -568,7 +570,6 @@ GFDGetGeometryShader(GX2GeometryShader *shader,
|
|||||||
|
|
||||||
return _GFDGetGenericBlock(GFD_BLOCK_GEOMETRY_SHADER_HEADER,
|
return _GFDGetGenericBlock(GFD_BLOCK_GEOMETRY_SHADER_HEADER,
|
||||||
shader,
|
shader,
|
||||||
sizeof(GX2GeometryShader),
|
|
||||||
GFD_BLOCK_GEOMETRY_SHADER_PROGRAM,
|
GFD_BLOCK_GEOMETRY_SHADER_PROGRAM,
|
||||||
&shader->program,
|
&shader->program,
|
||||||
program,
|
program,
|
||||||
@ -616,7 +617,6 @@ GFDGetPixelShader(GX2PixelShader *shader,
|
|||||||
|
|
||||||
return _GFDGetGenericBlock(GFD_BLOCK_PIXEL_SHADER_HEADER,
|
return _GFDGetGenericBlock(GFD_BLOCK_PIXEL_SHADER_HEADER,
|
||||||
shader,
|
shader,
|
||||||
sizeof(GX2PixelShader),
|
|
||||||
GFD_BLOCK_PIXEL_SHADER_PROGRAM,
|
GFD_BLOCK_PIXEL_SHADER_PROGRAM,
|
||||||
&shader->program,
|
&shader->program,
|
||||||
program,
|
program,
|
||||||
@ -660,7 +660,6 @@ GFDGetVertexShader(GX2VertexShader *shader,
|
|||||||
{
|
{
|
||||||
return _GFDGetGenericBlock(GFD_BLOCK_VERTEX_SHADER_HEADER,
|
return _GFDGetGenericBlock(GFD_BLOCK_VERTEX_SHADER_HEADER,
|
||||||
shader,
|
shader,
|
||||||
sizeof(GX2VertexShader),
|
|
||||||
GFD_BLOCK_VERTEX_SHADER_PROGRAM,
|
GFD_BLOCK_VERTEX_SHADER_PROGRAM,
|
||||||
&shader->program,
|
&shader->program,
|
||||||
program,
|
program,
|
||||||
@ -732,7 +731,6 @@ GFDGetTexture(GX2Texture *texture,
|
|||||||
{
|
{
|
||||||
return _GFDGetGenericBlock(GFD_BLOCK_TEXTURE_HEADER,
|
return _GFDGetGenericBlock(GFD_BLOCK_TEXTURE_HEADER,
|
||||||
texture,
|
texture,
|
||||||
sizeof(GX2Texture),
|
|
||||||
GFD_BLOCK_TEXTURE_IMAGE,
|
GFD_BLOCK_TEXTURE_IMAGE,
|
||||||
&texture->surface.image,
|
&texture->surface.image,
|
||||||
image,
|
image,
|
||||||
@ -831,7 +829,7 @@ GFDGetGX2RTexture(GX2Texture *texture,
|
|||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
GX2RDestroySurface(&texture->surface);
|
GX2RDestroySurfaceEx(&texture->surface, 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user