XboxUnity / AuroraScripts

Various LUA scripts for Aurora
33 stars 16 forks source link

Content.GetInfo(contentId) always returns empty table #32

Closed EmiMods closed 2 weeks ago

EmiMods commented 2 weeks ago

Content.GetInfo(contentId) appears to always return an empty table (#table == 0).

To provide a bit of information on my usecase, I've been testing using contentIDs between 252 and 624. My cutoff of 624 appears to correlate to 252 + the number of visible titles in Aurora, which is 372 for me, but that may just be coincidence. Testing with Aurora 0.7b.2.

Swizzy commented 2 weeks ago

Do they exist in the database?

I also assume you've put the permission object to allow access to Content as documented here; https://github.com/XboxUnity/AuroraScripts/tree/lua-annotations?tab=readme-ov-file#script-permissions

EmiMods commented 2 weeks ago

I believe they do exist in the database. Inside Content.db, the ContentItems table has entries with contentID of 252-382. When using Content.GetInfo(335), which is Black Ops in that table, I still get a table of 0 length.

Content is indeed defined in my script permissions. If I try to use Content.GetInfo on a number outside of 252-624 I get a nil response with "Invalid Content ID" so the method does appear to get accessed.

Swizzy commented 2 weeks ago

It does indeed sound like a bug, and having a quick look at the code tells me what the problem likely is, i can't verify anything right now, but - we'll look into it closer and fix it.

This is one of those features that haven't been used by anyone yet i think

EmiMods commented 2 weeks ago

Yeah I wasn't able to find a single script using it so I think you're right. Thank you!

Ste1io commented 2 weeks ago

@EmiMods run this and let me know what it logs:

local function testContentInfoQueries()
    print("calling Content.FindContent()...")
    local found = Content.FindContent()
    print(#found .. " items.")

    if #found > 0 and found[1] then
        local findResult = found[1]
        print(string.format("[1] = {name='%s', id=%d, ..}", findResult.Name, findResult.Id))

        print("calling GetInfo(" .. findResult.Id .. ")...")
        local getResult = Content.GetInfo(findResult.Id)

        if getResult then print(getResult) end
    end
end

[edit] output on my console:

> calling Content.FindContent()...
> 21 items.
> [1] = {name='Call of Duty: Black Ops II', id=45, ..}
> calling GetInfo(45)...
> ["VirtualRoot"]: "\xbox360\system\hdd1"
> ["Developer"]: "Treyarch"
> ["CapabilitiesFlag"]: 57
> ["Publisher"]: "Activision"
> ["MediaId"]: 96946474
> ["Description"]: "The Games on Demand version supports English

Pushing the boundaries of what fans have come to expect from the record-setting entertainment franchise, Call of Duty??: Black Ops II propels players into a near future, 21st Century Cold War, where technology and weapons have converged to create a new generation of warfare. Pre-order today.

Download the manual for this game by locating the game on http://marketplace.xbox.com and selecting ???See Game Manual"."
> ["LiveRating"]: 4.25
> ["Genre"]: 258
> ["DefaultGroup"]: 1
> ["Executable"]: "default.xex"
> ["CapabilitiesOnline"]: 302253058
> ["Hidden"]: false
> ["Favorite"]: false
> ["BaseVersion"]: 2
> ["AssetFlag"]: 100671479
> ["ScriptData"]: ""
> ["Directory"]: "\games\cod - black ops ii"
> ["Type"]: 28672
> ["TitleId"]: 1096157379
> ["Id"]: 45
> ["LastPlayed"]: table: 4199F970
>   ["LowPart"]: 705199408
>   ["Milliseconds"]: 35
>   ["DayOfWeek"]: 4
>   ["Year"]: 2022
>   ["Minute"]: 34
>   ["Month"]: 12
>   ["Second"]: 52
>   ["Hour"]: 13
>   ["HighPart"]: 31005377
>   ["Day"]: 28
> ["CaseIndex"]: 0
> ["CapabilitiesOffline"]: table: 41958490
>   ["HighPart"]: 513
>   ["LowPart"]: 67175425
> ["Flags"]: 20
> ["DiscsInSet"]: 1
> ["ReleaseDate"]: "2012-05-09"
> ["GenreStr"]: "Action & Adventure, Shooter"
> ["LiveRaters"]: 547958
> ["Group"]: 1
> ["Root"]: "hdd1:"
> ["Name"]: "Call of Duty: Black Ops II"
> ["Enabled"]: true
> ["SystemLink"]: true
> ["DateAdded"]: table: 419584C0
>   ["LowPart"]: 1002584624
>   ["Milliseconds"]: 139
>   ["DayOfWeek"]: 2
>   ["Year"]: 2022
>   ["Minute"]: 38
>   ["Month"]: 5
>   ["Second"]: 5
>   ["Hour"]: 14
>   ["HighPart"]: 30957106
>   ["Day"]: 2
> ["DiscNum"]: 1
EmiMods commented 2 weeks ago

@Ste1io Issue was between chair and keyboard.

TL;DR I was mapping the table length incorrectly. You put me on the right track and I sorted it out, thank you.