How can I modify files within PSX ISO for a hack of RE Director's Cut DualShock?

Started by ShadowOne333, February 24, 2021, 03:35:06 PM

Previous topic - Next topic

acediez

Congrats!

It looks very similar to Mega Man X4's table! Which was something like...

[00 00 00 00] [00 00 00 00] [00 00 00 00]
     LBA           SIZE      FILE TYPE ID


Yours are probably in a different order though.
Size can wither mean the exact number of bytes, or the number of disc sectors (round up filesize/2048).
As for the file type ID (if you have something like that), just keep the one already on the table.

Quote from: ShadowOne333 on March 01, 2021, 06:18:48 PM
I assume that I'd need to create a dummy BIN first with all the files in place, so I can grab the LBA final offsets, then modify the SLUS, and then recompile the BIN to create the final one. Am I correct?
That's exactly what I did for X4 and 8. I wrote a "makefile" script that does all that:

1. Build the disc with mkpsxiso
2. Extract the file list with LBA and sizes from it to a text file using IsoBuster. There's a command line parameter for that.
This is what I used, took it straight from some documentation: isobuster.exe "inputfile.bin" "/tree:all:outputfile.txt>?<`%RELPATH>`,<`%LBA>`,<`%BYTES>" /c
3. Read and sort the text file data and modify the PS-EXE file with the results
4. Repeat step 1 (rebuild the disc with the modified PS-EXE)

It's probably more practical to simply calculate the LBAs based on file sizes and file types, so you only build the disc once. It's the approach I would try to take if I were to do it from scratch now.
If you do manage to calculate them correctly without rebuilding, you could even try injecting your modified files and the modified PS-EXE using PSX-MODE2 instead of ever rebuilding the disc.

I won't offer my scripts as examples because they're hard to read even for me... they were the very first things I ever scripted, and I haven't maintained them in years, not sure they'll even work on a different machine. Tt's better if you write them yourself. When dealing with PS1 games, you will likely run into more situations that need scripting anyway.

PhOeNiX

mkpsxiso can  output to txt the LBA's of the files in the output iso without building the iso at all. So, the idea is to let mkpsxiso calculatethe LBAs in the txt file, and with some custom tool, parse the txt, update the LBA + size values in the SLUS. Then, you can actually build the iso with mkpsxiso.
Be sure that XA data and the dummy .DA file are at the end of the disk (i.e., with the highest LBA with the .DA file being the latest).

acediez

Quote from: PhOeNiX on March 02, 2021, 05:55:11 AM
mkpsxiso can  output to txt the LBA's of the files in the output iso without building the iso at all.

I somehow missed that 😅 Could it be done in 2018? lol

PhOeNiX

Quote from: acediez on March 02, 2021, 08:02:13 AM
I somehow missed that 😅 Could it be done in 2018? lol
I think so. At least, in v1.23 (dated Dec 20, 2018), which is the latest binary Lameguy has uploaded on github.

ShadowOne333

What Phoenix said is true, you can output a TXT file with the LBA table.
I believe it's something like:

mkpsxiso.exe -lba lba.txt -noisogen resident.xml

That should output a file called "lba.txt" with the information from the compiled ISO.
I screwed around with the SLUS again today, manually changing each address from the LBA table (yep, manually converting each LBA offset to Hex, then input the Hex address into the SLUS file through a Hex editor, no script. Dumb, I know), and I managed to get further than the Warning screen now.

The uncensored movie plays when starting a new game.
However, there's two drawbacks:

1) All of the movies (even the original Capcom movie) seem to not have any sound now.
2) The game doesn't start. Instead, it freezes on the intro text.
Normal mode freezes at the words "where they thought it was safe", while Arrange freezes at the word "Yet". The 3 dots after it don't appear. Tried with both Jill and Chris' scenarios, and they both refuse to start. Not sure if it might be related to the audio tracks ported over from Director's Cut trying to play that it crashes it.

