Hacking Don't use DSLazy or R4 Trimmer to trim roms!!!

outphase

Custom title
Member
Joined
Nov 21, 2005
Messages
1,217
Trophies
0
Website
Visit site
XP
176
Country
United States
ShortFuse's app is great. Pipelining an unzipped rom is golden
biggrin.gif
Then again, most windows users need not worry about the command line as much as a linux user
 

ferchl

New Member
Newbie
Joined
Aug 30, 2004
Messages
3
Trophies
0
XP
156
Country
United States
I am not surprised that people are experiencing crashes using ROMs trimmed with R4DS ROM Trimmer.exe. If you do a before and after binary compare of a ROM trimmed with this tool you will see many changes throughout the file. It appears this tool is replacing all occurences of FF with 00 in addition to trimming the file.

I am currently comparing trimming all ROMs using DS-X Manager and NDStrim by sgaap (downloaded from www.scorpei.com). The results are interesting. Not one came out exactly the same. Most often, NDStrim yielded a slightly larger file, but sometimes they were smaller. Also, NDStrim skipped a few files and displayed "Couldn't find the end of the file?". An example of one of these files is 0054 - Tiger Woods PGA Tour (UE) (M3) (v1.1).nds.

So, I really don't know which tool to use. Both seem to do a good job, but the difference in the output concerns me.
 

bollocks

Well-Known Member
Member
Joined
Apr 29, 2005
Messages
662
Trophies
0
XP
148
Country
I am not surprised that people are experiencing crashes using ROMs trimmed with R4DS ROM Trimmer.exe. If you do a before and after binary compare of a ROM trimmed with this tool you will see many changes throughout the file. It appears this tool is replacing all occurences of FF with 00 in addition to trimming the file.
wait, what? wouldn't that break ... pretty much everything?
 

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
Chou-Gekijou-Ban Keroro Gunsou - Enshuu Dayo! Zenin Shuugou is the same too, 186byte file when you try to trim it.

Serial is : NTR-AKRJ-JPN

I know. This has been fixed in the latest beta. At least I think I fixed it. Also, R4 is doing more than trimming. It's rebuilding the files and rewriting the file allocation table. I was thinking about this but I got lazy and worried about compatibility. I was going to do it as "hey, try this beta method of extreme trimming." Either way, i'm in the process of adding to sourceforge and gathering a team of developers to help continue my project. It's not dead, just... well yeah, it's kinda dead but...

::clap:: touches project
*blue lights flash*

(way too much FMA)
 

BrianTokyo

NDSTokyoTrim Dev.
Member
Joined
Jun 28, 2007
Messages
658
Trophies
1
Website
www.eden.fm
XP
339
Country
Feel free to try my trimmer, NDSTokyoTrim, discussion thread and download links in my sig
smile.gif
It detects if the rom has a wifi block or not, trims exactly the right amount of bytes, and is fast up to less than 0.1 secs for 5-10 roms (0.46 beta). Runs in windows up to Vista, and does not need .net
 

Wii_DS.

ウォリアー
Banned
Joined
Sep 5, 2007
Messages
681
Trophies
0
Website
fcrc.weebly.com
XP
2
Country
Feel free to try my trimmer, NDSTokyoTrim, discussion thread and download links in my sig
smile.gif
It detects if the rom has a wifi block or not, trims exactly the right amount of bytes, and is fast up to less than 0.1 secs for 5-10 roms (0.46 beta). Runs in windows up to Vista, and does not need .net

And it is basically the best trimmer available.
 

squeakypants

Well-Known Member
Newcomer
Joined
Jun 22, 2007
Messages
47
Trophies
0
XP
40
Country
United States
I saw your code, and I figured "that looks easy." Turns out, for once, I was right! Here's my carbon copy in python
smile.gif

CODEfrom sys import argv
source = argv[1]
if len(argv) == 3:
ÂÂÂÂdestination = argv[2]
else:
ÂÂÂÂdestination = source.rstrip(source.split(".")[-1]) + "new.nds"

input = open(source, 'rb', 4096)
output = open(destination, 'wb', 4096)
position = 0
bufferlength = 4096
buffer = [0] * 4096
TrimSizeA = [0] * 4
input.seek(128)

for i in xrange(4):
ÂÂÂÂTrimSizeA = input.read(1)

num = [0L] * 4
for i in xrange(4):
ÂÂÂÂnum = ord(TrimSizeA)
ÂÂÂÂif (num < 0): num = 256 + num

limit = num[0] + num[1]*256 + num[2]*256*256 + num[3]*256*256*256 + 136;

input.seek(0)
print "Trimmed File Size:", limit/1024.0, "KB"

