News: 11 March 2016 - Forum Rules

Author Topic: VRAM question...  (Read 2779 times)

falchion22

  • Jr. Member
  • **
  • Posts: 29
  • Shoryuken!!
    • View Profile
VRAM question...
« on: July 29, 2016, 08:34:54 pm »
So I am currently using the emulator vsnes to find vram offsets for certain sprites. So first I take a savestate of a rom and open it with vsnes. I then open the viewer and locate theSprite I am looking for. Now once I find the offset, I open up the built in hex editor and input the vram offset. Once I have found it, I edit the hex and I get the results I wanted. However, they are not permanant.

So my question is how can I use vsnes to locate offsets in a Hex editor such as HxD?

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7203
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: VRAM question...
« Reply #1 on: July 29, 2016, 08:38:36 pm »
If you can't find the graphics in the ROM then it's probably compressed. You would need ASM skills to trace backwards to figure out the compression.

No, there's not a tool for that. SNES games used per-game compression, often variants of LZSS. But there was no "standard" compression like GBA and DS have (from what I've heard).
"My watch says 30 chickens" Google, 2018

Nightcrawler

  • Hero Member
  • *****
  • Posts: 5792
    • View Profile
    • Nightcrawler's Translation Corporation
Re: VRAM question...
« Reply #2 on: July 30, 2016, 10:57:30 am »
You've found the location of the graphics in VRAM. There is no direct correlation to where those graphics came from in the ROM. All graphics are loaded into VRAM through the VRAM registers $2118/9. These registers could be written to via DMA (most likely), or manual copy routines. The source data may not have even come from the ROM at all if the data was decompressed or buffered. In those cases, they would have come from RAM (and you'd have game code you would need to reverse engineer).

In summary, if you can't find the graphics in the ROM by looking in a tile editor, you're going to have to spend much time learning about the hardware registers on the SNES, and how to use a debugger to back trace how the data you're interested in got there. That's well beyond what I can explain to you in this post. It's simply not quick and easy.
TransCorp - Over 20 years of community dedication.
Dual Orb 2, Wozz, Emerald Dragon, Tenshi No Uta, Glory of Heracles IV SFC/SNES Translations

falchion22

  • Jr. Member
  • **
  • Posts: 29
  • Shoryuken!!
    • View Profile
Re: VRAM question...
« Reply #3 on: July 31, 2016, 08:57:37 pm »
Thank you KingMike and Nightcrawler for your advice. It is much appreciated.

yugisokubodai

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Assembly
Re: VRAM question...
« Reply #4 on: August 14, 2016, 08:31:14 am »
Try to learn Snes asm and its hardware registers will help alot. I my self was a novice when I first stepped into rom hacking field, but after several years with learning, now I can solve almost game problems that I couldn't before. Just to encourage you.

For your question, try to use Geiger's Snes9X debugger. Then identify the graphic in question is which BG layer by pressing key 1, 2, 3,... The "what's used" button lets you know the BG's tileset, tilemap. Then press "Show Hex" --> Vram and jump to the address shown in "What's used".
You better read the game log and search for some keyword combos: $2116, $2118, $420B,...
From these information, you can search backward to get to the data you want.

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 7203
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: VRAM question...
« Reply #5 on: August 15, 2016, 12:41:27 am »
$2116 is an important register (it is the VRAM address register). However, note that it addresses in WORDS, unlike all other addresses which are in BYTES. So you will want to search for a value written to $2116 which is HALF of the desired address.
(or maybe the value will always be half because I hear the SNES physically stores its VRAM on two chips)
"My watch says 30 chickens" Google, 2018

falchion22

  • Jr. Member
  • **
  • Posts: 29
  • Shoryuken!!
    • View Profile
Re: VRAM question...
« Reply #6 on: August 15, 2016, 07:06:03 pm »
For your question, try to use Geiger's Snes9X debugger. Then identify the graphic in question is which BG layer by pressing key 1, 2, 3,... The "what's used" button lets you know the BG's tileset, tilemap. Then press "Show Hex" --> Vram and jump to the address shown in "What's used".
You better read the game log and search for some keyword combos: $2116, $2118, $420B,...
From these information, you can search backward to get to the data you want.

Ok, I will give it a shot. Thank you.