Remove Boost

This commit is contained in:
GhostlyDark 2024-05-05 21:12:36 +02:00
parent b44b0d1c43
commit bd747ff3e6
14 changed files with 468 additions and 56 deletions

View file

@ -44,8 +44,8 @@ jobs:
echo "G_REV=$(git rev-parse --short HEAD)" >> "${GITHUB_ENV}"
if [[ ${{ matrix.bits }} -eq 32 ]]; then sudo dpkg --add-architecture i386; fi
sudo apt-get update
sudo apt-get -y install libgl1-mesa-dev libboost-filesystem-dev libboost-system-dev libpng-dev libsdl1.2-dev libsdl2-dev zlib1g-dev
if [[ ${{ matrix.bits }} -eq 32 ]]; then sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386 libatomic1:i386 libgcc-s1:i386 libgomp1:i386 libitm1:i386 libquadmath0:i386 libstdc++6:i386 libubsan1:i386 libgl1-mesa-dev:i386 libboost-filesystem-dev:i386 libboost-system-dev:i386 libpng-dev:i386 libsdl1.2-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386; fi
sudo apt-get -y install libgl1-mesa-dev libpng-dev libsdl1.2-dev libsdl2-dev zlib1g-dev
if [[ ${{ matrix.bits }} -eq 32 ]]; then sudo apt-get --reinstall -y install gcc-multilib g++-multilib libc6 libc6-dev-i386 libatomic1:i386 libgcc-s1:i386 libgomp1:i386 libitm1:i386 libquadmath0:i386 libstdc++6:i386 libubsan1:i386 libgl1-mesa-dev:i386 libpng-dev:i386 libsdl1.2-dev:i386 libsdl2-dev:i386 zlib1g-dev:i386; fi
sudo ldconfig
- name: Build and related stuff, backup binaries
run: |
@ -117,7 +117,6 @@ jobs:
make
mingw-w64-${{ matrix.cross }}-gcc
mingw-w64-${{ matrix.cross }}-toolchain
mingw-w64-${{ matrix.cross }}-boost
mingw-w64-${{ matrix.cross }}-glew
mingw-w64-${{ matrix.cross }}-libpng
mingw-w64-${{ matrix.cross }}-SDL2
@ -149,7 +148,7 @@ jobs:
- name: Backup dependencies, etc...
run: |
if [[ ${{ matrix.bits }} -eq 32 ]]; then LIBGCC="libgcc_s_dw2-1"; else LIBGCC="libgcc_s_seh-1"; fi
for LIB in glew32 libboost_filesystem-mt ${LIBGCC} libpng16-16 libstdc++-6 libwinpthread-1 SDL2 zlib1; do
for LIB in glew32 ${LIBGCC} libpng16-16 libstdc++-6 libwinpthread-1 SDL2 zlib1; do
echo ":: Copying ${LIB}.dll"
cp "/mingw${{ matrix.bits }}/bin/${LIB}.dll" pkg/
done

View file

@ -10,8 +10,6 @@ addons:
- git
- libsdl1.2-dev
- libsdl2-dev
- libboost-filesystem-dev
- libboost-system-dev
- libgl1-mesa-dev
- libpng-dev
- pkg-config
@ -43,7 +41,6 @@ matrix:
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-sdl2
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-boost
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-pthreads
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-zlib
- sudo apt-get -y --allow-unauthenticated install mxe-i686-w64-mingw32.shared-libpng
@ -63,7 +60,6 @@ matrix:
- sudo apt-get update -qq
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-gcc
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-sdl2
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-boost
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-pthreads
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-zlib
- sudo apt-get -y --allow-unauthenticated install mxe-x86-64-w64-mingw32.shared-libpng

View file

