+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  Decompressing graphics
Pages: 1 [2] 3
Author Topic: Decompressing graphics  (Read 1942 times)
RedComet
Guest
« Reply #15 on: October 01, 2007, 04:34:23 am »

Quote from: Panzer88 on September 30, 2007, 09:46:18 pm
I know a lot of people who find this stuff overwhelming at first but if you actually sit down and read the tutorials provided, they really break down the basic, and some of the advanced stuff so that just about anyone who is willing to learn can understand. They don't teach you everything overnight, you have to be willing to put in a little time and maybe learn some things on your own once you have a basic grasp of it.

Most of the authors of a lot of those tutorials are regulars here and I'm sure would be happy to help if they know that you've put in some effort, and also know that if they start talking in a more "technical" manner, that they aren't wasting their time because they know you know what they are talking about.

This post wasn't directed any ONE person.

This man has earned a  :cookie:. Hell, make that half a dozen cookies: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie: :cookie:
RyanfromScotland
Guest
« Reply #16 on: October 01, 2007, 05:08:26 am »

@Panzer88 - Yeah I know what you mean, you soon learn here that if you post a question where you haven't done any outside research then your going to get no where. Well, no where isn't technicly right, you'll get Google/Wikipedia/Documents Section/How To Ask Questions The Smart Way. I noticed there are still a good few active users that have contributed to the documentation, such as RedComent above (shameless name drop count = 1), what about The Fake God is he still on the scene at all?

I might give writting the guide I'm looking for a bash once I'm a bit more clued up on asm, guess it can't hurt to try.
Nightcrawler
Guest
« Reply #17 on: October 01, 2007, 09:20:06 am »

Quote from: RyanfromScotland on September 30, 2007, 06:21:50 pm
Quote from: Nightcrawler on September 21, 2007, 07:39:29 am

Why don't you give a few suggestions for these guides that don't exist that you'd like to see?

Sorry it's been so long before a reply, just started uni last week so been a bit preoccupied.

I'd like to see a nice "Introduction to Assembly" guide, a guide which walks you though making an amendment to a game at the assembly level, such as making Sonic jump higher or something to that effect. Don't get me wrong, I'm not looking for a "change this to this, this to this, this to this" sort of thing but rather "change this to this because this effects such and such as you can tell from this." Hope that makes sense.

You pretty much had the exact response I figured you'd have. Look at what you just wrote. You practically just asked 'How do I hack a game using assembly?' That's not much different from just 'How do I hack a game?'. Surely, you can understand why that question can't be answered. Or at least, nobody is willing to answer it.

First, assembly is different depending on the platform. If nothing else, it's different because the hardware is different between the platforms. When it comes to assembly, you've got to learn about the hardware (in some cases nothing more than where RAM and ROM are addressed, but hardware knowledge is still required to some degree) or you're not going to be able to do a lot with it anyway. There are already THOUSANDS of assembly tutorials all over the Internet. We even have a nice handful pertaining to ROM hacking here on the site.

Second, every game is different. How to change the height in one game may do absolutely nothing to help you do the exact same task or any other task n any other game. The only useful part of the exercise would be how to use a debugger and the ROM hacking CONCEPTS used to come up with the information.

No document is going to be able to teach you how to APPLY the assembly code knowledge into game logic for your case. That's just the way it is. You can only learn some of this stuff by doing it and asking questions. The only thing you can hope to learn from a document to assist on these levels are the concepts of how to use a debugger, and the concept of how to insert your own code in a game. Beyond that, it's up to you to put things together. It's up to you to figure out how to hack. This hobby requires self learning more than most. Reverse engineering assembly code into game logic is simply a developed skill.

What I'm getting at is there is a reason why these documents don't exist and probably never will. A specific document outlining how to change the height in sonic's jump just isn't going to be too useful outside of the task of changing the height in Sonic. Wink On a side note, go to our database. We already have fully disassembled commented code for Super Mario Brothers. That should explain far more in the direction you're hoping for anyway.

