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

Hexadecimal memory locations for data.json #265

Open
isledge opened this issue Apr 29, 2022 · 1 comment
Open

Hexadecimal memory locations for data.json #265

isledge opened this issue Apr 29, 2022 · 1 comment

Comments

@isledge
Copy link

isledge commented Apr 29, 2022

Currently, it appears that JSON not support hexadecimal memory addresses. What is the correct way to handle mapping these addresses?

For example, my data.json file for the GameBoy game Super Mario Land looks like the following:

{
  "info": {
    "gameover": {
      "address": C0A4,
      "type": "=d1"
    },
    "lives": {
      "address": DA15,
      "type": "=d1"
    },
    "coins-tens": {
      "address": 9829,
      "type": "=d1"
    },
    "coins-ones": {
      "address": 982A,
      "type": "=d1"
    },
    "current-world": {
      "address": 982C,
      "type": "=d1"
    },
    "current-stage": {
      "address": 982E,
      "type": "=d1"
    },
    "mario-x-pos": {
      "address": C202,
      "type": "=d1"
    },
    "mario-y-pos": {
      "address": C201,
      "type": "=d1"
    },
    "score": {
      "address": C0A0,
      "type": "=d4"
    }
  }
}

This, naturally, will fail to import, since the JSON parser has no idea about how to read those hexadecimal values. Do we just convert from hex to decimal, i.e., 0xC0A4 becomes 49316?

Thank you!

@endrift
Copy link
Contributor

endrift commented May 3, 2022

Yeah, just convert to decimal. It's definitely very annoying, but it's what needs to be done. I think there may be some offsetting involved due to memory domains and limitations of the libretro API, but I forget. Take a look at some of the others for examples.

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

No branches or pull requests

2 participants