dol: add and use new `DolSectionType::Text`

This commit is contained in:
InusualZ 2022-06-01 20:51:03 -04:00
parent fd5ac733d7
commit 2de9ecc844
1 changed files with 8 additions and 1 deletions

View File

@ -146,6 +146,7 @@ impl Dol {
#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum DolSectionType { pub enum DolSectionType {
Text,
Data, Data,
Bss, Bss,
} }
@ -168,9 +169,15 @@ impl From<&DolHeaderData> for DolHeader {
fn from(header: &DolHeaderData) -> Self { fn from(header: &DolHeaderData) -> Self {
let mut sections = Vec::with_capacity(DolHeaderData::SECTION_COUNT); let mut sections = Vec::with_capacity(DolHeaderData::SECTION_COUNT);
for i in 0..DolHeaderData::SECTION_COUNT { for i in 0..DolHeaderData::SECTION_COUNT {
let kind = if i < 7 {
DolSectionType::Text
} else {
DolSectionType::Data
};
if header.section_sizes[i] > 0 { if header.section_sizes[i] > 0 {
sections.push(DolSection { sections.push(DolSection {
kind: DolSectionType::Data, kind,
index: i, index: i,
offset: header.section_offsets[i], offset: header.section_offsets[i],
target: header.section_targets[i], target: header.section_targets[i],