A document explaining the concepts on how you might do a hack like that would be better. Something removed from the specific lines of code. Everybody thinks if you hold their hand and tell them step by step how to change the jump height in Sonic, they will be able to do anything with Sonic. That's simply not true. You're too busy looking at the specific steps of this instance to learn the concept of what's being done. When I help people, I point them in right directions and explain concepts and make them fill in the blanks in between. No step by step. This way they learn the mechanics of how to do this and can go off on other tasks without needing to ask step by step for the next task that may be different. Sometimes it's a frustrating process, but it's the concepts that open the door to be successful at any task, not the specific line of code.

It challenges the student to make connections which is the key to learning and I am firm believer in teaching in this manner and have been very successful over the years.

Quote
Also a document describing how to relate information from savestates to the orignal ROM would be useful.

It sounds like what you really need is a document on how to use a debugger or additional information on the hardware. What do you suppose the relationship is between savestate and ROM data? Well, there's little if any other than teh fact the data was DERIVED form the ROM in some way. What is a savestate? It's just a snapshot of of the current contents of the CPU, RAM, VRAM etc. None of that data has to be contained in the ROM as it appears there. (Although often times some of that data was copied directly from the ROM as is). The key to relating the ROM to a savestate is finding out HOW the data got to where it is in the savestate.

That's related to the hardware and assembly. You'll use your debugger to backtrack on HOW values came to be in the savestate. You'll form the relationship by looking at the game code. No document is going to be able to tell you HOW to form that relationship, just how to use the debugger and give the hardware knowledge to know what registers or values you should be looking for.

Quote
There doesn't appear to be much on the topic of the Sega Master System either which is unfortunate but I guess that's just what I have to deal with since I'm a Sega fan and not a Nintendo fan :/ That may be the reason I've missed some of these guides if they do exist since so far I've been reading the Sega documention with the odd Nes/Snes file.

EDIT - -

"Parasyte gently introduces the FCEUd interface and ASM hacking techniques. Hackers will learn to modify the jump height of Samus in the original Metroid" maybe that's the sort of thing I'm looking for >_<. Really not sure how I missed the ASM stuff that is on here, guess it's been a busy few weeks with my mind on other things. Also it's a NES based document.

It doesn't matter if it's an NES based document. That's a common pitfall I've seen at least monthly for the past 10 years. I was even in it when I moved from NES to SNES. Then it became clear they are one in the same like all tile based cartridge systems. What's really different between NES and Sega Master System when it comes to ROMhacking? Nothing other than the difference in hardware. So, what does that mean? It means you need to get yourself a technical hardware document for it which we already have here and do the exact same thing you would do with the NES.

The only pitfall you may have is in available TOOLS. Otherwise, you do the exact same thing. You'll use your debugger, tile editor, hex editor etc the same ways to find and change the necessary data.

It's the exact same thing for all tile and cartridge based consoles with differences only in the hardware. The basic system design and the way you hack them are absolutely the same. Once you get to N64, Playstation and the CD and 3D era, things change a BIT, but are STILL conceptually almost the same. You just have some added concepts you'll need to know in order to deal with CD media and 3D graphics instead of tile based. Remix and repeat. If you get a solid grasp on the concepts, you can be successful hacking almost anything.

P.S. The hacking process is significantly harder without tools though. If you choose a system that doesn't have any available tools, you're in for a long haul. You can still use the same concepts, but if you can't see the game code run or use a debugger, it's much harder to arrive at definitive answers on where data comes from, how it is processed etc. Honestly, if I were going to hack a system without tools, I'd probably attempt to create my own rather than fumble through the painstaking process of having none.

It's like building a house without a hammer or saw. You can still do it with perseverance, but it's going to take much longer most likely and you'll have to come up with alternative ways to cut your boards and put them together.
RyanfromScotland
Guest
« Reply #18 on: October 01, 2007, 11:13:30 am »

