melonDS icon indicating copy to clipboard operation
melonDS copied to clipboard

Showing actual battery levels in DS/DSi games

Open HilbertIdeals5 opened this issue 3 years ago • 8 comments
trafficstars

This is more of an enhancement suggestion than a bug. Pokémon Black 2 has a meter that shows the current battery level. It's always set to 100%, but I think it would be cool and useful (in Mac fullscreen, w/ no menu bar) to show the actual battery level of your laptop in-game?

HilbertIdeals5 avatar Dec 31 '21 22:12 HilbertIdeals5

I've been working on an interface that allows you to set the DS/DSi battery level. Currently it's a dialog box that allows you to select between the different levels for each (the DS only shows a low/okay battery level and the DSi has 5 states exposed - not counting Critical which issues a shutdown). I don't think syncing it with a laptop battery would be a useful feature, and it would just complicate things code-wise.

RayyanAnsari avatar Dec 31 '21 23:12 RayyanAnsari

Personally, I thought it would be useful because I find it annoying to have to look in some corner of the screen (or, on a Mac, drag my mouse all the way to the top of the screen) just to quickly know how much battery is left so I can save and stop playing or plug in my laptop.

I suppose that would be complex though; the code would probably need to be written separately for each OS's API for battery info, and it would have to run in the background and constantly check for changes. And having "Critical" sounds like might be an issue if it just completely shuts down whatever you're playing.

If it does get implemented, though, maybe it could be an extension that the user can toggle, so you can use the laptop's battery only if you want to. It would be a nice little gimmick.

HilbertIdeals5 avatar Dec 31 '21 23:12 HilbertIdeals5

I think it would be cool and useful (in Mac fullscreen, w/ no menu bar) to show the actual battery level of your laptop in-game?

This is genuinely a cute feature idea that would be cool to have haha

Wunkolo avatar Jan 01 '22 00:01 Wunkolo

It would be a nice feature, but there isn't a cross-platform way to get the device battery level. Apparently Qt has an add-on for this called QtSystems, but I can't find any docs and the last commit was 3 years ago.

"Critical" sounds like might be an issue if it just completely shuts down whatever you're playing.

I think I didn't explain clearly enough, but Critical is a DSi battery state that causes the DSi to turn off when the battery is really low. This isn't exposed in the UI but I'm adding the option to set it in code.

RayyanAnsari avatar Jan 01 '22 12:01 RayyanAnsari

We already have platform specific code, and surely getting the battery level on each platform (maybe except for Linux sysfs sadness) can't be that difficult.

nadiaholmquist avatar Jan 01 '22 12:01 nadiaholmquist

Windows: GetSystemPowerStatus macOS: Something to do with IOPowerSources.h Linux: Continuously read /sys/class/power_supply/battery/status And for FreeBSD and NetBSD I have no idea.

Looks like a lot of code to maintain for a little gimmick.

RayyanAnsari avatar Jan 01 '22 12:01 RayyanAnsari

There's no maintenance, how this works shouldn't ever change.

For BSD we can simply just not support it.

nadiaholmquist avatar Jan 01 '22 12:01 nadiaholmquist

There's no maintenance, how this works shouldn't ever change.

For BSD we can simply just not support it.

or support should be manually inputting values only.

upintheairsheep avatar Apr 25 '24 23:04 upintheairsheep

I was hoping the state of "charging" can be added to Bizhawk as an "on or off" switch.

It holds value when you want to manipulate RNG, for example, in M&S at the Winter Olympics.

It's more simple than showing the battery of the DS / DSi or a level of battery. I hope it's simple from a coding perspective or appealing in some way.

I'm not talking about the laptop, I'm talking about the console being charged. "Charging a console" doesn't make sense on emulator unless you use it to manipulate RNG. So it's understandably not a feature of Bizhawk.

I've been told Melon has a ui for that in upstream, so I thought it would be a cool suggestion. Even if it's a small thing

Chall-99 avatar Nov 27 '24 19:11 Chall-99

It holds value when you want to manipulate RNG, for example, in M&S at the Winter Olympics.

What other games do this, and how do people take advantage of it?

JesseTG avatar Nov 27 '24 19:11 JesseTG

I was hoping the state of "charging" can be added to Bizhawk as an "on or off" switch.

This is a request for BizHawk, which is not appropriate for this issue tracker. This issue is more for connecting host battery status to melon's now existing emulated battery status interface.

CasualPokePlayer avatar Nov 27 '24 19:11 CasualPokePlayer