Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,483,579
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-25-24 10:05 PM
Guest: Register | Login

0 users currently in ROM Hacking | 2 guests | 1 bot

Main - ROM Hacking - Donkey Kong Country 3 Player Character Editing New thread | New reply


Jonesy47
Posted on 09-01-14 12:12 AM Link | Quote | ID: 158041


Micro-Goomba
Level: 8

Posts: 1/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Ok, so I've been asking around on a bunch of romhacking forums and decided that, after lurking for a while, to present the question here also considering I havent recieved much of a response. My idea is to simply replace the Kiddy Kong sprite with Donkey Kong's sprites.

The one response I got (on dkcatlas) told me I would need to do this manually with a hex editor, lots of pointer calculation, and intermediate asm knowledge. This is actually very helpful but at the same time, not helpful. It's like someone asking what a book means and someone answering "learn how to read". The answer is just too broad and nonspecific for me to know where to start.

I know how to use hex editors, have hacked a few nes games and I'm not quite ready to jump full on into asm yet but, what would be a good place to start with pointer calculation? I know what pointers are but how do I use this information to my benefit? Could anyone recommend a good tutorial or learning aid on this one that would help me with editing the graphics in DKC3? oh, and thanks for even reading this!

ShaneM
Posted on 09-01-14 04:00 AM (rev. 10 of 09-01-14 04:26 AM) Link | Quote | ID: 158050


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 113/285
EXP: 293455
Next: 14655

Since: 02-17-14

Last post: 3136 days
Last view: 2652 days
Posted by Jonesy47
My idea is to simply replace the Kiddy Kong sprite with Donkey Kong's sprites.


I know that Simion32 is the one making the DKC1 editor.

*Sits back in chair and thinks for a minute before speaking*...

This is how this is going to go down. All you want to do is replace Kiddy Kong with DK? Here is your issue: All the sprites are compressed. (Even the level data to ALL levels are compressed.) Not only that, but the sprites are buffered as OAM within VRAM. This is near impossible to do without:

1) 65C816 ASM knowledge. Because it requires tracing code down to the compression routine, finding out what it's doing and how the sprites are being compressed. SNES9X is the best SNES debugger that I know of.

2) This game is not very popular within the romhacking community. What that means is that you have very limited resources (Datacrystal and Kingizor's very basic level editor). So either you would need to wait for it to become more popular and to have more tools at your disposal or learn ASM and create a tool in a more modern language yourself.

3) We have no known disassembly of this game. We don't know what bank the compressed sprites are in nor do we have any idea how the compression routines works. Whoever said a bunch of pointers involved has absolutely no idea what they're talking about. What you need to do is find the compression routine. (An OAM table or VRAM viewer within the debugger comes in handy here for tracing writes.) Without a labeled, or even partially labeled disassembly, this is a very tedious task.

4) How do you know there is even enough free space in the bank if code needs to be added (if the OAM sprites are more and even heavier hardcoded)?


Sorry if it rains on your parade, but you asked an honest hack question and I'm just being real with you. Now, I know 6502 ASM (NES) pretty well and I can tell you that looking at some Mario games like Super Mario Allstars that are programmed in 65C16 ASM (SNES) is very similar. What I can do is link you to some documents that help newbies out with SNES ASM. I've already mentioned the lack of tools, so this is your best bet. http://en.wikibooks.org/wiki/Super_NES_Programming That site has enough resources for someone to learn to make a homebrew themselves. The issue is are you willing to take the time to learn; do you want this hack bad enough? I found this by doing a 1 minute Google search. So now that I gave you info and the programming language of the SNES, find a good simulator and try stuff. The rest is up to you. Ask for help-related programming questions if you get stuck. Good luck.

EDIT: I think by pointer calculation they meant either absolute addressing or high low pointer addresses. I highly doubt the compression routine would have a checksum of some sort. These change depending on where the code/data in question is located. So there is nothing really to "calculate" unless you already know where the code is (in this case, you don't).

____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Jonesy47
Posted on 09-01-14 05:18 AM (rev. 3 of 09-01-14 05:23 AM) Link | Quote | ID: 158053


Micro-Goomba
Level: 8

Posts: 2/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
No rain here. I was completely prepared for this sort of response. In fact, I'm glad you outlined it like you have. It gives me what I was hoping, ie, a good place to start.

Concerning this:
Posted by shanem
EDIT: I think by pointer calculation they meant either absolute addressing or high low pointer addresses. I highly doubt the compression routine would have a checksum of some sort. These change depending on where the code/data in question is located. So there is nothing really to "calculate" unless you already know where the code is (in this case, you don't).


The advice I got was this, from Mattrizzle at dkc atlas (seemingly the only guy attempting high level hacking on the Donkey Kong Country Games):

"There are no relevant utilities for the Donkey Kong Country games, so you'll have to resort to hex editing. Lots of pointer calculation is needed, as well as an intermediate knowledge of 65c816 assembly.

***Insert elaboration here***"

I know, I would assume there would be nothing as simple as pointer calcuation involved in hacking Donkey Kong Country games but the man has also been able to do quite a bit of magic with, I assume, the same methods.

Look at this work:





He had to add a lot of code for hit boxes and what not (since dixie is such a different size) but I assume I wouldn't have to add QUITE as much (still maybe/probably still a fair amount).

Anyways, so i should get to reading up on snes programming.

Also, as far as finding pointers, can I do that through corruption or is it something much more complicated in this case? If so, I would also be interested in what that process may be known as.

I am super willing to learn and put in a lot of time to figure this type of thing out, I just never know where to start and it almost seems like I'm going in circles, romhacking wise. I dont know what I'm doing so I jump into hexediting tutorials (the beginning) and I never get to that "next level". Thank you for the suggestions and if you ever have any other suggestions that you maybe think of later, feel free to continue adding possible things a begginner (me) would need to learn first before getting to coding asm. I assume coding asm is kind of the last, most complicated thing I can do, hackwise.
probably wrong there, too...oh well, Thanks for the response, shanem!

ShaneM
Posted on 09-01-14 05:52 AM (rev. 9 of 09-01-14 06:07 AM) Link | Quote | ID: 158054


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 114/285
EXP: 293455
Next: 14655

Since: 02-17-14

Last post: 3136 days
Last view: 2652 days
If you come from a programming background with a more modern language like Python or C++, learning ASM isn't that bad. If you don't have any previous knowledge then ASM may take longer. I can tell you that there really isn't much to learn about hexadecimal editing. other than $xxxx or 0x means offset. Really, every hex editor is different but with similar functions. Some more than others. What you could do is pick a hex editor, learn its functions (such as "inserting" "find/find all" "highlight" etc.). What you really need to do and what's most helpful is learning ASM. Really. This is your only bet at getting this done. You can do ASM through hex editing. For example, say you want to change code within a hex editor. So... let's say (NES code here as I know only NES and GB ASM) we want to change LDA #$05 STA $7292 to JSR $B0F0 and this is all at 0x4667... So, at that address we'd have $A9 $05 $8D $92 $72 we change that to $20 $F0 $B0 $EA $EA. This is doing ASM coding within a hex editor.

Let me explain the above: A9 is the opcode for LDA, 05 is the immediate value we loaded into the accumulator, 8D is the STA absolute address mnemonic( 8d 7292; always 3 bytes). Notice that I put the numbers in backwards. In RAM everything is big endian and it is stored in ROM as little endian. That is how absolute addressing works within the NES and GB (and I'm sure SNES). We changed the code to a jump to subroutine, so what we did was do $20 (the mnemonic for JSR), and the absolute address B0F0 (again, I put it as little endian because hex editing is ROM). I put 2 EAs there next because those represent NOP, or no operation. We add those if you want to cancel something out. otherwise the game would crash/"act weird" if we left the remnants of the old code, there. This is how to change code within a hex editor. You need to learn ASM to be able to actually trace code and then you can edit it within a hex editor. That's all there really is to know about that.

Now, to not overwhelm yourself, learn slowly. If you don't have a background in programming, go at a snails pace. Take what I just said, reread it until it makes sense and understand. Find the registers used within SNES ASM. (In NES we have A, X, Y and Memory.) Try to find a simulator where you can makeup routines and see if it works (it should say if it does if it's a good simulator). Learn a few mnemonics first to make a routine (mnemonics are the written form of opcodes; so, for example mnemonic=LDA (#$) opcode=A9 (immediate value). You'll find things like loading a zero page, absolute, immediate and x and y values with A. But learn that later on. I'm just mentioning it here so you don't think LDA is always immediate. For NES ASM when I now started out, I used Skilldricks page. If you want, google "skilldrick 6502 ASM" and it should come up. Hope this was helpful.

EDIT: I want you to see what the code was doing, here. Before, it was loading 05 into address (RAM) $7292. But now we made it jump to a subroutine at $B0F0. (Whenever the sub is done it ends with either a JMP or RTS, depending on what it's doing. Branching is always conditional [local or cannot be greater than $FF from memory; whether branching forwards or backwards] while a JMP [jump] is always unconditional. An RTS will always return to the mnemonic after the JSR code was called.)

____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Jonesy47
Posted on 09-01-14 07:10 AM (rev. 2 of 09-01-14 07:15 AM) Link | Quote | ID: 158057


Micro-Goomba
Level: 8

Posts: 3/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Thank you, dude! You've given me a good amount to chew on! I will post my progress (if I ever make any) as it occurs but yeah, this is a great starting point! This is very, VERY helpful! I...now venture forth on a journey for knowledge, god help me...

edit: Im probably gonna sound dumb here...but what's a simulator? Im trying google and its not popping up with anything...

ShaneM
Posted on 09-01-14 07:46 AM (rev. 3 of 09-01-14 07:49 AM) Link | Quote | ID: 158058


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 115/285
EXP: 293455
Next: 14655

Since: 02-17-14

Last post: 3136 days
Last view: 2652 days
Well, a simulator is something that you use to test custom code that you've made. Once you learn some more mnemonics (like the LDA) you can create some routines in them and test to see if they work. Here are some 6502 simulators (NES), for example: http://www.6502.org/tools/emu/ (Scroll down to "Desktop-based 6502 Emulation and Simulators".)

____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Jonesy47
Posted on 09-01-14 07:53 AM Link | Quote | ID: 158059


Micro-Goomba
Level: 8

Posts: 4/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Awesome. Thanks again!

ShaneM
Posted on 09-01-14 08:12 PM (rev. 2 of 09-01-14 08:12 PM) Link | Quote | ID: 158068


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 116/285
EXP: 293455
Next: 14655

Since: 02-17-14

Last post: 3136 days
Last view: 2652 days
I would really recommend the Skilldricks page since NES and SNES ASM are so similar. Start here to begin understanding: http://skilldrick.github.io/easy6502/

____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Jonesy47
Posted on 09-01-14 10:58 PM Link | Quote | ID: 158070


Micro-Goomba
Level: 8

Posts: 5/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Will do! You've done me a massive solid on this one and I hope any and all knowledge I acquire can be applied to help contribute to the awesome romhacking scenes I'm such a fan of. I have had many ideas for many years so, If i can actually figure shit out, you may see quite a lot of activity from me in the future. *FINGERS CROSSED on that one*

Kiokuffiib11
Posted on 09-02-14 11:06 AM Link | Quote | ID: 158077


Porcupo
Level: 40

Posts: 311/313
EXP: 407036
Next: 34273

Since: 07-10-09
From: Marquette, Michigan

Last post: 3312 days
Last view: 1934 days
I think the best place to post your findings would be: http://datacrystal.romhacking.net/ I personally like that site, and have posted quite a bit there myself.

____________________
セシル

Mattrizzle
Posted on 09-02-14 01:27 PM Link | Quote | ID: 158079


Red Cheep-cheep
Level: 33

Posts: 198/202
EXP: 226328
Next: 2851

Since: 04-21-07
From: United States

Last post: 2420 days
Last view: 2380 days
I didn't say it was all done using pointer calculation, only that it is a large part of the process because of the quantity of sprites I've had to port from the first game to the second one.

Posted by shanem
Here is your issue: All the sprites are compressed.
Not exactly. The majority of sprites in the DKC games are uncompressed. They don't appear perfectly aligned in a graphics editor because each sprite is preceded by related data--data which determines how many chr tiles are sent to VRAM, how many of these make up 16x16 and 8x8 OAM tiles, and the coordinates of the OAM tiles. Simion32 has documented the format of this data here.

It is important to note that this format isn't used exclusively by the DKC games. Several Rare-developed SNES use this (e.g. both Battletoads games, Killer Instinct, Ken Griffey, Jr.'s Winning Run).


More about the first DKC's data can be found here.

I'll have more about DKC3 later. Need to leave for work in a few minutes...

____________________

Jonesy47
Posted on 09-03-14 06:41 AM (rev. 2 of 09-03-14 06:42 AM) Link | Quote | ID: 158097


Micro-Goomba
Level: 8

Posts: 6/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Sooooo, if Donkey Kong Coutnry 3 isn't compressed, what's to stop me from editing each of Kiddy's 8x8 tiles into a Donkey Kong tile? Is there a reason why I couldn't?

I am also currently too useless to decypher the offset data you posted...*hangs head in shame*

So far, just looking around in the rom with vsnes, I can now view Kiddy's sprite in Vram and it tells me the tiles location. I STILL cant find a single 8x8 in yychr but, if it's possible, I'll find them. Any more info on how Donkey Kong Country 3 works would be helpful and amazing.

Oh, and thanks for all the info, even if you can't shed anymore light on the subject.

back to 6502 assembly training...

Superjustinbros
Posted on 09-03-14 05:44 PM Link | Quote | ID: 158104


Koopa
Level: 24

Posts: 75/105
EXP: 74970
Next: 3155

Since: 01-09-11
From: United States

Last post: 3198 days
Last view: 2446 days
So with how this'd work, would there have to be some kind of code that swaps the two Kongs so Donkey Kong is always the main Kong and not the side character?

MiniCompute
Posted on 09-03-14 08:07 PM Link | Quote | ID: 158105


Bubble
Level: 66

Posts: 598/981
EXP: 2421357
Next: 40494

Since: 04-25-07

Last post: 489 days
Last view: 697 days
Posted by Jonesy47


So far, just looking around in the rom with vsnes, I can now view Kiddy's sprite in Vram and it tells me the tiles location. I STILL cant find a single 8x8 in yychr but, if it's possible, I'll find them. Any more info on how Donkey Kong Country 3 works would be helpful and amazing.

Oh, and thanks for all the info, even if you can't shed anymore light on the subject.

back to 6502 assembly training...


Don't give up so easily with yychr go back to that location you found the tile address.
Make sure to hit + and -, it'll take awhile but you should be able to see it.
If you do find them make sure you find the correct size for the gfx tile and replace it.
Test the rom and see if it works, let us know what you find over time.


Jonesy47
Posted on 09-04-14 06:39 AM (rev. 2 of 09-04-14 06:51 AM) Link | Quote | ID: 158112


Micro-Goomba
Level: 8

Posts: 7/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
Well, I found Kiddy Kong, but it won't do me any good, In my stupid mind, even if offset in a weird way, I imagined a big 32x32 block I could edit. HA! Its the most efficient layout 0f 8x8 tiles possible, so essentially, the only way my attempt would work would be if Donkey Kong had the same exact size and animations as Kiddy and he does not.

The only way I could think to do this would be to write asm that hijacks Kiddy's sprite routine after I had identified said routine.

So yeah. Back to asm learnin.
Thanks for all the help, yous guys!

EDIT: FINALLY got around to skilldrick's tutorial and its AWESOME. I can't believe how well this is finally clicking...thanks a lot Shanem!! If anything, I'll at least be able to start completing my nes ideas if I can get this down.

ShaneM
Posted on 09-04-14 06:55 AM (rev. 7 of 09-04-14 07:02 AM) Link | Quote | ID: 158113


Snifit
Compromised account.
Please contact an admin to restore access.
Level: 36

Posts: 118/285
EXP: 293455
Next: 14655

Since: 02-17-14

Last post: 3136 days
Last view: 2652 days
Posted by Jonesy47


EDIT: FINALLY got around to skilldrick's tutorial and its AWESOME. I can't believe how well this is finally clicking...thanks a lot Shanem!! If anything, I'll at least be able to start completing my nes ideas if I can get this down.


No need to thank me. I only pointed you in the right direction. You are doing all the work to learn. This is the true spirit of ROM hacking: enticing others to partake in it and get them to see how easy it really is. Keep at it. When you've read the entire Skilldrick's page, you'll know enough to code in ASM. Take your time and do paragraphs a day if that's what it takes to absorb the knowledge. And really, SNES ASM is really similar to the 6502 (NES).

EDIT: Here is a page with all the mnemonics. When you read more of Skilldrick's it will make more sense: http://www.obelisk.demon.co.uk/6502/reference.html




____________________
At the end, when the day is over, the only one left to face is yourself. Have you been true to yourself and made the most of your day?

Jonesy47
Posted on 09-04-14 07:05 AM Link | Quote | ID: 158114


Micro-Goomba
Level: 8

Posts: 8/11
EXP: 2166
Next: 21

Since: 09-01-14

Last post: 3282 days
Last view: 3352 days
I think it's gotta be the javasimulator its got. I've read tons about asm but it never clicked. Now, all of that stuff I read a LOOONG time ago is suddenly coming ever so slightly into view each exercise I complete.

This is awesome and should be stickied on every rom hacking site. It's easily the best learning tool for ASM I have ever run into on the world wide web. Good stuff!

Main - ROM Hacking - Donkey Kong Country 3 Player Character Editing New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.028 seconds. (347KB of memory used)
MySQL - queries: 117, rows: 154/154, time: 0.018 seconds.