{"id":20350262,"url":"https://github.com/vector-man/ninja2","last_synced_at":"2025-08-26T16:25:30.177Z","repository":{"id":25799399,"uuid":"29238182","full_name":"vector-man/ninja2","owner":"vector-man","description":"Improved patching engine that also supports legacy formats such as IPS, PPF and FireFlower","archived":false,"fork":false,"pushed_at":"2012-10-22T02:37:47.000Z","size":144,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T23:52:44.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vector-man.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-14T10:00:29.000Z","updated_at":"2023-03-27T23:10:41.000Z","dependencies_parsed_at":"2022-08-24T14:14:43.042Z","dependency_job_id":null,"html_url":"https://github.com/vector-man/ninja2","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-man%2Fninja2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-man%2Fninja2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-man%2Fninja2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-man%2Fninja2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vector-man","download_url":"https://codeload.github.com/vector-man/ninja2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241879637,"owners_count":20035809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T22:29:35.355Z","updated_at":"2025-03-04T16:27:51.724Z","avatar_url":"https://github.com/vector-man.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"NINJA 2.0 (cli)\r\nCopyright (c) 2006, 2012 Derrick Sobodash\r\n\r\n\r\nFEATURES\r\n\r\n * Capable of creating and applying patches between both directories and\r\n   single files\r\n\r\n * XOR patches allows a NINJA patch to both patch a file and restore its\r\n   original form\r\n\r\n * Support for International Patching Standard (IPS) with the LunarCut\r\n   format extension.\r\n\r\n * Support for PlayStation Patch Format (PPF) 1.0, 2.0 and 3.0\r\n\r\n * Support for Generic Diff Format (GDIFF) binary patches\r\n\r\n * Support for FireFlower Patcher (FFP/PAT) textual patches. Can use as\r\n   both a patcher an unpatcher\r\n\r\n * Support for Microsoft File Compare output; can use as both a patcher\r\n   and unpatcher (Example: fc /b FILE1 FILE2 \u003eoutput.pat)\r\n\r\n * Format supports addressing in files up to 32,317,006*10^600 bytes;\r\n   sadly, this implementation only supports up to 9,223,372,036,854,775,807.\r\n\r\n * NINJA patches support a struct of internal patch info so you can store\r\n   the author, version number, game title, game genre, patch language,\r\n   release date, patch homepage and a 1074 character summary\r\n\r\n * Nintendo 8-bit: Supports patching around NES headers; support for all\r\n   NES formats except Pasofami (interNES, Famtasia and UNIF); one patch\r\n   will work on NES, FAM and UNF ROMs\r\n\r\n * Super Nintendo: Supports patching around SNES headers; deinterleaving of\r\n   Game Doctor SF3, Professor SF2, Super UFO and Multi Game Doctor formats;\r\n   can preserve NSRT headers; one patch will work on SMC, SWC, FIG, 048, \r\n   058, 078, SFC, MGD, UFO, GD3 and GD7 ROMs\r\n\r\n * Nintendo 64: Supports deinterleaving of Doctor V64 ROMS; one patch will\r\n   work on both Z64 and V64 ROMs\r\n\r\n * Game Boy: Supports removal of SmartCart Game Boy headers\r\n\r\n * Sega Master System: Supports deinterleaving of Super Magic Drive ROMs;\r\n   one patch will work on both SMS and SMD ROMs\r\n\r\n * Sega Genesis: Supports deinterleaving of Super Magic Drive ROMs; one\r\n   patch will work on both BIN and SMD ROMs\r\n\r\n * PC-Engine: Supports removal of Magic Super Griffin headers\r\n\r\n * Atari Lynx: Supports patching around Atari Lynx headers; one patch will\r\n   work on LNX/RAW and LYX ROMs\r\n\r\n\r\nREQUIREMENTS\r\n\r\n * PHP5 and the GMP module (php5-cli and php5-gmp on Debian)\r\n\r\n\r\nCOMMAND-LINE USEAGE\r\n\r\nNINJA does two things: makes patches and applies them. This version can apply\r\nNINJA 2.0, PPF, IPS, FFP, PAT and GDIFF patches. In the case of PPF, PAT, FFP\r\nand NINJA, the internal patch info will be displayed in the console for you\r\nto read.\r\n\r\nThe command lines are:\r\n\r\n * Create - ninja2.bat SOURCE MODIFIED FILE TYPE INFO\r\n                          |       |     |    |    |\r\n                          |       |     |    |    +- Text info file\r\n                          |       |     |    +------ Format of data\r\n                          |       |     +----------- File to create\r\n                          |       +----------------- Modified file/folder\r\n                          +------------------------- Original file/folder\r\n * Apply  - ninja2.bat PATCH TARGET\r\n                         |     |\r\n                         |     +-------------------- File/Folder to patch\r\n                         +-------------------------- Patch file\r\n\r\nThe text info file must be a plain text file of 8 lines. The data expected on\r\neach line is:\r\n\r\n 1: Author      (  84 characters max)\r\n 2: Version     (  11 characters max)\r\n 3: Title       ( 256 characters max)\r\n 4: Genre       (  48 characters max)\r\n 5: Language    (  48 characters max)\r\n 6: Date        (   8 characters max) (YYYYMMDD)\r\n 7: Website     ( 512 characters max)\r\n 8: Description (1074 characters max)\r\n\r\nData exceeding the limit for each line will be ignored. If no file is\r\nspecified, blank bytes will be entered for the file info.\r\n\r\nAllowed data types are as follows:\r\n\r\n raw - Raw Binary (0)               gb  - Nintendo Game Boy (5)\r\n nes - Nintendo/Famicom (1)         sms - Sega Master System/Game Gear (6)\r\n fds - Famicom Disk System (2)      mega- Sega Genesis/Megadrive (7)\r\n snes- Super Nintendo/Famicom (3)   pce - NEC TurboGrafx-16/PC-Engine (8)\r\n n64 - Nintendo 64 (4)              lynx- Atari Lynx (9)\r\n\r\nIf no data type is specified, raw is assumed.\r\n\r\nIf your original data is a folder, the modified data must be a folder with the\r\nsame structure. To decrease patch creation time, it is recommended you include\r\nonly modified files in the modified folder, otherwise NINJA will be forced to\r\nscan every single file.\r\n\r\nNINJA will fail if you attempt to create a patch between a file and a folder.\r\n\r\n\r\nFILE FORMAT\r\n\r\nNINJA 2.0 follows a much simpler file format than its predecessor. Each patch\r\nconsists of 3 regions: HEADER, INFO and DATA. HEADER and INFO make up the first\r\nsector of the patch (1024 bytes).\r\n\r\n@HEADER@\r\n{\r\n  NINJA_MAGIC - string \"NINJA\" (5 bytes)\r\n  NINJA_VER   - char \"2\"       (1 byte )\r\n}\r\n\r\n@INFO@\r\n{\r\n  PATCH_ENC   - int ENC      (   1 byte ) // Info text encoding\r\n                                          // 0: System codepage / 1: UTF-8\r\n  PATCH_AUTH  - string AUTH  (  84 bytes) // Author\r\n  PATCH_VER   - string VER   (  11 bytes) // Version\r\n  PATCH_TITLE - string TITLE ( 256 bytes) // Title\r\n  PATCH_GENRE - string GENRE (  48 bytes) // Genre\r\n  PATCH_LANG  - string LANG  (  48 bytes) // Language\r\n  PATCH_DATE  - string DATE  (   8 bytes) // Date as YYYYMMDD\r\n  PATCH_WEB   - string WEB   ( 512 bytes) // Website\r\n  PATCH_DESC  - string DESC  (1074 bytes) // Info (New line marked by \"\\n\")\r\n}\r\n\r\n@DATA@\r\n{\r\n  COMMAND     - int COMMAND  (  1 byte )\r\n  if COMMAND == 0x1     // Open File|Close Current\r\n  {\r\n    FILE_N_MUL    - int N_MUL     (        1 byte ) // 0 Signals single-file\r\n    FILE_N_LEN    - int N_LEN     (    N_MUL bytes) // Length of file name\r\n    FILE_NAME     - string NAME   (    N_LEN bytes) // File name\r\n    FILE_TYPE     - int TYPE      (        1 byte ) // File format\r\n    FILE_SSIZE_MUL- int SSIZE_MUL (        1 byte )\r\n    FILE_SSIZE    - int SIZE      (SSIZE_MUL bytes) // Source file size\r\n    FILE_MSIZE_MUL- int MSIZE_MUL (        1 byte )\r\n    FILE_MSIZE    - int MIZE      (MSIZE_MUL bytes) // Modified file size\r\n    FILE_SMD5     - string SMD5   (       16 bytes) // Source MD5sum\r\n    FILE_MMD5     - string MMD5   (       16 bytes) // Modified MD5sum\r\n    if SSIZE \u003e MSIZE\r\n    {\r\n      FILE_MAGIC   - char \"M\"        (       1 byte ) // Source overflow\r\n      FILE_OVER_MUL- int OVER_MUL    (       1 byte )\r\n      FILE_OVER    - int OVER        (OVER_MUL bytes) // Overflow length\r\n      FILE_OVERFLOW- string OVERFLOW (    OVER bytes) // Lost from modified\r\n    }\r\n    else if MSIZE \u003e SSIZE\r\n    {\r\n      FILE_MAGIC   - char \"A\"        (       1 byte ) // Modified overflow\r\n      FILE_OVER_MUL- int OVER_MUL    (       1 byte )\r\n      FILE_OVER    - int OVER        (OVER_MUL bytes) // Overflow length\r\n      FILE_OVERFLOW- string OVERFLOW (    OVER bytes) // Gained in modified\r\n    }\r\n  }\r\n  else if COMMAND == 02 // XOR Patch\r\n  {\r\n    PATCH_OFF_MUL- int OFF_MUL (      1 byte )\r\n    PATCH_OFF    - int OFF     (OFF_MUL bytes) // Patch offset\r\n    PATCH_LEN_MUL- int LEN_MUL (      1 byte )\r\n    PATCH_LEN    - int LEN     (LEN_MUL bytes) // Patch length\r\n    PATCH_XOR    - string XOR  (    LEN bytes) // XOR string\r\n  }\r\n  else if COMMAND == 0x0\r\n    // Terminate patch\r\n}\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvector-man%2Fninja2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvector-man%2Fninja2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvector-man%2Fninja2/lists"}