Home News Reviews Forums Shop


Writing to a CD-ROM XA Mode 2, Form 1?

Anything else

Writing to a CD-ROM XA Mode 2, Form 1?

Postby Atreides on Thu Jun 16, 2016 5:51 am

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
Atreides
Buffer Underrun
 
Posts: 6
Joined: Thu Jun 16, 2016 5:27 am

Re: Writing to a CD-ROM XA Mode 2, Form 1?

Postby Ian on Thu Jun 16, 2016 4:24 pm

Wouldn't it be easier to just replace the file within the container (ISO) or rebuild the ISO once the file has been modified?
"Blu-ray is just a bag of hurt." - Steve Jobs
User avatar
Ian
Grand Poobah
 
Posts: 15130
Joined: Sun Apr 08, 2001 2:34 pm
Location: Madison, WI

Re: Writing to a CD-ROM XA Mode 2, Form 1?

Postby Atreides on Fri Jun 17, 2016 6:25 pm

I don't know where to begin to do that, and (I heard) some PS1 games load files in a non-standard manner - though I don't know what the standard manner is, so take that with a grain of salt. I guess I could attempt to build an ISO from a directory of all the game files (using existing software) and see if it works in an emulator.

EDIT

https://i.sli.mg/NRumkM.png

http://pastebin.com/sy9tpBEL

Here is an example - Final Fantasy Tactics for the PS1. This is the first sector that contains filenames, and it's some sort of directory. Where does each entry in this directory begin and end? What is the significance of each byte/bit in each entry? How do you tell the difference between a entry to a file and an entry to another directory?

I think my issue is that I get stuck when I come across something I don't understand, and there is so much that I - and probably most people - don't know.
Atreides
Buffer Underrun
 
Posts: 6
Joined: Thu Jun 16, 2016 5:27 am


Return to General Software Questions

Who is online

Users browsing this forum: No registered users and 2 guests

All Content is Copyright (c) 2001-2024 CDRLabs Inc.