Homebrew Question unused writable ram?

  • Thread starter Deleted User
  • Start date
  • Views 1,947
  • Replies 14
D

Deleted User

Guest
OP
Hello,
I recently wanted to make a Homebrew connecting to another one.
but writing a text file is silly assfuck i mean you can just edit it.
so i thought about writing the memory into ram.
but then i have the problem that the ram could be overwritten by Horizon.
so does anybody know a location where i can write ram and it cant get overwritten.
and on switchbrew stands the memory layout but for every new version a new table.
and this is only for 1.x.x - 6.x.x. so i hope someone knows.
and if this doesnt work how does it work with Freebird and Freeset
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
Very few things will work this way any more. Way way way back in the day (DOS era, and even then it was a dubious practice) on X86 it would be referred to as terminate and stay resident (TSR). Nothing today will really do this, and if it does it is usually considered a bug which can lead to some odd behaviours or a security risk.

Your options as I see it are
1) as the Switch is technically a multi tasking device you could try to have another super small program launch, speak to the program you want while it is active, stay running and then have the next program speak to it. I don't know what multitasking is like for the homebrew Switch these days though.
2) You introduce an extra service on the Switch that stays running in the background and speak to that to have it save your data.
3) Rather than write a file you write to the network somewhere to have it pop back out when it needs it (some types of save dumping on other devices do this).
4) Just write a file. Barring stuff like 1) then it is what everybody does these days. If have not checked the Switch to see if it has a /tmp ( https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained ) type section of memory going on that you could use for this if you are really reluctant to write to the SD.
 
D

Deleted User

Guest
OP
Very few things will work this way any more. Way way way back in the day (DOS era, and even then it was a dubious practice) on X86 it would be referred to as terminate and stay resident (TSR). Nothing today will really do this, and if it does it is usually considered a bug which can lead to some odd behaviours or a security risk.

Your options as I see it are
1) as the Switch is technically a multi tasking device you could try to have another super small program launch, speak to the program you want while it is active, stay running and then have the next program speak to it. I don't know what multitasking is like for the homebrew Switch these days though.
2) You introduce an extra service on the Switch that stays running in the background and speak to that to have it save your data.
3) Rather than write a file you write to the network somewhere to have it pop back out when it needs it (some types of save dumping on other devices do this).
4) Just write a file. Barring stuff like 1) then it is what everybody does these days. If have not checked the Switch to see if it has a /tmp ( https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained ) type section of memory going on that you could use for this if you are really reluctant to write to the SD.
so
1) there is no way to load both homebrews with the normal hbl as far as i see right?
2) dont i need a complete CFW for that
3) yea that would be a idea but what if user wants to play in his car where he doesnt have a Network...
4) does the switch have a linux file struct? i mean its horizon

so hard?
 

Dichotomy754

Well-Known Member
Member
Joined
Nov 11, 2018
Messages
154
Trophies
0
Age
33
XP
671
Country
United States
so
1) there is no way to load both homebrews with the normal hbl as far as i see right?
2) dont i need a complete CFW for that
3) yea that would be a idea but what if user wants to play in his car where he doesnt have a Network...
4) does the switch have a linux file struct? i mean its horizon

so hard?
2) On the switch you'd be looking at something called a sys module. You can find some examples basically at the top of the list here https://wiki.gbatemp.net/wiki/List_of_Switch_homebrew_applications
 

chaoskagami

G̷̘̫̍̈́̊̓̈l̴̙͔̞͠i̵̳͊ţ̸̙͇͒̓c̵̬̪̯̥̳͒͌̚h̵̹̭͛̒̊̽̚
Developer
Joined
Mar 26, 2016
Messages
1,365
Trophies
1
Location
↑↑↓↓←→←→BA
Website
github.com
XP
2,262
Country
United States
so
1) there is no way to load both homebrews with the normal hbl as far as i see right?
2) dont i need a complete CFW for that
3) yea that would be a idea but what if user wants to play in his car where he doesnt have a Network...
4) does the switch have a linux file struct? i mean its horizon

