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

Android save.json character reset bug #4444

Open
RainaLute opened this issue Apr 6, 2024 · 3 comments
Open

Android save.json character reset bug #4444

RainaLute opened this issue Apr 6, 2024 · 3 comments
Labels

Comments

@RainaLute
Copy link

Describe the bug

After opening the save it resets my character completely

Steps To Reproduce

1- Start the world
2- Spawn a bit far away from where you last save and quitted completely naked and lose off proffession

Screenshots

Screenshot_2024-04-06-13-57-17-749_com cataclysmbnteam cataclysmbn experimental

Versions and configuration

  • OS: Android
    • OS Version: Manufacturer: Xiaomi; Model: M2004J19C; Release: 12; Incremental: V13.0.3.0.SJCTRXM;
  • Game Version: 522a610 [64-bit]
  • Graphics Version: Tiles
  • LAPI Version: 2
  • Game Language: English [en_US]
  • Mods loaded: [
    Bright Nights [bn],
    Disable NPC Needs [no_npc_food],
    Simplified Nutrition [novitamins],
    No Rail Stations [No_Rail_Stations],
    Prevent Zombie Revivication [no_reviving_zombies],
    Limit Fungal Growth [limit_fungal_growth],
    C.R.I.T. Expansion [crt_expansion],
    Advanced Gear [adv_gear],
    Armor Up! Survivor Expansion [ArmUpSurvEx],
    Craftable Gun Pack [craftgp],
    Expanded Archery [ExArch],
    More Survivor Stuff [more_survivor_stuff],
    Alternative Basement Layouts [basement_extension],
    sees-player icon, HitButton_iso [sees_player_hitbutton],
    sees-player icon, retrodays [sees_player_retro],
    Bionic Slots [cbm_slots],
    Fuji's Military Profession Pack [fuji_mpp],
    Manual Bionic Installation [manualbionicinstall],
    SpeedyDex [speedydex],
    Stats Through Kills [stats_through_kills],
    Stronger archery [bow_opness],
    BioCo Content [bioco],
    Bionic Space Expander [Bionic_Space_Expander],
    Bionics Systems Recipes [bio_recipes],
    Pneumatic fun [pneumo_fun],
    Large capacity storage CBMs [eps_cbm],
    Magical Nights [MagicalNights],
    Blazemod - Vehicle Additions Pack [blazemod]
    ]

Additional context

Uploading Cridersville.zip…

@RainaLute RainaLute added the bug label Apr 6, 2024
@olanti-p
Copy link
Member

olanti-p commented Apr 15, 2024

I'm not sure what's precisely going on here, but it seems that the game uses wrong parser function for reading the saved integer back from JSON. It saves a 64-bit integer, but tries to load it back as a 32-bit integer, so it doesn't fit and throws a parse error.

Uploading Cridersville.zip…

It seems you have submitted the issue form before waiting for the upload to finish (the text changes to file name once that happens).

@olanti-p
Copy link
Member

On further thought, in code that number means count of references, which in theory should stay far, far, far below limits of 32-bit unsigned int.

uint32_t count = it.second->json_count;
if( count != 0 ) {
json.write( id );
json.write( count );

But in the screenshot, it seems that the count has reached -1 for some reason, which caused overflow and had it appear as 2^32-1 = 4294967295, which got saved, and then promptly failed to be loaded.
So the root of the issue is more likely somewhere inside reference tracking code.

@olanti-p
Copy link
Member

For archival purposes, here's the save file from the issue:
Cridersville.zip

And the problematic snippet:

  "safe_references": { "items": [ 11602, 4294967295 ] },

Another save file from same user:
Boulder.zip

Different values this time - this doesn't even look like integer overflow, maybe memory corruption?

  "safe_references": { "items": [ 18446744073709551615, 2636248448, 11322597028362325620, 2636247792, 98784247841, 50559 ] },

As a note, those numbers don't repeat anywhere else in the save folder.

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

No branches or pull requests

2 participants