Quote
You practically just asked 'How do I hack a game using assembly?' That's not much different from just 'How do I hack a game?'. Surely, you can understand why that question can't be answered. Or at least, nobody is willing to answer it.

I don't feel I asked anything at all, infact going by your recommendation and reading what I wrote I'm pretty sure you asked what guides I'd like to see and I answered. The fact that you pre-emted the reply only goes on to further prove that such guides would be useful. Even if I did ask 'How do I hack a game using assembly?' - it's a fundumental question and I see no problems in asking that. Sure the answer wouldn't be as simple and clear cut as the question but an answer to that question would still yield a wealth of information on the topic that I bet anyone trying to get a start on assembly hacking would find invaluable. You could even call the guide 'How to hack a game using assembly.'

Quote
First, assembly is different depending on the platform. Second, every game is different.

Well I'll admit I didn't realise assembly was platform dependant I thought the language was the language and that was that although the mountains of different disassemblers did make me have doubts. I am trying to avoid saying 'of course' because really I'm a beginner and 'of course' sort of implies that I feel you should already know the level of knowledge I have but I really can't think of another phrase to use so, of course every game is different! And I don't mean Sonic compared to R-Type different I mean the routine to make Sonic jump in Sonic 1 compared to the routine to make Sonic jump in Sonic 2 different. I understand that a guide showing you how one works (almost deffinatly) won't show you how it works on another. But if that guide took you through the process of finding the relivant code and manipulating it I'm sure the principals could be applied to other games. <~~ This may be what your refering to by CONCEPTS.

Quote
We already have fully disassembled commented code for Super Mario Brothers. That should explain far more in the direction you're hoping for anyway

This sounds like a useful document which I haven't came across yet, I'll have a read once I'm finished this reply. Although your reply seems to be trying to tell me that such a document is useless since the assembly in SMB is only relative to SMB!

Quote
Everybody thinks if you hold their hand and tell them step by step how to change the jump height in Sonic, they will be able to do anything with Sonic.

Well then everybody is going to be pretty disappointed.

Quote
It sounds like what you really need is a document on how to use a debugger

Your right there Smiley I understand what debuggering is but only from programming ages ago. I wasn't sure if there was any relationship between savestates and roms but thought I'd put it out there and see what kinda response I got.

I may have portrayed myself in a bad light asking for some of these things and I'm sure I'm coming across more n00ber/lazy than I really am (except for my Simple GUI topic that really was me not wanting to learn VB) but don't get me wrong, I'm not looking for quick fixes, I just think some parts of the rom hacking world could be more 'user friendly.'
Nightcrawler
Guest
« Reply #19 on: October 01, 2007, 12:02:55 pm »

I can certainly understand where you're coming from. I hope you didn't take any offense to my previous post. I'm not criticizing you for asking the question. I only wanted to exemplify the point as to why some proposed missing documents have never been created. You, and many others at a a similar skill point, ask for these documents, but they can't really be created, or if they are, are of limited value as opposed to other documents aimed at other tasks or lower levels. Just trying to explain why nobody really makes them.

Don't get me wrong. I'm not saying no more documents are needed. Not by a long shot. Sure, some more documents should be created on the subject. However, I feel they need to be concept oriented and not of the specific variety which seems to be the type you, and others, perceive to be what you need. I do think more documents should be created, just removed from specific lines of code for a specific platform and a specific game. Perhaps some pseudo code or perhaps a task with examples of how it can be done on several platforms. Or just forget about all that and explain it on a high conceptual level instead, leaving it to the user to be applied to their specific task. Which while that seems like it might not be that effective, my practice has found it indeed seems to be.

Of course, documents of this nature aimed at a higher skill level are quite an undertaking. I've had the want to do some for a long while, I just haven't been willing to put in the time yet. I'm sure some others feel the same. It's probably a bigger undertaking than writing up another how to make tables or how to use a tile editor type document.

