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

Feature request: Ability to access individual json attributes in gamedata.json #306

Open
jueank opened this issue May 7, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@jueank
Copy link

jueank commented May 7, 2024

I would like to be able to query individual json attributes from gamedata.json. E.g. 'bg_fov_fullscreen'.
As a (potential later) extension, it would be nice if vpxtool allows setting attribute values.
Both could potentially be generalized to all json files within a .vpx file.

@francisdb
Copy link
Owner

One option is writing/editing the [tablename].ini next to each table that updates those values.
But I get the idea.
Just curious, what is your use case?

@francisdb francisdb added the enhancement New feature or request label May 7, 2024
@jueank
Copy link
Author

jueank commented May 7, 2024

I'm currently thinking about writing a small tool that uses vpxtool to retrieve glass_top_height and glass_bottom_height from gamedata.json of multiple .vpx files automatically. The intention is to calculate and set ViewCabWindowTop and ViewCabWindowBot, which are stored in [TableOverride] in the corresponding ini file per table. The calculation of ViewCabWindowTop and ViewCabWindowBot should be based on a target angle for the playfield, given by the user and batch automated for multiple .vpx files at once.
I wanted to have this as a feature in vpinball (you voted for it); see here: vpinball/vpinball#1295 - but I don't want to wait any longer and I'm therefore looking for an alternate or intermediate solution.
I'm still at the beginning of my investigation; I'm not even sure if glass_top_height and glass_bottom_height are really used for the calculation of the visual playfield z position & slope (I read it somewhere, but my first investigation doesn't prove it). Still, I thought that reading and setting attribute values from internal json data is a useful functionality for vpxtool. That's why I made the feature request.

@jueank
Copy link
Author

jueank commented Jun 19, 2024

Any chance, this feature (or this: #305) will be implemented?
I would now rather like to extract the table height from gamedata.json instead of the other mentioned values above. So any way to do that elegantly (instead of being forced to extract the whole VPX file & resulting folder structure) would be nice.

@francisdb
Copy link
Owner

francisdb commented Jun 19, 2024

Just wondering what the best cli experience would be. What do you think about this?

vpxtool gamedata show test.vpx
# {...}
vpxtool gamedata show bg_fov_fullscreen test.vpx
# 30.0

@francisdb
Copy link
Owner

If you are on a unix system I could just implement the first and you would call

vpxtool gamedata show test.vpx | jq .bg_fov_fullscreen
30.0

@jueank
Copy link
Author

jueank commented Jun 19, 2024

Thanks for the quick reply.
I happen to be on windows.
gamedata.json ist mostly flat, but the other json files within VPX are not. So, asking for access to individual json attributes will only work for a limited set of cases.
Therefore, a more robust and simple approach would be to just add the capability to extract files as a whole. I can then happily parse the file myself.
So, your first proposal would be sufficient (and much more than I hoped for)

@francisdb
Copy link
Owner

Can you get going with https://github.com/francisdb/vpxtool/releases/tag/v0.13.8 ?

It has vpxtool gamedata show test.vpx and that should be MUCH faster than extracting the whole table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants