mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
GLideNHQ: cleanup
This commit is contained in:
parent
ada73c60ee
commit
22f50fafb5
|
@ -72,34 +72,24 @@ endif()
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x -Wno-unused-result")
|
SET(GCC_CPP11_COMPILE_FLAGS "-std=c++0x -Wno-unused-result")
|
||||||
if( NOT GHQCHK )
|
|
||||||
if ( NOT MINGW )
|
if ( NOT MINGW )
|
||||||
SET ( PIC_FLAGS "-fPIC" )
|
SET ( PIC_FLAGS "-fPIC" )
|
||||||
endif ( NOT MINGW)
|
endif ( NOT MINGW)
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} -static ${PIC_FLAGS} " )
|
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} -static ${PIC_FLAGS} " )
|
||||||
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " )
|
SET( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static ${PIC_FLAGS} " )
|
||||||
else( NOT GHQCHK )
|
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" )
|
|
||||||
endif( NOT GHQCHK )
|
|
||||||
#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} " )
|
#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} " )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( NOT GHQCHK )
|
add_definitions( -DTXFILTER_LIB)
|
||||||
|
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_definitions( -DTXFILTER_LIB)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
SET( BUILD_VARIANT "debug" )
|
SET( BUILD_VARIANT "debug" )
|
||||||
else()
|
else()
|
||||||
SET( BUILD_VARIANT "release" )
|
SET( BUILD_VARIANT "release" )
|
||||||
endif()
|
endif()
|
||||||
|
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES})
|
add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES})
|
||||||
|
|
||||||
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1)
|
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||||
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1)
|
set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||||
|
|
||||||
if(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
if(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
||||||
FIND_PACKAGE( ZLIB REQUIRED )
|
FIND_PACKAGE( ZLIB REQUIRED )
|
||||||
FIND_PACKAGE( PNG REQUIRED )
|
FIND_PACKAGE( PNG REQUIRED )
|
||||||
|
@ -123,9 +113,9 @@ if( NOT GHQCHK )
|
||||||
osald
|
osald
|
||||||
)
|
)
|
||||||
endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES})
|
add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES})
|
||||||
|
|
||||||
# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1)
|
# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||||
|
@ -162,26 +152,4 @@ if( NOT GHQCHK )
|
||||||
osal
|
osal
|
||||||
)
|
)
|
||||||
endif(PANDORA)
|
endif(PANDORA)
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||||
else( NOT GHQCHK )
|
|
||||||
add_definitions(-DGHQCHK)
|
|
||||||
|
|
||||||
add_library( ghqchk SHARED ${GLideNHQ_SOURCES})
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(
|
|
||||||
ghqchk
|
|
||||||
PROPERTIES
|
|
||||||
LINKER_LANGUAGE CXX # Or else we get an error message, because cmake can't figure out from the ".o"-suffix that it is a C-linker we need.
|
|
||||||
PREFIX ""
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/plugin
|
|
||||||
)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
target_link_libraries(ghqchk png z )
|
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
||||||
target_link_libraries(ghqchk png z )
|
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
||||||
endif( NOT GHQCHK )
|
|
||||||
|
|
||||||
|
|
|
@ -1,172 +0,0 @@
|
||||||
/*
|
|
||||||
* Texture Filtering
|
|
||||||
* Version: 1.0
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
|
||||||
* Email koolsmoky(at)users.sourceforge.net
|
|
||||||
* Web http://www.3dfxzone.it/koolsmoky
|
|
||||||
*
|
|
||||||
* this is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* this is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GNU Make; see the file COPYING. If not, write to
|
|
||||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <memory.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include "Ext_TxFilter.h"
|
|
||||||
|
|
||||||
typedef boolean (*txfilter_init)(int maxwidth, int maxheight, int maxbpp,
|
|
||||||
int options, int cachesize,
|
|
||||||
const wchar_t *path, const wchar_t *ident,
|
|
||||||
dispInfoFuncExt callback);
|
|
||||||
|
|
||||||
typedef void (*txfilter_shutdown)(void);
|
|
||||||
|
|
||||||
typedef boolean (*txfilter_filter)(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
|
|
||||||
uint64 g64crc, GHQTexInfo *info);
|
|
||||||
|
|
||||||
typedef boolean (*txfilter_hirestex)(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info);
|
|
||||||
|
|
||||||
typedef uint64 (*txfilter_checksum)(unsigned char *src, int width, int height, int size, int rowStride, unsigned char *palette);
|
|
||||||
|
|
||||||
typedef boolean (*txfilter_dmptx)(unsigned char *src, int width, int height, int rowStridePixel, unsigned short gfmt, unsigned short n64fmt, uint64 r_crc64);
|
|
||||||
|
|
||||||
typedef boolean (*txfilter_reloadhirestex)();
|
|
||||||
|
|
||||||
static struct {
|
|
||||||
TXHMODULE lib;
|
|
||||||
txfilter_init init;
|
|
||||||
txfilter_shutdown shutdown;
|
|
||||||
txfilter_filter filter;
|
|
||||||
txfilter_hirestex hirestex;
|
|
||||||
txfilter_checksum checksum;
|
|
||||||
txfilter_dmptx dmptx;
|
|
||||||
txfilter_reloadhirestex reloadhirestex;
|
|
||||||
} txfilter;
|
|
||||||
|
|
||||||
void ext_ghq_shutdown(void)
|
|
||||||
{
|
|
||||||
if (txfilter.shutdown)
|
|
||||||
(*txfilter.shutdown)();
|
|
||||||
|
|
||||||
if (txfilter.lib) {
|
|
||||||
DLCLOSE(txfilter.lib);
|
|
||||||
memset(&txfilter, 0, sizeof(txfilter));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ext_ghq_init(int maxwidth, int maxheight, int maxbpp, int options, int cachesize,
|
|
||||||
const wchar_t *path, const wchar_t *ident,
|
|
||||||
dispInfoFuncExt callback)
|
|
||||||
{
|
|
||||||
boolean bRet = 0;
|
|
||||||
|
|
||||||
if (!txfilter.lib) {
|
|
||||||
wchar_t curpath[MAX_PATH];
|
|
||||||
wcscpy(curpath, path);
|
|
||||||
#ifdef WIN32
|
|
||||||
#ifdef GHQCHK
|
|
||||||
wcscat(curpath, wst("\\ghqchk.dll"));
|
|
||||||
#else
|
|
||||||
wcscat(curpath, wst("\\GlideHQ.dll"));
|
|
||||||
#endif
|
|
||||||
txfilter.lib = DLOPEN(curpath);
|
|
||||||
#else
|
|
||||||
char cbuf[MAX_PATH];
|
|
||||||
#ifdef GHQCHK
|
|
||||||
wcscat(curpath, wst("/ghqchk.so"));
|
|
||||||
#else
|
|
||||||
wcscat(curpath, wst("/GlideHQ.so"));
|
|
||||||
#endif
|
|
||||||
wcstombs(cbuf, curpath, MAX_PATH);
|
|
||||||
txfilter.lib = DLOPEN(cbuf);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (txfilter.lib) {
|
|
||||||
if (!txfilter.init)
|
|
||||||
txfilter.init = (txfilter_init)DLSYM(txfilter.lib, "txfilter_init");
|
|
||||||
if (!txfilter.shutdown)
|
|
||||||
txfilter.shutdown = (txfilter_shutdown)DLSYM(txfilter.lib, "txfilter_shutdown");
|
|
||||||
if (!txfilter.filter)
|
|
||||||
txfilter.filter = (txfilter_filter)DLSYM(txfilter.lib, "txfilter_filter");
|
|
||||||
if (!txfilter.hirestex)
|
|
||||||
txfilter.hirestex = (txfilter_hirestex)DLSYM(txfilter.lib, "txfilter_hirestex");
|
|
||||||
if (!txfilter.checksum)
|
|
||||||
txfilter.checksum = (txfilter_checksum)DLSYM(txfilter.lib, "txfilter_checksum");
|
|
||||||
if (!txfilter.dmptx)
|
|
||||||
txfilter.dmptx = (txfilter_dmptx)DLSYM(txfilter.lib, "txfilter_dmptx");
|
|
||||||
if (!txfilter.reloadhirestex)
|
|
||||||
txfilter.reloadhirestex = (txfilter_reloadhirestex)DLSYM(txfilter.lib, "txfilter_reloadhirestex");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (txfilter.init && txfilter.shutdown && txfilter.filter &&
|
|
||||||
txfilter.hirestex && txfilter.checksum /*&& txfilter.dmptx && txfilter.reloadhirestex */)
|
|
||||||
bRet = (*txfilter.init)(maxwidth, maxheight, maxbpp, options, cachesize, path, ident, callback);
|
|
||||||
else
|
|
||||||
ext_ghq_shutdown();
|
|
||||||
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ext_ghq_txfilter(unsigned char *src, int srcwidth, int srcheight, unsigned short srcformat,
|
|
||||||
uint64 g64crc, GHQTexInfo *info)
|
|
||||||
{
|
|
||||||
boolean ret = 0;
|
|
||||||
|
|
||||||
if (txfilter.filter)
|
|
||||||
ret = (*txfilter.filter)(src, srcwidth, srcheight, srcformat,
|
|
||||||
g64crc, info);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ext_ghq_hirestex(uint64 g64crc, uint64 r_crc64, unsigned short *palette, GHQTexInfo *info)
|
|
||||||
{
|
|
||||||
boolean ret = 0;
|
|
||||||
|
|
||||||
if (txfilter.hirestex)
|
|
||||||
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 ret = 0;
|
|
||||||
|
|
||||||
if (txfilter.checksum)
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
boolean ret = 0;
|
|
||||||
|
|
||||||
if (txfilter.dmptx)
|
|
||||||
ret = (*txfilter.dmptx)(src, width, height, rowStridePixel, gfmt, n64fmt, r_crc64);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean ext_ghq_reloadhirestex()
|
|
||||||
{
|
|
||||||
boolean ret = 0;
|
|
||||||
|
|
||||||
if (txfilter.reloadhirestex)
|
|
||||||
ret = (*txfilter.reloadhirestex)();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
|
@ -155,58 +155,6 @@ typedef void (*dispInfoFuncExt)(const wchar_t *format, ...);
|
||||||
#endif
|
#endif
|
||||||
#endif // OS_WINDOWS
|
#endif // OS_WINDOWS
|
||||||
|
|
||||||
#ifdef TXFILTER_DLL
|
|
||||||
typedef unsigned char uint8;
|
|
||||||
typedef unsigned short uint16;
|
|
||||||
typedef unsigned long uint32;
|
|
||||||
|
|
||||||
boolean 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 */
|
|
||||||
int cachesize,/* cache textures to system memory */
|
|
||||||
const wchar_t *path, /* plugin directory. must be smaller than MAX_PATH */
|
|
||||||
const wchar_t *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 */
|
|
||||||
int srcwidth, /* width of input texture */
|
|
||||||
int srcheight, /* height of input texture */
|
|
||||||
unsigned short srcformat, /* format of input texture */
|
|
||||||
uint64 g64crc, /* glide64 crc */
|
|
||||||
GHQTexInfo *info /* output */
|
|
||||||
);
|
|
||||||
|
|
||||||
boolean ext_ghq_hirestex(uint64 g64crc, /* glide64 crc */
|
|
||||||
uint64 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 */
|
|
||||||
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) */
|
|
||||||
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 */
|
|
||||||
);
|
|
||||||
|
|
||||||
boolean ext_ghq_reloadhirestex();
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
typedef unsigned char uint8;
|
typedef unsigned char uint8;
|
||||||
typedef unsigned short uint16;
|
typedef unsigned short uint16;
|
||||||
typedef unsigned int uint32;
|
typedef unsigned int uint32;
|
||||||
|
@ -246,6 +194,4 @@ txfilter_dumpcache(void);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* TXFILTER_DLL */
|
|
||||||
|
|
||||||
#endif /* __EXT_TXFILTER_H__ */
|
#endif /* __EXT_TXFILTER_H__ */
|
||||||
|
|
|
@ -1,79 +0,0 @@
|
||||||
/*
|
|
||||||
* Texture Filtering
|
|
||||||
* Version: 1.0
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
|
||||||
* Email koolsmoky(at)users.sourceforge.net
|
|
||||||
* Web http://www.3dfxzone.it/koolsmoky
|
|
||||||
*
|
|
||||||
* this is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* this is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GNU Make; see the file COPYING. If not, write to
|
|
||||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "bldno.h"
|
|
||||||
|
|
||||||
#define ID(id) id
|
|
||||||
|
|
||||||
#define VS_FILE_INFO ID(16) /* Version stamp res type */
|
|
||||||
#define VS_VERSION_INFO ID(1) /* Version stamp res ID */
|
|
||||||
#define VS_USER_DEFINED ID(100) /* User-defined res IDs */
|
|
||||||
|
|
||||||
#define VOS_DOS_WINDOWS32 0x00010004L
|
|
||||||
#define VFT_DLL 0x00000002L
|
|
||||||
#define VER_PRERELEASE 0
|
|
||||||
#define VER_PRIVATEBUILD 0
|
|
||||||
#define VER_DEBUG 0
|
|
||||||
|
|
||||||
#define VERSIONNAME "GlideHQ.dll\0"
|
|
||||||
#define PRODNAME "GlideHQ\0"
|
|
||||||
#define DESCRIPT "Texture filtering DLL\0"
|
|
||||||
#define COPYRIGHTSTR "Copyright (C) 2007 Hiroshi Morii\0"
|
|
||||||
#define CONTACTSTR "Hiroshi Morii <koolsmoky@users.sourceforge.net> http://www.3dfxzone.it/koolsmoky\0"
|
|
||||||
|
|
||||||
#define MANVERSION 1
|
|
||||||
#define MANREVISION 02
|
|
||||||
#define MINVERSION 00
|
|
||||||
|
|
||||||
#define VERSIONSTR "1.02.00." BUILD_NUMBER_STR
|
|
||||||
|
|
||||||
VS_VERSION_INFO VERSIONINFO
|
|
||||||
FILEVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
|
|
||||||
PRODUCTVERSION MANVERSION, MANREVISION, 0, BUILD_NUMBER
|
|
||||||
FILEFLAGSMASK 0x0030003FL
|
|
||||||
FILEFLAGS (VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
|
|
||||||
|
|
||||||
FILEOS VOS_DOS_WINDOWS32
|
|
||||||
FILETYPE VFT_DLL
|
|
||||||
FILESUBTYPE 0
|
|
||||||
BEGIN
|
|
||||||
BLOCK "StringFileInfo"
|
|
||||||
BEGIN
|
|
||||||
BLOCK "040904E4"
|
|
||||||
BEGIN
|
|
||||||
VALUE "FileDescription", DESCRIPT
|
|
||||||
VALUE "FileVersion", VERSIONSTR
|
|
||||||
VALUE "InternalName", VERSIONNAME
|
|
||||||
VALUE "LegalCopyright", COPYRIGHTSTR
|
|
||||||
VALUE "OriginalFilename", VERSIONNAME
|
|
||||||
VALUE "ProductName", PRODNAME
|
|
||||||
VALUE "ProductVersion", VERSIONSTR
|
|
||||||
VALUE "Contact", CONTACTSTR
|
|
||||||
END
|
|
||||||
END
|
|
||||||
BLOCK "VarFileInfo"
|
|
||||||
BEGIN
|
|
||||||
/* the following line should be extended for localized versions */
|
|
||||||
VALUE "Translation", 0x409, 1252
|
|
||||||
END
|
|
||||||
END
|
|
|
@ -62,11 +62,7 @@ TxDbg::TxDbg()
|
||||||
_level = DBG_LEVEL;
|
_level = DBG_LEVEL;
|
||||||
|
|
||||||
if (!_dbgfile)
|
if (!_dbgfile)
|
||||||
#ifdef GHQCHK
|
|
||||||
_dbgfile = fopen("ghqchk.txt", "w");
|
|
||||||
#else
|
|
||||||
_dbgfile = fopen("glidenhq.dbg", "w");
|
_dbgfile = fopen("glidenhq.dbg", "w");
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TxDbg::~TxDbg()
|
TxDbg::~TxDbg()
|
||||||
|
@ -93,10 +89,6 @@ TxDbg::output(const int level, const wchar_t *format, ...)
|
||||||
wcscat(newformat, format);
|
wcscat(newformat, format);
|
||||||
vfwprintf(_dbgfile, newformat, args);
|
vfwprintf(_dbgfile, newformat, args);
|
||||||
fflush(_dbgfile);
|
fflush(_dbgfile);
|
||||||
#ifdef GHQCHK
|
|
||||||
//vwprintf(newformat, args);
|
|
||||||
vwprintf(newformat.c_str(), args);
|
|
||||||
#endif
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
#endif // OS_ANDROID
|
#endif // OS_ANDROID
|
||||||
|
|
|
@ -47,15 +47,11 @@ public:
|
||||||
#define INFO DBG_INFO
|
#define INFO DBG_INFO
|
||||||
#else
|
#else
|
||||||
#define DBG_INFO(A, ...)
|
#define DBG_INFO(A, ...)
|
||||||
#ifdef GHQCHK
|
|
||||||
#define INFO TxDbg::getInstance()->output
|
|
||||||
#else
|
|
||||||
#if 0 /* XXX enable this to log basic hires texture checks */
|
#if 0 /* XXX enable this to log basic hires texture checks */
|
||||||
#define INFO TxDbg::getInstance()->output
|
#define INFO TxDbg::getInstance()->output
|
||||||
#else
|
#else
|
||||||
#define INFO DBG_INFO
|
#define INFO DBG_INFO
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* __TXDBG_H__ */
|
#endif /* __TXDBG_H__ */
|
||||||
|
|
|
@ -34,7 +34,6 @@
|
||||||
#include "TxFilter.h"
|
#include "TxFilter.h"
|
||||||
#include "TextureFilters.h"
|
#include "TextureFilters.h"
|
||||||
#include "TxDbg.h"
|
#include "TxDbg.h"
|
||||||
#include "bldno.h"
|
|
||||||
|
|
||||||
void TxFilter::clear()
|
void TxFilter::clear()
|
||||||
{
|
{
|
||||||
|
@ -88,11 +87,7 @@ TxFilter::TxFilter(int maxwidth,
|
||||||
/* shamelessness :P this first call to the debug output message creates
|
/* shamelessness :P this first call to the debug output message creates
|
||||||
* a file in the executable directory. */
|
* a file in the executable directory. */
|
||||||
INFO(0, wst("------------------------------------------------------------------\n"));
|
INFO(0, wst("------------------------------------------------------------------\n"));
|
||||||
#ifdef GHQCHK
|
INFO(0, wst(" GLideNHQ\n"));
|
||||||
INFO(0, wst(" GLideNHQ Hires Texture Checker 1.02.00.%d\n"), BUILD_NUMBER);
|
|
||||||
#else
|
|
||||||
INFO(0, wst(" GLideNHQ version 1.00.00.%d\n"), BUILD_NUMBER);
|
|
||||||
#endif
|
|
||||||
INFO(0, wst(" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n"));
|
INFO(0, wst(" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n"));
|
||||||
INFO(0, wst(" email : koolsmoky(at)users.sourceforge.net\n"));
|
INFO(0, wst(" email : koolsmoky(at)users.sourceforge.net\n"));
|
||||||
INFO(0, wst(" website : http://www.3dfxzone.it/koolsmoky\n"));
|
INFO(0, wst(" website : http://www.3dfxzone.it/koolsmoky\n"));
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
int main (void)
|
|
||||||
{
|
|
||||||
struct tm locTime;
|
|
||||||
time_t sysTime;
|
|
||||||
char *build;
|
|
||||||
|
|
||||||
time(&sysTime);
|
|
||||||
locTime = *localtime(&sysTime);
|
|
||||||
|
|
||||||
if ((build = getenv("BUILD_NUMBER")) != NULL) {
|
|
||||||
printf("#define BUILD_NUMBER %s\n", build);
|
|
||||||
printf("#define BUILD_NUMBER_STR \"%s\"\n", build);
|
|
||||||
} else {
|
|
||||||
unsigned short magic;
|
|
||||||
magic = (locTime.tm_yday << 7) |
|
|
||||||
(locTime.tm_hour << 2) |
|
|
||||||
(locTime.tm_min / 15);
|
|
||||||
printf("#define BUILD_NUMBER %d\n", magic);
|
|
||||||
printf("#define BUILD_NUMBER_STR \"%d\"\n", magic);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,2 +0,0 @@
|
||||||
#define BUILD_NUMBER 13480
|
|
||||||
#define BUILD_NUMBER_STR "13480"
|
|
|
@ -1,33 +0,0 @@
|
||||||
cmake_minimum_required(VERSION 2.6)
|
|
||||||
|
|
||||||
project( test_hq )
|
|
||||||
|
|
||||||
# Build type
|
|
||||||
|
|
||||||
if( NOT CMAKE_BUILD_TYPE)
|
|
||||||
set( CMAKE_BUILD_TYPE Release)
|
|
||||||
endif( NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
if( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
set( CMAKE_BUILD_TYPE Debug)
|
|
||||||
set( DEBUG_BUILD TRUE)
|
|
||||||
add_definitions(
|
|
||||||
-DDEBUG
|
|
||||||
)
|
|
||||||
endif( CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
||||||
|
|
||||||
add_definitions(
|
|
||||||
-DGHQCHK=1
|
|
||||||
-DTXFILTER_DLL=1
|
|
||||||
)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
add_definitions(
|
|
||||||
-DWIN32
|
|
||||||
-DOS_WINDOWS
|
|
||||||
)
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS}" )
|
|
||||||
|
|
||||||
add_executable( test_hq test.cpp ../Ext_TxFilter.cpp )
|
|
|
@ -1,70 +0,0 @@
|
||||||
# This MUST be processed by GNU make
|
|
||||||
#
|
|
||||||
# Texture Filtering Test Linux Makefile
|
|
||||||
# Version: 1.0
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
|
||||||
# Email koolsmoky(at)users.sourceforge.net
|
|
||||||
# Web http://www.3dfxzone.it/koolsmoky
|
|
||||||
#
|
|
||||||
# this is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# this is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with GNU Make; see the file COPYING. If not, write to
|
|
||||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Available options:
|
|
||||||
#
|
|
||||||
# Environment variables:
|
|
||||||
#
|
|
||||||
# Targets:
|
|
||||||
# all: build dynamic module
|
|
||||||
# clean: remove object files
|
|
||||||
# realclean: remove all generated files
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# GCC does not have SEH (structured exception handling)
|
|
||||||
#
|
|
||||||
|
|
||||||
.PHONY: all clean realclean
|
|
||||||
|
|
||||||
CC = g++
|
|
||||||
CFLAGS += -I. -I../
|
|
||||||
CFLAGS += -fPIC -DPIC
|
|
||||||
CFLAGS += -DGHQCHK=1
|
|
||||||
|
|
||||||
LD = g++
|
|
||||||
LDFLAGS += -ldl -lstdc++
|
|
||||||
|
|
||||||
RM = rm
|
|
||||||
|
|
||||||
SOURCES = \
|
|
||||||
test.cpp \
|
|
||||||
../Ext_TxFilter.cpp
|
|
||||||
|
|
||||||
OBJECTS = $(SOURCES:.cpp=.o)
|
|
||||||
|
|
||||||
.cpp.o:
|
|
||||||
$(CC) -o $@ $(CFLAGS) -c $<
|
|
||||||
|
|
||||||
all: test.exe
|
|
||||||
|
|
||||||
test.exe: $(OBJECTS)
|
|
||||||
$(LD) -o $@ $(LDFLAGS) $^
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-$(RM) *.o
|
|
||||||
|
|
||||||
realclean: clean
|
|
||||||
-$(RM) test.exe
|
|
|
@ -1,68 +0,0 @@
|
||||||
# This MUST be processed by GNU make
|
|
||||||
#
|
|
||||||
# Texture Filtering Test MSVC Makefile
|
|
||||||
# Version: 1.0
|
|
||||||
#
|
|
||||||
# Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
|
||||||
# Email koolsmoky(at)users.sourceforge.net
|
|
||||||
# Web http://www.3dfxzone.it/koolsmoky
|
|
||||||
#
|
|
||||||
# this is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
# any later version.
|
|
||||||
#
|
|
||||||
# this is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with GNU Make; see the file COPYING. If not, write to
|
|
||||||
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Available options:
|
|
||||||
#
|
|
||||||
# Targets:
|
|
||||||
# all: build everything
|
|
||||||
# clean: remove object files
|
|
||||||
# realclean: remove all generated files
|
|
||||||
#
|
|
||||||
|
|
||||||
.PHONY: all clean realclean
|
|
||||||
.SUFFIXES: .cpp .obj
|
|
||||||
|
|
||||||
CC = cl
|
|
||||||
LD = _link # change this to suite your build environment
|
|
||||||
|
|
||||||
UNLINK = $(RM) $(1)
|
|
||||||
|
|
||||||
CFLAGS += -D__MSC__ -DWIN32 -D_CONSOLE -EHa -D_CRT_SECURE_NO_DEPRECATE
|
|
||||||
CFLAGS += -I. -I../
|
|
||||||
CFLAGS += -DGHQCHK=1
|
|
||||||
|
|
||||||
#LDFLAGS += -ltcg:STATUS
|
|
||||||
|
|
||||||
SOURCES = \
|
|
||||||
test.cpp \
|
|
||||||
../Ext_TxFilter.cpp
|
|
||||||
|
|
||||||
OBJECTS = $(SOURCES:.cpp=.obj)
|
|
||||||
|
|
||||||
.cpp.obj:
|
|
||||||
$(CC) -Fo$@ $(CFLAGS) -c $<
|
|
||||||
|
|
||||||
all: test.exe
|
|
||||||
|
|
||||||
test.exe: $(OBJECTS)
|
|
||||||
$(LD) -out:$@ $(LDFLAGS) $(OBJECTS)
|
|
||||||
|
|
||||||
$(OBJECTS): $(SOURCES)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
-$(RM) *.obj *.pdb *.ilk
|
|
||||||
|
|
||||||
realclean: clean
|
|
||||||
-$(RM) test.exe
|
|
|
@ -1,120 +0,0 @@
|
||||||
/*
|
|
||||||
* Texture Filtering
|
|
||||||
* Version: 1.0
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007 Hiroshi Morii All Rights Reserved.
|
|
||||||
* Email koolsmoky(at)users.sourceforge.net
|
|
||||||
* Web http://www.3dfxzone.it/koolsmoky
|
|
||||||
*
|
|
||||||
* this is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
* any later version.
|
|
||||||
*
|
|
||||||
* this is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GNU Make; see the file COPYING. If not, write to
|
|
||||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "../Ext_TxFilter.h"
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
void DisplayLoadProgress(const wchar_t *format, ...)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
va_list args;
|
|
||||||
wchar_t wbuf[INFO_BUF];
|
|
||||||
char buf[INFO_BUF];
|
|
||||||
|
|
||||||
/* process input */
|
|
||||||
va_start(args, format);
|
|
||||||
vswprintf(wbuf, format, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
/* XXX: convert to multibyte */
|
|
||||||
wcstombs(buf, wbuf, INFO_BUF);
|
|
||||||
printf(buf);
|
|
||||||
#else
|
|
||||||
static unsigned int i = 0;
|
|
||||||
i++;
|
|
||||||
if (i == 1) printf("\b-");
|
|
||||||
else if (i == 2) printf("\b\\");
|
|
||||||
else if (i == 3) printf("\b|");
|
|
||||||
else {
|
|
||||||
printf("\b/");
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
float dummy = 1.1; /* force the compiler to load floating point support */
|
|
||||||
boolean bret = 0;
|
|
||||||
int options = 0;
|
|
||||||
|
|
||||||
/* Plugin path */
|
|
||||||
wchar_t path[MAX_PATH];
|
|
||||||
#ifdef WIN32
|
|
||||||
GETCWD(MAX_PATH, path);
|
|
||||||
#else
|
|
||||||
char cbuf[MAX_PATH];
|
|
||||||
GETCWD(MAX_PATH, cbuf);
|
|
||||||
mbstowcs(path, cbuf, MAX_PATH);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ROM name */
|
|
||||||
wchar_t name[21] = L"DEFAULT";
|
|
||||||
|
|
||||||
printf("------------------------------------------------------------------\n");
|
|
||||||
printf(" GlideHQ Hires Texture Checker version 1.2\n");
|
|
||||||
printf(" Copyright (C) 2010 Hiroshi Morii All Rights Reserved\n");
|
|
||||||
printf(" email : koolsmoky(at)users.sourceforge.net\n");
|
|
||||||
printf(" website : http://www.3dfxzone.it/koolsmoky\n");
|
|
||||||
printf("\n");
|
|
||||||
printf(" Glide64 official website : http://glide64.emuxhaven.net\n");
|
|
||||||
printf("\n");
|
|
||||||
printf(" Usage: ghqchk.exe \"INTERNAL ROM NAME\"\n");
|
|
||||||
printf("------------------------------------------------------------------\n");
|
|
||||||
|
|
||||||
if (argc != 2) return 0;
|
|
||||||
|
|
||||||
printf("Checking \"%s\"... ", argv[1]);
|
|
||||||
|
|
||||||
mbstowcs(name, argv[1], 21);
|
|
||||||
|
|
||||||
//options |= COMPRESS_TEX;
|
|
||||||
//options |= COMPRESS_HIRESTEX;
|
|
||||||
//options |= S3TC_COMPRESSION;
|
|
||||||
//options |= TILE_HIRESTEX;
|
|
||||||
//options |= FORCE16BPP_TEX;
|
|
||||||
//options |= FORCE16BPP_HIRESTEX;
|
|
||||||
//options |= GZ_TEXCACHE;
|
|
||||||
options |= GZ_HIRESTEXCACHE;
|
|
||||||
//options |= (DUMP_TEXCACHE|DUMP_HIRESTEXCACHE);
|
|
||||||
options |= LET_TEXARTISTS_FLY;
|
|
||||||
//options |= DUMP_TEX;
|
|
||||||
options |= RICE_HIRESTEXTURES;
|
|
||||||
|
|
||||||
bret = ext_ghq_init(1024, // max texture width supported by hardware
|
|
||||||
1024, // max texture height supported by hardware
|
|
||||||
32, // max texture bpp supported by hardware
|
|
||||||
options,
|
|
||||||
0, // cache texture to system memory
|
|
||||||
path, // plugin path
|
|
||||||
name, // name of ROM. must be no longer than 256 characters
|
|
||||||
DisplayLoadProgress);
|
|
||||||
|
|
||||||
ext_ghq_shutdown();
|
|
||||||
|
|
||||||
printf("\bDone!\nLogged to ghqchk.txt\n");
|
|
||||||
|
|
||||||
return bret;
|
|
||||||
}
|
|
|
@ -1,119 +0,0 @@
|
||||||
#ifdef OS_ANDROID
|
|
||||||
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "txWidestringWrapper.h"
|
|
||||||
|
|
||||||
tx_wstring::tx_wstring(const wchar_t * wstr) : _wstring(wstr)
|
|
||||||
{
|
|
||||||
wcstombs(cbuf, wstr, BUF_SIZE);
|
|
||||||
_astring.assign(cbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring::tx_wstring(const tx_wstring & other) : _wstring(other.c_str())
|
|
||||||
{
|
|
||||||
wcstombs(cbuf, other.c_str(), BUF_SIZE);
|
|
||||||
_astring.assign(cbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tx_wstring::assign(const wchar_t * wstr)
|
|
||||||
{
|
|
||||||
_wstring.assign(wstr);
|
|
||||||
wcstombs(cbuf, wstr, BUF_SIZE);
|
|
||||||
_astring.assign(cbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tx_wstring::assign(const tx_wstring & wstr)
|
|
||||||
{
|
|
||||||
_wstring.assign(wstr.c_str());
|
|
||||||
wcstombs(cbuf, wstr.c_str(), BUF_SIZE);
|
|
||||||
_astring.assign(cbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
void tx_wstring::append(const tx_wstring & wstr)
|
|
||||||
{
|
|
||||||
wcstombs(cbuf, wstr.c_str(), BUF_SIZE);
|
|
||||||
_astring.append(cbuf);
|
|
||||||
mbstowcs(wbuf, _astring.c_str(), BUF_SIZE);
|
|
||||||
_wstring.assign(wbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring & tx_wstring::operator=(const tx_wstring & other)
|
|
||||||
{
|
|
||||||
assign(other);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring & tx_wstring::operator+=(const tx_wstring & other)
|
|
||||||
{
|
|
||||||
append(other);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring & tx_wstring::operator+=(const wchar_t * wstr)
|
|
||||||
{
|
|
||||||
append(wstr);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring tx_wstring::operator+(const tx_wstring & wstr) const
|
|
||||||
{
|
|
||||||
tx_wstring ans(_wstring.c_str());
|
|
||||||
ans.append(wstr);
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx_wstring tx_wstring::operator+(const wchar_t * wstr) const
|
|
||||||
{
|
|
||||||
tx_wstring ans(_wstring.c_str());
|
|
||||||
ans.append(wstr);
|
|
||||||
return ans;
|
|
||||||
}
|
|
||||||
|
|
||||||
const wchar_t * tx_wstring::c_str() const
|
|
||||||
{
|
|
||||||
return _wstring.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool tx_wstring::empty() const
|
|
||||||
{
|
|
||||||
return _astring.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
int tx_wstring::compare(const wchar_t * wstr)
|
|
||||||
{
|
|
||||||
wcstombs(cbuf, wstr, BUF_SIZE);
|
|
||||||
return _astring.compare(cbuf);
|
|
||||||
}
|
|
||||||
|
|
||||||
dummyWString::dummyWString(const char * _str)
|
|
||||||
{
|
|
||||||
wchar_t buf[BUF_SIZE];
|
|
||||||
mbstowcs(buf, _str, BUF_SIZE);
|
|
||||||
_wstr.assign(buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
int tx_swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...)
|
|
||||||
{
|
|
||||||
char cbuf[BUF_SIZE];
|
|
||||||
char fmt[BUF_SIZE];
|
|
||||||
wcstombs(fmt, format, BUF_SIZE);
|
|
||||||
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
int res = vsprintf(cbuf, fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
mbstowcs(ws, cbuf, len);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wccmp(const wchar_t* w1, const wchar_t* w2)
|
|
||||||
{
|
|
||||||
char cbuf1[16];
|
|
||||||
wcstombs(cbuf1, w1, 16);
|
|
||||||
char cbuf2[16];
|
|
||||||
wcstombs(cbuf2, w2, 16);
|
|
||||||
return cbuf1[0] == cbuf2[0];
|
|
||||||
}
|
|
||||||
#endif // OS_ANDROID
|
|
|
@ -4,55 +4,6 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#ifdef OS_ANDROID
|
|
||||||
|
|
||||||
int tx_swprintf(wchar_t* ws, size_t len, const wchar_t* format, ...);
|
|
||||||
bool wccmp(const wchar_t* w1, const wchar_t* w2);
|
|
||||||
|
|
||||||
#define BUF_SIZE 2048
|
|
||||||
|
|
||||||
class tx_wstring {
|
|
||||||
public:
|
|
||||||
tx_wstring() {}
|
|
||||||
tx_wstring(const wchar_t * wstr);
|
|
||||||
tx_wstring(const tx_wstring & other);
|
|
||||||
void assign(const wchar_t * wstr);
|
|
||||||
void assign(const tx_wstring & wstr);
|
|
||||||
void append(const tx_wstring & wstr);
|
|
||||||
tx_wstring & operator=(const tx_wstring & other);
|
|
||||||
tx_wstring & operator+=(const tx_wstring & other);
|
|
||||||
tx_wstring & operator+=(const wchar_t * wstr);
|
|
||||||
tx_wstring operator+(const tx_wstring & wstr) const;
|
|
||||||
tx_wstring operator+(const wchar_t * wstr) const;
|
|
||||||
const wchar_t * c_str() const;
|
|
||||||
bool empty() const;
|
|
||||||
int compare(const wchar_t * wstr);
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::wstring _wstring;
|
|
||||||
std::string _astring;
|
|
||||||
char cbuf[BUF_SIZE];
|
|
||||||
wchar_t wbuf[BUF_SIZE];
|
|
||||||
};
|
|
||||||
|
|
||||||
class dummyWString
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
dummyWString(const char * _str);
|
|
||||||
|
|
||||||
const wchar_t * c_str() const {
|
|
||||||
return _wstr.c_str();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::wstring _wstr;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define wst(A) dummyWString(A).c_str()
|
|
||||||
|
|
||||||
#define removeColon(A)
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define tx_swprintf swprintf
|
#define tx_swprintf swprintf
|
||||||
#define wst(A) L##A
|
#define wst(A) L##A
|
||||||
#define wccmp(A, B) A[0] == B[0]
|
#define wccmp(A, B) A[0] == B[0]
|
||||||
|
@ -65,6 +16,4 @@ void removeColon(tx_wstring& _s)
|
||||||
std::replace(_s.begin(), _s.end(), L':', L'-');
|
std::replace(_s.begin(), _s.end(), L':', L'-');
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // OS_ANDROID
|
|
||||||
|
|
||||||
#endif // ___TXWIDESCREENWRAPPER_H__
|
#endif // ___TXWIDESCREENWRAPPER_H__
|
||||||
|
|
Loading…
Reference in New Issue
Block a user