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

Limit size of integers/ranged integers #6

Open
Auzoocle opened this issue Aug 10, 2021 · 5 comments
Open

Limit size of integers/ranged integers #6

Auzoocle opened this issue Aug 10, 2021 · 5 comments

Comments

@Auzoocle
Copy link

i have been looking into a bunch of save values in going commando for ps2.

we should be able to define the size of integers and ranged integers to avoid changing more than we want.

some values are only one byte large. several values are next to each other in the save file. using integer for a one byte value cause slimseditor to read from offset to nearest empty byte or up to 4 bytes? which could include values we dont want to change.

@maikelwever
Copy link
Member

maikelwever commented Aug 11, 2021

Sounds like a good idea, can you let me know which datatype the fields are? A list of common datatypes I can easily add are listed here: https://docs.python.org/3/library/struct.html#format-characters

Some examples in savegames would be very helpful while implementing this.

@maikelwever
Copy link
Member

I've added untested new datatypes, can you try them out on your savegames and let me know how it goes?

Binary release can be found here: https://github.com/RatchetModding/slimseditor/releases/tag/0.0.7

@Auzoocle
Copy link
Author

i updated my gc.json file with your new datatype. i tried creating a different ranged integer datatype, where integer where replaced with unsigned datatypes, but i was not able to get it to work. could you create them.

i dont understand your bitfield datatype. could you give some examples how this could look like in a .json file. I include my savefile and my gc.json file.
one example of a byte with bits inside is the todano dam elevator. the value is 0 when it is locked, but 16 (in decimals) when it is unlocked. it is a difference of one bit.

i can add my gc.json values to the master, but i am not happy about some of them.

rac2.ps2.zip
gc.json.zip

@maikelwever
Copy link
Member

Ah yes, there are no examples of BitField, might have written that in a bit of a hurry.

It should work like this:

{
    "name": "Test Item",
    "pos": 1234,
    "type": "BitField",
    "bitmap": {
        "Item in 1st Bit": 1,
        "Item in 4th Bit": 4,
        "Dam Elevator": 5,
    }
}

I'll take a look at your savegame and items soon, and I'll add ranged variants for char and short as well, since RangedInteger currently maps to int32.

@Auzoocle
Copy link
Author

i think there is a bug with the bitfield. it decodes the value correct, but it doesn't save the value.

and there is a problem here.

"bitmap": { "Item in 1st Bit": 1 }

is actually the second bit

the line should be

"bitmap": { "Item in 1st Bit": 0 }

to change the first bit.
you probably meant it like your example where bit 1 is the first bit. probably a bug there as well.

this time, i will respond in a more reasonable time.
by the way i am using Linux.

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