SpeedBreaker v0.1.9 Windows beta 1

Co-authored-by: rafidwayne <117944293+rafidwayne@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed 2026-10-24 19:31:48 +00:00
1 parent 57b0c69334
commit 61365bd067
99 files changed
+7457 -431

No files matched your search

+29 -7
View File
@@ -18,7 +18,11 @@
#include <string>
#include <vector>
#ifdef _WIN32
#include <platform/os.h>
#else
#include <unistd.h>
#endif
namespace install
{
@@ -43,22 +47,40 @@ namespace install
InterruptGuard()
{
s_cancel.store(false);
#ifdef _WIN32
// The C runtime's SIGINT is Ctrl-C (and Ctrl-Break), through
// a console control handler, and it resets itself as
// SA_RESETHAND does.
previousInt = signal(SIGINT, OnInterrupt);
previousTerm = signal(SIGTERM, OnInterrupt);
#else
struct sigaction sa{};
sa.sa_handler = OnInterrupt;
sa.sa_flags = SA_RESETHAND;
sigemptyset(&sa.sa_mask);
sigaction(SIGINT, &sa, &previousInt);
sigaction(SIGTERM, &sa, &previousTerm);
#endif
}
~InterruptGuard()
{
#ifdef _WIN32
signal(SIGINT, previousInt);
signal(SIGTERM, previousTerm);
#else
sigaction(SIGINT, &previousInt, nullptr);
sigaction(SIGTERM, &previousTerm, nullptr);
#endif
}
private:
#ifdef _WIN32
void (*previousInt)(int) = SIG_DFL;
void (*previousTerm)(int) = SIG_DFL;
#else
struct sigaction previousInt{}, previousTerm{};
#endif
};
// One rewritten status line on a terminal; a line per file otherwise
@@ -133,7 +155,7 @@ namespace install
Result r = OpenDiscSource(path, source);
if (!r.Ok())
return r;
printf("Source: %s (%s, %zu files)\n", source->Path().c_str(),
printf("Source: %s (%s, %zu files)\n", source->Path().string().c_str(),
source->Kind() == SourceKind::Image ? "disc image" : "folder", source->Files().size());
return {};
}
@@ -205,7 +227,7 @@ namespace install
std::vector<DiscImageCandidate> images = FindDiscImages(where, 1ull << 30, &s_cancel);
for (const DiscImageCandidate& image : images)
{
printf(" %-6s %s (%s)\n", image.status.Ok() ? "ready" : "no", image.path.c_str(),
printf(" %-6s %s (%s)\n", image.status.Ok() ? "ready" : "no", image.path.string().c_str(),
FormatSize(image.size).c_str());
if (!image.status.Ok())
printf(" %s: %s\n", ErrorName(image.status.error), image.status.message.c_str());
@@ -220,10 +242,10 @@ namespace install
{
const portable::Layout& layout = portable::Current();
if (layout.Active())
printf("Portable mode (%s in %s): data in %s, caches in %s\n", portable::kMarker, layout.root.c_str(),
GetUserPath().c_str(), GetCachePath().c_str());
printf("Portable mode (%s in %s): data in %s, caches in %s\n", portable::kMarker, layout.root.string().c_str(),
GetUserPath().string().c_str(), GetCachePath().string().c_str());
else
printf("Data in %s, caches in %s\n", GetUserPath().c_str(), GetCachePath().c_str());
printf("Data in %s, caches in %s\n", GetUserPath().string().c_str(), GetCachePath().string().c_str());
}
int RunWhere()
@@ -246,7 +268,7 @@ namespace install
}
const char* origin = game->origin == InstallOrigin::Environment ? "NFSMW_GAME_DIR"
: game->origin == InstallOrigin::Development ? "development checkout" : "installed";
printf("%s (%s%s)\n", game->path.c_str(), origin, game->marker ? ", verified by the installer" : "");
printf("%s (%s%s)\n", game->path.string().c_str(), origin, game->marker ? ", verified by the installer" : "");
PrintDataFolders();
return 0;
}
@@ -267,7 +289,7 @@ namespace install
std::unique_ptr<DiscSource> source;
if (Result r = OpenDiscSource(from, source); !r.Ok())
return r;
printf("Copying the game from %s (%s), checking every file:\n", from.c_str(),
printf("Copying the game from %s (%s), checking every file:\n", from.string().c_str(),
FormatSize(GameManifest().totalBytes).c_str());
ProgressPrinter printer;
Result r = Install(*source, to, std::ref(printer), &s_cancel);