while(position < limit):
ÂÂÂÂbuffer = input.read(bufferlength)
ÂÂÂÂoutput.write(buffer)
ÂÂÂÂ
ÂÂÂÂif position + bufferlength > limit:
ÂÂÂÂÂÂÂÂposition += limit - position
ÂÂÂÂelse:
ÂÂÂÂÂÂÂÂposition += bufferlength
ÂÂÂÂif position / limit < 0.25 and (position + bufferlength) / limit >= 0.25:
ÂÂÂÂÂÂÂÂprint "25%"
ÂÂÂÂif position / limit < 0.5 and (position + bufferlength) / limit >= 0.5:
ÂÂÂÂÂÂÂÂprint "50%"
ÂÂÂÂif position / limit < 0.75 and (position + bufferlength) / limit >= 0.75:
ÂÂÂÂÂÂÂÂprint "75%"

print "Done"
input.close()
output.close()

Python made it so much easier. All that position and bufferlength stuff doesn't even need to be there (in the while), I just kept it for the percentages.

(yes I know this is an old post, but I got the code from one of the links he posted in this thread)

EDIT: I refined it a bit:
Code:
from sys import argv
source = argv[1]
if len(argv) == 3:
ÂÂÂÂdestination = argv[2]
else:
ÂÂÂÂdestination = source.rstrip("nds") + "new.nds"

print "Output:", destination

input = open(source, 'rb', 4096)
output = open(destination, 'wb', 4096)

input.seek(128)
num = [ord(input.read(1)) for i in xrange(4)]
limit = num[0] + num[1]*256 + num[2]*256*256 + num[3]*256*256*256 + 136;
print "Trimmed File Size:", round(limit/1048576.0,2), "MB"

input.seek(0)
out = 0
for position in xrange(0,limit,4096):
ÂÂÂÂbuffer = input.read(4096)
ÂÂÂÂoutput.write(buffer)
ÂÂÂÂpercent = 100 * position / limit
ÂÂÂÂif percent >= out + 25:
ÂÂÂÂÂÂÂÂout += 25
ÂÂÂÂÂÂÂÂprint str(out) + "%"

print "Done"
input.close()
output.close()
 

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
Well my post is rather old and that was a year ago I released it. This past week I've done a major rewrite to the whole thing. In some ways it's inferior to the previous version but I've been trying to get native 7z working. I also brought back the style to the older version but broke some functionality. I'm trying to bring it back. I felt the single grid was too cluttered.
This has mostly been a personal application for myself and I tend to add things as they go. Now since my NDS library is in 7z format I've gone back to coding. I'm going try to fix this up for maybe a release by the end of next week. Is there any way to get GbaTemp's CRC32 database with their numbering?

Part of the changelog:
Version 0.3
-----------
Renamed to NDS Manager
Fixed bug where file scanner would freeze if a ZIP file contained a directory
Added support for other (any) devices
Redesigned GUI back to original style but with new toolbar
Optional CRC32 checks
Better homebrew detection
Pocketheaven DAT for have/missing list similar to GoodTools (requires CRC32)
Changed queue method.
Removed window size restrictions
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • A @ anotherthing:
    Online was free on the 3DS as well, and it worked well.
    +1
  • S @ salazarcosplay:
    I can't help but think nintendo switch online is the reason we did not get a gameboy/n64/gamecube
    mini classic edition
    +1
  • Xdqwerty @ Xdqwerty:
    @salazarcosplay, i think it would have been impossible to see anything in a gameboy mini
  • S @ salazarcosplay:
    well I meant that as a figure of speech
  • S @ salazarcosplay:
    they could just rerelease a modern gameboy
  • S @ salazarcosplay:
    like the pocket analogue
  • S @ salazarcosplay:
    but nintendo licensed
  • LeoTCK @ LeoTCK:
    dammit that thread got moved from offtopic to edge, well since that happened
  • Xdqwerty @ Xdqwerty:
    @LeoTCK, atleast it's still avaliable
  • LeoTCK @ LeoTCK:
    yes but it wasn't meant to be a comedy thread
  • LeoTCK @ LeoTCK:
    and edge of the forum is mostly comedy and games
  • LeoTCK @ LeoTCK:
    so I don't get why it got moved at all
  • Xdqwerty @ Xdqwerty:
    @LeoTCK, mods are probably hating you
  • LeoTCK @ LeoTCK:
    on most sites mods hated me, sooner or later, but usually over time I get either banned or the mods get used to me
  • LeoTCK @ LeoTCK:
    sometimes to the point of thanking me for my quick actions etc against spam and other stuff, but yea...its either they come to respect me or outright hate me
    +1
  • BigOnYa @ BigOnYa:
    If it's not game related, it will be moved to the Egde of the forum. Mods have moved a few of my threads also.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, it was in the off topic chat forum
  • BigOnYa @ BigOnYa:
    Well atleast they didn't delete it completely.
  • LeoTCK @ LeoTCK:
    hmm
  • Xdqwerty @ Xdqwerty:
    uoiea
  • LeoTCK @ LeoTCK:
    huh?
  • Xdqwerty @ Xdqwerty:
    Aeiou backwards
    Xdqwerty @ Xdqwerty: Aeiou backwards