Merge branch 'main' into sse

This commit is contained in:
Ondřej Novák 2025-05-09 08:04:02 +02:00
commit 5931c6eab4
37 changed files with 739 additions and 147 deletions

View file

@ -1,6 +1,7 @@
#include "../../game/skeldal.h"
#include "../getopt.h"
#include "../platform.h"
#include "../error.h"
#include <iostream>
#include <string>
#include <sstream>
@ -86,7 +87,7 @@ int main(int argc, char **argv) {
}
} catch (const std::exception &e) {
cfg.show_error(e.what());
cfg.show_error(exception_to_string(e).c_str());
return 1;
}
catch (...) {

View file

@ -15,13 +15,17 @@ std::string getSavedGamesDirectory() {
PWSTR path = nullptr;
if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_SavedGames, 0, NULL, &path))) {
fs::path savedGamesPath(path);
CoTaskMemFree(path);
return (savedGamesPath / SAVEGAME_FOLDERNAME).string();
CoTaskMemFree(path);
// Převod na UTF-8 std::string
std::u8string utf8 = (savedGamesPath / SAVEGAME_FOLDERNAME).u8string();
return std::string(reinterpret_cast<const char*>(utf8.data()), utf8.size());
} else {
display_error("Failed to retrieve FOLDEROD_SavedGames");
display_error("Failed to retrieve FOLDERID_SavedGames");
abort();
}
}
const char *get_default_savegame_directory() {
static std::string dir = getSavedGamesDirectory();