Banner
Views: 235,745,963
Time: 2013-05-18 10:11:55 AM
15 users online: AirMario, Atomik Bo0, Cesar the FoxWolf, Counterfeit, Falconpunch, o HuFlungDu, Incognito, levelengine, MarioBros980, RaindropDry, Sadistic Designer, o Scrydan, Sokobansolver, SomeGuy712x, X-cniS - Guests: 43 - Bots: 12Users: 22,833 (1,280 active)
Latest: TheFrozenParticle
Tip: Verify your ROM is unedited by using ROMclean.
How to check ROM is a correct SMW ROM?
Forum Index - Hobbies - Computers & Technology - How to check ROM is a correct SMW ROM?
Pages: « 1 »
I making a program who edits the ROM,it working perfectly but i want my program will check the file loaded. And also i want my program writes byte to textbox.
I use Visual Studio 2010 (Visual Basic .NET) but i can convert c# codes to vb.net.
Check for some random code nobody ever touches.
If the 29 bytes at 0x15D5C are "20 3F DC A9 FF 9D 94 15 A0 09 B9 C8 14 C9 08 D0 07 B9 9E 00 C9 9B F0 05 88 10 EF 80 25", it's an SMW ROM.
If the 29 bytes at 0x15B5C are "20 3F DC A9 FF 9D 94 15 A0 09 B9 C8 14 C9 08 D0 07 B9 9E 00 C9 9B F0 05 88 10 EF 80 25", it's also an SMW ROM, but this one is unheadered.

Or do it like LM and check the internal ROM name. If the 22 bytes at 0x081C0 (0x7FC0) are "53 55 50 45 52 20 4D 41 52 49 4F 57 4F 52 4C 44 20 20 20 20 20 20" ("SUPER MARIOWORLD "), it's an SMW ROM.
Last edited on 2011-07-15 03:42:25 PM by Alcaro.
Originally posted by Alcaro
Check for some random code nobody ever touches.
If the 29 bytes at 0x15D5C are "20 3F DC A9 FF 9D 94 15 A0 09 B9 C8 14 C9 08 D0 07 B9 9E 00 C9 9B F0 05 88 10 EF 80 25", it's an SMW ROM.
If the 29 bytes at 0x15B5C are "20 3F DC A9 FF 9D 94 15 A0 09 B9 C8 14 C9 08 D0 07 B9 9E 00 C9 9B F0 05 88 10 EF 80 25", it's also an SMW ROM, but this one is unheadered.

Or do it like LM and check the internal ROM name. If the 22 bytes at 0x081C0 (0x7FC0) are "53 55 50 45 52 20 4D 41 52 49 4F 57 4F 52 4C 44 20 20 20 20 20 20" ("SUPER MARIOWORLD "), it's an SMW ROM.

Thanks,but i don't know how to check the bytes... :S
in C# it looks a lot like this:

Code
private bool is_SMW (string rompath) { byte[] chkstr = { 0x20, 0x3F, 0xDC, 0xA9, 0xFF, 0x9D, 0x94, 0x15, 0xA0, 0x09, 0xB9, 0xC8, 0x14, 0xC9, 0x08, 0xD0, 0x07, 0xB9, 0x9E, 0x00, 0xC9, 0x9B, 0xF0, 0x05, 0x88, 0x10, 0xEF, 0x80, 0x25 }; byte[] rombyte = File.ReadAllBytes(rompath); int lentd = rombyte.Length % 0x8000; if (lentd != 0 && lentd != 0x200) { MessageBox.Show("Invalid ROM size"); return false; } for (int j = 0; j < 29; j++) { if (rombyte[j + lentd + 0x15B5C] != chkstr[j]) return false; } return true; }


Untested, but it should work.

Also, the code does not stretch the tables for me, but I've got a gigantic monitor, so if it does for anyone I'll disable my layout.

e: added 0x to the byte array numbers. stupid stupid me for forgetting them in the first place.
Last edited on 2011-07-16 03:51:08 PM by Noobish Noobsicle.
Gah! A byte array! Why didn't I think of that?!

(I was going to write up a sample, but couldn't think of how to implement it. :/)
Originally posted by Noobish Noobsicle
in C# it looks a lot like this:

Code
private bool is_SMW (string rompath) { byte[] chkstr = { 0x20, 0x3F, 0xDC, 0xA9, 0xFF, 0x9D, 0x94, 0x15, 0xA0, 0x09, 0xB9, 0xC8, 0x14, 0xC9, 0x08, 0xD0, 0x07, 0xB9, 0x9E, 0x00, 0xC9, 0x9B, 0xF0, 0x05, 0x88, 0x10, 0xEF, 0x80, 0x25 }; byte[] rombyte = File.ReadAllBytes(rompath); int lentd = rombyte.Length % 0x8000; if (lentd != 0 && lentd != 0x200) { MessageBox.Show("Invalid ROM size"); return false; } for (int j = 0; j < 29; j++) { if (rombyte[j + lentd + 0x15B5C] != chkstr[j]) return false; } return true; }


Untested, but it should work.

Also, the code does not stretch the tables for me, but I've got a gigantic monitor, so if it does for anyone I'll disable my layout.

e: added 0x to the byte array numbers. stupid stupid me for forgetting them in the first place.

Thank you! it worked!I also edited the code a bit for create an exception.
Using a SHA1 or SHA2 or MD5 sum would be a much better method, by the way. It'd test the entire ROM to make sure it is the correct and clean SMW ROM... Obviously this only works if you are expecting for sure a clean ROM. Perhaps check for clean then give a warning on a non-clean ROM?
Last edited on 2011-11-24 07:01:49 PM by monadic.
His tool wants to edit the ROM, and I think he wants his tool to be able to read its own output (while rejecting Yoshi's Island ROMs).
But I can't deny that SHA-1 (or something similar) is better if you want to check for a clean ROM.
Pages: « 1 »
Forum Index - Hobbies - Computers & Technology - How to check ROM is a correct SMW ROM?

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2013 - SMW Central
Legal Information - Link To Us


Total queries: 29

Menu