Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

NDS Rom Renamer (free app from me) ....

Old Dec 21, 2007 | 05:27 PM
  #1  
ChefDude's Avatar
ChefDude
Thread Starter
Scooby Regular
 
Joined: Aug 2005
Posts: 4,291
Likes: 0
Default 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
Reply
Old Dec 21, 2007 | 06:11 PM
  #2  
DJ Dunk's Avatar
DJ Dunk
Moderator
20 Year Member
iTrader: (5)
 
Joined: Nov 2001
Posts: 17,864
Likes: 0
From: Not all those who wander are lost
Default

Works a treat, thanks

Can it automatically replace underscores with spaces too?
Reply
Old Dec 21, 2007 | 09:48 PM
  #3  
Pumpkin's Avatar
Pumpkin
Scooby Senior
 
Joined: Mar 1999
Posts: 1,835
Likes: 0
From: Norwich
Default

cool
Reply
Old Dec 21, 2007 | 10:05 PM
  #4  
stevem2k's Avatar
stevem2k
Scooby Regular
 
Joined: Sep 2001
Posts: 4,670
Likes: 0
From: Kingston ( Surrey, not Jamaica )
Default

found the password then

Cheers

Steve
Reply
Old Dec 24, 2007 | 11:56 PM
  #5  
boxst's Avatar
boxst
Scooby Regular
 
Joined: Nov 1998
Posts: 11,905
Likes: 0
Default

Thank you, that's cool.

Steve
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
Jul 2, 2023 01:54 PM
Sam Witwicky
Engine Management and ECU Remapping
17
Nov 13, 2015 10:49 AM
XRS
Computer & Technology Related
18
Oct 16, 2015 01:38 PM
Wurzel
Computer & Technology Related
10
Sep 28, 2015 12:28 PM
Littleted
Computer & Technology Related
4
Sep 25, 2015 09:55 PM


Thread Tools
Search this Thread

All times are GMT +1. The time now is 05:05 AM.