Skip to content

Commit

Permalink
Fix v1-2 REL alignment regression
Browse files Browse the repository at this point in the history
Alignment after section data and
before relocations / import table
is exclusive to REL v3.
  • Loading branch information
encounter committed Sep 5, 2024
1 parent c403931 commit 9dfdbb9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "decomp-toolkit"
description = "Yet another GameCube/Wii decompilation toolkit."
authors = ["Luke Street <[email protected]>"]
license = "MIT OR Apache-2.0"
version = "0.9.5"
version = "0.9.6"
edition = "2021"
publish = false
repository = "https://github.com/encounter/decomp-toolkit"
Expand Down
10 changes: 6 additions & 4 deletions src/util/rel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,10 @@ where
offset = (offset + align) & !align;
offset += section.size() as u32;
}
// Align to 4 after section data
offset = (offset + 3) & !3;
if info.version >= 3 {
// Align to 4 after section data
offset = (offset + 3) & !3;
}

fn do_relocation_layout(
relocations: &[RelReloc],
Expand Down Expand Up @@ -1047,8 +1049,8 @@ where
}
w.write_all(&section_data)?;
}
// Align to 4 after section data
{
if info.version >= 3 {
// Align to 4 after section data
let position = w.stream_position()?;
w.write_all(&vec![0u8; calculate_padding(position, 4) as usize])?;
}
Expand Down

0 comments on commit 9dfdbb9

Please sign in to comment.