@@ -89,27 +89,41 @@ namespace tsl {
8989 extern u16 FramebufferWidth; // /< Width of the framebuffer
9090 extern u16 FramebufferHeight; // /< Height of the framebuffer
9191 extern u64 launchCombo; // /< Overlay activation key combo
92- extern u64 captureCombo; // /< Screenshot key combo
93- extern bool captureComboEnabled; // /< Screenshot enabled
9492
9593 }
9694
95+ /* *
96+ * @brief RGBA4444 Color structure
97+ */
98+ struct Color {
99+
100+ union {
101+ struct {
102+ u16 r: 4 , g: 4 , b: 4 , a: 4 ;
103+ } PACKED;
104+ u16 rgba;
105+ };
106+
107+ constexpr inline Color (u16 raw): rgba(raw) {}
108+ constexpr inline Color (u8 r, u8 g, u8 b, u8 a): r(r), g(g), b(b), a(a) {}
109+ };
110+
97111 namespace style {
98- constexpr u32 ListItemDefaultHeight = 70 ; // /< Standard list item height
99- constexpr u32 TrackBarDefaultHeight = 90 ; // /< Standard track bar height
100- constexpr u8 ListItemHighlightSaturation = 0x6 ; // /< Maximum saturation of Listitem highlights
101- constexpr u8 ListItemHighlightLength = 22 ; // /< Maximum length of Listitem highlights
112+ constexpr u32 ListItemDefaultHeight = 70 ; // /< Standard list item height
113+ constexpr u32 TrackBarDefaultHeight = 90 ; // /< Standard track bar height
114+ constexpr u8 ListItemHighlightSaturation = 6 ; // /< Maximum saturation of Listitem highlights
115+ constexpr u8 ListItemHighlightLength = 22 ; // /< Maximum length of Listitem highlights
102116
103117 namespace color {
104- constexpr u16 ColorFrameBackground = 0xD000 ; // /< Overlay frame background color
105- constexpr u16 ColorTransparent = 0x0000 ; // /< Transparent color
106- constexpr u16 ColorHighlight = 0xFDF0 ; // /< Greenish highlight color
107- constexpr u16 ColorFrame = 0xF777 ; // /< Outer boarder color
108- constexpr u16 ColorHandle = 0xF555 ; // /< Track bar handle color
109- constexpr u16 ColorText = 0xFFFF ; // /< Standard text color
110- constexpr u16 ColorDescription = 0xFAAA ; // /< Description text color
111- constexpr u16 ColorHeaderBar = 0xFCCC ; // /< Category header rectangle color
112- constexpr u16 ColorClickAnimation = 0xF220 ;
118+ constexpr Color ColorFrameBackground = { 0x0 , 0x0 , 0x0 , 0xD } ; // /< Overlay frame background color
119+ constexpr Color ColorTransparent = { 0x0 , 0x0 , 0x0 , 0x0 } ; // /< Transparent color
120+ constexpr Color ColorHighlight = { 0x0 , 0xF , 0xD , 0xF } ; // /< Greenish highlight color
121+ constexpr Color ColorFrame = { 0x7 , 0x7 , 0x7 , 0xF } ; // /< Outer boarder color
122+ constexpr Color ColorHandle = { 0x5 , 0x5 , 0x5 , 0xF } ; // /< Track bar handle color
123+ constexpr Color ColorText = { 0xF , 0xF , 0xF , 0xF } ; // /< Standard text color
124+ constexpr Color ColorDescription = { 0xA , 0xA , 0xA , 0xF } ; // /< Description text color
125+ constexpr Color ColorHeaderBar = { 0xC , 0xC , 0xC , 0xF } ; // /< Category header rectangle color
126+ constexpr Color ColorClickAnimation = { 0x0 , 0x2 , 0x2 , 0xF }; // /< Element click animation color
113127 }
114128 }
115129
@@ -230,55 +244,6 @@ namespace tsl {
230244 void dismiss () { f = nullptr ; }
231245 };
232246
233- /* *
234- * @brief Capture the whole screen with overlays
235- * @note this allocates 0x7D301 bytes of heap memory so make sure you have that.
236- *
237- * @return Result Result
238- */
239- static Result captureScreen () {
240- /* Allocate buffer for jpeg. */
241- size_t buffer_size = 0x7D000 ;
242- u8 *buffer = new u8 [buffer_size];
243- ScopeGuard buffer_guard ([buffer] { delete[] buffer; });
244-
245- /* Capture current screen. */
246- u64 size;
247- struct {
248- u32 a;
249- u64 b;
250- } in = {0 , 10000000000 };
251- R_TRY (serviceDispatchInOut (capsscGetServiceSession (), 1204 , in, size,
252- .buffer_attrs = {SfBufferAttr_HipcMapTransferAllowsNonSecure | SfBufferAttr_HipcMapAlias | SfBufferAttr_Out},
253- .buffers = { { buffer, buffer_size } },
254- ));
255-
256- /* Open Sd card filesystem. */
257- FsFileSystem sdmc;
258- R_TRY (fsOpenSdCardFileSystem (&sdmc));
259- ScopeGuard sdmc_guard ([&sdmc] { fsFsClose (&sdmc); });
260-
261- /* Allocate path buffer. */
262- char *pathBuffer = new char [FS_MAX_PATH];
263- ScopeGuard path_guard ([pathBuffer] { delete[] pathBuffer; });
264-
265- /* Get unique filepath. */
266- u64 timestamp=0 ;
267- Result rc = timeGetCurrentTime (TimeType_Default, ×tamp);
268- if (R_SUCCEEDED (rc)) std::snprintf (pathBuffer, FS_MAX_PATH, " /libtesla_%ld.jpg" , timestamp);
269- else std::strcpy (pathBuffer, " /libtesla_screenshot.jpg" );
270-
271- /* Create file, open and write to it. */
272- fsFsDeleteFile (&sdmc, pathBuffer);
273- R_TRY (fsFsCreateFile (&sdmc, pathBuffer, size, 0 ));
274- FsFile file;
275- R_TRY (fsFsOpenFile (&sdmc, pathBuffer, FsOpenMode_Write, &file));
276- fsFileWrite (&file, 0 , buffer, size, FsWriteOption_Flush);
277- fsFileClose (&file);
278-
279- return 0 ;
280- }
281-
282247 /* *
283248 * @brief libnx hid:sys shim that gives or takes away frocus to or from the process with the given aruid
284249 *
@@ -470,10 +435,6 @@ namespace tsl {
470435
471436 }
472437
473- static bool stringToBool (const std::string &value) {
474- return (value == " true" ) || (value == " 1" );
475- }
476-
477438 /* *
478439 * @brief Decodes a key string into it's key code
479440 *
@@ -528,22 +489,6 @@ namespace tsl {
528489
529490 extern " C" u64 __nx_vi_layer_id;
530491
531- /* *
532- * @brief RGBA4444 Color structure
533- */
534- struct Color {
535-
536- union {
537- struct {
538- u16 r: 4 , g: 4 , b: 4 , a: 4 ;
539- } PACKED;
540- u16 rgba;
541- };
542-
543- inline Color (u16 raw): rgba(raw) {}
544- inline Color (u8 r, u8 g, u8 b, u8 a): r(r), g(g), b(b), a(a) {}
545- };
546-
547492 struct ScissoringConfig {
548493 s32 x, y, w, h;
549494 };
@@ -1317,7 +1262,7 @@ namespace tsl {
13171262 * @param renderer Renderer
13181263 */
13191264 virtual void drawClickAnimation (gfx::Renderer *renderer) {
1320- gfx:: Color animColor = tsl::style::color::ColorClickAnimation;
1265+ Color animColor = tsl::style::color::ColorClickAnimation;
13211266 u8 saturation = tsl::style::ListItemHighlightSaturation * (float (this ->m_clickAnimationProgress ) / float (tsl::style::ListItemHighlightLength));
13221267
13231268 animColor.g = saturation;
@@ -1350,7 +1295,7 @@ namespace tsl {
13501295 virtual void drawHighlight (gfx::Renderer *renderer) {
13511296 static float counter = 0 ;
13521297 const float progress = (std::sin (counter) + 1 ) / 2 ;
1353- gfx:: Color highlightColor = { static_cast <u8 >((0x2 - 0x8 ) * progress + 0x8 ),
1298+ Color highlightColor = { static_cast <u8 >((0x2 - 0x8 ) * progress + 0x8 ),
13541299 static_cast <u8 >((0x8 - 0xF ) * progress + 0xF ),
13551300 static_cast <u8 >((0xC - 0xF ) * progress + 0xF ),
13561301 0xF };
@@ -1768,7 +1713,7 @@ namespace tsl {
17681713 *
17691714 * @param color Color of the rectangle
17701715 */
1771- DebugRectangle (gfx:: Color color) : Element(), m_color(color) {}
1716+ DebugRectangle (Color color) : Element(), m_color(color) {}
17721717 virtual ~DebugRectangle () {}
17731718
17741719 virtual void draw (gfx::Renderer *renderer) override {
@@ -1778,7 +1723,7 @@ namespace tsl {
17781723 virtual void layout (u16 parentX, u16 parentY, u16 parentWidth, u16 parentHeight) override {}
17791724
17801725 private:
1781- gfx:: Color m_color;
1726+ Color m_color;
17821727 };
17831728
17841729
@@ -2492,7 +2437,7 @@ namespace tsl {
24922437 virtual void drawHighlight (gfx::Renderer *renderer) override {
24932438 static float counter = 0 ;
24942439 const float progress = (std::sin (counter) + 1 ) / 2 ;
2495- gfx:: Color highlightColor = { static_cast <u8 >((0x2 - 0x8 ) * progress + 0x8 ),
2440+ Color highlightColor = { static_cast <u8 >((0x2 - 0x8 ) * progress + 0x8 ),
24962441 static_cast <u8 >((0x8 - 0xF ) * progress + 0xF ),
24972442 static_cast <u8 >((0xC - 0xF ) * progress + 0xF ),
24982443 static_cast <u8 >((0x6 - 0xD ) * progress + 0xD ) };
@@ -3338,12 +3283,6 @@ namespace tsl {
33383283 u64 decodedKeys = hlp::comboStringToKeys (parsedConfig[" tesla" ][" key_combo" ]);
33393284 if (decodedKeys)
33403285 tsl::cfg::launchCombo = decodedKeys;
3341-
3342- decodedKeys = hlp::comboStringToKeys (parsedConfig[" tesla" ][" screenshot_combo" ]);
3343- if (decodedKeys)
3344- tsl::cfg::captureCombo = decodedKeys;
3345-
3346- tsl::cfg::captureComboEnabled = hlp::stringToBool (parsedConfig[" tesla" ][" screenshot_combo_enabled" ]);
33473286 }
33483287
33493288 /* *
@@ -3443,10 +3382,6 @@ namespace tsl {
34433382 eventFire (&shData->comboEvent );
34443383 }
34453384
3446- if (shData->overlayOpen && tsl::cfg::captureComboEnabled && ((shData->keysHeld & tsl::cfg::captureCombo) == tsl::cfg::captureCombo) && shData->keysDown & tsl::cfg::captureCombo) {
3447- tsl::hlp::captureScreen ();
3448- }
3449-
34503385 shData->keysDownPending |= shData->keysDown ;
34513386 }
34523387
@@ -3660,13 +3595,12 @@ namespace tsl::cfg {
36603595 u16 FramebufferWidth = 0 ;
36613596 u16 FramebufferHeight = 0 ;
36623597 u64 launchCombo = KEY_L | KEY_DDOWN | KEY_RSTICK;
3663- u64 captureCombo = KEY_PLUS | KEY_MINUS;
3664- bool captureComboEnabled = false ;
36653598}
36663599
36673600extern " C" {
36683601
36693602 u32 __nx_applet_type = AppletType_None;
3603+ u32 __nx_fs_num_sessions = 1 ;
36703604 u32 __nx_nv_transfermem_size = 0x40000 ;
36713605 ViLayerFlags __nx_vi_stray_layer_flags = (ViLayerFlags)0 ;
36723606
@@ -3676,8 +3610,6 @@ extern "C" {
36763610 */
36773611 void __appInit (void ) {
36783612 tsl::hlp::doWithSmSession ([]{
3679- ASSERT_FATAL (capsscInitialize ());
3680- ASSERT_FATAL (timeInitialize ());
36813613 ASSERT_FATAL (fsInitialize ());
36823614 ASSERT_FATAL (hidInitialize ()); // Controller inputs and Touch
36833615 ASSERT_FATAL (plInitialize ()); // Font data. Use pl:s to prevent qlaunch/overlaydisp session exhaustion
@@ -3692,8 +3624,6 @@ extern "C" {
36923624 *
36933625 */
36943626 void __appExit (void ) {
3695- capsscExit ();
3696- timeExit ();
36973627 fsExit ();
36983628 hidExit ();
36993629 plExit ();
0 commit comments