Homebrew Homebrew app [Release] ftpsrv - A small ftp server

duckbill007

Well-Known Member
Member
Joined
May 5, 2011
Messages
855
Trophies
1
XP
3,033
Country
Russia
@ITotalJustice, Did you tested performance boost from such big TX/RX buffers? In my tests I got no more than 64Kb in single call to recv, unless I use MSG_WAITALL, but in that case some ftp client on android can not work properly.
 
  • Like
Reactions: impeeza

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
457
Trophies
1
Age
27
XP
2,859
Country
United Kingdom
In general, I can't even open the app, but I just realized that it only happens in applet mode.
I think I know what's causing this. I'll fix it when I finish work.
Post automatically merged:

@ITotalJustice, Did you tested performance boost from such big TX/RX buffers? In my tests I got no more than 64Kb in single call to recv, unless I use MSG_WAITALL, but in that case some ftp client on android can not work properly.
I can't remember at which point the buffer size no longer had impact on performance. I'm pretty sure I just set the buffer size to the biggest amount because why not, I have at minimum ~300mib to work with heh.

The biggest improvement was limiting the number of fs calls by buffer file r/w. This had a huge impact on writes, not so much on reads. The buffer size was 8mib, anything less affected performance, anything greater had no impact.

For the sys mod, I can't exactly buffer r/w, however I found that by setting the file size to large amount, such at 1mib, then writing to that file, re size by another 1mib if needed, had a huge improvement on performance. Internally, writing to a file in append mode calls setfilesize if it needs to grow. So by setting it in 1mib increments works around that. See vfs_nx.c, I have comments in there.

Using native fs over stdio had a minor impact on performance overall.
 
Last edited by TotalJustice,

duckbill007

Well-Known Member
Member
Joined
May 5, 2011
Messages
855
Trophies
1
XP
3,033
Country
Russia
The biggest improvement was limiting the number of fs calls by buffer file r/w. This had a huge impact on writes, not so much on reads. The buffer size was 8mib, anything less affected performance, anything greater had no impact.
Yes. I agree/ To achieve ~40MB/sec on FTP I had to buffer writes and also do in async in background thread.
 

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
457
Trophies
1
Age
27
XP
2,859
Country
United Kingdom
Testing for the first time the 1.1.2 version and so far working like a charm, I see

Code:
[Nx]
# enables showing all available mount points at root "/"
# for example, SdCard is as at "/sdmc:"
mount_devices = 1

# mounts the application save data, needs mount_devices = 1
save_application_id = 0x0100F2C0115B6000

# mounts the application bcat data, needs mount_devices = 1
bcat_application_id = 0x0100F2C0115B6000


on the config, but my client only shows:
View attachment 473289

I can no see the savegame mount, is a task to do or something is wrong on my config?
Post automatically merged:

By the way @TotalJustice Thanks a lot for all your work on the scene, you always give us excellent homebrew, you always are ready to teach us and share your knowledge.

Regards from Colombia.
is this application or sysmod? sysmod only mounts bcat, application can mount save. the reason for this is if the sysmod mounts the save data, then trying to launch the game whilst mounted will cause a crash.

the title id is from the config for zelda tears of the kingdom, do you have savedata for it?

if you are using application and have zelda savedata, then the only other thing that could fail is this https://github.com/ITotalJustice/ft...96781f083418d0fb1/src/platform/nx/main.c#L154

that function worked for me, so i didn't really think about all the ways it could fail. Do you have multiple profiles? Do you usually have to select which profile is to be used when launching a game?
 

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
457
Trophies
1
Age
27
XP
2,859
Country
United Kingdom
ftpsrv uses 0.39MB from mem pool vs 0.99MB of sys-ftp-light, it's a big gain if you have many sys-modules running
btw, if anyone needs a smaller build you can mess around with the options in the cmake file to make it smaller. you can reduce the max number of ftp sessions to 3 (do not go lower), lower the buffers from 16KiB to like 4KiB. those 2 changes would reduce it by a further ~21KiB, so down to 0.17MiB. Only do this if you are *really* struggling for space.
Post automatically merged:

https://github.com/ITotalJustice/ftpsrv/releases/tag/0.2.0

- [NX] reduced number of sessions to 128 so applet mode works.
- [NX] add led flashing, enabled via config.
- [NX] show that the user is in applet mode.
- add logging, enabled via config.
- add workaround clients sending -la -a for LIST. Fixes #2
- log filename on ftp error.

for those that want led flashing, see the config.ini.template.

the led will flash very quickly (12.5ms) a single time. hope you all like it.
 
Last edited by TotalJustice,

AlM2023

Active Member
Newcomer
Joined
Dec 17, 2023
Messages
42
Trophies
1
Age
37
XP
313
Country
Oman
is this application or sysmod? sysmod only mounts bcat, application can mount save. the reason for this is if the sysmod mounts the save data, then trying to launch the game whilst mounted will cause a crash.

the title id is from the config for zelda tears of the kingdom, do you have savedata for it?

if you are using application and have zelda savedata, then the only other thing that could fail is this https://github.com/ITotalJustice/ft...96781f083418d0fb1/src/platform/nx/main.c#L154

that function worked for me, so i didn't really think about all the ways it could fail. Do you have multiple profiles? Do you usually have to select which profile is to be used when launching a game?
Is there a way to mount all game data without listing all their IDs in the config file?
 
  • Like
Reactions: impeeza

HoRy205

Member
Newcomer
Joined
Jan 9, 2024
Messages
19
Trophies
0
Age
21
XP
253
Country
Japan
ftpsrv works great. I've completely migrated from ftpd. By the way, are there plans to start a thread dedicated to sphaira? There are mtp and ftp items in sphaira, but I don't know how to configure them to work. As for irs, I don't even know what it is.
Also, I'm Japanese and I want to translate sphaira. I'd be honored if I could help.
 
  • Like
Reactions: impeeza

impeeza

¡Kabito!
Member
Joined
Apr 5, 2011
Messages
8,192
Trophies
4
Age
46
Location
At my chair.
XP
28,019
Country
Colombia
How would you like it to work/look like?
Maybe the root, a list of your installed games:
1732899400167.png

and inside each game the players/system/BCAT folder

1732899569160.png


and inside each player folder the savegame files.
 
  • Like
Reactions: nitrozz

TotalJustice

Well-Known Member
OP
Member
Joined
Jan 28, 2017
Messages
457
Trophies
1
Age
27
XP
2,859
Country
United Kingdom
ftpsrv works great. I've completely migrated from ftpd. By the way, are there plans to start a thread dedicated to sphaira? There are mtp and ftp items in sphaira, but I don't know how to configure them to work. As for irs, I don't even know what it is.
Also, I'm Japanese and I want to translate sphaira. I'd be honored if I could help.
I guess I could create a thread for sphaira. Irs is the infrared camera on the joycon. Sphaira is full of random features because i was too lazy to create a new project and copy over my gui lib and set everything up, so any new features were added to sphaira instead.
Maybe the root, a list of your installed games:
View attachment 473497
and inside each game the players/system/BCAT folder

View attachment 473498

and inside each player folder the savegame files.
good idea. the name listing will only be possible in the app version as the only way (that i know) to retrieve the game name is using `nsGetApplicationControlData()` and the struct passed in is ~130KiB in size, which is massive as it returns the compressed jpeg as well sadly.

the sysmod version would instead just list the title id's of all the games instead.

this will take me a couple of days due to work keeping me busy :( and i will need to restructure the vfs code quite a bit.
 

impeeza

¡Kabito!
Member
Joined
Apr 5, 2011
Messages
8,192
Trophies
4
Age
46
Location
At my chair.
XP
28,019
Country
Colombia
the sysmod version would instead just list the title id's of all the games instead.
sad, but no problem at all.
Post automatically merged:

this will take me a couple of days due to work keeping me busy :( and i will need to restructure the vfs code quite a bit.
Don't worry, family and work are first! regards.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • Xdqwerty @ Xdqwerty:
    @K3Nv2, ok sorry
  • BigOnYa @ BigOnYa:
    I played like 20min of that ChoCho Charles and give up, didn't like it. It was on gamepass but its not now. You spend most of the game on the train shooting at the Spider-train behind you.
  • K3Nv2 @ K3Nv2:
    $4 seems pretty fair
    +1
  • BigOnYa @ BigOnYa:
    Don't you have gamepass still? Indiana Jones comes onto gamepass in 9 days. We got a couple patches and Stalker 2 is pretty awesome also.
  • K3Nv2 @ K3Nv2:
    Indie needs help
  • A @ anotherthing:
    I don't trust anything Indiana Jones after Crystal Skull.
  • BigOnYa @ BigOnYa:
    MachineGames made it so should be good, they did all the Wolfenstein games. Pre reviews look great so far.
    +1
  • A @ anotherthing:
    Obsidian did Fallout New Vegas and KotOR II, now look where they are.
  • BigOnYa @ BigOnYa:
    Outer Worlds was awesome. They making part 2 now even.
  • A @ anotherthing:
    It was pretty average.
  • A @ anotherthing:
    Which was shocking coming from Obsidian after hiring Tim Cain and Leon Boyarsky.
  • K3Nv2 @ K3Nv2:
    One of my buddies just got a pistol for 650 lol
  • BigOnYa @ BigOnYa:
    It sucked on the Switch, is great on the Series S/X tho, esp since they added a 4k 60fps patch for it.
  • A @ anotherthing:
    I have it on the Switch and PC.
  • A @ anotherthing:
    And yeah, it's awkward on the Switch for some reason.
    +1
  • A @ anotherthing:
    I got it used for $10, so it's worth having on the Switch for that much, just to take up space on the shelf.
    +1
  • A @ anotherthing:
    The controls just seem off on the Switch. And it doesn't even feel like lag.
    +1
  • kijetesantakalu042 @ kijetesantakalu042:
    games that end development shouldn't just become free, they should become open source.
  • A @ anotherthing:
    I think people might be horrified at what most code looks like from game developers these days.
    +2
  • K3Nv2 @ K3Nv2:
    Snoop about to live on music prime lol
  • MidTVU @ MidTVU:
    i need help, but i think its too small for a thread. How do I transfer a mii charcter from the Tomodachi collection ds game to the wii
  • MidTVU @ MidTVU:
    i want jack black on my island but dont feel like remaking him
  • Xdqwerty @ Xdqwerty:
    Good night
    +1
  • K3Nv2 @ K3Nv2:
    Bad night
    +1
    K3Nv2 @ K3Nv2: Bad night +1