Skip to content

Commit e31acf7

Browse files
committed
feat: sync latest sys-botbase changes
1 parent 0d86b3f commit e31acf7

File tree

2 files changed

+36
-41
lines changed

2 files changed

+36
-41
lines changed

sys-botbaseplus/source/constants.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
using namespace BotBasePlus;
44

5-
const std::string Constants::version = "0.1.0";
5+
const std::string Constants::version = "0.1.1";

sys-botbaseplus/source/main.cpp

Lines changed: 35 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ extern "C"
8585
setsysExit();
8686
}
8787
}
88-
rc = fsInitialize();
89-
if (R_FAILED(rc))
90-
fatalThrow(rc);
91-
rc = fsdevMountSdmc();
92-
if (R_FAILED(rc))
93-
fatalThrow(rc);
94-
rc = timeInitialize();
95-
if (R_FAILED(rc))
96-
fatalThrow(rc);
9788
rc = pmdmntInitialize();
9889
if (R_FAILED(rc))
9990
{
@@ -119,21 +110,14 @@ extern "C"
119110
rc = viInitialize(ViServiceType_Default);
120111
if (R_FAILED(rc))
121112
fatalThrow(rc);
122-
rc = lblInitialize();
123-
if (R_FAILED(rc))
124-
fatalThrow(rc);
125113
}
126114

127115
void __appExit(void)
128116
{
129-
fsdevUnmountAll();
130-
fsExit();
131117
smExit();
132118
audoutExit();
133-
timeExit();
134119
socketExit();
135120
viExit();
136-
lblExit();
137121
}
138122
}
139123

@@ -171,7 +155,7 @@ int argmain(int argc, char **argv)
171155
if (argc == 0)
172156
return 0;
173157

174-
//peek <address in hex or dec> <amount of bytes in hex or dec>
158+
// peek <address in hex or dec> <amount of bytes in hex or dec>
175159
if (!strcmp(argv[0], "peek"))
176160
{
177161
if (argc != 3)
@@ -264,7 +248,7 @@ int argmain(int argc, char **argv)
264248
Commands::peekMulti(offsets, sizes, itemCount);
265249
}
266250

267-
//poke <address in hex or dec> <amount of bytes in hex or dec> <data in hex or dec>
251+
// poke <address in hex or dec> <amount of bytes in hex or dec> <data in hex or dec>
268252
if (!strcmp(argv[0], "poke"))
269253
{
270254
if (argc != 3)
@@ -305,7 +289,7 @@ int argmain(int argc, char **argv)
305289
free(data);
306290
}
307291

308-
//click <buttontype>
292+
// click <buttontype>
309293
if (!strcmp(argv[0], "click"))
310294
{
311295
if (argc != 2)
@@ -314,7 +298,7 @@ int argmain(int argc, char **argv)
314298
Commands::click(key);
315299
}
316300

317-
//hold <buttontype>
301+
// hold <buttontype>
318302
if (!strcmp(argv[0], "press"))
319303
{
320304
if (argc != 2)
@@ -323,7 +307,7 @@ int argmain(int argc, char **argv)
323307
Commands::press(key);
324308
}
325309

326-
//release <buttontype>
310+
// release <buttontype>
327311
if (!strcmp(argv[0], "release"))
328312
{
329313
if (argc != 2)
@@ -332,7 +316,7 @@ int argmain(int argc, char **argv)
332316
Commands::release(key);
333317
}
334318

335-
//setStick <left or right stick> <x value> <y value>
319+
// setStick <left or right stick> <x value> <y value>
336320
if (!strcmp(argv[0], "setStick"))
337321
{
338322
if (argc != 4)
@@ -354,7 +338,7 @@ int argmain(int argc, char **argv)
354338

355339
int dxVal = strtol(argv[2], NULL, 0);
356340
if (dxVal > JOYSTICK_MAX)
357-
dxVal = JOYSTICK_MAX; //0x7FFF
341+
dxVal = JOYSTICK_MAX; // 0x7FFF
358342
if (dxVal < JOYSTICK_MIN)
359343
dxVal = JOYSTICK_MIN; //-0x8000
360344
int dyVal = strtol(argv[3], NULL, 0);
@@ -366,13 +350,13 @@ int argmain(int argc, char **argv)
366350
Commands::setStickState(side, dxVal, dyVal);
367351
}
368352

369-
//detachController
353+
// detachController
370354
if (!strcmp(argv[0], "detachController"))
371355
{
372356
Commands::detachController();
373357
}
374358

375-
//configure <mainLoopSleepTime or buttonClickSleepTime> <time in ms>
359+
// configure <mainLoopSleepTime or buttonClickSleepTime> <time in ms>
376360
if (!strcmp(argv[0], "configure"))
377361
{
378362
if (argc != 3)
@@ -442,7 +426,7 @@ int argmain(int argc, char **argv)
442426

443427
if (!strcmp(argv[0], "getSystemLanguage"))
444428
{
445-
//thanks zaksa
429+
// thanks zaksa
446430
setInitialize();
447431
u64 languageCode = 0;
448432
SetLanguage language = SetLanguage_ENUS;
@@ -471,7 +455,7 @@ int argmain(int argc, char **argv)
471455

472456
if (!strcmp(argv[0], "pixelPeek"))
473457
{
474-
//errors with 0x668CE, unless debugunit flag is patched
458+
// errors with 0x668CE, unless debugunit flag is patched
475459
u64 bSize = 0x7D000;
476460
char *buf = (char *)malloc(bSize);
477461
u64 outSize = 0;
@@ -676,7 +660,7 @@ int argmain(int argc, char **argv)
676660
if (!strcmp(argv[0], "freezeUnpause"))
677661
freeze_thr_state = Freeze::Active;
678662

679-
//touch followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is sequential taps, not different fingers. Functions in its own thread, but will not allow the call again while running. tapcount * pollRate * 2
663+
// touch followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is sequential taps, not different fingers. Functions in its own thread, but will not allow the call again while running. tapcount * pollRate * 2
680664
if (!strcmp(argv[0], "touch"))
681665
{
682666
if (argc < 3 || argc % 2 == 0)
@@ -695,7 +679,7 @@ int argmain(int argc, char **argv)
695679
makeTouch(state, count, Commands::pollRate * 1e+6L, false);
696680
}
697681

698-
//touchHold <x in the range 0-1280> <y in the range 0-720> <time in milliseconds (must be at least 15ms)>. Functions in its own thread, but will not allow the call again while running. pollRate + holdtime
682+
// touchHold <x in the range 0-1280> <y in the range 0-720> <time in milliseconds (must be at least 15ms)>. Functions in its own thread, but will not allow the call again while running. pollRate + holdtime
699683
if (!strcmp(argv[0], "touchHold"))
700684
{
701685
if (argc != 4)
@@ -709,7 +693,7 @@ int argmain(int argc, char **argv)
709693
makeTouch(state, 1, time * 1e+6L, false);
710694
}
711695

712-
//touchDraw followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is vectors of where finger moves to, then removes the finger. Functions in its own thread, but will not allow the call again while running. (vectorcount * pollRate * 2) + pollRate
696+
// touchDraw followed by arrayof: <x in the range 0-1280> <y in the range 0-720>. Array is vectors of where finger moves to, then removes the finger. Functions in its own thread, but will not allow the call again while running. (vectorcount * pollRate * 2) + pollRate
713697
if (!strcmp(argv[0], "touchDraw"))
714698
{
715699
if (argc < 3 || argc % 2 == 0)
@@ -731,8 +715,8 @@ int argmain(int argc, char **argv)
731715
if (!strcmp(argv[0], "touchCancel"))
732716
touchToken = 1;
733717

734-
//key followed by arrayof: <HidKeyboardKey> to be pressed in sequential order
735-
//thank you Red (hp3721) for this functionality
718+
// key followed by arrayof: <HidKeyboardKey> to be pressed in sequential order
719+
// thank you Red (hp3721) for this functionality
736720
if (!strcmp(argv[0], "key"))
737721
{
738722
if (argc < 2)
@@ -747,13 +731,13 @@ int argmain(int argc, char **argv)
747731
if (key < 4 || key > 231)
748732
continue;
749733
keystates[i].keys[key / 64] = 1UL << key;
750-
keystates[i].modifiers = 1024UL; //numlock
734+
keystates[i].modifiers = 1024UL; // numlock
751735
}
752736

753737
makeKeys(keystates, count);
754738
}
755739

756-
//keyMod followed by arrayof: <HidKeyboardKey> <HidKeyboardModifier>(without the bitfield shift) to be pressed in sequential order
740+
// keyMod followed by arrayof: <HidKeyboardKey> <HidKeyboardModifier>(without the bitfield shift) to be pressed in sequential order
757741
if (!strcmp(argv[0], "keyMod"))
758742
{
759743
if (argc < 3 || argc % 2 == 0)
@@ -774,7 +758,7 @@ int argmain(int argc, char **argv)
774758
makeKeys(keystates, count);
775759
}
776760

777-
//keyMulti followed by arrayof: <HidKeyboardKey> to be pressed at the same time.
761+
// keyMulti followed by arrayof: <HidKeyboardKey> to be pressed at the same time.
778762
if (!strcmp(argv[0], "keyMulti"))
779763
{
780764
if (argc < 2)
@@ -794,7 +778,7 @@ int argmain(int argc, char **argv)
794778
makeKeys(keystate, 1);
795779
}
796780

797-
//turns off the screen (display)
781+
// turns off the screen (display)
798782
if (!strcmp(argv[0], "screenOff"))
799783
{
800784
ViDisplay temp_display;
@@ -806,11 +790,18 @@ int argmain(int argc, char **argv)
806790
rc = viSetDisplayPowerState(&temp_display, ViPowerState_NotScanning); // not scanning keeps the screen on but does not push new pixels to the display. Battery save is non-negligible and should be used where possible
807791
svcSleepThread(1e+6l);
808792
viCloseDisplay(&temp_display);
793+
794+
rc = lblInitialize();
795+
if (R_FAILED(rc))
796+
fatalThrow(rc);
797+
lblSwitchBacklightOff(1ul);
798+
lblExit();
799+
809800
lblSwitchBacklightOff(1ul);
810801
}
811802
}
812803

813-
//turns on the screen (display)
804+
// turns on the screen (display)
814805
if (!strcmp(argv[0], "screenOn"))
815806
{
816807
ViDisplay temp_display;
@@ -822,7 +813,12 @@ int argmain(int argc, char **argv)
822813
rc = viSetDisplayPowerState(&temp_display, ViPowerState_On);
823814
svcSleepThread(1e+6l);
824815
viCloseDisplay(&temp_display);
816+
817+
rc = lblInitialize();
818+
if (R_FAILED(rc))
819+
fatalThrow(rc);
825820
lblSwitchBacklightOn(1ul);
821+
lblExit();
826822
}
827823
}
828824

@@ -887,8 +883,7 @@ int main()
887883
while (true)
888884
{
889885
svr->listen("0.0.0.0", 9999);
890-
}
891-
},
886+
} },
892887
svr);
893888

894889
int newfd;
@@ -1048,7 +1043,7 @@ void sub_freeze(void *arg)
10481043
}
10491044
else if (*(Freeze::FreezeThreadState *)arg == Freeze::Pause)
10501045
{
1051-
svcSleepThread(1e+8L); //1s
1046+
svcSleepThread(1e+8L); // 1s
10521047
continue;
10531048
}
10541049

0 commit comments

Comments
 (0)