You're also correct in your understanding. The SMB assembly code is limited in it's usefulness. While it certainly does have educational value and may help one make some connection between assembly and game code logic and help solidify assembly knowledge itself, it is indeed going to be of limited help help in other projects. Mileage will of course vary on the individual. Maybe you will pick up some things to assist in other projects, but I'd bet most for that would come from the mechanics of tinkering with the ROM based on that document rather than the information it contains directly.

And yes, people would indeed be disappointed when changing the jump height in Sonic, and then trying to change the jump height in Sonic 2 or for mario, that they can't if they didn't pick up on the concepts and just focused on the code which is typical. Not everybody is typical mind you, but generally speaking.

I'm afraid the ROM hacking world probably will not get much more user friendly. It's a very individualized self learned hobby as has been said. ROMhacking.net attempts to help the user friendliness come through, but it's effectiveness is still limited. But really, if you spend the time to really go over many of the documents available here and the Getting Started section(if you're a complete newbie), and have DONE some tinkering with ROMs as you go through them, you'll more than likely have achieved the skills you need to succeed. Many people READ a document, but they never actually DO anything with a ROM. It's just a class with textbook only learning. If you never get any hands on, it's going to be much more difficult for you. You may think you understand the document completely, but you've got to try it out and see. Hands on is necessary in ROM hacking.

I'll tell you what is, in my opinion, the quickest way to advance through the more advanced levels of ROMhacking and get the help and information you need. It's a simple formula:

1. Read all that you can.
2. Give it a try. Try and DO something with your ROM.
3. If you hit a wall, ask a question either on the forum in private to another hacker you know. Ask a smart, specific question, showing what you've tried to do, and what isn't working right.

You're very likely to get an answer to help you. Rinse and repeat. You'll get to the head of the class in no time. People around here are much willing to help if you've demonstrated you've tried to help yourself. Your peers can provide some quick missing links that can really go a long way and can be more effective than any document.

Many people that come through here just don't bother trying to help themselves enough and blame the system or lack of documents. They're the people that are either ignored here or in some cases ridiculed.


I'm not really aiming those last few paragraphs at you personally. They're just some observations.
RyanfromScotland
Guest
« Reply #20 on: October 01, 2007, 02:45:54 pm »

Hey not a big reply here, safe to say I'm not offended at all and never will be at something some-one says over the internet but your post didn't come across offensive at all anyways.

I have thousands of questions but don't plan on asking any of them yet since I'm sure the answers aren't far away.

Right now I'm playing with UCon64 but I'll be soon jumping back to find good Megadrive debugging tools and practices. Aim is to add some text into the space I've created with UCon64 and get the pointers to jump to it and back rather than the original text. Not revolutionary I know but it's a start.

A quick question before I leave this topic which really should be dead and burried. I'm getting errors when I disassemble Dr.Robotnic and google-ing only returns advice on beating HIV and DNA repair (does that come into ASM cause then I think I may really be out my league.) Same thing happens with Toejam and Earl so it's not game specific. Using 68KD for my disassembling.

Extract from Toejam:

0x00000000: 0x00FF                              UNRECOGNIZED <----Error on the first line?
0x00000002: 0x8000                              OR.B     D0,D0
0x00000004: 0x0000 0x0202                       ORI.B    #0x2,D0
0x00000008: 0x0000 0x0200                       ORI.B    #0x0,D0
0x0000000C: 0x0000 0x0200                       ORI.B    #0x0,D0
0x00000010: 0x0000 0x0200                       ORI.B    #0x0,D0
Here's some a little later on:
0x00000100: 0x5345                              SUBQ.W   #1,D5
0x00000102: 0x4741                              UNRECOGNIZED
0x00000104: 0x2047                              MOVEA.L  D7,A0
0x00000106: 0x454E                              UNRECOGNIZED
0x00000108: 0x4553                              UNRECOGNIZED
0x0000010A: 0x4953                              UNRECOGNIZED
0x0000010C: 0x2020                              MOVE.L   -(A0),D0
0x0000010E: 0x2020                              MOVE.L   -(A0),D0
0x00000110: 0x2843                              MOVEA.L  D3,A4

