This tool can be used to import .obj files, binary files, hex data, and tweaks into the Super Mario 64 ROM.
Required Tools:
- nconvert.exe - Used to convert all different types of image files. This program needs to be in the same directory as sm64Import.exe. I can't legally include it in this project, but you can download it here: http://www.xnview.com/en/nconvert/
Libraries used:
- BMP.h - Used to decode .bmp files for textures
- rapidXML.h - Used to parse .xml files for importing tweak files.
Preparing your ROM with SM64 Editor patches:
- Use ApplyPPF3.exe to apply the obj_import195S ppf patch.
- beh12-hack.bin & cmd17-hack.bin are both required to get a custom level to work
- water-hack.bin is required for water boxes
- LevelImporterPatches.xml tweak is used for minor improvements
sm64Import.exe -run "hacks/tools/ApplyPPF3.exe a "sm64.ext.z64" "obj_import195S.ppf"" -r "sm64.ext.z64" -a 0x101B84 -ib "hacks/beh12-hack.bin" -a 0x1202000 -ib "hacks/cmd17-hack.bin" -a 0x1203000 -ib "hacks/water-hack.bin" -it "tweaks/LevelImporterPatches.xml"
Importing over BOB example (Using this basic LevelScript.bin file):
sm64Import.exe -df t 0x4000 0x4000 0xBFFF 0xBFFF -8000 -r "sm64.ext.z64" -a 0x2AC0F8 -ih "00 10 00 19 01 8E 00 00 01 8E 20 00 19 00 00 1C" -a 0x18E1800 0x19001800 -c 0x1500 -ib "LevelScript.bin" -a 0x18F0000 0x0E000000 -c 0x150000 -s 500 -io "Import.obj" "" -a 0x18E1700 0x19001700 -c 0x100 -ig "Import.obj" 1 -put "Import.obj" col 0x18E014C
Arguments:
-a ROM_ADDRESS {SEG_POINTER}
Set the base ROM address (and optional segmented pointer) to import to. The segmented pointer is required for importing obj files.-c SIZE
Sets the max data cap. If the following import data size is larger than this, then the program will return an error.-center BOOLEAN
Centers the follwing obj model(s) if true.-ct DATA
Allows you to add color to textures. DATA ="Name:Color:DarkScale"
. DarkScale is a float multiplier from the original color value that is used for lighting, so 0.8 would be 80% as bright as the set color.
Example:-ct "TextureName:0xFF0000FF:0.8"
-df BOOLEAN X1_POS Z1_POS X2_POS Z2_POS Y_POS
Creates a death floor for the level.-ib BIN_PATH {OFFSET SIZE} {NAME}
Import binary file into the ROM. Optional parameters for importing only a specific section of the file into the ROM. The optional NAME parameter is used with the -put cmd. Example:-ib "A_Binary_File.bin" 0x1000 0x10
-ig OBJ_NAME GEO_TYPE {NAME}
Creates a geo layout from data from a previous -io cmd. GEOTYPE = 0 for objects & GEOTYPE = 1 for levels.-ih HEX_STRING {NAME}
Import raw hex from a string into the ROM. Example:-ih "FF 00 00 FF FF 00 00 FF"
-io OBJ_PATH {COL_DATA} {NAME}
Import .obj file as f3d level data (Textures, colors, verticies, and f3d scripts). If you define the optional second parameter, {COL_DATA}, then collision data will be generated for the OBJ.-ioc OBJ_PATH COL_DATA {NAME}
Import .obj file as collision data. COL_DATA is for defining each material with a collision type. Note: You don't have to define every material with COL_DATA, the default value is set to 0 (enviorment default) for each material.-it XML_PATH
Imports a tweak file into the ROM.-n NAME
Sets the name for the next import. The name is used for the -put cmd.-o OFFSET_X OFFSET_Y OFFSET_Z
Set offset model/collision data.-option OPTION VALUE
Changes an importer value. Currently the only option to change is the vertex reduction level. Example:-option rvl 2
will set the vertex reduction level to 2.-fog ENABLED {FOG_TYPE RED_VALUE GREEN_VALUE BLUE_VALUE}
Enables/Disables fog in the current level.-r ROM_PATH
Defines the ROM to import data to-run PROGRAM
Runs a exe program with arguments.-s SCALE_AMOUNT
Scale factor for model.-sv LIGHT_VALUE DARK_VALUE
Set shading value for levels.-sgm DATA
Sets the geometry mode for a particular material. Example:-sgm "TextureName:0x00040000"
-tt DATA {EXTRA}
Allows you to define the type of texture a material is, default type is rgba16. Example:-tt "TextureName:rgba32"
. The currently supported texture types are: RGBA16, RGBA32, I4, I8, IA4, IA8, and IA16. You can make I4 & I8 textures have an alpha mask by setting the optional {EXTRA} parameter to be "a" like this:-tt "i4_tex:i8:a"
-put NAME SEG_DATA ROM_ADDRESS {ADD_OFFSET}
Puts the segmented pointer of SEG_Data into the ROM. Useful for updating pointers in your levelscript automatically. SEG_DATA can be (Names are not case-sensative): START, SOLID, ALPHA, TRANS, GEO, or COL-vft BOOLEAN
Flip all textures vertically if true.-wb BOX_TYPE_ID X1_POS Z1_POS X2_POS Z2_POS HEIGHT
Creates a water box in the level. Used with -io* & -ioc. *Water box data is grouped with collision data, so you have to define <COL_DATA> if your just using -io.-wbc
Clears the water box list.-wd
Imports water data for the current level. Note: You MUST import this at the segmented address 0x19001800 with the current patches.
MIT License. Copyright 2015 Davideesk.