GPF Converter

Started by dcx2, June 05, 2011, 06:29:03 PM

Previous topic - Next topic

dcx2

http://www.mediafire.com/download/7p4x4339pzfligp/GPFConveter.zip

This is a simple app.  Just plug 00/02/04/06 codes into the textbox, press "Save GPF", and it will create a proper gpf file for you to use with Gecko OS.

Name the gpf file after your game.  For instance, Tales of Symphonia is RT4EAF, so I named my file "RT4EAF.gpf".  Place the resulting file in SD:\patch\ (e.g. SD:\patch\RT4EAF.gpf )

GPF files are codes that are written only once, right after the game loads.  So a data hack (like inf health) won't work because it must write during each frame to work.  But just about every ASM patch works.  Data tables that are only read from (e.g. Tales' encounter and experience tables) also work.

This is useful if you have a ton of codes and you're hitting the code limit.  You can put the ASM patches into a gpf file to save code space.

EDIT:

BTW, the text box is cleared of all non-code related info.  So you can copy and paste pretty liberally into it.  You do not need the *'s, but if they are there from whatever you copy from, they get parsed out.

hetoan2

Nice. It's a shame that games like call of duty reload the assembly when you move between different sections of the game. :(


Check out my site with codes obviously...
http://hetoan2.com/

and youtube...
http://youtube.com/hetoan2

dcx2

I can throw up the source tonight.  You might want to steal the method I use for stripping text from the input and reducing it to just code types for your own converter.

dcx2

In summary, I read the contents into a string[] array, one element for each line.

Then I used regular expressions to remove every line from the string[] that didn't match the pattern "8 hex digits, followed by white space, followed by 8 hex digits".

Then, I stripped all non-hex, non-whitespace characters from a line.

dcx2

#4
Regex will give you a headache if you stare at it too long.

if (Regex.Match(codesToSanitize[ i], @"^[0-9A-F]{8}\s[0-9A-F]{8}$").Success)

The @ prefix on a string literal spares you the agony of manually escaping characters like \ etc.  The ^ means "match the beginning of the line" (lines were sanitized before this snippet).  The [0-9A-F] means "match any hex digit".  The {8} means "match 8 of them".  \s means "match whitespace".  The $ means "match the end of the line".

Source is attached.  All the action happens in GPFConveter.cs.

James0x57

codesToSanitize is an array of single lines from the input?

If it's not necessarily a single line then it will match this too:
00000000
00000001

(unless multiline mode is default or previously set?)


dcx2

The TextBox.Text property is Split using \r and \n delimiters before being parsed.