-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfrmMain.frm
456 lines (389 loc) · 16.4 KB
/
frmMain.frm
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmMain
Caption = "NSF Tool"
ClientHeight = 4110
ClientLeft = 60
ClientTop = 345
ClientWidth = 5790
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 4110
ScaleWidth = 5790
Begin MSComctlLib.StatusBar StatusBar
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 4
Top = 3735
Width = 5790
_ExtentX = 10213
_ExtentY = 661
Style = 1
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 1
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView1
Height = 495
Left = 240
TabIndex = 3
Top = 1080
Width = 1455
Visible = 0 'False
_ExtentX = 2566
_ExtentY = 873
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 1
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Path"
Object.Width = 5292
EndProperty
End
Begin MSComctlLib.ImageList ImageList2
Left = 2520
Top = 2640
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 20
ImageHeight = 20
MaskColor = 63488
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 6
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":27A2
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":2D84
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3366
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3948
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":3F2A
Key = ""
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":450C
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.ImageList ImageList1
Left = 1800
Top = 2640
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "frmMain.frx":4AEE
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar
Align = 1 'Align Top
Height = 540
Left = 0
TabIndex = 0
Top = 0
Width = 5790
_ExtentX = 10213
_ExtentY = 953
ButtonWidth = 1482
ButtonHeight = 953
AllowCustomize = 0 'False
Style = 1
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 8
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Add"
Object.ToolTipText = "Add files"
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Remove"
Object.ToolTipText = "Remove selected"
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Properties"
Object.ToolTipText = "View information"
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Rename"
Object.ToolTipText = "Rename"
EndProperty
BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628}
Style = 3
EndProperty
BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "Settings"
Object.ToolTipText = "Settings"
EndProperty
BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "About"
Object.ToolTipText = "About"
EndProperty
EndProperty
End
Begin MSComctlLib.ListView ListView
Height = 3135
Left = 0
TabIndex = 1
ToolTipText = "Drop your NSF files here"
Top = 960
Width = 5775
_ExtentX = 10186
_ExtentY = 5530
View = 3
LabelEdit = 1
MultiSelect = -1 'True
LabelWrap = -1 'True
HideSelection = -1 'True
OLEDropMode = 1
FullRowSelect = -1 'True
_Version = 393217
SmallIcons = "ImageList1"
ColHdrIcons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
Appearance = 1
OLEDropMode = 1
NumItems = 2
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = "Current Filename"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
SubItemIndex = 1
Text = "Preview"
Object.Width = 2540
EndProperty
End
Begin VB.CommandButton Command1
Cancel = -1 'True
Caption = "Exit"
Height = 495
Left = 120
TabIndex = 2
Top = 1200
Width = 975
End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Toolbar.ImageList = ImageList2
Toolbar.Buttons.Item(1).Image = 1
Toolbar.Buttons.Item(2).Image = 2
Toolbar.Buttons.Item(3).Image = 3
Toolbar.Buttons.Item(5).Image = 4
Toolbar.Buttons.Item(7).Image = 5
Toolbar.Buttons.Item(8).Image = 6
Toolbar.Buttons.Item(2).Enabled = False
Toolbar.Buttons.Item(3).Enabled = False
Toolbar.Buttons.Item(5).Enabled = False
ListView.TOp = Toolbar.TOp + Toolbar.Height + 80
''' settings '''
nsfFormat = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Format", "%T %F.nsf")
ConfirmRename = CBool(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "ConfirmRename", False))
frmMain.Left = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Left", "500"))
frmMain.TOp = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Top", "500"))
frmMain.Width = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Width", "5000"))
frmMain.Height = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Height", "4000"))
col = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "Columns", "-1"))
frmMain.WindowState = Val(ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "WindowState", "0"))
sLastDir = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "LastDir", "c:\")
special_bit0 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "VRCVI", "- (Konami VRCVI)")
special_bit1 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "VRCVII", "- (Konami VRCVII)")
special_bit2 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "FDS", "- (FDS Sound)")
special_bit3 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "MMC5", "- (Nintendo MMC5 Audio)")
special_bit4 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "NAMCO", "- (Namco-106)")
special_bit5 = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "SUNSOFT", "- (Sunsoft FME-07)")
unknown_artist = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN_ARTIST", "Unknown Artist")
unknown_title = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN_TITLE", "Unknown Title")
unknown_copyright = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN COPYRIGHT", "Unknown Copyright")
unknown_ripper = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN RIPPER", "Unknown Ripper")
ntsc_string = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "NTSC", "NTSC")
pal_string = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "PAL", "PAL")
ntscpal_string = ReadIniValue(App.Path & "\Settings.ini", "NSF Tool", "DUAL PAL-NTSC", "Dual PAL-NTSC")
''''''''''''''''
If col = -1 Then 'First time
ListView.ColumnHeaders.Item(1).Width = (ListView.Width / 3) - 90
ListView.ColumnHeaders.Item(2).Width = ListView.Width / 3 * 2
Else
ListView.ColumnHeaders.Item(1).Width = col
ListView.ColumnHeaders.Item(2).Width = ListView.Width - col
End If
StatusBar.SimpleText = "Ready"
'XP Themes
If IsThemed() Then
FixThemeSupport Controls
End If
End Sub
Private Sub Form_Resize()
On Error Resume Next
If frmMain.Width < 5910 Then frmMain.Width = 5910
If frmMain.Height < 4620 Then frmMain.Height = 4620
ListView.Height = frmMain.Height - 1500
ListView.Width = frmMain.Width - 120
ListView.ColumnHeaders.Item(2).Width = ListView.Width - ListView.ColumnHeaders.Item(1).Width - 50
End Sub
Private Sub Command1_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Format", nsfFormat
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "ConfirmRename", ConfirmRename
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "LastDir", sLastDir
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Columns", ListView.ColumnHeaders.Item(1).Width
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "VRCVI", special_bit0
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "VRCVII", special_bit1
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "FDS", special_bit2
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "MMC5", special_bit3
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "NAMCO", special_bit4
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "SUNSOFT", special_bit5
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN_ARTIST", unknown_artist
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN_TITLE", unknown_title
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "UNKNOWN COPYRIGHT", unknown_copyright
Temp = frmMain.WindowState
If Temp = 0 Then 'Only if normal state
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Left", frmMain.Left
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Top", frmMain.TOp
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Width", frmMain.Width
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "Height", frmMain.Height
End If
If Temp = 1 Then Temp = 0 'Do not save minimized state
WriteIniValue App.Path & "\Settings.ini", "NSF Tool", "WindowState", Temp
Call UnloadXpApp
End Sub
Private Sub ListView_DblClick()
If ListView.ListItems.Count > 0 Then frmInfo.Show vbModal
End Sub
Private Sub ListView_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyInsert
AddFiles
Case vbKeyDelete
For num = ListView.ListItems.Count To 1 Step -1
If ListView.ListItems.Item(num).Selected = True Then
ListView.ListItems.Remove (num)
ListView1.ListItems.Remove (num)
End If
Next
StatusBar.SimpleText = "Showing " & ListView.ListItems.Count & " file(s)"
If frmMain.ListView.ListItems.Count = 0 Then
Toolbar.Buttons.Item(2).Enabled = False
Toolbar.Buttons.Item(3).Enabled = False
Toolbar.Buttons.Item(5).Enabled = False
End If
End Select
End Sub
Private Sub ListView_OLEDragDrop(Data As MSComctlLib.DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, y As Single)
Dim myNSF As NSF
If Data.GetFormat(15) = True Then
num = 1
frmMain.StatusBar.SimpleText = "Working..."
frmMain.Enabled = False
On Error GoTo err
Do
myNSF.Path = Data.Files(num)
If CheckForDuplicateEntry(myNSF) = False Then 'Not in list
ret = LoadNSF(myNSF)
If ret = True Then
Set itmX = ListView.ListItems.Add(, , , , 1)
itmX.Text = RemovePath(myNSF.Path)
itmX.SubItems(1) = FormatName(myNSF)
Set itmX2 = frmMain.ListView1.ListItems.Add()
itmX2.Text = myNSF.Path
End If
End If
num = num + 1
DoEvents
Loop
err:
On Error GoTo 0
StatusBar.SimpleText = "Showing " & ListView.ListItems.Count & " file(s)"
If frmMain.ListView.ListItems.Count > 0 Then
Toolbar.Buttons.Item(2).Enabled = True
Toolbar.Buttons.Item(3).Enabled = True
Toolbar.Buttons.Item(5).Enabled = True
End If
frmMain.Enabled = True
End If
End Sub
Private Sub mnuAdd_Click()
CommonDialog.flags = cdlOFNAllowMultiselect + cdlOFNFileMustExist + cdlOFNPathMustExist + cdlOFNLongNames + cdlOFNExplorer
CommonDialog.Filter = "NSF Files (*.nsf)|*.nsf|All Files|*.*"
CommonDialog.ShowOpen
End Sub
Private Sub mnuSettings_Click()
frmSettings.Show vbModal
End Sub
Private Sub Toolbar_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1:
AddFiles
Case 2:
If ListView.ListItems.Count > 0 Then
For num = ListView.ListItems.Count To 1 Step -1
If ListView.ListItems.Item(num).Selected = True Then
ListView.ListItems.Remove (num)
ListView1.ListItems.Remove (num)
End If
Next
StatusBar.SimpleText = "Showing " & ListView.ListItems.Count & " file(s)"
If frmMain.ListView.ListItems.Count = 0 Then
Toolbar.Buttons.Item(2).Enabled = False
Toolbar.Buttons.Item(3).Enabled = False
Toolbar.Buttons.Item(5).Enabled = False
End If
End If
Case 3:
If ListView.ListItems.Count > 0 Then frmInfo.Show vbModal
Case 5:
Me.Enabled = False
NsfRename
Me.Enabled = True
If frmMain.ListView.ListItems.Count = 0 Then
Toolbar.Buttons.Item(2).Enabled = False
Toolbar.Buttons.Item(3).Enabled = False
Toolbar.Buttons.Item(5).Enabled = False
End If
Case 7:
frmSettings.Show vbModal
Case 8:
frmAbout.Show vbModal
End Select
End Sub