Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Initial Tweaks to get the app to build / launch / import games properly first time. #2351

Closed

Conversation

proskd
Copy link
Contributor

@proskd proskd commented Oct 11, 2024

User description

  1. adjust name of one of the jagboot bioses to temporarily avoid the filename conflict in Realm on initial launch

  2. fix GameImporter.swift to properly load the system to file path map

There is a known issue not fixed here where the HUD state won't properly update after importing games, we will fix that separately.

What does this PR do

Fixes some errors preventing a clean app build / launch / import on first attempt.

Where should the reviewer start

How should this be manually tested

do a fresh clone of the repo, build and run for the first time.

Any background context you want to provide

What are the relevant tickets

Screenshots (important for UI changes)

Questions


PR Type

Bug fix


Description

  • Fixed a filename conflict by renaming jagboot.rom to jagboot1.rom in two plist files.
  • Refactored the updateSystemToPathMap function in GameImporter.swift to remove redundant code and improve functionality.

Changes walkthrough 📝

Relevant files
Bug fix
GameImporter.swift
Refactor system to path map update logic                                 

PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift

  • Removed redundant variable declaration in updateSystemToPathMap
    function.
  • Improved the logic for mapping system identifiers to ROM directories.
  • +0/-1     
    systems.plist
    Rename Jaguar BIOS file to avoid conflict                               

    PVCoreLoader/Sources/PVCoreLoader/Resources/systems.plist

  • Renamed jagboot.rom to jagboot1.rom to avoid filename conflict.
  • +1/-1     
    systems.plist
    Rename Jaguar BIOS file to avoid conflict                               

    PVLibrary/Sources/PVLibrary/Resources/systems.plist

  • Renamed jagboot.rom to jagboot1.rom to avoid filename conflict.
  • +1/-1     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    …filename conflict in Realm on initial launch
    
    2.  fix GameImporter.swift to properly load the system to file path map
    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Code Improvement
    The removal of the redundant variable declaration in the updateSystemToPathMap function improves code clarity. However, it's worth verifying if this change maintains the intended functionality.

    Filename Change
    The BIOS filename for the Jaguar system has been changed from 'jagboot.rom' to 'jagboot1.rom'. Ensure this change is consistent across the entire project and doesn't break any existing functionality.

    Filename Consistency
    Verify that the BIOS filename change from 'jagboot.rom' to 'jagboot1.rom' is consistent with the change made in the PVCoreLoader systems.plist file.

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Enhance error handling and logging in data processing operations

    Consider adding error handling or logging for cases where system.romsDirectory might
    be nil or inaccessible, to improve robustness and debugging capabilities.

    PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift [144-146]

    -return await systems.async.reduce(into: [String: URL]()) {partialResult, system in
    -    partialResult[system.identifier] = system.romsDirectory
    +return await systems.async.reduce(into: [String: URL]()) { partialResult, system in
    +    if let romsDirectory = system.romsDirectory {
    +        partialResult[system.identifier] = romsDirectory
    +    } else {
    +        print("Warning: ROMs directory not found for system: \(system.identifier)")
    +    }
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Adding error handling for cases where system.romsDirectory might be nil or inaccessible significantly improves the robustness and debugging capabilities of the code, making this a valuable enhancement.

    8
    Enhancement
    Improve code readability by using more descriptive parameter names in closures

    Consider using a more descriptive name for the closure parameter partialResult. A
    name like systemMap would better reflect its purpose in mapping system identifiers
    to ROM directories.

    PVLibrary/Sources/PVLibrary/Importer/Services/GameImporter/GameImporter.swift [144-146]

    -return await systems.async.reduce(into: [String: URL]()) {partialResult, system in
    -    partialResult[system.identifier] = system.romsDirectory
    +return await systems.async.reduce(into: [String: URL]()) { systemMap, system in
    +    systemMap[system.identifier] = system.romsDirectory
     }
    • Apply this suggestion
    Suggestion importance[1-10]: 5

    Why: The suggestion to rename partialResult to systemMap improves code readability by making the purpose of the variable clearer. However, it doesn't address any functional issues, so its impact is moderate.

    5

    💡 Need additional feedback ? start a PR chat

    @JoeMatt
    Copy link
    Member

    JoeMatt commented Oct 13, 2024

    my submodule was fucked so I did this local and force pushed. Thanks again @proskd !

    @JoeMatt JoeMatt closed this Oct 13, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants