Windows 2000 support, part 1

This commit is contained in:
tildearrow 2025-06-03 19:54:02 -05:00
parent f5a6a9ed6c
commit 1ec49d3557
7 changed files with 30 additions and 11 deletions

View file

@ -188,7 +188,7 @@ list(APPEND DEPENDENCIES_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
if (WIN32) if (WIN32)
# support Windows XP # support Windows XP
if (SUPPORT_XP) if (SUPPORT_XP)
list(APPEND DEPENDENCIES_DEFINES "_WIN32_WINNT=0x0501") list(APPEND DEPENDENCIES_DEFINES "_WIN32_WINNT=0x0500")
list(APPEND DEPENDENCIES_DEFINES "SUPPORT_XP") list(APPEND DEPENDENCIES_DEFINES "SUPPORT_XP")
else() else()
# support Windows Vista # support Windows Vista

View file

@ -16,7 +16,7 @@ fi
cd xpbuild cd xpbuild
# TODO: potential Arch-ism? # TODO: potential Arch-ism?
i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type" -DBUILD_SHARED_LIBS=OFF -DSUPPORT_XP=ON -DWITH_RENDER_DX11=OFF -DSDL_SSE=OFF -DSDL_SSE2=OFF -DSDL_SSE3=OFF -DENABLE_SSE=OFF -DENABLE_SSE2=OFF -DENABLE_AVX=OFF -DENABLE_AVX2=OFF -DUSE_BACKWARD=ON -DCONSOLE_SUBSYSTEM=OFF -DWITH_LOCALE=ON -DUSE_MOMO=ON -DFORCE_CODEVIEW=ON .. || exit 1 i686-w64-mingw32-cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="-O2" -DCMAKE_CXX_FLAGS="-O2 -Wall -Wextra -Wno-unused-parameter -Wno-cast-function-type" -DBUILD_SHARED_LIBS=OFF -DSUPPORT_XP=ON -DWITH_RENDER_DX11=OFF -DSDL_SSE=OFF -DSDL_SSE2=OFF -DSDL_SSE3=OFF -DENABLE_SSE=OFF -DENABLE_SSE2=OFF -DENABLE_AVX=OFF -DENABLE_AVX2=OFF -DUSE_BACKWARD=OFF -DCONSOLE_SUBSYSTEM=OFF -DWITH_LOCALE=ON -DUSE_MOMO=ON -DFORCE_CODEVIEW=OFF .. || exit 1
make -j8 || exit 1 make -j8 || exit 1
cd .. cd ..

View file

@ -35,7 +35,7 @@ String getWinConfigPath() {
if (!PathIsDirectoryW(configPath.c_str())) { if (!PathIsDirectoryW(configPath.c_str())) {
logI("creating config dir..."); logI("creating config dir...");
int mkdirRet; int mkdirRet;
if ((mkdirRet=SHCreateDirectory(NULL,configPath.c_str()))!=ERROR_SUCCESS) { if ((mkdirRet=SHCreateDirectoryExW(NULL,configPath.c_str(),NULL))!=ERROR_SUCCESS) {
logW("could not make config dir! (%.8x)",mkdirRet); logW("could not make config dir! (%.8x)",mkdirRet);
configPath=L"."; configPath=L".";
} }

View file

@ -96,7 +96,7 @@ bool dirExists(const char* what) {
bool makeDir(const char* path) { bool makeDir(const char* path) {
#ifdef _WIN32 #ifdef _WIN32
return (SHCreateDirectory(NULL,utf8To16(path).c_str())==ERROR_SUCCESS); return (SHCreateDirectoryExW(NULL,utf8To16(path).c_str(),NULL)==ERROR_SUCCESS);
#else #else
return (mkdir(path,0755)==0); return (mkdir(path,0755)==0);
#endif #endif

View file

@ -7,7 +7,7 @@
#include <nfd.h> #include <nfd.h>
#elif defined(ANDROID) #elif defined(ANDROID)
#include <SDL.h> #include <SDL.h>
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
#include "../../extern/pfd-fixed/portable-file-dialogs.h" #include "../../extern/pfd-fixed/portable-file-dialogs.h"
#endif #endif
@ -176,9 +176,12 @@ bool FurnaceGUIFileDialog::openLoad(String header, std::vector<String> filter, S
jniEnv->DeleteLocalRef(class_); jniEnv->DeleteLocalRef(class_);
jniEnv->DeleteLocalRef(activity); jniEnv->DeleteLocalRef(activity);
return true; return true;
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
dialogO=new pfd::open_file(header,path,filter,allowMultiple?(pfd::opt::multiselect):(pfd::opt::none)); dialogO=new pfd::open_file(header,path,filter,allowMultiple?(pfd::opt::multiselect):(pfd::opt::none));
hasError=!pfd::settings::available(); hasError=!pfd::settings::available();
#else
hasError=true;
return false;
#endif #endif
} else { } else {
hasError=false; hasError=false;
@ -268,9 +271,12 @@ bool FurnaceGUIFileDialog::openSave(String header, std::vector<String> filter, S
jniEnv->DeleteLocalRef(class_); jniEnv->DeleteLocalRef(class_);
jniEnv->DeleteLocalRef(activity); jniEnv->DeleteLocalRef(activity);
return true; return true;
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
dialogS=new pfd::save_file(header,path,filter); dialogS=new pfd::save_file(header,path,filter);
hasError=!pfd::settings::available(); hasError=!pfd::settings::available();
#else
hasError=true;
return false;
#endif #endif
} else { } else {
hasError=false; hasError=false;
@ -312,9 +318,12 @@ bool FurnaceGUIFileDialog::openSelectDir(String header, String path, double dpiS
#elif defined(ANDROID) #elif defined(ANDROID)
hasError=true; hasError=true;
return false; return false;
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
dialogF=new pfd::select_folder(header,path); dialogF=new pfd::select_folder(header,path);
hasError=!pfd::settings::available(); hasError=!pfd::settings::available();
#else
hasError=true;
return false;
#endif #endif
} else { } else {
hasError=false; hasError=false;
@ -407,7 +416,7 @@ bool FurnaceGUIFileDialog::render(const ImVec2& min, const ImVec2& max) {
#elif defined(ANDROID) #elif defined(ANDROID)
// TODO: detect when file picker is closed // TODO: detect when file picker is closed
return false; return false;
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
if (dialogType==2) { if (dialogType==2) {
if (dialogF!=NULL) { if (dialogF!=NULL) {
if (dialogF->ready(0)) { if (dialogF->ready(0)) {
@ -455,6 +464,8 @@ bool FurnaceGUIFileDialog::render(const ImVec2& min, const ImVec2& max) {
logE("what!"); logE("what!");
} }
return false; return false;
#else
return false;
#endif #endif
} else { } else {
return ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollWithMouse,min,max); return ImGuiFileDialog::Instance()->Display("FileDialog",ImGuiWindowFlags_NoCollapse|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_NoScrollWithMouse,min,max);

View file

@ -19,12 +19,14 @@
#elif defined(ANDROID) #elif defined(ANDROID)
#include <jni.h> #include <jni.h>
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
namespace pfd { namespace pfd {
class open_file; class open_file;
class save_file; class save_file;
class select_folder; class select_folder;
} }
#else
// nothing
#endif #endif
typedef std::function<void(const char*)> FileDialogSelectCallback; typedef std::function<void(const char*)> FileDialogSelectCallback;
@ -48,10 +50,14 @@ class FurnaceGUIFileDialog {
void* dialogO; void* dialogO;
void* dialogS; void* dialogS;
void* dialogF; void* dialogF;
#else #elif (!defined(SUPPORT_XP) || !defined(_WIN32))
pfd::open_file* dialogO; pfd::open_file* dialogO;
pfd::save_file* dialogS; pfd::save_file* dialogS;
pfd::select_folder* dialogF; pfd::select_folder* dialogF;
#else
unsigned char* dialogO;
unsigned char* dialogS;
unsigned char* dialogF;
#endif #endif
void convertFilterList(std::vector<String>& filter); void convertFilterList(std::vector<String>& filter);

View file

@ -545,12 +545,14 @@ int main(int argc, char** argv) {
// Windows console thing - thanks dj.tuBIG/MaliceX // Windows console thing - thanks dj.tuBIG/MaliceX
#ifdef _WIN32 #ifdef _WIN32
#ifndef TA_SUBSYSTEM_CONSOLE #ifndef TA_SUBSYSTEM_CONSOLE
#ifndef SUPPORT_XP
if (AttachConsole(ATTACH_PARENT_PROCESS)) { if (AttachConsole(ATTACH_PARENT_PROCESS)) {
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
freopen("CONIN$", "r", stdin); freopen("CONIN$", "r", stdin);
} }
#endif #endif
#endif
#endif #endif
srand(time(NULL)); srand(time(NULL));