Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dad3dcafb7 | ||
|
|
c6ef2ea0b4 | ||
|
|
e4d9f8ba45 | ||
|
|
87a4319360 | ||
|
|
dc232e1e43 | ||
|
|
39be891452 | ||
|
|
c3cad7c793 | ||
|
|
2952322759 | ||
|
|
653bc8668c | ||
|
|
1a23851000 | ||
|
|
560d1cd273 | ||
|
|
dc0d7304f1 |
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@@ -51,10 +51,10 @@ jobs:
|
|||||||
timeout 2 cartridges; [ "$?" -eq "124" ]
|
timeout 2 cartridges; [ "$?" -eq "124" ]
|
||||||
|
|
||||||
- name: Inno Setup
|
- name: Inno Setup
|
||||||
run: iscc ".\_build\Cartridges.iss"
|
run: iscc ".\_build\windows\Cartridges.iss"
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Windows Installer
|
name: Windows Installer
|
||||||
path: _build/Output/Cartridges Setup.exe
|
path: _build/windows/Output/Cartridges Setup.exe
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<default>true</default>
|
<default>true</default>
|
||||||
</key>
|
</key>
|
||||||
<key name="steam-location" type="s">
|
<key name="steam-location" type="s">
|
||||||
<default>"~/.steam/"</default>
|
<default>"~/.steam/steam"</default>
|
||||||
</key>
|
</key>
|
||||||
<key name="lutris" type="b">
|
<key name="lutris" type="b">
|
||||||
<default>true</default>
|
<default>true</default>
|
||||||
|
|||||||
@@ -44,6 +44,13 @@
|
|||||||
</screenshots>
|
</screenshots>
|
||||||
<content_rating type="oars-1.1" />
|
<content_rating type="oars-1.1" />
|
||||||
<releases>
|
<releases>
|
||||||
|
<release version="2.0.2" date="2023-07-08">
|
||||||
|
<description translatable="no">
|
||||||
|
<ul>
|
||||||
|
<li>Fixes an issue with internal data storage</li>
|
||||||
|
</ul>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release version="2.0" date="2023-07-05">
|
<release version="2.0" date="2023-07-05">
|
||||||
<description translatable="no">
|
<description translatable="no">
|
||||||
<p>After months of work, Cartridges 2.0 is here:</p>
|
<p>After months of work, Cartridges 2.0 is here:</p>
|
||||||
|
|||||||
@@ -28,8 +28,7 @@
|
|||||||
"/share/man",
|
"/share/man",
|
||||||
"/share/pkgconfig",
|
"/share/pkgconfig",
|
||||||
"*.la",
|
"*.la",
|
||||||
"*.a",
|
"*.a"
|
||||||
"Cartridges.iss"
|
|
||||||
],
|
],
|
||||||
"modules" : [
|
"modules" : [
|
||||||
{
|
{
|
||||||
|
|||||||
12
meson.build
12
meson.build
@@ -1,5 +1,5 @@
|
|||||||
project('cartridges',
|
project('cartridges',
|
||||||
version: '2.0',
|
version: '2.0.2',
|
||||||
meson_version: '>= 0.59.0',
|
meson_version: '>= 0.59.0',
|
||||||
default_options: [ 'warning_level=2', 'werror=false', ],
|
default_options: [ 'warning_level=2', 'werror=false', ],
|
||||||
)
|
)
|
||||||
@@ -33,13 +33,9 @@ subdir('data')
|
|||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
|
||||||
configure_file(
|
if host_machine.system() == 'windows'
|
||||||
input: './windows/Cartridges.iss.in',
|
subdir('windows')
|
||||||
output: 'Cartridges.iss',
|
endif
|
||||||
configuration: conf,
|
|
||||||
install: true,
|
|
||||||
install_dir: '.'
|
|
||||||
)
|
|
||||||
|
|
||||||
gnome.post_install(
|
gnome.post_install(
|
||||||
glib_compile_schemas: true,
|
glib_compile_schemas: true,
|
||||||
|
|||||||
@@ -155,9 +155,10 @@ class DetailsWindow(Adw.Window):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# Increment the number after the game id (eg. imported_1, imported_2)
|
# Increment the number after the game id (eg. imported_1, imported_2)
|
||||||
|
source_id = "imported"
|
||||||
numbers = [0]
|
numbers = [0]
|
||||||
game_id: str
|
game_id: str
|
||||||
for game_id in shared.store.games:
|
for game_id in shared.source_games[source_id]:
|
||||||
prefix = "imported_"
|
prefix = "imported_"
|
||||||
if not game_id.startswith(prefix):
|
if not game_id.startswith(prefix):
|
||||||
continue
|
continue
|
||||||
@@ -168,7 +169,7 @@ class DetailsWindow(Adw.Window):
|
|||||||
{
|
{
|
||||||
"game_id": f"imported_{game_number}",
|
"game_id": f"imported_{game_number}",
|
||||||
"hidden": False,
|
"hidden": False,
|
||||||
"source": "imported",
|
"source": source_id,
|
||||||
"added": int(time()),
|
"added": int(time()),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ class Importer(ErrorProducer):
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Use several Gio.Task to import games from added sources"""
|
"""Use several Gio.Task to import games from added sources"""
|
||||||
|
|
||||||
|
shared.win.get_application().lookup_action("import").set_enabled(False)
|
||||||
|
|
||||||
self.create_dialog()
|
self.create_dialog()
|
||||||
|
|
||||||
# Collect all errors and reset the cancellables for the managers
|
# Collect all errors and reset the cancellables for the managers
|
||||||
@@ -221,6 +223,7 @@ class Importer(ErrorProducer):
|
|||||||
self.import_dialog.close()
|
self.import_dialog.close()
|
||||||
self.summary_toast = self.create_summary_toast()
|
self.summary_toast = self.create_summary_toast()
|
||||||
self.create_error_dialog()
|
self.create_error_dialog()
|
||||||
|
shared.win.get_application().lookup_action("import").set_enabled(True)
|
||||||
|
|
||||||
def create_error_dialog(self):
|
def create_error_dialog(self):
|
||||||
"""Dialog containing all errors raised by importers"""
|
"""Dialog containing all errors raised by importers"""
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class HeroicSourceIterator(SourceIterator):
|
|||||||
runner = entry["runner"]
|
runner = entry["runner"]
|
||||||
service = self.sub_sources[runner]["service"]
|
service = self.sub_sources[runner]["service"]
|
||||||
values = {
|
values = {
|
||||||
"source": self.source.id,
|
"source": f"{self.source.id}_{service}",
|
||||||
"added": added_time,
|
"added": added_time,
|
||||||
"name": entry["title"],
|
"name": entry["title"],
|
||||||
"developer": entry.get("developer", None),
|
"developer": entry.get("developer", None),
|
||||||
@@ -159,4 +159,4 @@ class HeroicSource(URLExecutableSource):
|
|||||||
@property
|
@property
|
||||||
def game_id_format(self) -> str:
|
def game_id_format(self) -> str:
|
||||||
"""The string format used to construct game IDs"""
|
"""The string format used to construct game IDs"""
|
||||||
return self.name.lower() + "_{service}_{game_id}"
|
return self.id + "_{service}_{game_id}"
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ class SteamSource(URLExecutableSource):
|
|||||||
data_location = Location(
|
data_location = Location(
|
||||||
schema_key="steam-location",
|
schema_key="steam-location",
|
||||||
candidates=(
|
candidates=(
|
||||||
shared.flatpak_dir / "com.valvesoftware.Steam" / "data" / "Steam",
|
shared.home / ".steam" / "steam",
|
||||||
shared.data_dir / "Steam",
|
shared.data_dir / "Steam",
|
||||||
shared.home / ".steam",
|
shared.flatpak_dir / "com.valvesoftware.Steam" / "data" / "Steam",
|
||||||
shared.programfiles32_dir / "Steam",
|
shared.programfiles32_dir / "Steam",
|
||||||
),
|
),
|
||||||
paths={
|
paths={
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ class CartridgesApplication(Adw.Application):
|
|||||||
shared.store.add_manager(SteamAPIManager())
|
shared.store.add_manager(SteamAPIManager())
|
||||||
shared.store.add_manager(OnlineCoverManager())
|
shared.store.add_manager(OnlineCoverManager())
|
||||||
shared.store.add_manager(SGDBManager())
|
shared.store.add_manager(SGDBManager())
|
||||||
shared.store.enable_manager_in_pipelines(FileManager)
|
shared.store.toggle_manager_in_pipelines(FileManager, True)
|
||||||
|
|
||||||
# Create actions
|
# Create actions
|
||||||
self.create_actions(
|
self.create_actions(
|
||||||
@@ -179,6 +179,7 @@ class CartridgesApplication(Adw.Application):
|
|||||||
# Translators: Replace this with your name for it to show up in the about window
|
# Translators: Replace this with your name for it to show up in the about window
|
||||||
translator_credits=_("translator_credits"),
|
translator_credits=_("translator_credits"),
|
||||||
debug_info=debug_str,
|
debug_info=debug_str,
|
||||||
|
debug_info_filename="cartridges.log",
|
||||||
)
|
)
|
||||||
about.present()
|
about.present()
|
||||||
|
|
||||||
|
|||||||
@@ -214,10 +214,9 @@ class PreferencesWindow(Adw.PreferencesWindow):
|
|||||||
self.toast.dismiss()
|
self.toast.dismiss()
|
||||||
|
|
||||||
def remove_all_games(self, *_args):
|
def remove_all_games(self, *_args):
|
||||||
for game in shared.store.games.values():
|
for game in shared.store:
|
||||||
if not game.removed:
|
if not game.removed:
|
||||||
self.removed_games.add(game)
|
self.removed_games.add(game)
|
||||||
|
|
||||||
game.removed = True
|
game.removed = True
|
||||||
game.save()
|
game.save()
|
||||||
game.update()
|
game.update()
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ state_schema = Gio.Settings.new(APP_ID + ".State")
|
|||||||
home = Path.home()
|
home = Path.home()
|
||||||
data_dir = Path(GLib.get_user_data_dir())
|
data_dir = Path(GLib.get_user_data_dir())
|
||||||
config_dir = Path(GLib.get_user_config_dir())
|
config_dir = Path(GLib.get_user_config_dir())
|
||||||
cache_dir = Path(GLib.get_user_config_dir())
|
cache_dir = Path(GLib.get_user_cache_dir())
|
||||||
flatpak_dir = home / ".var" / "app"
|
flatpak_dir = home / ".var" / "app"
|
||||||
|
|
||||||
games_dir = data_dir / "cartridges" / "games"
|
games_dir = data_dir / "cartridges" / "games"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
from typing import MutableMapping, Generator, Any
|
||||||
|
|
||||||
from src import shared
|
from src import shared
|
||||||
from src.game import Game
|
from src.game import Game
|
||||||
@@ -31,24 +32,59 @@ class Store:
|
|||||||
managers: dict[type[Manager], Manager]
|
managers: dict[type[Manager], Manager]
|
||||||
pipeline_managers: set[Manager]
|
pipeline_managers: set[Manager]
|
||||||
pipelines: dict[str, Pipeline]
|
pipelines: dict[str, Pipeline]
|
||||||
games: dict[str, Game]
|
source_games: MutableMapping[str, MutableMapping[str, Game]]
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.managers = {}
|
self.managers = {}
|
||||||
self.pipeline_managers = set()
|
self.pipeline_managers = set()
|
||||||
self.pipelines = {}
|
self.pipelines = {}
|
||||||
self.games = {}
|
self.source_games = {}
|
||||||
|
|
||||||
|
def __contains__(self, obj: object) -> bool:
|
||||||
|
"""Check if the game is present in the store with the `in` keyword"""
|
||||||
|
if not isinstance(obj, Game):
|
||||||
|
return False
|
||||||
|
if not (source_mapping := self.source_games.get(obj.source)):
|
||||||
|
return False
|
||||||
|
return obj.game_id in source_mapping
|
||||||
|
|
||||||
|
def __iter__(self) -> Generator[Game, None, None]:
|
||||||
|
"""Iterate through the games in the store with `for ... in`"""
|
||||||
|
for _source_id, games_mapping in self.source_games.items():
|
||||||
|
for _game_id, game in games_mapping.items():
|
||||||
|
yield game
|
||||||
|
|
||||||
|
def __len__(self) -> int:
|
||||||
|
"""Get the number of games in the store with the `len` builtin"""
|
||||||
|
return sum(len(source_mapping) for source_mapping in self.source_games)
|
||||||
|
|
||||||
|
def __getitem__(self, game_id: str) -> Game:
|
||||||
|
"""Get a game by its id with `store["game_id_goes_here"]`"""
|
||||||
|
for game in iter(self):
|
||||||
|
if game.game_id == game_id:
|
||||||
|
return game
|
||||||
|
raise KeyError("Game not found in store")
|
||||||
|
|
||||||
|
def get(self, game_id: str, default: Any = None) -> Game | Any:
|
||||||
|
"""Get a game by its ID, with a fallback if not found"""
|
||||||
|
try:
|
||||||
|
game = self[game_id]
|
||||||
|
return game
|
||||||
|
except KeyError:
|
||||||
|
return default
|
||||||
|
|
||||||
def add_manager(self, manager: Manager, in_pipeline=True):
|
def add_manager(self, manager: Manager, in_pipeline=True):
|
||||||
"""Add a manager to the store"""
|
"""Add a manager to the store"""
|
||||||
manager_type = type(manager)
|
manager_type = type(manager)
|
||||||
self.managers[manager_type] = manager
|
self.managers[manager_type] = manager
|
||||||
if in_pipeline:
|
self.toggle_manager_in_pipelines(manager_type, in_pipeline)
|
||||||
self.enable_manager_in_pipelines(manager_type)
|
|
||||||
|
|
||||||
def enable_manager_in_pipelines(self, manager_type: type[Manager]):
|
def toggle_manager_in_pipelines(self, manager_type: type[Manager], enable: bool):
|
||||||
"""Make a manager run in new pipelines"""
|
"""Change if a manager should run in new pipelines"""
|
||||||
|
if enable:
|
||||||
self.pipeline_managers.add(self.managers[manager_type])
|
self.pipeline_managers.add(self.managers[manager_type])
|
||||||
|
else:
|
||||||
|
self.pipeline_managers.discard(self.managers[manager_type])
|
||||||
|
|
||||||
def cleanup_game(self, game: Game) -> None:
|
def cleanup_game(self, game: Game) -> None:
|
||||||
"""Remove a game's files"""
|
"""Remove a game's files"""
|
||||||
@@ -74,7 +110,7 @@ class Store:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
# Handle game duplicates
|
# Handle game duplicates
|
||||||
stored_game = self.games.get(game.game_id)
|
stored_game = self.get(game.game_id)
|
||||||
if not stored_game:
|
if not stored_game:
|
||||||
# New game, do as normal
|
# New game, do as normal
|
||||||
logging.debug("New store game %s (%s)", game.name, game.game_id)
|
logging.debug("New store game %s (%s)", game.name, game.game_id)
|
||||||
@@ -96,11 +132,15 @@ class Store:
|
|||||||
for signal in manager.signals:
|
for signal in manager.signals:
|
||||||
game.connect(signal, manager.execute_resilient_manager_logic)
|
game.connect(signal, manager.execute_resilient_manager_logic)
|
||||||
|
|
||||||
|
# Add the game to the store
|
||||||
|
if not game.source in self.source_games:
|
||||||
|
self.source_games[game.source] = {}
|
||||||
|
self.source_games[game.source][game.game_id] = game
|
||||||
|
|
||||||
# Run the pipeline for the game
|
# Run the pipeline for the game
|
||||||
if not run_pipeline:
|
if not run_pipeline:
|
||||||
return None
|
return None
|
||||||
pipeline = Pipeline(game, additional_data, self.pipeline_managers)
|
pipeline = Pipeline(game, additional_data, self.pipeline_managers)
|
||||||
self.games[game.game_id] = game
|
|
||||||
self.pipelines[game.game_id] = pipeline
|
self.pipelines[game.game_id] = pipeline
|
||||||
pipeline.advance()
|
pipeline.advance()
|
||||||
return pipeline
|
return pipeline
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class CartridgesWindow(Adw.ApplicationWindow):
|
|||||||
def set_library_child(self):
|
def set_library_child(self):
|
||||||
child, hidden_child = self.notice_empty, self.hidden_notice_empty
|
child, hidden_child = self.notice_empty, self.hidden_notice_empty
|
||||||
|
|
||||||
for game in shared.store.games.values():
|
for game in shared.store:
|
||||||
if game.removed or game.blacklisted:
|
if game.removed or game.blacklisted:
|
||||||
continue
|
continue
|
||||||
if game.hidden:
|
if game.hidden:
|
||||||
|
|||||||
@@ -15,10 +15,10 @@ AppSupportURL=https://github.com/kra-mo/cartridges/issues
|
|||||||
AppUpdatesURL={#MyAppURL}
|
AppUpdatesURL={#MyAppURL}
|
||||||
DefaultDirName={autopf64}\{#MyAppName}
|
DefaultDirName={autopf64}\{#MyAppName}
|
||||||
DisableProgramGroupPage=yes
|
DisableProgramGroupPage=yes
|
||||||
LicenseFile=..\LICENSE
|
LicenseFile=..\..\LICENSE
|
||||||
PrivilegesRequiredOverridesAllowed=dialog
|
PrivilegesRequiredOverridesAllowed=dialog
|
||||||
OutputBaseFilename=Cartridges Setup
|
OutputBaseFilename=Cartridges Setup
|
||||||
SetupIconFile=..\windows\icon.ico
|
SetupIconFile=..\..\windows\icon.ico
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
@@ -50,7 +50,7 @@ Source: "D:\a\_temp\msys64\ucrt64\share\glib-2.0\*"; DestDir: "{app}\share\glib-
|
|||||||
Source: "D:\a\_temp\msys64\ucrt64\share\gtk-4.0\*"; DestDir: "{app}\share\gtk-4.0"; Flags: recursesubdirs ignoreversion
|
Source: "D:\a\_temp\msys64\ucrt64\share\gtk-4.0\*"; DestDir: "{app}\share\gtk-4.0"; Flags: recursesubdirs ignoreversion
|
||||||
Source: "D:\a\_temp\msys64\ucrt64\share\locale\*"; DestDir: "{app}\share\locale"; Flags: recursesubdirs ignoreversion
|
Source: "D:\a\_temp\msys64\ucrt64\share\locale\*"; DestDir: "{app}\share\locale"; Flags: recursesubdirs ignoreversion
|
||||||
|
|
||||||
Source: "..\windows\icon.ico"; DestDir: "{app}"; Flags: recursesubdirs ignoreversion
|
Source: "..\..\windows\icon.ico"; DestDir: "{app}"; Flags: recursesubdirs ignoreversion
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"; Parameters: """{app}\bin\cartridges"""; IconFilename: "{app}\icon.ico"
|
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\bin\{#MyAppExeName}"; Parameters: """{app}\bin\cartridges"""; IconFilename: "{app}\icon.ico"
|
||||||
|
|||||||
7
windows/meson.build
Normal file
7
windows/meson.build
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
configure_file(
|
||||||
|
input: './Cartridges.iss.in',
|
||||||
|
output: 'Cartridges.iss',
|
||||||
|
configuration: conf,
|
||||||
|
install: true,
|
||||||
|
install_dir: '.'
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user