NetMD.Factory.Commands (NetMD v0.1.0)

Copy Markdown View Source

Higher-level factory operations, ported from netmd-js's factory commands: bracketed reads and writes, firmware patching and raw UTOC sector access.

These manipulate device internals directly and can brick hardware. The patch/unpatch routines are the exploit machinery Web MiniDisc uses to unlock features; use them only with a known patch set.

Summary

Functions

Open, read and close a memory range in one call.

Open, write and close a memory range in one call.

Show text on the display, taking over from the default readout.

Install a firmware patch (method by Sir68k): redirect address to the 4-byte value using patch slot patch_number of total_patches.

Read a firmware patch slot, returning %{address: patched_address, data: value}.

Read a full 2352-byte UTOC sector from the disc-cache peripheral.

Remove a firmware patch installed with patch/6.

Write arbitrarily long data, split into 0x10-byte cleanWrites.

Write a full 2352-byte UTOC sector to the disc-cache peripheral.

Types

error()

@type error() :: NetMD.Factory.error()

Functions

clean_read(factory, address, length, type, opts \\ [])

Open, read and close a memory range in one call.

With encrypted: true the range is opened encrypted and the result is decrypted unless auto_decrypt: false.

clean_write(factory, address, data, type, opts \\ [])

@spec clean_write(
  NetMD.Factory.t(),
  non_neg_integer(),
  binary(),
  NetMD.Factory.memory_type(),
  keyword()
) :: :ok | error()

Open, write and close a memory range in one call.

With encrypted: true the data is encrypted before writing unless auto_encrypt: false.

display(factory, text, opts \\ [])

@spec display(NetMD.Factory.t(), String.t() | binary(), keyword()) :: :ok | error()

Show text on the display, taking over from the default readout.

patch(factory, address, value, patch_number, total_patches, opts \\ [])

Install a firmware patch (method by Sir68k): redirect address to the 4-byte value using patch slot patch_number of total_patches.

read_patch(factory, patch_number, opts \\ [])

@spec read_patch(NetMD.Factory.t(), non_neg_integer(), keyword()) ::
  {:ok, %{address: non_neg_integer(), data: binary()}} | error()

Read a firmware patch slot, returning %{address: patched_address, data: value}.

read_utoc_sector(factory, sector)

@spec read_utoc_sector(NetMD.Factory.t(), non_neg_integer()) ::
  {:ok, binary()} | error()

Read a full 2352-byte UTOC sector from the disc-cache peripheral.

unpatch(factory, patch_number, total_patches, opts \\ [])

@spec unpatch(NetMD.Factory.t(), non_neg_integer(), non_neg_integer(), keyword()) ::
  :ok | error()

Remove a firmware patch installed with patch/6.

write_of_any_length(factory, address, data, type, opts \\ [])

@spec write_of_any_length(
  NetMD.Factory.t(),
  non_neg_integer(),
  binary(),
  NetMD.Factory.memory_type(),
  keyword()
) :: :ok | error()

Write arbitrarily long data, split into 0x10-byte cleanWrites.

write_utoc_sector(factory, sector, data)

@spec write_utoc_sector(NetMD.Factory.t(), non_neg_integer(), binary()) ::
  :ok | error()

Write a full 2352-byte UTOC sector to the disc-cache peripheral.