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

start of contribution guide #99

Merged
2 commits merged into from
Jun 29, 2018
Merged

start of contribution guide #99

2 commits merged into from
Jun 29, 2018

Conversation

ttdonovan
Copy link
Contributor

From this issue #84 I've stated a contribution guide. Feel free to make any changes. Other things that might be useful are screenshots or a video explaining how to reverse an example function.

There are also a couple of #TODOs that could use some polishing to further explain concepts.

Copy link
Contributor

@mewmew mewmew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ttdonovan. Great start of the contribution docs. We can keep evolving these docs as the project progresses.

Added some comments, mostly typos.

CONTRIBUTE.md Outdated

## How To...

Described below are steps for using the IDA and SYM to reverse the Diablo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-and SYM to
+and SYM files to

CONTRIBUTE.md Outdated

* A clean installation of Diablo patched to version 1.09b (Diablo.exe)
* Download IDA (Interactive Disassembler) [Hex-Rays](https://www.hex-rays.com/products/ida/support/download_freeware.shtml)
* Download IDC script from sancturary/notes repository: [notes.idc](http://sanctuary.github.io/notes/notes.idc)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-sancturary
+sanctuary

CONTRIBUTE.md Outdated
Described below are steps for using the IDA and SYM to reverse the Diablo
source.

### Understanding Devilusion and Sancutary Notes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Devilusion
+Devilution
-Sancutary
+Sanctuary

CONTRIBUTE.md Outdated

### Understanding Devilusion and Sancutary Notes

Both Devilution and the Sancutary Notes repo have the intended aim to get as
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Sancutary
+Sanctuary

CONTRIBUTE.md Outdated
See for instance [drlg_l1_load_dun](http://sanctuary.github.io/notes/#function/drlg_l1_load_dun),
which is defined in `drlg_l1.cpp`. This function has the PSX signature
`void LoadL1Dungeon__FPcii(char *sFileName, int vx, int vy)`, but is documented
in the Sancutary Notes repo as follows for consistency:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Sancutary
+Sanctuary

CONTRIBUTE.md Outdated
* Processor type i386 (80386)
* Run the IDC script in IDA on the fresh IDB database to import names for
variables and functions, type definitions, etc. (Note: run the IDC script
only on new IDB databases as it removes all variable names before adding new
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-only
+**only**

to put emphasis that this is an important notice.

CONTRIBUTE.md Outdated

### About the SYM

The diasurgical/scalpel includes a copy of a symbolic file was accidentally
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-The diasurgical/scalpel includes a copy of a symbolic file was accidentally
+The diasurgical/scalpel repository includes a copy of a symbolic file that was accidentally

@mewmew
Copy link
Contributor

mewmew commented Jun 29, 2018

@galaxyhaxz Would you like to add notes for how to open the diabpsx.bin executable from the Diablo (Japan) [SLPS-01416] release? The steps are fairly involved, as the file is loaded as raw.

Our current notes are as follows,

  1. Processor type: MIPS R5900 (Sony Playstation 2) little endian
  2. ok
  3. ROM: ROM start address: 0x80010000
  4. Input file: Loading address: 0x80010000
  5. File -> Load file -> Another binary file: pregame.bin
  6. Loading segment: 0x8001000 (in paragraphs)
  7. Loading offset: 0x129BF8 (0x80139BF8-0x80010000)

We should probably extend these steps by mentioning that the same address of the .SYM files may map to more than one function, as only one of fmv.bin, frontend.bin, game.bin, or pregame.bin may be loaded at once, and they are loaded at the same base address.

From #84 (comment), this could be tidied up a bit and added to the CONTRIBUTE.md documentation.

Load diabpsx.bin executable in IDA and explore :) You may also want to extract the lump.bin archive to be able to load fmv.bin, frontend.bin, game.bin, or pregame.bin shared libraries. Note, only one of these libraries is loaded at any one time, the reason probably being that Playstation 1 had very limited memory. For notes on what each address maps to in the PSX release, refer to scalpel.

We may also want to mention how to map global variable accesses relative to $gp, e.g.

# How to calculate global variable addresses in MIPS

$gp = 0x8011A780

## Example from drlg_l1.cpp___L5firstRoom(void)

seg003:8013D9C4                 sb      $zero, 0x215A($gp)

address: 0x8011A780 + 0x215A = 0x8011C8DA

sbss:8011C8DA HR3:            .space 1                 # PSX ref: 0x8011C8DA
sbss:8011C8DA                                          # PSX def: unsigned char HR3

CONTRIBUTE.md Outdated
* Function arguments `(char *dun_path, int view_x, int view_y)`
* #TODO whatelse can be inferred from below?

```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can probably syntax highlight using asm

@ttdonovan
Copy link
Contributor Author

I've corrected the typos in the CONTRIBUTE.md

@ghost
Copy link

ghost commented Jun 29, 2018

Indeed there is a lot to reversing the PSX module. I'll add some more notes on that, and how to annotate function variables based on the symbol file. This is a good start though!

@ghost ghost merged commit 4881ed2 into diasurgical:master Jun 29, 2018
@ttdonovan ttdonovan deleted the contribute branch July 3, 2018 19:18
This pull request was closed.
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

Successfully merging this pull request may close these issues.

3 participants