diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-04-17 03:06:55 +0200 |
|---|---|---|
| committer | Admiral H. Curtiss <pikachu025@gmail.com> | 2022-07-11 23:11:37 +0200 |
| commit | fdc327c252d2d3e9e7a2aa7a801bcad591456946 (patch) | |
| tree | 135ce3adab46cccda3bc823ebe2630eabe111984 /Source/Core | |
| parent | 4ad00e84e77843b7ce9ba9f163305b5e43586d4f (diff) | |
Externals/FatFs: Build as part of Dolphin.
Co-authored-by: Pablo Stebler <pablo@stebler.xyz>
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Common/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | Source/Core/Common/FatFsUtil.cpp | 78 | ||||
| -rw-r--r-- | Source/Core/DolphinLib.props | 1 |
3 files changed, 81 insertions, 0 deletions
diff --git a/Source/Core/Common/CMakeLists.txt b/Source/Core/Common/CMakeLists.txt index 729d62c441..1edb201350 100644 --- a/Source/Core/Common/CMakeLists.txt +++ b/Source/Core/Common/CMakeLists.txt @@ -44,6 +44,7 @@ add_library(common EnumFormatter.h EnumMap.h Event.h + FatFsUtil.cpp FileSearch.cpp FileSearch.h FileUtil.cpp @@ -144,6 +145,7 @@ PUBLIC PRIVATE ${CURL_LIBRARIES} + FatFs ${ICONV_LIBRARIES} png ${VTUNE_LIBRARIES} diff --git a/Source/Core/Common/FatFsUtil.cpp b/Source/Core/Common/FatFsUtil.cpp new file mode 100644 index 0000000000..4d8b450529 --- /dev/null +++ b/Source/Core/Common/FatFsUtil.cpp @@ -0,0 +1,78 @@ +// Copyright 2022 Dolphin Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <cstdlib> +#include <mutex> + +// Does not compile if diskio.h is included first. +// clang-format off +#include "ff.h" +#include "diskio.h" +// clang-format on + +// For now this is just mostly dummy functions so FatFs actually links. + +extern "C" DSTATUS disk_status(BYTE pdrv) +{ + return STA_NOINIT; +} + +extern "C" DSTATUS disk_initialize(BYTE pdrv) +{ + return STA_NOINIT; +} + +extern "C" DRESULT disk_read(BYTE pdrv, BYTE* buff, LBA_t sector, UINT count) +{ + return RES_PARERR; +} + +extern "C" DRESULT disk_write(BYTE pdrv, const BYTE* buff, LBA_t sector, UINT count) +{ + return RES_PARERR; +} + +extern "C" DRESULT disk_ioctl(BYTE pdrv, BYTE cmd, void* buff) +{ + return RES_PARERR; +} + +extern "C" DWORD get_fattime(void) +{ + return 0; +} + +extern "C" void* ff_memalloc(UINT msize) +{ + return std::malloc(msize); +} + +extern "C" void ff_memfree(void* mblock) +{ + return std::free(mblock); +} + +extern "C" int ff_cre_syncobj(BYTE vol, FF_SYNC_t* sobj) +{ + *sobj = new std::recursive_mutex(); + return *sobj != nullptr; +} + +extern "C" int ff_req_grant(FF_SYNC_t sobj) +{ + std::recursive_mutex* m = reinterpret_cast<std::recursive_mutex*>(sobj); + m->lock(); + return 1; +} + +extern "C" void ff_rel_grant(FF_SYNC_t sobj) +{ + std::recursive_mutex* m = reinterpret_cast<std::recursive_mutex*>(sobj); + m->unlock(); +} + +extern "C" int ff_del_syncobj(FF_SYNC_t sobj) +{ + delete reinterpret_cast<std::recursive_mutex*>(sobj); + return 1; +} diff --git a/Source/Core/DolphinLib.props b/Source/Core/DolphinLib.props index 2e7e546c78..17c2aa4345 100644 --- a/Source/Core/DolphinLib.props +++ b/Source/Core/DolphinLib.props @@ -725,6 +725,7 @@ <ClCompile Include="Common\Debug\Watches.cpp" /> <ClCompile Include="Common\DynamicLibrary.cpp" /> <ClCompile Include="Common\ENetUtil.cpp" /> + <ClCompile Include="Common\FatFsUtil.cpp" /> <ClCompile Include="Common\FileSearch.cpp" /> <ClCompile Include="Common\FileUtil.cpp" /> <ClCompile Include="Common\FloatUtils.cpp" /> |