That's as far as I got today.
If anyone has any insight on why the movies don't have any sound and/or why the actual game refuses to boot, please let me know!

acediez

1) I've had intanced of STR audio not playing, it was either because I extracted them incorrectly, or they were modified and encoded with the wrong parameters. Maybe you didn't extract the STR files correctly? I'm sure LameGuy64's tool would handle that correctly, but if you haven't tried yet, I'd rip the files using XtrActor. That works for me every time.

2) If you did it all manually, I'd start by double cheking your table editing :P

After that, one simple way of finding the cause: remove one of the changes one by one, rebuild the disc each time. (That's why I suggest scripts when dealing with PS1 games. Not that the tasks are hard, it's just that doing them manually every time you need to test a small change will kill you. At the very least you could save some time parsing numbers, converting to-from hexadecimal, endian swapping, etc, using Excel/Google Sheets and some formulas, if you haven't already.)

There's also the chance that your game has a separate table dedicated to audio tracks (with a similar start offset/file size structure). I've dealt with a couple of those, both on Mega Man X5 and Goemon Shinsedai Shuumei (though they were XA audio tracks).

Quote from: PhOeNiX on March 02, 2021, 09:53:31 AM
I think so. At least, in v1.23 (dated Dec 20, 2018), which is the latest binary Lameguy has uploaded on github.

Should've read the documentation more throughly! It would've cut my waiting time for each test build significately. Thanks, I'll definitely use it next time  :laugh:

PhOeNiX

Isodump definitely supports extracting the str with xa audio. So, it should work if you extracted the bin with isodump (the most recent version here at rhdn).

-EDIT-
I just tried dumping the clean USA bin with the latest version of isodump and then rebuilt it with mkpsxiso, and the game works perfectly with also XA audio. So, if anything wrong, it has to do with how you change the files. STR files are extracted correctly, and mkpsxiso even rebuilds the bin following the same lba's of the original BIN (if no changes are applied).

March 03, 2021, 04:39:02 AM - (Auto Merged - Double Posts are not allowed before 7 days.)

Quote from: ShadowOne333 on March 01, 2021, 06:18:48 PM

I tracked down the whole table, and I think the beginning of it is at location 0x087650 within the SLUS file.
I am still not sure what the 4th byte of each entry in the table seems to be, as it tends to change between files a lot.


The table actually starts at 0x087654, and each file has 8 bytes info. The first 4 bytes are a 4-bytes integer denoting the size of the file in bytes. Then, there is a 3-bytes integer denoting the LBA. The last byte is the actual CRC of the file that the game checks when loading the file in memory. Since you disabled the check completely, you can ignore this byte.

ShadowOne333

How exactly are you dumping and rebuilding the ISO with isodump/mkpsxiso, Phoenix?
I don't remember well, but I think either isodump or mkpsxiso, but I recall getting a message about the ZNULL.DAT (or whatever the name is of the DAT at the root) file not matching entirely or something like that. And also RE DC DS has two bins in it.

From the information given, I believe I didn't really take into account the first 4 byte integer for the size into account when I was modifying the SLUS file. I only changed the LBA table addresses, not those 4-bytes.
Could the issue about the audio not playing be related to that?

I will try making a script today to make things easier for when editing the SLUS file.
It might take longer since it'll be my first time actually dealing with byte/Hex editing through script handling, but I'll do my best.

PhOeNiX

You can ignore the warning isodump is throwing. It simply said that the znull file points to an audio track that is not included in the bin file (indeed it is on a separate bin). So isodump writes a dummy audio in it. However this track is dummy anyway in the original game, so when rebuilding the iso, you will not loose anything.

So whatever is wrong, it has to do with the lba table or the modified files.

REDeli

Hi, I'm getting into modding RE1 PSX too. I'd advise you to read this little article I wrote, I think it might help you:
http://re123.bplaced.net/board/viewtopic.php?f=10&t=1296

REDeli

The thing is I want to do a Director's Cut mod too, but without the issues of UDC and maybe some extras too. The guy who made UDC, Wes67, also created a rebuilder for RE1 which removes the checksum verification, it works pretty well for replacing the awful DualShock soundtrack, room files, etc. However, if you replace a cutscene that is longer than the original, it will cut playback before it should. So I've kinda fixed that, as I've detailed in my post above, but there are still some issues to fix. Also, I'd love to restore the original Japanese background for the files, missing in every US PS1 version. If anyone's interested, my Discord is #6203.

ShadowOne333

I finally finished making a script that makes a copy of the SLUS file and patches the proper bytes in place.
I renamed the bin to the Track 1 name, loaded the original .cue for the game into ePSXe, and it now boots with audio and all.

However, I am STILL getting stuck at the messages that are supposed to appear right after the intro movie (which plays fine now).
After the coloured intro finishes, now the message that is supposed to appear before starting the game just doesn't appear.

I tried looking if I did something wrong with the patching, but I am not sure.
I am running out of ideas on what I could be doing wrong, if anyone has a suggestion on what to try next, please let me know.

Here's the patching script I made, alongside the LBA table of the project, and an IPS to patch the SLUS for anyone who wants to try out:

https://www.dropbox.com/s/81z6vigrg8vf9ht/REPatch.zip?dl=0

Remember the files carried over from the Ultimate Director's Cut hack are:
Spoiler

Models for Chris, Jill & Rebecca:
ENEMY/
EM1032.EMD
EM1033.EMD
EM1035.EMD
EM1040.EMD
EM1041.EMD
EM1043.EMD
EM104C.EMD

Music and sound files:
All files after SEP00.HSB
SOUND/
SEP00.HSB -> SEP36.HSB

ZMOVIE/
DM3.STR
DM4.STR
DM6.STR
DMB.STR
DMC.STR
ED1.STR
ED2.STR
ED3.STR
ED4.STR
ED5.STR
ED6.STR
ED7.STR
PJ.STR
STFR.STR

STAGE2/
STAGE207.BSS
STAGE2070.RDT
STAGE2071.RDT
[close]

With those files copied over from Ultimate Director's Cut, and the SLUS patched with the IPS or the script, it should give the same result as the build I'm having.

Any suggestion would be greatly appreciated!

PhOeNiX

Did you check that with the original files, your script does not change anything on the lba table? If this is the case, did you try rebuilding the iso without the stage files (these are the ones containing text, textures etc. of the different sections of the game).

ShadowOne333

Quote from: PhOeNiX on March 08, 2021, 01:57:05 PM
Did you check that with the original files, your script does not change anything on the lba table? If this is the case, did you try rebuilding the iso without the stage files (these are the ones containing text, textures etc. of the different sections of the game).

Haven't build the original files, but I'll give it a try and see what happens.
Out of that, I completely missed the posts made by @Deli yesterday.
In his posts, he mentions doing something very similar in scope to what I am attempting.

Not only that, but he brought up to my attention a tool by Wes67 which apparently allows for rebuilding the ISO without having to worry about the LBA table, as it seems that you can replace files just fine and the tool handles that. The tool in question is "RE1 Rebuilder" by Wes67, which can be found here:
https://www.tapatalk.com/groups/residentevil123/re1_rebuilder-t2390.html

Maybe with this tool I can make a build and be sure that the LBA is correct, and it's not a screw up on my part lol




EDIT:
I got in touch with @Deli these past couple of days, and from what he's told me and teached me, he managed to pretty much cover all I wanted to do (which is put the uncensored FMVs, the 3D models for characters and the DC OST from Ultimate Director's Cut), but with so much more stuff planned under his belt.

