u/FirefighterOk9355

Hey everyone, I developed this library to make save editing easier on android (and to support future endeavors that use the BinaryFormatter save format). It's relatively simple to install and use, and with it, you can fully edit a BitLife save file. I won't provide details on how to retrieve your save file, please find that information on your own.

I had originally developed bitlife-edit, but it's not usable on android devices and I have more control over the output and access to the binary file by developing my own interpreter. Eventually, I will build a full-fledged save editor for BitLife on top of dnbflib.

Below is a tutorial on how to use dnbflib for now to edit your bank balance. Keep in mind this is a powerful tool; you can edit any field of the save file as long as you know what to look for. Unfortunately, to edit MonetizationVars and such, you will still have to use bitlife-edit. I'll eventually port the decrypter to Python so it too can be used on android.

View the source code to dnbflib here: https://github.com/yntha/dnbflib

I strongly recommend anyone interested in this project to look at the html file in the docs/ folder.


Editing your BitLife save with dnbflib on Termux

This guide shows how to install Python, install dnbflib, and edit your bank balance in a BitLife save file.

Make a backup first.

1. Install Python in Termux

pkg update
pkg upgrade
pkg install python

Check that Python works:

python --version

2. Install dnbflib

PyPI:

python -m pip install dnbflib

If you are installing directly from GitHub instead:

pkg install git
python -m pip install git+https://github.com/yntha/dnbflib.git

Check that it installed:

python -c "import dnbflib; print('dnbflib installed')"

3. Moving the save file for easy access

Example:

mkdir -p ~/bitlife-saves
cp /sdcard/Download/my_save.bin ~/bitlife-saves/save.bin
cd ~/bitlife-saves

4. Create the edit script

Open a new file:

nano edit_bank_balance.py

Paste this:

from pathlib import Path
import sys

from dnbflib import DNBFDocument


def main():
    if len(sys.argv) != 4:
        print("Usage:")
        print("  python edit_bank_balance.py input.bin output.bin new_balance")
        print()
        print("Example:")
        print("  python edit_bank_balance.py save.bin edited.bin 999999")
        raise SystemExit(1)

    input_path = Path(sys.argv[1])
    output_path = Path(sys.argv[2])
    new_balance = int(sys.argv[3])

    with DNBFDocument.open(input_path) as doc:
        life = doc.one(class_name="Life")
        finances = life.member("Finances").deref()
        finances.member("BankBalance").set(new_balance)
        doc.write(output_path)

    print(f"Wrote modded save file: {output_path}")


if __name__ == "__main__":
    main()

Save in nano:

CTRL + O
Enter
CTRL + X

5. Run It

Example:

python edit_bank_balance.py save.bin edited.bin 999999

This reads:

save.bin

Changes:

Life > Finances > BankBalance

And writes:

edited.bin

6. Copy the Edited File Back

Example:

cp edited.bin /sdcard/Download/edited_save.bin

If multiple Life objects exist

That means the file has more than one Life object, and the script does not know which one you mean.

In that case, you need to identify the correct instance with another field, like a name, age, ID, etc. Example:

life = doc.one(
    class_name="Life",
    where=lambda obj: obj.member("Name").value == "Alex",
)

Change "Name" and "Alex" to whatever makes sense for your file.

Notes

  • Keep backups.
  • If the edited file does not load, restore your backup and try a smaller edit.
  • doc.write(...) is better than doc.to_bytes() on phones because it uses less memory.
u/FirefighterOk9355 — 22 days ago