-
Notifications
You must be signed in to change notification settings - Fork 920
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 path.cpp #79
Refactor path.cpp #79
Conversation
because that's all it was used as
Great work @silverhammermba! |
There were a few decompiler issues on This will be merged into a temporary branch and reviewed later. But I can't promise everything will make it's way in. As dumb/pointless as it sounds, even though I'm the minority here, I'm trying very hard to keep things identical to the original. So simplifying code and removing/adding stuff breaks the whole point of a clean-reversal. A lot of people come to this project specifically because it documents the exact code that made history in 1996. All that said, I'll be updating the readme soon to include contribution guidelines and some short-mid term goals. Changes should be kept as small as possible (ASAP 😝) for the time being. If you haven't noticed, most the of the edits I've made fix critical bugs/issues by only changing 1-5 lines. We're not it any hurry, there's plenty of time to clean things up later on once we've settled the priorities. Reverse engineering is like a puzzle. It's like pulling apart every molecule, every atom and quark that makes our existence possible. Understanding it and putting it back together exactly the same way; just so we can gasp in astonishment when we have played god... |
I figured it might be too dramatic a change. I can make a more conservative PR that just fixes obvious decompiler issues, adds comments, and renames variables. Does that sound good? I can provide a map seed, but it's pretty easy to test the bug. Find any 1x1 solid tile (e.g. pillar/brazier) and try walking around it in both directions. In Diablo you have to take 8 steps, in devilution you take 7. |
Your comments in the code were indeed very helpful, much appreciated. The PSX symbol unfortunately does not contain function names/variables for pathing, since it was optimized for the controller. The change to make Edit: Also, I will be uploading the symbol files soon, so everyone can take a peek. Devilution's core aspect is based strictly on them, as they are essentially a "guide" to reversing the game. It contains even as much as total lines/line numbers and location of braces for each function! |
Ok, so just as expected it was my fault when putting There's a gap of about 15,600 bytes in between path.cpp and pfile.cpp that's unused. Weird. Feel free to add some of your comments and names to the new code, it should resolve any bugs. |
Should add a |
On a related note, @Predelnik developed a documentation generation tool for the sanctuary/notes repo, which is capable of producing IDC scripts that can import these notes into IDA. Travis has now been configured to automatically update the http://sanctuary.github.io/notes/notes.idc To import the variable names and function signatures of the
Note: This IDC script should only be applied to empty/new IDB databases, as it removes all names of functions and variables before adding new ones. |
Wow that's great! I'd imagine once the cross-reference spreadsheet is finished, it shouldn't be difficult to parse so we can also import multiple versions! |
We'll have to revisit this in the future. Symbols have been uploaded for reference. |
Refactored path-finding algorithms, named variables, added comments (based on my understanding).
Everything is logically equivalent to how it was before, with one exception: there was a bug in
path_solid_pieces
that let the player cut corners when moving down or right. I'm not sure how this sneaked into the reversed code, but the bug isn't present in my retail copy of Diablo so I fixed it.Smoke tested by playing for a while without crashes. Also made sure that the maximum path length (24) matches retail Diablo.