diff --git a/CMakeLists.txt b/CMakeLists.txt index ffc9fab..2d812d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,26 +211,6 @@ add_library(NintendoSDK OBJECT include/nn/atk/SoundArchivePlayer.h include/nn/atk/SoundPlayer.h include/nn/atk/SoundDataManager.h - include/nn/nex/client.h - include/nn/nex/RootObject.h - include/nn/nex/socket.h - include/nn/nex/key.h - include/nn/nex/checksum.h - include/nn/nex/reference.h - include/nn/nex/pseudo.h - include/nn/nex/string.h - include/nn/nex/instance.h - include/nn/nex/ddl.h - include/nn/nex/encryption.h - include/nn/nex/cache.h - include/nn/nex/time.h - include/nn/nex/plugin.h - include/nn/nex/dynamic.h - include/nn/nex/data.h - include/nn/nex/auth.h - include/nn/nex/buffer.h - include/nn/nex/system.h - include/nn/nex/hash.h include/nn/nfp.h include/nn/nfp/nfp.h include/nn/nfp/nfp_types.h diff --git a/include/nn/crypto.h b/include/nn/crypto.h index d34d678..0e53fbb 100644 --- a/include/nn/crypto.h +++ b/include/nn/crypto.h @@ -144,17 +144,8 @@ class Sha1Impl { void GetHash(void* destHash, u64); void ProcessLastBlock(); - u64 _x0; - u64 _x8; - u32 _x10; - u128 _x14; - u128 _x24; - u128 _x34; - u32 _x44; - u64 _x48; - u64 _x50; - u64 _x58; - u64 _x60; + void* filler[13]; + u32 _68; }; class Sha256Impl { diff --git a/include/nn/nex/RootObject.h b/include/nn/nex/RootObject.h deleted file mode 100644 index faae73f..0000000 --- a/include/nn/nex/RootObject.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @file RootObject.h - * @brief RootObject for NEX. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class RootObject { -public: - enum TargetPool {}; - - virtual ~RootObject(); - - void* operator new(u64); - void operator delete(void*); - void* operator new(u64, char const*, u32); - void* operator new[](u64); - void* operator new[](u64, char const*, u32); - void operator delete[](void*); - void operator delete(void*, char const*, u32); - void operator delete[](void*, char const*, u32); - void* operator new(u64, nn::nex::RootObject::TargetPool); - void* operator new(u64, nn::nex::RootObject::TargetPool, char const*, u32); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/auth.h b/include/nn/nex/auth.h deleted file mode 100644 index c35a699..0000000 --- a/include/nn/nex/auth.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * @file auth.h - * @brief Authorization for DDL. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class NintendoAuthenticationDDLDeclarations : public nn::nex::DDLDeclarations { -public: - virtual ~NintendoAuthenticationDDLDeclarations(); - virtual void Init(); - - void Register(); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/berkeley.h b/include/nn/nex/berkeley.h deleted file mode 100644 index 8268e0b..0000000 --- a/include/nn/nex/berkeley.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include - -namespace nn::nex { - -class BerkeleySocketDriver - : SocketDriver { // inherits SocketDriver and RootObject but not documented -public: - class BerkeleySocket : public SocketDriver::Socket { - public: - BerkeleySocket(); - BerkeleySocket(const BerkeleySocket*, int); - ~BerkeleySocket(); - - bool Open(TransportProtocol::Type); - bool SetAsync(bool); - bool SetBroadcastMode(bool); - bool Bind(u16&); - bool LastSocketErrorToResult(const char*, long); - s32 GetLastSocketError(long); - s32 RecvFrom(u8*, ulong, SocketDriver::InetAddress*, u64*, SocketDriver::_SocketFlag); - }; - - ~BerkeleySocketDriver() override; -}; - -} // namespace nn::nex diff --git a/include/nn/nex/buffer.h b/include/nn/nex/buffer.h deleted file mode 100644 index ca0c6a4..0000000 --- a/include/nn/nex/buffer.h +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @file buffer.h - * @brief NEX buffer implementation. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class String; -// todo -class Buffer { -public: - Buffer(nn::nex::Buffer const&); - Buffer(nn::nex::Buffer&&); - Buffer(nn::nex::String const&); - - void FreeDataBuffer(u8*, u64); - - virtual ~Buffer(); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/cache.h b/include/nn/nex/cache.h deleted file mode 100644 index c896840..0000000 --- a/include/nn/nex/cache.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file cache.h - * @brief NEX Cache Mangement. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class String; -class BasicCache; - -class CacheManager { -public: - CacheManager(); - ~CacheManager(); - - nn::nex::BasicCache* GetCache(nn::nex::String const&); -}; - -class BasicCache { -public: - BasicCache(nn::nex::String const&); - - virtual ~BasicCache(); - - u64 _8; - u8 _10; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/checksum.h b/include/nn/nex/checksum.h deleted file mode 100644 index d00878b..0000000 --- a/include/nn/nex/checksum.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file checksum.h - * @brief NEX Checksum Implementation. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class Buffer; - -class ChecksumAlgorithm : public nn::nex::RootObject { -public: - ChecksumAlgorithm(); - - virtual ~ChecksumAlgorithm(); - - virtual bool ComputeChecksum(nn::nex::Buffer const&, nn::nex::Buffer*) = 0; - // virtual bool ComputeChecksum(u8 const **, u64 const *, u64, nn::nex::SignatureBytes &) = 0; - virtual bool IsReady() const; - virtual void ComputeChecksumForTransport(u8 const*, u64); - virtual u32 ComputeChecksumForTransportArray(u8 const**, u64 const*, u64) = 0; - virtual u32 GetChecksumLength() = 0; - - u64 _8; - u8 _10; -}; - -class MD5Checksum : public nn::nex::ChecksumAlgorithm { -public: - MD5Checksum(); - - virtual ~MD5Checksum(); - - virtual bool ComputeChecksum(nn::nex::Buffer const&, nn::nex::Buffer*); - virtual u32 ComputeChecksumForTransportArray(u8 const**, u64 const*, u64); - virtual u32 GetChecksumLength(); -}; - -class CRC16Checksum : public nn::nex::ChecksumAlgorithm { -public: - CRC16Checksum(); - - virtual ~CRC16Checksum(); - - virtual bool ComputeChecksum(nn::nex::Buffer const&, nn::nex::Buffer*); - virtual u32 ComputeChecksumForTransportArray(u8 const**, u64 const*, u64); - virtual u32 GetChecksumLength(); -}; - -/* -this actually inherits some sort of KeyedChecksum thing. whatever -class HMACChecksum : public nn::nex::ChecksumAlgorithm -{ - -}; -*/ -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/client.h b/include/nn/nex/client.h deleted file mode 100644 index 04b4eeb..0000000 --- a/include/nn/nex/client.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * @file client.h - * @brief Client implementations for NEX. - */ -#pragma once - -#include - -namespace nn { -namespace nex { -class Credentials; -class EndPoint; -class Message; -class ProtocolCallContext; -class ProtocolRequestBrokerInterface; - -class Protocol : public nn::nex::SystemComponent { -public: - enum _Command { Response, Request }; - - enum _Type { - Client, // implemented in nn::nex::ClientProtocol - Server // implemented in nn::nex::ServerProtocol - }; - - Protocol(u32); - - virtual ~Protocol(); - - virtual char* GetType() const; - virtual bool IsAKindOf(char const*) const; - virtual void EnforceDeclareSysComponentMacro(); - - virtual bool BeginInitialization(); - virtual bool BeginTermination(); - - virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; - virtual void EndPointDisconnected(nn::nex::EndPoint*); - virtual void FaultDetected(nn::nex::EndPoint*, u32); - virtual nn::nex::Protocol* Clone() const; - virtual bool Reload(); - - nn::nex::EndPoint* GetOutgoingConnection() const; - void SetIncomingConnection(nn::nex::EndPoint*); - void SetProtocolID(u16); - void AddMethodID(nn::nex::Message*, u32); - void CopyMembers(nn::nex::Protocol const*); - void AssociateProtocolRequestBroker(nn::nex::ProtocolRequestBrokerInterface*); - void ClearFlag(u32 newFlag); - - static void ExtractProtocolKey(nn::nex::Message*, nn::nex::Protocol::_Command&, u16&); - static bool IsOldRVDDLVersion(nn::nex::EndPoint*); - - u16 mProtocolID; // _48 - u16 _4A; - u32 _4C; - nn::nex::EndPoint* mOutgoingConnection; // _50 - nn::nex::ProtocolRequestBrokerInterface* mBrokerInterface; // _58 - u32 mFlags; // _60 - u32 _64; - nn::nex::EndPoint* mIncomingConnection; // _68 - u32 mUseLoopback; // _70 (boolean) - u32 _74; - u64 _78; - u32 _80; - u32 _84; -}; - -class ClientProtocol : public nn::nex::Protocol { -public: - ClientProtocol(u32); - - virtual ~ClientProtocol(); - - virtual char* GetType() const; - virtual bool IsAKindOf(char const*) const; - virtual void EnforceDeclareSysComponentMacro(); - - virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; - - virtual void ExtractCallSpecificResults(nn::nex::Message*, nn::nex::ProtocolCallContext*) = 0; - virtual nn::nex::ClientProtocol* CreateResponder() const = 0; - virtual void SetDefaultCredentials(nn::nex::Credentials*); - - bool SendOverLocalLoopback(nn::nex::ProtocolCallContext*, nn::nex::Message*); - bool SendRMCMessage(nn::nex::ProtocolCallContext*, nn::nex::Message*); - void ProcessResponse(nn::nex::Message*, nn::nex::EndPoint*); - - nn::nex::Credentials* mCredentials; // _88 -}; - -class ServerProtocol : public nn::nex::Protocol { -public: - ServerProtocol(u32); - - virtual ~ServerProtocol(); - - virtual char* GetType() const; - virtual bool IsAKindOf(char const*) const; - virtual void EnforceDeclareSysComponentMacro(); - - virtual nn::nex::Protocol::_Type GetProtocolType() const = 0; - - virtual void DispatchProtocolMessage(nn::nex::Message*, nn::nex::Message*, bool*, - nn::nex::EndPoint*) = 0; - virtual void DispatchProtocolMessageWithAttemptCount(u64, nn::nex::Message*, nn::nex::Message*, - bool*, int*, nn::nex::EndPoint*); - virtual bool UseAttemptCountMethod(); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/data.h b/include/nn/nex/data.h deleted file mode 100644 index c8ae36d..0000000 --- a/include/nn/nex/data.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @file data.h - * @brief NEX Data. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class Data : public nn::nex::RootObject { -public: - Data(); - - virtual ~Data(); - - u8 _8; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/ddl.h b/include/nn/nex/ddl.h deleted file mode 100644 index a4cc015..0000000 --- a/include/nn/nex/ddl.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * @file ddl.h - * @brief DDL Declaration Implementation. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class DDLDeclarations : public nn::nex::RootObject { -public: - DDLDeclarations(bool); - - virtual ~DDLDeclarations(); - - virtual void Init() = 0; - - void RegisterIfRequired(); - void Unregister(); - static void UnregisterAll(); - void LoadAll(); - void Load(); - void UnloadAll(); - void Unload(); - void ResetDOClassIDs(); - - u32 mNumDecsLoaded; // _8 - u8 DDLDeclarations_xC; - u8 _D; // padding - u8 _E; // ^^ - u8 _F; // ^^ - u64 _10; - bool _18; - - static nn::nex::DDLDeclarations* s_pFirstDDLDecl; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/dynamic.h b/include/nn/nex/dynamic.h deleted file mode 100644 index 0ad3d72..0000000 --- a/include/nn/nex/dynamic.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * @file dynamic.h - * @brief NEX Dyamnic Runtime. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class DynamicRunTimeInterface : public nn::nex::RootObject { -public: - DynamicRunTimeInterface(); - - virtual ~DynamicRunTimeInterface(); - - u64* GetInstance(); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/encryption.h b/include/nn/nex/encryption.h deleted file mode 100644 index bfbdc2a..0000000 --- a/include/nn/nex/encryption.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @file encryption.h - * @brief NEX Encryption Algorithm. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class Buffer; -class Key; - -class EncryptionAlgorithm : public nn::nex::RootObject { -public: - EncryptionAlgorithm(u32, u32); - - virtual ~EncryptionAlgorithm(); - - virtual bool Encrypt(nn::nex::Buffer const&, nn::nex::Buffer*) = 0; - virtual bool Encrypt(nn::nex::Buffer*); - virtual bool Decrypt(nn::nex::Buffer const&, nn::nex::Buffer*) = 0; - virtual bool Decrypt(nn::nex::Buffer*); - virtual bool GetErrorString(u32, char* destStr, u64 errLen); - virtual void KeyHasChanged(); - - bool SetKey(nn::nex::Key const& key); - - u64 _8; - u64 _10; - u64 _18; - u64 _20; - u64 _28; - u64 _30; - u64 _38; - u64 _40; -}; - -class RC4Encryption : public nn::nex::EncryptionAlgorithm { -public: - RC4Encryption(); - - virtual ~RC4Encryption(); - - virtual bool Encrypt(nn::nex::Buffer const&, nn::nex::Buffer*); - virtual bool Encrypt(nn::nex::Buffer*); - virtual bool Decrypt(nn::nex::Buffer const&, nn::nex::Buffer*); - virtual bool Decrypt(nn::nex::Buffer*); - - virtual void KeyHasChanged(); - - void GetDefaultKey(); - void PrepareEncryption(); - void ReinitStateArray(); - void SetReinitEverytime(bool); - - u8 _48[0x298 - 0x48]; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/hash.h b/include/nn/nex/hash.h deleted file mode 100644 index 1d72218..0000000 --- a/include/nn/nex/hash.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * @file hash.h - * @brief NEX Hash Implementation. - */ - -#pragma once - -#include -#include - -namespace nn { -namespace nex { -class MD5 : public nn::crypto::detail::Md5Impl, public nn::nex::RootObject { -public: - MD5(); - - void init(); - void raw_digest(u8*); - void hex_digest(); - - u8 _5C[0x74 - 0x5C]; -}; - -class Sha1 : public nn::crypto::detail::Sha1Impl, public nn::nex::RootObject { -public: - Sha1(); - - void Update(void const*, u64); - void GetHash(void*, u64); - void GenerateHash(void*, u64, void const*, u64); - - u32 _68; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/instance.h b/include/nn/nex/instance.h deleted file mode 100644 index 30633a1..0000000 --- a/include/nn/nex/instance.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @file instance.h - * @brief NEX Instance Controllers. - */ -#pragma once - -#include - -namespace nn { -namespace nex { -class InstanceTable; - -class InstanceControl : public nn::nex::RootObject { -public: - InstanceControl(u32, u32); - - u32 mInstanceContext; // _8 - u32 mInstanceType; // _C - void* mDelegateInstance; // _10 - bool mIsValidControl; // _18 - u8 _19; // probably padding - u8 _1A; - u8 _1B; - - static nn::nex::InstanceTable* s_oInstanceTable; -}; - -class InstanceTable : public nn::nex::RootObject { -public: - InstanceTable(); - - virtual ~InstanceTable(); - - bool AddInstance(nn::nex::InstanceControl*, u32, u32); - void DelInstance(nn::nex::InstanceControl*, u32, u32); - u32 CreateContext(); - bool DeleteContext(u32); - void AllocateExtraContexts(u64 size); - void FreeExtraContexts(); - u32 GetHighestID() const; - u32 FindInstanceContext(nn::nex::InstanceControl*, u32); - - u8 _0[0x94]; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/key.h b/include/nn/nex/key.h deleted file mode 100644 index 14767c0..0000000 --- a/include/nn/nex/key.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @file key.h - * @brief NEX Key Implementation. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class String; - -class Key : public nn::nex::RootObject { -public: - Key(); - Key(u8 const* src, u64 size); - Key(u64 size); - Key(nn::nex::Key const&); - Key(nn::nex::String const&); - - virtual ~Key(); - - u64* GetContentPtr(); - u64 GetLength() const; - nn::nex::Key& operator=(nn::nex::Key const&); - bool operator==(nn::nex::Key const&); - bool operator!=(nn::nex::Key const&); - void PrepareContentPtr(u64); - nn::nex::String* ToString(); - void ExtractToString(nn::nex::String*) const; - void Trace(u64) const; - void GenerateRandomKey(u64); - - u64* mContentPtrStart; // _10 - u64* mContentPtrEnd; // _18 -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/plugin.h b/include/nn/nex/plugin.h deleted file mode 100644 index c0ce757..0000000 --- a/include/nn/nex/plugin.h +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @file plugin.h - * @brief Plugin interface for NEX. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class PluginObject : public nn::nex::RootObject {}; - -class Plugin : public nn::nex::RootObject { -public: - Plugin(); - - virtual ~Plugin(); - - // there's a bunch of pure virtual methods but nothing ever inherits this class... - virtual bool Initalize(); - virtual void ThreadAttach(); - virtual void ThreadDetach(); - virtual void Destroy(); - - void SetLibrary(void*); - - void* mLibrary; // _8s - - static nn::nex::Plugin* s_pInstance; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/pseudo.h b/include/nn/nex/pseudo.h deleted file mode 100644 index 009b036..0000000 --- a/include/nn/nex/pseudo.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * @file psuedo.h - * @brief Psuedo variable implementation for NEX. - */ - -#pragma once - -#include -#include - -namespace nn { -namespace nex { -class PseudoGlobalVariableList; - -class PseudoGlobalVariableRoot : public nn::nex::RootObject { -public: - PseudoGlobalVariableRoot(); - - virtual ~PseudoGlobalVariableRoot(); - - virtual void AllocateExtraContexts() = 0; - virtual void FreeExtraContexts() = 0; - virtual void ResetContext(u32) = 0; - virtual PseudoGlobalVariableRoot* GetNext() = 0; - virtual void SetNext(PseudoGlobalVariableRoot* pNextVariable) = 0; - - static void ResetContextForAllVariables(u32); - static void AllocateExtraContextsForAllVariables(u64); - static void FreeExtraContextsForAllVariables(); - static s64 GetNbOfExtraContexts(); - - nn::nex::PseudoGlobalVariableRoot* mNextRoot; // _8 - - static s64 s_uiNbOfExtraContexts; - static PseudoGlobalVariableList s_oList; -}; - -class PseudoGlobalVariableList : public nn::nex::RootObject { -public: - PseudoGlobalVariableList(); - - virtual ~PseudoGlobalVariableList(); - - void AddVariable(nn::nex::PseudoGlobalVariableRoot*); - void RemoveVariable(nn::nex::PseudoGlobalVariableRoot*); - static nn::nex::PseudoGlobalVariableRoot* GetVariable(u32 idx); - static u32 FindVariableIndex(nn::nex::PseudoGlobalVariableRoot*); - void AllocateExtraContextsForAllVariables(); - void FreeExtraContextsForAllVariables(); - void ResetContextForAllVariables(u32); - static u32 GetNbOfVariables(); - - static PseudoGlobalVariableRoot* s_pVariableListHead; - static u32 m_uiNbOfVariables; -}; - -template -class PseudoGlobalVariable : public nn::nex::PseudoGlobalVariableRoot { -public: - PseudoGlobalVariable(); - - virtual ~PseudoGlobalVariable(); - - virtual void AllocateExtraContexts(); - virtual void FreeExtraContexts(); - virtual void ResetContext(u32); - virtual PseudoGlobalVariableRoot* GetNext(); - virtual void SetNext(PseudoGlobalVariableRoot* pNextVariable); -}; - -class PseudoSingleton : public nn::nex::InstanceControl { -public: - PseudoSingleton(u32); - - virtual ~PseudoSingleton(); - - static bool s_bUseInstantiationContext; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/reference.h b/include/nn/nex/reference.h deleted file mode 100644 index d779eb6..0000000 --- a/include/nn/nex/reference.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * @file reference.h - * @brief Reference implementations for NEX. - */ -#pragma once - -#include - -namespace nn { -namespace nex { -class RefCountedObject : public nn::nex::RootObject { -public: - virtual ~RefCountedObject(); - - u32 _8; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/socket.h b/include/nn/nex/socket.h deleted file mode 100644 index 5faba4c..0000000 --- a/include/nn/nex/socket.h +++ /dev/null @@ -1,68 +0,0 @@ -#pragma once - -#include //FIXME requires proper musl-setup -#include -#include "RootObject.h" - -namespace nn { -namespace nex { -class TransportProtocol { -public: - enum Type { - Sock_Default = 0, - Sock_Stream = SOCK_STREAM, - Sock_DGram = SOCK_DGRAM, - Sock_Raw = SOCK_RAW, - Sock_SeqPacket = SOCK_SEQPACKET, - Sock_NonBlock = SOCK_NONBLOCK - }; -}; - -class SocketDriver : nn::nex::RootObject { -public: - typedef in_addr_t InetAddress; - - enum _SocketFlag : int32_t { - Msg_None = 0, - Msg_Oob = MSG_OOB, - Msg_Peek = MSG_PEEK, - Msg_DontRoute = MSG_DONTROUTE, - Msg_Eor = MSG_EOR, - Msg_Trunc = MSG_TRUNC, - Msg_CTrunc = MSG_CTRUNC, - Msg_WaitAll = MSG_WAITALL, - Msg_DontWait = MSG_DONTWAIT, - // Msg_Eof = MSG_EOF, - // Msg_Notification = MSG_NOTIFICATION, - // Msg_Nbio = MSG_NBIO, - // Msg_Compat = MSG_COMPAT, - // Msg_SoCallbck = MSG_SOCALLBCK, - // Msg_NoSignal = MSG_NOSIGNAL, - Msg_CMsg_CloExec = MSG_CMSG_CLOEXEC - }; - - class Socket { - virtual bool Open(nn::nex::TransportProtocol::Type); - virtual void Close(); - virtual bool Bind(u16&); - virtual s32 RecvFrom(u8*, ulong, InetAddress*, ulong*, nn::nex::SocketDriver::_SocketFlag); - virtual s32 SendTo(u8 const*, ulong, nn::nex::SocketDriver::InetAddress const&, ulong*); - }; - - class PollInfo {}; - - ~SocketDriver() override; - - virtual Socket* Create(); - virtual void Delete(Socket*); - virtual int Poll(PollInfo*, u32, u32); - virtual bool CanUseGetAllReceivableSockets(); - virtual void GetAllReceivableSockets(Socket**, ulong, u32); -}; - -class ClientWebSocketDriver : SocketDriver { - class ClientWebSocket : Socket {}; - ~ClientWebSocketDriver() override; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/string.h b/include/nn/nex/string.h deleted file mode 100644 index 65bb3fa..0000000 --- a/include/nn/nex/string.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * @file string.h - * @brief NEX String Implementation. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class String : public nn::nex::RootObject { -public: - String(); - String(const char*); - String(const wchar_t*); - String(const char16_t*); - String(const String&); - String(String&&); - - String& operator=(String&&); - String& operator=(const char*); - String& operator=(const wchar_t*); - String& operator=(const String&); - String& operator=(const char16_t*); - String& operator+=(const String&); - String operator==(const String&); - bool operator<(nn::nex::String const&); - - void Truncate(u64) const; - u64 GetLength() const; - void Reserve(u64); - void SetBufferChar(char*); - void SetStringToPreReservedBuffer(char const*); - s32 GetWideCharLength() const; - void CopyString(char*, u64) const; - void CreateCopy(wchar_t**) const; - void ReleaseCopy(wchar_t*); - void ToUpper(); - void ToLower(); - void DeleteContent(); - - template - void Assign(T const*); -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/system.h b/include/nn/nex/system.h deleted file mode 100644 index 3467bca..0000000 --- a/include/nn/nex/system.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * @file system.h - * @brief System state / component interface for NEX. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class String; - -class SystemComponent : public nn::nex::RefCountedObject { -public: - enum _State { - State_Uninitialized = 1 << 0, - State_Initializing = 1 << 1, - State_Ready = 1 << 2, - State_ReadyInUse = 1 << 3, - State_Terminating = 1 << 4, - State_TerminatingWhileInUse = 1 << 5, - State_Terminated = 1 << 6, - State_Faulty = 1 << 7, - State_Unknown = 1 << 8, - State_HighestState = 1 << 8 - }; - - SystemComponent(nn::nex::String const&); - - virtual ~SystemComponent(); - - virtual char* GetType() const; - virtual bool IsAKindOf(char const*) const; - virtual void EnforceDeclareSysComponentMacro() = 0; - virtual void StateTransition(nn::nex::SystemComponent::_State); - virtual void OnInitialize(); - virtual void OnTerminate(); - virtual bool BeginInitialization(); - virtual bool EndInitialization(); - virtual bool BeginTermination(); - virtual bool EndTermination(); - virtual bool ValidTransition(nn::nex::SystemComponent::_State); - virtual bool UseIsAllowed(); - virtual nn::nex::SystemComponent::_State TestState(); - virtual void DoWork(); - - nn::nex::SystemComponent::_State Initialize(); - nn::nex::SystemComponent::_State Terminate(); - - u8 SystemComponent_xC; - u8 _D; - u8 _E; - u8 _F; - u64 _10; - u64 _18; - u64 _20; - u32 _28; - u32 _2C; - u64 _30; - nn::nex::SystemComponent::_State mState; // _38 - u32 _3C; - u64 _40; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/nex/time.h b/include/nn/nex/time.h deleted file mode 100644 index 313849f..0000000 --- a/include/nn/nex/time.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * @file time.h - * @brief NEX Time Library. - */ - -#pragma once - -#include - -namespace nn { -namespace nex { -class TimeProvider; - -class Time { -public: - static void Reset(); - static void RegisterTimeProvider(TimeProvider* provider); - - Time Multiply(f32) const; - Time Divide(f32) const; - Time Scale(f32) const; - - static Time ConvertTimeoutToDeadline(u32 timeout); - static u32 ConvertDeadlineToTimeout(Time deadline); - - u64 mCurTime; // _0 - - static u64* s_pfGetSessionTime; // some sort of callback? -}; - -class SystemClock { -public: - SystemClock(); - - virtual ~SystemClock(); - - static void RegisterTimeProvider(nn::nex::TimeProvider*, bool); - static void ApplyCorrection(Time curTime, Time newTime); - static Time ProtectedGetTime(); - static Time GetTimeImpl(bool); - static Time GetTimeImplCorrectless(); - static void Reset(); - - static nn::nex::TimeProvider* s_pTimeProvider; - static bool s_needCorrection; - static bool s_tiCorrection; -}; -} // namespace nex -} // namespace nn diff --git a/include/nn/time.h b/include/nn/time.h index 9f34c93..b8a8a88 100644 --- a/include/nn/time.h +++ b/include/nn/time.h @@ -17,7 +17,9 @@ class TimeSpan { ret.nanoseconds = nanoSeconds; return ret; } - + static TimeSpan FromMilliSeconds(u64 milliseconds) { + return FromNanoSeconds(milliseconds * 1000 * 1000); + } static TimeSpan FromSeconds(u64 seconds) { return FromNanoSeconds(seconds * 1000 * 1000 * 1000); } diff --git a/src/NintendoWare/nex/.gitkeep b/src/NintendoWare/nex/.gitkeep deleted file mode 100644 index e69de29..0000000