@ -75,7 +75,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\boost-1.81.0\;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -83,7 +83,7 @@
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;SDL2.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\boost-1.81.0\lib32-msvc;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
@ -91,7 +91,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\boost-1.81.0\;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_DEBUG;_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;NO_ASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -99,24 +99,25 @@
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;SDL2.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\boost-1.81.0\lib64-msvc;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\boost-1.81.0\;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;__VISUALC__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;SDL2.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\boost-1.81.0\lib32-msvc;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x86;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x86;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SubSystem>Windows</SubSystem>
@ -124,17 +125,18 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\boost-1.81.0\;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\include;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\include;..\..\..\mupen64plus-win32-deps\opengl\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;_VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;__VISUALC__;NO_ASM;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<Link>
<AdditionalDependencies>opengl32.lib;glu32.lib;SDL2.lib;libpng16.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\boost-1.81.0\lib64-msvc;..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalLibraryDirectories>..\..\..\mupen64plus-win32-deps\libpng-1.6.39\lib\x64;..\..\..\mupen64plus-win32-deps\zlib-1.2.13\lib\x64;..\..\..\mupen64plus-win32-deps\SDL2-2.26.3\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<SubSystem>Windows</SubSystem>
@ -157,6 +159,7 @@
<ClCompile Include="..\..\src\Glide64\TexCache.cpp" />
<ClCompile Include="..\..\src\Glide64\Util.cpp" />
<ClCompile Include="..\..\src\GlideHQ\Ext_TxFilter.cpp" />
<ClCompile Include="..\..\src\GlideHQ\osal_files_win32.c" />
<ClCompile Include="..\..\src\GlideHQ\tc-1.1+\fxt1.c" />
<ClCompile Include="..\..\src\GlideHQ\tc-1.1+\s2tc\s2tc_algorithm.cpp" />
<ClCompile Include="..\..\src\GlideHQ\tc-1.1+\s2tc\s2tc_libtxc_dxtn.cpp" />

View file

@ -19,6 +19,9 @@
<Filter Include="GlideHQ\tc-1.1+\s2tc">
<UniqueIdentifier>{2cc583d4-7f35-421e-93d1-42b27587c3de}</UniqueIdentifier>
</Filter>
<Filter Include="GlideHQ\Windows">
<UniqueIdentifier>{09258efe-2a3d-4c7c-825f-c2c0881048f0}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\src\GlideHQ\TextureFilters_hq4x.cpp">
@ -138,6 +141,9 @@
<ClCompile Include="..\..\src\GlideHQ\tc-1.1+\s2tc\s2tc_libtxc_dxtn.cpp">
<Filter>GlideHQ\tc-1.1+\s2tc</Filter>
</ClCompile>
<ClCompile Include="..\..\src\GlideHQ\osal_files_win32.c">
<Filter>GlideHQ\Windows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\GlideHQ\tc-1.1+\s2tc\s2tc_algorithm.h">

View file

@ -44,7 +44,6 @@ ifeq ("$(UNAME)","Darwin")
OS = OSX
SO_EXTENSION = dylib
SHARED = -bundle
BOOST_SUFFIX = -mt
endif
ifeq ("$(UNAME)","FreeBSD")
OS = FREEBSD
@ -66,7 +65,6 @@ ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
SO_EXTENSION = dll
SHARED = -shared
PIC = 0
BOOST_SUFFIX = -mt
CPPFLAGS += -DNO_FILTER_THREAD
endif
ifeq ("$(OS)","NONE")
@ -154,9 +152,8 @@ OBJDIR = _obj$(POSTFIX)
OPTFLAGS ?= -O3 -flto
WARNFLAGS ?= -Wall -Wno-unused-function
CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I$(SRCDIR) -I$(SRCDIR)/Glitch64/inc -DGCC
CXXFLAGS += -fvisibility-inlines-hidden -std=gnu++0x
CXXFLAGS += -fvisibility-inlines-hidden -std=gnu++17
LDFLAGS += $(SHARED)
BOOST_SUFFIX ?=
ifeq ($(CPU), X86)
CFLAGS += -mmmx -msse
@ -440,7 +437,6 @@ SOURCE += \
$(SRCDIR)/GlideHQ/tc-1.1+/texstore.c
CPPFLAGS += -DTEXTURE_FILTER -DDUMP_CACHE
LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX)
ifeq ($(TXCDXTN), 1)
CPPFLAGS += -DTXCDXTN_EXTERNAL
@ -452,9 +448,13 @@ LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX)
endif
ifeq ($(OS),MINGW)
SOURCE += $(SRCDIR)/Glide64/osal_dynamiclib_win32.c
SOURCE += \
$(SRCDIR)/Glide64/osal_dynamiclib_win32.c \
$(SRCDIR)/GlideHQ/osal_files_win32.c
else
SOURCE += $(SRCDIR)/Glide64/osal_dynamiclib_unix.c
SOURCE += \
$(SRCDIR)/Glide64/osal_dynamiclib_unix.c \
$(SRCDIR)/GlideHQ/osal_files_unix.c
endif