And from Dr.R:

0x00000000: 0x00FF                              UNRECOGNIZED <----Again first line errors
0x00000002: 0xFC00                              UNRECOGNIZED
0x00000004: 0x0000 0x0200                       ORI.B    #0x0,D0
0x00000008: 0x0000 0x0546                       ORI.B    #0x46,D0

I may find this out shortly since I'm reading through the site and I imagin I'm not the only person ever to have had this problem.
« Last Edit: October 01, 2007, 05:34:38 pm by RyanfromScotland »
KingMike
Guest
« Reply #21 on: October 01, 2007, 07:35:21 pm »

If I remember, the first 0x200 or so bytes in a Genesis ROM are header data (I know $100-1FF is the cartridge header).
As data is not code, the results will be junk.
I've found doing a full-ROM disassembly is fairly useless, as disassmblers can't tell data and code.
It's better to use a tracer to find where the code you're interested in is in the ROM, and then disassemble just a portion of the ROM.
RyanfromScotland
Guest
« Reply #22 on: October 02, 2007, 12:35:52 pm »

Quote from: KingMike on October 01, 2007, 07:35:21 pm
If I remember, the first 0x200 or so bytes in a Genesis ROM are header data (I know $100-1FF is the cartridge header).
As data is not code, the results will be junk.
I've found doing a full-ROM disassembly is fairly useless, as disassmblers can't tell data and code.
It's better to use a tracer to find where the code you're interested in is in the ROM, and then disassemble just a portion of the ROM.

Ah right, I thought that the code controlled everything on the ROM and that the first few lines was always code dedicated to setting the header. So would a rom map look something along the lines of:

00000000:00000200 - Header
00000201:00080000 - Code
00080001:00090000 - Graphical Data
00090001:000FFFFF  - Sound Data
RedComet
Guest
« Reply #23 on: October 02, 2007, 12:40:17 pm »

Quote from: RyanfromScotland on October 02, 2007, 12:35:52 pm
Quote from: KingMike on October 01, 2007, 07:35:21 pm
If I remember, the first 0x200 or so bytes in a Genesis ROM are header data (I know $100-1FF is the cartridge header).
As data is not code, the results will be junk.
I've found doing a full-ROM disassembly is fairly useless, as disassmblers can't tell data and code.
It's better to use a tracer to find where the code you're interested in is in the ROM, and then disassemble just a portion of the ROM.

Ah right, I thought that the code controlled everything on the ROM and that the first few lines was always code dedicated to setting the header. So would a rom map look something along the lines of:

00000000:00000200 - Header
00000201:00080000 - Code
00080001:00090000 - Graphical Data
00090001:000FFFFF  - Sound Data

Data and code are usually not separated into nice little homogeneous chunks. More often than not you find a block a code, a little data (could be graphics, could be sound), more code, etc. The header is usually something console specific that contains release information and the like. Most of the time it's nothing to terribly important, but always check the appropriate documentation to know for certain.
creaothceann
Guest
« Reply #24 on: October 02, 2007, 02:52:53 pm »

Quote from: RyanfromScotland on October 02, 2007, 12:35:52 pm
Ah right, I thought that the code controlled everything on the ROM and that the first few lines was always code dedicated to setting the header. So would a rom map look something along the lines of:

00000000:00000200 - Header
00000201:00080000 - Code
00080001:00090000 - Graphical Data
00090001:000FFFFF  - Sound Data

More like this, right?

00000000:000001FF - Header
00000200:0007FFFF - Code
00080000:0008FFFF - Graphical Data
00090000:000FFFFF - Sound Data
RyanfromScotland
Guest
« Reply #25 on: October 02, 2007, 07:53:50 pm »

