-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9902084
Showing
12 changed files
with
6,857 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
*~ | ||
*.3dsx | ||
*.elf | ||
*.smdh | ||
Thumbs.db | ||
build/ | ||
lib/ | ||
docs/ | ||
examples/ | ||
internal_docs | ||
build.sh | ||
output/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "buildtools"] | ||
path = buildtools | ||
url = https://github.com/Steveice10/buildtools.git |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# TARGET # | ||
|
||
TARGET := 3DS | ||
LIBRARY := 0 | ||
|
||
ifeq ($(TARGET),3DS) | ||
ifeq ($(strip $(DEVKITPRO)),) | ||
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro") | ||
endif | ||
|
||
ifeq ($(strip $(DEVKITARM)),) | ||
$(error "Please set DEVKITARM in your environment. export DEVKITARM=<path to>devkitARM") | ||
endif | ||
endif | ||
|
||
# COMMON CONFIGURATION # | ||
|
||
NAME := tikSweep | ||
|
||
BUILD_DIR := build | ||
OUTPUT_DIR := output | ||
INCLUDE_DIRS := include | ||
SOURCE_DIRS := source | ||
|
||
BUILD_FILTER := source/svchax/test/test.c | ||
|
||
EXTRA_OUTPUT_FILES := | ||
|
||
LIBRARY_DIRS := $(DEVKITPRO)/libctru | ||
LIBRARIES := ctru m | ||
|
||
BUILD_FLAGS := -DVERSION_STRING="\"`git describe --tags --abbrev=0`\"" -DREVISION_STRING="\"`git rev-parse --short HEAD`\"" | ||
RUN_FLAGS := | ||
|
||
# 3DS CONFIGURATION # | ||
|
||
TITLE := $(NAME) | ||
DESCRIPTION := Remove unused tickets | ||
AUTHOR := DanTheMan827 | ||
PRODUCT_CODE := CTR-K-TIKSWEEP | ||
UNIQUE_ID := 0xA8BF | ||
|
||
SYSTEM_MODE := 64MB | ||
SYSTEM_MODE_EXT := Legacy | ||
|
||
ICON_FLAGS := | ||
|
||
ROMFS_DIR := romfs | ||
BANNER_AUDIO := audio.wav | ||
BANNER_IMAGE := banner.png | ||
ICON := icon.png | ||
|
||
# INTERNAL # | ||
|
||
include buildtools/make_base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ![tikShop](https://raw.githubusercontent.com/DanTheMan827/tikSweep/master/banner.png) | ||
tikSweep is utility app meant to do one thing, remove unused tickets from the system. | ||
|
||
# Installation | ||
Scan the QR code below in FBI to install the current version of tikSweep | ||
|
||
![tikSweep QR Code](https://raw.githubusercontent.com/DanTheMan827/tikSweep/master/qr_code.png) | ||
|
||
# Building | ||
LibCTRU v.1.1.0 or higher is required, this version is not installed with devkitPro by default. | ||
|
||
# License | ||
tikSweep | ||
Copyright (C) 2016 Daniel Radtke (DanTheMan827) | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
tikSweep | ||
Copyright (C) 2016 Daniel Radtke (DanTheMan827) | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
#include <fstream> | ||
#include <cstdlib> | ||
#include <3ds.h> | ||
|
||
u32 wait_key() | ||
{ | ||
while (true) | ||
{ | ||
hidScanInput(); | ||
|
||
u32 keys = hidKeysDown(); | ||
if (keys > 0) | ||
{ | ||
return keys; | ||
} | ||
gfxFlushBuffers(); | ||
gspWaitForVBlank(); | ||
} | ||
} | ||
|
||
int util_compare_u64(const void* e1, const void* e2) { | ||
u64 id1 = *(u64*) e1; | ||
u64 id2 = *(u64*) e2; | ||
|
||
return id1 > id2 ? 1 : id1 < id2 ? -1 : 0; | ||
} | ||
|
||
void clean_tickets(){ | ||
Result res = 0; | ||
u32 ticketCount = 0; | ||
u32 deletedCount = 0; | ||
if(R_SUCCEEDED(res = AM_GetTicketCount(&ticketCount))) { | ||
u64* ticketIDs = (u64*) calloc(ticketCount, sizeof(u64)); | ||
if(ticketIDs != NULL) { | ||
if(R_SUCCEEDED(res = AM_GetTicketList(&ticketCount, ticketCount, 0, ticketIDs))) { | ||
qsort(ticketIDs, ticketCount, sizeof(u64), util_compare_u64); | ||
char cur[34]; | ||
for(u32 i = 0; i < ticketCount && R_SUCCEEDED(res); i++) { | ||
sprintf(cur,"%016llX", ticketIDs[i]); | ||
std::string curStr = cur; | ||
std::string typeCheck = curStr.substr(4,4); | ||
u64 titleID = ticketIDs[i]; | ||
AM_TitleEntry entry; | ||
if( | ||
(typeCheck == "0000" || typeCheck == "008c" || typeCheck == "000e" || typeCheck == "8004") && | ||
( | ||
!R_SUCCEEDED(AM_GetTitleInfo(MEDIATYPE_SD, 1, &titleID, &entry)) && | ||
!R_SUCCEEDED(AM_GetTitleInfo(MEDIATYPE_NAND, 1, &titleID, &entry)) | ||
) | ||
) { | ||
AM_DeleteTicket(titleID); | ||
deletedCount++; | ||
printf("Deleted "); | ||
printf(cur); | ||
printf("\n"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
printf("\nTotal tickets: %lu\n", ticketCount); | ||
printf("Deleted tickets: %lu", deletedCount); | ||
printf("\n\nPress any button to exit."); | ||
wait_key(); | ||
} | ||
|
||
void action_about(gfxScreen_t screen){ | ||
PrintConsole infoConsole; | ||
PrintConsole* currentConsole = consoleSelect(&infoConsole); | ||
consoleInit(screen, &infoConsole); | ||
|
||
consoleClear(); | ||
|
||
printf(CONSOLE_RED "\n tikSweep " VERSION_STRING " by DanTheMan827\n\n" CONSOLE_RESET); | ||
printf(" Remove unused tickets.\n\n"); | ||
|
||
printf(" Commit: " REVISION_STRING); | ||
|
||
consoleSelect(currentConsole); | ||
} | ||
|
||
int main(int argc, const char* argv[]){ | ||
|
||
gfxInitDefault(); | ||
consoleInit(GFX_TOP, NULL); | ||
amInit(); | ||
|
||
AM_InitializeExternalTitleDatabase(false); | ||
|
||
|
||
action_about(GFX_BOTTOM); | ||
printf("This will remove all unused tickets."); | ||
printf("\n\nPress the A button to continue.\n\n"); | ||
|
||
if(wait_key() == KEY_A) | ||
clean_tickets(); | ||
|
||
amExit(); | ||
gfxExit(); | ||
} |