ROM Hack Gateway 3DS microSD Tool

_Tim_

Well-Known Member
OP
Newcomer
Joined
Dec 23, 2013
Messages
63
Trophies
0
Age
43
XP
210
Country
Belgium
Run "gw3ds.exe scan x:" (where "x:" is the driveletter of your GW3DS microSD card) from a command prompt window to scan for problems. Run "gw3ds.exe fix x:" to fix fragmentation errors and missing game icons.

You receive a fragmentation error when the rom file has more than 32 fragments.
You receive a fragmentation error when the rom file occupies either of the last two clusters on an exFAT partition.
You don't see all game icons if the root directory entry is fragmented.

https://dl.dropboxusercontent.com/u/94421767/gw3ds_ver_12.zip
https://dl.dropboxusercontent.com/u/94421767/gw3ds_ver_10.zip

EDIT: Avast seems to think that my program is infected with malware. I can assure you that it contains no malware. I wrote and compiled the program myself. I reported the false positive to Avast so hopefully they will fix it in their next virus database update.
 

migles

All my gbatemp friends are now mods, except for me
Member
Joined
Sep 19, 2013
Messages
8,034
Trophies
0
Location
Earth-chan
XP
5,234
Country
China
AVAST POPED UP VIRUS OMG OMG VIRUS!111!!!ONEONEONE!!!

people, now seriously, make sure you be carefull..

edit: also, dont use defragger tools on sd cards or any flash memory, it kills the card much faster...

and windows and OSes already have their own degragger tools, and ther is the defragger from piriform, this tool is not needed...
 

_Tim_

Well-Known Member
OP
Newcomer
Joined
Dec 23, 2013
Messages
63
Trophies
0
Age
43
XP
210
Country
Belgium
edit: also, dont use defragger tools on sd cards or any flash memory, it kills the card much faster...

and windows and OSes already have their own degragger tools, and ther is the defragger from piriform, this tool is not needed...
I wrote this tool to fix GW3DS fragmentation errors. It defragments only if it is necessary. For example, if a rom file consists of 35 fragments, my program will reduce the number of fragments to 32 by combining the 4 smallest fragments into a single fragment. It is faster and introduces less wear than reformatting and copying everything back.
 

migles

All my gbatemp friends are now mods, except for me
Member
Joined
Sep 19, 2013
Messages
8,034
Trophies
0
Location
Earth-chan
XP
5,234
Country
China
heres the screenshot.
gw3ds screen.PNG
 

zhdarkstar

Well-Known Member
Member
Joined
Jan 30, 2008
Messages
570
Trophies
0
XP
494
Country
United States
While I have no immediate use for this tool, as all of the roms on my mSD are working properly, thinking about how it functions does bring up one possible concern. External fragmentation as a result of repeated usage of this tool over time. I'll admit that it's more of an outlier scenario affecting mostly smaller mSDs or those kept near capacity, it's one that your targeted defragging code could probably fix with only a little tweaking. Perhaps you could add a free space optimizer that triggers only when external fragmentation reaches a certain threshold, or at least a warning message advising the user to address the issue. That way it also helps to prevent newer files added to the mSD from suffering excessive data fragmentation, by making the free space look less like swiss cheese.

Also, I'm curious as to why you decided to defrag only the smallest fragments, as opposed to the largest fragments. I understand from a wear and tear perspective, but couldn't the creation of all of those small holes in the memory allocation cause files added later to be excessively fragmented due to a large amount of small clusters of free space? Just a little food for thought.
 

_Tim_

Well-Known Member
OP
Newcomer
Joined
Dec 23, 2013
Messages
63
Trophies
0
Age
43
XP
210
Country
Belgium
While I have no immediate use for this tool, as all of the roms on my mSD are working properly, thinking about how it functions does bring up one possible concern. External fragmentation as a result of repeated usage of this tool over time. I'll admit that it's more of an outlier scenario affecting mostly smaller mSDs or those kept near capacity, it's one that your targeted defragging code could probably fix with only a little tweaking. Perhaps you could add a free space optimizer that triggers only when external fragmentation reaches a certain threshold, or at least a warning message advising the user to address the issue. That way it also helps to prevent newer files added to the mSD from suffering excessive data fragmentation, by making the free space look less like swiss cheese.
Free space optimizer? I'd rather leave that to a real defragmentation program. I could calculate and show some statistics to know how fragmented the microSD card is. For instance, I could show the size of the largest contiguous block of free space, the total size of the 32 smallest/largest contiguous blocks of free space, ... If you run "gw3ds.exe scan x:" you can already see the number of fragments for each 3DS file.

Also, I'm curious as to why you decided to defrag only the smallest fragments, as opposed to the largest fragments. I understand from a wear and tear perspective, but couldn't the creation of all of those small holes in the memory allocation cause files added later to be excessively fragmented due to a large amount of small clusters of free space? Just a little food for thought.
I wanted to fix those fragmentation errors without having to wait longer than necessary.
 

Oxybelis

