• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Important Melee, Hacks, and You -- New Hackers Start Here, in the OP!

tatatat0

Smash Journeyman
Joined
Jan 28, 2015
Messages
412
Good stuff tata. You should check out this spreadsheet I started a while back:

https://docs.google.com/spreadsheets/d/1iAfxxAQUboOfaLoJExNVAq76Sv7dG7UkfvTDzzqGgjY/edit?usp=sharing

The mythical "next version of Crazy Hand" that I've been slowly working on for the past million years is going to read all of its values from this sheet, in this format. Right now it has all of the values that are present in CH v1.31. You've been finding tons of amazing values and if you could put them in here, that would be incredible. Unfortunately I don't know when the next CH build will actually be available... real life is hectic.
Peach Offsets[tatatat0]:
Okay. Got it.
 

DraGon72097

Smash Rookie
Joined
Oct 25, 2016
Messages
18
1) I tried making a custom css, but when I tried to re-add the edited .png files to the MnSlChr.usd, all the images were horribly wrong. The basic image is there, but the colors are all wrong, and it looks like it was ran through seventeen vhs filters. Is there some special .png compression I need to use before re-adding them to the .usd?

2) Is there some source that details what each .dsp file in each .ssm file is in game? For example, ganon00.dsp is ganondorf's jump sound (it probably isn't, that's just an example.)

I'm working on a pretty expansive mod for melee, and these are the last two puzzle pieces I need to complete it.
 
Last edited:

tatatat0

Smash Journeyman
Joined
Jan 28, 2015
Messages
412
Hey DRGN DRGN You still never ended up giving me a working code to resize files.
Your code was
Code:
global datDataHeader, datData, rtData, after
def extendDataSpace( offset, diff):
    """ This function will expand the data area at the given offset, starting at the first argument. The second argument is the amount to increase by.
        All pointers occurring after the sum of the two arguments will be recalculated. """

    def replaceHex(hexData, offset, newHex): # Input takes a string, int, and string, respectively.
            offset *= 2; # Doubled to count by nibbles rather than bytes, since the data is just a string.
            codeEndPoint = offset + len(newHex);
            return hexData[:int(offset)] + newHex + hexData[int(codeEndPoint):]
    if (datDataHeader != '')and (datData != '') and (rtData != '') and (after !=''):
        #After is the data right after the rtData
        # Update the file header with the new file size and start of the relocation table.
        filesize = int(datDataHeader[:8], 16)
        newFilesize = filesize + diff
        rtStart = int(datDataHeader[8:16], 16) # Size of the data block
        newRtStart = rtStart + diff
        datDataHeader = replaceHex(datDataHeader, 0, "{0:0{1}X}".format(newFilesize, 8) + "{0:0{1}X}".format(newRtStart, 8))

        # For each entry in the relocation table, update the address it points to, and the value of the pointer there, if they point to locations beyond the extended space.
        entriesUpdated = 0
        pointersUpdated = 0
        for nib in range(0, len(rtData), 8):
            rtEntryNum = (nib/8)
            rtEntryAddress = rtStart + (rtEntryNum * 4)
            rtEntryString = rtData[nib:nib+8]
            rtEntryValue = int(rtEntryString, 16) # i.e. the pointer address
            pointerString = datData[rtEntryValue * 2:(rtEntryValue + 4) * 2] # Multipled by 2 because this is per character/nibble, not per byte.
            pointerValue = int(pointerString, 16)

            # If the pointer appears after the change, update its address in the relocation table accordingly.
            if rtEntryValue >= offset:
                newRtEntryValue = rtEntryValue + diff
                datData = replaceHex(datData, rtEntryAddress, "{0:0{1}X}".format(newRtEntryValue, 8))
                #print ("rtEntryAddress: " + str(rtEntryAddress))
                #print ("Old data: ", rtEntryValue)
                #print ("New Data: ", "{0:0{1}X}".format(newRtEntryValue, 8))
                #input("S")
                #exit()
                entriesUpdated += 1
            else: #doesn't just ignore unused stuff
                datData = replaceHex(datData, rtEntryAddress, "{0:0{1}X}".format(rtEntryValue, 8))

            # If the place that the pointer points to is after the space change, update its value accordingly.
            if pointerValue >= offset:
                newPointerValue = pointerValue + diff
                datData = replaceHex(datData, rtEntryValue, "{0:0{1}X}".format(newPointerValue, 8))
                pointersUpdated += 1

        # Fill the newly extended space with zeros. (Values doubled to count by nibbles rather than bytes, since the data is just a string.)
        datData = datData[0:offset * 2] + '0'.zfill(diff*2) + datData[offset * 2:]
        datfile = open("bowsertestinsert.dat", "w+")
        datfile.write(datDataHeader + datData + after)
        datfile.close()
