Skip to content

Commit

Permalink
v0.8.0
Browse files Browse the repository at this point in the history
add igdb as games info source
  • Loading branch information
Ciberusps committed Jun 16, 2024
1 parent 1708174 commit da79c8f
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 13 deletions.
89 changes: 82 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FireSave",
"version": "0.7.4",
"version": "0.8.0",
"description": "Saves manager",
"main": "./src/main/main.ts",
"scripts": {
Expand Down Expand Up @@ -136,6 +136,7 @@
"i18next-fs-backend": "^1.1.4",
"lodash.debounce": "^4.0.8",
"lodash.groupby": "^4.6.0",
"make-synchronous": "^0.1.1",
"nanoid": "^3.2.0",
"node-wmi": "^0.0.5",
"parse-filepath": "^1.0.2",
Expand Down
2 changes: 1 addition & 1 deletion release/app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FireSave",
"version": "0.7.4",
"version": "0.8.0",
"description": "Saves manager",
"main": "./dist/main/main.js",
"author": {
Expand Down
4 changes: 2 additions & 2 deletions src/main/handlers/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const GamesHandlers: TGamesHandlers = {
}

const name = payload.gamePath.files?.[0] || "Unknown";
const savePointsFolderName = name.replace(".exe", "");

const newGame: TGame = {
id,
Expand All @@ -47,8 +48,7 @@ const GamesHandlers: TGamesHandlers = {
isSaveConfigValid: false,
isSettupedAtLeastOnce: true,
isPlaingNow: false,
// name but probably installDir better, mb for steamgames prefix "steam__" can be done or for others "nonsteam__"
savePointsFolderName: name.replace(".exe", ""),
savePointsFolderName,
savesStats: { total: 0, auto: 0, manual: 0 },
imageUrl: undefined,
gamePath: { [PLATFORM]: payload.gamePath },
Expand Down
54 changes: 54 additions & 0 deletions src/main/stores/games.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import ElectronStore from "electron-store";
import makeSynchronous from "make-synchronous";

import persistentStore from "./persistent";
import FileSystem from "../utils/fileSystem";
import { PLATFORM } from "../utils/config";
import { findSteam, ISteamApp } from "@ciberus/find-steam-app";

const DEFAULT_TAGS_LIST = [
"auto",
Expand Down Expand Up @@ -124,6 +126,58 @@ const gamesStore = new ElectronStore<TGamesStore>({

store.set("games", games);
},
"0.8.0": (store) => {
let games = store.store.games;

const steamInfo = makeSynchronous(findSteam)();
const steamApps: ISteamApp[] = [];
for (const lib of steamInfo.libraries) {
for (const steamApp of lib.apps) {
steamApps.push(steamApp);
}
}

console.log("KDSFLKD", steamApps.length, steamApps);

Object.entries(games).forEach(async ([, game]) => {
if (
game.isAutoDetectionEnabled &&
game.autoDetectionMethod === "steam"
) {
console.log("KDSFLKD 1 ", game.id, game.name);
const steamAppInfo = steamApps.find(
(s) => s.appId === game.steamAppId
);
const newSavePointsFolderName = steamAppInfo?.manifest.installdir;
console.log(
"KDSFLKD 2 ",
game.id,
game.name,
newSavePointsFolderName
);

if (newSavePointsFolderName) {
const savesFolderPath = FileSystem.joinUpath(
persistentStore.store.savesFolder,
`${game.savePointsFolderName}__${game.id}`
);
const newSavesFolderPath = FileSystem.joinUpath(
persistentStore.store.savesFolder,
`${newSavePointsFolderName}__${game.id}`
);

game.savePointsFolderName = newSavePointsFolderName;

try {
FileSystem.renameFolder(savesFolderPath, newSavesFolderPath);
} catch (err) {}
}
}
});

console.log("New GAMES EPTA", games);
gamesStore.set("games", games);
},
},
});

Expand Down
3 changes: 3 additions & 0 deletions src/main/utils/fileSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const normalizePathForCurrentOS = (pathString: string): string => {
return path.normalize(pathString);
};

const renameFolder = fs.promises.rename;

const FileSystem = {
writeFileSync,
copyFolder,
Expand All @@ -63,6 +65,7 @@ const FileSystem = {
join,
joinUpath,
normalizePathForCurrentOS,
renameFolder,
};

export default FileSystem;
2 changes: 1 addition & 1 deletion src/main/utils/games.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const convertSteamAppToGame = (
isSettupedAtLeastOnce: false,
isPlaingNow: false,
// name but probably installDir better, mb for steamgames prefix "steam__" can be done or for others "nonsteam__"
savePointsFolderName: steamApp.manifest.name,
savePointsFolderName: steamApp.manifest.installdir,
savesStats: { total: 0, auto: 0, manual: 0 },
imageUrl: storeInfo?.header_image,
gamePath: {
Expand Down

0 comments on commit da79c8f

Please sign in to comment.