ROM Hack Game Freezes when I insert song.

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
The song uses 15 sound channels and 9 samples that are around 32khz and the rest are PSG's. The game is Megaman Starforce Leo and the song replaced is the final boss theme. Upon entering the loading zone the game tries to load everything freezes. I don't believe that it is a ram issue because when I remove the samples and try playing the song without the new samples the game still freezes anyway. The SWAR has 29 samples in it and all of the samples used in the song are IMA-ADPCM encoded. Besides this particular song the game runs normally with no issues or crashes even when playing a song that uses the 29 sample SWAR. When I attempt to get the song to play in another area the song runs fine, but nothing else loads. When I remove some of the samples used in the song the song doesn't play at all and the game freezes again. This was tested on real hardware. Any advice would be helpful.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
Usual choices are

1) You messed up some pointers or other data somewhere. Even a simple typo can cause something to go awry.

2) You exceeded a software limit. This can be a simple piece of data saying what it should expect in a location and what is there in reality, or it can be something speaking far deeper (if sticking with SDAT audio then games that do not normally have STRM will tend not to have support for the STRM format).

3) You exceeded a hardware limit.

What happens when you try an emulator? Unlike many older emulators of older devices then most DS emulators are fairly accurate and will falter if you exceed limits.
The song playing if you stick it in another area, albeit at the cost of the game not otherwise working, says much and also not a lot. That could just be as simple as priorities for the game are different for the final boss and a normal level.

Ultimately it might come down to playing with a debugger and seeing what changes.
Prior to that. Double check pointers, size values and all else describing the files you altered.
Memory issues is a possibility but you can see what goes here by chopping the file down to match original sizes and seeing if it loads here and then building things back up.
 

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
It freezes on an emulator too. I used desmume emulator and the no$gba debugger and both of them do indeed freeze when I approach the loading zone. It might be a memory issue though I'm still not entirely sure yet. I decided to replace one of the songs I already replaced with this song to see what would happen and the song loaded but nothing else did. After that I again removed the new samples to see if the song would load with the graphics and everything and nothing loaded this time which is interesting. It's almost like I am regressing backwards with this whole situation.


For some of the other stuff like pointers I used Nitro Studio to import the song because I seem to break the SDAT for some reason when I change the pointers manually. Is it possible that it could be something within the SSEQ file that's causing all of this?
 
Last edited by biolizardshadow,

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
I believe its a memory issue now. I was able to get the song to run with the wrong wave archive. What's the best way to gauge how much memory you have and how much you have used? Also I have put all of my sound samples into one wave archive that is now almost 1mb. I thought that the DS allowed for individual loading of samples which in nitro studio is an option that seems to make the songs work with high fidelity samples and by individual loading I mean just loading the needed samples and keeping everything else unloaded until it needs to load them.
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,321
Country
United Kingdom
I don't know how many people have properly pushed the limits of the memory handler here, or indeed game specific handling for things (the New Super Mario Brothers folks did some stuff here).

For simple space finding then you have two main options

An older version of dsatm did something called deadbeef padding. Here the RAM is flooded with the value DEADBEEF (all hex) and thus you can then pop open the RAM viewer and anything that says that or a fragment thereof is presumably free at that point in time. Some games will clear it though, and with the DS being firmly in the sort of just about modern camp for game/program flow and doing some measure of dynamic allocation of memory there is always the risk of someone doing something strange (fiddling in options, stage select... compared to start at level 1) and the game overwriting something.

There was a fork of desmume that kept track of writes and would display it simply. https://gbatemp.net/threads/unofficial-desmume-build-unused-memory-finder-tool.349332/

If I need to claw back some space in a binary I will tend to look for the wifi error strings. They are often in plain ASCII in it and a) wifi is dead and b) the replacement service probably won't experience the weird errors and frankly it does not matter if they do. How easy it will be to claw it back here for use with this I don't know, I would almost sooner fiddle with the handler to make it more of a dynamic setup if it is going to be that.

Afraid I have not played with Nitro Studio enough to know how well it works. I have not heard people pointing at it for use though, however plenty of things go unnoticed in ROM hacking world.
If you are having troubles with manual then you might instead try repointing it to the end of the SDAT (might have to change sizes of various sections too, though I would also not be surprised to find such values be redundant and included just because) and skip much of the repointing for later files issues.
 

biolizardshadow

Well-Known Member
OP
Member
Joined
May 4, 2020
Messages
121
Trophies
0
Age
22
XP
298
Country
United States
I was able to get it to work properly but that required a lot of trial and error and I also had to cut back the samples by a lot. I definitely will take a look at the unofficial desmune build that has the free memory finder. One thing I noticed that was very annoying was that the game during this section would load things into memory on during the boss fight that and because I used most of it then the game would freeze. I believe its mostly good now but I'm still testing that to be sure.

The guy who made Nitro Studio isn't well known as far as I know and he mostly does hacking relate to SM64DS. I mostly use it to import the SSEQ files and SWAV files into the SDAT. He recently released Nitro Studio 2 which has a lot more features than the original.
 
Last edited by biolizardshadow,

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    I @ idonthave: :)