Skip to content

Commit 7ebc36d

Browse files
committed
Got rid of the time service as it hindered other homebrew
1 parent 087e4d5 commit 7ebc36d

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

include/tesla.hpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -238,39 +238,39 @@ namespace tsl {
238238
*/
239239
static Result captureScreen() {
240240
/* Allocate buffer for jpeg. */
241-
size_t buffer_size = 0x7D000;
242-
u8 *buffer = new u8[buffer_size];
243-
ScopeGuard buffer_guard([buffer] { delete[] buffer; });
241+
size_t bufferSize = 0x7D000;
242+
u8 *buffer = new u8[bufferSize];
243+
ScopeGuard bufferGuard([buffer] { delete[] buffer; });
244244

245245
/* Capture current screen. */
246246
u64 size;
247247
struct {
248248
u32 a;
249249
u64 b;
250250
} in = {0, 10000000000};
251+
251252
R_TRY(serviceDispatchInOut(capsscGetServiceSession(), 1204, in, size,
252-
.buffer_attrs = {SfBufferAttr_HipcMapTransferAllowsNonSecure | SfBufferAttr_HipcMapAlias | SfBufferAttr_Out},
253-
.buffers = { { buffer, buffer_size } },
253+
.buffer_attrs = { SfBufferAttr_HipcMapTransferAllowsNonSecure | SfBufferAttr_HipcMapAlias | SfBufferAttr_Out },
254+
.buffers = { { buffer, bufferSize } },
254255
));
255256

256257
/* Open Sd card filesystem. */
257258
FsFileSystem sdmc;
258259
R_TRY(fsOpenSdCardFileSystem(&sdmc));
259-
ScopeGuard sdmc_guard([&sdmc] { fsFsClose(&sdmc); });
260+
ScopeGuard sdmcGuard([&sdmc] { fsFsClose(&sdmc); });
260261

261262
/* Allocate path buffer. */
262263
char *pathBuffer = new char[FS_MAX_PATH];
263-
ScopeGuard path_guard([pathBuffer] { delete[] pathBuffer; });
264+
ScopeGuard pathGuard([pathBuffer] { delete[] pathBuffer; });
264265

265266
/* Get unique filepath. */
266-
u64 timestamp=0;
267-
Result rc = timeGetCurrentTime(TimeType_Default, &timestamp);
268-
if (R_SUCCEEDED(rc)) std::snprintf(pathBuffer, FS_MAX_PATH, "/libtesla_%ld.jpg", timestamp);
269-
else std::strcpy(pathBuffer, "/libtesla_screenshot.jpg");
267+
u64 timestamp = svcGetSystemTick();
268+
std::snprintf(pathBuffer, FS_MAX_PATH, "/libtesla_%ld.jpg", timestamp);
270269

271270
/* Create file, open and write to it. */
272271
fsFsDeleteFile(&sdmc, pathBuffer);
273272
R_TRY(fsFsCreateFile(&sdmc, pathBuffer, size, 0));
273+
274274
FsFile file;
275275
R_TRY(fsFsOpenFile(&sdmc, pathBuffer, FsOpenMode_Write, &file));
276276
fsFileWrite(&file, 0, buffer, size, FsWriteOption_Flush);
@@ -3677,7 +3677,6 @@ extern "C" {
36773677
void __appInit(void) {
36783678
tsl::hlp::doWithSmSession([]{
36793679
ASSERT_FATAL(capsscInitialize());
3680-
ASSERT_FATAL(timeInitialize());
36813680
ASSERT_FATAL(fsInitialize());
36823681
ASSERT_FATAL(hidInitialize()); // Controller inputs and Touch
36833682
ASSERT_FATAL(plInitialize(PlServiceType_System)); // Font data. Use pl:s to prevent qlaunch/overlaydisp session exhaustion
@@ -3693,7 +3692,6 @@ extern "C" {
36933692
*/
36943693
void __appExit(void) {
36953694
capsscExit();
3696-
timeExit();
36973695
fsExit();
36983696
hidExit();
36993697
plExit();

0 commit comments

Comments
 (0)