Skip to content

armgit / PS5LM

Public Imported from GitHub
0

llama.cpp on a jailbroken PS5: run any GGUF model natively on the console, starting with Qwen 3.8

Downloads: the SHA-256 check says how far it has read, and a restart repeats only the check (#30) (#51)

Mert Cobanov85232afd3c5e
diff --git a/ps5/app/dashboard.cpp b/ps5/app/dashboard.cpp
index efc8785..3fe9e7e 100644
--- a/ps5/app/dashboard.cpp
+++ b/ps5/app/dashboard.cpp
@@ -365,7 +365,8 @@ std::string download_line(const Download & d) {
}
std::snprintf(t, sizeof(t), "%.1f of %.1f GB", done, all);
if (d.state == DownloadState::running) {
- return std::string(t) + ", starting";
+ // No speed: starting, or every piece is in and the note says the SHA-256 check's progress (#30).
+ return std::string(t) + ", " + (d.note.empty() ? "starting" : d.note);
}
if (d.state == DownloadState::done) {
return d.note;
diff --git a/ps5/app/market.cpp b/ps5/app/market.cpp
index dc32494..f440253 100644
--- a/ps5/app/market.cpp
+++ b/ps5/app/market.cpp
@@ -649,15 +649,26 @@ bool Market::fetch(Download & d) {
publish(true);
return false;
}
- // Whole: check it.
+ // Whole: check it. The queue is saved first, with `resume` at the file's
+ // size, so a restart during the check repeats only the check, not the last
+ // piece; and the row says how far the check has read (#30).
d.note = "Checking the SHA-256";
- publish(false);
+ publish(true);
sha256_t h;
sha256_init(&h);
if (FILE * in = std::fopen(part.c_str(), "rb")) {
std::vector<unsigned char> buf(8u << 20);
+ uint64_t read = 0;
+ auto shown = std::chrono::steady_clock::now();
for (size_t n; (n = std::fread(buf.data(), 1, buf.size(), in)) > 0;) {
sha256_update(&h, buf.data(), n);
+ read += n;
+ const auto now = std::chrono::steady_clock::now();
+ if (now - shown >= std::chrono::seconds(1)) {
+ shown = now;
+ d.note = "Checking the SHA-256, " + std::to_string((int) (100.0 * (double) read / (double) d.bytes)) + "%";
+ publish(false);
+ }
}
std::fclose(in);
}