Code Monkey home page Code Monkey logo

Comments (8)

jgayfer avatar jgayfer commented on September 1, 2024 1

Ah! I got it working. You were right; Just had to convert the unsigned values into signed ones 🙂

I used this function to convert the number, if anyone else is having the same issue (Python).

def twos_comp_32(val):
    val = int(val)
     if (val & (1 << (32 - 1))) != 0:
        val = val - (1 << 32)
    return val

Thank you for your help!

from api.

vthornheart-bng avatar vthornheart-bng commented on September 1, 2024

Hmm, that's odd - I see it in there, look for index 925 (name = "Speed of Dark"). Oh, could it be that the hash is being converted to an int instead of a uint in your code? I know this has tripped people up before. Let me know!

from api.

jgayfer avatar jgayfer commented on September 1, 2024

I'm not quite sure where 925 is coming from. I'm still a bit confused.

If the hashes are all unsigned ints, how come I am seeing negative values in my sqlite viewer? Could it be displaying the numbers as signed values?

from api.

vthornheart-bng avatar vthornheart-bng commented on September 1, 2024

Ah, yeah - the index property of the contained item will be 925 when you pull it out of the database.

Indeed: sqlite viewer must be treating those as signed values. Convert your unsigned value into a signed one and make the query again in sqlite viewer, and you should find the result. It's the same limitation and trick that people had to pull in Destiny 1:

http://destinydevs.github.io/BungieNetPlatform/docs/Manifest
(take a look in here under "Entry IDs")

I still need to add a section to our wiki about the Manifest and these... er... quirks.

from api.

vthornheart-bng avatar vthornheart-bng commented on September 1, 2024

Sweet, no problem - and glad you got it working! That is definitely an extremely unintuitive problem with the Manifest, and warrants a new FAQ entry on my part (and eventual Wiki article about the manifest in general)

from api.

artem-galas avatar artem-galas commented on September 1, 2024

Hm...I don't understand how we can check signed or unsigned number?

from api.

jgayfer avatar jgayfer commented on September 1, 2024

If you're using unsigned, you'll never have negative numbers. Whereas with signed, you will (approximately half the time).

from api.

vthornheart-bng avatar vthornheart-bng commented on September 1, 2024

@artem-galas A good, quick formula you can use to convert is the following, that'll convert the values when needed for you: (or you can do the bitshifting jgayfer is doing above of course! That's arguably faster and truer to what's actually happening under the surface, but whatever floats your boat)

if (hash < 0)
{
hash = hash + 4294967296;
}

That will push it up to its unsigned equivalent value.

... indeed, this is a most inconvenient hack, and one that the community has had to endure for quite some time. When we get around to putting out JSON files directly, this won't be an issue anymore (though you will have to convert strings to unsigned ints... but you're already having to do that, so I imagine that's a more obvious problem than this signed/unsigned problem)

from api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.