+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Porting modded textures from PC game to PSX game.
Pages: [1] 2 3
Author Topic: Porting modded textures from PC game to PSX game.  (Read 2064 times)
sb iq
Guest
« on: October 14, 2006, 04:05:23 am »

I used a program called TR2View (made by creaothceann) to view the raw data in the level files in Tomb Raider 2 for the PC (.TR2) and Tomb Raider 2 for the PSX (.PSX). The program views the raw data and 2 codecs can be chosen, 8-bit and 16-bit.

Tomb Raider 2 for the PC has 2 copies of textures: 1 copy in 8-bit, and one copy in 16-bit. Tomb Raider 2 for the PSX has only 1 copy of textures that are 8-bit.

I took snapshots of the program running with the 8-bit codec. The PC version is on the left and I am viewing the 8-bit textures, and the PSX version is on the right. Please copy and paste the URL into the browser. Geocities isn't very nice.

http://www.geocities.com/sbiq2/tr2view8.GIF

And in the next picture, I am running the program with the 16-bit codec. I am viewing the 8-bit textures of the PC version on the left, and the PSX version on the right.

http://www.geocities.com/sbiq2/tr2view16.GIF

As you can see, the colors and sizes do not match up. As for the size, I was told that the texture map for the PSX is actually smaller than the PC version, since the PSX has less RAM.

Let's say I wanted to port texture hacks for the PC version into the PSX version. The way I see it I have to:

1.) Rip the raw 8-bit textures from the modded levels of the PC version with a hex editor (easily done).

2.) Change the dimensions and make it smaller like the PSX version (possibly with Paint Shop Pro).

3.) Make the raw data that has been ripped and shrunk refer to the same palette the PSX textures refer to--or in other words--make the colors of my raw hex rip match the colors of the PSX textures in the image editor program (this is where I am stumped).

So how do I fix the color problem? I've been straining my brain trying to figure out how to fix this problem. I hear it is because the PC uses RGB, RGBA, ARGB, etc. while the PSX uses ABGR. Is this true? Can I fix this problem using Adobe Photoshop or Paint Shop Pro?
« Last Edit: October 14, 2006, 04:17:35 am by sb iq »
creaothceann
Guest
« Reply #1 on: October 14, 2006, 04:55:35 am »

Next time use high-color PNG or JPG files for your screenshots. Tongue Even better, just copy one window into PSP, double the picture width and paste the second window next to the first one.

Quote from: sb  iq on October 14, 2006, 04:05:23 am
Tomb Raider 2 for the PC has 2 copies of textures: 1 copy in 8-bit, and one copy in 16-bit. Tomb Raider 2 for the PSX has only 1 copy of textures that are 8-bit.

[...]

And in the next picture, I am running the program with the 16-bit codec. I am viewing the 8-bit textures of the PC version on the left, and the PSX version on the right.

http://www.geocities.com/sbiq2/tr2view16.GIF

Viewing the PSX version in 16-bit is nonsense. The first pic clearly shows that it's 8-bit.


Quote from: sb  iq on October 14, 2006, 04:05:23 am
As you can see, the colors and sizes do not match up. As for the size, I was told that the texture map for the PSX is actually smaller than the PC version, since the PSX has less RAM.

Let's say I wanted to port texture hacks for the PC version into the PSX version. The way I see it I have to:

1.) Rip the raw 8-bit textures from the modded levels of the PC version with a hex editor (easily done).

2.) Change the dimensions and make it smaller like the PSX version (possibly with Paint Shop Pro).

3.) Make the raw data that has been ripped and shrunk refer to the same palette the PSX textures refer to--or in other words--make the colors of my raw hex rip match the colors of the PSX textures in the image editor program (this is where I am stumped).

So how do I fix the color problem? I've been straining my brain trying to figure out how to fix this problem. I hear it is because the PC uses RGB, RGBA, ARGB, etc. while the PSX uses ABGR. Is this true? Can I fix this problem using Adobe Photoshop or Paint Shop Pro?

It may be possible that the PSX version uses 128x? texture maps, which would be why the graphics in a line are doubled.

Have you tried loading the palette files? Sad

You can load a palette in Paint Shop Pro and have the selected image adjust its palette indices. RGB, RGBA, ARGB etc. only applies to 16-bit images, or the palettes themselves (not the indices).

I'll change TR2View to use a 128x? viewing window...
« Last Edit: October 19, 2006, 05:32:13 pm by creaothceann »
creaothceann
Guest
« Reply #2 on: October 14, 2006, 06:34:19 am »

link
sb iq
Guest
« Reply #3 on: October 17, 2006, 07:54:27 pm »

