This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathNCAForm.vb
164 lines (153 loc) · 6.5 KB
/
NCAForm.vb
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
Imports System.IO.File
Imports System.IO.Directory
Public Class NCAForm
Private Sub OpenNCA_Click(sender As Object, e As EventArgs) Handles OpenNCA.Click
SelectNCA.ShowDialog()
FileName.Text = SelectNCA.FileName
If FileName.Text = "Select a file." Then
FileName.Text = ""
End If
End Sub
Private Sub PlainOpt_CheckedChanged(sender As Object, e As EventArgs) Handles PlainOpt.CheckedChanged
WriteAllText("prefs.dat", "0")
RadioButton1.Enabled = False
RadioButton2.Enabled = False
RomFSStr.Enabled = False
RomFSName.Enabled = False
RomFSStart.Enabled = False
OutFolderStr.Enabled = False
ExtFolderName.Enabled = False
ExtStart.Enabled = False
PlainStr.Enabled = True
PlainName.Enabled = True
PlainStart.Enabled = True
PlainExtStr.Enabled = True
End Sub
Private Sub ExtractOpt_CheckedChanged(sender As Object, e As EventArgs) Handles ExtractOpt.CheckedChanged
WriteAllText("prefs.dat", "1")
RadioButton1.Enabled = False
RadioButton2.Enabled = False
RomFSStr.Enabled = False
RomFSName.Enabled = False
RomFSStart.Enabled = False
PlainStr.Enabled = False
PlainName.Enabled = False
PlainStart.Enabled = False
PlainExtStr.Enabled = False
OutFolderStr.Enabled = True
ExtFolderName.Enabled = True
ExtStart.Enabled = True
End Sub
Private Sub PlainStart_Click(sender As Object, e As EventArgs) Handles PlainStart.Click
If IO.File.Exists("keys.dat") Then
If PlainName.Text IsNot "" Then
Process.Start("cmd", "/c hactool -k keys.dat " + "--plaintext=" + PlainName.Text + ".nca" + " " + """" + FileName.Text + """")
Else
MsgBox("You must type a filename!")
End If
Else
MsgBox("You must add keys first.")
KeyForm.Show()
End If
End Sub
Private Sub ExtStart_Click(sender As Object, e As EventArgs) Handles ExtStart.Click
If IO.File.Exists("keys.dat") Then
If ExtFolderName.Text IsNot "" Then
CreateDirectory(ExtFolderName.Text)
Process.Start("cmd", "/c hactool -k keys.dat " + "--romfsdir=" + ExtFolderName.Text + " " + """" + FileName.Text + """")
Else
MsgBox("You must type a folder name!")
End If
Else
MsgBox("You must add keys first.")
KeyForm.Show()
End If
End Sub
Private Sub KeyManLaunch_Click(sender As Object, e As EventArgs) Handles KeyManLaunch.Click
KeyForm.Show()
End Sub
Private Sub RomFSOpt_CheckedChanged(sender As Object, e As EventArgs) Handles RomFSOpt.CheckedChanged
WriteAllText("prefs.dat", "2")
RadioButton1.Enabled = True
RadioButton2.Enabled = True
RomFSStr.Enabled = True
RomFSName.Enabled = True
RomFSStart.Enabled = True
PlainStr.Enabled = False
PlainName.Enabled = False
PlainStart.Enabled = False
PlainExtStr.Enabled = False
OutFolderStr.Enabled = False
ExtFolderName.Enabled = False
ExtStart.Enabled = False
End Sub
Private Sub RomFSStart_Click(sender As Object, e As EventArgs) Handles RomFSStart.Click
If IO.File.Exists("keys.dat") Then
If RomFSName.Text IsNot "" Then
CreateDirectory(RomFSName.Text)
If RadioButton1.Checked = True Then
WriteAllText("prefs.dat", "A")
Process.Start("cmd", "/c hactool -k keys.dat " + "--romfs=" + RomFSName.Text + "/RomFS.romfs" + " --section0dir=" + RomFSName.Text + " " + """" + FileName.Text + """")
Else
WriteAllText("prefs.dat", "B")
Process.Start("cmd", "/c hactool -k keys.dat " + "--romfs=" + RomFSName.Text + "/game.istorage" + " --section0dir=" + RomFSName.Text + " " + """" + FileName.Text + """")
End If
Else
MsgBox("You must type a filename!")
End If
Else
MsgBox("You must add keys first.")
KeyForm.Show()
End If
End Sub
Private Sub NCAForm_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop
Dim DraggedFile() As String = e.Data.GetData(DataFormats.FileDrop)
For Each File In DraggedFile
FileName.Text = File
Next
PictureBox1.Visible = False
End Sub
Private Sub NCAForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.AllowDrop = True
If IO.File.Exists("prefs.dat") = False Then
IO.File.Create("prefs.dat").Close()
End If
If ReadAllText("prefs.dat") = "0" Then
PlainOpt.Checked = True
ElseIf ReadAllText("prefs.dat") = "1" Then
ExtractOpt.Checked = True
ElseIf ReadAllText("prefs.dat") = "2" Then
RomFSOpt.Checked = True
ElseIf ReadAllText("prefs.dat") = "A" Then
RadioButton1.Checked = True
ElseIf ReadAllText("prefs.dat") = "B" Then
RadioButton2.Checked = True
ElseIf ReadAllText("prefs.dat") = "" Then
End If
End Sub
Private Sub NCAForm_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
PictureBox1.Visible = True
End Sub
Private Sub FileName_DragDrop(sender As Object, e As DragEventArgs) Handles FileName.DragDrop
Dim DraggedFile() As String = e.Data.GetData(DataFormats.FileDrop)
For Each File In DraggedFile
FileName.Text = File
Next
PictureBox1.Visible = False
End Sub
Private Sub FileName_DragEnter(sender As Object, e As DragEventArgs) Handles FileName.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
End If
PictureBox1.Visible = True
End Sub
Private Sub NCAForm_DragLeave(sender As Object, e As EventArgs) Handles MyBase.DragLeave
PictureBox1.Visible = False
End Sub
Private Sub FileName_DragLeave(sender As Object, e As EventArgs) Handles FileName.DragLeave
PictureBox1.Visible = False
End Sub
End Class