Skip to content

Commit

Permalink
aaaaaaaaAa
Browse files Browse the repository at this point in the history
  • Loading branch information
ieee802dot11ac committed Oct 2, 2024
1 parent ef63715 commit 1cb6c96
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 28 deletions.
4 changes: 2 additions & 2 deletions config/SZBE69_B8/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@
"sdk/RevoEX": {
"base": "base",
"flags": [
"-func_align 4",
"-O4,p"
"-O4,p",
"-func_align 4"
]
},
"sdk/DWC": {
Expand Down
12 changes: 6 additions & 6 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -777,19 +777,19 @@
"network/Platform/SpinTest.cpp": "MISSING",
"network/Platform/StackTracer.cpp": "MISSING",
"network/Platform/String.cpp": "NonMatching",
"network/Platform/StringConversion.cpp": "MISSING",
"network/Platform/StringConversion.cpp": "NonMatching",
"network/Platform/StringConverter.cpp": "MISSING",
"network/Platform/StringStream.cpp": "NonMatching",
"network/Platform/SystemChecker.cpp": "MISSING",
"network/Platform/SystemChecker.cpp": "Matching",
"network/Platform/SystemClock.cpp": "MISSING",
"network/Platform/SystemError.cpp": "MISSING",
"network/Platform/ThreadScrambler.cpp": "MISSING",
"network/Platform/ThreadScrambler.cpp": "Matching",
"network/Platform/ThreadVariable.cpp": "MISSING",
"network/Platform/Time.cpp": "NonMatching",
"network/Platform/TraceLog.cpp": "Matching",
"network/Platform/VirtualRootObject.cpp": "Matching",
"network/Platform/WaterMark.cpp": "MISSING",
"network/Platform/WiiIpStack.cpp": "MISSING",
"network/Platform/WiiIpStack.cpp": "NonMatching",
"network/Platform/WiiNetInit.cpp": "Matching"
}
},
Expand Down Expand Up @@ -2058,8 +2058,8 @@
"sdk/RevoEX/net/neterrorcode.c": "MISSING",
"sdk/RevoEX/net/netmemcpy.c": "MISSING",
"sdk/RevoEX/net/netmemset.c": "MISSING",
"sdk/RevoEX/net/NETVersion.c": "MISSING",
"sdk/RevoEX/net/wireless_macaddr.c": "MISSING",
"sdk/RevoEX/net/NETVersion.c": {"status": "NonMatching", "comment": "Linker just hates me i guess"},
"sdk/RevoEX/net/wireless_macaddr.c": "Matching",

"sdk/RevoEX/nhttp/d_nhttp.c": "MISSING",
"sdk/RevoEX/nhttp/d_nhttp_common.c": "MISSING",
Expand Down
12 changes: 12 additions & 0 deletions src/network/Core/Job.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once

#include "Platform/RefCountedObject.h"

namespace Quazal {
// forward decl cause i can't find the bastard
class DebugString;

class Job : public RefCountedObject {
Job(const DebugString&);
};
}
10 changes: 10 additions & 0 deletions src/network/Core/PeriodicJob.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include "Core/Job.h"

namespace Quazal {
class PeriodicJob : public Job {
PeriodicJob(const DebugString&);
virtual ~PeriodicJob() {}
};
}
9 changes: 9 additions & 0 deletions src/network/Core/PseudoSingleton.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once

namespace Quazal {
class PseudoSingleton {
public:

static int GetCurrentContext();
};
}
8 changes: 8 additions & 0 deletions src/network/Core/Scheduler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

namespace Quazal {
class Scheduler {
public:
static bool CurrentThreadCanWaitForJob();
};
}
13 changes: 11 additions & 2 deletions src/network/Core/SystemComponent.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "SystemComponent.h"
#include "Core/PseudoSingleton.h"
#include "Core/Scheduler.h"
#include "decomp.h"
#include "network/Platform/TraceLog.h"

Expand Down Expand Up @@ -199,7 +201,14 @@ SystemComponent::Use::~Use() {
}
}