so hard?

1 - There's no way to load two homebrews, no. But first - why is two homebrews the solution to your problem? Could threads or files solve the issue instead? A cleverly constructed argv?

3 - Then use the switch's IPC and write a system module that's backed by memory or a file. That's what freebird does.

4 - I'm assuming you mean file handles, because there are two functions that return such a thing; fopen and open. One returns an opaque struct that you never tamper with, and the other returns a fd (which is an integer.) I fail to see how this would help you.

Very few things will work this way any more. Way way way back in the day (DOS era, and even then it was a dubious practice) on X86 it would be referred to as terminate and stay resident (TSR). Nothing today will really do this, and if it does it is usually considered a bug which can lead to some odd behaviours or a security risk.

Your options as I see it are
1) as the Switch is technically a multi tasking device you could try to have another super small program launch, speak to the program you want while it is active, stay running and then have the next program speak to it. I don't know what multitasking is like for the homebrew Switch these days though.
2) You introduce an extra service on the Switch that stays running in the background and speak to that to have it save your data.
3) Rather than write a file you write to the network somewhere to have it pop back out when it needs it (some types of save dumping on other devices do this).
4) Just write a file. Barring stuff like 1) then it is what everybody does these days. If have not checked the Switch to see if it has a /tmp ( https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained ) type section of memory going on that you could use for this if you are really reluctant to write to the SD.

1) You can have multiple threads in a single homebrew and pass arguments when launching other homebrew but you cannot run more than one at a time (unless you count running as a game and under an applet simultaneously, but that's sandboxed and fails the OP's requirements.)

4) The switch does not have any form of tmpfs as far as I am aware, and even if it did, there's no mmap equivalent that would allow mapping said file into memory without properly reading it as a file first.
 
Last edited by chaoskagami,

hippy dave

BBMB
Member
Joined
Apr 30, 2012
Messages
9,789
Trophies
2
XP
28,227
Country
United Kingdom
A cleverly constructed argv?
I mean yeah, you (OP) haven't given much detail on when the "connecting" between the apps takes place - if one is to be run immediately after the other, then passing an argument sounds great. If the first program just finishes and then the user loads the second one whenever they're ready, then argument passing doesn't sound so feasible, so you'd probably go with either the sysmodule or just writing a file. Add some basic encryption/signature if you really don't want it edited.
 
D

Deleted User

Guest
OP
I mean yeah, you (OP) haven't given much detail on when the "connecting" between the apps takes place - if one is to be run immediately after the other, then passing an argument sounds great. If the first program just finishes and then the user loads the second one whenever they're ready, then argument passing doesn't sound so feasible, so you'd probably go with either the sysmodule or just writing a file. Add some basic encryption/signature if you really don't want it edited.
yea encrypted file was my thought too.
 

smf

Well-Known Member
Member
Joined
Feb 23, 2009
Messages
6,638
Trophies
2
XP
5,835
Country
United Kingdom
I can just as easily edit your encrypted file or ram, what exactly are you trying to achieve & why are you so bothered if someone edits it?
 
  • Like
Reactions: chaoskagami

chaoskagami

G̷̘̫̍̈́̊̓̈l̴̙͔̞͠i̵̳͊ţ̸̙͇͒̓c̵̬̪̯̥̳͒͌̚h̵̹̭͛̒̊̽̚
Developer
Joined
Mar 26, 2016
Messages
1,365
Trophies
1
Location
↑↑↓↓←→←→BA
Website
github.com
XP
2,262
Country
United States
yea encrypted file was my thought too.

The reality is if you do any crypto locally, someone can derive the keys and work around it. See: Nintendo, Atmosphere.

I think you're trying to solve the wrong problem here. Take a step back and think about what you're really trying to do here, because chances are this is the wrong approach to whatever your "problem" is (and since you won't explain at all, it's impossible to offer any advice. Aside from that, I probably wouldn't use anything you coded just based on this thread, no offense.)
 
Last edited by chaoskagami,
  • Like
Reactions: gnmmarechal
D

Deleted User

Guest
OP
The reality is if you do any crypto locally, someone can derive the keys and work around it. See: Nintendo, Atmosphere.

I think you're trying to solve the wrong problem here. Take a step back and think about what you're really trying to do here, because chances are this is the wrong approach to whatever your "problem" is (and since you won't explain at all, it's impossible to offer any advice. Aside from that, I probably wouldn't use anything you coded just based on this thread, no offense.)
i know but how ever why should someone want to crack a HB port?
 

chaoskagami

G̷̘̫̍̈́̊̓̈l̴̙͔̞͠i̵̳͊ţ̸̙͇͒̓c̵̬̪̯̥̳͒͌̚h̵̹̭͛̒̊̽̚
Developer
Joined
Mar 26, 2016
Messages
1,365
Trophies
1
Location
↑↑↓↓←→←→BA
Website
github.com
XP
2,262
Country
United States
i know but how ever why should someone want to crack a HB port?

Because they can?

If you can't answer any of these questions, I'm just not going to bother replying any further. You're making it difficult to impossible to help you, since none of us have any clue what problem you're even trying to solve here. You're being so vague that we have nothing to work with here.
 
  • Like
Reactions: gnmmarechal
D

Deleted User

Guest
OP
Because they can?

If you can't answer any of these questions, I'm just not going to bother replying any further. You're making it difficult to impossible to help you, since none of us have any clue what problem you're even trying to solve here. You're being so vague that we have nothing to work with here.
well i always think mmh. they cracked it... new version and all the work was for nothing
 

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,284
Country
United Kingdom
well i always think mmh. they cracked it... new version and all the work was for nothing
What chaoskagami said -- most of us are all for abstract discussions (see me wittering on about TSR above) but at this point it is all a bit too abstract. I am not even sure if we are talking about having a program immediately pass off the info to another program (in which case having some fun with the call arguments is probably the way) and have it do something or have it all happen at some essentially arbitrary point in the future (in which case we are back to the abstract things I started on about, and apparently with the nature of things here some of those are not so viable compared to a more traditional computing setup).

Most things that would need a security focus have already been solved, or largely solved. Might be a new example of the concept that has never been done before, however the abstract is a different matter; pretty sure nobody made a DS application to speak to my small local bank to do online accounting, does not mean online banking application is not a largely solved issue though. That sort of thing we are more likely to at least be able to point you at something to handle it.
 
  • Like
Reactions: chaoskagami

smf

Well-Known Member
Member
Joined
Feb 23, 2009
Messages
6,638
Trophies
2
XP
5,835
Country
United Kingdom
Most things that would need a security focus have already been solved, or largely solved.

I get the impression it wasn't a security thing, more that he couldn't cope with the potential that someone might look at or modify his variables. But as he couldn't even cope with giving any information about it, then we'll never know for sure.

I kinda agree that putting things in files to pass between programs is not ideal when they could be part of the same program or at least do some more modern IPC, encrypting it doesn't make it more ideal. Storing stuff in unallocated ram and hoping it stays there is even less ideal, I second the opinion that I wouldn't want to run any thing like that.

Apparently someone else has figured it out, whatever it was.
 
Last edited by smf,
  • Like
Reactions: chaoskagami

eyeliner

Has an itch needing to be scratched.
Member
Joined
Feb 17, 2006
Messages
2,879
Trophies
2
Age
44
XP
5,468
Country
Portugal
Hello,
I recently wanted to make a Homebrew connecting to another one.
but writing a text file is silly assfuck i mean you can just edit it.
so i thought about writing the memory into ram.
but then i have the problem that the ram could be overwritten by Horizon.
so does anybody know a location where i can write ram and it cant get overwritten.
and on switchbrew stands the memory layout but for every new version a new table.
and this is only for 1.x.x - 6.x.x. so i hope someone knows.
and if this doesnt work how does it work with Freebird and Freeset
Explain the rectal fornication part. I am intrigued at how your homebrew could open up vast amounts of enjoyment to rectal fornicators out there.
Thank you.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @salazarcosplay, Morning