How were payloads like Godmode9 created?

Discussion in '3DS - Homebrew Development and Emulators' started by HamBone41801, May 21, 2017.

  1. HamBone41801
    OP

    HamBone41801 K35

    Member
    534
    292
    Jan 16, 2017
    United States
    As the title says, I'm interested in the creation of payloads used by a9lh or sighax. Specifically, Id like to create a payload that would play .m4a audio files.
     
  2. Drakia

    Drakia GBAtemp Maniac

    Member
    1,495
    1,747
    Mar 15, 2008
    Canada
  3. LinkSoraZelda

    LinkSoraZelda GBAtemp Advanced Maniac

    Member
    1,970
    617
    Aug 12, 2015
    United States
    Land of the Rising Orange
    The speakers are not initialised this early into boot.
     
  4. HamBone41801
    OP

    HamBone41801 K35

    Member
    534
    292
    Jan 16, 2017
    United States
    is it possible to initialize them via the payload?
     
  5. Dionicio3

    Dionicio3 GBATemp's Official Skiddo™ | Founder of Skiddoism

    Member
    2,853
    3,720
    Feb 26, 2017
    United States
    Hollister, CA
    No. Also, why not just use the built in sound player?
     
  6. LinkSoraZelda

    LinkSoraZelda GBAtemp Advanced Maniac

    Member
    1,970
    617
    Aug 12, 2015
    United States
    Land of the Rising Orange
    For all intents, no.
     
  7. Ryccardo

    Ryccardo WiiUaboo

    Member
    2,899
    1,353
    Feb 13, 2015
    Italy
    Imola
    Well this is a hard question...

    A payload is no more than a binary executable (which must be programmed keeping in mind there's no real operating system to interact with, and that specific memory addresses are reserved for specific devices and purposes - it doesn't have to be 100% handwritten assembly but it's not your typical amateur command line program for windows/mac/linux/bsd/plan9/... either)

    Plus you'd have to consider nobody has developed an arm9 homebrew with sound; while nobody is opposed to you being the first, how much of that is due to lack of interest and how much due to technical limitations is something I don't know the answer for...

    Sorry if this answer sounds generic but to a certain extent so is your question, like all "how to learn programming" - it's a combination of reading documentation, others' code, and trial and error!
     
  8. HamBone41801
    OP

    HamBone41801 K35

    Member
    534
    292
    Jan 16, 2017
    United States
    I have never seen such a god-awful audio player in my life.
     
    XXII likes this.
  9. Dionicio3

    Dionicio3 GBATemp's Official Skiddo™ | Founder of Skiddoism

    Member
    2,853
    3,720
    Feb 26, 2017
    United States
    Hollister, CA
    The 3DS sound is not bad dude
     
    Jacklack3 and LinkSoraZelda like this.
  10. HamBone41801
    OP

    HamBone41801 K35

    Member
    534
    292
    Jan 16, 2017
    United States
    yea, but its 100% featureless. no shuffle, no playlists, no repeats, no statistics, no metadata.
     
  11. LinkSoraZelda

    LinkSoraZelda GBAtemp Advanced Maniac

    Member
    1,970
    617
    Aug 12, 2015
    United States
    Land of the Rising Orange
    What? It has shuffle, playlists, metadata, and repeats...
     
    Ryccardo and Dionicio3 like this.
  12. Dionicio3

    Dionicio3 GBATemp's Official Skiddo™ | Founder of Skiddoism

    Member
    2,853
    3,720
    Feb 26, 2017
    United States
    Hollister, CA
    There is playlists, just create folders in the SD card. And there is a shuffle
     
  13. Ryccardo

    Ryccardo WiiUaboo

    Member
    2,899
    1,353
    Feb 13, 2015
    Italy
    Imola
    It even runs snes games!
     
  14. Jacklack3

    Jacklack3 ( ゚ヮ゚) buddie was here

    Member
    1,483
    1,886
    Oct 6, 2015
    Canada
    In your basement Dick Size: 5 meters.
    On the O3DS too!
     
    LinkSoraZelda likes this.
  15. blujay

    blujay GBATemp's Official Warthog

    Member
    1,988
    1,668
    Nov 2, 2015
    United States
    Gilbert, Arizona
    If you really want an audio player that starts at boot:

    1. Install 11.2 FW
    2. Install menuhax
    3. Create a audio player (.3dsx extension)
    4. Name it boot.3dsx
    5. Put on SD card
    6. Hold menuhax button
    7. Profit (Kinda)
    There you go. Have at it.
     
    pixelmasher and Dionicio3 like this.
  16. B_E_P_I_S_M_A_N

    B_E_P_I_S_M_A_N oh no

    Member
    635
    2,218
    Jun 7, 2016
    United States
    Sixth Circle of Hell
    MaK11-12 likes this.
  17. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,492
    3,878
    Jun 9, 2007
    I'll break this into two 'replies' of sorts since the question branches into two different areas (even if they're related).

    This isn't terribly difficult, but basically, you'd compile your code into an ELF and use objcopy to extract the binary code out of it (in the case of a9lh), or take the ELF and build a FIRM file for it with TuxSH's firmtool (sighax/b9s). The thing is you have to understand the environment in which you're wanting to work, which I'll describe below in the second 'reply'.


    Now this is where things would get iffy. You have to consider the A9LH/Sighax environment to be like an embedded device, or perhaps a better analogy would be a PC that's still booting/the BIOS/EFI* just finished executing. Hardware generally isn't initialised to a level where you need it to be, and there aren't any operating system drivers or services in place to let you do what you want. It's an extremely primitive environment where you have to do everything yourself (you could even think about it being like the DS or GBA). You would have to bring the screens up to show graphics (relatively easy to do, there's lots of code for it in Luma, godmode9, etc.) for a menu, and get input to drive the menu (easy to do, it's just a hardware register that you read like on the DS or GBA).

    Finally, you have the issue of sound. The 3DS has a DSP chip that plays sound, but it uses its own firmware, so you would have to figure out how to initialise the chip, upload firmware to it, and then start sending sound data to it. Nobody has done this outside of the FIRM/horizon environment (meaning the main 3DS OS), so you'd not have any references to work with. You could reverse engineer parts of the 3DS OS to get going, but that would take a lot of time and effort for something you could do as suggested above: get menuhax and run a program that way, or just wait the 6-9 seconds it takes for your console to boot and run your favourite music player. Alternatively, if something like MarcusD's TreeHome gets finished, maybe it could autoboot into certain titles, but until that happens, the prior ideas are all that are really available at this point.

    *Leaving aside the fact that both BIOS and UEFI have extremely rudimentary device drivers and services to get the system going, it's for the sake of analogy and explanation.
     
    Gray_Jack, Giodude and HamBone41801 like this.
  18. HamBone41801
    OP

    HamBone41801 K35

    Member
    534
    292
    Jan 16, 2017
    United States
    thanks for the reply man! I cracked the first part. I found a test for a payload in @d0k3 's github, fixed an error in his make file, and I can now build and load firms. as for the second part, I doubt ill be able to do all of that.
     
  19. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,492
    3,878
    Jun 9, 2007
    No problem. It would be a daunting task, for sure. It took TuxSH, Aurora, Mid-kid, b1l1s, and some others a good week or so just to get screen init working safely. Sound would be a fair bit more complicated..