-
Notifications
You must be signed in to change notification settings - Fork 0
/
appgen.py
49 lines (38 loc) · 1.53 KB
/
appgen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from os import path, getcwd, mkdir, listdir
from shutil import rmtree, copyfile
def agen(apath, dst):
print('AppGen V1.8 - BY R-YaTian')
files = ['dsiware', 'appgen.py', '53524c41', '484e474a', '534c524e']
dware = path.join(dst, 'dsiware')
if dst == getcwd():
if path.exists(dware):
rmtree(dware)
mkdir(dware)
num = 0
for app in listdir(apath):
if app in files or app.endswith('.exe'):
continue
apps = path.join(apath, app)
try:
for title in listdir(path.join(apps, 'content')):
if title.endswith('.app'):
print('{}/content/{}'.format(app, title))
copyfile(path.join(apath, app, 'content', title), path.join(dware, app + '.nds'))
num += 1
except:
pass
try:
for titleid in listdir(path.join(apps, 'data')):
if titleid.endswith('.sav'):
if titleid.startswith('pri'):
print('{}/data/{}'.format(app, titleid))
copyfile(path.join(apath, app, 'data', titleid), path.join(dware, app + '.prv'))
if titleid.startswith('pub'):
print('{}/data/{}'.format(app, titleid))
copyfile(path.join(apath, app, 'data', titleid), path.join(dware, app + '.pub'))
except:
pass
if num == 0 and dst == getcwd():
rmtree(dware)
if __name__ == '__main__':
agen(getcwd(), getcwd())