Skip to content

Commit

Permalink
Added battery function on win32 also (defaulting to val 50) useful fo…
Browse files Browse the repository at this point in the history
…r theme testing
  • Loading branch information
proconsule committed Feb 27, 2022
1 parent 0a3427c commit 5595a86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 1 addition & 3 deletions include/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ namespace Utility{
int getLanguagesIdx(std::string lang);

void replace(std::string& subject, const std::string& search,const std::string& replace);
#ifdef __SWITCH__
u32 GetBatteryPercentage(void);
#endif
uint32_t GetBatteryPercentage(void);
std::string scrapElement(std::string content, std::string get,std::string delim);
std::string KeyboardCall (std::string hint="", std::string text="");
std::string Nozomi_Link(std::string Link);
Expand Down
4 changes: 2 additions & 2 deletions source/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -996,9 +996,9 @@ namespace GUI {
changeFontTheme();
dochangethemefont = false;
}
#ifdef __SWITCH__

batteryPorcent = Utility::GetBatteryPercentage();
#endif


#ifdef NXMP_SWITCH
//rewrite switch state
Expand Down
9 changes: 6 additions & 3 deletions source/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -506,17 +506,20 @@ SwkbdTextCheckResult Keyboard_ValidateText(char *string, size_t size) {
return SwkbdTextCheckResult_OK;
}
#endif
uint32_t GetBatteryPercentage(void) {
#ifdef _WIN32
return 50;
#endif
#ifdef __SWITCH__
u32 GetBatteryPercentage(void) {
Result ret = 0;
u32 percentage = 0;

if (R_FAILED(ret = psmGetBatteryChargePercentage(&percentage)))
return 0;

return percentage;
}
#endif
}
std::string KeyboardCall (std::string hint, std::string text){
#ifdef __SWITCH__
Result ret = 0;
Expand Down

0 comments on commit 5595a86

Please sign in to comment.