View file

@ -25,12 +25,13 @@
#pragma warning(disable: 4786)
#endif
#include <boost/filesystem.hpp>
#include <filesystem>
#include <zlib.h>
#include "TxCache.h"
#include "TxDbg.h"
#include "../Glide64/m64p.h"
#include "../Glide64/Gfx_1.3.h"
#include "osal_files.h"
TxCache::~TxCache()
{
@ -237,11 +238,11 @@ TxCache::save(const wchar_t *path, const wchar_t *filename, int config)
/* dump cache to disk */
char cbuf[MAX_PATH];
boost::filesystem::path cachepath(path);
boost::filesystem::create_directory(cachepath);
std::filesystem::path cachepath(path);
osal_mkdirp(cachepath.wstring().c_str());
/* Ugly hack to enable fopen/gzopen in Win9x */
#ifdef BOOST_WINDOWS_API
#ifdef _WIN32
wchar_t curpath[MAX_PATH];
GETCWD(MAX_PATH, curpath);
CHDIR(cachepath.wstring().c_str());
@ -330,9 +331,9 @@ TxCache::load(const wchar_t *path, const wchar_t *filename, int config)
/* find it on disk */
char cbuf[MAX_PATH];
boost::filesystem::path cachepath(path);
std::filesystem::path cachepath(path);
#ifdef BOOST_WINDOWS_API
#ifdef _WIN32
wchar_t curpath[MAX_PATH];
GETCWD(MAX_PATH, curpath);
CHDIR(cachepath.wstring().c_str());

View file

@ -36,6 +36,8 @@
#define swprintf _snwprintf
#endif
#include "osal_files.h"
typedef struct {
uint32 *src;
uint32 srcwidth;
@ -658,18 +660,18 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
/* create directories */
tmpbuf.assign(_datapath + L"/texture_dump");
if (!boost::filesystem::exists(tmpbuf) &&
!boost::filesystem::create_directory(tmpbuf))
if (!osal_path_existsW(tmpbuf.c_str()) &&
!osal_mkdirp(tmpbuf.c_str()))
return 0;
tmpbuf.append(L"/" + _ident);
if (!boost::filesystem::exists(tmpbuf) &&
!boost::filesystem::create_directory(tmpbuf))
if (!osal_path_existsW(tmpbuf.c_str()) &&
!osal_mkdirp(tmpbuf.c_str()))
return 0;
tmpbuf.append(L"/GlideHQ");
if (!boost::filesystem::exists(tmpbuf) &&
!boost::filesystem::create_directory(tmpbuf))
if (!osal_path_existsW(tmpbuf.c_str()) &&
!osal_mkdirp(tmpbuf.c_str()))
return 0;
if ((n64fmt >> 8) == 0x2) {

View file

@ -58,6 +58,8 @@
#include "TxHiResCache.h"
#include "TxDbg.h"
#include "../Glide64/Gfx_1.3.h"
#include "osal_files.h"
TxHiResCache::~TxHiResCache()
{
@ -65,8 +67,8 @@ TxHiResCache::~TxHiResCache()
if ((_options & DUMP_HIRESTEXCACHE) && !_haveCache && !_abortLoad) {
/* dump cache to disk */
std::wstring filename = _ident + L"_HIRESTEXTURES.dat";
boost::filesystem::path cachepath(_cachepath);
cachepath /= boost::filesystem::path(L"glidehq");
std::filesystem::path cachepath(_cachepath);
cachepath /= std::filesystem::path(L"glidehq");
int config = _options & (HIRESTEXTURES_MASK|COMPRESS_HIRESTEX|COMPRESSION_MASK|TILE_HIRESTEX|FORCE16BPP_HIRESTEX|GZ_HIRESTEXCACHE|LET_TEXARTISTS_FLY);
TxCache::save(cachepath.wstring().c_str(), filename.c_str(), config);
@ -107,8 +109,8 @@ TxHiResCache::TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,
if (_options & DUMP_HIRESTEXCACHE) {
/* find it on disk */
std::wstring filename = _ident + L"_HIRESTEXTURES.dat";
boost::filesystem::path cachepath(_cachepath);
cachepath /= boost::filesystem::path(L"glidehq");
std::filesystem::path cachepath(_cachepath);
cachepath /= std::filesystem::path(L"glidehq");
int config = _options & (HIRESTEXTURES_MASK|COMPRESS_HIRESTEX|COMPRESSION_MASK|TILE_HIRESTEX|FORCE16BPP_HIRESTEX|GZ_HIRESTEXCACHE|LET_TEXARTISTS_FLY);
_haveCache = TxCache::load(cachepath.wstring().c_str(), filename.c_str(), config);
@ -132,7 +134,7 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
if (!replace) TxCache::clear();
boost::filesystem::path dir_path(_datapath);
std::filesystem::path dir_path(_datapath);
switch (_options & HIRESTEXTURES_MASK) {
case GHQ_HIRESTEXTURES:
@ -149,8 +151,8 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
INFO(80, L" usage of only 2) and 3) highly recommended!\n");
INFO(80, L" folder names must be in US-ASCII characters!\n");
dir_path /= boost::filesystem::path(L"hires_texture");
dir_path /= boost::filesystem::path(_ident);
dir_path /= std::filesystem::path(L"hires_texture");
dir_path /= std::filesystem::path(_ident);
loadHiResTextures(dir_path, replace);
break;
case JABO_HIRESTEXTURES:
@ -164,7 +166,7 @@ TxHiResCache::load(boolean replace) /* 0 : reload, 1 : replace partial */
}
boolean
TxHiResCache::loadHiResTextures(boost::filesystem::path dir_path, boolean replace)
TxHiResCache::loadHiResTextures(std::filesystem::path dir_path, boolean replace)
{
uint32_t last, now, diff;
DBG_INFO(80, L"-----\n");
@ -172,7 +174,7 @@ TxHiResCache::loadHiResTextures(boost::filesystem::path dir_path, boolean replac
last = SDL_GetTicks();
/* find it on disk */
if (!boost::filesystem::exists(dir_path)) {
if (!osal_path_existsW(dir_path.wstring().c_str())) {
INFO(80, L"Error: path not found!\n");
return 0;
}
@ -205,8 +207,8 @@ TxHiResCache::loadHiResTextures(boost::filesystem::path dir_path, boolean replac
*
* RULE OF THUMB: NEVER save texture packs in NON-ASCII names!!
*/
boost::filesystem::directory_iterator it(dir_path);
boost::filesystem::directory_iterator end_it; /* default construction yields past-the-end */
std::filesystem::directory_iterator it(dir_path);
std::filesystem::directory_iterator end_it; /* default construction yields past-the-end */
for (; it != end_it; ++it) {
@ -218,7 +220,7 @@ TxHiResCache::loadHiResTextures(boost::filesystem::path dir_path, boolean replac
if (_abortLoad) break;
/* recursive read into sub-directory */
if (boost::filesystem::is_directory(it->status())) {
if (std::filesystem::is_directory(it->status())) {
loadHiResTextures(it->path(), replace);
continue;
}
@ -349,9 +351,9 @@ TxHiResCache::loadHiResTextures(boost::filesystem::path dir_path, boolean replac
*/
if (pfname == strstr(fname, "_rgb.") || pfname == strstr(fname, "_a.")) {
strcpy(pfname, "_rgb.png");
if (!boost::filesystem::exists(fname)) {
if (!osal_path_existsA(fname)) {
strcpy(pfname, "_rgb.bmp");
if (!boost::filesystem::exists(fname)) {
if (!osal_path_existsA(fname)) {
#if !DEBUG
INFO(80, L"-----\n");
INFO(80, L"path: %ls\n", dir_path.string().c_str());

View file

@ -34,7 +34,7 @@
#include "TxQuantize.h"
#include "TxImage.h"
#include "TxReSample.h"
#include <boost/filesystem.hpp>
#include <filesystem>
class TxHiResCache : public TxCache
{
@ -47,7 +47,7 @@ private:
TxImage *_txImage;
TxQuantize *_txQuantize;
TxReSample *_txReSample;
boolean loadHiResTextures(boost::filesystem::path dir_path, boolean replace);
boolean loadHiResTextures(std::filesystem::path dir_path, boolean replace);
public:
~TxHiResCache();
TxHiResCache(int maxwidth, int maxheight, int maxbpp, int options,

View file

@ -29,7 +29,7 @@
#include "TxDbg.h"
#include <zlib.h>
#include <string>
#include <boost/filesystem.hpp>
#include <filesystem>
TxTexCache::~TxTexCache()
{
@ -37,8 +37,8 @@ TxTexCache::~TxTexCache()
if (_options & DUMP_TEXCACHE) {
/* dump cache to disk */
std::wstring filename = _ident + L"_MEMORYCACHE.dat";
boost::filesystem::path cachepath(_cachepath);
cachepath /= boost::filesystem::path(L"glidehq");
std::filesystem::path cachepath(_cachepath);
cachepath /= std::filesystem::path(L"glidehq");
int config = _options & (FILTER_MASK|ENHANCEMENT_MASK|COMPRESS_TEX|COMPRESSION_MASK|FORCE16BPP_TEX|GZ_TEXCACHE);
TxCache::save(cachepath.wstring().c_str(), filename.c_str(), config);
@ -58,8 +58,8 @@ TxTexCache::TxTexCache(int options, int cachesize, const wchar_t *datapath, cons
if (_options & DUMP_TEXCACHE) {
/* find it on disk */
std::wstring filename = _ident + L"_MEMORYCACHE.dat";
boost::filesystem::path cachepath(_cachepath);
cachepath /= boost::filesystem::path(L"glidehq");
std::filesystem::path cachepath(_cachepath);
cachepath /= std::filesystem::path(L"glidehq");
int config = _options & (FILTER_MASK|ENHANCEMENT_MASK|COMPRESS_TEX|COMPRESSION_MASK|FORCE16BPP_TEX|GZ_TEXCACHE);
TxCache::load(cachepath.wstring().c_str(), filename.c_str(), config);

12
src/GlideHQ/osal_export.h Normal file
View file

@ -0,0 +1,12 @@
#if !defined(OSAL_EXPORT_H)
#define OSAL_EXPORT_H
#if defined(WIN32)
#define EXPORT __declspec(dllexport)
#define CALL __cdecl
#else /* Not WINDOWS */
#define EXPORT __attribute__((visibility("default")))
#define CALL
#endif
#endif /* #define OSAL_EXPORT_H */

71
src/GlideHQ/osal_files.h Normal file
View file

@ -0,0 +1,71 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-ui-console - osal_files.h *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program 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 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This header file is for all kinds of system-dependent file handling
*
*/
#if !defined(OSAL_FILES_H)
#define OSAL_FILES_H
#include "osal_export.h"
#ifdef __cplusplus
extern "C" {
#endif
#define OSAL_DIR_SEPARATOR_STR L"/"
#define OSAL_DIR_SEPARATOR_CHAR L'/'
#if defined(WIN32)
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH
#endif
#define strdup _strdup
#else /* Not WINDOWS */
#ifndef PATH_MAX
#define PATH_MAX 260
#endif
#endif
// Returns 1 if name contains path to a directory, 0 otherwise
EXPORT int CALL osal_is_directory(const wchar_t* name);
// Returns 1 if name contains an absolute path, 0 otherwise. Path validity not tested.
EXPORT int CALL osal_is_absolute_path(const wchar_t* name);
// Returns 1 if path points to file or directory, 0 otherwise
EXPORT int CALL osal_path_existsA(const char *path);
// Returns 1 if path points to file or directory, 0 otherwise
EXPORT int CALL osal_path_existsW(const wchar_t *path);
// Returns 0 if all directories on the path exist or successfully created
// Returns 1 if path is bad
// Returns 2 if we can't create some directory on the path
EXPORT int CALL osal_mkdirp(const wchar_t *dirpath);
EXPORT void * CALL osal_search_dir_open(const wchar_t *_pathname);
EXPORT const wchar_t * CALL osal_search_dir_read_next(void * dir_handle);
EXPORT void CALL osal_search_dir_close(void * dir_handle);
#ifdef __cplusplus
}
#endif
#endif /* #define OSAL_FILES_H */

View file

@ -0,0 +1,153 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal_files_unix.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program 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 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This file contains the definitions for the unix-specific file handling
* functions
*/
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "osal_files.h"
/* global functions */
#ifdef __cplusplus
extern "C"{
#endif
EXPORT int CALL osal_path_existsA(const char *path)
{
struct stat fileinfo;
return stat(path, &fileinfo) == 0 ? 1 : 0;
}
EXPORT int CALL osal_path_existsW(const wchar_t *_path)
{
char path[PATH_MAX];
wcstombs(path, _path, PATH_MAX);
struct stat fileinfo;
return stat(path, &fileinfo) == 0 ? 1 : 0;
}
EXPORT int CALL osal_is_absolute_path(const wchar_t* name)
{
return name[0] == L'/';
}
EXPORT int CALL osal_is_directory(const wchar_t * _name)
{
char name[PATH_MAX + 1];
wcstombs(name, _name, PATH_MAX);
DIR* dir;
dir = opendir(name);
if(dir != NULL)
{
closedir(dir);
return 1;
}
return 0;
}
EXPORT int CALL osal_mkdirp(const wchar_t *_dirpath)
{
char dirpath[PATH_MAX];
wcstombs(dirpath, _dirpath, PATH_MAX);
struct stat fileinfo;
int dirpathlen = strlen(dirpath);
char *currpath = strdup(dirpath);
/* first, break the path into pieces by replacing all of the slashes wil NULL chars */
while (strlen(currpath) > 1)
{
char *lastslash = strrchr(currpath, '/');
if (lastslash == NULL)
break;
*lastslash = 0;
}
/* then re-assemble the path from left to right until we get to a directory that doesn't exist */
while (strlen(currpath) < dirpathlen)
{
if (strlen(currpath) > 0 && stat(currpath, &fileinfo) != 0)
break;
currpath[strlen(currpath)] = '/';
}
/* then walk up the path chain, creating directories along the way */
do
{
if (stat(currpath, &fileinfo) != 0)
{
if (mkdir(currpath, 0700) != 0)
{
free(currpath);
return 1; /* mkdir failed */
}
}
if (strlen(currpath) == dirpathlen)
break;
else
currpath[strlen(currpath)] = '/';
} while (1);
free(currpath);
return 0;
}
EXPORT void * CALL osal_search_dir_open(const wchar_t *_pathname)
{
char pathname[PATH_MAX];
wcstombs(pathname, _pathname, PATH_MAX);
DIR *dir;
dir = opendir(pathname);
return dir;
}
EXPORT const wchar_t * CALL osal_search_dir_read_next(void * dir_handle)
{
static wchar_t last_filename[PATH_MAX];
DIR *dir = (DIR *) dir_handle;
struct dirent *entry;
if (dir_handle == NULL)
return NULL;
entry = readdir(dir);
if (entry == NULL)
return NULL;
mbstowcs(last_filename, entry->d_name, PATH_MAX);
return last_filename;
}
EXPORT void CALL osal_search_dir_close(void * dir_handle)
{
closedir((DIR *) dir_handle);
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,167 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Mupen64plus-core - osal_files_win32.c *
* Mupen64Plus homepage: https://mupen64plus.org/ *
* Copyright (C) 2009 Richard Goedeken *
* *
* This program 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 of the License, or *
* (at your option) any later version. *
* *
* This program 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 this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This file contains the definitions for the unix-specific file handling
* functions
*/
#include <direct.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <windows.h>
#include "osal_files.h"
/* global functions */
#ifdef __cplusplus
extern "C"{
#endif
EXPORT int CALL osal_path_existsA(const char *path)
{
struct _stat fileinfo;
return _stat(path, &fileinfo) == 0 ? 1 : 0;
}
EXPORT int CALL osal_path_existsW(const wchar_t *path)
{
struct _stat fileinfo;
return _wstat(path, &fileinfo) == 0 ? 1 : 0;
}
EXPORT int CALL osal_is_absolute_path(const wchar_t* name)
{
return wcschr(name, L':') != NULL || name[0] == L'\\' || name[0] == L'/';
}
EXPORT int CALL osal_is_directory(const wchar_t* _name)
{
wchar_t DirName[MAX_PATH + 1];
int namelen = 0;
/* we must remove any trailing backslash on the end of the pathname, or this will fail */
wcsncpy(DirName, _name, MAX_PATH);
DirName[MAX_PATH] = 0;
namelen = wcslen(DirName);
if (namelen > 0 && DirName[namelen - 1] == OSAL_DIR_SEPARATOR_CHAR)
DirName[namelen - 1] = L'\0';
return (GetFileAttributesW(DirName) & FILE_ATTRIBUTE_DIRECTORY);
}
EXPORT int CALL osal_mkdirp(const wchar_t * dirpath)
{
struct _stat fileinfo;
size_t dirpathlen = wcslen(dirpath);
wchar_t *currpath = _wcsdup(dirpath);
/* first, remove sub-dirs on the end (by replacing slashes with NULL chars) until we find an existing directory */
while (wcslen(currpath) > 1 && _wstat(currpath, &fileinfo) != 0) {
wchar_t *lastslash = wcsrchr(currpath, OSAL_DIR_SEPARATOR_CHAR);
if (lastslash == NULL) {
free(currpath);
return 1; /* error: we never found an existing directory, this path is bad */
}
*lastslash = 0;
}
/* then walk up the path chain, creating directories along the way */
do {
if (currpath[wcslen(currpath) - 1] != OSAL_DIR_SEPARATOR_CHAR && _wstat(currpath, &fileinfo) != 0)
{
if (_wmkdir(currpath) != 0)
{
free(currpath);
return 2; /* mkdir failed */
}
}
if (wcslen(currpath) == dirpathlen)
break;
else
currpath[wcslen(currpath)] = OSAL_DIR_SEPARATOR_CHAR;
} while (1);
free(currpath);
return 0;
}
typedef struct {
HANDLE hFind;
WIN32_FIND_DATAW find_data;
} dir_search_info;
EXPORT void * CALL osal_search_dir_open(const wchar_t *pathname)
{
wchar_t SearchString[MAX_PATH + 1];
dir_search_info *pInfo = (dir_search_info *)malloc(sizeof(dir_search_info));
if (pInfo == NULL)
return NULL;
pInfo->hFind = INVALID_HANDLE_VALUE;
pInfo->find_data.cFileName[0] = 0;
if (pathname[wcslen(pathname) - 1] == OSAL_DIR_SEPARATOR_CHAR)
swprintf(SearchString, MAX_PATH, L"%ls*", pathname);
else
swprintf(SearchString, MAX_PATH, L"%ls%ls*", pathname, OSAL_DIR_SEPARATOR_STR);
SearchString[MAX_PATH] = 0;
pInfo->hFind = FindFirstFileW(SearchString, &pInfo->find_data);
return (void *) pInfo;
}
EXPORT const wchar_t * CALL osal_search_dir_read_next(void * search_info)
{
static wchar_t last_filename[_MAX_PATH];
dir_search_info *pInfo = (dir_search_info *) search_info;
if (pInfo == NULL || pInfo->hFind == INVALID_HANDLE_VALUE || pInfo->find_data.cFileName[0] == 0)
return NULL;
wcscpy(last_filename, pInfo->find_data.cFileName);
if (FindNextFileW(pInfo->hFind, &pInfo->find_data) == 0)
{
pInfo->find_data.cFileName[0] = 0;
}
return last_filename;
}
EXPORT void CALL osal_search_dir_close(void * search_info)
{
dir_search_info *pInfo = (dir_search_info *) search_info;
if (pInfo != NULL)
{
if (pInfo->hFind != INVALID_HANDLE_VALUE)
FindClose(pInfo->hFind);
free(pInfo);
}
}
#ifdef __cplusplus
}
#endif