Quote from: RedComet on October 02, 2007, 12:40:17 pm
Data and code are usually not separated into nice little homogeneous chunks. More often than not you find a block a code, a little data (could be graphics, could be sound), more code, etc. The header is usually something console specific that contains release information and the like. Most of the time it's nothing to terribly important, but always check the appropriate documentation to know for certain.

Hmm well that's annoying. Any idea as to why that is? I would have thought that once the programmer(s) finished writing the code it would be compiled and everything put on the rom in a certain, predetermind space. That way the author would know roughly where to make references to for graphics and so forth and could change any errors near completion. It seems rather nonsensical to have graphics (or others) stored half way through code.

@creaothceann - Are you actually asking that or just being pedantic? I ask because sometimes it is hard to tell though written word the tone of a sentance. To me that looks like your trying to knock an obviously inaccurate and 100% made up example but I may be misinterpreting your post. The fact that your post comes over 1 hour after RedComet's clear explanation that "Data and code are usually not separated into nice little homogeneous chunks" and yet yours still is only leads me further to belive that you are some how trying to correct my blatantly off-the-top-of-my-head example. Or maybe your trying to help me understand that it is more likely that a section of code would end at XXXXXXFF rather than XXXXXX00 since FF is the highest value allowed in such circumstance and would therefore more likely symbolise the end of a section with 00 being a new begining. If this is the case I suggest a bit more explanation than "More like this, right?" Of course if you are genuinely asking if that is right then you can probably disregard most of what you just read and I apologise for all the assumptions I just made of you.
Spikeman
Guest
« Reply #26 on: October 02, 2007, 10:06:42 pm »

Quote from: RyanfromScotland on October 02, 2007, 07:53:50 pm
Quote from: RedComet on October 02, 2007, 12:40:17 pm
Data and code are usually not separated into nice little homogeneous chunks. More often than not you find a block a code, a little data (could be graphics, could be sound), more code, etc. The header is usually something console specific that contains release information and the like. Most of the time it's nothing to terribly important, but always check the appropriate documentation to know for certain.

Hmm well that's annoying. Any idea as to why that is?

Addressing of instructions is fairly limited on most consoles so it's much faster and smaller code-wise to access data close to the code.
Tauwasser
Guest
« Reply #27 on: October 03, 2007, 03:39:06 am »

Yep, creaothceann tried to tell you that "nice little chunks" would work out more like XX00 to XXFF because that's how banking works in original roms Smiley There are, as Spikeman said, addressing boundaries for certain instructions as well as mappers.
So in gameboy (top off my head example...) only 16k banks can be addressed additionally to the first 16k of the rom which can be used at all times. So data is not going to spill into another bank like in your example.
Of course, there are games that let you spill data deliberately over some rom banks (to save rom space; Devil Children gbc games, anyone?).

And that's pretty much all he tried to point out Smiley
[Oh yeah, banking varies between platforms - be aware of that!]

cYa,

Tauwasser
creaothceann
Guest
« Reply #28 on: October 03, 2007, 03:54:23 am »

Quote from: RyanfromScotland on October 02, 2007, 07:53:50 pm
@creaothceann - Are you actually asking that or just being pedantic?

What Tauwasser said. Even for made-up examples, the boundaries looked a bit wrong.

Beware the "off by 1" errors. Wink
RyanfromScotland
Guest
« Reply #29 on: October 03, 2007, 07:54:48 am »

Cool cool. It's probably best to get in the practice of keeping examples like above more accurate anyway just to reinforce the ideas in my head.
 
I quite like to keep topics on topic and I'm surprised no-ones mentioned how far off from Decompressing Grapics we are now so I am going to stop putting questions in this thread (unless of course someone posts something I have to reply to.)

Thanks for the help again I feel I've learnt quite a bit from the last few post.  :thumbsup:
Pages: 1 [2] 3  


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