With that said, right now the top priorities are to find how to restore the background images used for files obtained from the Japanese version, restoring/editing the bloody wall text for Arrange mode, and restore the credits video from the ending FMV that's not just a plain black background.
If anyone knows (for starters) how to text edit message for the game, that'd be helpful for the bloody wall text.

Aside from that, here's the checklist that Deli wants to cover for a release of his hack:

- Restore all the uncut FMVs:
    - DM3.STR: First Zombie (DONE).
    - PJ.STR: Intro (ALMOST DONE).
    - ED1.STR: Chris' Bad Ending (DONE).
    - STFZ.STR: Japanese Gory Ending after using the Rocket Launcher. Requires restoring the credits text
      (the JP version has English text, except for the Opening and Ending themes credits).
      https://www.youtube.com/watch?v=BS9NlHyFQAY&ab_channel=pyramid
- Restore Original BGM (if using DualShock Ver.) (DONE).
- Restore Background of the different files throughout the game as in the Japanese versions.
- Restore the text that labels Jill and Chris a Easy and Hard respectively (use DualShock Japanese version for this!!).
- Restore message written in blood in Mansion East Stairway 2F (possibly needs a translation) from Demo Version. The text translates to the following:
  "Something is written on the wall...
   I... can't breathe... (Breathing is painful...)
   Save me from this pain... (Someone stop this suffering)"
- Restore footsteps scene when you enter the Mansion Storeroom, following a Zombie appearing when you exit the room, from Demo Version.
- Restore unknown music track from the scene when Jill first re-encounters with Barry in the Hallway Stairs ("especially against living things" scene) from 01/31/1996 beta.
- Restore ability of the root to kill in the Guardhouse Entry (if possible, only in Arrange mode) from 01/31/1996 beta.
- Restore Beretta Ammo in Bathtub in the Mansion's bathroom from 01/31/1996 beta.
- Restore Heliport and Battery SFX from 01/31/1996 beta.
- Restore Boulder activating when you approach from 01/31/1996 beta (if possible, only in Arrange mode).
- Alter Naked zombies location in the lab.

ShadowOne333

Continuing over with this discussion, @Deli managed to get a lot of the planned stuff on his end working, and released an initial version of the restoration hack:
http://www.romhacking.net/hacks/5837/

To anyone interested, be sure to check it out.
According to the release page, and the post above, he might work on other things to make this the definitive way to play the original cheesy RE1!

niuus

Quote from: ShadowOne333 on March 23, 2021, 08:11:31 PM
Continuing over with this discussion, @Deli managed to get a lot of the planned stuff on his end working, and released an initial version of the restoration hack:
http://www.romhacking.net/hacks/5837/

To anyone interested, be sure to check it out.
According to the release page, and the post above, he might work on other things to make this the definitive way to play the original cheesy RE1!
This is super cool, i'll be playing it shortly. Hopefully a version with the orchestrated OST becomes available too, would be nice having both options.

Quote from: ShadowOne333 on March 08, 2021, 04:09:55 PM
Not only that, but he brought up to my attention a tool by Wes67 which apparently allows for rebuilding the ISO without having to worry about the LBA table, as it seems that you can replace files just fine and the tool handles that. The tool in question is "RE1 Rebuilder" by Wes67, which can be found here:
https://www.tapatalk.com/groups/residentevil123/re1_rebuilder-t2390.html

Maybe with this tool I can make a build and be sure that the LBA is correct, and it's not a screw up on my part lol
There is a link to a file called cdtools, but seems to be dead. Do you happen to have a mirror?

SCD



SCD


caikelm

So a long time ago I found a hack for Resident Evil DC Dualshock that replaced the laughable remade soundtrack with the classic one

I believe there's probably a ton of hacks that do that but this specific one did something very very interesting

It replaced the composer's name in the credits with the actual composers of the classic soundtrack

Now that's a nice detail I don't think everybody pays attention to
And since I've been looking for this hack for years now without luck (I downloaded it but lost the files) I think it would be fantastic if you guys did it in this one too, having the correct credits for Masami Ueda and the rest of the gang for the classic soundtrack and maybe even keeping Takashi Niigaki if you made a version with the dualshock ost for those who for some reason prefer it

Please please please at least consider it
And thanks for the efforts! :)