From 22f50fafb52fdb56b259318563f359737783252d Mon Sep 17 00:00:00 2001 From: Rosalie Wanders Date: Sun, 5 Sep 2021 17:17:51 +0200 Subject: [PATCH] GLideNHQ: cleanup --- src/GLideNHQ/CMakeLists.txt | 182 +++++++++++---------------- src/GLideNHQ/Ext_TxFilter.cpp | 172 ------------------------- src/GLideNHQ/Ext_TxFilter.h | 54 -------- src/GLideNHQ/GlideHQ.rc | 79 ------------ src/GLideNHQ/TxDbg.cpp | 8 -- src/GLideNHQ/TxDbg.h | 4 - src/GLideNHQ/TxFilter.cpp | 7 +- src/GLideNHQ/bldno.cpp | 27 ---- src/GLideNHQ/bldno.h | 2 - src/GLideNHQ/test/CMakeLists.txt | 33 ----- src/GLideNHQ/test/Makefile.gcc | 70 ----------- src/GLideNHQ/test/Makefile.vc8 | 68 ---------- src/GLideNHQ/test/test.cpp | 120 ------------------ src/GLideNHQ/txWidestringWrapper.cpp | 119 ------------------ src/GLideNHQ/txWidestringWrapper.h | 51 -------- 15 files changed, 76 insertions(+), 920 deletions(-) delete mode 100644 src/GLideNHQ/Ext_TxFilter.cpp delete mode 100644 src/GLideNHQ/GlideHQ.rc delete mode 100644 src/GLideNHQ/bldno.cpp delete mode 100644 src/GLideNHQ/bldno.h delete mode 100644 src/GLideNHQ/test/CMakeLists.txt delete mode 100644 src/GLideNHQ/test/Makefile.gcc delete mode 100644 src/GLideNHQ/test/Makefile.vc8 delete mode 100644 src/GLideNHQ/test/test.cpp delete mode 100644 src/GLideNHQ/txWidestringWrapper.cpp diff --git a/src/GLideNHQ/CMakeLists.txt b/src/GLideNHQ/CMakeLists.txt index 1e98896d..af9d9617 100644 --- a/src/GLideNHQ/CMakeLists.txt +++ b/src/GLideNHQ/CMakeLists.txt @@ -72,116 +72,84 @@ endif() 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") - if( NOT GHQCHK ) - if ( NOT MINGW ) - SET ( PIC_FLAGS "-fPIC" ) - endif ( NOT MINGW) - SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_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 ) + if ( NOT MINGW ) + SET ( PIC_FLAGS "-fPIC" ) + endif ( NOT MINGW) + 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_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_CPP11_COMPILE_FLAGS} " ) endif() -if( NOT GHQCHK ) +add_definitions( -DTXFILTER_LIB) +if( CMAKE_BUILD_TYPE STREQUAL "Debug") + SET( BUILD_VARIANT "debug" ) +else() + SET( BUILD_VARIANT "release" ) +endif() +if( CMAKE_BUILD_TYPE STREQUAL "Debug") + add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES}) + set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1) + set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1) + if(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) + FIND_PACKAGE( ZLIB REQUIRED ) + FIND_PACKAGE( PNG REQUIRED ) + target_link_libraries(GLideNHQd + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + osald + ) + elseif(ANDROID) + target_link_libraries(GLideNHQ PRIVATE + ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a + z + dl + osal + ) + else(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) + target_link_libraries(GLideNHQd PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a + ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a + dl + osald + ) + endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) +endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions( -DTXFILTER_LIB) +if( CMAKE_BUILD_TYPE STREQUAL "Release") + add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES}) - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - SET( BUILD_VARIANT "debug" ) - else() - SET( BUILD_VARIANT "release" ) - endif() - - if( CMAKE_BUILD_TYPE STREQUAL "Debug") - add_library( GLideNHQd STATIC ${GLideNHQ_SOURCES}) - - set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_START_STATIC 1) - set_target_properties(GLideNHQd PROPERTIES LINK_SEARCH_END_STATIC 1) - - if(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - FIND_PACKAGE( ZLIB REQUIRED ) - FIND_PACKAGE( PNG REQUIRED ) - target_link_libraries(GLideNHQd - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - osald - ) - elseif(ANDROID) - target_link_libraries(GLideNHQ PRIVATE - ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a - z - dl - osal - ) - else(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - target_link_libraries(GLideNHQd PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a - dl - osald - ) - endif(MINGW OR BCMHOST OR APPLE OR USE_SYSTEM_LIBS) - endif( CMAKE_BUILD_TYPE STREQUAL "Debug") - - if( CMAKE_BUILD_TYPE STREQUAL "Release") - add_library( GLideNHQ STATIC ${GLideNHQ_SOURCES}) - -# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1) -# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_END_STATIC 1) -# set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -# find_library(PNGLIB libpng.a) - - if(PANDORA) - target_link_libraries(GLideNHQ PRIVATE - /mnt/utmp/codeblocks/usr/lib/libpng.a - /mnt/utmp/codeblocks/usr/lib/libz.a - osal - ) - elseif(BCMHOST OR MINGW OR APPLE OR USE_SYSTEM_LIBS) - FIND_PACKAGE( ZLIB REQUIRED ) - FIND_PACKAGE( PNG REQUIRED ) - target_link_libraries(GLideNHQ - ${PNG_LIBRARIES} - ${ZLIB_LIBRARIES} - osal - ) - elseif(ANDROID) - target_link_libraries(GLideNHQ PRIVATE - ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a - z - dl - osal - ) - else(PANDORA) - target_link_libraries(GLideNHQ PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a - ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a - dl - osal - ) - endif(PANDORA) - 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 ) +# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_START_STATIC 1) +# set_target_properties(GLideNHQ PROPERTIES LINK_SEARCH_END_STATIC 1) +# set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") +# find_library(PNGLIB libpng.a) + if(PANDORA) + target_link_libraries(GLideNHQ PRIVATE + /mnt/utmp/codeblocks/usr/lib/libpng.a + /mnt/utmp/codeblocks/usr/lib/libz.a + osal + ) + elseif(BCMHOST OR MINGW OR APPLE OR USE_SYSTEM_LIBS) + FIND_PACKAGE( ZLIB REQUIRED ) + FIND_PACKAGE( PNG REQUIRED ) + target_link_libraries(GLideNHQ + ${PNG_LIBRARIES} + ${ZLIB_LIBRARIES} + osal + ) + elseif(ANDROID) + target_link_libraries(GLideNHQ PRIVATE + ${ANDROID_LIB_PATH}/libs/${BUILD_VARIANT}/${ANDROID_ABI}/libpng.a + z + dl + osal + ) + else(PANDORA) + target_link_libraries(GLideNHQ PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/lib/libpng.a + ${CMAKE_CURRENT_SOURCE_DIR}/lib/libz.a + dl + osal + ) + endif(PANDORA) +endif( CMAKE_BUILD_TYPE STREQUAL "Release") diff --git a/src/GLideNHQ/Ext_TxFilter.cpp b/src/GLideNHQ/Ext_TxFilter.cpp deleted file mode 100644 index 947017ce..00000000 --- a/src/GLideNHQ/Ext_TxFilter.cpp +++ /dev/null @@ -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 -#include -#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; -} diff --git a/src/GLideNHQ/Ext_TxFilter.h b/src/GLideNHQ/Ext_TxFilter.h index 439ae9b7..bd87a468 100644 --- a/src/GLideNHQ/Ext_TxFilter.h +++ b/src/GLideNHQ/Ext_TxFilter.h @@ -155,58 +155,6 @@ typedef void (*dispInfoFuncExt)(const wchar_t *format, ...); #endif #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 short uint16; typedef unsigned int uint32; @@ -246,6 +194,4 @@ txfilter_dumpcache(void); } #endif -#endif /* TXFILTER_DLL */ - #endif /* __EXT_TXFILTER_H__ */ diff --git a/src/GLideNHQ/GlideHQ.rc b/src/GLideNHQ/GlideHQ.rc deleted file mode 100644 index 9346c06e..00000000 --- a/src/GLideNHQ/GlideHQ.rc +++ /dev/null @@ -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 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 diff --git a/src/GLideNHQ/TxDbg.cpp b/src/GLideNHQ/TxDbg.cpp index 838ba141..ef8f7714 100644 --- a/src/GLideNHQ/TxDbg.cpp +++ b/src/GLideNHQ/TxDbg.cpp @@ -62,11 +62,7 @@ TxDbg::TxDbg() _level = DBG_LEVEL; if (!_dbgfile) -#ifdef GHQCHK - _dbgfile = fopen("ghqchk.txt", "w"); -#else _dbgfile = fopen("glidenhq.dbg", "w"); -#endif } TxDbg::~TxDbg() @@ -93,10 +89,6 @@ TxDbg::output(const int level, const wchar_t *format, ...) wcscat(newformat, format); vfwprintf(_dbgfile, newformat, args); fflush(_dbgfile); -#ifdef GHQCHK - //vwprintf(newformat, args); - vwprintf(newformat.c_str(), args); -#endif va_end(args); } #endif // OS_ANDROID diff --git a/src/GLideNHQ/TxDbg.h b/src/GLideNHQ/TxDbg.h index 0a64d6ac..85518546 100644 --- a/src/GLideNHQ/TxDbg.h +++ b/src/GLideNHQ/TxDbg.h @@ -47,15 +47,11 @@ public: #define INFO DBG_INFO #else #define DBG_INFO(A, ...) -#ifdef GHQCHK -#define INFO TxDbg::getInstance()->output -#else #if 0 /* XXX enable this to log basic hires texture checks */ #define INFO TxDbg::getInstance()->output #else #define INFO DBG_INFO #endif #endif -#endif #endif /* __TXDBG_H__ */ diff --git a/src/GLideNHQ/TxFilter.cpp b/src/GLideNHQ/TxFilter.cpp index e266d1e9..f7deabb1 100644 --- a/src/GLideNHQ/TxFilter.cpp +++ b/src/GLideNHQ/TxFilter.cpp @@ -34,7 +34,6 @@ #include "TxFilter.h" #include "TextureFilters.h" #include "TxDbg.h" -#include "bldno.h" void TxFilter::clear() { @@ -88,11 +87,7 @@ TxFilter::TxFilter(int maxwidth, /* shamelessness :P this first call to the debug output message creates * a file in the executable directory. */ INFO(0, wst("------------------------------------------------------------------\n")); -#ifdef GHQCHK - 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(" GLideNHQ\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(" website : http://www.3dfxzone.it/koolsmoky\n")); diff --git a/src/GLideNHQ/bldno.cpp b/src/GLideNHQ/bldno.cpp deleted file mode 100644 index f71eefc0..00000000 --- a/src/GLideNHQ/bldno.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -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; -} diff --git a/src/GLideNHQ/bldno.h b/src/GLideNHQ/bldno.h deleted file mode 100644 index eb0ec01d..00000000 --- a/src/GLideNHQ/bldno.h +++ /dev/null @@ -1,2 +0,0 @@ -#define BUILD_NUMBER 13480 -#define BUILD_NUMBER_STR "13480" diff --git a/src/GLideNHQ/test/CMakeLists.txt b/src/GLideNHQ/test/CMakeLists.txt deleted file mode 100644 index 7f166b49..00000000 --- a/src/GLideNHQ/test/CMakeLists.txt +++ /dev/null @@ -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 ) diff --git a/src/GLideNHQ/test/Makefile.gcc b/src/GLideNHQ/test/Makefile.gcc deleted file mode 100644 index e76af4bf..00000000 --- a/src/GLideNHQ/test/Makefile.gcc +++ /dev/null @@ -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 diff --git a/src/GLideNHQ/test/Makefile.vc8 b/src/GLideNHQ/test/Makefile.vc8 deleted file mode 100644 index 007f5389..00000000 --- a/src/GLideNHQ/test/Makefile.vc8 +++ /dev/null @@ -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 diff --git a/src/GLideNHQ/test/test.cpp b/src/GLideNHQ/test/test.cpp deleted file mode 100644 index 86ed01a0..00000000 --- a/src/GLideNHQ/test/test.cpp +++ /dev/null @@ -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 -#include -#include - -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; -} diff --git a/src/GLideNHQ/txWidestringWrapper.cpp b/src/GLideNHQ/txWidestringWrapper.cpp deleted file mode 100644 index ea005848..00000000 --- a/src/GLideNHQ/txWidestringWrapper.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#ifdef OS_ANDROID - -#include -#include -#include -#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 diff --git a/src/GLideNHQ/txWidestringWrapper.h b/src/GLideNHQ/txWidestringWrapper.h index 100c119a..d6abd2c4 100644 --- a/src/GLideNHQ/txWidestringWrapper.h +++ b/src/GLideNHQ/txWidestringWrapper.h @@ -4,55 +4,6 @@ #include #include -#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 wst(A) L##A #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'-'); } -#endif // OS_ANDROID - #endif // ___TXWIDESCREENWRAPPER_H__