NDS Rom Renamer (free app from me) ....
#1
NDS Rom Renamer (free app from me) ....
if you put the exe in c:\ and dbl-click the add_to.reg file you will be able to right click on a NDS rom and rename the file to whatever name the game has within the rom
http://www.reefbeasties.com/mt/NDSROMRen.exec
http://www.reefbeasties.com/mt/add_to.reg
not sure why you can't right click on multiple files, but you *can* drag multiple files onto the exe and it will do all of them (don't do more than about 10 at once though.
Merry Christmas NDS'ers
Here's the code for the interested:
Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Long) As Long
Sub Main()
Dim sROMS$(), p&, sCMD$, bQuoteON As Boolean
sCMD = Command()
If InStr(sCMD, Chr(34)) > 0 Then 'some filenames have spaces
For p = 1 To Len(sCMD)
If Mid$(sCMD, p, 1) = Space(1) Then
If Not bQuoteON Then
Mid(sCMD, p, 1) = "~"
End If
ElseIf Mid$(sCMD, p, 1) = Chr(34) Then
bQuoteON = Not bQuoteON
End If
Next
sCMD = Replace(sCMD, Chr(34), "")
sROMS = Split(sCMD, "~")
Else
sROMS = Split(sCMD, Space(1))
End If
For p = 0 To UBound(sROMS)
If Len(Trim(sROMS(p))) > 0 Then
RenameRom (Trim(sROMS(p)))
End If
Next
End Sub
Sub RenameRom(sROM$)
Dim bF() As Byte, n&, f$, fl&, p$, bStart As Boolean, m$
If (GetAttr(sROM) And vbDirectory) <> 0 Then
MsgBox "Could not identify file; too many selected?" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
End If
If LCase(Right$(sROM, 4)) <> ".nds" Then
MsgBox "Not an nds file" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
End If
p = Left(sROM, InStrRev(sROM, "\"))
Open sROM For Binary Access Read As #77
fl = LOF(77)
ReDim bF(1024): Get #77, , bF()
n = 0: f = "": m = ""
'(bF(&H0 + n)
'00 38 18 00
'&H 18 38 00 = &D 1,587,200
n = H2D(ByteToHex(bF(&H6B)) & ByteToHex(bF(&H6A)) & ByteToHex(bF(&H69)) & ByteToHex(bF(&H68))) + &H240
ReDim bF(1024)
Get #77, n + 1, bF()
Close #77
n = 0
f = ""
Do
f = f & Chr(bF(n))
n = n + 2
Loop Until bF(n) < &HB Or n > 1024
f = Replace(f, Space(1), "_")
f = Replace(f, ":", "")
f = Replace(f, ";", "")
If Len(f) <= 2 Then
MsgBox "No valid nds title" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
Else
f = p & f & ".nds"
End If
'MsgBox f
MoveFileEx sROM, f, &H1
End Sub
Private Function ByteToHex$(b As Byte) 'for testing purposes
Dim d$(1), n&(1), i%
ByteToHex = Space$(2): n(0) = b \ 16: n(1) = b Mod 16
For i = 0 To 1
If n(i) > 9 Then
d(i) = Chr(55 + n(i))
Else
d(i) = Chr(48 + n(i))
End If
Mid$(ByteToHex, i + 1, 1) = d(i)
Next
End Function
Function H2D&(h$)
Dim n&, t&
H2D = 0: h = UCase(h)
For n = Len(h) To 1 Step -1
t = Asc(Mid$(h, n, 1)) - 48
If t > 9 Then t = t - 7
H2D = H2D + (t * (16 ^ (Len(h) - n)))
Next
End Function
http://www.reefbeasties.com/mt/NDSROMRen.exec
http://www.reefbeasties.com/mt/add_to.reg
not sure why you can't right click on multiple files, but you *can* drag multiple files onto the exe and it will do all of them (don't do more than about 10 at once though.
Merry Christmas NDS'ers
Here's the code for the interested:
Private Declare Function MoveFileEx Lib "kernel32" Alias "MoveFileExA" (ByVal lpExistingFileName As String, ByVal lpNewFileName As String, ByVal dwFlags As Long) As Long
Sub Main()
Dim sROMS$(), p&, sCMD$, bQuoteON As Boolean
sCMD = Command()
If InStr(sCMD, Chr(34)) > 0 Then 'some filenames have spaces
For p = 1 To Len(sCMD)
If Mid$(sCMD, p, 1) = Space(1) Then
If Not bQuoteON Then
Mid(sCMD, p, 1) = "~"
End If
ElseIf Mid$(sCMD, p, 1) = Chr(34) Then
bQuoteON = Not bQuoteON
End If
Next
sCMD = Replace(sCMD, Chr(34), "")
sROMS = Split(sCMD, "~")
Else
sROMS = Split(sCMD, Space(1))
End If
For p = 0 To UBound(sROMS)
If Len(Trim(sROMS(p))) > 0 Then
RenameRom (Trim(sROMS(p)))
End If
Next
End Sub
Sub RenameRom(sROM$)
Dim bF() As Byte, n&, f$, fl&, p$, bStart As Boolean, m$
If (GetAttr(sROM) And vbDirectory) <> 0 Then
MsgBox "Could not identify file; too many selected?" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
End If
If LCase(Right$(sROM, 4)) <> ".nds" Then
MsgBox "Not an nds file" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
End If
p = Left(sROM, InStrRev(sROM, "\"))
Open sROM For Binary Access Read As #77
fl = LOF(77)
ReDim bF(1024): Get #77, , bF()
n = 0: f = "": m = ""
'(bF(&H0 + n)
'00 38 18 00
'&H 18 38 00 = &D 1,587,200
n = H2D(ByteToHex(bF(&H6B)) & ByteToHex(bF(&H6A)) & ByteToHex(bF(&H69)) & ByteToHex(bF(&H68))) + &H240
ReDim bF(1024)
Get #77, n + 1, bF()
Close #77
n = 0
f = ""
Do
f = f & Chr(bF(n))
n = n + 2
Loop Until bF(n) < &HB Or n > 1024
f = Replace(f, Space(1), "_")
f = Replace(f, ":", "")
f = Replace(f, ";", "")
If Len(f) <= 2 Then
MsgBox "No valid nds title" & vbCrLf & vbCrLf & "Exiting", vbExclamation, "NDS Rom rename"
End
Else
f = p & f & ".nds"
End If
'MsgBox f
MoveFileEx sROM, f, &H1
End Sub
Private Function ByteToHex$(b As Byte) 'for testing purposes
Dim d$(1), n&(1), i%
ByteToHex = Space$(2): n(0) = b \ 16: n(1) = b Mod 16
For i = 0 To 1
If n(i) > 9 Then
d(i) = Chr(55 + n(i))
Else
d(i) = Chr(48 + n(i))
End If
Mid$(ByteToHex, i + 1, 1) = d(i)
Next
End Function
Function H2D&(h$)
Dim n&, t&
H2D = 0: h = UCase(h)
For n = Len(h) To 1 Step -1
t = Asc(Mid$(h, n, 1)) - 48
If t > 9 Then t = t - 7
H2D = H2D + (t * (16 ^ (Len(h) - n)))
Next
End Function
Thread
Thread Starter
Forum
Replies
Last Post
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM