Skip to content

Rename new_type attribute and code improvements#73

Open
N4gtan wants to merge 33 commits intoLameguy64:masterfrom
N4gtan:dev
Open

Rename new_type attribute and code improvements#73
N4gtan wants to merge 33 commits intoLameguy64:masterfrom
N4gtan:dev

Conversation

@N4gtan
Copy link
Contributor

@N4gtan N4gtan commented Jan 20, 2026

This PR introduces several code improvements and a necessary terminology update:

  • Refactored Logic: Unified the sector reading logic in ReadBytes and simplified virtual_wav_seek to reduce complexity and code duplication. Also removed redundant validation checks and redundant return values in writer functions.

  • Global IsoReader: Moved IsoReader to the global scope. Since this instance is utilized in practically every function of the program, making it global simplifies the code structure and will make implementing future changes much easier.

  • Attribute Rename (new_type -> cdvd_style): The previous attribute name new_type was too vague. I've renamed it to cdvd_style to accurately reflect that this setting handles the logic specific to the Sony CD/DVD Generator engine.

    • Note: I am open to suggestions for a better name.

This PR depends on:

N4gtan added 15 commits January 13, 2026 05:15
Files and subdirectories now automatically inherit the base path from their
parent entry. This allows omitting the `source` attribute, as paths will
be resolved relative to the current directory context.
Since IsoReader is utilized in practically all program functions, it made more sense to handle it globally rather than passing it as a parameter everywhere.
…ctions

- Convert signatures to `void` to reflect "fire-and-forget" logic.
- Remove defensive checks for `srcfiles` already validated by `Stat()` upstream.
The previous implementation added unnecessary complexity by handling relative offsets and multiple seek origins (SET/END/CUR) individually.

Normalizing all seek requests to an absolute position reduces code duplication and eliminates fragile relative arithmetic.
The `new_type` attribute was vague. Research confirmed that some late PS1 games (~2003) were built using the Sony CD/DVD-ROM Generator engine logic.

`cdvd_style` accurately describes this behavior.
Rewrite the DA file normalization loop to correctly identify and reuse existing tracks, preventing conflicts between `trackid` and `source` attributes.
- Rename 'entry' and 'parent' to 'm_entry' and 'm_parent'.
- Remove redundant 'name' member; use m_entry->id instead.
- Move WriteDescriptor to be a member function of DirTreeClass.
- Update WriteDirectoryRecords to rely on internal state.
- Adjust main.cpp to match the updated class constructor and methods.
- Merge GenPathTableSub into GeneratePathTable.
- Remove the unused recursive 'sub' pointer from PathEntryClass.
- Move implementation next to GenTableData to improve code locality and debugging flow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant