EnderdracheLP / ClockMod

A Quest Beat Saber mod that displays the time in the menus.
20 stars 3 forks source link

Feature request: show battery percentage #3

Closed jacobgb24 closed 3 years ago

jacobgb24 commented 3 years ago

I thought it could be useful to show the quest's battery percentage in addition to the clock. That way you wouldn't have to leave beat saber to check.

Never done quest development, so I have no idea how feasible this is. Just an idea though

michael-r-elp commented 3 years ago

I don't think it's possible to get the battery percentage from within beat saber, as that is information not contained within beat saber. It would probably also be beyond my coding skill level to implement, if it would be possible.

I will leave this open, incase I'm wrong and it somehow turns out to be possible, it sure is a pretty good idea.

jacobgb24 commented 3 years ago

Oh, I didn't realize that mods are limited to only accessing what's available in beat saber, but that makes sense.

One avenue that could work is going through Unity. I saw the modding guide mentions that the entire unity scripting api is available, and it looks like they have a method for getting the battery level: https://docs.unity3d.com/ScriptReference/SystemInfo-batteryLevel.html

michael-r-elp commented 3 years ago

That might actually be worth a look, thanks

michael-r-elp commented 3 years ago

Oh, I didn't realize that mods are limited to only accessing what's available in beat saber, but that makes sense.

One avenue that could work is going through Unity. I saw the modding guide mentions that the entire unity scripting api is available, and it looks like they have a method for getting the battery level: https://docs.unity3d.com/ScriptReference/SystemInfo-batteryLevel.html

I took a look, and there is no mention of batteryLevel within UnityEngine.SystemInfo shipped with codegen, but it does seem to have references to battery on OVR. https://github.com/sc2ad/BeatSaber-Quest-Codegen/search?q=battery

Seems that is where the information is located: https://github.com/sc2ad/BeatSaber-Quest-Codegen/search?q=ovrp_GetSystemBatteryLevel%28%29%3B

michael-r-elp commented 3 years ago

Can now confirm that I'm able to get Battery Percentage information displayed ingame using GlobalNamespace::OVRPlugin::OVRP_1_1_0::ovrp_GetSystemBatteryLevel();, not looking nice yet though, will hopefully be in ClockMod 0.1.3 if I can get it displayed nicely.

jacobgb24 commented 3 years ago

That's awesome to hear! I'm looking forward to the next release

michael-r-elp commented 3 years ago

I have a Pre-Release Build uploaded on Github for you to try out, any feedback or suggestions would be welcome. https://github.com/EnderdracheLP/ClockMod/releases/tag/0.1.3-Pre2

The Battery Percentage will be on the right of the clock for the moment. If you know for a better place for the battery percentage let me know. I'm somewhat thinking having it maybe below the clock and maybe somewhat smaller.

jacobgb24 commented 3 years ago

I was originally thinking below the clock as well, but it's already fairly tight on vertical space as it is (especially with the default font size). I think it looks fine on the right, and that avoids potential overlaps.

michael-r-elp commented 3 years ago

Yeah, I did try it below for a short time, but by default it has a weird spacing between the time and the battery percentage, so far this seems to be the best solution for the time being.