It says the file was deleted. Sorry, I've been cramming for 3 exams this week and didn't get the chance to come online to download the file. Sad
« Last Edit: October 17, 2006, 07:59:42 pm by sb iq »
Aerdan
Guest
« Reply #4 on: October 17, 2006, 08:06:41 pm »

Therein lies the reason why you shouldn't use rapidshare.
creaothceann
Guest
« Reply #5 on: October 18, 2006, 02:35:50 am »

I'll upload it when I get home.
creaothceann
Guest
« Reply #6 on: October 18, 2006, 10:56:08 am »

link
sb iq
Guest
« Reply #7 on: October 19, 2006, 04:49:53 am »

Thanks for the programs creaothceann.

I got the sizes to "match" by loading my hex rip into PSP as a .raw file. I loaded it as a gray scaled image, specified the dimensions 256 x 2816 and set the header size to 8 bytes. I went to Image -> Resize and changed the dimensions to 128 x 2816 and when I saved it, I selected a header size of 8 bytes when I clicked the Options button in the Save As window.

On the left is my shrunken hex rip from the PC game which is now in .raw format. On the right is the PSX level file.



The PSX one is shifted a bit, but I think that is just an issue of where the textures are stored and its hex address. I don't think that should be a problem since I might be able to figure out the hex address of the the textures with Tile Molester (although I still do not know where the palettes are as usual). But then again I'm not entirely sure about this issue, either.

Fortunately, now the sizes do match up. The only glaring problem now is the colors. As you can see, the PSX version has a weird bluish-yellow scheme, and the textures I ripped from the PC game do not. It seems that is the only problem I am having now.

How do I fix it? Should I run my hex rip from the PC game through an MIPS assembler like LemASM?
« Last Edit: October 19, 2006, 05:07:49 pm by sb iq »
creaothceann
Guest
« Reply #8 on: October 19, 2006, 05:30:53 pm »

Quote from: sb  iq on October 19, 2006, 04:49:53 am
I got the sizes to "match" by loading my hex rip into PSP as a .raw file. I loaded it as a gray scaled image, specified the dimensions 256 x 2816 and set the header size to 8 bytes. I went to Image -> Resize and changed the dimensions to 128 x 2816 and when I saved it, I selected a header size of 8 bytes when I clicked the Options button in the Save As window.

Did you remove the "junk" before resizing the picture? Or if you know the offsets of the texture, just extract it, edit it and insert it again. Remember, PSP doesn't know about the file format.


Quote from: sb  iq on October 19, 2006, 04:49:53 am
On the left is my shrunken hex rip from the PC game which is now in .raw format. On the right is the PSX level file.

<img>http://i116.photobucket.com/albums/o17/sbiq/diffcolor.jpg</img>

The PSX one is shifted a bit, but I think that is just an issue of where the textures are stored and its hex address. I don't think that should be a problem since I might be able to figure out the hex address of the the textures with Tile Molester (although I still do not know where the palettes are as usual). But then again I'm not entirely sure about this issue, either.

As you've said you're still not applying the palettes. You should get them (if possible), otherwise I doubt the results will match your ideas. Can't you get the PSX ones via an emulator? The PC version's palettes are easy to get, as I explained in previous posts.


Quote from: sb  iq on October 19, 2006, 04:49:53 am
Fortunately, now the sizes do match up. The only glaring problem now is the colors. As you can see, the PSX version has a weird bluish-yellow scheme, and the textures I ripped from the PC game do not. It seems that is the only problem I am having now.

How do I fix it? Should I run my hex rip from the PC game through an MIPS assembler like LemASM?

Why should you? An assembler translates source code to executable code. It won't magically fix anything.

I think without the palettes there's not much hope to fix the color issue.
sb iq
Guest
« Reply #9 on: October 19, 2006, 07:24:38 pm »

Quote
Did you remove the "junk" before resizing the picture? Or if you know the offsets of the texture, just extract it, edit it and insert it again. Remember, PSP doesn't know about the file format.

I went to the hex address where the textures are found in the PC level (0x000704) and copied 720896 bytes (256 x 2816=720896) starting from that hex address and pasted it into a seperate raw file, and added .raw at the end. Then I loaded it up into PSP, adjusted a few settings, changed the dimensions, then saved it.

Quote
Can't you get the PSX ones via an emulator?

That's the thing, I don't know how. epsxe works best on my computer, so that is what I use.

I know palettes can be extracted from save states for emulators for the SNES, Genesis, etc., with Tile Molester, but I don't know how it can be done with a PSX game.

If I were to take my hex rip from the PC game that has been shrunk, and use a hex editor to replace the PSX textures with the one in my hex rip, when I play the game, won't everything in the level be the wrong color? If that is the case, then I need to take my hex rip that I took from the PC game, and somehow make it have the same "bluish-yellow" look like the PSX version.
« Last Edit: October 19, 2006, 07:48:15 pm by sb iq »
creaothceann
Guest
« Reply #10 on: October 20, 2006, 12:48:13 pm »

Quote from: sb  iq on October 19, 2006, 07:24:38 pm
If I were to take my hex rip from the PC game that has been shrunk, and use a hex editor to replace the PSX textures with the one in my hex rip, when I play the game, won't everything in the level be the wrong color?

Yep.

Quote from: sb  iq on October 19, 2006, 07:24:38 pm
... then I need to take my hex rip that I took from the PC game, and somehow make it have the same "bluish-yellow" look like the PSX version.

And for that you need the palette. (The "bluish-yellow" is because of the palette I used - completely unrelated to TR.)

It looks like you'll need someone (e.g. you?) who can follow the game's code when it loads the level, to understand where and how it gets its palette.
sb iq
Guest
« Reply #11 on: October 20, 2006, 06:00:23 pm »

How big should the palette in the PSX version be?

From what info I've read in beginner's text files, I need to run PCSXTrace and hit F11 when the level starts to begin tracing, then hit F11 to stop. Then I would need to load the trace.log that PCSXTrace made in a text program, and look for something in there that refers to the palette. Am I correct in this reasoning?

PCSXTrace won't run on my computer. It keeps saying "Could not load CDR Plugin" and 'Configuration not OK!" even though I am using the same plugins I use for epsxe. Is there any other PSX emulator with a trace and logging function that I can use?

And my biggest question is, in the event I do find the PSX palette, how would that fix the color problem with my raw hex rip from the PC game? How would I make my raw data I ripped from the PC game refer to the palette in the PSX game?

I just realized right now that I made a typo in my first post. I meant to say "...make the colors of my raw hex rip match the colors of the PSX textures in the image viewing program." I've decided on replacing the textures in the PSX game via a hex editor, not any image editing programs, since when I load up the PSX level in PSP as .raw, I get garbage. I haven't tried Photoshop yet because I do not have a copy.

Sorry for the miscommunication.

Also, I do not know what you mean when you say:

Quote
You can load a palette in Paint Shop Pro and have the selected image adjust its palette indices.

Because I load a .raw file and this is what I get in the window:



What exactly do I need to do to "load the palette using the indices"? I'm totally lost on that part.
« Last Edit: October 21, 2006, 04:35:27 am by sb iq »
creaothceann
Guest
« Reply #12 on: October 21, 2006, 04:33:52 am »

Quote from: sb  iq on October 20, 2006, 06:00:23 pm
How big should the palette in the PSX version be?

Dunno. 256 colors for sure, but each color could be encoded in a variety of ways. SNES uses "5550" (5 bits per color channel, 2 bytes, 16th bit unused); many DOS games used palette files of 768 bytes ("888", 1 byte per channel) and today's 32-bit video memory uses "8888" for speed reasons.

How many colors can the PS1 display at a given time? 16-bit? 15-bit? This might be a first hint.

Quote from: sb  iq on October 20, 2006, 06:00:23 pm
From what info I've read in beginner's text files, I need to run PCSXTrace and hit F11 when the level starts to begin tracing, then hit F11 to stop. Then I would need to load the trace.log that PCSXTrace made in a text program, and look for something in there that refers to the palette.

Am I correct in this reasoning? Also, I've had bad luck trying to run PCSXTrace on my computer in the past. Is there any other PSX emulator with a trace and logging function that I can use?

Sounds reasonable. I don't have any knowledge about the PSX scene or the games; can't help you there.


Quote from: sb  iq on October 20, 2006, 06:00:23 pm
And my biggest question is, in the event I do find the PSX palette, how would that fix the color problem with my raw hex rip from the PC game? How would I make my raw data I ripped from the PC game refer to the palette in the PSX game?

[...]

Also, I do not know what you mean when you say:

Quote
You can load a palette in Paint Shop Pro and have the selected image adjust its palette indices.

[...]

What exactly do I need to do to "load the palette using the indices"? I'm totally lost on that part.

Select "Colors|Load palette..." from the menu. In the palette loading window you can specify if you want the palette indices of the current picture to be modified ("Nearest color matching", "Error diffusion dithering") or not ("Maintain indexes").

For adjusting the indices to match the PSX graphics, you'd have to select the first or the second one. Your picture will then use the specified palette.
sb iq
Guest
« Reply #13 on: October 21, 2006, 04:52:15 am »

Oh, I see what to do now. Thanks for the explanation.
MegaManJuno
Guest
« Reply #14 on: October 21, 2006, 11:28:37 am »

Posting BMPs on the internet makes baby Jesus cry...  Cry
Pages: [1] 2 3  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC