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,804
Trophies
3
Age
23
Location
Budakeszi, Hungary
Website
sites.google.com
XP
10,591
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
  • Psionic Roshambo @ Psionic Roshambo:
    I would like a Predator game "Kill Team" it takes place in the Jungle of the first movie, your team is sent to hunt the predator, using current tech drones and a trained team. Set traps use strategy to hunt and trap or kill the predator.
  • BigOnYa @ BigOnYa:
    Ill stick with my Battlefield. Yea a predator hunting game like that would be cool. Esp if you can be Arnold and say "Get to da choppa"
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Maybe Arnold could do a cameo voice acting, he is the one briefing you on the mission
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Honestly surprised they didn't make a tie in game for Predators that movie was awesome
  • Psionic Roshambo @ Psionic Roshambo:
    I was kinda sad the Yakuza guy died sword fighting a predator lol
  • Psionic Roshambo @ Psionic Roshambo:
    The Russian guy went out like a boss
  • Psionic Roshambo @ Psionic Roshambo:
    Double claymores to the face definitely kill a predator lol
  • BigOnYa @ BigOnYa:
    I went today and looked at a motorcycle someone was selling. I get there and the battery on it was dead, so the guy grabbed a battery charger and hooked it up. He plugged it into the wall, and the motorcycle sparked and started smoking. Come to find out the bike uses a 6 volt battery and the guy had the charger set to 12v. I said sorry to the dude and walked away. I felt bad for him tho.
  • Psionic Roshambo @ Psionic Roshambo:
    Sounds like it would be an exciting ride....
  • Psionic Roshambo @ Psionic Roshambo:
    Not sure I would want something on fire between my legs
  • BigOnYa @ BigOnYa:
    He ruined it basically. Sad cause it was a decent old bike. It would take more money to rewire the bike than it was worth tho.
  • Psionic Roshambo @ Psionic Roshambo:
    Yeah I'm sure at minimum the starter was fried
  • Psionic Roshambo @ Psionic Roshambo:
    Alternator and battery
  • BigOnYa @ BigOnYa:
    Prob alot of fried parts. It was still smoking when I left.
  • K3Nv2 @ K3Nv2:
    I would've said show me how it rides
  • Psionic Roshambo @ Psionic Roshambo:
    I always wanted one of those Smart Cars with a Hyabusa motor in it.
  • K3Nv2 @ K3Nv2:
    I'm getting sick and tired of cheap ass baking pans now
  • BigOnYa @ BigOnYa:
    I think it be cool to have one that would fit in my pickup truck bed, then I could put down ramps n drive it off.
  • K3Nv2 @ K3Nv2:
    Used this one 5 times already impossible to clean
  • BigOnYa @ BigOnYa:
    You need the $900 copper coated ones, they are good for 10 times cooking before they are un cleanable
  • Psionic Roshambo @ Psionic Roshambo:
    Condoms are only meant to be used once Ken lol
  • K3Nv2 @ K3Nv2:
    Well damn that explains how you were born
    Psionic Roshambo @ Psionic Roshambo: Lol