Skip to content
New issue

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

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

Already on GitHub? # to your account

DLC unrecognized after CNMT lookup failure, fallback infers incorrect base title_id #97

Closed
PortableProgrammer opened this issue Aug 7, 2024 · 5 comments

Comments

@PortableProgrammer
Copy link

PortableProgrammer commented Aug 7, 2024

For certain DLC (e.g. The Legend of Heroes Trails through Daybreak [DLC][010040C01D249001][v0].nsp) that are not present in cnmts.json, the base title_id is not correctly inferred.

Ownfoil attempts to locate the base title_id by replacing the last three characters of the app_id with 000 to get the assumed base, which results in 010040C01D249000 instead of the correct base 010040C01D248000, causing the base title_id to be Unrecognized. The Unrecognized title also causes QoL features like Missing Update and Missing DLC to be less useful, since the default is "missing", potentially masking true missing updates/DLC.

While researching this issue, I spot-checked ~50 DLC ("titleType": 130) entries in cnmts.json and found that in every case, the correct base title_id could be inferred by subtracting 0x01 from app_id[:-3] before appending 000.

So instead of:

ownfoil/app/titles.py

Lines 83 to 84 in 8e77292

app_type = APP_TYPE_DLC
title_id = app_id[:-3] + '000'

You could do:

app_type = APP_TYPE_DLC
title_id = hex(int(app_id[:-3], base=16) - 0x01)[2:].rjust(13, '0') + '000'

Which works in basic testing:

> python3
>>> app_id = '010040C01D249001'
>>> hex(int(app_id[:-3], base=16) - 0x01)[2:].rjust(13, '0') + '000'
'010040c01d248000'
>>> app_id = '0100ED9018F3F001'
>>> hex(int(app_id[:-3], base=16) - 0x01)[2:].rjust(13, '0') + '000'
'0100ed9018f3e000'
The DLC is present in titles.US.en.json, so the banner, DLC name, etc. are pulled correctly.

Screenshot 2024-08-07 at 9 17 20 AM

"70050000048589": {
        "bannerUrl": "https://img-eshop.cdn.nintendo.net/i/f79b3345414d4df502720155c76e25f65213b86a7c7fb2dea0080add46145c59.jpg",
        "category": null,
        "description": "This set includes the following DLC:\n- Holo Core Voice: Latoya Hamilton\n- Risette's Marduk Battle Maid Suit\n- Feri's Kruga Priestess Garb\n- 'Gift from Spriggan A' Item Set \n- 'Gift from Spriggan B' Item Set \n- Agn\u00e8s' Old Calvardian Kingdom Dress\n- Dark Azure Treasure Box\n- 40th Anniversary Xipha Cover\n- 4SPG UNITED: Van\n- 4SPG UNITED: Agn\u00e8s\n- 4SPG UNITED: Feri\n- 4SPG UNITED: Aaron\n- Judith's Golden Blood Suit",
        "developer": null,
        "frontBoxArt": null,
        "iconUrl": null,
        "id": "010040C01D249001",
        "ids": [
            "010040C01D249001"
        ],
        "intro": null,
        "isDemo": false,
        "key": null,
        "languages": null,
        "name": "Trails through Daybreak - Bonus Set",
        "nsuId": 70050000048589,
        "numberOfPlayers": null,
        "publisher": "NIS America",
        "rating": 13,
        "ratingContent": [
            "Blood",
            "Drug Reference",
            "Fantasy Violence",
            "Language",
            "Suggestive Themes"
        ],
        "region": null,
        "releaseDate": 20240705,
        "rightsId": null,
        "screenshots": null,
        "size": 0,
        "version": null
    },

So far I have seen this behavior on the following titles:

  • Cult of the Lamb
    • 01002E7016C47001 vs. 01002E7016C46000
  • Eiyuden Chronicle Hundred Heroes
    • 0100ED9018F3F001 vs. 0100ED9018F3E000
  • The Legend of Heroes Trails through Daybreak
    • 010040C01D249001 vs. 010040C01D248000
  • Neptunia Game Maker RE:volution
    • 010082901D6F3002 vs. 010082901D6F2000
  • SaGa Emerald Beyond
    • 01008BE01E1C3001 vs. 01008BE01E1C2000
  • Unicorn Overlord
    • 010069401ADB9001 vs. 010069401ADB8000

Edit: add rjust() to ensure proper hex string length

@a1ex4
Copy link
Owner

a1ex4 commented Aug 13, 2024

Thank you very much for your investigations and providing the fix! I couldn't figure it out and always was wondering how to get the correct Title ID. I implemented the fix in the develop branch, the new version can be tested by pulling the develop tag of the image. Although you need to rescan the library from scratch, by first deleting the directory and adding it again in the settings page.

@PortableProgrammer
Copy link
Author

Confirmed, develop has fixed this issue:
Screenshot 2024-08-13 at 4 23 05 PM

I see one other null DLC, but it appears to be a different issue. I believe it's just not in titles.US.en.json at all, which displays null for the DLC title and no image. I'll research it when I can get a few minutes to play around with it some more.

@a1ex4
Copy link
Owner

a1ex4 commented Aug 13, 2024

Thanks for the feedback. I just noticed and fixed an issue where titledb was not updating to the latest available, it was stuck with a 19 days old titlesdb. Maybe that's why it is missing currently, you can test the new version when the image is done building in ~20 minutes.

@PortableProgrammer
Copy link
Author

The DLC that is failing with null, 0100ED9018F3F004, is not in the latest version of blawar/titledb/US.en.json as of this writing, so the titledb update above wouldn't have mattered, unfortunately. Regardless, I believe my original issue is fixed; this remaining one appears to be a product of a pending titledb update.

I have another DLC, 01002E7016C47005, which is also missing from titledb, but it's handled differently, labeled as Unrecognized and not found in titledb. I'll review and see if I can suss out the null problem with 0100ED9018F3F004.

0100ED9018F3F004 and 01002E7016C47005

Screenshot 2024-08-14 at 8 08 03 AM

Screenshot 2024-08-14 at 8 07 53 AM

@a1ex4
Copy link
Owner

a1ex4 commented Aug 15, 2024

Fix merged in master.

@a1ex4 a1ex4 closed this as completed Aug 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants