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

Error when opening newer saves #2

Open
Diniboy1123 opened this issue Dec 4, 2023 · 9 comments
Open

Error when opening newer saves #2

Diniboy1123 opened this issue Dec 4, 2023 · 9 comments

Comments

@Diniboy1123
Copy link

Thanks for all the incredible research. I tried this project on a newly generated map from the recently released Linux server of Blockheads and I got the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/TheBlockheadsTools/gameSave.py", line 146, in load
    return GameSave(path)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 48, in __init__
    self._read_env(full_path, self._data[sub_dir])
  File "/tmp/TheBlockheadsTools/gameSave.py", line 72, in _read_env
    self._read_db(txn, sub_db, dict_[k])
  File "/tmp/TheBlockheadsTools/gameSave.py", line 82, in _read_db
    dict_[k] = self._parse(v)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 105, in _parse
    result._data[0] = self._parse(result._data[0])
  File "/tmp/TheBlockheadsTools/gameSave.py", line 110, in _parse
    return self._parse(result)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 121, in _parse
    src._data = self._parse(src._data)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 118, in _parse
    src[k] = self._parse(v)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 114, in _parse
    src[i] = self._parse(v)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 118, in _parse
    src[k] = self._parse(v)
  File "/tmp/TheBlockheadsTools/gameSave.py", line 99, in _parse
    if src.startswith(b"bplist00"):  # bplist
TypeError: startswith first arg must be str or a tuple of str, not bytes

I assume that the protocol must have changed. If I print the string that's causing the issue, I get OWEN.

Found the linux server here: https://theblockheadswiki.com/wiki/Server#Linux_Server

@JarlPenguin
Copy link

Unfortunately the Linux server uses a different format, so saves created with it won't work with this tool.

@med1844
Copy link
Owner

med1844 commented Feb 14, 2024

Sorry for slow reply, I have no idea why but Github doesn't notify me this issue.

I have only tested the code for save file of version 1.7.4 from an android simulator. As JarlPenguin has mentioned, the server save file might be different from single player save files. If I have time, I will take a look into it to see if it is the case.

@Bobzilla07
Copy link

i have a save file from 1.7.4 on ios and when i try to open the file in it i get this

`from gameSave import GameSave

gs = GameSave.load("./1fb91154039a981a1d994317c9d9b40f/")
Traceback (most recent call last):
File "", line 1, in
File "/home/runner/TheBlockheadsTools-1/gameSave.py", line 146, in load
return GameSave(path)
File "/home/runner/TheBlockheadsTools-1/gameSave.py", line 48, in init
self._read_env(full_path, self._data[sub_dir])
File "/home/runner/TheBlockheadsTools-1/gameSave.py", line 67, in _read_env
env = lmdb.open(path, readonly=True, max_dbs=self.MAX_DBS)
lmdb.InvalidError: ./1fb91154039a981a1d994317c9d9b40f/world_db: MDB_INVALID: File is not an LMDB file
`

idk if its a problem with the version of the app or im just to dumb to figure out how to work this

@med1844
Copy link
Owner

med1844 commented Feb 16, 2024

I suspect it's related to 32-bit and 64-bit LMDB format, but not quite sure as I have not worked on this for 4 years.

You may try to install 32-bit and 64-bit python and install lmdb in each of them and try open the path again to see which one works.

If none of them works, then it might be iOS files having different format? I can't tell for sure.

@Bobzilla07
Copy link

if this helps here is the save file i am trying to work with
https://github.com/Bobzilla07/BLOCKHEADS-SAVEFILES

@Bobzilla07
Copy link

Sorry for slow reply, I have no idea why but Github doesn't notify me this issue.

I have only tested the code for save file of version 1.7.4 from an android simulator. As JarlPenguin has mentioned, the server save file might be different from single player save files. If I have time, I will take a look into it to see if it is the case.

The 1.7.4 doesn't have any of the files mentioned in some of the script I can only find it with 2 folders world_db and map the world_db has the files data.mdb and lock.mdb

@med1844
Copy link
Owner

med1844 commented Mar 17, 2024

I finally got some time to work on this issue.

I tested the repo on the same save file that works before when I was developing this and got the same MDB_INVALID: File is not an LMDB file error. So, it's very likely to be 32/64-bit issue as it's not related to codebase itself.

It's hard to set up a new python environment, especially a 32-bit one, when you already have a ton of them. So, I updated the repository and added a Dockerfile so that you can use python interactive shell in docker container to load, modify, save, etc. Please refer to README for more info.

But I have to warn that even though the repo is passing all tests and seems to export without a bug in gameSave.py:__main__, I don't have blockhead installed on any device now, therefore I can't really tell if the exported world is correctly modified or not. I also only tested the repository on WSL Ubuntu 22.04 LTS. Though theoretically on other platforms docker should yield the same result, it might go wrong.

When I have more time, I will take a look into the linux server save file. Currently the blockheads wiki seems to be not responsive and thus I have no idea how to get that server.

@Diniboy1123
Copy link
Author

Here: https://majicdave.com/share/blockheads_server171.tar.gz

I had to run patchelf on it to have it working on modern linux distributions.

@med1844
Copy link
Owner

med1844 commented Mar 29, 2024

I was busy recently, but according to preliminary tests the updated code that I have already commited and pushed should be able to load copied save folder from the server (when I load symlinked folder it seems to crash?). But I still can't replicate the error you met at first.

I also can't verify if the modified world data would be loadable by the server. The test world also has no user data as I still have no blockhead installed on any device.

I plan to look into it when I got more time, most probably after spring semester. Thanks for providing server, this should greatly help development as I don't have to drag & replace files in simulators manually, and the save files are stored in 64-bit meaning the development won't be stumbled by docker containers!

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

4 participants