chore(binana): add a lot of texture functions

This commit is contained in:
phaneron 2024-08-27 04:00:05 -04:00
parent 1042d9fa22
commit 571579c3c4
19 changed files with 2001 additions and 45 deletions

View file

@ -9,11 +9,11 @@ DECLARE_STRUCT(CDataRecycler__NodeBlock);
DECLARE_STRUCT(CDataRecycler__Node);
struct CDataRecycler__vtable {
void *v_fn_00;
void *v_fn_01;
void *v_fn_02;
void *v_fn_03;
void *v_fn_04;
void* v_fn_00;
void* v_fn_01;
void* v_fn_02;
void* v_fn_03;
void* v_fn_04;
};
struct CDataRecycler__Node {

View file

@ -0,0 +1,36 @@
#ifndef COMMON_STATUS_H
#define COMMON_STATUS_H
#include "storm/list.h"
DECLARE_ENUM(STATUS_TYPE);
DECLARE_STRUCT(CStatus);
DECLARE_STRUCT(CStatus__STATUSENTRY);
enum STATUS_TYPE {
STATUS_INFO = 0x0,
STATUS_WARNING = 0x1,
STATUS_ERROR = 0x2,
STATUS_FATAL = 0x3,
STATUS_NUMTYPES = 0x4
};
STORM_TS_LIST(CStatus__STATUSENTRY);
struct CStatus__STATUSENTRY {
char* text;
STATUS_TYPE severity;
TSLink_CStatus__STATUSENTRY link;
};
struct CStatus {
TSExplicitList_CStatus__STATUSENTRY statusList;
};
// class CWOWClientStatus : public CStatus {
// public:
// HSLOG m_logFile = nullptr;
// };
#endif

View file

@ -5,34 +5,35 @@
#include "storm/array.h"
typedef enum BlitAlpha BlitAlpha;
typedef enum BlitFormat BlitFormat;
typedef enum EGxApi EGxApi;
typedef enum EGxBlend EGxBlend;
typedef enum EGxColorFormat EGxColorFormat;
typedef enum EGxFontHJusts EGxFontHJusts;
typedef enum EGxFontVJusts EGxFontVJusts;
typedef enum EGxMasterEnables EGxMasterEnables;
typedef enum EGxPrim EGxPrim;
typedef enum EGxPrimMask EGxPrimMask;
typedef enum EGxRenderState EGxRenderState;
typedef enum EGxShPS EGxShPS;
typedef enum EGxShTarget EGxShTarget;
typedef enum EGxShVS EGxShVS;
typedef enum EGxTexCommand EGxTexCommand;
typedef enum EGxTexFilter EGxTexFilter;
typedef enum EGxTexFormat EGxTexFormat;
typedef enum EGxTexTarget EGxTexTarget;
typedef enum EGxTexWrapMode EGxTexWrapMode;
typedef enum EGxXform EGxXform;
typedef enum EGxuDrawListCategory EGxuDrawListCategory;
typedef enum EGxWM EGxWM;
typedef enum COLOR_FILE_FORMAT COLOR_FILE_FORMAT;
typedef enum PIXEL_FORMAT PIXEL_FORMAT;
DECLARE_ENUM(BlitAlpha);
DECLARE_ENUM(BlitFormat);
DECLARE_ENUM(EGxApi);
DECLARE_ENUM(EGxBlend);
DECLARE_ENUM(EGxColorFormat);
DECLARE_ENUM(EGxFontHJusts);
DECLARE_ENUM(EGxFontVJusts);
DECLARE_ENUM(EGxMasterEnables);
DECLARE_ENUM(EGxPrim);
DECLARE_ENUM(EGxPrimMask);
DECLARE_ENUM(EGxRenderState);
DECLARE_ENUM(EGxShPS);
DECLARE_ENUM(EGxShTarget);
DECLARE_ENUM(EGxShVS);
DECLARE_ENUM(EGxTexCommand);
DECLARE_ENUM(EGxTexFilter);
DECLARE_ENUM(EGxTexFormat);
DECLARE_ENUM(EGxTexTarget);
DECLARE_ENUM(EGxTexWrapMode);
DECLARE_ENUM(EGxXform);
DECLARE_ENUM(EGxuDrawListCategory);
DECLARE_ENUM(EGxWM);
DECLARE_ENUM(COLOR_FILE_FORMAT);
DECLARE_ENUM(PIXEL_FORMAT);
typedef struct C4Pixel C4Pixel;
typedef struct MipBits MipBits;
typedef struct CGxGammaRamp CGxGammaRamp;
DECLARE_STRUCT(C4Pixel);
DECLARE_STRUCT(C4LargePixel);
DECLARE_STRUCT(MipBits);
DECLARE_STRUCT(CGxGammaRamp);
enum BlitAlpha {
BlitAlpha_0 = 0,
@ -370,10 +371,17 @@ enum PIXEL_FORMAT {
};
struct C4Pixel {
char b;
char g;
char r;
char a;
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
};
struct C4LargePixel {
uint64_t b;
uint64_t g;
uint64_t r;
uint64_t a;
};
struct MipBits {

View file

@ -7,6 +7,7 @@
#include "common/handle.h"
#include "common/instance.h"
#include "common/datarecycler.h"
#include "common/status.h"
#include "d3d9/caps.h"
#include "d3d9/device.h"
@ -46,6 +47,9 @@
#include "tempest/sphere.h"
#include "tempest/vector.h"
#include "texture/blp.h"
#include "texture/tga.h"
#include "ui/simpleframe.h"
// include files that define the use of template classes for standard library types

View file

@ -0,0 +1,9 @@
#ifndef STORM_FILE_H
#define STORM_FILE_H
DECLARE_STRUCT(SFile);
struct SFile {
};
#endif

View file

@ -0,0 +1,70 @@
#ifndef TEXTURE_BLP_H
#define TEXTURE_BLP_H
#include "system/types.h"
#include "storm/file.h"
#include "gx/types.h"
DECLARE_HANDLE(HCOLORMAP);
DECLARE_ENUM(MipMapAlgorithm);
DECLARE_STRUCT(CBLPFile);
DECLARE_STRUCT(BlpPalPixel);
DECLARE_STRUCT(BLPHeader);
DECLARE_STRUCT(BLPJPEGHeader);
enum MipMapAlgorithm {
MMA_BOX = 0x0,
MMA_CUBIC = 0x1,
MMA_FULLDFT = 0x2,
MMA_KAISER = 0x3,
MMA_LINEARLIGHTKAISER = 0x4
};
struct BlpPalPixel {
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t pad;
};
struct BLPJPEGHeader {
uint32_t headerSize;
uint8_t headerData[1020];
};
struct BLPHeader {
uint32_t magic;
uint32_t formatVersion;
uint8_t colorEncoding;
uint8_t alphaSize;
uint8_t preferredFormat;
uint8_t hasMips;
uint32_t width;
uint32_t height;
uint32_t mipOffsets[16];
uint32_t mipSizes[16];
union {
BlpPalPixel palette[256];
BLPJPEGHeader jpeg;
} extended;
};
struct CBLPFile {
MipBits* m_images;
BLPHeader m_header;
void* m_inMemoryImage;
int32_t m_inMemoryNeedsFree;
uint32_t m_numLevels;
uint32_t m_quality;
HCOLORMAP m_colorMapping;
MipMapAlgorithm m_mipMapAlgorithm;
uint8_t* m_lockDecompMem;
};
#endif

View file

@ -0,0 +1,66 @@
#ifndef TEXTURE_TGA_H
#define TEXTURE_TGA_H
#include "system/types.h"
#include "storm/file.h"
DECLARE_STRUCT(TGAFooter);
DECLARE_STRUCT(TGAHeader);
DECLARE_STRUCT(TGA32Pixel);
DECLARE_STRUCT(TGAImageDesc);
DECLARE_STRUCT(CTgaFile);
struct TGAFooter {
uint32_t dwExtensionOffset;
uint32_t dwDeveloperOffset;
uint8_t szSigniture[18];
};
#pragma pack(push, 1)
struct TGAImageDesc {
uint8_t bAlphaChannelBits : 4;
uint8_t bLeftRightOrder : 1;
uint8_t bTopBottomOrder : 1;
uint8_t bReserved : 2;
};
struct TGAHeader {
uint8_t bIDLength;
uint8_t bColorMapType;
uint8_t bImageType;
// byte packed
uint16_t wColorMapStartIndex;
uint16_t wColorMapEntries;
uint8_t bColorMapEntrySize;
uint16_t wXOrigin;
uint16_t wYOrigin;
uint16_t wWidth;
uint16_t wHeight;
uint8_t bPixelDepth;
union {
uint8_t bImageDescriptor;
TGAImageDesc desc;
};
};
#pragma pack(pop)
struct TGA32Pixel {
uint8_t b;
uint8_t g;
uint8_t r;
uint8_t a;
};
struct CTgaFile {
SFile* m_file;
uint8_t* m_image;
TGAHeader m_header;
uint8_t* m_addlHeaderData;
TGAFooter m_footer;
uint32_t m_imageBytes;
uint8_t* m_colorMap;
};
#endif