Skip to content

APS (N64)

Boris Timofeev edited this page Jan 8, 2017 · 3 revisions

The text below converted from the file aps.txt (http://n64.icequake.net/mirror/www.dextrose.com/files/n64/ips_tools/bb-aps12.zip)

APS : Advanced Patching System Version 1.2

Authors: Silo ([email protected]), Fractal ([email protected])

Introduction

APS has been designed with several features as standard.

  • No file limitations. With the ever expanding file sizes that are appearing ips files have problems with patching files that are greater than 16Mb. APS does not have this problem and should facilitate patching of files up to 2Gb.

  • Target file verification. APS will be capable of target verification. In the case of type 1 (N64 patching) the patch will contain the CRC, Territory code and Cart ID. This will allow the patching program to make sure that the file about to be patched is the intended target.

  • Internal Descriptors. A small text field allowing APS authors to describe precisely what the patch does.

  • Future expansion through different patch types and encoding methods.

Detailed File Structure

Standard Header

BYTE 0-4        : Magic ("APS10")

BYTE 5          : Patch Type : -
                    0 for a Simple Patch
                    1 for a N64 Specific Patch
                      This method allows future expansion for other definable patch types. 

BYTE 6          : Encoding Method
                        0 for Simple Encoding (Similar to IPS & Defined Below)
                      (Again allowing for future expansion)

BYTE 7-56       : Description
                      Space padded free text for patch information.

Type 0 : Simple Patching Header

BYTE 57-61	: Size of destination image.

Type 1 : N64 Header

Header specific information for a type 1 (N64 specific) patch.

BYTE 57         : Original image file format
    	           0 = Doctor V64
            	   1 = CD64/Z64/Wc/SP

BYTE 58-59      : CartID
    	           This is the two bytes of Cart ID taken directly from
            	   the original image. Stored in Motorola (human readable) 
		   endian.

BYTE 60         : Country
                   The original image's country code.Stored in Motorola
                   (human readable) endian.

BYTE 61-68      : CRC
    	           The original image's CRC taken directly out of the
    	           original image. Stored in Motorola (human readable) 
		   endian.

BYTE 69-74      : Pad.
    	           For future expansion.

BYTE 75-79 	: Size of destination image.

The Patch Itself

Encoding Method #0. (offset 0x6 within the standard header)

Format : xxxx,y,zzzz

xxxx 	= 4 byte file offset.

y	= Number of bytes that will be changed.

zzzz	= New data to be written ('y' number of bytes).

If paramter 'y' is set to zero (0) then paramter 'z' will be a two (2) byte field. Byte zero (0) will be the data and byte one (1) will be the number of repetitions.

Examples

Starting from File Offset 0x0015F9D0 replace 3 bytes with 01,02,03 D0 F9 15 00 03 01 02 03

Starting from File Offset 0x0015F9D0 replace 0x10 bytes with 0xFF D0 F9 15 00 00 FF 10

Revision Log:

13th July 1998. Initial Draft. Blackbag [Silo/Frac]


Comments

From file xPSapply.txt (http://n64.icequake.net/mirror/www.dextrose.com/files/n64/ips_tools/xpsapply-1.0.1.tar.gz):

There is a little bug in the draft

wrong | BYTE 69-74 : Pad.
      | BYTE 75-79 : Size of destination image.

fixed | BYTE 69-73 : Pad.
      | BYTE 74-77 : Size of destination image.