define the globals please.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Hey DRGN DRGN You still never ended up giving me a working code to resize files.
Your code was
Code:
global datDataHeader, datData, rtData, after
def extendDataSpace( offset, diff):
    """ This function will expand the data area at the given offset, starting at the first argument. The second argument is the amount to increase by.
        All pointers occurring after the sum of the two arguments will be recalculated. """

    def replaceHex(hexData, offset, newHex): # Input takes a string, int, and string, respectively.
            offset *= 2; # Doubled to count by nibbles rather than bytes, since the data is just a string.
            codeEndPoint = offset + len(newHex);
            return hexData[:int(offset)] + newHex + hexData[int(codeEndPoint):]
    if (datDataHeader != '')and (datData != '') and (rtData != '') and (after !=''):
        #After is the data right after the rtData
        # Update the file header with the new file size and start of the relocation table.
        filesize = int(datDataHeader[:8], 16)
        newFilesize = filesize + diff
        rtStart = int(datDataHeader[8:16], 16) # Size of the data block
        newRtStart = rtStart + diff
        datDataHeader = replaceHex(datDataHeader, 0, "{0:0{1}X}".format(newFilesize, 8) + "{0:0{1}X}".format(newRtStart, 8))

        # For each entry in the relocation table, update the address it points to, and the value of the pointer there, if they point to locations beyond the extended space.
        entriesUpdated = 0
        pointersUpdated = 0
        for nib in range(0, len(rtData), 8):
            rtEntryNum = (nib/8)
            rtEntryAddress = rtStart + (rtEntryNum * 4)
            rtEntryString = rtData[nib:nib+8]
            rtEntryValue = int(rtEntryString, 16) # i.e. the pointer address
            pointerString = datData[rtEntryValue * 2:(rtEntryValue + 4) * 2] # Multipled by 2 because this is per character/nibble, not per byte.
            pointerValue = int(pointerString, 16)

            # If the pointer appears after the change, update its address in the relocation table accordingly.
            if rtEntryValue >= offset:
                newRtEntryValue = rtEntryValue + diff
                datData = replaceHex(datData, rtEntryAddress, "{0:0{1}X}".format(newRtEntryValue, 8))
                #print ("rtEntryAddress: " + str(rtEntryAddress))
                #print ("Old data: ", rtEntryValue)
                #print ("New Data: ", "{0:0{1}X}".format(newRtEntryValue, 8))
                #input("S")
                #exit()
                entriesUpdated += 1
            else: #doesn't just ignore unused stuff
                datData = replaceHex(datData, rtEntryAddress, "{0:0{1}X}".format(rtEntryValue, 8))

            # If the place that the pointer points to is after the space change, update its value accordingly.
            if pointerValue >= offset:
                newPointerValue = pointerValue + diff
                datData = replaceHex(datData, rtEntryValue, "{0:0{1}X}".format(newPointerValue, 8))
                pointersUpdated += 1

        # Fill the newly extended space with zeros. (Values doubled to count by nibbles rather than bytes, since the data is just a string.)
        datData = datData[0:offset * 2] + '0'.zfill(diff*2) + datData[offset * 2:]
        datfile = open("bowsertestinsert.dat", "w+")
        datfile.write(datDataHeader + datData + after)
        datfile.close()
define the globals please.
Hey. Sorry for the slow reply.

datDataHeader is the dat's header (the first 0x20 bytes)
datData is everything else
rtData is the relocation table (lmk if you need specifics to get this)
I don't know what "after" is; that must be something you added. Looks like there are some other extra bits in there as well.

Depending on what file you're working on, and where, you may also need to iterate over the root table and update the pointers there too. I haven't needed to in the examples I've done, but that might be why this didn't work for you before. Code should be added for that either way to really finish this though. The code here might be able to help with that if you want to add that yourself. Or you could update them manually since sometimes there aren't a whole lot of them. Otherwise, I may look at it tomorrow or Friday.
 

tatatat0

Smash Journeyman
Joined
Jan 28, 2015
Messages
412
Brute forcing notes from PlCo.dat. Found two things of interest. A format, and the IMPORTANT? offset.
 
Last edited:

Zerrick

