Skip to content

Commit 5d4b33a

Browse files
committed
Update README.md & config.schema.json
1 parent f2a5913 commit 5d4b33a

File tree

2 files changed

+71
-81
lines changed

2 files changed

+71
-81
lines changed

README.md

Lines changed: 61 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ A local diffing tool for decompilation projects. Inspired by [decomp.me](https:/
77

88
Features:
99

10-
- Compare entire object files: functions and data.
11-
- Built-in symbol demangling for C++. (CodeWarrior, Itanium & MSVC)
12-
- Automatic rebuild on source file changes.
13-
- Project integration via [configuration file](#configuration).
14-
- Search and filter all of a project's objects and quickly switch.
15-
- Click to highlight all instances of values and registers.
10+
- Compare entire object files: functions and data
11+
- Built-in C++ symbol demangling (GCC, MSVC, CodeWarrior, Itanium)
12+
- Automatic rebuild on source file changes
13+
- Project integration via [configuration file](#configuration)
14+
- Search and filter objects with quick switching
15+
- Click-to-highlight values and registers
16+
- Detailed progress reporting (powers [decomp.dev](https://decomp.dev))
17+
- WebAssembly API, [web interface](https://github.com/encounter/objdiff-web) and [Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=decomp-dev.objdiff) (WIP)
1618

1719
Supports:
1820

@@ -40,7 +42,7 @@ For Linux and macOS, run `chmod +x objdiff-*` to make the binary executable.
4042

4143
### CLI
4244

43-
CLI binaries can be found on the [releases page](https://github.com/encounter/objdiff/releases).
45+
CLI binaries are available on the [releases page](https://github.com/encounter/objdiff/releases).
4446

4547
## Screenshots
4648

@@ -49,33 +51,30 @@ CLI binaries can be found on the [releases page](https://github.com/encounter/ob
4951

5052
## Usage
5153

52-
objdiff works by comparing two relocatable object files (`.o`). The objects are expected to have the same relative path
53-
from the "target" and "base" directories.
54+
objdiff compares two relocatable object files (`.o`). Here's how it works:
5455

55-
For example, if the target ("expected") object is located at `build/asm/MetroTRK/mslsupp.o` and the base ("actual")
56-
object is located at `build/src/MetroTRK/mslsupp.o`, the following configuration would be used:
56+
1. **Create an `objdiff.json` configuration file** in your project root (or generate it with your build script).
57+
This file lists **all objects in the project** with their target ("expected") and base ("current") paths.
5758

58-
- Target build directory: `build/asm`
59-
- Base build directory: `build/src`
60-
- Object: `MetroTRK/mslsupp.o`
59+
2. **Load the project** in objdiff.
6160

62-
objdiff will then execute the build system from the project directory to build both objects:
61+
3. **Select an object** from the sidebar to begin diffing.
6362

64-
```sh
65-
$ make build/asm/MetroTRK/mslsupp.o # Only if "Build target object" is enabled
66-
$ make build/src/MetroTRK/mslsupp.o
67-
```
63+
4. **objdiff automatically:**
64+
- Executes the build system to compile the base object (from current source code)
65+
- Compares the two objects and displays the differences
66+
- Watches for source file changes and rebuilds when detected
6867

69-
The objects will then be compared and the results will be displayed in the UI.
68+
The configuration file allows complete flexibility in project structure - your build directories can have any layout as long as the paths are specified correctly.
7069

71-
See [Configuration](#configuration) for more information.
70+
See [Configuration](#configuration) for setup details.
7271

7372
## Configuration
7473

75-
While **not required** (most settings can be specified in the UI), projects can add an `objdiff.json` file to configure the tool automatically. The configuration file must be located in
74+
Projects can add an `objdiff.json` file to configure the tool automatically. The configuration file must be located in
7675
the root project directory.
7776

78-
If your project has a generator script (e.g. `configure.py`), it's recommended to generate the objdiff configuration
77+
If your project has a generator script (e.g. `configure.py`), it's highly recommended to generate the objdiff configuration
7978
file as well. You can then add `objdiff.json` to your `.gitignore` to prevent it from being committed.
8079

8180
```json
@@ -128,78 +127,69 @@ file as well. You can then add `objdiff.json` to your `.gitignore` to prevent it
128127

129128
### Schema
130129

131-
View [config.schema.json](config.schema.json) for all available options. The below list is a summary of the most important options.
130+
> [!NOTE]
131+
> View [config.schema.json](config.schema.json) for all available options. Below is a summary of the most important options.
132+
133+
#### Build Configuration
134+
135+
**`custom_make`** _(optional, default: `"make"`)_
136+
If the project uses a different build system (e.g. `ninja`), specify it here. The build command will be `[custom_make] [custom_args] path/to/object.o`.
132137

133-
`custom_make` _(optional)_: By default, objdiff will use `make` to build the project.
134-
If the project uses a different build system (e.g. `ninja`), specify it here.
135-
The build command will be `[custom_make] [custom_args] path/to/object.o`.
138+
**`custom_args`** _(optional)_
139+
Additional arguments to pass to the build command prior to the object path.
136140

137-
`custom_args` _(optional)_: Additional arguments to pass to the build command prior to the object path.
141+
**`build_target`** _(default: `false`)_
142+
If true, objdiff will build the target objects before diffing (e.g. `make path/to/target.o`). Useful if target objects are not built by default or can change based on project configuration. Requires proper build system configuration.
138143

139-
`build_target`: If true, objdiff will tell the build system to build the target objects before diffing (e.g.
140-
`make path/to/target.o`).
141-
This is useful if the target objects are not built by default or can change based on project configuration or edits
142-
to assembly files.
143-
Requires the build system to be configured properly.
144+
**`build_base`** _(default: `true`)_
145+
If true, objdiff will build the base objects before diffing (e.g. `make path/to/base.o`). It's unlikely you'll want to disable this unless using an external tool to rebuild the base object.
144146

145-
`build_base`: If true, objdiff will tell the build system to build the base objects before diffing (e.g. `make path/to/base.o`).
146-
It's unlikely you'll want to disable this, unless you're using an external tool to rebuild the base object on source file changes.
147+
#### File Watching
147148

148-
`watch_patterns` _(optional)_: A list of glob patterns to watch for changes.
149-
([Supported syntax](https://docs.rs/globset/latest/globset/#syntax))
150-
If any of these files change, objdiff will automatically rebuild the objects and re-compare them.
151-
If not specified, objdiff will use the default patterns listed above.
149+
**`watch_patterns`** _(optional, default: listed above)_
150+
A list of glob patterns to watch for changes ([supported syntax](https://docs.rs/globset/latest/globset/#syntax)). When these files change, objdiff automatically rebuilds and re-compares objects.
152151

153-
`ignore_patterns` _(optional)_: A list of glob patterns to explicitly ignore when watching for changes.
154-
([Supported syntax](https://docs.rs/globset/latest/globset/#syntax))
155-
If not specified, objdiff will use the default patterns listed above.
152+
**`ignore_patterns`** _(optional, default: listed above)_
153+
A list of glob patterns to explicitly ignore when watching for changes ([supported syntax](https://docs.rs/globset/latest/globset/#syntax)).
156154

157-
`units` _(optional)_: If specified, objdiff will display a list of objects in the sidebar for easy navigation.
155+
#### Units (Objects)
158156

159-
> `name` _(optional)_: The name of the object in the UI. If not specified, the object's `path` will be used.
160-
>
161-
> `target_path`: Path to the "target" or "expected" object from the project root.
162-
> This object is the **intended result** of the match.
163-
>
164-
> `base_path`: Path to the "base" or "actual" object from the project root.
165-
> This object is built from the **current source code**.
166-
>
167-
> `metadata.auto_generated` _(optional)_: Hides the object from the object list, but still includes it in reports.
168-
>
169-
> `metadata.complete` _(optional)_: Marks the object as "complete" (or "linked") in the object list.
170-
> This is useful for marking objects that are fully decompiled. A value of `false` will mark the object as "incomplete".
157+
**`units`** _(optional)_
158+
If specified, objdiff displays a list of objects in the sidebar for easy navigation. Each unit contains:
159+
160+
- **`name`** _(optional)_ - The display name in the UI. Defaults to the object's `path`.
161+
- **`target_path`** _(optional)_ - Path to the "target" or "expected" object (the **intended result**).
162+
- **`base_path`** _(optional)_ - Path to the "base" or "current" object (built from **current source code**). Omit if there is no source object yet.
163+
- **`metadata.auto_generated`** _(optional)_ - Hides the object from the sidebar but includes it in progress reports.
164+
- **`metadata.complete`** _(optional)_ - Marks the object as "complete" (linked) when `true` or "incomplete" when `false`.
171165

172166
## Building
173167

174168
Install Rust via [rustup](https://rustup.rs).
175169

176170
```shell
177-
$ git clone https://github.com/encounter/objdiff.git
178-
$ cd objdiff
179-
$ cargo run --release
171+
git clone https://github.com/encounter/objdiff.git
172+
cd objdiff
173+
cargo run --release
180174
```
181175

182-
Or using `cargo install`.
176+
Or install directly with cargo:
183177

184178
```shell
185-
$ cargo install --locked --git https://github.com/encounter/objdiff.git objdiff-gui objdiff-cli
179+
cargo install --locked --git https://github.com/encounter/objdiff.git objdiff-gui objdiff-cli
186180
```
187181

188-
The binaries will be installed to `~/.cargo/bin` as `objdiff` and `objdiff-cli`.
189-
190-
## Installing `pre-commit`
191-
192-
When contributing, it's recommended to install `pre-commit` to automatically run the linter and formatter before a commit.
182+
Binaries will be installed to `~/.cargo/bin` as `objdiff` and `objdiff-cli`.
193183

194-
[`uv`](https://github.com/astral-sh/uv#installation) is recommended to manage Python version and tools.
184+
## Contributing
195185

196-
Rust nightly is required for `cargo +nightly fmt` and `cargo +nightly clippy`.
186+
Install `pre-commit` to run linting and formatting automatically:
197187

198188
```shell
199-
$ cargo install --locked cargo-deny
200-
$ rustup toolchain install nightly
201-
$ uv tool install pre-commit
202-
$ pre-commit install
189+
rustup toolchain install nightly # Required for cargo fmt/clippy
190+
cargo install --locked cargo-deny # https://github.com/EmbarkStudios/cargo-deny
191+
uv tool install pre-commit # https://docs.astral.sh/uv, or use pipx or pip
192+
pre-commit install
203193
```
204194

205195
## License

config.schema.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"custom_make": {
1717
"type": "string",
18-
"description": "By default, objdiff will use make to build the project.\nIf the project uses a different build system (e.g. ninja), specify it here.\nThe build command will be `[custom_make] [custom_args] path/to/object.o`.",
18+
"description": "If the project uses a different build system (e.g. ninja), specify it here.\nThe build command will be `[custom_make] [custom_args] path/to/object.o`.",
1919
"examples": [
2020
"make",
2121
"ninja"
@@ -41,17 +41,17 @@
4141
},
4242
"build_target": {
4343
"type": "boolean",
44-
"description": "If true, objdiff will tell the build system to build the target objects before diffing (e.g. `make path/to/target.o`).\nThis is useful if the target objects are not built by default or can change based on project configuration or edits to assembly files.\nRequires the build system to be configured properly.",
44+
"description": "If true, objdiff will build the target objects before diffing (e.g. `make path/to/target.o`).\nUseful if target objects are not built by default or can change based on project configuration.\nRequires proper build system configuration.",
4545
"default": false
4646
},
4747
"build_base": {
4848
"type": "boolean",
49-
"description": "If true, objdiff will tell the build system to build the base objects before diffing (e.g. `make path/to/base.o`).\nIt's unlikely you'll want to disable this, unless you're using an external tool to rebuild the base object on source file changes.",
49+
"description": "If true, objdiff will build the base objects before diffing (e.g. `make path/to/base.o`).\nIt's unlikely you'll want to disable this unless using an external tool to rebuild the base object.",
5050
"default": true
5151
},
5252
"watch_patterns": {
5353
"type": "array",
54-
"description": "List of glob patterns to watch for changes in the project.\nIf any of these files change, objdiff will automatically rebuild the objects and re-compare them.\nSupported syntax: https://docs.rs/globset/latest/globset/#syntax",
54+
"description": "A list of glob patterns to watch for changes.\nWhen these files change, objdiff automatically rebuilds and re-compares objects.\nSupported syntax: https://docs.rs/globset/latest/globset/#syntax",
5555
"items": {
5656
"type": "string"
5757
},
@@ -82,7 +82,7 @@
8282
},
8383
"ignore_patterns": {
8484
"type": "array",
85-
"description": "List of glob patterns to explicitly ignore when watching for changes.\nFiles matching these patterns will not trigger a rebuild.\nSupported syntax: https://docs.rs/globset/latest/globset/#syntax",
85+
"description": "A list of glob patterns to explicitly ignore when watching for changes.\nSupported syntax: https://docs.rs/globset/latest/globset/#syntax",
8686
"items": {
8787
"type": "string"
8888
},
@@ -119,7 +119,7 @@
119119
"properties": {
120120
"name": {
121121
"type": "string",
122-
"description": "The name of the object in the UI. If not specified, the object's path will be used."
122+
"description": "The display name in the UI. Defaults to the object's path."
123123
},
124124
"path": {
125125
"type": "string",
@@ -128,11 +128,11 @@
128128
},
129129
"target_path": {
130130
"type": "string",
131-
"description": "Path to the target object from the project root.\nRequired if path is not specified."
131+
"description": "Path to the \"target\" or \"expected\" object (the intended result)."
132132
},
133133
"base_path": {
134134
"type": "string",
135-
"description": "Path to the base object from the project root.\nRequired if path is not specified."
135+
"description": "Path to the \"base\" or \"current\" object (built from current source code).\nOmit if there is no source object yet."
136136
},
137137
"reverse_fn_order": {
138138
"type": "boolean",
@@ -207,7 +207,7 @@
207207
"properties": {
208208
"complete": {
209209
"type": "boolean",
210-
"description": "Marks the object as \"complete\" (or \"linked\") in the object list.\nThis is useful for marking objects that are fully decompiled. A value of `false` will mark the object as \"incomplete\"."
210+
"description": "Marks the object as \"complete\" (linked) when `true` or \"incomplete\" when `false`."
211211
},
212212
"reverse_fn_order": {
213213
"type": "boolean",
@@ -227,7 +227,7 @@
227227
},
228228
"auto_generated": {
229229
"type": "boolean",
230-
"description": "Hides the object from the object list by default, but still includes it in reports."
230+
"description": "Hides the object from the sidebar but includes it in progress reports."
231231
}
232232
}
233233
},

0 commit comments

Comments
 (0)