Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Generally when reversing, a bottom-up approach is used. The problem with
render.cpp
is that it uses two languages, which makes this approach very difficult to achieve the desired results. Therefore, this approach is more of a top-down sort of technique.The idea is that we now have a binary exact version of this file (barring the order of the initial
push/pop
), so the inlined code can be integrated and will retain the same output with much more ease than trying to guess what registers the C compiler is going to hog. Once the inlined code replaces the base assembly code, the rest can be converted to C since we know the assembly is already correct.At the same time, the project will still retain the pure C version for newer compilers, which can't produce binary parity anyway...
Edit: also, I discovered some dead code thanks to the raw ASM approach. There appears to be four different calls to draw transparent tiles (leftover from the demo when tiles were drawn differently). This code wasn't present in the current project.