Home Gallery Resources The Team Rules chat Login Register
Pages: [1]
Author Topic: The Beginner's Guide to Stage Modules  (Read 6690 times)
0 Members and 1 Guest are viewing this topic.
PhantomWings
Mega Kitten
*****
Offline Offline

Posts: 167

  • Awards Super Saiyan Topic Featured

  • View Profile Awards
    « on: August 05, 2011, 06:09:56 PM »


    I was going through my notes the other day when something caught my attention that I'd meant to expand on a little more. It's not really anything useable at the moment, but hey, I figure someone should be able to get something out of it.

    First off, some class declarations

    stClassInfo:
    Declaration: 80B292A8
    Constructor Method: 809301d0
    Inherits: None
    Methods: 3
    Size: 0x04

    gfTask:
    Declaration: 80422F08
    Constructor Method: 8002d8b8
    Inherits: None
    Methods: 23
    Method Range: 0 - 22
    Size: 0x44

    Stage:
    Declaration: 80B29088
    Constructor Method: 8092c478
    Inherits: gfTask
    Methods: 127
    Method Range: 23 - 126
    Size: 0x1A0

    stCommonGimmick:
    Declaration: 80B2B608
    Constructor Method: 80942614
    Inherits: Stage, gfTask
    Methods: 127
    Size: 0x1D0

    stMelee:
    Declaration: 80B2B8E8
    Constructor Method: 809435F0
    Inherits: stCommonGimmick, Stage, gfTask
    Methods: 132
    Method Range: 127 - 132
    Size: 0x1D8

    You may have seen these classes before if you've ever taken the time to look inside any stage module. For the sake of the analysis, I used the Wifi Waiting Room stage(st_otrain.rel) - I will refer to it whenever necessary.

    For now we'll look at stClassInfoImpl<55, stOnlineTrainning>, a derived class of the stClassInfo class. (you could argue that it's actually an implementation of the abstract interface stClassInfo, but let's not complicate the terminology) This is a lightweight class that Brawl uses whenever it needs to generate the Wifi Waiting Room stage for you to fight on. (Incidentally, the Results Screen stage's stClassInfo is always loaded into memory, so it can be loaded at any time)

    The method in question that loads the stage is stClassInfoImpl<55, stOnlinetrainning>.Method[1]. I won't go into details, but it does 3 main things:

    1. Allocate a block of memory on the StageInstance heap the size of the stOnlineTrainning class.
    2. Call the stMelee constructor. (the base class of the stOnlineTrainning class)
    3. Construct the remaining parts unique to the stOnlineTrainning class.

    After the constructor returns, the address of the stOnlineTrainning class gets stored at 80B8A428. (Somewhere inside module 1B) When the match actually starts, stOnlineTrainning gets accessed from 80B8A428 and it's initializer gets called.

    For all instances of the Stage class, method[23] is the initalizer. This is the function that is responsible for loading up all the assets from STGONLINETRAINING.pac. It is also responsible for creating any other instances that exist on the stage as separate objects. (The blocks from Mushroomy Kingdom, say)



    And unfortunately, that's really as far as I got with this. I might venture a guess as to say that the method at 80015DDC is responsible for loading specific archives out of the .pac with r4 being the type and r5 being the FileIndex, but the rest of it is uncharted territory.

    In case that all went by a little bit too fast for you, I whipped up a quick diagram for you to reference at your leisure.
    (The diagram says that Method[22] is the Stage initializer - ignore that, it's really Method[23])


    Just a few more miscellaneous notes:

    As mentioned above, the current existing stage instance can be accessed at any time from the pointer at 80B8A428.

    All methods in a class that don't reference assembly inside it's own module are methods that have not been overridden from it's base class.

    Method[127] is the main loop of the stage. It is constantly called and is used for things like the Sandbag in WWR or rebuilding the mansion in Luigi's Mansion.

    Just as there are constructors and initializers, there are also destructors and finalizers. stClassInfo.Method[0] is used for removing the stClassInfo from memory and Stage.Method[22] is the destructor for the actual stage

    The memory allocation function can be found at 8000C8B8, it may be a good idea to see what else calls it if you wish to find out where other classes get constructed. (8000C8C8 is the memory free function if anyone was wondering) Also, here's a list of the types of memory heaps.
    Code:
    00 *Null
    01 System FW
    02 System
    03 Effect
    04 RenderFifo
    05 Sound
    06 Network
    07 WiiPad
    08 IteamResource
    09 InfoResource
    0A CommonResource
    0B Replay
    0C Tmp
    0D Physics
    0E ItemInstance
    0F StageInstance
    10 *Null
    11 StageResoruce
    12 Fighter1Resoruce
    13 Fighter2Resoruce
    14 Fighter3Resoruce
    15 Fighter4Resoruce
    16 Fighter1Resoruce2
    17 Fighter2Resoruce2
    18 Fighter3Resoruce2
    19 Fighter4Resoruce2
    1A FighterEffect
    1B Fighter1Instance
    1C Fighter2Instance
    1D Fighter3Instance
    1E Fighter4Instance
    1F FighterTechqniq
    20 FighterKirbyResource1
    21 FighterKirbyResource2
    22 FighterKirbyResource3
    23 AssistFigureResource
    24 ItemExtraResource
    25 *Null
    26 PokemonResource
    27 *Null
    28 InfoInstance
    29 *Null
    2A MenuInstance
    2B *Null
    2C CopyFB
    2D GameGlobal
    2E GlobalMode
    2F *Null
    30 MeleeFont
    31 *Null
    32 OverlayCommon
    33 OverlayStage
    34 OverlayMenu
    35 OverlayFighter1
    36 OverlayFighter2
    37 OverlayFighter3
    38 OverlayFighter4
    39 *Null
    3A Thread


    That's all for now folks. I'll hang around for a little while to see if this can be taken anywhere, but I'll be riding backseat for the most part.
    Logged

    SmashClash
    This is my title.
    Boss Kitten
    ****
    Offline Offline

    Posts: 4662


  • Awards Super Saiyan Topic Heart Container >9000 Renowned Hacker

  • View Profile Awards
    « Reply #1 on: August 05, 2011, 06:18:57 PM »


    Noone posted here yet?!
    Wonderful guide, PW.
    People were doubting you or Dant would come back. But here you are! Cheesy
    Logged

    BlackJax96
    Brawl Mod God
    Moderator
    ****
    Offline Offline

    Posts: 4612


  • Awards Super Saiyan Topic Sniper King for a Day Featured

  • View Profile Awards
    « Reply #2 on: August 05, 2011, 06:43:01 PM »


    Whoa, this is nice! I don't even know what I'm supposed to say lol, this is just really, really awesome. Glad you're still around, PW.
    Logged

    I'm making a game engine and video games literally from scratch over at https://theradevgames.com


    Protoman.EXE
    Extreme Kitten
    *******
    Offline Offline

    Posts: 427


    Netbattler pro.

  • Awards Shadow the Pinhog

  • View Profile Awards
    « Reply #3 on: August 05, 2011, 09:19:08 PM »


    inb40vah9000requests

    Great guide PW, always depthening our knowledge, bit, by epic bit.
    Logged

    Sig by Segtendo. Epic

    Eternal Yoshi
    Heroic Kitten
    **
    Offline Offline

    Posts: 2425


    Boss? Is that you?

  • Awards KCMM Old Timer Super Saiyan Topic Active Contributor Former PMDT

  • View Profile Awards
    « Reply #4 on: August 05, 2011, 09:39:50 PM »


    I did not notice this thread. Thanks for this info.
    Logged


    DoctorFlux(Mariodk)
    Never Gonna Give You Up
    *
    Offline Offline

    Posts: 9387


  • Awards Infinite Smash Team Heart Container KCMM 2012 Awards Winner >9000

  • View Profile Awards
    « Reply #5 on: August 06, 2011, 01:23:32 AM »


    PM is back that can only means one thing Cheesy
    something awesome is Coming like always you leaving and then come back
    Logged

    I Dont Take Requests & Dont Do Brawl Mods anymore Maybe Sm4sh modz later

    xxmasal22xx
    Holy Kitten
    *
    Offline Offline

    Posts: 1357


    The epic importer

  • Awards Hot Topic Dedicated Hacker KCMM Veteran Heart Container

  • View Profile WWW Awards
    « Reply #6 on: August 07, 2011, 08:43:46 PM »


    HES BACK EVERYBODY!!!

    Welcome back Phantom Wings! Great to see ya!
    Logged

    By the way, I think every active hacker in this forum could use less distractions.

    MEMORABLE QUOTES:
    Quote
    Tcll:  I <3 69
    Quote
    xxmasal22xx: Hey, you should probably go to the hop[censored]al
    Quote
    BlackJax96: everything is so ROUND

    [SPOILERED. Reason: Whole signature size must be under 250px.]

    Join my website, Brawl Imports, a gathering place for importers!
    http://brawlimports.proboards.com/index.cgi

    Support Project Darkrai? Put the official Project Darkrai banner in your siggy!
    [PICTURE REMOVED. Reason: Total signature pic size exceeds 695x200.]


    ghost_user47
    Overlord Kitten
    ******
    Offline Offline

    Posts: 6754


  • Awards Former PMDT Sniper Diamond in the Rough >9000

  • View Profile WWW Awards
    « Reply #7 on: August 09, 2011, 03:09:08 PM »


    well.... now hes gone...  I see what you did there ...
    Logged

    DarkPikachu
    Angel Kitten
    ***
    Offline Offline

    Posts: 3069


    complexity == fun

  • Awards Fiery Topic Heart Container KCMM Veteran Tutorial Writer

  • View Profile Awards
    « Reply #8 on: August 09, 2011, 09:13:04 PM »


    glad to see ya PW Cheesy

    teach me the REL format o great one *bows*

    lol... nah... Laugh
    just send me a detailed PM of the format plz Smiley

    I just need to figure out how to decompile the scripts >_>
    Logged


    Quote: Friedslick6
    you have been through a lot of hassle. I've watched every topic you posted on this, and most of them seemed to disintegrate gradually.
    But the coolest part was that you didn't stop working on it despite that.

    Quote: Internet Explorer
    you're doing more with your life right now than probably most other people around you. You're a valuable asset to the Smash community. So yeah, you should be proud.

    quote: Greg
    You do have a gift which I've seen many developers use to their advantage. You can become a great coder, and with all of those ideas I think you can really build something great.

    xxmasal22xx
    Holy Kitten
    *
    Offline Offline

    Posts: 1357


    The epic importer

  • Awards Hot Topic Dedicated Hacker KCMM Veteran Heart Container

  • View Profile WWW Awards
    « Reply #9 on: August 10, 2011, 07:56:55 AM »


    glad to see ya PW Cheesy

    teach me the REL format o great one *bows*

    lol... nah... Laugh
    just send me a detailed PM of the format plz Smiley

    I just need to figure out how to decompile the scripts >_>

    I think tcll just scared him off Im srs here LOL
    Logged

    By the way, I think every active hacker in this forum could use less distractions.

    MEMORABLE QUOTES:
    Quote
    Tcll:  I <3 69
    Quote
    xxmasal22xx: Hey, you should probably go to the hop[censored]al
    Quote
    BlackJax96: everything is so ROUND

    [SPOILERED. Reason: Whole signature size must be under 250px.]

    Join my website, Brawl Imports, a gathering place for importers!
    http://brawlimports.proboards.com/index.cgi

    Support Project Darkrai? Put the official Project Darkrai banner in your siggy!
    [PICTURE REMOVED. Reason: Total signature pic size exceeds 695x200.]


    Jaklub
    Supreme Kitten
    ********
    Offline Offline

    Posts: 597


    Personal Text:

  • Awards Featured Good Citizen Super Saiyan Topic Renowned Hacker

  • View Profile Awards
    « Reply #10 on: August 10, 2011, 11:04:30 AM »


    That's all for now folks. I'll hang around for a little while to see if this can be taken anywhere, but I'll be riding backseat for the most part.
    Looks like you misunderstood him a bit.
    Logged

    As you may have noticed, I don't answer PMs with problems anymore.

    -
    The Corrupted
    Holy Kitten
    *
    Offline Offline

    Posts: 1799

  • Awards Hot Topic Pin Collector Active Contributor Heart Container

  • View Profile Awards
    « Reply #11 on: August 12, 2011, 06:32:37 PM »


    Hmm, interesting data you got there Phantom Wings.
    Will probably help me get rid of the Parasite Queen's voice (loop) without getting rid of the rest.

    To bad character modules aren't that easy to dissect though...
    A man can dream
    « Last Edit: August 12, 2011, 06:33:32 PM by ds22 » Logged

    Sajiao Omelette
    Holy Kitten
    *
    Offline Offline

    Posts: 1058


    Paramedics finished her text, "...love you."

  • Awards Fiery Topic Starstormer Heart Container KCMM Old Timer

  • View Profile Awards
    « Reply #12 on: August 12, 2011, 06:47:34 PM »


    My understanding of code is extremely low, but this looks theoretically promising (honestly, probably because Phantom Wings posted it).

    What exactly does knowing what stClassInfoImpl<55, stOnlineTrainning> do do for us? (Or more specifically, people who know this stuff.... @_@)
    Logged


    Pages: [1]
    Print
    Jump to: