Skip to content

RUP (NINJA2)

DSG (Destitute Streetdwelling Guttersnipe) edited this page Aug 23, 2023 · 2 revisions

RUP (NINJA2) intro

copied from Utilities: NINJA 2.0 Beta Test

For those who have been following on the forums, you may know I've been actively developing the NINJA 2.0 format for the last month. There have been several beta tests on the forums, and I think it's finally ready for a front-page notice.

This will be the last major beta round for NINJA. I am looking for people to report bugs in both creation and application. This is directed only to Win32 users--people planning to use it on the command line with have a different release with the script only (a much smaller download at 30KB). To run NINJA you will need the Microsoft .NET Framework 2.0.

NINJA 2.0 is a new patching format that is designed as a replacement to IPS and several other formats. Because it uses a prefix byte to tell the length of all offsets, it creates filesizes a little larger than IPS, but the patch format is ever expandable. The greatest address NINJA can support is 2048-bit addressing (a 32,317,006*10^600 byte file). Patches created with NINJA can be created and applied between single files or directories of files. Its patches store the MD5 sums of both source and modified file versions, and a NINJA patch can be used to hard patch and unpatch target files and folders. This means if a new translation for a PC game comes out, you can re-apply the last patch to "unpatch" to the source files, then apply an updated patch with no need to reinstall.

NINJA patches store 2048 bytes of internal information including Author name, patch language, genre, game or software title, release date, website, and a brief description of the patch (1074 characters). Information can be stored in UTF-8 or in the system's default ANSI codepage. Any fields left blank will be ignored during patch time, so you only need to include what is actually used.

There is also support for special handling of ROMs. If you create a single file patch for a ROM and select its system from the drop-down menu, the resulting NINJA patch can be used on any version of the ROM. This means one NINJA patch could work on Famtasia, interNES and UNIF format ROMs, SNES ROMs that are headered and interleaved, interleaved N64 ROMs, interleaved Megadrive ROMs, and many other variations.

The NINJA Patcher program accepts files off the command line and can be associated with many patch types. As of this release, it can apply NINJA 2.0 patches, IPS patches, PPF 1.0, 2.0 and 3.0 patches, FireFlower patches, Generic Diff patches, and it can use the output of a Microsoft File Comparison (fc.com) saved to a text file to patch and unpatch files. For more details on this, please read the README file. The program includes an association management menu and patch file icons to match Microsoft Luna, Microsoft Vista, or Everaldo's Crystal style icons.

The patching interface (not the creator) supports localization files. The current beta includes interface localizations in English, German, Spanish, Italian, Portugese (Brazil), Russian, Chinese Simplified and Chinese Traditional. If you can contribute a localization in your language, please reply to the NINJA in your language thread on the forums.

Please leave your comments about this beta test in this thread. Suggestions on how to improve the format are not welcome as NINJA 2.0's file specifications are finalized. Any suggestions will be considered for NINJA 3.0--whenever the need for that format arises. I am looking primarily for bug reports and interface improvement suggestions.

Guidelines for writing your own NINJA patcher are in format.html. This file will be improved for clarity in the final release.

Thank you!

Relevant Link: (http://ninja.cinnamonpirate.com/)

NINJA File Format Specifications

quoted filespec20.txt from Romhacking.net - Documents - NINJA 2.0 File Format

------------------------------------------------------------------------------
 NINJA File Format Specifications                                 version 2.0
 Written by Derrick Sobodash                                   Copyright 2006
 Released on June 29, 2006                   http://ninja.cinnamonpirate.com/
------------------------------------------------------------------------------

 NINJA 2.0 follows a much simpler file format than its predecessor. Each
 patch consists of 3 regions: HEADER, INFO and DATA. HEADER and INFO make
 up the first sector of the patch (1024 bytes).

 @HEADER@
 {
   NINJA_MAGIC - string "NINJA" (5 bytes)
   NINJA_VER   - char "2"       (1 byte )
 }

 @INFO@
 {
   PATCH_ENC   - int ENC      (   1 byte ) // Info text encoding
                                           // 0: System codepage / 1: UTF-8
   PATCH_AUTH  - string AUTH  (  84 bytes) // Author
   PATCH_VER   - string VER   (  11 bytes) // Version
   PATCH_TITLE - string TITLE ( 256 bytes) // Title
   PATCH_GENRE - string GENRE (  48 bytes) // Genre
   PATCH_LANG  - string LANG  (  48 bytes) // Language
   PATCH_DATE  - string DATE  (   8 bytes) // Date as YYYYMMDD
   PATCH_WEB   - string WEB   ( 512 bytes) // Website
   PATCH_DESC  - string DESC  (1074 bytes) // Info (New line marked by "\n")
 }

 @DATA@
 {
   COMMAND     - int COMMAND  (  1 byte )

   if COMMAND == 0x1     // Open File|Close Current
   {
     FILE_N_MUL    - int N_MUL     (        1 byte ) // 0 Signals single-file
     FILE_N_LEN    - int N_LEN     (    N_MUL bytes) // Length of file name
     FILE_NAME     - string NAME   (    N_LEN bytes) // File name
     FILE_TYPE     - int TYPE      (        1 byte ) // File format
     FILE_SSIZE_MUL- int SSIZE_MUL (        1 byte )
     FILE_SSIZE    - int SIZE      (SSIZE_MUL bytes) // Source file size
     FILE_MSIZE_MUL- int MSIZE_MUL (        1 byte )
     FILE_MSIZE    - int MIZE      (MSIZE_MUL bytes) // Modified file size
     FILE_SMD5     - string SMD5   (       16 bytes) // Source MD5sum
     FILE_MMD5     - string MMD5   (       16 bytes) // Modified MD5sum

     if SSIZE > MSIZE
     {
       FILE_MAGIC   - char "M"        (       1 byte ) // Source overflow
       FILE_OVER_MUL- int OVER_MUL    (       1 byte )
       FILE_OVER    - int OVER        (OVER_MUL bytes) // Overflow length
       FILE_OVERFLOW- string OVERFLOW (    OVER bytes) // Lost from modified
     }

     else if MSIZE > SSIZE
     {
       FILE_MAGIC   - char "A"        (       1 byte ) // Modified overflow
       FILE_OVER_MUL- int OVER_MUL    (       1 byte )
       FILE_OVER    - int OVER        (OVER_MUL bytes) // Overflow length
       FILE_OVERFLOW- string OVERFLOW (    OVER bytes) // Gained in modified
     }
   }

   else if COMMAND == 02 // XOR Patch
   {
     PATCH_OFF_MUL- int OFF_MUL (      1 byte )
     PATCH_OFF    - int OFF     (OFF_MUL bytes) // Patch offset
     PATCH_LEN_MUL- int LEN_MUL (      1 byte )
     PATCH_LEN    - int LEN     (LEN_MUL bytes) // Patch length
     PATCH_XOR    - string XOR  (    LEN bytes) // XOR string
   }

   else if COMMAND == 0x0
     // Terminate patch
 }

------------------------------------------------------------------------------
Clone this wiki locally