Modding > Hacking/Patching Tools

FFT Hack Template Spreadsheet

(1/4) > >>

Xifanie:
FFT Hack Template Spreadsheet
Downloads
Download the latest version (0.06b) - BLANK
Download the latest version (0.06b) - Xifanie's Hacks
Download "FFT File List.txt"
Download the latest update files

* Download the latest update files
* In VBA (Alt+F11), remove all the forms from your spreadsheet and remove the "SharedXifiSheets" module
* Either manually import each form (.frm) and the "SharedXifiSheets" module (.bas), or drag and drop them in Excel
* SaveNote: Do not delete your "Self" module!
Note2: You cannot import .frx files. They contain the form's code and will be automatically imported alongside their .frm counterpart.

What is it?
It's an Excel spreadsheet LOADED with new functions to help you to create and test your ASM hacks in the most user-friendly environment I could think of. You can also easily import your old hacks and it will be nicely reformatted for you, allowing a smooth transition to this tool.
It will forever change the way you make ASM Hacks!
Requirements

* Windows OS
* Microsoft Excel 2007+ (non-negotiable, forget about alternatives)
* *pSX 1.13 (to use the "Save to Savestate" function)
* *FFTText Editor spreadsheet (to use the Load "FFTText function")
* *ISO Manager (to create your own "FFT File List.txt")*optional
Overview
An ASM coding friendly environment



With an XML import/export function that aims to retain as much information as it can



A TON of functions to help you out!



Save directly to your ISO, to your Savestate (only if the appropriate files are loaded), or even to XML with 3 different output options




A function that find console-breaking errors for you!



A function that allows you to import code from your ISO, your savestate, or even from the wiki!



A function to import data from your ISO or from a savestate, in the format that you want!



A function that lets you see where the free space is, and which hacks are conflicting!
(Restricted to the hacks currently present in the spreadsheet)



And much, much more!

Getting Started

* Get yourself familiarized with each sheet's functions
* Open up the "Add-Ins" toolbar/ribbon
* Click the Configuration icon and configure away!
* Import an existing XML and look at branches/jump's formulas; use the same format for your own hacks. The colours are optional.
* Try out essential functions such as "Insert Line(s)"
* ASM Away!
* Use the "Analyze Code" function to detect and fix console-breaking errors
* Test your ASMs faster with "Save to ISO" and "Save to Savestate"
* Finally, release as XML (Save to .xml) and share for everyone to use your hack
Known Bugs

* Excel 2010 might crap out an annoying, but not spreadsheet breaking, 32bit ShellExecute function error (possibly only on W10)
* Unable to properly parse XMLs containing ASM and not opcodes stored as Hex (Glain.xml)
* Might get a run time error whenever the last MEMLOCATION uses hex instead of an op code when attempting to save
Changelog
1.06b - Fixed Save to Savestate, re-introduced Concatenate Cells function1.05b - Fixed a few bugs, improved functions, introduced LEAddress() function1.04b - Fixed a bug where replace variables would not work when saving1.03b - Fixed a bug where you could only import hacks if they had both Location and Variable fields1.02b - Initial Release

Xifanie:
SHEETS
Tutorial
This sheet is entirely optional. This sheet is only meant to provide information on how to use your spreadsheet, if you wish to release it in this format and not only in XML format.

Code
This is where all the magic happens.
You can import an .xml to see how you should format it, but using this example as a base and the detailed information below, you should be fine.


PATCH
Column B: Patch Name
DESCRIPTION
Column B: Patch's Description (can be spread across multiple lines)
COMMENT
Column B: Comment (can be spread across multiple lines)
MEMLOCATION
Column C: Location's File Name
Column D: Location's Memory Address (NOT the File Offset) [Can be spread across multiple lines]
Column E: Opcode or Hex Data (Can be spread across multiple lines)
Column F: Hex Backup; this value is printed when you import data. If it gets wrongly recognized as an opcode, you can simply copy/paste the data in this column back into Column E. If you have no need for the data in this column anymore, feel free to click "Clear Hex Backup" in your toolbar. This will automatically delete its contents and hide the column.
Column G: Comment

MEMLOCATION-1 and MEMLOCATION-2
The same as MEMLOCATION, except that it will be automatically trimmed by 1 or 2 bytes ("-1" and "-2" respectively).
Use this alongside MEMVARIABLE when the variable is part of an opcode, and you still wish the opcode to be on your sheet and to compile properly.
Refer to the above screenshot for more information.
MEMVARIABLE
Column B: Variable's Name
Column C: Variable's File Name
Column D: Variable's Memory Address (NOT the File Offset) [Can be spread across multiple lines]
Column E: Hex Data in Big-Endian; meaning don't flip the bytes!

LOCATION
Column C: Location's File Name or [Sector]
Column D: Location's File/Sector Offset (Can be spread across multiple lines)
Column E: Hex Data (Can be spread across multiple lines) [it will still accept opcodes, but if you want to use opcodes you should really be using MEMLOCATION with Memory Addresses instead]
Column F: Hex Backup; this value is printed when you import data. If it gets wrongly recognized as an opcode, you can simply copy/paste the data in this column back into Column E. If you have no need for the data in this column anymore, feel free to click "Clear Hex Backup" in your toolbar. This will automatically delete its contents and hide the column.
Column G: Comment

VARIABLE
Column B: Variable's Name
Column C: Variable's File Name or [Sector]
Column D: Variable's File Offset [Can be spread across multiple lines]
Column E: Hex Data in Big-Endian; meaning don't flip the bytes!


Hacks

Hack Table
Determines whether the hacks will be saved to ISO/Savestate/XML.
If the "Apply?" column is set to "No" or if the hack is simply not present in the list, the hack will not be parsed.
If it is set to "Yes", then it will be.

NOTE: If your hack isn't in the list, press "Update Hack List" in the Add-Ins toolbar/ribbon.

Auto-Replace Table
Allows you to make terms be auto-replaced by a specific value in your opcodes (or hex, even).
For example: With "Power_Level" and "0x2329"
"ori r2, r0, %Power_Level%" would be parsed as "ori r2, r0, 0x2329"


Hack Settings and Tables
This is where you will place any checkbox, list, table, etc. for the user to interact with that will modify the outcome of the hack.
This sheet uses the Developer toolbar by default. It would be very nice if I could make any new sheet come with a Developer Toolbar, but that's not possible without being very impractical at the same time. If you want another sheet like that, you should either copy this one or give a new sheet a Developer Toolbar.

Calculations
This sheet is meant to handle any calculation that are unnecessary to use the spreadsheet, but used when saving to ISO/Savestate/XML. If you have a large number of calculations to perform to compile data for the Code Sheet, you should place them in this sheet because automatic calculation is turned off by default, and it will be only recalculated when attempting the aforementioned saving to ISO/Savestate/XML. It is unlikely most people will have a use for this Sheet, but hey, it's there.

LoadFFTText
This page has a table that you can edit as you wish to fetch text from your FFTText Editor spreadsheet and a few other things. Look up the wiki to know how to use each function, and what to type for each parameter. For any parameter that requires a range, just use my new "=RangeAddress()" function. Simply press the "Load FFTText" button under the Add-Ins toolbar to make all those functions run all at once, in the order you typed them.

How to create a new sheet with a Developer Toolbar
You could also pre-emptively make a copy of the "Hack Settings and Tables" sheet
1) Create a new sheet
2) Head into the VBA Editor (Alt+F11)
3) On the left page, you'll see your spreadsheet name... under that will be a folder called "Microsoft Excel Objects", and under that will be the sheet's name. Double click it.
4) Paste the following code inside the sheet's code page:

--- Code: ---Private Sub Worksheet_Activate()
    Call HackToolbar("Developer")
End Sub

--- End code ---

Xifanie:
SPREADSHEET FUNCTIONS AND VBA
Spreadsheet Functions
WARNING: VBA Functions on a spreadsheet are several thousand times slower than native Excel functions. Try to limit their use; use them smartly!
Function UpperAddress As String
Gets the upper half-word of a word to use with the lui opcode (ex: 0x8016AB6C --> 0x8017)Function LowerAddress As String
Gets the lower half-word of a word to use with the addiu/ori opcodes (ex: 0x8016AB6C --> 0xAB6C)
Set the second parameter to TRUE if you wish to force the result as a Signed Hex value if applicable (ex: 0x8016AB6C --> -0x5494)Function ReverseBytes As String
Converts a Little-Endian hex string to Big-EndianFunction RangeAddress As String
Outputs an array of ranges that can be used by VBA code (such as the LoadFFTText functions)
VBA Subs and Functions
On a spreadsheet, use the native Excel functions instead of these instead of the ones listed below (see DEC2HEX/DEC2BIN/HEX2DEC/HEX2BIN/BIN2DEC/BIN2HEX)
Also look at the "Self" VBA Module for customizable custom functions
Sub VBATime
Enables or Disables VBA related enhancements to make writing to the spreadsheet way faster.
Make sure to disable it afterwards before the end of your sub with "VBATime false", otherwise it will be extremely hard or impossible to use the spreadsheet.Function Open_ISO As Integer
Readies your FFT ISO for binary read/write. Use with:

--- Code: ---Dim ISO_File as Integer
ISO_File = Open_ISO
If ISO_File = -1 Then Exit Sub

--- End code ---
Then use "ISO_File" in the Subs/Functions that request it.
If the user has canceled the ISO selection, the Sub/Function will automatically terminate.Function Import_Files_List As Boolean
Loads FFT File List.txt's contents. At the beginning of your sub/function, place:

--- Code: ---If Not Import_Files_List Then Exit Sub
--- End code ---
If the file cannot be loaded or has errors, an error will be displayed and the current Sub/Function will be terminated.Function GetFileMatch As Long
*Requires Import_Files_List
Gets the Match ID of a filename in FFT File List.txt's contents to use with the File_Sectors/File_Offsets/etc. arrays based on its full filename, its filename, or its XML filename.

Valid arrays to use with a File Match ID:
Array NameDescriptionExampleFile_Full_NamesThe file's full path"EVENT\ATTACK.OUT"File_NamesThe file's name"ATTACK.OUT"File_XML_NamesThe file's XML name"EVENT_ATTACK_OUT"File_SectorsThe file's Sector Offset2448File_OffsetsThe file's Memory Offset, i.e. where it is loaded in RAM1830912 (0x001BF000)File_OriginalIf true, the file matches a vanilla ISO's name and SectortrueFunction Create_Sort_Index As Long()
Creates an array to be used with Sort_Array.
This array is an index that specifies which entries to include and in what order.
It can ignore or include duplicates, ignore or include null values, and either sort from A-Z, Z-A, or not sort at all.
This index can then be used with Sort_Array to quickly rearrange one or more arrays.Function Sort_Array As Variant
Creates a new array from an existing one, reordering and trimming out undesired values.
Should ideally be used with Create_Sort_Index.
Returns an array of the same data type that was parsed.Function Get_File_Data As Byte()
Gets ISO Data and returns it into an array of bytes. (requires Open_ISO)Sub Save_File_Data
Saves an array of bytes back into the ISO. (requires Open_ISO)Function ReadReg As Variant
Gets the value of a specified registry key. If it doesn't exist, it will return a default value.Sub WriteReg
Writes a value to a specified registry key.Function DecToHex As String
Converts a long decimal value into a hex string with a given number of digits.Function DecToBin As String
Converts a long decimal value into a binary string with a given number of digits.Function HexToDec As Long
Converts a hex string into a long decimal value. (unsigned/signed)Function HexToBin As String
Converts a hex string into a binary string with a given number of digits.Function BinToDec As Long
Converts a binary string into into a long decimal value. (unsigned)Function BinToHex As String
Converts a binary string into a hex string with a given number of digits.Function HexDecToDec As Long
Converts a string from hex (if the string starts with "0x") or from decimal into a long decimal value. (unsigned/signed)Function ReverseBytes As String
Converts a Little-Endian hex string to Big-Endian.Function bAND As Long
Performs a bitwise AND on two long decimal variables.Function bOR As Long
Performs a bitwise OR on two long decimal variables.Function bXOR As Long
Performs a bitwise XOR on two long decimal variables.Function bNOT As Long
Performs a bitwise NOT on two long decimal variables.Function Smart_Trim As String
Trims out leading and trailing spaces, carriage returns and tab characters.Function Get_Filename_From_Path As String
Returns the filename from a file path.Function Get_Directory_Path_From_Path As String
Returns the directory path from a file/directory path.
About FFT File List.txt
This file is necessary to load for anything that requests information about a file on the ISO like "SCUS_942.21", such as its Sector Offset or its Memory Offset.
This file needs to be placed in the same folder as your active spreadsheet. You can either download the "FFT File List.txt" in this topic, or generate one that suits your purposes with my ISO Manager.

Xifanie:
placeholder

Dokurider:
Xifanie, I can't seem to import any .xml into the spreadsheet unless at least one hack contains an Variable line.

Navigation

[0] Message Index

[#] Next page

Go to full version