45 Commits

Author SHA1 Message Date
01a8d2a96a Added command line argument to decompiler to print instruction positions and the header. 2021-01-15 15:42:11 +00:00
ab7a0903c3 Functions and data now have # prefixes and suffixes.
Function labels cannot be equal to it's starting position now.
2021-01-14 22:48:03 +00:00
c82ce251a1 Removed manual serde impl of Pos. 2021-01-14 21:03:50 +00:00
f56ef6b136 Made Data fully immutable and removed it's *Eq impl.
Moved `DataTable::search_instruction` to `Data`.
Completely revised `DataTable`'s implementation.
Fixed duplicate and mis-typed data in `known_data`.
2021-01-14 16:22:07 +00:00
bbfe541a6d Fixed {Data, Func}Table::get_*.
`Directive` now implements `InstTargetFmt`.
2021-01-13 23:09:25 +00:00
930696eaec Made same changes last commit did in DataTable to FunTable. 2021-01-13 22:38:27 +00:00
cba889642a Inst::decode now returns a Result.
Added `Diretive::decode_with_data`.
2021-01-13 21:01:07 +00:00
d9bc90882b Executable size and start positions are now dynamic.
Function labels are no longer printed at the start.
2021-01-12 03:20:13 +00:00
8f2898f9a7 Added obtaining labels from other functions for targets. 2021-01-12 03:05:42 +00:00
83db95939a pseudo::{load, store} now implement InstTarget and InstTagetFmt. 2021-01-12 02:40:15 +00:00
12f2abc638 Relaxed requirements of implementing InstTargetFmt to allow semi-targetable instructions.
`pseudo::load_imm` now implements `InstTargetFmt`.
2021-01-12 02:35:39 +00:00
dbfdc01a2e basic::jmp now implements InstTargetFmt. 2021-01-12 02:28:22 +00:00
eb00824fbf Improved decompiler's instruction formatting. 2021-01-12 02:21:08 +00:00
a559fa80a9 Added InstTarget and InstTargetFmt to format custom instructions with a target.
Removed `fmt::InstFmt::fmt_value` and `fmt::InstFmtWrapper`.
2021-01-12 02:13:00 +00:00
650d1272a4 Missing missing . in labels. 2021-01-12 01:40:07 +00:00
27fc4e4a5a Removed pseudo::jmp and made basic::{cond, jmp::reg} write the pseudo instrutions. 2021-01-12 01:30:30 +00:00
220d0068a6 Improved inst::iter.
The decompiler now successfully goes through functions, data and others.
2021-01-12 01:17:02 +00:00
da41cb8eca decompiler now just goes instruction by instruction. 2021-01-11 14:44:44 +00:00
8d08ed0d60 Directive now stores a reference to the string read.
`InstFmt` no longer requires the instruction bytes.
2021-01-11 14:41:42 +00:00
21a0d7a4cb Revised documentation for dcb-exe::exe. 2021-01-09 14:19:44 +00:00
c0b2fd8c62 Added FuncTable and Func back to dcb-exe.
Added an iterator over function, data and misc (`ExeItem`) for the executable.
2021-01-09 12:34:43 +00:00
0483c63bfd Added new InstFmt trait for formatting instructions. 2021-01-08 15:26:43 +00:00
48e29ec83c Revamped most things.
Honstly not sure what's happened, but `dcb-exe` is mostly being redone from scratch.
2021-01-08 13:39:50 +00:00
38ea8db1db Split dcb into dcb-io, dcb-exe, dcb-util and dcb.
Also worked on `dcb-exe` slightly, but still not fully supported.
2020-11-11 17:56:37 +00:00
94bb2d780d Renamed some instructions' register names for consistency.
Made `BasicInst::Lui` it's own type.
Started working on `PseudoInst`.
Removed `dcb::game::exe` and `decompiler` binary temporarily.
Fixed the game file not being read / written correctly.
2020-11-05 15:59:59 +00:00
0e58b3df15 Renamed SimpleInstruction to BasicInstruction.
Added `BasicInst` type to replace `BasicInstruction` eventually.
Replaced `Formatter<'_>` with just `Formatter` where possible.
Added a `Display` impl for `Header`.
`dw` instructions now have their argument replaced instead of just having a comment.
2020-11-03 12:05:54 +00:00
06f67c4cf0 Data and DataTable now acknowledge stacked / 'specialized' data locations.
Improved replacement of addresses with their labels somewhat.
Grealy extended the known data locations with hardware locations.
2020-11-01 05:51:55 +00:00
6f70c110c4 Data, DataTable, Func and FuncTable now just use String instead of providing a S: AsRef<str> generic.
Fixed `Pos` not decoding normal integers correctly.
Unwrapper all string-encoded hex values to simply hex values.
`Func` and `Data` now have some fields defaulted.
2020-11-01 04:28:38 +00:00
21c2019713 Modified DataTable and FuncTable to dynamically load the known functions instead of describing them in code.
Removed unecessary dependencies for `dcb` and `dcb-tools`.
`dcb::game::exe::Pos` is now deserialized properly as a hex-string.
2020-11-01 04:01:11 +00:00
dc3b66167e Revamped game::exe::{Func, FuncTable}.
Added experimentally getting function arguments heuristically.
2020-10-30 09:15:46 +00:00
0e5ea3967f Revamped game::exe::{Data, DataTable}.
Renamed `MergeSortedIter` to `DiscardingSortedMergeIter`.
2020-10-30 07:09:31 +00:00
998ef01b54 Moved game:.exe::Data from an enum to a struct with the kind of data.
Renamed `int` usage to `u32` throughout.
Added `Dh` and `Db` directives.
Unfortunately, function end printing just broke. This feature was minor and will be currently removed as other parts are revamped.
2020-10-30 06:28:58 +00:00
35d0909152 Changed function signature from C style to Rust style.
`AllData::get()` can not retrieve data before it.
2020-10-29 11:44:44 +00:00
00a85397a7 Data no longer stores it's end position.
Removed `Directive::DwRepeat`.
Fixed `WithInstructionsIter` stoping on `jr $ra` instead of at the end of the function.
2020-10-29 00:38:31 +00:00
7d380510da Added dcb::game::exe::{Data, AllData} contrapart to Func/Funcs. 2020-10-28 22:27:02 +00:00
c7ab0e5e94 Directive now only decodes dw after the code end.
Load/Store instructions now display what function/string/data they're loading inline.
2020-10-28 19:55:36 +00:00
d73a9ff415 Added local labels to functions.
Jump instructions are now labeled with their label / function.
2020-10-28 19:18:22 +00:00
da782b5a52 Readded the missing local indexes, strings and data from last commit. 2020-10-28 17:31:40 +00:00
17b3aa0e4f Added dcb::util::merge_iter.
Improved `dcb::game::exe::Func` yet again.
2020-10-28 17:27:25 +00:00
eb51f448ce SimpleInstruction is now defined using bitmatch instead of a macro. 2020-10-26 01:14:16 +00:00
2d931f10cb Moved Pos to game::exe::pos.
Adding missing instructions `break` + `syscall`.
Added `Func` for the game executable.
`Pos` now implements `serde::{Serialize, Deserialize}`.
2020-10-25 22:46:04 +00:00
233eec4fa1 Added heuristics-based decompiler to dcb-tools. 2020-10-25 19:12:54 +00:00
128945e52f Removed unnecessary rustfmt.toml from dcb-tools. 2020-10-21 01:31:34 +01:00
de5c550e7a Fully integrated dcb-tools into the repo. 2020-10-21 01:17:41 +01:00
5a8f2cc1f5 Moved project into sub-folder 'dcb-tools' in preparation for merge with main repo 2020-10-21 00:54:06 +01:00