Smash Rookie
Joined
Nov 11, 2016
Messages
12
I cant even figure out how to open crazy hand. what do i need to open crazy hand?
 

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
It isnt even showing up i have no idea whats wrong. i go to rightclick, open with, and it doesnt even show up
Shift+Right click the directory, and click "Open command window here." Type "java -jar [nameoffile].jar" without the quotations and the name of your jar file. If it doesn't run, you'll see a Java error.
 
Last edited:

-Stavo-

Smash Rookie
Joined
Dec 22, 2014
Messages
15
Which codes in the File System pertain to the single player modes? Like Event Matches or Stadium modes?
 

_yuna

Smash Apprentice
Joined
Feb 11, 2014
Messages
97
Location
Fox
Does GCRebuilder add data if the resulting ISO doesn't match 1.36gb? I had to get the root of an iso to change the ID back to GALE, and when I had done that, the filesize was back to 1.36gb from 900mb even though I had removed the how to video, and the omake thing. Seems kinda weird.
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Does GCRebuilder add data if the resulting ISO doesn't match 1.36gb? I had to get the root of an iso to change the ID back to GALE, and when I had done that, the filesize was back to 1.36gb from 900mb even though I had removed the how to video, and the omake thing. Seems kinda weird.
Yeah, GCR adds extra blank space between files in order to make the finished disc 1.36 GB. You don't need to export the files of an ISO to change the Game ID though. Just open the disc in a hex editor. It's literally the first thing in the disc (even if it wasn't though, you can just go to the offset of any particular value you want to change and edit it directly).

Hey, does anyone know how to make 20XX 4.05 show the intro video instead of going straight to the CSS?
To my knowledge I think the intro was removed for space.
Yeah, all videos besides some of the really small ones for 1-P modes were removed.

Btw, Achilles1515 Achilles1515 , there's still the audio for the intro movie in there though. Is that just a quick way to prevent the game from crashing if users are skimming through the Sound Test?
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
Btw, Achilles1515 Achilles1515 , there's still the audio for the intro movie in there though. Is that just a quick way to prevent the game from crashing if users are skimming through the Sound Test?
Yes. For 4.06, I am also overwriting MTH/THP assembly functions because I ran out of room (added some code to skip the THP "Congratulations" images after 1P modes and then removed the THP files from the filesystem as well).

Code:
MCM Settings.py:
commonCodeRegions = [( 0x32C998, 0x332834 ), ( 0x407540, 0x408F00 ), ( 0x18DCC0, 0x197B2C )]
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Yes. For 4.06, I am also overwriting MTH/THP assembly functions because I ran out of room (added some code to skip the THP "Congratulations" images after 1P modes and then removed the THP files from the filesystem as well).

Code:
MCM Settings.py:
commonCodeRegions = [( 0x32C998, 0x332834 ), ( 0x407540, 0x408F00 ), ( 0x18DCC0, 0x197B2C )]
What!? Out of space? That's nuts. That's a lot of assembly.

So why don't we increase the size of the DOL? I've had the thought before, and I can't remember if there was something that made it impossible, but I don't think it is.

DOL section offsets would need to be updated in the header, and file sizes and offsets would need to be updated in the FST, of course, as well as in boot.bin. According to the apploader's source code, there's a limit for individual text/data sections, and also a limit for their total. It looks like the total limit is defined in bi2.bin (a.k.a. DVDBI2, and "the disc header information") at 0x28, and in Melee that's set as 0 (which defaults to unlimited). Definition of the individual text/data section limit is less clear; apparently it checks that the addresses that they would be loaded to are not out of bounds. As a simple shortcut, considering that all sections compared the same way, we might be able to just make some or all of them as large as the current largest, which would give a lot more space. Not really something to play with until v4.07 though, I suppose.

Also, I'm curious why you don't use some of the other defined free space regions. To avoid segmenting your code?

I take it the 0x32C998 region is the MTH/THP region? Do any codes need to be applied to circumvent the game trying to call these functions? I could add this with description to MCM's regions (disabled by default of course).
 
Last edited:

_yuna

Smash Apprentice
Joined
Feb 11, 2014
Messages
97
Location
Fox
Yeah, GCR adds extra blank space between files in order to make the finished disc 1.36 GB. You don't need to export the files of an ISO to change the Game ID though. Just open the disc in a hex editor. It's literally the first thing in the disc (even if it wasn't though, you can just go to the offset of any particular value you want to change and edit it directly).
Ah, all right. I figured that would be the case. But I never bothered to check the ISO in a hex editor because who knows what reason. Is there any way for me to free up the filled space? Or would I have to revert to an older ISO and put everything back in?
 

DRGN

Technowizard
Moderator
Joined
Aug 20, 2005
Messages
2,179
Location
Sacramento, CA
Ah, all right. I figured that would be the case. But I never bothered to check the ISO in a hex editor because who knows what reason. Is there any way for me to free up the filled space? Or would I have to revert to an older ISO and put everything back in?
You'd have to revert to your last back-up. Or, if it's not too important and can wait for the next version of DTW, I've nearly finished the functions to rebuild a disc while being able to specify how much space is added between files. Might be done sometime this month, but I'm not sure since I've also been busy working on other things.
 

_yuna

Smash Apprentice
Joined
Feb 11, 2014
Messages
97
Location
Fox
You'd have to revert to your last back-up. Or, if it's not too important and can wait for the next version of DTW, I've nearly finished the functions to rebuild a disc while being able to specify how much space is added between files. Might be done sometime this month, but I'm not sure since I've also been busy working on other things.
All right, thank you! I'll be able to wait. I've removed some other things to make space in the mean-time. Also how would I go about making a custom stage select screen? Been messing around with adding in the new stage model imports and creating some icons and stage names (like the ones that pop up when you hover over a stage) and figured it could do with a new layout.
 

Acryte

Smash Ace
Joined
Mar 30, 2005
Messages
986
You'd have to revert to your last back-up. Or, if it's not too important and can wait for the next version of DTW, I've nearly finished the functions to rebuild a disc while being able to specify how much space is added between files. Might be done sometime this month, but I'm not sure since I've also been busy working on other things.
Does it support resizing for added audio tracks? Just a curiosity.
 
Last edited:
Joined
Jul 21, 2016
Messages
6
I know nothing about hex editing and i cant find the guide for it, but I'm trying to get into melee modding and I don't understand the format people put their gecko codes in.

example:
1234567 3127911
1274291 1249424
1234095 0238475
And so on...

What are the numbers on the left and right supposed to be?
Is the left supposed to be the original hex value thing and the right is what I'm supposed to change it to?
I've tried that before but the values on the left didn't exist (maybe its's more simple than that and I'm just thinking too hard about it).

can someone please explain this to me, or just give me a link to the HxD guide.
 

Achilles1515

Smash Master
Joined
Jun 18, 2007
Messages
3,211
Location
Cincinnati / Columbus OH
I know nothing about hex editing and i cant find the guide for it, but I'm trying to get into melee modding and I don't understand the format people put their gecko codes in.

example:
1234567 3127911
1274291 1249424
1234095 0238475
And so on...

What are the numbers on the left and right supposed to be?
Is the left supposed to be the original hex value thing and the right is what I'm supposed to change it to?
I've tried that before but the values on the left didn't exist (maybe its's more simple than that and I'm just thinking too hard about it).

can someone please explain this to me, or just give me a link to the HxD guide.
https://smashboards.com/threads/assembly-guides-resources-q-a.397941/

Watch the Intro to Wii Hacking series and then go to the Gecko Codetype Documentation link in that post.

----

DRGN DRGN

Melee throws an assertion if it is trying to load a file whose filename string length (extension not included) is 30 or more characters. Not sure about the specifics of your new disc operations for DTW, but maybe there should be a check for this when adding files.

Also, in the DVDConvertPathToEntrynum function, the filename to be loaded is passed into tolower(), so filenames are not case sensitive.
 

SinsOfApathy

Smash Journeyman
Joined
Feb 24, 2015
Messages
474
NNID
Psion312
Ended up realizing after doing some static analysis that the majority of assertion strings are right next to the declared C file names and a table of function pointers for those files.

It's pretty much, stage specific functions, menu functions, character specials, and item functions. I also discovered from the item function tables the pointers related to item AI for things like Bobombs and Mr. Saturn. I've got a lot to document that may just end up with names like, "Stage_BigBlue_Unknown1" until we nail things down. That way, we can more accurately locate functions, even without understanding what they might do.

I also noticed several incorrectly named functions in our map by forcing assertion failures or looking at how they were associated. An example of this is Absolome's function stage function that's definitely not what it claims to be, or my sins_Spawn_Article which would be more appropriately sins_Spawn_JObj, since it handles things like Tingle and Laser Pistols plus is part of JObj.h.
 
Last edited:
D

Deleted member

Guest
I'm using GCRebuilder and I'm trying to import a .hps file, but it tells me "File to import is too large". How can I make sure my files are the right size?
 
Top Bottom