# How the RAWSECISO Plugin Enables ISO Access on NTFS Devices in webMAN MOD

> Discover how the RAWSECISO plugin grants ISO access on NTFS devices in webMAN MOD. Mount and play ISOs from external storage on your PS3 like native Blu-ray discs.

- Repository: [Aldo Vargas/webman-mod](https://github.com/aldostools/webman-mod)
- Tags: how-to-guide
- Published: 2026-02-24

---

**The RAWSECISO plugin acts as a proxy PRX module that intercepts Cobra's SCSI read commands and translates them into raw block reads on NTFS-formatted USB devices, enabling PlayStation 3 systems to mount and play ISO files from external storage as if they were native Blu-ray discs.**

The **RAWSECISO plugin** is a specialized kernel module within the **aldostools/webman-mod** repository that bridges incompatible storage formats with the PlayStation 3's disc emulation layer. By operating as a proxy between the Cobra payload and external NTFS/exFAT devices, this plugin bypasses the PS3's standard file system limitations and allows direct sector-level access to ISO images stored on non-native file systems.

## Architecture and Initialization Flow

When webMAN MOD mounts a `.ntfs[]` file as `/dev_bdvd`, it dynamically loads `raw_iso.sprx` from `/dev_hdd0/tmp/wm_res/` and initializes the proxy layer. The plugin establishes a command queue that translates high-level SCSI requests into low-level storage operations.

### Plugin Loading and Thread Spawning

The entry point `rawseciso_start()` in [`_Projects_/rawseciso/main.c`](https://github.com/aldostools/webman-mod/blob/main/_Projects_/rawseciso/main.c) (lines 27-30) allocates a temporary buffer and spawns the primary worker thread before exiting the caller. This non-blocking initialization allows webMAN MOD to continue its setup while the plugin prepares the virtual disc environment.

The thread receives a `rawseciso_args` structure (lines 61-89) containing:
- **Device handle**: The USB storage device identifier
- **Emulation mode**: Disc type (PS3, PSX, etc.)
- **Sections table**: Mapping array translating ISO logical sectors to physical device sectors
- **Track information**: For multi-disc PSX emulation

### Device Preparation and Event Queue Creation

Before mounting, the plugin performs hardware initialization in [`main.c`](https://github.com/aldostools/webman-mod/blob/main/main.c) (lines 106-119). It opens the USB device via `sys_storage_open()` and queries the sector size using `sys_storage_get_device_info()` to ensure alignment between ISO logical blocks and physical storage blocks.

The plugin then creates two kernel communication objects (lines 121-131):
- **`result_port`**: An event port for returning read completion status to Cobra
- **`command_queue`**: An event queue that receives SCSI-style commands from the Cobra payload

### Virtual Disc Mounting

With the communication channels established, `sys_storage_ext_mount_discfile_proxy()` (lines 145-148) registers the plugin as a virtual disc drive. This system call accepts the emulation mode, total disc size, cache parameters, and track information, causing the PS3 to treat the NTFS ISO as a physical Blu-ray or CD-ROM device.

## Sector Translation and Raw Reading

The core functionality of RAWSECISO lies in its ability to map ISO file offsets to physical NTFS device sectors without requiring the PS3 to understand the NTFS file system structure.

### The Sections Table Mapping

WebMAN MOD prepares a **sections table** that describes where the ISO file fragments reside on the NTFS device. Each entry contains:
- **ISO sector start**: Logical position within the disc image
- **Device sector start**: Physical LBA on the USB storage
- **Section size**: Number of contiguous sectors

When the `rawseciso_thread` receives a `CMD_READ_ISO` event, it calls `get_next_read()` (lines 13-33) to walk the sections table and translate the requested ISO offset into a physical sector address.

### Direct Block I/O Operations

The `process_read_iso_cmd` handler (lines 90-112 and 124-140) executes the actual data retrieval:

```c
u64 pos, readsize;
int idx;
get_next_read(requested_offset, requested_size, &pos, &readsize, &idx, sec_size);

// Calculate physical sector
u64 sector = sections[idx] + (pos / sec_size);

// Issue raw read command
sys_storage_read(handle, 0, sector, n_sectors, buffer, &returned_size, 0);

```

This `sys_storage_read()` call bypasses the Virtual File System (VFS) layer entirely, reading raw blocks directly from the USB device. If the device reports a busy status or transient error, the plugin implements retry logic with device reinitialization to ensure robust access during high-load scenarios.

### CD-Specific Caching

For PlayStation 1 and CD-based ISOs requiring 2352-byte raw sector reads (`CMD_READ_CD_ISO_2352`), the plugin maintains a 128 KB `cd_cache` (lines 84-115). This buffer minimizes redundant raw reads when the game requests overlapping or adjacent sectors, significantly improving performance for Red Book audio tracks and subchannel data.

## Multi-Disc and Ejection Handling

The plugin includes an auxiliary `eject_thread` (lines 88-114) that monitors for virtual disc ejection events. When triggered, it fires fake storage events through the result port and automatically reconfigures the sections table to point to the next disc in a PlayStation 1 multi-disc set, allowing seamless disc swapping without unmounting the entire virtual drive.

## Practical Implementation Example

While webMAN MOD handles argument preparation automatically, developers can understand the plugin's interface through this minimal invocation structure:

```c
#include <stdint.h>

typedef struct {
    uint64_t device;
    uint32_t emu_mode;
    uint32_t num_sections;
    uint32_t num_tracks;
    uint32_t *sections;
    uint32_t *sections_size;
    // ... additional fields for track info
} rawseciso_args;

void mount_ntfs_iso(uint64_t usb_device, uint32_t *sector_table, 
                    uint32_t *size_table, uint32_t section_count)
{
    rawseciso_args args = {
        .device = usb_device,
        .emu_mode = 1,  // EMU_PS3
        .num_sections = section_count,
        .num_tracks = 0,
        .sections = sector_table,
        .sections_size = size_table
    };
    
    // Buffer must reside in allocated PS3 RAM
    rawseciso_start((uint64_t)&args);
}

```

This illustrates how webMAN MOD constructs the mapping tables that enable the RAWSECISO plugin to locate ISO data amid NTFS metadata structures.

## Summary

- **Proxy Architecture**: RAWSECISO operates as a PRX module that intercepts Cobra SCSI commands and translates them into raw storage operations.
- **Sector Mapping**: The plugin relies on pre-calculated sections tables provided by webMAN MOD to translate ISO logical addresses to NTFS physical sectors.
- **Kernel Integration**: Uses `sys_storage_ext_mount_discfile_proxy()` to register as a virtual disc drive and `sys_storage_read()` for direct block access.
- **Event-Driven Design**: Implements a command queue system (`command_queue`) for asynchronous processing of read requests.
- **Multi-Disc Support**: Includes dedicated ejection handling and disc-swapping capabilities for PlayStation 1 games.

## Frequently Asked Questions

### Why does webMAN MOD need a separate plugin for NTFS ISO access?

The PlayStation 3's operating system lacks native NTFS and exFAT drivers in its storage stack. The **RAWSECISO plugin** bridges this gap by bypassing the standard file system layer entirely. Instead of mounting the NTFS volume and reading files through the VFS, it treats the ISO as a raw block device, using pre-calculated sector maps to fetch data directly from the USB hardware.

### How does the plugin handle fragmented ISO files on NTFS?

WebMAN MOD analyzes the NTFS Master File Table (MFT) during the mounting process and constructs the **sections table** (arrays of `sections` and `sections_size`) that describes exactly which physical sectors belong to the ISO file. When processing a read command, `get_next_read()` traverses this table to locate the correct physical sectors, allowing the plugin to read fragmented files as if they were contiguously stored.

### What happens if the USB device disconnects during gameplay?

The plugin implements error recovery in `process_read_iso_cmd` (lines 124-140). If `sys_storage_read()` returns an error indicating device unavailability, the plugin attempts to reopen the device handle using `sys_storage_open()` and retry the operation. If recovery fails, the result port signals an error to Cobra, which typically results in a game freeze or disc-read error similar to physical media failure.

### Can RAWSECISO work with file-based ISOs instead of raw devices?

Yes, the plugin supports file-mode ISOs through `process_read_file_cmd`. When initialized in this mode, the plugin uses standard file I/O (`cellFsRead`) rather than `sys_storage_read`. However, for NTFS devices, raw device mode is preferred because it achieves higher throughput by eliminating file system abstraction overhead and supports the 128 KB caching mechanism for CD-based games.