diff --git a/Source/Core/Common/CommonPaths.h b/Source/Core/Common/CommonPaths.h index 1482b9656cc7..4e4a6c1c4aa7 100644 --- a/Source/Core/Common/CommonPaths.h +++ b/Source/Core/Common/CommonPaths.h @@ -34,6 +34,7 @@ // Subdirs in the User dir returned by GetUserPath(D_USER_IDX) #define GC_USER_DIR "GC" +#define TRI_USER_DIR "Triforce" #define GBA_USER_DIR "GBA" #define WII_USER_DIR "Wii" #define CONFIG_DIR "Config" diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp index 0eac268b0042..9181d439a19b 100644 --- a/Source/Core/Common/FileUtil.cpp +++ b/Source/Core/Common/FileUtil.cpp @@ -931,6 +931,7 @@ static void RebuildUserDirectories(unsigned int dir_index) { case D_USER_IDX: s_user_paths[D_GCUSER_IDX] = s_user_paths[D_USER_IDX] + GC_USER_DIR DIR_SEP; + s_user_paths[D_TRIUSER_IDX] = s_user_paths[D_USER_IDX] + TRI_USER_DIR DIR_SEP; s_user_paths[D_WIIROOT_IDX] = s_user_paths[D_USER_IDX] + WII_USER_DIR; s_user_paths[D_CONFIG_IDX] = s_user_paths[D_USER_IDX] + CONFIG_DIR DIR_SEP; s_user_paths[D_GAMESETTINGS_IDX] = s_user_paths[D_USER_IDX] + GAMESETTINGS_DIR DIR_SEP; diff --git a/Source/Core/Common/FileUtil.h b/Source/Core/Common/FileUtil.h index 415c3fd10239..2dda5a7aab59 100644 --- a/Source/Core/Common/FileUtil.h +++ b/Source/Core/Common/FileUtil.h @@ -27,6 +27,7 @@ enum { D_USER_IDX, D_GCUSER_IDX, + D_TRIUSER_IDX, D_WIIROOT_IDX, // always points to User/Wii or global user-configured directory D_SESSION_WIIROOT_IDX, // may point to minimal temporary directory for determinism D_CONFIG_IDX, // global settings diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp index 714698a5e29b..c2cbc9b74ab6 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.cpp @@ -5,12 +5,32 @@ #include "Common/Assert.h" #include "Common/ChunkFile.h" +#include "Common/CommonPaths.h" #include "Common/CommonTypes.h" +#include "Common/FileUtil.h" +#include "Common/IOFile.h" #include "Common/Logging/Log.h" namespace ExpansionInterface { -CEXIBaseboard::CEXIBaseboard() = default; +CEXIBaseboard::CEXIBaseboard() +{ + EEPROM_filename = File::GetUserPath(D_TRIUSER_IDX) + "EEPROM.raw"; + if (File::Exists(EEPROM_filename)) + { + m_EEPROM = std::make_unique(EEPROM_filename, "rb+"); + } + else + { + m_EEPROM = std::make_unique(EEPROM_filename, "wb+"); + } +} + +CEXIBaseboard::~CEXIBaseboard() +{ + m_EEPROM->Close(); + File::Delete(EEPROM_filename); +} void CEXIBaseboard::SetCS(int cs) { diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h index 687ff110cc5a..6e2cc9ff01db 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceBaseboard.h @@ -5,6 +5,8 @@ #include "Core/HW/EXI/EXI_Device.h" +#include "Common/IOFile.h" + class PointerWrap; namespace ExpansionInterface @@ -13,12 +15,16 @@ class CEXIBaseboard : public IEXIDevice { public: CEXIBaseboard(); + ~CEXIBaseboard(); void SetCS(int CS) override; bool IsPresent() const override; bool IsInterruptSet(); void DoState(PointerWrap& p) override; private: + std::string EEPROM_filename; + std::unique_ptr m_EEPROM; + // STATE_TO_SAVE bool m_have_irq; u32 m_position = 0; diff --git a/Source/Core/UICommon/UICommon.cpp b/Source/Core/UICommon/UICommon.cpp index 5c34c6b90294..3532e7d16eab 100644 --- a/Source/Core/UICommon/UICommon.cpp +++ b/Source/Core/UICommon/UICommon.cpp @@ -196,6 +196,7 @@ void CreateDirectories() File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX)); File::CreateFullPath(File::GetUserPath(D_SHADERS_IDX) + ANAGLYPH_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); + File::CreateFullPath(File::GetUserPath(D_TRIUSER_IDX)); #ifndef ANDROID File::CreateFullPath(File::GetUserPath(D_THEMES_IDX)); File::CreateFullPath(File::GetUserPath(D_STYLES_IDX));