Homebrew (3DS) How do I restart my Homebrew app with the press of a button?

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
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,

smileyhead

I like cute stuff.
Member
Joined
Aug 31, 2015
Messages
4,802
Trophies
3
Age
23
Location
Budakeszi, Hungary
Website
sites.google.com
XP
10,573
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.
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
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 :)
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
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.

--------------------- MERGED ---------------------------

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

zoogie

playing around in the end of life
Developer
Joined
Nov 30, 2014
Messages
8,560
Trophies
2
XP
15,000
Country
Micronesia, Federated States of
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.

--------------------- MERGED ---------------------------

I have been looking all over, and I just can't find any function to restart the app itself :D
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.
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
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
 

darkweb

Well-Known Member
Newcomer
Joined
Mar 15, 2020
Messages
45
Trophies
0
Age
39
XP
346
Country
Canada
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.

--------------------- MERGED ---------------------------

I have been looking all over, and I just can't find any function to restart the app itself :D
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?
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
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?

I WOULD, but I'm not as experienced in that area..
 

darkweb

Well-Known Member
Newcomer
Joined
Mar 15, 2020
Messages
45
Trophies
0
Age
39
XP
346
Country
Canada

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
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);

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)
 

darkweb

Well-Known Member
Newcomer
Joined
Mar 15, 2020
Messages
45
Trophies
0
Age
39
XP
346
Country
Canada
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)
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.
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
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.

I'll try it, and get back to you!
 

Momoro

The Dark One
OP
Member
Joined
Oct 7, 2019
Messages
111
Trophies
0
Age
45
XP
194
Country
United States
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.

So I tried it, and it works!! Thanks :)
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/@legolambs