mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 00:56:55 +02:00
Initial commit
This commit is contained in:
26
arm9/source/romBrowser/FileRecyclerAdapter.cpp
Normal file
26
arm9/source/romBrowser/FileRecyclerAdapter.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "common.h"
|
||||
#include "core/task/TaskQueue.h"
|
||||
#include "FileInfoManager.h"
|
||||
#include "FileRecyclerAdapter.h"
|
||||
|
||||
u32 FileRecyclerAdapter::GetItemCount() const
|
||||
{
|
||||
return _fileInfoManager->GetItemCount();
|
||||
}
|
||||
|
||||
void FileRecyclerAdapter::BindView(View* view, int index) const
|
||||
{
|
||||
LOG_DEBUG("Binding %d\n", index);
|
||||
_taskQueue->Enqueue([=, this] (const vu8& cancelRequested)
|
||||
{
|
||||
LOG_DEBUG("Started task to load %d\n", index);
|
||||
_fileInfoManager->LoadFileInfo(index);
|
||||
auto internalFileInfo = _fileInfoManager->GetInternalFileInfo(index);
|
||||
if (cancelRequested)
|
||||
{
|
||||
_fileInfoManager->ReleaseFileInfo(index);
|
||||
return TaskResult<void>::Canceled();
|
||||
}
|
||||
return BindView(view, index, internalFileInfo, cancelRequested);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user