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

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
Hey guys.

I wrote the DS-X Manager. It should work with all carts. I just called it DS-X Manager because I bought a DS-X and posted it on the DS-X Forums. It's fully compatible with all those other carts. In fact, the new version v0.3 will be released as NDS Manager but it's mostly just a name change.

This is why DS-X Manager's trimming is different:
Every rom has a set point for where the data ends. It's in the header. The trimmer I wrote writes up to that point. After that, there's 4 bytes of blank space, followed by 184 bytes the WiFi data. If you trim roms by just using the ROM Size and don't take into account the wifi you'd break download play (and maybe something else) on the carts that support it.

I've been developing this application originally for the DS-X

You can find a link to it here
http://forums.ds-xtreme.com/showthread.php?t=1050

It basically works for any DS cart that uses FAT but since the DS-X was the first one I got I based it around that. The new version i'm writing (v0.3) will be renamed to NDS Manager because it'll be able to support any NDS Flash Cart that uses a FAT file system (including the microSD ones). It supports reading within RAR files and ZIP files and extracts them automatically and includes the option to trim on copy. It also allows creating a library for quicker access to your files.

Latest versions are:
v0.2.6.1 (beta) (trim/zip/rar support)
v0.2.4 (stable) (trim/zip)

If you are using 0.2.6.1 be sure to include the ICSharpCode.SharpZipLib.dll and unrar.dll also on the forum's page.
Again, this WILL work for other carts besides DS-X if it uses a drive folder (ie: "E:\")

Included here is a screenshot of version 0.2.5 though there have been some changes with the revision to 0.2.6.x
DS-X_Manager.jpg


I developed a method for trimming which is safer than dslazy's method (or R4 since they copy dslazy's method). Already people on the forum have claimed that issues they had with trimming using R4's trimmer (issues such as white screen / crashing) didn't happen when trimming using DS-X Manager.

I have made a stand-alone for the trimmer and called it NDS Trimmer. It is open source and has been ported to C and well as C++. It is available here:
http://forums.ds-xtreme.com/showthread.php?t=1964
On that thread, there is already a win32 version, mac os x (universal build). it has already been compiled for even AmigaOS and some have already compiled it for use on linux systems.

Here a repost of the reason why I released the source code:
QUOTE said:
NDS Trimmer is a very simple way to trim files. I didn't want to complicate it. I wanted it to be a simple as possible so people can look it and say "oh, that's how it's done"
i'm not even a C++ programmer. i mostly write VB.NET
i just REALLY didn't like dslazy's trimming method because it can cause problems. and it has shown. r4's method of trimming is a copy of dslazy's and people have reported white screens / crashes when they try trimming.

this is what i started DS-X Manager (now NDS Manager) for. I didn't like the complicated method of use dslazy for trimming roms and then moving it. it all started with this code and I hope it can inspire others to create programs as well.

Why DSLazy and R4 Trimmer trim incorrectly. What you came here to read
DSLazy and R4 Trimmer do it differently (and much slower too). It reads the ROM from the end, and keeps trimming until it finds something that isn't FF or 00. This is bad way of trimming. I explained this on the DS-X thread so I'll just repost what I wrote.

Post one:
QUOTE said:
i'm realizing dslazy's included NDS Rom Trimmer trims more than it should. it might cause problems for some games. the header says where the rom ends on the card, but dslazy's trimmer deletes trailing FF's and 00's from the last file. I'm assuming it's working backwards, from the end of the cart to the last file, but it keeps going until it finds something that's not 00 or FF... I think it shouldn't be done. I haven't had a problem yet... but... I'll trim up to where the developers said where the empty data starts (which is, as i said, specified in the header)

Post two:
QUOTE
0x080 to 0x083 holds the ROM Size

DSLazy/Trimmer starts cutting backwards from the end. The problem is that in the file table, it says where in the rom a file begins and a file ends. it's luck it works. let's say the last file on the table was a sprite file and it's between 101 and 150. Let's say the header says the rom ends in 150, being that it's the last file. let's say from 141 to 150, it's all FF (in hex). And finally, let's say the card size is 200.

According to the header, the unused space is from 151 to 200. Now this is true. What DSLazy/Trimmer does, it counts back from 200 until it finds a value not equal to 00 or FF. It should erase up to 151, but since the end of the last file has FF, it keeps going until 141. In some games, this might not cause a problem.

Now supposed the last file on the ROM is a sprite, and the developer sends a command to copy it the memory or whatever, maybe send it via wifi, anything. When it looks to send the file, it checks the FAT (file allocation table) and expects to read from 101 to 150, but in fact, the file has been truncated from 101 to 140. This might cause problems when it tries to read sector 141 as in, a crash. So I'm not going to truncate from the last file and any rom that has truncated files is flagged red in my program.

What if the last file is a sprite uses color#16 (in the palette) twice in a row (0xFF) for the last few bytes? What if it's an audio file with silence at the end (0x00)?

And then I later learned that the wifi data comes after the rom size and DSLazy / R4 Trimmer could be trimming that data.
FF and 00's are values (0x00 = Null, 0xFF = 255) and the other method could be erasing data which, as I said could crash/break your game.


