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

Reader: Handle corrupted chunks better #249

fmatthew5876 opened this Issue Oct 3, 2018 · 2 comments


None yet
4 participants
Copy link

fmatthew5876 commented Oct 3, 2018

Some games in #246 have corrupted chunks that liblcf can't handle. One example animation chunk from Devil and Angel is not 0 terminated, causing liblcf to continue reading past the end of the chunk and getting confused.

rm2k/3 is able to run these games, so it's a compatibility issue.

Make liblcf able to load these ldbs in the best way possible. More compatible with rm2k/3 the better. The games can be opened in the rm2k/3 editor to compare how liblcf interprets them vs how rm2k/3 does it.

Approach 1:

When returning from ReadLcf() calls, check how many bytes were read vs how many should have been read via LcfSize(). If the numbers don't match, seek back to the right position before going to the next chunk.

Approach 2:

Add a check before every read operation to ensure we never pass LcfSize(). This approach might be slower.


This comment has been minimized.

Copy link

Ghabry commented Oct 30, 2018

@fmatthew5876 As #250 is merged would you consider this resolved?


This comment has been minimized.

Copy link
Contributor Author

fmatthew5876 commented Oct 30, 2018

I guess so. We could further try to parse corrupted chunks exactly like RPG_RT does but I see little benefit to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.