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

Refactor Unsigned32read() by access to object already containing the value #6

Open
pedro-javierf opened this issue Jan 9, 2021 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@pedro-javierf
Copy link
Owner

pedro-javierf commented Jan 9, 2021

Describe the bug
Method Decompress() at ARM9.java does this:

public static byte[] Decompress(byte[] Data, int _start_ModuleParamsOffset)
	{
		if (IOUtil.ReadU32LE(Data, _start_ModuleParamsOffset + 0x14) == 0) 
			return Data;//Not Compressed!
		
		byte[] Result = CRT0.MIi_UncompressBackward(Data);
		IOUtil.WriteU32LE(Result, _start_ModuleParamsOffset + 0x14, 0); //sets 4 bytes to 0x0
		
		return Result;
	}

Instead of using ReadU32LE, we can access the corresponding field of the object ModuleParams (CRT0.java). I believe the field is public int CompressedStaticEnd; though I haven't properly checked it or if it is at ModuleParamsOffset + 0x14 but it is the only field that makes sense.

@pedro-javierf pedro-javierf added enhancement New feature or request good first issue Good for newcomers labels Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant