It is currently Wed Aug 21, 2019 4:14 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Replacing a soundtrack.
PostPosted: Thu May 30, 2019 4:35 am 
Offline
User avatar

Joined: Thu May 30, 2019 3:34 am
Posts: 4
Location: Either the corruption, or lavender town.
Hey everyone, first time posting here.
I apologise in advance for anything in this thread, I'm extremely unexperienced with modding NES games (Or any games for that matter), I don't really know anything about HEX etc.

okay, that's out of the way. I'll cut to the chase so as to not waste anyone's time.

I recently made a graphical mod for an old NES game called "Lode Runner", I'm sure some of you have heard of it.
Yesterday I composed a soundtrack in NFL format using Famitracker, and I would like to know how to take the current soundtrack for the game and replace it with the newly composed soundtrack.

Some things to consider:
- The song isn't that long, so memory shouldn't be an issue.
- I'm fully aware of the difficulty of this task, it is possible to do, it's just very tedious and pain staking.
- I'm also aware that this requires you to know how to HEX edit, as well as learning about the game's engine. (Or something of that nature)
- I'm not asking for handouts, in other words, I'm not asking people to just take the two files and do all this for me. (Unless offered)
- I'm asking for advice, a direction, things to consider and how to actually do it.I'm willing to learn because this is something I genuinely want to do.

Thank you very much for your time, I look forward to some responses.
Kind regards,
-L0ST :beer:

Ps. If anybody needs access to the modified NES file or NSF file (if for some reason that helps) I'd be happy to attach them if necessary,


Top
 Profile  
 
PostPosted: Thu May 30, 2019 7:20 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21559
Location: NE Indiana, USA (NTSC)
Do you know 6502 assembly language? Knowing 6502 assembly language would help you understand our instructions on how to track down the game's music code.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu May 30, 2019 10:00 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2548
Location: DIGDUG
Nothing famitracker can output will be compatible with Lode Runner's music code.

You would either have to reverse engineer the Lode Runner's code, and write a conversion tool (minimum 1 month of time),

or, gut all the music code out of Lode Runner, and replace it with a format that famitracker can output... NSF is the easiest, presumably you would disassemble the game code and reassemble it with the NSF code and data... or, use one of the homebrew music engines (famitone2, for example)...which is more reasonable due to the large size of native famitracker music engine. And reassemble the game with the famitone2 code in place.

The size of the song wouldn't change the time involved.

Another thought. Some game hackers just hex edit the music data until it sounds right. Trial and error. Knowing exactly where the music data is is the tricky part, and likely it won't sound nearly as good as your famitracker version.

Hacking advice isn't really the focus of this forum, and should be directed to the Romhacking.net forum.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu May 30, 2019 10:51 am 
Offline
User avatar

Joined: Thu May 30, 2019 3:34 am
Posts: 4
Location: Either the corruption, or lavender town.
tepples wrote:
Do you know 6502 assembly language? Knowing 6502 assembly language would help you understand our instructions on how to track down the game's music code.

I don't know any coding languages, I vaguely know C++ and other bits and bobs.
dougeff wrote:
Nothing famitracker can output will be compatible with Lode Runner's music code.

You would either have to reverse engineer the Lode Runner's code, and write a conversion tool (minimum 1 month of time),

or, gut all the music code out of Lode Runner, and replace it with a format that famitracker can output... NSF is the easiest, presumably you would disassemble the game code and reassemble it with the NSF code and data... or, use one of the homebrew music engines (famitone2, for example)...which is more reasonable due to the large size of native famitracker music engine. And reassemble the game with the famitone2 code in place.

The size of the song wouldn't change the time involved.

Another thought. Some game hackers just hex edit the music data until it sounds right. Trial and error. Knowing exactly where the music data is is the tricky part, and likely it won't sound nearly as good as your famitracker version.

Hacking advice isn't really the focus of this forum, and should be directed to the Romhacking.net forum.


That's a lot of info. Okay so, could you break down step by step what I'd have to do and learn?

I'm guess something along the lines of:
Learn hex, just straight up, since I have no idea where to find the music part of the code in a jumble of Hexademical characters.
How would I write a conversion tool? using a total separate coding language?
also when you say "gut all the music code out of Lode Runner, and replace it with a format that famitracker can output... NSF is the easiest" what exactly do you mean by that? You mean locate the music in lode runner, take out the code that is the in-game music, then open the NSF for my song, copy all the code there and paste it in? That doesn't sound right, so you'll probably have to correct me on that one.

Also I apologise if this is not the correct forum to post such a topic, I was sent here by a friend, I didn't know and am sorry if it was rude at all for me to post this here.


I'd really appreciate a response, hopefully you can tell me everything I'd need to know in order to do this.
Again, I'm a total beginner so I apologise for my ignorance of coding.

Either way I'm willing to learn whatever is warranted to do this, I'm willing to commit, I'm a musician and have studied music theory for over a year now, and nothing can be harder than that, so I'm willing to take on as many coding languages as necessary.
Thank you very much for the helpful reply.
Kind regards,
-L0ST


Top
 Profile  
 
PostPosted: Thu May 30, 2019 11:33 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21559
Location: NE Indiana, USA (NTSC)
1. Learn enough 6502 assembly to understand what's going on in a debugger
2. Learn which I/O addresses represent audio commands
3. Run the program while watching for writes to those addresses
4. Find where the program reads the data that it proceeds to write to those addresses
5. Based on the structure of the program, find out how the data is organized
6. Poke in new data

Steps 1 and 2 might take a month or two. Steps 3 through 6 took about a day when I made a patch to put Doom music in Klax. I tried to describe my thought processes in the notes accompanying that patch (click "Readme File" on the patch's description page).

To get started, work through Easy 6502 until you understand most of what is presented.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu May 30, 2019 12:01 pm 
Offline
User avatar

Joined: Thu May 30, 2019 3:34 am
Posts: 4
Location: Either the corruption, or lavender town.
tepples wrote:
1. Learn enough 6502 assembly to understand what's going on in a debugger
2. Learn which I/O addresses represent audio commands
3. Run the program while watching for writes to those addresses
4. Find where the program reads the data that it proceeds to write to those addresses
5. Based on the structure of the program, find out how the data is organized
6. Poke in new data

Steps 1 and 2 might take a month or two. Steps 3 through 6 took about a day when I made a patch to put Doom music in Klax. I tried to describe my thought processes in the notes accompanying that patch (click "Readme File" on the patch's description page).

To get started, work through Easy 6502 until you understand most of what is presented.

I see. Thank you! What debugger would you recommend?
Edit: My mistake, the debugger is or is included with Easy 6502, correct?


Top
 Profile  
 
PostPosted: Thu May 30, 2019 1:13 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 21559
Location: NE Indiana, USA (NTSC)
The most commonly used debugging NES emulators are Mesen and FCEUX.

_________________
Pin Eight | Twitter | GitHub | Patreon


Top
 Profile  
 
PostPosted: Thu May 30, 2019 2:57 pm 
Offline
User avatar

Joined: Thu May 30, 2019 3:34 am
Posts: 4
Location: Either the corruption, or lavender town.
tepples wrote:
The most commonly used debugging NES emulators are Mesen and FCEUX.

Cheers. I'll be on my way then. unless anyone else wants to add something to this topic.(?)


Top
 Profile  
 
PostPosted: Thu Jun 20, 2019 7:11 pm 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 4200
If I was sticking a different sound engine into a game, I'd see what RAM the game uses, and ensure the replacement sound engine doesn't use the same memory. Since you can build the sound engine, you can change what memory is used for the music code.
Note that changing the sound engine means you need to remake the sound effects too.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
PostPosted: Tue Jun 25, 2019 8:52 pm 
Offline

Joined: Tue Jun 25, 2019 8:00 pm
Posts: 1
Location: Finland
Hello, L0ST5ILVER!

Replacing music in a nes game is not so difficult. It took me only some minutes to figure out how the music data works in Lode Runner.
Use FCEUX, Open Hex editor -> View -> ROM file, Open Data Logger -> click "Start" and you will see all the bytes highlighted that were read. Use Pause on your keyboard to pause / resume the emulation.

I made a demonstration video for you:
https://streamable.com/y1y7q


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group