1
0
mirror of https://github.com/kalymos/PsNee.git synced 2026-01-11 23:53:07 +00:00
0
Edit mode: General Description of the BIOS_patching.h
kalymos edited this page 2025-03-15 11:03:54 +01:00

General Description of the BIOS_patching.h File

The BIOS_patching.h file is responsible for managing the patching process of the PlayStation BIOS. It contains functions and interrupt service routines (ISRs) that facilitate patching based on specific trigger events. The file includes configuration for handling interrupts and timing delays during the BIOS patching process, ensuring that it operates correctly for different consoles and patching scenarios.

Key Features

Interrupt Service Routines (ISRs)

  • PIN_AX_INTERRUPT_VECTOR: Used for the primary patching process. Once the defined impulse (TRIGGER) is reached, it performs the patching by toggling the state of PIN_DX and applying the patch.
  • PIN_AY_INTERRUPT_VECTOR: Used for the secondary patching process (if HIGH_PATCH is defined). It performs similar actions to the primary patching once the second impulse (TRIGGER2) is reached.

Patch Process

The patching procedure is divided into two stages:

  1. First Stage: When the first trigger condition (TRIGGER) is met, the firmware waits for the AX pin to change states, starts a timer, and performs actions at the defined CHECKPOINT.
  2. Second Stage (if HIGH_PATCH is defined): A secondary interrupt handles the second stage of patching, with a separate trigger condition (TRIGGER2) and its own set of timing parameters (CHECKPOINT2).

Timer Functions

  • Timer_Start and Timer_Stop: These functions are used to measure elapsed time in microseconds. The BIOS patching process relies on precise timing to complete the patching at the correct moments.

Region-Specific Settings

The patching behavior is controlled by various preprocessor directives:

  • LOW_TRIGGER: Determines whether the interrupt triggers on the falling or rising edge of the signal.
  • HIGH_PATCH: Enables the second patching stage.
  • BIOS_PATCH: Controls whether the BIOS patching is enabled for the specific console.

Patch Completion

The patching process is signaled by setting the patch variable, which is checked during the process to ensure that each stage of patching is completed before moving to the next.