Skip to content

Delete DLL backups on game update - #588

Merged
beeradmoore merged 1 commit into
mainfrom
feature/reset-dll-on-game-update
Jul 13, 2025
Merged

beeradmoore merged 1 commit into
mainfrom
feature/reset-dll-on-game-update

Conversation

@beeradmoore

Copy link
Copy Markdown
Owner

Description of Changes

When a DLL changes externally we delete the backup file. The intent is that when a game updates the backup is removed because the DLL is technically no longer swapped. This leads the user to believe that resetting will put the game back to where it was, but in reality you are swapping back to what the game had before the update.

Type of Change

  • Bug fix
  • New feature
  • Documentation update

Issues Resolved

#514

@beeradmoore
beeradmoore requested a review from Copilot July 13, 2025 00:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds tracking and cleanup of DLL backups when a game update externally changes a DLL, ensuring history events reflect actual state and removing obsolete backup files.

  • Introduces new GameHistoryEventType values (DLLDetected, DLLChangedExternally, DLLBackupRemoved) and corresponding resource entries and converter mappings.
  • Extends GameHistory with an AssetPath column and updates database inserts to record history events and delete outdated backups.
  • Refactors ProcessGame to extract repeated asset-processing logic into a local function and updates LoadCoverImageAsync to batch-insert history entries.

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Translations/en-US/Resources.resw Added new event labels and updated existing DLL event strings
src/Data/GameHistory.cs Added new enum members and AssetPath property for history tracking
src/Data/Game.cs Refactored ProcessGame, implemented history recording & backup cleanup
src/Converters/GameHistoryEventTypeToLabelConverter.cs Mapped new event types to resource labels
Comments suppressed due to low confidence (5)

src/Data/GameHistory.cs:28

  • After adding AssetPath to GameHistory, ensure you include a corresponding database migration or schema update to add the asset_path column to the GameHistory table. Without this, insert operations may fail at runtime.
    [Column("asset_path")]

src/Data/Game.cs:315

  • [nitpick] The local function name ProcessGame_ProcessGameAsset duplicates the containing method's name and is quite verbose. Consider renaming it to something more concise like HandleGameAsset or ProcessAssetUpdate for clarity.
                    void ProcessGame_ProcessGameAsset(GameAsset gameAsset)

src/Data/Game.cs:312

  • [nitpick] This method has grown significantly with nested local functions and branching. Consider extracting the asset-processing logic into private helper methods on the class to reduce complexity and improve readability.
                    var dllHistory = new List<GameHistory>();

src/Data/Game.cs:481

  • [nitpick] There's a commented-out block for backupGameAsset logic that appears obsolete. Remove this commented code to keep the codebase clean.
                        }

src/Data/Game.cs:329

  • Consider adding unit tests for ProcessGame to verify that the new history events (DLLDetected, DLLChangedExternally, DLLBackupRemoved) are correctly recorded when assets are added, changed, or backups removed.
                                dllHistory.Add(new GameHistory()

Comment thread src/Data/Game.cs
@beeradmoore
beeradmoore merged commit a70ff93 into main Jul 13, 2025
@beeradmoore
beeradmoore deleted the feature/reset-dll-on-game-update branch July 13, 2025 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants