LumaTeam / Luma3DS

Nintendo 3DS "Custom Firmware"
GNU General Public License v3.0
5.31k stars 561 forks source link

[Feature Request for Rosalina] Toggle power to Game Card slot #1202

Closed radical6 closed 2 years ago

radical6 commented 6 years ago

Similar to toggle LED and wireless already in Rosalina, would it be possible to toggle the power for the game card slot? Mainly for those DS flashcards that drain the battery even when not in use.

(I couldn't write on #752 since I'm not a collaborator.)

ghost commented 6 years ago

My fault— it was locked during a spam incident and I forgot to unlock it.

bel3atar commented 6 years ago

do r4s drain power even while not being used?

urherenow commented 6 years ago

Very little. I’m sure measurable though. Why don’t you test it? Fully charge, power on, unplug, and close the lid. See how long it takes to shut off empty, with a game cart, and with an R4. Compare the times.

gaiaweylyn commented 6 years ago

I don't know about R4s, but I know SuperCards have their own CPUs for emulation purposes. If this feature were possible it'd definitely be useful for those.

Nuck-TH commented 5 years ago

different r4s consume different current. also i can confirm that DSTWO consume much either if inactive, or when sleeping in DS game. btw DSTWO uses CPU not only for emulators, but for some other tasks. so turning off slot power would be useful.

upya4ko commented 5 years ago

I make some research. Have New3DS XL and cartridge R4 SDHC (r4isdhc.com), battery is not new. Testing algorithm: fully charge at off state (all night) ON and close lid, testing end when red blinking light off, accuracy +- 1H. New3DS XL WITHOUT R4 cartridge - 11 days, 23 hours New3DS XL WITH R4 cartridge - 2 days, 8 hours

In result - R4 drain battery MUCH faster.

urherenow commented 5 years ago

And while I accept that result (and always thought so anyway), we can’t cut the power to the card slot. If you do that, you can NEVER sleep in the middle of a game; it will assume you removed the cartridge. You can’t remove a cartridge in sleep mode without losing your spot in a game. The system will yell at you when you open the lid, warning you not to do that, and you’ll be back at the home menu.

upya4ko commented 5 years ago

I think means manually disable slot in Rosalina menu, just disable it when slot not used, to leave R4 in slot and not lost it on backpack or pocket.

Nuck-TH commented 5 years ago

yes, this request doesn't mean developing any advances powersaving algorytms, but merely ability to disable slot1 while not in use to keep flashcart stored in it.

profi200 commented 5 years ago

There are cmds which apparently do this but testing is needed to confirm if it really cuts power to the slot.

https://www.3dbrew.org/wiki/FS:CardSlotPowerOff

Update: Measured and confirmed it does cut off power completeley.

coolmccoolsons commented 5 years ago

There are cmds which apparently do this but testing is needed to confirm if it really cuts power to the slot.

https://www.3dbrew.org/wiki/FS:CardSlotPowerOff

Update: Measured and confirmed it does cut off power completeley.

how do you use this?

urherenow commented 5 years ago

Probably a better conversation for a forum or Discord. Either way, cutting power will cause problems if you cut it in sleep mode while actually running software from the card...

profi200 commented 5 years ago

There are cmds which apparently do this but testing is needed to confirm if it really cuts power to the slot. https://www.3dbrew.org/wiki/FS:CardSlotPowerOff Update: Measured and confirmed it does cut off power completeley.

how do you use this?

By writing code using these 2: https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/fs.h#L503-L513

[...]cutting power will cause problems if you cut it in sleep mode while actually running software from the card...

Rosalina doesn't work in sleep mode anyway. Can't reach these menu options while in sleep mode.

ParzivalWolfram commented 5 years ago

Is there any plans to implement this? It's stupidly hard to get cards in/out of SLOT-1 on my N3DS, and i'd like to preserve what little use it has left and not have to remove my R4 outright (which takes a stupid high amount of force and scrapes the card's contacts hard) every time it's not in use to save power.

Clydefrosch22 commented 4 years ago

If it's a possible option, I would really like it as well. My 3ds drains half its battery in 10 hours sleep mode. I've already turned off all wifi and spotpass and whatnot too

shizwz commented 4 years ago

Can I also add it would be beneficial to have this as an option that remains across power cycles. E.g. as non-volatile option in Luma config, with a Rosalina counterpart for on-the-go use.

For example I like to use my cart slot for games I also have installed, as a second save. E.g. I play a patched version of ultra sun and a non-patched version. Swapping between game patches off or on with fastboot 3ds key combos for NAND/SD. Oftentimes I don't even use the slot

DullPointer commented 4 years ago

There are cmds which apparently do this but testing is needed to confirm if it really cuts power to the slot. https://www.3dbrew.org/wiki/FS:CardSlotPowerOff Update: Measured and confirmed it does cut off power completeley.

how do you use this?

By writing code using these 2: https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/fs.h#L503-L513

[...]cutting power will cause problems if you cut it in sleep mode while actually running software from the card...

Rosalina doesn't work in sleep mode anyway. Can't reach these menu options while in sleep mode.

So I was getting my script-kiddy on to try and make a PoC for this, but unfortunately my game card is not recognized after switching the slot power back on. Sleep/unsleep doesn't change the recognition: only a reboot does. Any suggestions on how to force game card recognition? Also, any suggestions on how to block the power from being switched off when the card is in use? My crude solution was to block it if any title were running, but this is not ideal...

ParzivalWolfram commented 4 years ago

That's not really a massive issue, and could come in handy for some limited situations. I wouldn't really worry about people cutting slot power during use as it'd be a deliberate act anyways.

On Thu, Jul 30, 2020 at 3:20 PM DullPointer notifications@github.com wrote:

There are cmds which apparently do this but testing is needed to confirm if it really cuts power to the slot. https://www.3dbrew.org/wiki/FS:CardSlotPowerOff Update: Measured and confirmed it does cut off power completeley.

how do you use this?

By writing code using these 2: https://github.com/smealum/ctrulib/blob/master/libctru/include/3ds/services/fs.h#L503-L513

[...]cutting power will cause problems if you cut it in sleep mode while actually running software from the card...

Rosalina doesn't work in sleep mode anyway. Can't reach these menu options while in sleep mode.

So I was getting my script-kiddy on to try and make a PoC for this, but unfortunately my game card is not recognized after switching the slot power back on. Sleep/unsleep doesn't change the recognition: only a reboot does. Any suggestions on how to force game card recognition? Also, any suggestions on how to block the power from being switched off when the card is in use? My crude solution was to block it if any title were running, but this is not ideal...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LumaTeam/Luma3DS/issues/1202#issuecomment-666667388, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE6CQPILOAEBIZYLZRPLVTR6HIUZANCNFSM4GDBUHCA .

DullPointer commented 4 years ago

I guess it would be easy enough to write a warning against people cutting power in game. The downside of slot power being restored but the game card not being recognized is that you wouldn't be ab;e to set the power off by default in the Luma config settings and then toggle it back on from Rosalina when you want to play. Currently, you would either have to switch the power off via Rosalina each time you don't want to use to card and/or remember to change the Luma config on each boot to toggle it.

Update: I'm going to try and send the "Game cartridge inserted" notifications to the relevant processes :/ https://www.3dbrew.org/wiki/Services#Notifications

DullPointer commented 4 years ago

Bad news: Unfortunately, I don't have the skills/time yet to implement this as a configurable feature up to the quality standards of the Luma team. I might revisit if another bit of tinkering forces me to learn how to add to the Luman config file.

Sort of good news: I did some playing around but I couldn't find a way to force game cartridge recognition again without physically reinserting it or by rebooting. Sending the "Game cartridge inserted" notifications didn't work, probably because FSUSER_CardSlotIsInserted was already true. So there is no point having a toggle switch in the Rosalina menu. However, if the game cartridge is for DS then it will be found when booted into TWL mode (regardless of whether the slot power was switched off in 3DS mode). Therefore, a solution would be to switch the card slot power off only when a DS game cartridge is inserted and then use TWiLight Menu++ to access that DS game cartridge as needed. This wouldn't be to every user's taste though so it would need to be a configurable option...

PoC: https://github.com/DullPointer/Luma3DS/blob/54c02cf561e1dd2a6d40265d802f9aeb27be2068/sysmodules/rosalina/source/main.c#L256-L264

ParzivalWolfram commented 4 years ago

There's a TWL cart loader stub for home menus to bypass cart blacklists, would that work? I can link the CIA if need be.

On Mon, Aug 3, 2020, 2:34 PM DullPointer notifications@github.com wrote:

Bad news: Unfortunately, I don't have the skills/time yet to implement this as a configurable feature up to the quality standards of the Luma team. I might revisit if another bit of tinkering forces me to learn how to add to the Luman config file.

Sort of good news: I did some playing around but I couldn't find a way to force game cartridge recognition again without physically reinserting it or by rebooting. Sending the "Game cartridge inserted" notifications didn't work, probably because FSUSER_CardSlotIsInserted was already true. So there is no point having a toggle switch in the Rosalina menu. However, if the game cartridge is for DS then it will be found when booted into TWL mode (regardless of whether the slot power was switched off in 3DS mode). Therefore, a solution would be to switch the card slot power off only when a DS game cartridge is inserted and then use TWiLight Menu++ to access that DS game cartridge as needed. This wouldn't be to every user's taste though so it would need to be a configurable option...

PoC:

https://github.com/DullPointer/Luma3DS/blob/master/sysmodules/rosalina/source/main.c#L268-L276

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LumaTeam/Luma3DS/issues/1202#issuecomment-668203571, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE6CQJ2BG4NISRZUVXZU5LR64GMNANCNFSM4GDBUHCA .

DullPointer commented 4 years ago

There's a TWL cart loader stub for home menus to bypass cart blacklists, would that work? I can link the CIA if need be.

Is it legit to share? e.g. homebrew and not warez. If so, I could test it out. However, the PoC still might not be a satisfactory solution and it would definitely need to be a configurable option for official release.

ParzivalWolfram commented 4 years ago

It's homebrew, yes. I'll dig it up when I can find my 3DS.

On Tue, Aug 4, 2020 at 12:03 PM DullPointer notifications@github.com wrote:

There's a TWL cart loader stub for home menus to bypass cart blacklists, would that work? I can link the CIA if need be. Is it legit to share? e.g. homebrew and not warez. If so, I could test it out. However, the PoC still might not be a satisfactory solution and it would definitely need to be a configurable option for official release.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LumaTeam/Luma3DS/issues/1202#issuecomment-668714590, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE6CQJT2OHETGO4NURJTQLR7A5ORANCNFSM4GDBUHCA .

ParzivalWolfram commented 4 years ago

There's a TWL cart loader stub for home menus to bypass cart blacklists, would that work? I can link the CIA if need be.

Is it legit to share? e.g. homebrew and not warez. If so, I could test it out. However, the PoC still might not be a satisfactory solution and it would definitely need to be a configurable option for official release.

Backups got obliterated, but it's still online. https://gbatemp.net/threads/twl-slot-1-launcher-first-custom-dsiware-app.414501/

DullPointer commented 4 years ago

Backups got obliterated, but it's still online. https://gbatemp.net/threads/twl-slot-1-launcher-first-custom-dsiware-app.414501/

I can confirm that that CIA works as a way to force boot into a DS cartridge, even when the card slot power is switched off in 3DS mode.

ParzivalWolfram commented 4 years ago

Stopgap solution found, then. Is it useful for fixing Rosalina, however?

On Fri, Aug 7, 2020 at 2:21 PM DullPointer notifications@github.com wrote:

Backups got obliterated, but it's still online.

https://gbatemp.net/threads/twl-slot-1-launcher-first-custom-dsiware-app.414501/

I can confirm that that CIA works as a way to force boot into a DS cartridge, even when the card slot power is switched off in 3DS mode.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/LumaTeam/Luma3DS/issues/1202#issuecomment-670674009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE6CQI75E4JVCUSY3SAHYDR7RH4HANCNFSM4GDBUHCA .

1alien1 commented 3 years ago

any news on this? i read through the whole posts here but i have no clue on how to implement the code that dullpointer used...can anybody point me on how to do it? the part about the cia i understood, so i would only have to somehow install the code in order to toggle power off. im using my dstwo in a closed case which i have to remove every time to get the card out and this would be awesome! please help :)

Backups got obliterated, but it's still online. https://gbatemp.net/threads/twl-slot-1-launcher-first-custom-dsiware-app.414501/

I can confirm that that CIA works as a way to force boot into a DS cartridge, even when the card slot power is switched off in 3DS mode.

TheNamelessWonderer commented 2 years ago

This is great but any way to make it persist between reboots? Every time the console is restarted power is re-enabled to the cart even if you have no intention of playing it.

profi200 commented 2 years ago

Iirc if you cut power automatically via this service call on boot it will stop recognizing all gamecards completely even if you swap them. This could confuse people thinking their slot is broken.

ParzivalWolfram commented 2 years ago

If memory serves, the DSiWare SLOT-1 forwarder works even when the slot is disabled, so there's probably some way around that.

On Sun, Jun 5, 2022, 7:33 AM profi200 @.***> wrote:

Iirc if you cut power automatically via this service call on boot it will stop recognizing all gamecards completely even if you swap them. This could confuse people thinking their slot is broken.

— Reply to this email directly, view it on GitHub https://github.com/LumaTeam/Luma3DS/issues/1202#issuecomment-1146796371, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHE6CQINKMOE5RWA36427PDVNSNAJANCNFSM4GDBUHCA . You are receiving this because you commented.Message ID: @.***>

profi200 commented 2 years ago

@ParzivalWolfram I assume that doesn't even try to detect if anything is in the card slot before booting to DS(i) mode so i would not count that. I was talking about detection in 3DS mode.

JimPix1 commented 11 months ago

This is great but any way to make it persist between reboots? Every time the console is restarted power is re-enabled to the cart even if you have no intention of playing it.

Seconded