From 64bc5409d12c7252c188caaa201108d15d94e8bc Mon Sep 17 00:00:00 2001 From: TheLastRar Date: Mon, 16 Nov 2020 20:19:22 +0000 Subject: [PATCH] DEV9: support old config files that specify a file name, but no path --- pcsx2/DEV9/DEV9.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/pcsx2/DEV9/DEV9.cpp b/pcsx2/DEV9/DEV9.cpp index 6ca175307d..40278fe438 100644 --- a/pcsx2/DEV9/DEV9.cpp +++ b/pcsx2/DEV9/DEV9.cpp @@ -27,6 +27,7 @@ #include #endif +#include "ghc/filesystem.h" #include #include @@ -37,8 +38,9 @@ #include "DEV9.h" #undef EXTERN #include "Config.h" +#include "AppConfig.h" #include "smap.h" -#include "ata.h" + #ifdef _WIN32 #pragma warning(disable : 4244) @@ -250,7 +252,19 @@ s32 DEV9open(void* pDsp) #else DEV9_LOG("open r+: %s\n", config.Hdd); #endif - config.HddSize = 8 * 1024; + +#ifdef _WIN32 + ghc::filesystem::path hddPath(std::wstring(config.Hdd)); +#else + ghc::filesystem::path hddPath(config.Hdd); +#endif + + if (hddPath.is_relative()) + { + //GHC uses UTF8 on all platforms + ghc::filesystem::path path(GetSettingsFolder().ToUTF8().data()); + hddPath = path / hddPath; + } #ifdef ENABLE_ATA ata_init();