1. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    Hi!

    I am creating a simple Homebrew app in C++, but I am stuck - I have a file-check, and if the file does not exist, the app will tell the user, then restart. (Not the system!)

    How would I restart the Homebrew app while it is running? Or is it not possible at all?

    I can provide more info if it is needed.

    Thanks :)
     
    Last edited by Momoro, Mar 13, 2020
  2. smileyhead

    smileyhead This is definitely not a robotic component!
    Member

    Joined:
    Aug 31, 2015
    Messages:
    4,235
    Country:
    Hungary
    I know this doesn't really answer your question, but if a file's missing, why restart? You'll be back in the same place with the file still missing.
    If it's not a file the user has to get themselves, your program can create it and then carry on like normal.
     
  3. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    Well, what the program does is edit an already-existing GBA file,(I already coded the editing part) and if the GBA file does not exist, the program would restart itself. Sorry if I was unclear :)
     
  4. smileyhead

    smileyhead This is definitely not a robotic component!
    Member

    Joined:
    Aug 31, 2015
    Messages:
    4,235
    Country:
    Hungary
    But if the program restarts due to the file being missing, it will still be missing when the program tries again.
     
  5. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    Yes, but the user is prompted to type in the directory every time, so it wouldn't be missing every time, unless the user decides not provide the file, and just keep typing the same directory.

    — Posts automatically merged - Please don't double post! —

    I have been looking all over, and I just can't find any function to restart the app itself :D
     
  6. zoogie

    zoogie playing around in the dsiware
    Developer

    Joined:
    Nov 30, 2014
    Messages:
    8,016
    Country:
    Micronesia, Federated States of
    It's really difficult to follow your logic here, but whatever it is, just reset the entered data, not the whole app.
    Rebooting the app is possible but the process differs between homebrew entry points, and it will just make things messy and more difficult to go that way.
     
    ry755 and smileyhead like this.
  7. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    I would reset the data, but I am also allowing the user to edit NDS files, and they can choose from a list,(GBA or NDS) but at the moment, I have no way of "resetting the data" and going back to the selection menu. So I was thinking that rebooting the app would be better :D
     
  8. darkweb

    darkweb Member
    Newcomer

    Joined:
    Mar 15, 2020
    Messages:
    10
    Country:
    Canada
    It would be a bit more work but instead of restarting the app, could you bring up a file browser similar to FBI on startup so that they select the file rather than the directory?
     
  9. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    I WOULD, but I'm not as experienced in that area..
     
  10. darkweb

    darkweb Member
    Newcomer

    Joined:
    Mar 15, 2020
    Messages:
    10
    Country:
    Canada
    Just looking at the libctru source (
    https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/fs.h) you should be able to read a directory using:
    Code:
    Result FSUSER_OpenDirectory(Handle *out, FS_Archive archive, FS_Path path)
    Result FSDIR_Read(Handle handle, u32* entriesRead, u32 entryCount, FS_DirectoryEntry* entries);
    
     
  11. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    I saw that, but does it print the directories to the screen, like FBI or GodMode9? I would use this if it had a better UI.. I've been trying all day but can't seem to figure out how to get the same output as FBI.. (You know.. Giving the user the option to view folders, etc. like File Explorer)
     
  12. darkweb

    darkweb Member
    Newcomer

    Joined:
    Mar 15, 2020
    Messages:
    10
    Country:
    Canada
    Ah yeah you'll need to create a UI for it. I just took a look around and you could probably leverage the UI code from CTRXplorer as a baseline and then just remove all of the extra features such as rename, copy, etc.

    https://gbatemp.net/threads/release-ctrxplorer-open-source-sd-file-manager.390353/

    It's not using the calls from libctru but it is using standard POSIX calls such as opendir and readdir which should do the same thing.
     
  13. Momoro

    OP Momoro Member
    Newcomer

    Joined:
    Oct 7, 2019
    Messages:
    15
    Country:
    United States
    I'll try it, and get back to you!
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - Homebrew, restart, button