Download here:
DS-X Manager v0.2.4
DS-X Manager v0.2.6.1 (dll's included)
 

aristo

Well-Known Member
Newcomer
Joined
Dec 20, 2006
Messages
71
Trophies
0
Website
Visit site
XP
34
Country
WOW!
Excellent work!!

I will wait for your NDS Manager...
It will be the MUST HAVE utility for all the NDS cart user around the globe!

Keep up the good work!
 

magikalfly

Active Member
Newcomer
Joined
Dec 7, 2006
Messages
42
Trophies
0
XP
40
Country
ShortFuse, I have a question. I tried your manager. I've been using bodom child's trimmer with no problems yet.

"Look here, a little program I've done :

http://www.playeradvance.org/forum/showthread.php?t=5293

http://weburn.net/nds/DS%20Trimmer.rar

The readme is in french, here's how it work :

Launch the program DS Trimmer, select your roms, drag & drop them in the little window, and wait a few second smile.gif

All the trimmed roms will be in a folder named "Roms trimmées".

Enjoy smile.gif"

However, your manager gives different trimmed sizes. Some games, it seems the DSX manager results in a smaller file than bodom's trimmer. Any clue as to what's going on? People have been using both trimmers with no problems so what's with the file size discrepancies?
 

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
However, your manager gives different trimmed sizes.  Some games, it seems the DSX manager results in a smaller file than bodom's trimmer.  Any clue as to what's going on?  People have been using both trimmers with no problems so what's with the file size discrepancies?
i don't know how bodom's works so i can't really say. at least bodom's is not over trimming but i guess there's more that can be trimmed. the problem arise when you overtrim.

dslazy/r4 trimmer use what's more of a guessing strategy (maybe bosom's does too) while DS-X does calculations based on the rom header's info
 

cory1492

Well-Known Member
Member
Joined
Jun 23, 2005
Messages
1,497
Trophies
1
Location
Home, WhereElse?
XP
334
Country
Canada
You'd think the programmers who are clever enough to make these devices work would be clever enough to simply read the header defines from ndstool
frown.gif


At any rate, as you say with the wifi data (I think this is what you are saying at any rate) it is technically safer to not trim any ROM even to the header sizes as there is a slim possibility of vital data outside the defined ROM area/inside the unused space.
 

kirra

Well-Known Member
Member
Joined
Jun 11, 2006
Messages
117
Trophies
0
XP
111
Country
United States
ShortFuse, I have a question. I tried your manager. I've been using bodom child's trimmer with no problems yet.Â

"Look here, a little program I've done :

http://www.playeradvance.org/forum/showthread.php?t=5293

http://weburn.net/nds/DS%20Trimmer.rar

The readme is in french, here's how it work :

Launch the program DS Trimmer, select your roms, drag & drop them in the little window, and wait a few second smile.gif

All the trimmed roms will be in a folder named "Roms trimmées".

Enjoy smile.gif"

However, your manager gives different trimmed sizes. Some games, it seems the DSX manager results in a smaller file than bodom's trimmer. Any clue as to what's going on? People have been using both trimmers with no problems so what's with the file size discrepancies?

bodom child's trimmer has been great, its simple to use and does a great job. I highly recommend it. I didn't like the bulky interface of the DS-X Manager.
 

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
You'd think the programmers who are clever enough to make these devices work would be clever enough to simply read the header defines from ndstool
frown.gif


At any rate, as you say with the wifi data (I think this is what you are saying at any rate) it is technically safer to not trim any ROM even to the header sizes as there is a slim possibility of vital data outside the defined ROM area/inside the unused space.

nintendo wifi download play key or w/e it is, comes 136 bytes (186 was a typo but eh, what's 50bytes) after certain roms. we found this out on the ds-x forum when mario kart's download play didn't work. i put all roms to append 186bytes to the filesize just in case. i mean, what's 186bytes. a tenth of a KB
 

GSBS

Member
Newcomer
Joined
Jan 19, 2007
Messages
13
Trophies
1
XP
303
Country
United States
So I assume gameplay shouldn't be altered in any way because of your discoveries?
biggrin.gif


I really love the interface for mass trimming and knowing the amount of room all the games will take up on my card once trimmed. Really helps if you are cramming (like most trimmers are.) What are the odds we can see a GBA counterpart to this? Flash Advance Tool is the standard (I believe), but this UI is so much more efficient.
 
Joined
Nov 8, 2003
Messages
975
Trophies
0
Age
36
Website
Visit site
XP
174
Country
United States
Hmm.. when transferring roms to the card, some kind of progress bar would be nice. Also, an option for renaming roms couldn't hurt. And I'm not sure if this is implemented, but the option to transfer existing saves.

Just some suggestions. Good job otherwise.
 

ShortFuse

Well-Known Member
OP
Member
Joined
Nov 17, 2006
Messages
132
Trophies
1
XP
243
Country
United States
Hmm.. when transferring roms to the card, some kind of progress bar would be nice. Also, an option for renaming roms couldn't hurt. And I'm not sure if this is implemented, but the option to transfer existing saves.

Just some suggestions. Good job otherwise.

yeah the transfer bar broke in the beta release but the final (stable) has it.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    ZeroT21 @ ZeroT21: horny jail is full la