void SystemComponent::WaitForTerminatedState(unsigned int) {

void SystemComponent::WaitForTerminatedState(unsigned int ui) { // returns struct
Terminate();
if (ui != 0 && Scheduler::CurrentThreadCanWaitForJob()) {
if (PseudoSingleton::GetCurrentContext() == 0) {

} else {

}
}
}
}
75 changes: 75 additions & 0 deletions src/network/Platform/StringConversion.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "StringConversion.h"
#include "types.h"
#include <sdk/PowerPC_EABI_Support/MSL/MSL_C/string.h>

namespace {
void Latin1ToUtf8(const char* in, char* out, unsigned int len) {
u8 srch = *in;
len--;
while (srch != 0 && len != 0) {
if ((s16)srch >= 0x80) {
u8 nu_hi = ((u16)srch >> 6) & 0x1F;
srch &= 0x3F;
*out = nu_hi | 0xC0;
*(out + 1) = srch | 0x80;
len -= 2;
out += 2;
} else {
*(out++) = srch;
len--;
}
srch = *((const u8*)++in);
}
*out = 0;
}
void Utf8ToLatin1(const char* in, char* out, unsigned int len) {
u8 srch = *in;
len--;
bool hitNonLatin1Char = false;
while (srch != 0 && len != 0 && !hitNonLatin1Char) {
if (srch <= 0x7F) {
*out = srch;
out++;
len--;
} else {
if ((srch - 0xC0) <= 0x1F) {
u8 hi = *in;
len--;
u8 lo = *((const u8*)++in);
*out = ((hi - 0xC0) << 6) + lo - 0x80;
out++;
} else {
hitNonLatin1Char = true;
}
}
srch = *((const u8*)++in);
}
*out = 0;
}
}

namespace Quazal {
namespace StringConversion {
void Char8_2T(const char* in, char* out, unsigned int len) {
strcpy(out, in); // BUG: should be strncpy(out, in, len);
}

void T2Char8(const char* in, char* out, unsigned int len) {
strcpy(out, in); // BUG: should be strncpy(out, in, len);
}

void Utf8ToT(const char* in, char* out, unsigned int len) {
Utf8ToLatin1(in, out, len);
}

void TToUtf8(const char* in, char* out, unsigned int len) {
Latin1ToUtf8(in, out, len);
}

int GetTToUtf8BufferSize(const char* str) {
return strlen(str) * 2 + 1;
}

}
}

11 changes: 11 additions & 0 deletions src/network/Platform/StringConversion.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

namespace Quazal {
namespace StringConversion {
void Char8_2T(const char* in, char* out, unsigned int len);
void T2Char8(const char* in, char* out, unsigned int len);
void Utf8ToT(const char* in, char* out, unsigned int len);
void TToUtf8(const char* in, char* out, unsigned int len);
int GetTToUtf8BufferSize(const char* str);
}
}
6 changes: 6 additions & 0 deletions src/network/Platform/SystemChecker.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Quazal {
namespace SystemChecker {
int s_pfGetSystemCheckInfo = 0;
}
}

Empty file.
54 changes: 54 additions & 0 deletions src/network/Platform/WiiIpStack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "revolution/os/OSError.h"
#include "revolution/os/OSTime.h"
#include "revolution/rvl/so.h"
#include "sdk/RevoEX/so/SOBasic.h"
#include "types.h"

uint htonl(uint x) { return SOHtoNl(x); }
uint htons(u16 x) { return SOHtoNs(x); }
uint ntohl(uint x) { return SONtoHl(x); }
uint ntohs(u16 x) { return SONtoHs(x); }

so_ret_t poll(struct SOPollFD* fd, unsigned int pollct, int timeout) {
return SOPoll((so_poll_t*)fd, pollct, 1000);
}

void bind(so_fd_t socket, const struct sockaddr* sa, unsigned int) {
SOBind(socket, (so_addr_t*)sa);
}

void connect(so_fd_t socket, const sockaddr* sa, unsigned int) {
SOConnect(socket, (so_addr_t*)sa);
}

void recv(so_fd_t sock, void* buf, unsigned long bufsiz, int flags) {
SORecv(sock, buf, bufsiz, flags);
}

void recvfrom(so_fd_t sock, void* buf, size_t bufsiz, int flags, sockaddr* addr, unsigned int*) {
SORecvFrom(sock, buf, bufsiz, flags, (so_addr_t*)addr);
}

void send(so_fd_t sock, const void* buf, size_t bufsiz, int flags) {
SOSend(sock, buf, bufsiz, flags);
}

void sendto(so_fd_t sock, const void* buf, unsigned long bufsiz, int flags, const sockaddr* addr, unsigned int) {
SOSendTo(sock, buf, bufsiz, flags, (so_addr_t*)addr);
}

void setsockopt(so_fd_t sock, int lvl, int name, const void* buf, unsigned int bufsiz) {
SOSetSockOpt(sock, (so_lvl_t)lvl, (so_opt_t)name, buf, bufsiz);
}

so_fd_t socket(int a, int b, int c) {
return SOSocket((so_pf_t)a, (so_type_t)b, (so_prot_t)c);
}

int closesocket(so_fd_t sock) {
int err;
if ((err = SOClose(sock))) {
OSReport("SOClose returns %d\n", err);
}
return err;
}
22 changes: 4 additions & 18 deletions src/sdk/RVL_SDK/revolution/rvl/so.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,24 +338,10 @@ enum so_opt_t {
static inline so_ret_t SOStartup(void) {
return SOStartupEx(60000);
}
static inline so_ret_t SORecvFrom(
so_fd_t socket, void *buffer, size_t buffer_size, int flags,
so_addr_t *addr) {
return SOiRecvFrom(0, socket, buffer, buffer_size, flags, addr);
}
static inline so_ret_t SORecv(
so_fd_t socket, void *buffer, size_t buffer_size, int flags) {
return SOiRecvFrom(0, socket, buffer, buffer_size, flags, NULL);
}
static inline so_ret_t SOSendTo(
so_fd_t socket, const void *buffer, size_t buffer_size, int flags,
const so_addr_t *addr) {
return SOiSendTo(0, socket, buffer, buffer_size, flags, addr);
}
static inline so_ret_t SOSend(
so_fd_t socket, const void *buffer, size_t buffer_size, int flags) {
return SOiSendTo(0, socket, buffer, buffer_size, flags, NULL);
}
so_ret_t SORecvFrom(so_fd_t socket, void *buffer, size_t buffer_size, int flags, so_addr_t *addr);
so_ret_t SORecv(so_fd_t socket, void *buffer, size_t buffer_size, int flags);
so_ret_t SOSendTo(so_fd_t socket, const void *buffer, size_t buffer_size, int flags, const so_addr_t *addr);
so_ret_t SOSend(so_fd_t socket, const void *buffer, size_t buffer_size, int flags);

// past this point are things i had to grab from mkwii since this so.h just Doesn't Have Them
int SOiPrepare(const char*, s32*);
Expand Down
12 changes: 12 additions & 0 deletions src/sdk/RevoEX/ncd/ncdsystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#pragma once
#ifdef __cplusplus
extern "C" {
#endif

#include "types.h"

u32 NCDiGetWirelessMacAddress();

#ifdef __cplusplus
}
#endif
4 changes: 4 additions & 0 deletions src/sdk/RevoEX/net/NETVersion.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const char* NETRexPPCVersionPrintableString = "<< REX-PPC 2.4.255.0 (RevoEX-2.4) REL 090609111526 >>";
const char* NETGetRexPPCVersionPrintable(void) {
return NETRexPPCVersionPrintableString;
}
2 changes: 2 additions & 0 deletions src/sdk/RevoEX/net/wireless_macaddr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#include "RevoEX/ncd/ncdsystem.h"
void NETGetWirelessMacAddress(void) { NCDiGetWirelessMacAddress(); }
16 changes: 16 additions & 0 deletions src/sdk/RevoEX/so/SOBasic.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <types.h>

#ifdef __cplusplus
extern "C" {
#endif

uint SONtoHl(uint);
uint SONtoHs(uint);
uint SOHtoNl(uint);
uint SOHtoNs(uint);

#ifdef __cplusplus
}
#endif

0 comments on commit 1cb6c96

Please sign in to comment.