[Video] Fix up some of the types in Ext_TxFilter
This commit is contained in:
parent
1ca9601deb
commit
a9b189b78c
|
@ -14,52 +14,52 @@
|
|||
#include <stdlib.h>
|
||||
#include "Ext_TxFilter.h"
|
||||
|
||||
extern "C" boolean txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, const char *path, const char *ident, dispInfoFuncExt callback);
|
||||
extern "C" bool txfilter_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize, const char *path, const char *ident, dispInfoFuncExt callback);
|
||||
extern "C" void txfilter_shutdown(void);
|
||||
extern "C" boolean txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat, uint64 g64crc, GHQTexInfo *info);
|
||||
extern "C" boolean txfilter_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info);
|
||||
extern "C" uint64 txfilter_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette);
|
||||
extern "C" boolean txfilter_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64);
|
||||
extern "C" boolean txfilter_reloadhirestex();
|
||||
extern "C" bool txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat, uint64_t g64crc, GHQTexInfo *info);
|
||||
extern "C" bool txfilter_hirestex(uint64_t g64crc, uint64_t r_crc64, unsigned short *palette, GHQTexInfo *info);
|
||||
extern "C" uint64_t txfilter_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette);
|
||||
extern "C" bool txfilter_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64_t r_crc64);
|
||||
extern "C" bool txfilter_reloadhirestex();
|
||||
|
||||
void ext_ghq_shutdown(void)
|
||||
{
|
||||
txfilter_shutdown();
|
||||
}
|
||||
|
||||
boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
bool ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
||||
const char *path, const char *ident, dispInfoFuncExt callback)
|
||||
{
|
||||
return txfilter_init(maxwidth, maxheight, maxbpp, options, cachesize, path, ident, callback);
|
||||
}
|
||||
|
||||
boolean ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
|
||||
uint64 g64crc, GHQTexInfo *info)
|
||||
bool ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
|
||||
uint64_t g64crc, GHQTexInfo *info)
|
||||
{
|
||||
return txfilter(src, srcwidth, srcheight, srcformat, g64crc, info);;
|
||||
}
|
||||
|
||||
boolean ext_ghq_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info)
|
||||
bool ext_ghq_hirestex(uint64_t g64crc, uint64_t r_crc64, unsigned short *palette, GHQTexInfo *info)
|
||||
{
|
||||
boolean ret = txfilter_hirestex(g64crc, r_crc64, palette, info);
|
||||
bool ret = txfilter_hirestex(g64crc, r_crc64, palette, info);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64 ext_ghq_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette)
|
||||
uint64_t ext_ghq_checksum(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette)
|
||||
{
|
||||
uint64 ret = txfilter_checksum(src, width, height, size, rowStride, palette);
|
||||
uint64_t ret = txfilter_checksum(src, width, height, size, rowStride, palette);
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean ext_ghq_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64)
|
||||
bool ext_ghq_dmptx(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64_t r_crc64)
|
||||
{
|
||||
boolean ret = txfilter_dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
|
||||
bool ret = txfilter_dmptx(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
|
||||
return ret;
|
||||
}
|
||||
|
||||
boolean ext_ghq_reloadhirestex()
|
||||
bool ext_ghq_reloadhirestex()
|
||||
{
|
||||
boolean ret = txfilter_reloadhirestex();
|
||||
bool ret = txfilter_reloadhirestex();
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -10,39 +10,9 @@
|
|||
* version 2 of the License, or (at your option) any later version. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __EXT_TXFILTER_H__
|
||||
#define __EXT_TXFILTER_H__
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#define TXHMODULE HMODULE
|
||||
#define DLOPEN(a) LoadLibraryW(a)
|
||||
#define DLCLOSE(a) FreeLibrary(a)
|
||||
#define DLSYM(a, b) GetProcAddress(a, b)
|
||||
#define GETCWD(a, b) GetCurrentDirectoryW(a, b)
|
||||
#define CHDIR(a) SetCurrentDirectoryW(a)
|
||||
#else
|
||||
#include <iostream>
|
||||
#include <dlfcn.h>
|
||||
#define MAX_PATH 4095
|
||||
#define TXHMODULE void*
|
||||
#define DLOPEN(a) dlopen(a, RTLD_LAZY|RTLD_GLOBAL)
|
||||
#define DLCLOSE(a) dlclose(a)
|
||||
#define DLSYM(a, b) dlsym(a, b)
|
||||
#define GETCWD(a, b) getcwd(b, a)
|
||||
#define CHDIR(a) chdir(a)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
typedef __int64 int64;
|
||||
typedef unsigned __int64 uint64;
|
||||
typedef unsigned char boolean;
|
||||
#else
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned char boolean;
|
||||
#endif
|
||||
#pragma once
|
||||
#include <Project64-video/Renderer/types.h>
|
||||
#include <Common/stdtypes.h>
|
||||
|
||||
#define NO_OPTIONS 0x00000000
|
||||
|
||||
|
@ -94,16 +64,16 @@ typedef unsigned char boolean;
|
|||
#define LET_TEXARTISTS_FLY 0x40000000 /* a little freedom for texture artists */
|
||||
#define DUMP_TEX 0x80000000
|
||||
|
||||
|
||||
struct GHQTexInfo {
|
||||
struct GHQTexInfo
|
||||
{
|
||||
unsigned char *data;
|
||||
int width;
|
||||
int height;
|
||||
unsigned short format;
|
||||
gfxTextureFormat_t format;
|
||||
|
||||
int smallLodLog2;
|
||||
int largeLodLog2;
|
||||
int aspectRatioLog2;
|
||||
gfxLOD_t largeLodLog2;
|
||||
gfxAspectRatio_t aspectRatioLog2;
|
||||
|
||||
int tiles;
|
||||
int untiled_width;
|
||||
|
@ -131,7 +101,7 @@ struct GHQTexInfo {
|
|||
typedef void(*dispInfoFuncExt)(const wchar_t *format, ...);
|
||||
|
||||
#ifndef TXFILTER_DLL
|
||||
boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
|
||||
bool ext_ghq_init(int maxwidth, /* maximum texture width supported by hardware */
|
||||
int maxheight,/* maximum texture height supported by hardware */
|
||||
int maxbpp, /* maximum texture bpp supported by hardware */
|
||||
int options, /* options */
|
||||
|
@ -139,42 +109,40 @@ boolean ext_ghq_init(int maxwidth, /* maximum texture width supported by hardwar
|
|||
const char *path, /* plugin directory. must be smaller than MAX_PATH */
|
||||
const char *ident, /* name of ROM. must be no longer than 64 in character. */
|
||||
dispInfoFuncExt callback /* callback function to display info */
|
||||
);
|
||||
);
|
||||
|
||||
void ext_ghq_shutdown(void);
|
||||
|
||||
boolean ext_ghq_txfilter(unsigned char *src, /* input texture */
|
||||
bool ext_ghq_txfilter(unsigned char *src, /* input texture */
|
||||
int srcwidth, /* width of input texture */
|
||||
int srcheight, /* height of input texture */
|
||||
unsigned short srcformat, /* format of input texture */
|
||||
uint64 g64crc, /* glide64 crc */
|
||||
uint64_t g64crc, /* glide64 crc */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
);
|
||||
|
||||
boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */
|
||||
uint64 r_crc64, /* checksum hi:palette low:texture */
|
||||
bool ext_ghq_hirestex(uint64_t g64crc, /* glide64 crc */
|
||||
uint64_t r_crc64, /* checksum hi:palette low:texture */
|
||||
unsigned short *palette, /* palette for CI textures */
|
||||
GHQTexInfo *info /* output */
|
||||
);
|
||||
);
|
||||
|
||||
uint64 ext_ghq_checksum(unsigned char *src, /* input texture */
|
||||
uint64_t ext_ghq_checksum(unsigned char *src, /* input texture */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int size, /* type of texture pixel */
|
||||
int rowStride, /* row stride in bytes */
|
||||
unsigned char *palette /* palette */
|
||||
);
|
||||
);
|
||||
|
||||
boolean ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
|
||||
bool ext_ghq_dmptx(unsigned char *src, /* input texture (must be in 3Dfx Glide format) */
|
||||
int width, /* width of texture */
|
||||
int height, /* height of texture */
|
||||
int rowStridePixel, /* row stride of input texture in pixels */
|
||||
unsigned short gfmt, /* glide format of input texture */
|
||||
unsigned short n64fmt,/* N64 format hi:format low:size */
|
||||
uint64 r_crc64 /* checksum hi:palette low:texture */
|
||||
);
|
||||
uint64_t r_crc64 /* checksum hi:palette low:texture */
|
||||
);
|
||||
|
||||
boolean ext_ghq_reloadhirestex();
|
||||
bool ext_ghq_reloadhirestex();
|
||||
#endif /* TXFILTER_DLL */
|
||||
|
||||
#endif /* __EXT_TXFILTER_H__ */
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct TEXINFO_t
|
|||
uint32_t crc;
|
||||
uint32_t flags;
|
||||
int splits, splitheight;
|
||||
uint64 ricecrc;
|
||||
uint64_t ricecrc;
|
||||
} TEXINFO;
|
||||
|
||||
TEXINFO texinfo[2];
|
||||
|
@ -1262,7 +1262,7 @@ void LoadTex(int id, gfxChipID_t tmu)
|
|||
|
||||
cache->ricecrc = ext_ghq_checksum(addr, tile_width, tile_height, (unsigned short)(rdp.tiles(td).format << 8 | rdp.tiles(td).size), bpl, paladdr);
|
||||
WriteTrace(TraceRDP, TraceDebug, "CI RICE CRC. format: %d, size: %d, CRC: %08lx, PalCRC: %08lx", rdp.tiles(td).format, rdp.tiles(td).size, (uint32_t)(cache->ricecrc & 0xFFFFFFFF), (uint32_t)(cache->ricecrc >> 32));
|
||||
if (ext_ghq_hirestex((uint64)g64_crc, cache->ricecrc, palette, &ghqTexInfo))
|
||||
if (ext_ghq_hirestex((uint64_t)g64_crc, cache->ricecrc, palette, &ghqTexInfo))
|
||||
{
|
||||
cache->is_hires_tex = ghqTexInfo.is_hires_tex;
|
||||
if (!ghqTexInfo.is_hires_tex && aspect != ghqTexInfo.aspectRatioLog2)
|
||||
|
@ -1530,7 +1530,7 @@ void LoadTex(int id, gfxChipID_t tmu)
|
|||
{
|
||||
if (!ghqTexInfo.data)
|
||||
if (!g_settings->ghq_enht_nobg() || !rdp.texrecting || (texinfo[id].splits == 1 && texinfo[id].width <= 256))
|
||||
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64)g64_crc, &ghqTexInfo);
|
||||
ext_ghq_txfilter((unsigned char*)texture, (int)real_x, (int)real_y, LOWORD(result), (uint64_t)g64_crc, &ghqTexInfo);
|
||||
|
||||
if (ghqTexInfo.data)
|
||||
{
|
||||
|
|
|
@ -267,7 +267,7 @@ typedef struct {
|
|||
float c_scl_y; // scale to lower-right center-texel y
|
||||
|
||||
uint32_t mod, mod_color, mod_color1, mod_color2, mod_factor;
|
||||
uint64 ricecrc;
|
||||
uint64_t ricecrc;
|
||||
int is_hires_tex;
|
||||
} CACHE_LUT;
|
||||
|
||||
|
|
Loading…
Reference in New Issue