TegraExplorer icon indicating copy to clipboard operation
TegraExplorer copied to clipboard

Save class usage

Open shadow2560 opened this issue 4 years ago • 5 comments

I have a problem to understand how the save class work. I have a code like that (SYSTEM partition is already mounted, the save file exists and Minerva is used):

save = readsave("bis:/save/8000000000000050")
save_file = save.read("file")

When the "save.read("file")" command is executed, the script exit with an error so I think I don't understand how the path in the save work so I need your help... again.

shadow2560 avatar Aug 07 '21 17:08 shadow2560

save.read's first argument always starts with a /. Thus if a file called file existed on the root of the save, then /file would work

suchmememanyskill avatar Aug 07 '21 18:08 suchmememanyskill

OK, this seems to be my issue.

Now second problem, I want to modify the save to replace the byte in position 0x29484 of the "/file" file of the save (this is used to bypass the first configuration menu) but again I think I miss something.

save = readsave("bis:/save/8000000000000050")
save_file = save.read("/file")
byte_test = ["BYTE[]",0x01]
save_file[0x29484] = byte_test[0]
save.write("/file", save_file)
save.commit()
save = 0
save_file = 0

Even when I remove the line "save_file[0x29484] = byte_test[0]" (I don't know if I use it correctly here) the save doesn't work and the console doesn't launch anymore; but without this line this should rewrite the save with the same content so I don't understand something again.

shadow2560 avatar Aug 07 '21 20:08 shadow2560

Looking at the output, it corrupts the save. I currently don't have a lot of time, but i'll take a proper look when i do

suchmememanyskill avatar Aug 08 '21 13:08 suchmememanyskill

looking further into this, the error happens here https://github.com/suchmememanyskill/TegraExplorer/blob/master/source/script/saveClass.c#L34

Seemingly save_data_file_write cannot take the amount of bytes being written to it (which is about 0.5mb)

suchmememanyskill avatar Aug 08 '21 14:08 suchmememanyskill

OK, thanks for the info, I will wait a fix if this can be fixed cause I'm not enough experimented to fix it by myself.

shadow2560 avatar Aug 08 '21 20:08 shadow2560