mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Externals/FatFs: Build as part of Dolphin.
Co-authored-by: Pablo Stebler <pablo@stebler.xyz>
This commit is contained in:
@ -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}
|
||||
|
78
Source/Core/Common/FatFsUtil.cpp
Normal file
78
Source/Core/Common/FatFsUtil.cpp
Normal file
@ -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;
|
||||
}
|
@ -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" />
|
||||
|
Reference in New Issue
Block a user