Ok now that we have our code working it's time to make it look pretty. Some people can use a console fairly well,some can barely click a button lol. We want our programs to be as user-friendly as possible, thus we need a GUI. This should actually be the easiest part of the project since we already have our code. As I said before the code should be in functions so it's just a matter of tying those functions into events. Whenever a user does anything and I mean anything it triggers an event, be it clicking or moving a mouse, pressing a key, or sometimes even just sneezing on the screen (or maybe that's just me lol). We only need to capture certain events such as a button being clicked or a slider being moved usually so that's what I'll focus in terms of controls.
Designing the GUI
First thing we do is open up our favorite form designer. There are designers for most languages so if you don't have one just google, you're bound to find one. Design your GUI in this (place buttons, sliders, text boxes, labels, etc) then get the code for it. Make sure when you're designing your GUI anything that needs to be interacted with (buttons, sliders, etc) have an event set off when they're clicked/changed. Most form designers have an option to import the code directly into your editor/compiler so just do that if you can.
Integrating Functions and Events
Ok now that we have our code and our GUI code we can put the two together. Since all our important stuff is in functions and we can call it whenever we need all we need to do is put our function calls inside our event triggers. Here's an example in autoit of code that calls our custom function, called "HexEdit" when a button named "$btnChange" is clicked. Now it's named $btnChange but it will show Change on the button itself, don't get those confused it'll screw you up.
$nMsg = GUIGetMsg()
$data is just a variable passed as a parameter to the function. Ok whose head just exploded, be honest. Raise your hand. Ok now go get a towel then talk to me after it grows back. For those of you still able to think all this code does is say "when a user clicks a button named $btnChange call the function HexEdit and send $data to that function."
Our function "HexEdit" should take the data it gets from $data and use that to do whatever it needs to do. Say it edits our gold, $data should be the value we want our gold at. We send $data (which has a value of, say, 10k) and in turn HexEdit() automatically edits our save file to give us 10k gold. Simple in principle yeah?
The most time-consuming portion of the GUI phase is designing the GUI. We all want our programs to look good so we'll probably spend a fair amount of time designing. I've found that doing a rough draft in the form designer then editing values in the code is a good way to make things look neat. I like to do things in increments of 5. If something has a value of 173 I'll make it 175, if it's 289 I'll make it 290, etc. Things line up well and it seems more professional, plus it's easier than trying to get it perfect in the form designer. Try to have an idea of how you want it to look before you start designing, that way you're not making it up and it looks even better. Really integration of the code and GUI is simple, once both portions are done. If you plan on adding features later you might want to add the appropriate controls to the editor and just disable them until their functions are working. It gives users a bit of a teaser of what's to come.
Now most of these will be in AutoIt since it's my preferred language but I will post some code in other languages as well if I know the conversions off-hand. Most of these will be snippets (small pieces of code that do something specific).
For loop: *assuming you have an integer variable declared that's named iCount*
$path = ""
$drives = DriveGetDrive("removable")
for $i = 2 to $drives
if FileExists($drives[$i] & "\seplugins") Then
$path = $drives[$i] & "\seplugins\cwcheat\cheat.db"
if $path = "" Then
MsgBox(48,"Error","No database detected." & @CRLF & @CRLF & "Exiting...")
$file = FileOpen($path,0)
$data = StringReplace(StringReplace(StringStripCR(FileRead($file)),"_", @CRLF & "_"),@cr,"",1)
$file = FileOpen($path,2)
Now the two DB fixers work exactly the same in exactly the same way with exactly the same result. Oddly enough the c# version was slower on my system than the autoit version, but considerably smaller. It may just be something quirky with my system but I thought I'd let you know. Since they work the same it's easy to look at the code and "translate" between the two.
switch (sType.ToLower())//use .ToLower() to handle the string as all lowercase
case "removable": dType = DriveType.Removeable; break;
case "network": dType = DriveTypeNetwork; break;
case "fixed": dType = DriveType.Fixed; break;
case "cdrom": dType = DriveType.CDRom; break;
default: throw new Exception("Invalid type!");
As you can see, it saves code space and looks tidier
In case you guys were afraid feel free to ask any questions or make requests for examples here the worst that'll happen is I'll say "I don't know how to do that :/" and it'll allow someone who does know how know they need to post an example
cant you read the OP? 10 poster. use search button for modding apk.
this is what i have always wanted. i tried learning hex-editing on .gba modifying sites for games but was never able to do it. will get back at this guide after exams. Thanks no thanks button in OT forum
XDA Developers was founded by developers, for developers. It is now a valuable resource for people who want to make the most of their mobile devices, from customizing the look and feel to adding new functionality. Are you a developer?