libctr9
Nintendo 3DS ARM9 library
|
#include <ctr9/ctr_headers.h>
#include <ctr9/io/ctr_io_interface.h>
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | ctr_cart_interface |
io interface object for accessing 3DSS game carts. More... | |
Functions | |
bool | ctr_cart_interface_initialize (ctr_cart_interface *cart) |
Initialize the given 3DS cart io interface object. More... | |
bool | ctr_cart_inserted (void) |
Returns whether a cart is inserted or not. More... | |
int | ctr_cart_interface_read_sector (void *io, void *buffer, size_t buffer_size, size_t sector, size_t count) |
Reads sectors from the given io interface. More... | |
int | ctr_cart_interface_read (void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count) |
Reads bytes from the given io interface. More... | |
int | ctr_cart_interface_noop_write (void *io, const void *buffer, size_t buffer_size, uint64_t position) |
Writes bytes to the given io interface. Not possible for carts. More... | |
int | ctr_cart_interface_noop_write_sector (void *io, const void *buffer, size_t buffer_size, size_t sector) |
Writes sectors from the given io interface. Not possible for carts. More... | |
uint64_t | ctr_cart_interface_disk_size (void *io) |
Returns the size of the underlying disk for the given io interface. More... | |
size_t | ctr_cart_interface_sector_size (void *io) |
Returns the size of the sectors used by the io interface. This is cart dependent, althoug to date most, if not all carts report 512 bytes. More... | |
int | ctr_cart_raw_interface_read (void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count) |
Reads bytes from the given io interface. More... | |
int | ctr_cart_raw_interface_read_sector (void *io, void *buffer, size_t buffer_size, size_t sector, size_t count) |
Reads sectors from the given io interface. More... | |
bool ctr_cart_inserted | ( | void | ) |
Returns whether a cart is inserted or not.
uint64_t ctr_cart_interface_disk_size | ( | void * | io | ) |
Returns the size of the underlying disk for the given io interface.
bool ctr_cart_interface_initialize | ( | ctr_cart_interface * | cart | ) |
Initialize the given 3DS cart io interface object.
[out] | io | 3DS cart io interface to initialize. |
int ctr_cart_interface_noop_write | ( | void * | io, |
const void * | buffer, | ||
size_t | buffer_size, | ||
uint64_t | position | ||
) |
Writes bytes to the given io interface. Not possible for carts.
It is not possible to write to a 3DS cart, so this function will always return an error.
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. |
[in] | position | Position/address in the io interface to write to. |
int ctr_cart_interface_noop_write_sector | ( | void * | io, |
const void * | buffer, | ||
size_t | buffer_size, | ||
size_t | sector | ||
) |
Writes sectors from the given io interface. Not possible for carts.
It is not possible to write to a 3DS cart, so this function will always return an error.
[in,out] | io | The io interface to use for writing. |
[in] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer, and the number of bytes to write. If the number is not a multiple of the sector size, this function will only write all the full sectors it can, ignoring the end of the buffer that doesn't fit a sector. |
[in] | sector | Sector Position in the io interface to write to. |
int ctr_cart_interface_read | ( | void * | io, |
void * | buffer, | ||
size_t | buffer_size, | ||
uint64_t | position, | ||
size_t | count | ||
) |
Reads bytes from the given io interface.
This implementation automatically returns the NCCH header when reading carts at 0x1000, and from 0x1200 to 0x2000 it returns 0xFF bytes.
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | position | Position/address in the io interface to read from. |
[in] | count | The number of bytes to read. |
int ctr_cart_interface_read_sector | ( | void * | io, |
void * | buffer, | ||
size_t | buffer_size, | ||
size_t | sector, | ||
size_t | count | ||
) |
Reads sectors from the given io interface.
3DS carts define their own sector size. They refer to these as the unit media size. Most, if not all carts seem to use 512 bytes.
This implementation automatically returns the NCCH header when reading carts at 0x1000, and from 0x1200 to 0x2000 it returns 0xFF bytes.
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | sector | Sector position in the io interface to read from. |
[in] | count | The number of sectors to read. |
size_t ctr_cart_interface_sector_size | ( | void * | io | ) |
Returns the size of the sectors used by the io interface. This is cart dependent, althoug to date most, if not all carts report 512 bytes.
int ctr_cart_raw_interface_read | ( | void * | io, |
void * | buffer, | ||
size_t | buffer_size, | ||
uint64_t | position, | ||
size_t | count | ||
) |
Reads bytes from the given io interface.
This implementation returns the raw data returned by the cart reading system for data between 0x1000 to 0x4000, which tends to be incomprehensible.
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | position | Position/address in the io interface to read from. |
[in] | count | The number of bytes to read. |
int ctr_cart_raw_interface_read_sector | ( | void * | io, |
void * | buffer, | ||
size_t | buffer_size, | ||
size_t | sector, | ||
size_t | count | ||
) |
Reads sectors from the given io interface.
3DS carts define their own sector size. They refer to these as the unit media size. Most, if not all carts seem to use 512 bytes.
This implementation returns the raw data returned by the cart reading system for data between 0x1000 to 0x4000, which tends to be incomprehensible.
[in,out] | io | The io interface to use for reading. |
[out] | buffer | Pointer to the buffer. |
[in] | buffer_size | The size of the buffer in bytes. |
[in] | sector | Sector position in the io interface to read from. |
[in] | count | The number of sectors to read. |