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

Deprecate game.load_info #11

Open
Nielsbishere opened this issue Aug 25, 2021 · 0 comments
Open

Deprecate game.load_info #11

Nielsbishere opened this issue Aug 25, 2021 · 0 comments

Comments

@Nielsbishere
Copy link

Hi guys, thanks for making this nice repo; really helpful. I have managed to do the decompression automatically by using the following code (C++):

	static constexpr u32 blzStart = 0xDEC00621;
	static constexpr u64 blzMarker = 0x2106C0DEDEC00621;

	usz offset = usz_MAX;

	for (u64 *start = in.begin<u64>(), *end = in.end<u64>(); start + 1 < end; start = (u64*)((u32*)start + 1))
		if (*start == blzMarker)
			offset = usz(start) - usz(in.add());

	if (offset == usz_MAX || offset <= 4)
		EXCEPTION("Marker not found. Probably uncompressed");

	offset -= 8;

	u32 end = in.at<u32>(offset);

       //Other decompression stuff

in is the arm9 buffer.

I know that this is not python, but I hope it can be of any help in porting it if you at some point decide to do so (I saw a TODO, so I thought I should post this). Only tested it on HGSS, so it might not always work (since you seem to check two separate u16s from the u32s instead of the whole u32s, which my scan doesn't do).

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

1 participant