Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/nn/fs/fs_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CloseFile(FileHandle handle);
position: Position within the file to be read.
size: How many bytes to read from file.
*/
Result ReadFile(FileHandle handle, long position, void* buffer, ulong size);
Result ReadFile(FileHandle handle, long position, void* buffer, size size);

/*
Read file at a location, with additional options.
Expand All @@ -56,7 +56,7 @@ Result ReadFile(FileHandle handle, long position, void* buffer, const ReadOption
position: Position within the file to be read.
size: How many bytes to read from file.
*/
Result ReadFile(ulong* bytesRead, FileHandle handle, long position, void* buffer);
Result ReadFile(u64* bytesRead, FileHandle handle, long position, void* buffer);

/*
Read file at a location, with an output amount of bytes read, and additional options.
Expand All @@ -66,7 +66,7 @@ Result ReadFile(ulong* bytesRead, FileHandle handle, long position, void* buffer
size: How many bytes to read from file.
option: Additional options for reading, see ReadOption.
*/
Result ReadFile(ulong* bytesRead, FileHandle handle, long position, void* buffer,
Result ReadFile(u64* bytesRead, FileHandle handle, long position, void* buffer,
const ReadOption& option);

Result ReadFile(u64* outSize, FileHandle handle, s64 offset, void* buffer, u64 bufferSize,
Expand Down Expand Up @@ -99,8 +99,8 @@ Result WriteFile(FileHandle handle, s64 position, void const* buffer, u64 size,
*/
Result FlushFile(FileHandle handle);

// Result GetSaveDataTimeStamp(nn::time::PosixTime *,ulong);
// Result GetSaveDataTimeStamp(nn::time::PosixTime*, nn::fs::SaveDataSpaceId, ulong);
// Result GetSaveDataTimeStamp(nn::time::PosixTime *,u64);
// Result GetSaveDataTimeStamp(nn::time::PosixTime*, nn::fs::SaveDataSpaceId, u64);
Result GetFileTimeStampForDebug(nn::fs::FileTimeStamp*, const char*);

Result DeleteFile(const char* path);
Expand Down
2 changes: 1 addition & 1 deletion include/nn/os.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ struct UserExceptionInfo {

CpuRegister FAR; ///< Fault Address Register.
};
void SetUserExceptionHandler(void (*)(UserExceptionInfo*), void*, ulong, UserExceptionInfo*);
void SetUserExceptionHandler(void (*)(UserExceptionInfo*), void*, u64, UserExceptionInfo*);

// OTHER
void GenerateRandomBytes(void*, u64);
Expand Down
64 changes: 32 additions & 32 deletions include/nn/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ struct InAddr {

// taken from https://switchbrew.org/wiki/Sockets_services#BsdBufferConfig
struct BsdBufferConfig {
ulong tcp_tx_buf_size = 0x8000; ///< Size of the TCP transfer (send) buffer (initial or fixed).
ulong tcp_rx_buf_size = 0x10000; ///< Size of the TCP recieve buffer (initial or fixed).
ulong tcp_tx_buf_max_size =
size tcp_tx_buf_size = 0x8000; ///< Size of the TCP transfer (send) buffer (initial or fixed).
size tcp_rx_buf_size = 0x10000; ///< Size of the TCP recieve buffer (initial or fixed).
size tcp_tx_buf_max_size =
0x30000; ///< Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the
///< buffer is fixed to its initial value.
ulong tcp_rx_buf_max_size = 0x30000; ///< Maximum size of the TCP receive buffer. If it is 0,
///< the size of the buffer is fixed to its initial value.
ulong udp_tx_buf_size =
size tcp_rx_buf_max_size = 0x30000; ///< Maximum size of the TCP receive buffer. If it is 0,
///< the size of the buffer is fixed to its initial value.
size udp_tx_buf_size =
0x2400; ///< Size of the UDP transfer (send) buffer (typically 0x2400 bytes).
ulong udp_rx_buf_size = 0xA500; ///< Size of the UDP receive buffer (typically 0xA500 bytes).
size udp_rx_buf_size = 0xA500; ///< Size of the UDP receive buffer (typically 0xA500 bytes).
int sb_efficiency =
4; ///< Number of buffers for each socket (standard values range from 1 to 8).
};
Expand All @@ -39,19 +39,19 @@ struct Config {
bool unkBool1 = false; // 0x4
bool isUseBsdS = false; // 0x5
void* pool; // 0x8
ulong poolSize; // 0x10
ulong allocPoolSize; // 0x18
size poolSize; // 0x10
size allocPoolSize; // 0x18
BsdBufferConfig bufferConfig; // 0x20-0x50
int concurLimit; // 0x54
int padding;
};

static_assert(sizeof(Config) == 0x60, "Config Size");

s32 Recv(s32 socket, void* out, ulong outLen, s32 flags);
s32 RecvFrom(int, void*, ulong, int, sockaddr*, u32*);
s32 Send(s32 socket, const void* data, ulong dataLen, s32 flags);
s32 SendTo(int, const void*, ulong, int, const sockaddr*, u32);
s32 Recv(s32 socket, void* out, size outLen, s32 flags);
s32 RecvFrom(int, void*, size, int, sockaddr*, u32*);
s32 Send(s32 socket, const void* data, size dataLen, s32 flags);
s32 SendTo(int, const void*, size, int, const sockaddr*, u32);
s32 Accept(int, sockaddr*, u32*);
s32 Bind(int, const sockaddr*, u32);
nn::Result Connect(s32 socket, const sockaddr* address, u32 addressLen);
Expand All @@ -65,11 +65,11 @@ s32 Shutdown(int, int);
s32 ShutdownAllSockets(bool);
s32 Socket(s32 domain, s32 type, s32 protocol);
s32 SocketExempt(int, int, int);
s32 Write(int, const void*, ulong);
s32 Read(int, void*, ulong);
s32 Write(int, const void*, u64);
s32 Read(int, void*, u64);
Result Close(s32 socket);
s32 Select(int, fd_set*, fd_set*, fd_set*, timeval*);
s32 Poll(pollfd*, ulong, int);
s32 Poll(pollfd*, u64, int);
s32 Fcntl(int, int, ...);
s32 InetPton(int, const char*, void*);
const char* InetNtop(int af, const void* src, char* dst, u32 size);
Expand All @@ -89,12 +89,12 @@ u32 InetNtohl(u32);
s32 GetLastErrno();
void SetLastErrno(int);
s32 RecvMsg(int, msghdr*, int);
s32 RecvMMsg(int, mmsghdr*, ulong, int, nn::TimeSpan*);
s32 RecvMMsg(int, mmsghdr*, u64, int, nn::TimeSpan*);
s32 SendMsg(int, const msghdr*, int);
s32 SendMMsg(int, const mmsghdr*, ulong, int);
s32 Ioctl(int, u32, void*, ulong);
s32 SendMMsg(int, const mmsghdr*, u64, int);
s32 Ioctl(int, u32, void*, u64);
s32 Open(const char*, int);
Result Initialize(void* pool, ulong poolSize, ulong allocPoolSize, int concurLimit);
Result Initialize(void* pool, u64 poolSize, u64 allocPoolSize, int concurLimit);
Result Initialize(nn::socket::Config const&);
s32 Finalize();
s32 GetAddrInfo(const char*, const char*, const addrinfo*, addrinfo**);
Expand All @@ -115,19 +115,19 @@ s32 Cancel(int);
s32 GetHErrno();
s32 HStrError(int);
s32 GAIStrError(int);
s32 Sysctl(int*, ulong, void*, ulong*, void*, ulong);
s32 DuplicateSocket(int, ulong);
s32 GetResourceStatistics(ResourceStatistics*, ulong);
s32 Sysctl(int*, u64, void*, u64*, void*, u64);
s32 DuplicateSocket(int, u64);
s32 GetResourceStatistics(ResourceStatistics*, u64);

} // namespace socket
} // namespace nn

extern "C" {

int nnsocketRecv(int socket, void* out, ulong outLen, int flags);
int nnsocketRecvFrom(int, void*, ulong, int, sockaddr*, u32*);
int nnsocketSend(int socket, const void* data, ulong dataLen, int flags);
int nnsocketSendTo(int, const void*, ulong, int, const sockaddr*, u32);
int nnsocketRecv(int socket, void* out, u64 outLen, int flags);
int nnsocketRecvFrom(int, void*, u64, int, sockaddr*, u32*);
int nnsocketSend(int socket, const void* data, u64 dataLen, int flags);
int nnsocketSendTo(int, const void*, u64, int, const sockaddr*, u32);
int nnsocketAccept(int, sockaddr*, u32*);
int nnsocketBind(int, const sockaddr*, u32);
u32 nnsocketConnect(); // returns nn::Result
Expand All @@ -143,7 +143,7 @@ int nnsocketWrite(int domain, int type, int protocol);
int nnsocketRead(int, int, int);
u32 nnsocketClose(); // returns nn::Result
void nnsocketSelect(int, fd_set*, fd_set*, fd_set*, timeval*);
void nnsocketPoll(pollfd*, ulong, int);
void nnsocketPoll(pollfd*, u64, int);
void nnsocketFcntl(int, int, ...);
void nnsocketInetPton(int, const char*, void*);
const char* nnsocketInetNtop(int af, const void* src, char* dst, u32 size);
Expand All @@ -157,9 +157,9 @@ s32 nnsocketGetLastErrno();
void nnsocketSetLastErrno(int);
s32 nnsocketRecvMsg(int, msghdr*, int);
s32 nnsocketSendMsg(int, const msghdr*, int);
s32 nnsocketIoctl(int, u32, void*, ulong);
s32 nnsocketIoctl(int, u32, void*, u64);
s32 nnsocketOpen(const char*, int);
u32 nnsocketInitialize(void* pool, ulong poolSize, ulong allocPoolSize, int concurLimit);
u32 nnsocketInitialize(void* pool, u64 poolSize, u64 allocPoolSize, int concurLimit);
s32 nnsocketFinalize();
s32 nnsocketGetAddrInfo(const char*, const char*, const addrinfo*, addrinfo**);
s32 nnsocketGetAddrInfoCancel(const char*, const char*, const addrinfo*, addrinfo**, int);
Expand All @@ -180,6 +180,6 @@ s32 nnsocketCancel(int);
s32 nnsocketGetHErrno();
s32 nnsocketHStrError(int);
s32 nnsocketGAIStrError(int);
s32 nnsocketSysctl(int*, ulong, void*, ulong*, void*, ulong);
s32 nnsocketDuplicateSocket(int, ulong);
s32 nnsocketSysctl(int*, u64, void*, u64*, void*, u64);
s32 nnsocketDuplicateSocket(int, u64);
}
Loading
Loading