Official [Release] GodMode9 - All Access File Browser for the 3DS

Discussion in '3DS - Homebrew Development and Emulators' started by d0k3, Mar 22, 2016.

  1. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    1,008
    418
    May 11, 2008
    United States
    Well, I'm kind of off to a late start tonight, but, it builds. I rebuilt the SSR and re-uploaded it. Looks like some change broke the "move to root" trick, but it may have been a change to GM9 for all I know (I've been writing batch files and scripts for a long time, so I usually avoid "move" or "mv" like the plague). It's been a long time since I tried it. Oh well, it's just one file to copy. It just copies "boot.firm.bak" to "boot.firm" now, so, make sure that's on the card. Even with having to use that one extra "cp" command, I was still looking at the Luma configuration screen about 7 seconds after I powered the system on using NTRBootHax. I'll consider that a resounding success (keep in mind, my copy has the keys built in though).

    P.S. A pre-loaded card IS in compliance with AnalogMan's rules. It just can't start in the system. So, just forget about the original "Nintendo 3DS" folder. If you really want Dinosaur Office, download it with Freeshop ;)
     

    Attached Files:

    Last edited by Kazuma77, Oct 21, 2017
  2. Eix

    Eix GBAtemp's Best Waifu (now lewd-ish)

    Member
    597
    1,007
    May 27, 2017
    United States
    Vanilmirth
    would this be a better battery color and indicator or no?
    Code:
    void GenerateBatteryBitmap(u8* bitmap, u32 width, u32 height, u32 color_bg) {
        const u32 color_outline = COLOR_ORANGE;
        const u32 color_inline = COLOR_BLACK;
        const u32 color_inside = COLOR_GREY;
       
        if ((width < 8) || (height < 6)) return;
       
        u32 battery;
        bool is_charging;
        CheckBattery(&battery, &is_charging);
       
        u32 color_battery = (is_charging) ? COLOR_BLUE :
            (battery > 75) ? COLOR_GREEN : (battery > 50) ? COLOR_YELLOW : (battery > 25) ? COLOR_ORANGE : COLOR_RED;
     
  3. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    Can't we handle touching bottom screen on arm9?
    Some of linux-3ds uses touch software keyboard so I think we can.
     
    Eix likes this.
  4. Eix

    Eix GBAtemp's Best Waifu (now lewd-ish)

    Member
    597
    1,007
    May 27, 2017
    United States
    Vanilmirth
    but what would we use that for?
     
  5. SirNapkin1334

    SirNapkin1334 Renound Aritst

    Member
    768
    217
    Aug 20, 2017
    United States
    Near Crap Mountain
    Keyboard on bottom screen, when entering text. That would also allow us to have a texteditor! But I'm not sure if Arm11 payloads can use touchscreen, we'd better ask @d0k3 .
     
  6. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    We can use it for touch keyboard. The linux-3ds's keyboard is useless (sorry but make many mistakes) but it uses only about 2/3 height of that of the bottom screens. The height of the bottom screens is almost same as 5-inches mobile phone. so a touch keyboard on 3ds will be not so useless and fast to input something.
     
  7. Eix

    Eix GBAtemp's Best Waifu (now lewd-ish)

    Member
    597
    1,007
    May 27, 2017
    United States
    Vanilmirth
    The linux 3ds keyboard isn't too bad if its a xl
    But I would prefer the hexeditor edit function for text editing if it had insert&delete
     
  8. SirNapkin1334

    SirNapkin1334 Renound Aritst

    Member
    768
    217
    Aug 20, 2017
    United States
    Near Crap Mountain
    Hey, I have a request for a script. Can someone please make a script that deletes all files on the SD card starting with ._ or . or ._. ? I would make it myself but I don't know the GM9 Language. Someone should make a guide.
     
  9. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    Doing that completely with a script is not possible now. but you can do like this to remove all files starting with "._" from the root of SD cards.

    find "0:/._*" $[delfile]
    rm -o -s $[delfile]
    find "0:/._*" $[delfile]
    rm -o -s $[delfile]
    ... Loop ...

    Here is a GodMode9 script collection thread. It's not a guide but may help you...
    https://gbatemp.net/threads/release-godmode9-scripts-megathread.482150/

    You can learn about GM9 script by looking HelloScript.gm9 in the release archive.

    Edit :
    Fix bad english
    Fix wrong syntax in example script (sorry)
     
    Last edited by windows_server_2003, Nov 6, 2017
  10. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    @d0k3
    https://github.com/windows-server-2003/GodMode9/tree/if-goto
    I don't make PR now, but question.
    Are there any fundamental issues in this code ?
    I think the only stuff can be an issue is using too much memoly and the firms' sizes increase too much.
    About variable "lbl_his" :
    1Byte(char) * (512(MAX_ARG_LEN for label name) + 1) * 256(maximum number of labels) = 128KB
    Original firm size (branch "new_make") : 495KB
    My branch's one (base branch "master") : 561KB

    It can be solved by limitting the number of label's name length to 32 or 64.
    I tested and I didn't find any bugs. even I coded, it was not so hard and you also could code and commit but you haven't. so there are some issues ?
     
    Last edited by windows_server_2003, Nov 4, 2017
  11. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    1,008
    418
    May 11, 2008
    United States
    I could do that easily if the "rm" command had a recurse function and supported wildcards. Maybe @d0k3 can add them, but I think he was avoiding wildcards for security reasons. If "find" had recurse, and we had "goto" I could have it do an endless "find" and "rm" loop that would delete them one by one and ultimately error out when it couldn't find any more files (windows_server_2003 kind of beat me to the punch with his suggestion). If he does add this functionality in the future, I would be more than happy to create such a clean-up script (and add it to my InScripted project, naturally). Maybe even make it an SSR for the extra apps menu.
     
    SirNapkin1334 likes this.
  12. SirNapkin1334

    SirNapkin1334 Renound Aritst

    Member
    768
    217
    Aug 20, 2017
    United States
    Near Crap Mountain
    Well, I'll then be voting for @d0k3 to add them, maybe under an unlock combo or something.
     
  13. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,704
    2,763
    Dec 3, 2004
    Gambia, The
    I had a quick look. Can you maybe clean up and squash the commit history a bit? Also, make sure to use spaces, not tabs. Mixed makes it badly readable.

    Hint: Try this...
    Code:
    git rebase -i head~6
     
    GilgameshArcher likes this.
  14. d0k3
    OP

    d0k3 3DS Homebrew Legend

    Member
    2,704
    2,763
    Dec 3, 2004
    Gambia, The
  15. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    1,008
    418
    May 11, 2008
    United States
    Sure. I was planning to have a look at it anyway. If it hadn't been announced right when I was putting the finishing touches on a new release of my AIO, I'd have started playing with it sooner.

    @windows_server_2003: Does the "goto" command automatically reset the "if" nest? I tried putting an "end" after a "label" to end the "if" after the jump but got an error. But that's good if it's clearing the "if" nest out automatically, because that's how I would want it to work anyway. Any chance you could possibly add a "choice" command while you're at it? You'll see why if you download the attachment (not that "filesel" does a terrible job).

    I started off simple. I did the old "Pick A Number" game ;) I tried it first with non-nested "if" commands and "goto" commands to skip an unconditional loop I setup for people that hit the B button (it reloads the selection menu -- you WILL pick a number :evil: ). Then I made a second one using else statements. @d0k3: I know you weren't planning on doing the "else" command, but, even with this simple game, it is clearly more efficient than ending every "if" section with a "goto" command. I've uploaded it in case anyone wants to check it out. The win/lose phrases have a bit of a retro-gaming twist -- they're taken from Contra, Super Ghouls & Ghosts, and SMB (keep in mind I was half awake, they seemed funnier then than now).

    I did notice one thing odd. I forgot to put quotes at the end of the echo line for 1 the first time, as I was rushing to get a test example typed up, but I still got the error when I picked 2 and 3. It seems kind-of strange that it would still process a line it's supposed to skip over. Still, nothing that seems like a deal-breaker so far.

    EDIT: Since the "if" command is fairly similar to the existing "chk" command parameter-wise, I'd suggest including the -u flag for the same reasons it was included with the "chk" command.
     

    Attached Files:

    Last edited by Kazuma77, Nov 8, 2017
  16. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    Thank you for bug report.
    For some reason, I can't build it by myself now so please try with latest commit and send me the build if you can. I used git on Android because of it.
    There are at least two new commits since you built it(at commit "Fix using too many memory and clean up", the FIRM's size decreased more than 100KB and became 4xxKB)
     
  17. zen

    zen Newbie

    Newcomer
    3
    0
    May 2, 2017
    United States
    hey guys,im trying to unlink my nnid using godmode but it doesnt seem to work,every time i check the 10038 folder an extra new 00000 file is created on top of my renamed 10000 one ,im running 11.6 with b9s 1.2 for reference
     
  18. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    1,008
    418
    May 11, 2008
    United States
    Then the file gets created automatically by the system software. There is nothing GM9 can do about that. The system WILL re-create system save files automatically. That's just natural behavior. The same thing happens if you delete your PTM save. A new one will be generated as soon as you boot CFW. That doesn't mean you failed to wipe your existing activity data. The system just created a new file to take the old one's place. The fact that it's creating a new NNID file does not mean that it is re-linking your NNID, it just needs something to be there. Just complete the rest of the steps for the guide you're using and you will probably see that it worked just fine.

    Yeah, that definitely made it smaller. Especially with me still using "-flto" in my Makefile (it was only removed to avoid compiling issues on some platforms, after all -- since mine has never had any, and it especially makes compiled SSRs much smaller than a regular GM9 build, I always add that back in). I've not tried building with Android, so, hard to say what it could be. I'm using "Cmder" with Emerge Desktop Windows 7 (the distinction was necessary, given how much better 7 is without Explorer). It avoids the need to install Git for Windows, and the less mess I can have in my Windows registry, the better. Anyway, here's your requested build. I'll test it in a little bit.

    EDIT: Looks like you broke the "else" command somehow. It's not working in the script that uses it. Apparently "skip" stays on until the "end" commands are reached. Also, you might want to just forget what I said about clearing the "if" nest with the "goto" command now that I see how these actually work (or at least, I think I do -- keep in mind I don't know any C at all). It will be cleared if I have the correct number of "end" commands anyway. I was thinking an "end" after a "goto" would be completely ignored, but now I see those lines are still being processed, just not acted upon if "skip" is set. The count is still being incremented and decremented even with "skip" on, so, I guess it's all good then.

    EDIT2: I found it -- line 906. You forgot the "[0]" that you used in your other "findlabel" checks for the other commands. Basically, "else" wasn't executing because it always thought a label search was going on. Fixed.

    EDIT3: I have uploaded the fix so that you can verify it works.

    EDIT4: I see you fixed it. I've uploaded the new build with your latest commit.
     

    Attached Files:

    Last edited by Kazuma77, Nov 10, 2017
  19. windows_server_2003

    windows_server_2003 Advanced Member

    Newcomer
    60
    10
    Jul 13, 2017
    Japan
    You got an unexpected error with that build and script ?
    It works fine for me...
    if not, please give me a script which shows an error.
    Anyway, is it fixed in the latest commit?

    -u flag...
    We got "else" but it's nice to add "-u" flag optional. I'll add it.

    "choice" command
    How to pass the list to show to "choice" command ?
    I know such selecting method isn't smart.
    For now, I'm testing if,else,end,... and make sure there are no bugs there. so I can't add that now, sorry.
     
  20. Kazuma77

    Kazuma77 GBAtemp Maniac

    Member
    1,008
    418
    May 11, 2008
    United States
    I think I just did not fully understand how the commands worked at the time. Everything seems fine with the current build.

    My reason for suggesting including the -u flag was for cases where you only need to do something when there is not a match. Case in point, checking the SHA on the secret sector when restoring a system to retail. You would not need to do anything if the hash checks, but you would need to try to replace it if it does not match. So, I would be following the "if" command with an immediate "else" command.

    I understand the "choice" command would be a difficult one to implement since the parameters would necessarily differ in number. Maybe it could get the list from a plain text file or something. I was just thinking it might be a bit cleaner than my current method -- using "filesel" with a folder containing zero byte files. It's OK though. I can place either in the VRAM image for most of my projects, so most people will never know the difference anyway.

    EDIT: Maybe a more advanced example is in order to really test this thing properly now. Here's the "Multiple TWLN Manager" I just added to InScripted R9, but as a single compiled SSR app instead of multiple scripts. Just like the original, it will enable you to create as many TWLN backups as you want, so you can simply save and switch when you run out of space for DSiWare. NOTE: I have had this crash once. It gave the error message for the option I selected, rebooted, when I tried to get it to go into GM9 it said there was no essentials backup, and the system shut down whether I told it to create one or not. But after waiting about 15 seconds to reboot the system, it went back to normal. This bug doesn't appear to be anything that will brick a console, just a memory overload or something. Hopefully someone can replicate the issue and figure out why it does it. That said, it only crashed that one time. It's fairly stable. Check it out. As usual, I've included the source in case anyone wants to modify it.
     

    Attached Files:

    Last edited by Kazuma77, Nov 10, 2017