News: 11 March 2016 - Forum Rules

Author Topic: .  (Read 5356 times)

creeperton

  • Hero Member
  • *****
  • Posts: 604
    • View Profile
.
« on: April 04, 2013, 11:26:57 pm »
.
« Last Edit: November 16, 2015, 01:27:30 am by creeperton »

PhOeNiX

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: PSX VRAM
« Reply #1 on: April 05, 2013, 06:31:48 pm »
PSX VRAM is a 1MB 1024x512 raw image at BGR555 (16 bit). You can just dump the VRAM with pSX and then view it with psxvram by agemo or tile molester. The right-hand side of the VRAM is used to store textures to be loaded in the screen buffer on the left. Such textures can be either in 4bpp or 8bbp format, so you should change encoding for a correct visualization. At the bottom left side you can see the palettes of every 4bpp/8bpp texture stored on the right side. Such palettes are in BGR555 format too.

To get the offset of a particular coordinate in VRAM, let's say x,y, it is just y*2048 +x*2 (2 bytes per pixel, 1024 pixels per row). Note that PSX does not store images by tiles.

creeperton

  • Hero Member
  • *****
  • Posts: 604
    • View Profile
.
« Reply #2 on: April 06, 2013, 12:43:03 am »
.
« Last Edit: November 16, 2015, 01:27:25 am by creeperton »

PhOeNiX

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: PSX VRAM
« Reply #3 on: April 06, 2013, 04:15:12 am »
If they are not compressed, it is simply a matter of copying a portion of hex bytes of your texture (either 4bpp or 8bpp) from VRAM and serching for it over the whole ISO. Let's say you fnd a match at offset
0xA456FE5 of your ISO. Since a PSX ISO is segmented in sectors of 2352 bytes in size, simply convert 0xA456FE5 in decimal and divide by 2352 -> 172322789 / 2352 = 73266: this is the LBA (logical block address) in which a part of one and only one file of your iso is stored. In other words, open up your iso with cdmage and search for a file whose starting LBA is less or equal to 73266 and its ending LBA is greater or equal to 73266. This is the file you are searching for.

Vehek

  • Full Member
  • ***
  • Posts: 215
    • View Profile
Re: PSX VRAM
« Reply #4 on: April 06, 2013, 04:55:08 am »
Note that since Playstation VRAM is stored in rows, each row's pixels will be far apart from the previous row (the 2048 byte-distance mentioned above). So just grabbing a giant chunk of data starting from the desired offset won't work; it'll have the pixels of the same row from other images mixed in. If you want to search for multiple rows of a single image, you need to gather the rows of the particular image individually. (That was probably poorly worded.)

PhOeNiX

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: PSX VRAM
« Reply #5 on: April 06, 2013, 06:30:10 am »
For his needings, i think copying only a bunch of hex values of any row would suffice.

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: PSX VRAM
« Reply #6 on: April 06, 2013, 08:27:06 am »
Copying a scanline (or part of it) is not exactly the best method for locating the source image. The bit blit DMA gives access to quite a wide range of possible scanline widths, especially if the transfer was optimized in order to take advantage of packet size and combines (or subdivides) multiple pictures. Best solution I can think: locate LoadImage and trace where the data is coming from in RAM, then perform a search.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.

PhOeNiX

  • Jr. Member
  • **
  • Posts: 98
    • View Profile
Re: PSX VRAM
« Reply #7 on: April 06, 2013, 10:37:22 am »
Quote
How could this be done, for people who don't know MIPS?

Gemini

  • Hero Member
  • *****
  • Posts: 2026
  • 時を越えよう、そして彼女の元に戻ろう
    • View Profile
    • Apple of Eden
Re: PSX VRAM
« Reply #8 on: April 06, 2013, 11:46:42 am »
You don't need to know MIPS for understanding hex values.
I am the lord, you all know my name, now. I got it all: cash, money, and fame.