Ridge Racer Type 4 reverse engineering help needed

GuillermoTell15

Member
Newcomer
Joined
Jan 26, 2018
Messages
8
Reaction score
0
Trophies
0
Age
32
XP
96
Country
Spain
Hi guys, I've trying to get into this game's filesystem but, unfortunately, looks like it does not use any common folder structure. Right now I'm stuck. Looks like the files are just attached somehow leaving some blank spaces sometimes (file offset somewhere?). No filenames. No compression for now.

By far, I think I've already located all cars except for the Pacman one. However, I've no idea of how they work internally, just managed to get some point clouds, no textures, no polygons. It uses the TIM format but only for the scenery, no idea how cars' textures work.

Also, with some work I think it may be possible to get the tracks, as I found some point clouds which ressemble them.

If someone is interested and has some knowledge about PSOne reverse engineering just comment below so we can continue working together. If no one is interested I'll just drop it.
 
Last edited by GuillermoTell15,
There are some PS1 games that use raw sector reads/LBA addresses to grab data. I had not heard of Ridge Racer using it (usually get it for music for Square (Enix) games) but I suppose I am not that plugged into the PS1 ROM hacking scene.
 
Ok, this is what I got:
The CD-ROM contains the following files:

Captura de pantalla 2020-10-16 132807.png


From what I found, the game assets are located in R4.BIN. Inside it there are car vertices, scenery TIM textures, track vertices, etc.

The file follows the following structure (after sector info cleaning):

Captura de pantalla 2020-10-16 133514.png


There is a header marked in red, it may stand for the file count. Then, there are a bunch of 4 byte sets marked in yellow. They look like addresses, as the value always increases. I was unable to understand their meaning. It looks like the filesystem starts at 0x1000.

On the other hand, the car sections look like this (I used Promessa as an example):

Captura de pantalla 2020-10-16 134123.png


The file starts with what looks like a fixed header of value 05 00 00 00 18 00 00 00 30 02 00 00 40 02 00 00, under the yellow bar. Marked in red there is the car name. By far I've found 640 coincidences, but there are 321 cars in the game so, 2 instances per car? and the Pacman car is missing. The file size doesn't look like is fixed. The textures may be inside, but they are not TIM for sure.

If someone is interested, I can continue explaining what I found about the cars' vertices. I'm not sure about sharing the game's files as it may go against the forum rules, more info would be appreciated.

Thanks.
 
Last edited by GuillermoTell15,
Ok, if someone wants to have a look inside a car file sample, here you have one. It's a raw binary rip from the game files.

I hope someone with more experience in game files than me can understand how the info is stored. The geometry's there, not sure about the textures, in case they're there, they aren't in TIM format.

Interesting things I found:
-The vertices start at 0x236C with a padding of 2, short signed, little endian. Looks like this case has 290 vertices.
-At 0x34E0 there are more vertices. These look like the lights. 32 of them? As above, padding 2, short signed and little endian.

Here is how they look in hex:

Captura de pantalla 2020-10-17 171327.png


And rendered:

Captura de pantalla 2020-10-17 171443.png


The car in game:

latest


Thanks.
 

Attachments

Last edited by GuillermoTell15,
Good news!
Thanks to the Nana tool I was able to get a lot of info.

First of all, I was right, the texture is inside the car file. No compression! :yay: Here you can see it:

Captura de pantalla 2020-10-18 030011.png


It's 256 bytes wide and 4 bpp, as you can see in the screenshot.

Also, I had a look inside the main file, R4.BIN, and found the lost Pacman car. For some reason, it's named Promessa in the game's files so, I had it located, but it wasn't properly identified.

What's left is:
-Locate CLUTs (no idea how these work!).
-Texture extraction (in progress).
-Locate faces.
-Locate texture mapping.
-Rebuild the whole 3D model.
-Something else I missed? :unsure:

If someone has experience in any of these fields and wants to help, I'd be very pleased.

Thanks!
 
Last edited by GuillermoTell15,
hey man, still there ?

this will read the fat and extract the blobs in r4.bin, there are 934 of them:

Code:
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            const string path = @"C:\Temp\R4.BIN";

            using var reader = new BinaryReader(File.OpenRead(path));

            reader.BaseStream.Position = 0;

            var count = reader.ReadInt32();

            var positions = new int[count + 1];

            for (var i = 0; i < positions.Length; i++)
            {
                positions[i] = reader.ReadInt32() * 2048;
            }

            for (var i = 0; i < positions.Length - 1; i++)
            {
                var position1 = positions[i];
                var position2 = positions[i + 1];
                var length = position2 - position1;

                reader.BaseStream.Position = position1;

                var bytes = reader.ReadBytes(length);

                File.WriteAllBytes($"{path}.{i:D5}", bytes);
            }
        }
    }
}

from what i've seen, a car is like this: 3d data, sounds, textures (blob 23 for instance)

use tim2view to detect where tim files are in a file

etc, etc, etc good luck,

:)
 
Last edited by aybe,
Hey, if you want to get into PS1 hacking, might I suggest contacting someone in the scene?

There's this guy in particular. He's doing a lot of Resident Evil stuff nowadays (including working on a restoration of Resident Evil 1.5 started by Team IGAS...at least, I think he's still working on it), but he's also done translation work for the PS1 version of Persona 2 Innocent Sin, Mizzurna Falls, and others! :)

https://mobile.twitter.com/REBehindtheMask
 

Site & Scene News

Popular threads in this forum