fix gamecard install due to fs==NULL. more explicit yields for sd card transfers for file based emummc.

This commit is contained in:
ITotalJustice
2025-05-28 15:00:31 +01:00
parent 6b56b7f7c2
commit 01bfcb05cd
6 changed files with 49 additions and 6 deletions

View File

@@ -946,6 +946,7 @@ void FsView::UploadFiles() {
const auto loc = network_locations[*op_index];
App::Push(std::make_shared<ProgressBox>(0, "Uploading"_i18n, "", [this, loc](auto pbox) -> Result {
auto targets = GetSelectedEntries();
const auto is_file_based_emummc = App::IsFileBaseEmummc();
const auto file_add = [&](s64 file_size, const fs::FsPath& file_path, const char* name) -> Result {
// the file name needs to be relative to the current directory.
@@ -958,7 +959,11 @@ void FsView::UploadFiles() {
return thread::TransferPull(pbox, file_size,
[&](void* data, s64 off, s64 size, u64* bytes_read) -> Result {
return f.Read(off, data, size, FsReadOption_None, bytes_read);
const auto rc = f.Read(off, data, size, FsReadOption_None, bytes_read);
if (m_fs->IsNative() && is_file_based_emummc) {
svcSleepThread(2e+6); // 2ms
}
return rc;
},
[&](thread::PullCallback pull) -> Result {
s64 offset{};

View File

@@ -186,7 +186,9 @@ private:
};
struct NspSource final : dump::BaseSource {
NspSource(const std::vector<NspEntry>& entries) : m_entries{entries} { }
NspSource(const std::vector<NspEntry>& entries) : m_entries{entries} {
m_is_file_based_emummc = App::IsFileBaseEmummc();
}
Result Read(const std::string& path, void* buf, s64 off, s64 size, u64* bytes_read) override {
const auto it = std::ranges::find_if(m_entries, [&path](auto& e){
@@ -194,7 +196,11 @@ struct NspSource final : dump::BaseSource {
});
R_UNLESS(it != m_entries.end(), 0x1);
return it->Read(buf, off, size, bytes_read);
const auto rc = it->Read(buf, off, size, bytes_read);
if (m_is_file_based_emummc) {
svcSleepThread(2e+6); // 2ms
}
return rc;
}
auto GetName(const std::string& path) const -> std::string {
@@ -235,6 +241,7 @@ struct NspSource final : dump::BaseSource {
private:
std::vector<NspEntry> m_entries{};
bool m_is_file_based_emummc{};
};
Result Notify(Result rc, const std::string& error_message) {