PLUS+1 GUIDE doesn't show what changed between two versions of a project. Customers who keep GUIDE projects in git see only "binary file changed" for the graphical logic. This issue covers a tool that makes those changes visible, for the control logic (the function blocks, gates and wires on GUIDE's sheets) as well as the display screens.
The goal is a GUI tool that shows two versions side by side, drawn the way GUIDE draws them, with the changes highlighted. A command-line diff comes first, because it gives us the decoded format the GUI draws from.
Based on two public projects (GUIDE 2023.1.4 and 2025.1.2), which have no licence and are used for format research only:
.scs (main module and submodules): a 64-byte header (C)GM Data Service Sweden v.100 ... BinStreamInchange, then a zlib stream at offset 64. Decompressed, it is a binary record stream with readable names: sheets, blocks, nets, labels. The main module of the sample is 1.3 MB decompressed. It also holds drawing coordinates.
Already text or XML, so git diffs them as they are:
.p1x (project manifest);
.ssd (screens and submodule interfaces);
.pvc, .nms, .bsd;
PLCFile1.xml (PLCopen XML ST blocks);
.tnt (a net list with values and data types, written by the build).
The project format version differs between the samples (FileFormat 007D and 008D), so the decoder has to know which version it reads.
Steps
Prototype CLI (this issue's first step):
inflate .scs and walk the record stream;
write a canonical text form in a fixed order: sheets, blocks with their type, pins and connections, parameters and constants, labels;
usable as a git textconv driver (*.scs diff=plus1) and as p1diff A B for diff tools;
unknown records are written as hex, so nothing is hidden.
Decoder: map the record types to GUIDE's model: the block library (gates, timers, math, CAN, I/O), instances, pins, wires, parameters, pages, and the screens' widgets. The fastest way there is before/after pairs from a real project: change one constant, one wire or one gate, save, commit.
GUI tool:
two versions side by side, each sheet drawn as GUIDE draws it (blocks as gate symbols, wires, labels, positions from the coordinates);
added, removed and changed blocks and wires highlighted;
a list of changes to step through;
opens two files, or two git revisions of a repository;
Windows first (GUIDE runs there), single binary;
display screens shown the same way.
Later: Prüfwerk's scan history lists control-logic changes per scan, as it lists component changes (#974).
Risks
The .scs format is undocumented and can change with GUIDE versions.
GUIDE's licence terms may restrict reverse engineering. The EU Software Directive 2009/24, Art. 6 allows it for interoperability under conditions. Needs a legal check, or an agreement with Danfoss.
The public samples can't be fixtures. Tests need samples we're allowed to keep: the customer's, or ones we create with a GUIDE licence (the Express licence is a 30-day trial).
Open questions
Is it a separate product or part of Prüfwerk? (Repo and licence follow from that.)
Can the customer give us before/after pairs of their own project?
Do we get a GUIDE licence to create our own samples?
PLUS+1 GUIDE doesn't show what changed between two versions of a project. Customers who keep GUIDE projects in git see only "binary file changed" for the graphical logic. This issue covers a tool that makes those changes visible, for the **control logic** (the function blocks, gates and wires on GUIDE's sheets) as well as the **display screens**.
The goal is a **GUI tool** that shows two versions side by side, drawn the way GUIDE draws them, with the changes highlighted. A command-line diff comes first, because it gives us the decoded format the GUI draws from.
Related: #976 (PLUS+1 support in Prüfwerk).
## What we know about the format
Based on two public projects (GUIDE 2023.1.4 and 2025.1.2), which have no licence and are used for format research only:
- **`.scs`** (main module and submodules): a 64-byte header `(C)GM Data Service Sweden v.100 ... BinStreamInchange`, then a **zlib stream** at offset 64. Decompressed, it is a binary record stream with readable names: sheets, blocks, nets, labels. The main module of the sample is 1.3 MB decompressed. It also holds drawing coordinates.
- Already text or XML, so git diffs them as they are:
- `.p1x` (project manifest);
- `.ssd` (screens and submodule interfaces);
- `.pvc`, `.nms`, `.bsd`;
- `PLCFile1.xml` (PLCopen XML ST blocks);
- `.tnt` (a net list with values and data types, written by the build).
- The project format version differs between the samples (`FileFormat` 007D and 008D), so the decoder has to know which version it reads.
## Steps
1. **Prototype CLI (this issue's first step):**
- inflate `.scs` and walk the record stream;
- write a canonical text form in a fixed order: sheets, blocks with their type, pins and connections, parameters and constants, labels;
- usable as a git `textconv` driver (`*.scs diff=plus1`) and as `p1diff A B` for diff tools;
- unknown records are written as hex, so nothing is hidden.
2. **Decoder:** map the record types to GUIDE's model: the block library (gates, timers, math, CAN, I/O), instances, pins, wires, parameters, pages, and the screens' widgets. The fastest way there is **before/after pairs from a real project**: change one constant, one wire or one gate, save, commit.
3. **GUI tool:**
- two versions side by side, each sheet drawn as GUIDE draws it (blocks as gate symbols, wires, labels, positions from the coordinates);
- added, removed and changed blocks and wires highlighted;
- a list of changes to step through;
- opens two files, or two git revisions of a repository;
- Windows first (GUIDE runs there), single binary;
- display screens shown the same way.
4. **Later:** Prüfwerk's scan history lists control-logic changes per scan, as it lists component changes (#974).
## Risks
- The `.scs` format is undocumented and can change with GUIDE versions.
- GUIDE's licence terms may restrict reverse engineering. The EU Software Directive 2009/24, Art. 6 allows it for interoperability under conditions. Needs a legal check, or an agreement with Danfoss.
- The public samples can't be fixtures. Tests need samples we're allowed to keep: the customer's, or ones we create with a GUIDE licence (the Express licence is a 30-day trial).
## Open questions
- Is it a separate product or part of Prüfwerk? (Repo and licence follow from that.)
- Can the customer give us before/after pairs of their own project?
- Do we get a GUIDE licence to create our own samples?
Based on 15 saved versions of four modules (GUIDE 2023.1 and 2025.1, a display and three controllers), for format research only.
Container
64-byte header (C)GM Data Service Sweden v.100 ... BinStreamInchange, then a zlib stream at offset 64.
Decompressed, a flat record stream: u16 tag, u32 length, payload, little-endian.
It parses to the last byte in all 15 files. Tags 0x13/0x14 open and close groups, so the stream is a tree.
41 to 42 tags in use.
Objects and references
Objects carry their memory address as id: 0x54 symbol types, 0x2e placed blocks at @0, 0x2d ports, 0x41 texts at @2, 0x36 pages, among others.
References use the same addresses: net endpoint lists 0x2a, a block's type at 0x2e@18, a port's type at 0x2d@20.
All references resolve to an object in the same file. The ids differ on every save.
What a save changes, apart from the edit itself
All ids.
The order of objects within a sheet.
The numbering and order of wire segments (0x25) and junctions (0x52).
The last 16 bytes of page records (0x36).
Stable across saves
Names, positions and properties.
The 16-byte GUID at 0x2e@30, one per placed block. That's the identity key the GUI needs to tell "moved" from "changed" from "replaced".
Decoded records
Tag
What
Fields
0x11
name of the object that follows
text
0x2e
placed block
id @0, x @4, y @8, type @18, GUID @30
0x2d
port / bus label
id @0, x @6, y @10, type @20
0x38
block pin and its net
pin number @2, net name @6
0x19, 0x3a
property KEY=VALUE, e.g. V1= constant values, PINTYPE, PINDIR
6-byte head, text
0x41
text shown on the sheet
id @2, x @14, y @18, flag byte @46, text @47
0x50 / 0x51
net / wire segment
marker
0x2a
pins a net connects
u16 count, then (object id, u16 pin)
0x25
wire polyline
u16 point count @8, points (i32 x, i32 y) from @18
0x52
junction points
u32 count, points
0x05, 0x0e, 0x06, 0x4f
symbol drawing (lines, arcs, rectangles) and pin positions
coordinates
The symbol drawings and all positions are in the file. So drawing sheets the way GUIDE does is feasible for the GUI.
Prototype p1diff
A Rust CLI, kept local for now (no repo, no push):
p1diff dump FILE.scs writes the canonical text. It works as a git textconv driver (*.scs diff=plus1).
p1diff diff OLD NEW writes a unified diff.
p1diff git-setup prints the git configuration.
In the canonical text:
ids are replaced by the object's path of names (Sheet/Page/Block);
objects are sorted within each group;
wires and junctions are written without numbering and sorted;
undecoded records are written as hex, so a change in them still shows.
Result: between saves of the same project, the diff is down to the real edits. Changed constants, moved blocks and ports, rewired nets and added blocks show up; save noise doesn't. For example, one pair went from 10,152 changed lines (naive) to 62, all of them real. The release with the most added logic is large, as it should be. It reads a 2.5 MB module in 0.07 s.
Known limits
The git hunk header names the nearest preceding name line, which can be a sibling object.
Unnamed parts (nets, segments) are sorted by content, so a rewire reads as one segment removed and one added rather than a changed line.
Paths assume names are unique within a sheet.
About half of the 41 tags are still written as hex.
Next
Before/after pairs from a real project, made on purpose (one constant, one wire, one gate), to decode the remaining tags.
Test data we may keep: from the customer, or created with a GUIDE licence.
Decide where the tool lives (a separate repo recommended), then step 3: the GUI.
## The `.scs` format: what's decoded so far
Based on 15 saved versions of four modules (GUIDE 2023.1 and 2025.1, a display and three controllers), for format research only.
**Container**
- 64-byte header `(C)GM Data Service Sweden v.100 ... BinStreamInchange`, then a zlib stream at offset 64.
- Decompressed, a flat record stream: `u16 tag`, `u32 length`, payload, little-endian.
- It parses to the last byte in all 15 files. Tags `0x13`/`0x14` open and close groups, so the stream is a tree.
- 41 to 42 tags in use.
**Objects and references**
- Objects carry their **memory address as id**: `0x54` symbol types, `0x2e` placed blocks at @0, `0x2d` ports, `0x41` texts at @2, `0x36` pages, among others.
- References use the same addresses: net endpoint lists `0x2a`, a block's type at `0x2e`@18, a port's type at `0x2d`@20.
- All references resolve to an object in the same file. The ids differ on every save.
**What a save changes, apart from the edit itself**
- All ids.
- The order of objects within a sheet.
- The numbering and order of wire segments (`0x25`) and junctions (`0x52`).
- The last 16 bytes of page records (`0x36`).
**Stable across saves**
- Names, positions and properties.
- The 16-byte GUID at `0x2e`@30, one per placed block. That's the identity key the GUI needs to tell "moved" from "changed" from "replaced".
**Decoded records**
| Tag | What | Fields |
|---|---|---|
| `0x11` | name of the object that follows | text |
| `0x2e` | placed block | id @0, x @4, y @8, type @18, GUID @30 |
| `0x2d` | port / bus label | id @0, x @6, y @10, type @20 |
| `0x38` | block pin and its net | pin number @2, net name @6 |
| `0x19`, `0x3a` | property `KEY=VALUE`, e.g. `V1=` constant values, `PINTYPE`, `PINDIR` | 6-byte head, text |
| `0x41` | text shown on the sheet | id @2, x @14, y @18, flag byte @46, text @47 |
| `0x50` / `0x51` | net / wire segment | marker |
| `0x2a` | pins a net connects | u16 count, then (object id, u16 pin) |
| `0x25` | wire polyline | u16 point count @8, points (i32 x, i32 y) from @18 |
| `0x52` | junction points | u32 count, points |
| `0x05`, `0x0e`, `0x06`, `0x4f` | symbol drawing (lines, arcs, rectangles) and pin positions | coordinates |
The symbol drawings and all positions are in the file. So drawing sheets the way GUIDE does is feasible for the GUI.
## Prototype `p1diff`
A Rust CLI, kept local for now (no repo, no push):
- `p1diff dump FILE.scs` writes the canonical text. It works as a git `textconv` driver (`*.scs diff=plus1`).
- `p1diff diff OLD NEW` writes a unified diff.
- `p1diff git-setup` prints the git configuration.
In the canonical text:
- ids are replaced by the object's path of names (`Sheet/Page/Block`);
- objects are sorted within each group;
- wires and junctions are written without numbering and sorted;
- undecoded records are written as hex, so a change in them still shows.
**Result:** between saves of the same project, the diff is down to the real edits. Changed constants, moved blocks and ports, rewired nets and added blocks show up; save noise doesn't. For example, one pair went from 10,152 changed lines (naive) to 62, all of them real. The release with the most added logic is large, as it should be. It reads a 2.5 MB module in 0.07 s.
**Known limits**
- The git hunk header names the nearest preceding `name` line, which can be a sibling object.
- Unnamed parts (nets, segments) are sorted by content, so a rewire reads as one segment removed and one added rather than a changed line.
- Paths assume names are unique within a sheet.
- About half of the 41 tags are still written as hex.
## Next
- Before/after pairs from a real project, made on purpose (one constant, one wire, one gate), to decode the remaining tags.
- Test data we may keep: from the customer, or created with a GUIDE licence.
- Decide where the tool lives (a separate repo recommended), then step 3: the GUI.
The prototype now lives in its own private repo: platform/p1diff (https://git.breakpilot.com/platform/p1diff), main at 88f608d. It has no CI yet and contains no GUIDE project files.
The prototype now lives in its own private repo: platform/p1diff (https://git.breakpilot.com/platform/p1diff), main at 88f608d. It has no CI yet and contains no GUIDE project files.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
PLUS+1 GUIDE doesn't show what changed between two versions of a project. Customers who keep GUIDE projects in git see only "binary file changed" for the graphical logic. This issue covers a tool that makes those changes visible, for the control logic (the function blocks, gates and wires on GUIDE's sheets) as well as the display screens.
The goal is a GUI tool that shows two versions side by side, drawn the way GUIDE draws them, with the changes highlighted. A command-line diff comes first, because it gives us the decoded format the GUI draws from.
Related: #976 (PLUS+1 support in Prüfwerk).
What we know about the format
Based on two public projects (GUIDE 2023.1.4 and 2025.1.2), which have no licence and are used for format research only:
.scs(main module and submodules): a 64-byte header(C)GM Data Service Sweden v.100 ... BinStreamInchange, then a zlib stream at offset 64. Decompressed, it is a binary record stream with readable names: sheets, blocks, nets, labels. The main module of the sample is 1.3 MB decompressed. It also holds drawing coordinates..p1x(project manifest);.ssd(screens and submodule interfaces);.pvc,.nms,.bsd;PLCFile1.xml(PLCopen XML ST blocks);.tnt(a net list with values and data types, written by the build).FileFormat007D and 008D), so the decoder has to know which version it reads.Steps
.scsand walk the record stream;textconvdriver (*.scs diff=plus1) and asp1diff A Bfor diff tools;Risks
.scsformat is undocumented and can change with GUIDE versions.Open questions
The
.scsformat: what's decoded so farBased on 15 saved versions of four modules (GUIDE 2023.1 and 2025.1, a display and three controllers), for format research only.
Container
(C)GM Data Service Sweden v.100 ... BinStreamInchange, then a zlib stream at offset 64.u16 tag,u32 length, payload, little-endian.0x13/0x14open and close groups, so the stream is a tree.Objects and references
0x54symbol types,0x2eplaced blocks at @0,0x2dports,0x41texts at @2,0x36pages, among others.0x2a, a block's type at0x2e@18, a port's type at0x2d@20.What a save changes, apart from the edit itself
0x25) and junctions (0x52).0x36).Stable across saves
0x2e@30, one per placed block. That's the identity key the GUI needs to tell "moved" from "changed" from "replaced".Decoded records
0x110x2e0x2d0x380x19,0x3aKEY=VALUE, e.g.V1=constant values,PINTYPE,PINDIR0x410x50/0x510x2a0x250x520x05,0x0e,0x06,0x4fThe symbol drawings and all positions are in the file. So drawing sheets the way GUIDE does is feasible for the GUI.
Prototype
p1diffA Rust CLI, kept local for now (no repo, no push):
p1diff dump FILE.scswrites the canonical text. It works as a gittextconvdriver (*.scs diff=plus1).p1diff diff OLD NEWwrites a unified diff.p1diff git-setupprints the git configuration.In the canonical text:
Sheet/Page/Block);Result: between saves of the same project, the diff is down to the real edits. Changed constants, moved blocks and ports, rewired nets and added blocks show up; save noise doesn't. For example, one pair went from 10,152 changed lines (naive) to 62, all of them real. The release with the most added logic is large, as it should be. It reads a 2.5 MB module in 0.07 s.
Known limits
nameline, which can be a sibling object.Next
The prototype now lives in its own private repo: platform/p1diff (https://git.breakpilot.com/platform/p1diff), main at 88f608d. It has no CI yet and contains no GUIDE project files.