Hello,
https://en.wikipedia.org/wiki/CD-ROM#XA
I'm developing a game editor for a PS1 game. I need to edit files that are contained in a disc image. This has vexed me, but I think I have a plan now.
1. Determine the start of the write location in the disc image.
2. Determine the number of bytes between that location and the end of the data portion of current sector.
3. Create a data structure (and array of arrays of integers) that mimics the data portion of the sectors.
4. Load the game data into that data structure, starting at the same location in the first Integer[][] as the write location.
5. Write the remainder of Integer[0] to the disc image.
6. int counter = 1.
7. Begin while loop - iterate if Integer[counter] is full (there are several ways I could do that), else skip to step 12.
8. Skip to beginning of next sector's data portion.
9. Write Integer[counter] to that sector's data portion.
10. counter ++
11. Return to step 7.
12. You've reached an Integer[] that is only partially full.
13. Skp to beginning of next sector's data portion.
14. lastArrayCounter = 0
15. While Integer[counter][lastArrayCounter] != null, else skip to step 19.
16. Write Interger[counter][lastArrayCounter] to disc image.
17. lastArrayCounter ++
18. Return to step 15.
19. Return void
Does this pseudocode seem viable? Does anyone have a cleverer solution to the problem? Has anyone done something like this before?
I don't care about EDC and ECC because most emulators don't care about it, but can anyone explain how I would generate them in terms that someone who barely understands discrete math would comprehend?
Thanks,
Atreides