Well-Known Member
Member
Joined
Jan 10, 2010
Messages
349
Trophies
0
XP
379
Country
While I have no immediate use for this tool, as all of the roms on my mSD are working properly, thinking about how it functions does bring up one possible concern. External fragmentation as a result of repeated usage of this tool over time. I'll admit that it's more of an outlier scenario affecting mostly smaller mSDs or those kept near capacity, it's one that your targeted defragging code could probably fix with only a little tweaking. Perhaps you could add a free space optimizer that triggers only when external fragmentation reaches a certain threshold, or at least a warning message advising the user to address the issue. That way it also helps to prevent newer files added to the mSD from suffering excessive data fragmentation, by making the free space look less like swiss cheese.

Also, I'm curious as to why you decided to defrag only the smallest fragments, as opposed to the largest fragments. I understand from a wear and tear perspective, but couldn't the creation of all of those small holes in the memory allocation cause files added later to be excessively fragmented due to a large amount of small clusters of free space? Just a little food for thought.
There are could be a lot of cases. But the case where a lot of ROMs scattered with >32 fragments is already an extreme case which should not happen frequently. I think program logic is fine.
 
  • Like
Reactions: Subtle Demise

Bug_Checker_

Well-Known Member
Member
Joined
Jun 10, 2006
Messages
950
Trophies
0
XP
663
Country
United States
Run "gw3ds.exe fix x:" (where "x:" is the driveletter of your GW3DS microSD card) from a command prompt window to fix fragmentation errors and missing game icons.

You receive a fragmentation error when the rom file has more than 32 fragments.
You receive a fragmentation error when the rom file occupies either of the last two clusters on an exFAT partition.
You don't see all game icons if the root directory entry is fragmented.

https://dl.dropboxusercontent.com/u/94421767/gw3ds_ver_10.zip

EDIT: Avast seems to think that my program is infected with malware. I can assure you that it contains no malware. I wrote and compiled the program myself. I reported the false positive to Avast so hopefully they will fix it in their next virus database update.


Is this problem seen with other exfat implementations or only Gateway's?

btw 0/53 on virustotal
https://virustotal.com/en/file/c857b056c3b85a92fe327bd746250bf48e486d53f32ab9cba71b7ce3335f14d4/analysis/
[URL=https://www.virustotal.com/en/file/5416ed0097c28f217afd6d39131b5ceab2584ff77eda6bfcbd6da359a7e56e0e/analysis/1406232426/']https://virustotal.com/en/file/5416ed0097c28f217afd6d39131b5ceab2584ff77eda6bfcbd6da359a7e56e0e/analysis/
[/URL]
 

_Tim_

Well-Known Member
OP
Newcomer
Joined
Dec 23, 2013
Messages
63
Trophies
0
Age
43
XP
210
Country
Belgium
Is this problem seen with other exfat implementations or only Gateway's?
It is a GW3DS bug. The exFAT partition info contains the cluster count, unlike FAT16/32 partitions. The first data cluster starts at number 2. Number 0 and 1 are reserved. If the number of clusters is "n" then the number of the last cluster is "n+2". There is probably a check somewhere in the GW3DS code to see if a cluster number is valid where they compare the cluster number against the cluster count, without adding/subtracting 2. My program "releases" those two last clusters if they are in use by a file and then creates a small file named "_GW3DS_DO_NOT_DELETE.BIN" in the root directory which will occupy the last two clusters, to prevent the fragmentation error from reoccurring.
 

mijuu

Well-Known Member
Member
Joined
Jan 9, 2010
Messages
390
Trophies
0
XP
376
Country
This tool works great, no more fragmentation errors in GW. Both me and a friend of mine had this bug so its not that uncommon.
 
D

Deleted User

Guest
Have you tried to email Gateway team? I'm sure they can fix it in the next launcher release
 

Kazuma77

Well-Known Member
Member
Joined
May 11, 2008
Messages
1,035
Trophies
0
XP
865
Country
United States
What can I say? Nice app. I usually don't get errors, being a Total Commander user, but this is nice for checking the card. Certainly beats having to format and re-copy if something does go wrong. And I like the way the output is displayed. Thanks.
 
  • Like
Reactions: Sirius64

tyons

Well-Known Member
Member
Joined
Jul 11, 2012
Messages
656
Trophies
0
XP
261
Country
Italy
I have a micro sd formatted in exFat that my gateway can't read (the diagnostic test always fails). it happened when it was formatted in FAT32, too.
I tried this tool but it says

Drive F

Error: The drive type is not supported. (1)

### ERROR CODE 15 ###

I inserted the card in its oiriginal SD adapter and plugged that in the pc.
I use windows 8.1, if it can matter.
I run the tool with the command prompt opened as an admin and it's the same.

I'll try to format the microSD to FAT32 now.

edit: the same error is given with FAT32.


EDIT 2: I FEEL SO STUPID. I had to write "F:" not "F".

aaand the gateway still can't read the microSD. I guess it's definitely malfunctional... (I had it repaired because I couldn't update it, but probably that ruined the microSD reading stuff).

edit 3: lol the test fails but sometimes in emunand it manages to show the games. when I open one it says "fragmentation error" (even though I used this tool). sometimes the icons show up white and sometimes corrupted >_>

edit 4: oh wow, when I keep the top of the gateway card pressed against the 3ds, it works perfectly. I guess I need to glue it properly.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    KenniesNewName @ KenniesNewName: Won't lie kinda cool...