Compare commits
5 Commits
cleanup/se
...
agent/w092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
706d053c74 | ||
|
|
099a6e2de2 | ||
|
|
255256dfc4 | ||
|
|
41dcc6f888 | ||
|
|
6f2b84e167 |
@@ -94,11 +94,11 @@ AOSS_810BDF18 = .bss:0x810BDF18; // type:object size:0x6A0
|
||||
AOSS_810BE5B8 = .bss:0x810BE5B8; // type:object size:0x280
|
||||
AOSS_810BE838 = .bss:0x810BE838; // type:object size:0x68
|
||||
AOSS_810BE8A0 = .bss:0x810BE8A0; // type:object size:0x400
|
||||
ATERM_810BECA0 = .bss:0x810BECA0; // type:object size:0x924 data:4byte
|
||||
ATERM_810BF5C4 = .bss:0x810BF5C4; // type:object size:0x24
|
||||
ATERM_810BF5E8 = .bss:0x810BF5E8; // type:object size:0x258
|
||||
ATERM_810BF840 = .bss:0x810BF840; // type:object size:0x900
|
||||
ATERM_810C0140 = .bss:0x810C0140; // type:object size:0x818 data:2byte
|
||||
gNetworkSettings = .bss:0x810BECA0; // type:object size:0x924 data:4byte
|
||||
gAccessPointName = .bss:0x810BF5C4; // type:object size:0x24
|
||||
gScanSettings = .bss:0x810BF5E8; // type:object size:0x258
|
||||
gAtermConfigurationResult = .bss:0x810BF840; // type:object size:0x900
|
||||
gAtermResponseBuffer = .bss:0x810C0140; // type:object size:0x818 data:2byte
|
||||
AtermThread = .bss:0x810C0958; // type:object size:0x318 scope:local align:32
|
||||
Voices = .bss:0x810C0C80; // type:object size:0x1800 data:4byte
|
||||
sZeroMem = .bss:0x810C2480; // type:object size:0x100 data:byte
|
||||
@@ -20582,8 +20582,8 @@ lbl_81694C60 = .sdata2:0x81694C60; // type:object size:0x4 align:4 data:float
|
||||
lbl_81694C64 = .sdata2:0x81694C64; // type:object size:0x4 align:4 data:float
|
||||
lbl_81694C68 = .sdata2:0x81694C68; // type:object size:0x4 align:4 data:float
|
||||
lbl_81694C70 = .sdata2:0x81694C70; // type:object size:0x8 align:8 data:double
|
||||
lbl_81694C78 = .sdata2:0x81694C78; // type:object size:0x2 data:2byte
|
||||
lbl_81694C7A = .sdata2:0x81694C7A; // type:object size:0x6 data:2byte
|
||||
aossDefaultConnection = .sdata2:0x81694C78; // type:object size:0x2 data:2byte
|
||||
aossDefaultOptions = .sdata2:0x81694C7A; // type:object size:0x6 data:2byte
|
||||
lbl_81694C80 = .sdata2:0x81694C80; // type:object size:0x1 data:byte
|
||||
lbl_81694C81 = .sdata2:0x81694C81; // type:object size:0x1 data:byte
|
||||
lbl_81694C82 = .sdata2:0x81694C82; // type:object size:0x1 data:byte
|
||||
@@ -22218,18 +22218,18 @@ s_socket = .sdata:0x81697200; // type:object size:0x4 data:4byte
|
||||
s_manufacturer = .sdata:0x81697204; // type:object size:0x6 data:string
|
||||
lbl_8169720C = .sdata:0x8169720C; // type:object size:0x4 data:4byte
|
||||
lbl_81697210 = .sdata:0x81697210; // type:object size:0x8
|
||||
lbl_81697218 = .sdata:0x81697218; // type:object size:0x4 data:4byte
|
||||
lbl_8169721C = .sdata:0x8169721C; // type:object size:0x4 data:4byte
|
||||
lbl_81697220 = .sdata:0x81697220; // type:object size:0x4 data:4byte
|
||||
lbl_81697224 = .sdata:0x81697224; // type:object size:0x4
|
||||
lbl_81697228 = .sdata:0x81697228; // type:object size:0x4
|
||||
lbl_8169722C = .sdata:0x8169722C; // type:object size:0x4
|
||||
lbl_81697230 = .sdata:0x81697230; // type:object size:0x4
|
||||
lbl_81697234 = .sdata:0x81697234; // type:object size:0x4
|
||||
lbl_81697238 = .sdata:0x81697238; // type:object size:0x7 data:string
|
||||
lbl_81697240 = .sdata:0x81697240; // type:object size:0x4 data:4byte
|
||||
lbl_81697244 = .sdata:0x81697244; // type:object size:0x4 data:4byte
|
||||
lbl_81697248 = .sdata:0x81697248; // type:object size:0x5 data:string
|
||||
gAtermDeadline = .sdata:0x81697218; // type:object size:0x4 data:4byte
|
||||
gAtermScanLimit = .sdata:0x8169721C; // type:object size:0x4 data:4byte
|
||||
gAtermScanBufferSize = .sdata:0x81697220; // type:object size:0x4 data:4byte
|
||||
gDefaultIpAddress = .sdata:0x81697224; // type:object size:0x4
|
||||
gDefaultSubnetMask = .sdata:0x81697228; // type:object size:0x4
|
||||
gDefaultGateway = .sdata:0x8169722C; // type:object size:0x4
|
||||
gDefaultPrimaryDns = .sdata:0x81697230; // type:object size:0x4
|
||||
gDefaultSecondaryDns = .sdata:0x81697234; // type:object size:0x4
|
||||
gAtermAossSsid = .sdata:0x81697238; // type:object size:0x7 data:string
|
||||
gAtermRequestOptions = .sdata:0x81697240; // type:object size:0x4 data:4byte
|
||||
gAtermUseSharedAddress = .sdata:0x81697244; // type:object size:0x4 data:4byte
|
||||
gAtermProductName = .sdata:0x81697248; // type:object size:0x5 data:string
|
||||
@10020 = .sdata:0x81697250; // type:object size:0x4 scope:local data:string
|
||||
scBtnSoundType__Q23ipl5scene = .sdata:0x81697258; // type:object size:0x8 scope:local
|
||||
@10722 = .sdata:0x81697260; // type:object size:0x4 scope:local data:string
|
||||
|
||||
@@ -268,7 +268,10 @@ static char s_manufacturer[] = "MELCO";
|
||||
static s32 s_operationState = -1;
|
||||
static const u8 s_messageId[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
|
||||
static u8 s_responseTypeByState[8] = { 9, 8, 0, 0, 0, 0, 0, 0 };
|
||||
static const u16 s_defaultOptions[4] = { 0xffff, 0xffff, 0, 0 };
|
||||
__declspec(section ".sdata2") u16 s_defaultConnection = 0xffff;
|
||||
__declspec(section ".sdata2") u16 s_defaultOptions = 0xffff;
|
||||
const u16 s_defaultResponseA = 0;
|
||||
const u16 s_defaultResponseB = 0;
|
||||
|
||||
static void* s_responseBuffer;
|
||||
static s32 s_socketStarted;
|
||||
@@ -438,8 +441,8 @@ int AOSS_Init_old(AOSSInitInput* input)
|
||||
u32 networkAddresses[5];
|
||||
AOSSPollDescriptor pollArguments[2];
|
||||
|
||||
defaultConnection = s_defaultOptions[0];
|
||||
defaultResponse = s_defaultOptions[1];
|
||||
defaultConnection = s_defaultConnection;
|
||||
defaultResponse = s_defaultOptions;
|
||||
waitIntervals.defaults.connection = defaultConnection;
|
||||
waitIntervals.defaults.response = defaultResponse;
|
||||
waitSettings.value = 0;
|
||||
@@ -1028,10 +1031,12 @@ request_socket_cleanup_complete:
|
||||
if (0 < requestResult) goto process_received_packet;
|
||||
receivedPackets = receivedPackets + 1;
|
||||
if (receivedPackets > attemptCount) {
|
||||
switch (protocolState) {
|
||||
case 0: s_errorCode = 0xf; break;
|
||||
case 1: s_errorCode = 0x10; break;
|
||||
default: s_errorCode = 0x11; break;
|
||||
if (protocolState == 0) {
|
||||
s_errorCode = 0xf;
|
||||
} else if (protocolState == 1) {
|
||||
s_errorCode = 0x10;
|
||||
} else {
|
||||
s_errorCode = 0x11;
|
||||
}
|
||||
protocolResult = -1;
|
||||
goto close_protocol_socket;
|
||||
@@ -1299,10 +1304,12 @@ wait_for_packet:
|
||||
}
|
||||
protocolState = requestResult;
|
||||
if (receivedPackets > waitSettings.halfwords.high) {
|
||||
switch (requestResult) {
|
||||
case 0: s_errorCode = 0xf; break;
|
||||
case 1: s_errorCode = 0x10; break;
|
||||
default: s_errorCode = 0x11; break;
|
||||
if (requestResult == 0) {
|
||||
s_errorCode = 0xf;
|
||||
} else if (requestResult == 1) {
|
||||
s_errorCode = 0x10;
|
||||
} else {
|
||||
s_errorCode = 0x11;
|
||||
}
|
||||
protocolResult = -1;
|
||||
goto close_protocol_socket;
|
||||
|
||||
@@ -34,7 +34,7 @@ struct AOSSAccessPoint {
|
||||
u8 bssid[6];
|
||||
u16 capabilities;
|
||||
u32 rateCount;
|
||||
u8 rates[12];
|
||||
u8 rates[16];
|
||||
u32 beaconPeriod;
|
||||
u32 mode;
|
||||
};
|
||||
@@ -84,7 +84,7 @@ void* AOSSi_Alloc(u32 size) {
|
||||
}
|
||||
|
||||
void AOSSi_Free(void* block) {
|
||||
if (releaseMemory != NULL) {
|
||||
if (releaseMemory) {
|
||||
releaseMemory(0, block, 0);
|
||||
}
|
||||
}
|
||||
@@ -128,16 +128,17 @@ int AOSSi_EndLocal(void) {
|
||||
|
||||
int AOSSi_WLANGetBSSList(struct AOSSAccessPointList** output) {
|
||||
int result = -1;
|
||||
int startupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
int cleanupRetries = 0;
|
||||
int unlockRetries = 0;
|
||||
int driver;
|
||||
u8* buffer;
|
||||
WD_Info info ATTRIBUTE_ALIGN(32);
|
||||
WDScanParam scan;
|
||||
u8 macAddress[6];
|
||||
if (allocateMemory == NULL || releaseMemory == NULL) {
|
||||
WDScanParam scan ATTRIBUTE_ALIGN(32);
|
||||
WD_Info info ATTRIBUTE_ALIGN(32);
|
||||
int startupRetries = 0;
|
||||
int unlockRetries = 0;
|
||||
int cleanupRetries = 0;
|
||||
int scanRetries = 0;
|
||||
|
||||
if (!allocateMemory || !releaseMemory) {
|
||||
return -1;
|
||||
}
|
||||
driver = NCDLockWirelessDriver();
|
||||
@@ -157,7 +158,7 @@ startup:
|
||||
memcpy(macAddress, info.MAC, 6);
|
||||
}
|
||||
buffer = AOSSi_Alloc(0x3200);
|
||||
if (buffer != NULL) {
|
||||
if (buffer) {
|
||||
memset(buffer, 0, 0x3200);
|
||||
scan.channelBit = info.enableChannel;
|
||||
scan.maxChannelTime = 40;
|
||||
@@ -167,48 +168,47 @@ startup:
|
||||
memset(scan.ssid, 0, 32);
|
||||
memset(scan.ssidMask, 255, 32);
|
||||
while (1) {
|
||||
int scanResult = WD_Scan(&scan, buffer, 0x3200);
|
||||
int count;
|
||||
int count = WD_Scan(&scan, buffer, 0x3200);
|
||||
struct AOSSAccessPointList* list;
|
||||
WDBssDesc* descriptor;
|
||||
int index;
|
||||
if (scanResult != 0 && scanResult != WD_INTERNAL_ERR_4) {
|
||||
if (count != 0 && count != WD_INTERNAL_ERR_4) {
|
||||
break;
|
||||
}
|
||||
count = *(u16*)buffer;
|
||||
if (count != 0) {
|
||||
list = AOSSi_Alloc(sizeof(*list) + (count - 1) * sizeof(struct AOSSAccessPoint));
|
||||
if (list == NULL) {
|
||||
if (!list) {
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
list->count = count;
|
||||
descriptor = (WDBssDesc*)&buffer[2];
|
||||
for (index = 0; index < count; ++index) {
|
||||
struct AOSSAccessPoint* accessPoint = &list->accessPoints[index];
|
||||
int rate;
|
||||
int rateCount = 0;
|
||||
accessPoint->ssidLength = descriptor->ssidLength;
|
||||
memcpy(accessPoint->ssid, descriptor->ssid, 32);
|
||||
accessPoint->channel = descriptor->channel;
|
||||
memcpy(accessPoint->bssid, descriptor->bssid, 6);
|
||||
int rateCount;
|
||||
list->accessPoints[index].ssidLength = descriptor->ssidLength;
|
||||
memcpy(list->accessPoints[index].ssid, descriptor->ssid, 32);
|
||||
list->accessPoints[index].channel = descriptor->channel;
|
||||
memcpy(list->accessPoints[index].bssid, descriptor->bssid, 6);
|
||||
rateCount = 0;
|
||||
for (rate = 0; rate < 12; ++rate) {
|
||||
if (descriptor->rateSet.support & supportedRates[rate].mask) {
|
||||
accessPoint->rates[rateCount] = supportedRates[rate].value;
|
||||
list->accessPoints[index].rates[rateCount] = supportedRates[rate].value;
|
||||
if (descriptor->rateSet.basic & supportedRates[rate].mask) {
|
||||
accessPoint->rates[rateCount] |= 128;
|
||||
list->accessPoints[index].rates[rateCount] |= 128;
|
||||
}
|
||||
++rateCount;
|
||||
}
|
||||
}
|
||||
accessPoint->rateCount = rateCount;
|
||||
accessPoint->beaconPeriod = descriptor->beaconPeriod;
|
||||
list->accessPoints[index].rateCount = rateCount;
|
||||
list->accessPoints[index].beaconPeriod = descriptor->beaconPeriod;
|
||||
if ((descriptor->capabilities & 3) == 1) {
|
||||
accessPoint->mode = 1;
|
||||
list->accessPoints[index].mode = 1;
|
||||
} else if ((descriptor->capabilities & 3) == 2) {
|
||||
accessPoint->mode = 2;
|
||||
list->accessPoints[index].mode = 2;
|
||||
} else {
|
||||
accessPoint->mode = 0;
|
||||
list->accessPoints[index].mode = 0;
|
||||
}
|
||||
descriptor = (WDBssDesc*)((u16*)descriptor + descriptor->length);
|
||||
}
|
||||
@@ -222,7 +222,7 @@ startup:
|
||||
}
|
||||
if (++scanRetries > 10) {
|
||||
list = AOSSi_Alloc(sizeof(*list));
|
||||
if (list == NULL) {
|
||||
if (!list) {
|
||||
result = -1;
|
||||
break;
|
||||
}
|
||||
@@ -235,31 +235,27 @@ startup:
|
||||
}
|
||||
AOSSi_Free(buffer);
|
||||
}
|
||||
cleanup:
|
||||
if (WD_Cleanup() != 0) {
|
||||
while (WD_Cleanup() != 0) {
|
||||
if (cleanupRetries > 10) {
|
||||
result = -1;
|
||||
goto unlock;
|
||||
}
|
||||
++cleanupRetries;
|
||||
AOSSi_SleepMs(10);
|
||||
goto cleanup;
|
||||
}
|
||||
unlock:
|
||||
if (NCDUnlockWirelessDriver(driver) != 0) {
|
||||
while (NCDUnlockWirelessDriver(driver) != 0) {
|
||||
if (unlockRetries > 10) {
|
||||
result = -1;
|
||||
return -1;
|
||||
}
|
||||
++unlockRetries;
|
||||
AOSSi_SleepMs(10);
|
||||
goto unlock;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int AOSSi_WLANConnect(struct AOSSConnection* connection, struct AOSSConnectionStatus* status) {
|
||||
int retries = 0;
|
||||
int result = 0;
|
||||
WD_Info info ATTRIBUTE_ALIGN(32);
|
||||
NCDIfConfig* interfaceConfig = &AOSSi_NcdIfConfig;
|
||||
@@ -307,6 +303,7 @@ int AOSSi_WLANConnect(struct AOSSConnection* connection, struct AOSSConnectionSt
|
||||
result = -1;
|
||||
}
|
||||
if (result == 0) {
|
||||
int retries = 0;
|
||||
while (!NCDIsInterfaceDecided()) {
|
||||
if (AOSSi_cancel_flag == 1) {
|
||||
result = -1;
|
||||
@@ -325,9 +322,11 @@ int AOSSi_WLANConnect(struct AOSSConnection* connection, struct AOSSConnectionSt
|
||||
if (WD_GetInfo(&info) == 0) {
|
||||
status->channel = info.channel;
|
||||
}
|
||||
status->ssidLength = interfaceConfig->netif.wireless.config.manual.ssidLength;
|
||||
memcpy(status->ssid, interfaceConfig->netif.wireless.config.manual.ssid,
|
||||
interfaceConfig->netif.wireless.config.manual.ssidLength);
|
||||
{
|
||||
u16 ssidLength = interfaceConfig->netif.wireless.config.manual.ssidLength;
|
||||
status->ssidLength = ssidLength;
|
||||
memcpy(status->ssid, interfaceConfig->netif.wireless.config.manual.ssid, ssidLength);
|
||||
}
|
||||
} else {
|
||||
status->connected = 0;
|
||||
}
|
||||
|
||||
@@ -505,11 +505,13 @@ typedef void* (*AtermAllocateCallback)(u32);
|
||||
typedef void (*AtermFreeCallback)(void*);
|
||||
|
||||
AtermNetworkSettings gNetworkSettings;
|
||||
AtermThreadBuffer gAtermResponseBuffer;
|
||||
static OSThread AtermThread;
|
||||
char gAccessPointName[0x24];
|
||||
AtermScanSettings gScanSettings;
|
||||
AtermConfigurationResult gAtermConfigurationResult;
|
||||
AtermThreadBuffer gAtermResponseBuffer;
|
||||
static OSThread sAtermThread;
|
||||
|
||||
u8* gAtermRequestOptions = gAtermResponseBuffer.data;
|
||||
u32 gAtermDeadline = 0xFFFFFFFF;
|
||||
u32 gAtermScanLimit = 0x40;
|
||||
u32 gAtermScanBufferSize = 0x800;
|
||||
@@ -522,7 +524,7 @@ char gAtermAossSsid[7] = "******";
|
||||
extern u32 gAtermUseSharedAddress;
|
||||
extern char gAtermProductName[5];
|
||||
u32 gAtermCancelRequested;
|
||||
u8 gAtermSelectedBssid[6];
|
||||
u8 gAtermSelectedBssid[8];
|
||||
u32 gAtermProtocolState;
|
||||
u8 gAtermAddressBuffer[8];
|
||||
u32 gAtermResponseMode;
|
||||
@@ -537,6 +539,40 @@ void* gAtermAllocation;
|
||||
AtermFreeCallback gAtermRelease;
|
||||
AtermAllocateCallback gAtermAllocate;
|
||||
AtermProgressCallback gAtermProgressCallback;
|
||||
|
||||
typedef struct {
|
||||
u8 challenge[8];
|
||||
u8 digest[16];
|
||||
} AtermAuthenticationData;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
u8 payload[0x800];
|
||||
AtermDecodedPayload decoded;
|
||||
};
|
||||
union {
|
||||
AtermAuthenticationData data;
|
||||
u8 keyMaterial[24];
|
||||
};
|
||||
} AtermAuthentication;
|
||||
|
||||
typedef struct {
|
||||
char ssid[32];
|
||||
u32 setupMode;
|
||||
u32 securityMode;
|
||||
u8 reserved028[0x80];
|
||||
u8 keyMaterial[0x40];
|
||||
u8 connectionPrefix[0x10];
|
||||
u8 packetBuffer[0x800];
|
||||
AtermAuthentication authentication;
|
||||
} AtermGlobalsConfiguration;
|
||||
|
||||
typedef struct {
|
||||
AtermNetworkSettings networkSettings;
|
||||
char accessPointName[0x24];
|
||||
AtermScanSettings scanSettings;
|
||||
AtermGlobalsConfiguration configuration;
|
||||
} AtermGlobals;
|
||||
u32 gAtermResult;
|
||||
s32 gAtermState;
|
||||
|
||||
@@ -1439,8 +1475,10 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
OSAlarm waitAlarm;
|
||||
AtermSocketAddress socketBindAddress;
|
||||
AtermSocketAddress peerAddress;
|
||||
AtermThreadBuffer* response = (AtermThreadBuffer*)&gAtermConfigurationResult.responseLength;
|
||||
void* sessionKey = gAtermResponseBuffer.session.keyMaterial;
|
||||
AtermGlobals* globals = (AtermGlobals*)&gNetworkSettings;
|
||||
void* sessionKey = globals->configuration.authentication.keyMaterial;
|
||||
AtermAuthenticationData* authData = &globals->configuration.authentication.data;
|
||||
u32 messageLength;
|
||||
AtermMd5Context digestContext;
|
||||
u8 digestLength[8];
|
||||
s32 socket = 0;
|
||||
@@ -1525,11 +1563,11 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
break;
|
||||
}
|
||||
peerAddress.length = 8;
|
||||
ATERMBuildAssociationRequest((AtermAssociationRequest*)gAtermConfigurationResult.connectionPrefix);
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
ATERMBuildAssociationRequest((AtermAssociationRequest*)globals->configuration.connectionPrefix);
|
||||
receivedLength = SORecvFrom(socket, globals->configuration.packetBuffer,
|
||||
sizeof(globals->configuration.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0 &&
|
||||
ATERMParsePacket((AtermPacket*)gAtermConfigurationResult.packetBuffer, &gAtermResponseMode)) {
|
||||
ATERMParsePacket((AtermPacket*)globals->configuration.packetBuffer, &gAtermResponseMode)) {
|
||||
AtermProgress progress;
|
||||
gAtermDeadline = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6)) + 30000;
|
||||
gAtermProtocolState = 5;
|
||||
@@ -1546,30 +1584,29 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
u8 optionIds[7] = {6, 0, 1, 2, 3, 4, 5};
|
||||
u8 optionIds[7] = "\006\000\001\002\003\004\005";
|
||||
AtermRequestOption8* shortOption = (AtermRequestOption8*)gAtermRequestOptions;
|
||||
AtermRequestOption16* longOption;
|
||||
u16 enabled = SOHtoNs(1);
|
||||
AtermSocketAddress sendAddress;
|
||||
u8* optionEnd;
|
||||
memset(shortOption, 0, 4);
|
||||
shortOption->type = SOHtoNs(1);
|
||||
shortOption->length = SOHtoNs(2);
|
||||
memset(shortOption->value, 0, sizeof(shortOption->value));
|
||||
memcpy(shortOption->value, &enabled, sizeof(enabled));
|
||||
shortOption++;
|
||||
memset(shortOption, 0, 4);
|
||||
shortOption->type = SOHtoNs(2);
|
||||
shortOption->length = SOHtoNs(2);
|
||||
memset(shortOption->value, 0, sizeof(shortOption->value));
|
||||
memcpy(shortOption->value, &enabled, sizeof(enabled));
|
||||
memset(&shortOption[0], 0, 4);
|
||||
shortOption[0].type = SOHtoNs(1);
|
||||
shortOption[0].length = SOHtoNs(2);
|
||||
memset(shortOption[0].value, 0, sizeof(shortOption[0].value));
|
||||
memcpy(shortOption[0].value, &enabled, sizeof(enabled));
|
||||
memset(&shortOption[1], 0, 4);
|
||||
shortOption[1].type = SOHtoNs(2);
|
||||
shortOption[1].length = SOHtoNs(2);
|
||||
memset(shortOption[1].value, 0, sizeof(shortOption[1].value));
|
||||
memcpy(shortOption[1].value, &enabled, sizeof(enabled));
|
||||
shortOption++;
|
||||
if (gAtermResponseMode != 0) {
|
||||
memset(shortOption, 0, 4);
|
||||
shortOption->type = SOHtoNs(5);
|
||||
shortOption->length = SOHtoNs(2);
|
||||
memset(shortOption->value, 0, sizeof(shortOption->value));
|
||||
memcpy(shortOption->value, &enabled, sizeof(enabled));
|
||||
memset(&shortOption[1], 0, 4);
|
||||
shortOption[1].type = SOHtoNs(5);
|
||||
shortOption[1].length = SOHtoNs(2);
|
||||
memset(shortOption[1].value, 0, sizeof(shortOption[1].value));
|
||||
memcpy(shortOption[1].value, &enabled, sizeof(enabled));
|
||||
shortOption++;
|
||||
}
|
||||
longOption = (AtermRequestOption16*)shortOption;
|
||||
@@ -1588,13 +1625,14 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
longOption++;
|
||||
}
|
||||
optionEnd = (u8*)longOption;
|
||||
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 2,
|
||||
(u16*)response->data, optionEnd - gAtermRequestOptions + 8, NULL);
|
||||
messageLength = ATERMBuildEncryptedMessage((u16*)globals->configuration.packetBuffer, 2,
|
||||
(u16*)globals->configuration.authentication.decoded.options, optionEnd - gAtermRequestOptions + 8, NULL);
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
gAtermMessageLength = messageLength;
|
||||
SOSendTo(socket, globals->configuration.packetBuffer, messageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
gAtermProtocolState = 6;
|
||||
break;
|
||||
@@ -1607,14 +1645,14 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
failed = 1;
|
||||
break;
|
||||
}
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
receivedLength = SORecvFrom(socket, globals->configuration.packetBuffer,
|
||||
sizeof(globals->configuration.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0) {
|
||||
AtermPacket* packet = (AtermPacket*)gAtermConfigurationResult.packetBuffer;
|
||||
AtermPacket* packet = (AtermPacket*)globals->configuration.packetBuffer;
|
||||
s32 sequence = SONtoHs(packet->sequence);
|
||||
s32 payloadLength = SONtoHs(packet->length);
|
||||
u32 checksum = 0;
|
||||
u8* cursor = gAtermConfigurationResult.packetBuffer;
|
||||
u8* cursor = globals->configuration.packetBuffer;
|
||||
u8* packetEnd = packet->payload + payloadLength;
|
||||
u8* payload = packet->payload;
|
||||
for (; cursor < packetEnd; cursor++) {
|
||||
@@ -1627,16 +1665,16 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
payloadLength = 0;
|
||||
} else if (sequence != 3) {
|
||||
payloadLength = 0;
|
||||
} else if (gAtermConfigurationResult.connectionPrefix != NULL) {
|
||||
ATERMAesKeyUnwrap((u16*)response->authentication.payload, (u16*)payload,
|
||||
payloadLength, gAtermConfigurationResult.connectionPrefix, 16);
|
||||
} else if (globals->configuration.connectionPrefix != NULL) {
|
||||
ATERMAesKeyUnwrap((u16*)globals->configuration.authentication.payload, (u16*)payload,
|
||||
payloadLength, globals->configuration.connectionPrefix, 16);
|
||||
payloadLength -= 8;
|
||||
} else {
|
||||
memcpy(response->authentication.payload, payload, payloadLength);
|
||||
memcpy(globals->configuration.authentication.payload, payload, payloadLength);
|
||||
}
|
||||
if (payloadLength != 0) {
|
||||
AtermPacketOption* option = (AtermPacketOption*)response->authentication.decoded.options;
|
||||
u8* optionEnd = (u8*)option + SONtoHs(response->authentication.decoded.length);
|
||||
AtermPacketOption* option = (AtermPacketOption*)globals->configuration.authentication.decoded.options;
|
||||
u8* optionEnd = (u8*)option + SONtoHs(globals->configuration.authentication.decoded.length);
|
||||
s32 optionType;
|
||||
u8* optionValue;
|
||||
if ((u8*)option >= optionEnd) {
|
||||
@@ -1652,7 +1690,7 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
(__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
u32 index;
|
||||
u32 digestBytes;
|
||||
memcpy(response->authentication.challenge,
|
||||
memcpy(authData->challenge,
|
||||
optionValue, 8);
|
||||
digestContext.bitCountHigh = 0;
|
||||
digestContext.bitCountLow = 0;
|
||||
@@ -1673,22 +1711,29 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
ATERMMd5Update(&digestContext, gAtermDigestFill,
|
||||
digestBytes < 56 ? 56 - digestBytes : 120 - digestBytes);
|
||||
ATERMMd5Update(&digestContext, digestLength, sizeof(digestLength));
|
||||
response->authentication.digest[0] = digestContext.state[0];
|
||||
response->authentication.digest[1] = digestContext.state[0] >> 8;
|
||||
response->authentication.digest[2] = digestContext.state[0] >> 16;
|
||||
response->authentication.digest[3] = digestContext.state[0] >> 24;
|
||||
response->authentication.digest[4] = digestContext.state[1];
|
||||
response->authentication.digest[5] = digestContext.state[1] >> 8;
|
||||
response->authentication.digest[6] = digestContext.state[1] >> 16;
|
||||
response->authentication.digest[7] = digestContext.state[1] >> 24;
|
||||
response->authentication.digest[8] = digestContext.state[2];
|
||||
response->authentication.digest[9] = digestContext.state[2] >> 8;
|
||||
response->authentication.digest[10] = digestContext.state[2] >> 16;
|
||||
response->authentication.digest[11] = digestContext.state[2] >> 24;
|
||||
response->authentication.digest[12] = digestContext.state[3];
|
||||
response->authentication.digest[13] = digestContext.state[3] >> 8;
|
||||
response->authentication.digest[14] = digestContext.state[3] >> 16;
|
||||
response->authentication.digest[15] = digestContext.state[3] >> 24;
|
||||
{
|
||||
u8* digest = authData->digest;
|
||||
u32 state = digestContext.state[0];
|
||||
digest[0] = state;
|
||||
digest[1] = state >> 8;
|
||||
digest[2] = state >> 16;
|
||||
digest[3] = state >> 24;
|
||||
state = digestContext.state[1];
|
||||
digest[4] = state;
|
||||
digest[5] = state >> 8;
|
||||
digest[6] = state >> 16;
|
||||
digest[7] = state >> 24;
|
||||
state = digestContext.state[2];
|
||||
digest[8] = state;
|
||||
digest[9] = state >> 8;
|
||||
digest[10] = state >> 16;
|
||||
digest[11] = state >> 24;
|
||||
state = digestContext.state[3];
|
||||
digest[12] = state;
|
||||
digest[13] = state >> 8;
|
||||
digest[14] = state >> 16;
|
||||
digest[15] = state >> 24;
|
||||
}
|
||||
{
|
||||
u8* contextByte = (u8*)&digestContext;
|
||||
for (index = 0; index < sizeof(digestContext); index++) {
|
||||
@@ -1714,37 +1759,38 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
break;
|
||||
case 7:
|
||||
{
|
||||
AtermRequestOption16* option = (AtermRequestOption16*)response->authentication.decoded.options;
|
||||
AtermRequestOption16* option = (AtermRequestOption16*)globals->configuration.authentication.decoded.options;
|
||||
AtermSocketAddress sendAddress;
|
||||
memset(response->data, 0, 8);
|
||||
memset(&globals->configuration.authentication, 0, 8);
|
||||
memset(option, 0, 4);
|
||||
option->type = SOHtoNs(0x102);
|
||||
option->length = SOHtoNs(8);
|
||||
memset(option->value, 0, sizeof(option->value));
|
||||
memcpy(option->value, response->authentication.digest, 8);
|
||||
gAtermReplyLength = (u8*)(option + 1) - response->data;
|
||||
response->authentication.decoded.length = gAtermReplyLength - 8;
|
||||
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 4,
|
||||
(u16*)response->data, gAtermReplyLength, gAtermConfigurationResult.connectionPrefix);
|
||||
memcpy(option->value, authData->digest, 8);
|
||||
gAtermReplyLength = (u8*)(option + 1) - globals->configuration.authentication.decoded.options;
|
||||
globals->configuration.authentication.decoded.length = gAtermReplyLength - 8;
|
||||
messageLength = ATERMBuildEncryptedMessage((u16*)globals->configuration.packetBuffer, 4,
|
||||
(u16*)globals->configuration.authentication.decoded.options, gAtermReplyLength, globals->configuration.connectionPrefix);
|
||||
sendAddress.length = 8;
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
gAtermMessageLength = messageLength;
|
||||
SOSendTo(socket, globals->configuration.packetBuffer, messageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
memset(&gScanSettings, 0, 0x254);
|
||||
memset(&globals->scanSettings, 0, 0x254);
|
||||
gAtermProtocolState = 8;
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
receivedLength = SORecvFrom(socket, gAtermConfigurationResult.packetBuffer,
|
||||
sizeof(gAtermConfigurationResult.packetBuffer), 4, &peerAddress);
|
||||
receivedLength = SORecvFrom(socket, globals->configuration.packetBuffer,
|
||||
sizeof(globals->configuration.packetBuffer), 4, &peerAddress);
|
||||
if (receivedLength > 0) {
|
||||
AtermPacket* packet = (AtermPacket*)gAtermConfigurationResult.packetBuffer;
|
||||
AtermPacket* packet = (AtermPacket*)globals->configuration.packetBuffer;
|
||||
s32 sequence = SONtoHs(packet->sequence);
|
||||
s32 payloadLength = SONtoHs(packet->length);
|
||||
u32 checksum = 0;
|
||||
u8* cursor = gAtermConfigurationResult.packetBuffer;
|
||||
u8* cursor = globals->configuration.packetBuffer;
|
||||
u8* packetEnd = packet->payload + payloadLength;
|
||||
u8* payload = packet->payload;
|
||||
for (; cursor < packetEnd; cursor++) {
|
||||
@@ -1758,17 +1804,17 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
} else if (sequence != 5) {
|
||||
payloadLength = 0;
|
||||
} else if (sessionKey != NULL) {
|
||||
ATERMAesKeyUnwrap((u16*)response->authentication.payload, (u16*)payload,
|
||||
ATERMAesKeyUnwrap((u16*)globals->configuration.authentication.payload, (u16*)payload,
|
||||
payloadLength, sessionKey, 16);
|
||||
payloadLength -= 8;
|
||||
} else {
|
||||
memcpy(response->authentication.payload, payload, payloadLength);
|
||||
memcpy(globals->configuration.authentication.payload, payload, payloadLength);
|
||||
}
|
||||
gAtermReplyLength = payloadLength;
|
||||
if (payloadLength != 0 && ATERMParseAssociationResponse((u16*)response->data)) {
|
||||
if (payloadLength != 0 && ATERMParseAssociationResponse((u16*)globals->configuration.authentication.decoded.options)) {
|
||||
gAtermProtocolState = 9;
|
||||
retries = 0;
|
||||
gAtermMode = gScanSettings.ssid[0] != 0;
|
||||
gAtermMode = globals->scanSettings.ssid[0] != 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1785,18 +1831,18 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
AtermRequestOption8* option = (AtermRequestOption8*)response->authentication.decoded.options;
|
||||
AtermRequestOption8* option = (AtermRequestOption8*)globals->configuration.authentication.decoded.options;
|
||||
AtermSocketAddress sendAddress;
|
||||
memset(response->data, 0, 8);
|
||||
memset(&globals->configuration.authentication, 0, 8);
|
||||
memset(option, 0, 4);
|
||||
option->type = SOHtoNs(0x301);
|
||||
option->length = SOHtoNs(1);
|
||||
memset(option->value, 0, sizeof(option->value));
|
||||
memcpy(option->value, &gAtermMode, 1);
|
||||
gAtermReplyLength = (u8*)(option + 1) - response->data;
|
||||
response->authentication.decoded.length = gAtermReplyLength - 8;
|
||||
gAtermMessageLength = ATERMBuildEncryptedMessage((u16*)gAtermConfigurationResult.packetBuffer, 6,
|
||||
(u16*)response->data, gAtermReplyLength, sessionKey);
|
||||
gAtermReplyLength = (u8*)(option + 1) - globals->configuration.authentication.decoded.options;
|
||||
globals->configuration.authentication.decoded.length = gAtermReplyLength - 8;
|
||||
messageLength = ATERMBuildEncryptedMessage((u16*)globals->configuration.packetBuffer, 6,
|
||||
(u16*)globals->configuration.authentication.decoded.options, gAtermReplyLength, sessionKey);
|
||||
if (NCDGetLinkStatus() != 5) {
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6)) + 1000;
|
||||
retries = 10;
|
||||
@@ -1807,7 +1853,8 @@ s32 ATERMRunConfigProtocol(void) {
|
||||
sendAddress.family = 2;
|
||||
sendAddress.address = 0xFFFFFFFF;
|
||||
sendAddress.port = SOHtoNs(0xE601);
|
||||
SOSendTo(socket, gAtermConfigurationResult.packetBuffer, gAtermMessageLength, 0, &sendAddress);
|
||||
gAtermMessageLength = messageLength;
|
||||
SOSendTo(socket, globals->configuration.packetBuffer, messageLength, 0, &sendAddress);
|
||||
lastSendTime = (u32)(OSGetTime() / (__mulhwu(reciprocal, OS_BUS_CLOCK >> 2) >> 6));
|
||||
gAtermProtocolState = 10;
|
||||
break;
|
||||
@@ -2479,7 +2526,7 @@ int ATERMi_ApConfigStart(OSPriority priority, u32 scanLimit,
|
||||
return -1;
|
||||
}
|
||||
|
||||
OSCreateThread(&sAtermThread, (void* (*)(void*))ATERMi_AutoConfigThread, NULL,
|
||||
OSCreateThread(&AtermThread, (void* (*)(void*))ATERMi_AutoConfigThread, NULL,
|
||||
(u8*)gAtermAllocation + (gAtermScanBufferSize & ~7), gAtermScanBufferSize, priority, 1);
|
||||
gAtermState = 1;
|
||||
{
|
||||
@@ -2499,7 +2546,7 @@ int ATERMi_ApConfigStart(OSPriority priority, u32 scanLimit,
|
||||
}
|
||||
progress.result = gAtermResult;
|
||||
gAtermProgressCallback(&progress);
|
||||
OSResumeThread(&sAtermThread);
|
||||
OSResumeThread(&AtermThread);
|
||||
gAtermThreadStarted = 1;
|
||||
return 1;
|
||||
}
|
||||
@@ -2536,8 +2583,8 @@ int ATERMi_ApConfigEnd(void) {
|
||||
OSMillisecondsToTicks(500),
|
||||
ATERMAlarmWakeQueue);
|
||||
OSReceiveMessage(&joinQueue, &joinMessage, 1);
|
||||
while (OSIsThreadTerminated(&sAtermThread) == 0) {
|
||||
OSJoinThread(&sAtermThread, NULL);
|
||||
while (OSIsThreadTerminated(&AtermThread) == 0) {
|
||||
OSJoinThread(&AtermThread, NULL);
|
||||
}
|
||||
|
||||
if (gAtermAllocation != NULL) {
|
||||
@@ -2584,7 +2631,6 @@ int ATERMi_ApConfigGetVersion(void) {
|
||||
return 0x106;
|
||||
}
|
||||
|
||||
u8* gAtermRequestOptions = gAtermResponseBuffer.data;
|
||||
|
||||
u32 gAtermUseSharedAddress = 1;
|
||||
char gAtermProductName[5] = "WARP";
|
||||
|
||||
@@ -38,6 +38,14 @@ extern "C" RakuStatus sRakuStatus;
|
||||
RakuStatus sRakuStatus;
|
||||
extern "C" OSMessageQueue sRakuMsgQueue;
|
||||
OSMessageQueue sRakuMsgQueue;
|
||||
|
||||
extern "C" void syncRakuProgress__Q33ipl5scene14RakuRakuThreadFv();
|
||||
|
||||
struct RakuThreadGlobals {
|
||||
MEMAllocator allocator[1];
|
||||
RakuStatus status[1];
|
||||
OSMessageQueue queue;
|
||||
};
|
||||
static u32 startTimeHigh = 0;
|
||||
static u32 startTimeLow = 0;
|
||||
static bool active = false;
|
||||
@@ -136,26 +144,27 @@ void RakuRakuThread::destroy() {
|
||||
}
|
||||
|
||||
int RakuRakuThread::start() {
|
||||
RakuThreadGlobals* shared = (RakuThreadGlobals*)&sRakuAllocator;
|
||||
if (active || mHeapBuffer == NULL) {
|
||||
return 0;
|
||||
}
|
||||
BOOL interrupts = OSDisableInterrupts();
|
||||
OSTime time = OSGetTime();
|
||||
startTimeHigh = time >> 32;
|
||||
startTimeLow = time;
|
||||
startTimeLow = (u32)time;
|
||||
startTimeHigh = (u32)(time >> 32);
|
||||
mHeap = MEMCreateExpHeapEx(mHeapBuffer, 0x40000, 2);
|
||||
MEMInitAllocatorForExpHeap(&sRakuAllocator, mHeap, 32);
|
||||
MEMInitAllocatorForExpHeap(&shared->allocator[0], mHeap, 32);
|
||||
mPriority = OSGetThreadPriority(OSGetCurrentThread()) - 1;
|
||||
active = true;
|
||||
mFinished = 0;
|
||||
memset(&sRakuStatus.configuration, 0, sizeof(RakuConfiguration));
|
||||
memset(&sRakuStatus.progress, 0, sizeof(RakuProgress));
|
||||
memset(&shared->status[0].configuration, 0, sizeof(RakuConfiguration));
|
||||
memset(&shared->status[0].progress, 0, sizeof(RakuProgress));
|
||||
SOLibraryConfig socketConfig;
|
||||
socketConfig.alloc = RakuSocketAlloc;
|
||||
socketConfig.free = RakuSocketFree;
|
||||
SOInit(&socketConfig);
|
||||
ATERMi_ApConfigStart(mPriority, 200,
|
||||
progressCallback,
|
||||
(void (*)(RakuProgress*))&syncRakuProgress__Q33ipl5scene14RakuRakuThreadFv,
|
||||
RakuAtermAlloc, RakuAtermFree, 4096);
|
||||
if (!mRunning) {
|
||||
mRunning = 1;
|
||||
@@ -230,41 +239,44 @@ int RakuRakuThread::cancel() {
|
||||
}
|
||||
|
||||
int RakuRakuThread::finish(NCDApConfig* config, int* result) {
|
||||
RakuThreadGlobals* shared = (RakuThreadGlobals*)&sRakuAllocator;
|
||||
if (!active) {
|
||||
if (result != NULL) {
|
||||
*result = -99;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
s32 state = sRakuStatus.progress.state;
|
||||
if ((u32)(state - 6) > 1) {
|
||||
return 0;
|
||||
}
|
||||
if (!mFinished) {
|
||||
if (state == 6) {
|
||||
ATERMi_ApConfigGetResult(&sRakuStatus.configuration);
|
||||
printInfo();
|
||||
s32 state = shared->status[0].progress.state;
|
||||
if ((u32)(state - 6) <= 1) {
|
||||
if (!mFinished) {
|
||||
if (state == 6) {
|
||||
ATERMi_ApConfigGetResult(&shared->status[0].configuration);
|
||||
printInfo();
|
||||
}
|
||||
OSSendMessage(&shared->queue, (OSMessage)1, 0);
|
||||
return 0;
|
||||
}
|
||||
OSSendMessage(&sRakuMsgQueue, (OSMessage)1, 0);
|
||||
SOFinish();
|
||||
active = false;
|
||||
destroy();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
SOFinish();
|
||||
active = false;
|
||||
destroy();
|
||||
if (config != NULL) {
|
||||
RakuConfiguration* settings = &sRakuStatus.configuration;
|
||||
memcpy(config->ssid, settings->ssid, 32);
|
||||
config->ssidLength = strlen(settings->ssid);
|
||||
memcpy(config->ssid, shared->status[0].configuration.ssid, 32);
|
||||
config->ssidLength = strlen(shared->status[0].configuration.ssid);
|
||||
RakuConfiguration* settings = &shared->status[0].configuration;
|
||||
int index;
|
||||
if (settings->security == 1) {
|
||||
config->privacy.mode = 1;
|
||||
config->privacy.wep40.keyId = settings->keyId;
|
||||
for (int index = 0; index < 4; ++index) {
|
||||
for (index = 0; index < 4; ++index) {
|
||||
memcpy(config->privacy.wep40.key[index], settings->wepKeys[index], 5);
|
||||
}
|
||||
} else if (settings->security == 2) {
|
||||
config->privacy.mode = 2;
|
||||
config->privacy.wep104.keyId = settings->keyId;
|
||||
for (int index = 0; index < 4; ++index) {
|
||||
for (index = 0; index < 4; ++index) {
|
||||
memcpy(config->privacy.wep104.key[index], settings->wepKeys[index], 13);
|
||||
}
|
||||
} else if (settings->security == 4) {
|
||||
@@ -278,7 +290,7 @@ int RakuRakuThread::finish(NCDApConfig* config, int* result) {
|
||||
}
|
||||
}
|
||||
if (result != NULL) {
|
||||
*result = sRakuStatus.progress.result;
|
||||
*result = shared->status[0].progress.result;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -438,8 +438,8 @@ namespace ipl {
|
||||
snprintf(browserPath, sizeof(browserPath), basePath, regionCodes[regionIndex],
|
||||
languageCodes[System::getLanguage()], regionPages[regionIndex]);
|
||||
} else if (mInitialArgument == ARG_UNK_6) {
|
||||
const char* pageNames[] = {"Calendar", "Display", "Sound", "Parental_Control",
|
||||
"Internet", "Wiiconnect24", "Update"};
|
||||
const char* pageNames[] = {"Calendar", "Display", "Sound", "Parental_Control", "Internet",
|
||||
"Wiiconnect24", "Update"};
|
||||
int directPage;
|
||||
for (directPage = 0; directPage < 7; directPage++) {
|
||||
if (strstr(mpStringBuffer->netSettingArg, pageNames[directPage]) != NULL) {
|
||||
@@ -462,7 +462,6 @@ namespace ipl {
|
||||
directPagePath = "index03.html";
|
||||
break;
|
||||
case 7:
|
||||
default:
|
||||
directPagePath = "index01.html";
|
||||
break;
|
||||
}
|
||||
@@ -1370,7 +1369,7 @@ namespace ipl {
|
||||
if (!mBrowserCreated) {
|
||||
utility::Graphics::setOrtho(0);
|
||||
nw4r::ut::Rect background(-1000.0f, -1000.0f, 1000.0f, 1000.0f);
|
||||
GXColor color = {0, 0, 0, 0xFF};
|
||||
static const GXColor color = {0, 0, 0, 0xFF};
|
||||
utility::Graphics::drawPolygon(background, color);
|
||||
return;
|
||||
}
|
||||
@@ -1390,7 +1389,7 @@ namespace ipl {
|
||||
|
||||
ext_ead::www::BrowserWindow* browserWindow =
|
||||
static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
|
||||
if ((browserWindow != NULL ? browserWindow->unk_0x2C4[3] : 0) != 0) {
|
||||
if ((browserWindow == NULL ? 0 : browserWindow->unk_0x2C4[3]) != 0) {
|
||||
unk_0x91C[2] = 1;
|
||||
mState = 0;
|
||||
browserWindow = static_cast<ext_ead::www::BrowserWindow*>(browser->mpBrowserWindows[0]);
|
||||
@@ -1398,9 +1397,13 @@ namespace ipl {
|
||||
browserWindow->unk_0x2C4[3] = 0;
|
||||
}
|
||||
www::trasition::ScrollState scrollState = www::trasition::GetScrollState();
|
||||
browserScrollDirection = scrollState == www::trasition::SCROLL_LEFT
|
||||
? 1
|
||||
: (scrollState == www::trasition::SCROLL_RIGHT ? -1 : 0);
|
||||
if (scrollState == www::trasition::SCROLL_LEFT) {
|
||||
browserScrollDirection = 1;
|
||||
} else if (scrollState == www::trasition::SCROLL_RIGHT) {
|
||||
browserScrollDirection = -1;
|
||||
} else {
|
||||
browserScrollDirection = 0;
|
||||
}
|
||||
www::trasition::ResetScrollState();
|
||||
void* changedWideBuffer = browser->GetTextureBuffer(1, NULL);
|
||||
void* changedStandardBuffer = browser->GetTextureBuffer(0, NULL);
|
||||
@@ -1408,16 +1411,16 @@ namespace ipl {
|
||||
ext_ead::www::Heap::reportLeaHeap();
|
||||
}
|
||||
|
||||
if (!mpSecondAnimation->isPlaying() && !mpFirstAnimation->isPlaying()) {
|
||||
if (!(mpSecondAnimation->isPlaying() || mpFirstAnimation->isPlaying())) {
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(false);
|
||||
} else {
|
||||
mpChangeLayout->FindPaneByName("N_Tra0")->SetVisible(true);
|
||||
}
|
||||
|
||||
WWWRect* standardRect;
|
||||
WWWRect* wideRect;
|
||||
void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
|
||||
WWWRect* standardRect;
|
||||
void* standardBuffer = browser->GetTextureBuffer(0, &standardRect);
|
||||
void* wideBuffer = browser->GetTextureBuffer(1, &wideRect);
|
||||
nw4r::ut::Rect projection4x3;
|
||||
System::getProjectionRect4x3(&projection4x3);
|
||||
int screenWidth = abs(static_cast<int>(projection4x3.GetWidth()));
|
||||
@@ -1443,14 +1446,15 @@ namespace ipl {
|
||||
System::getProjectionRect16x9(&projection16x9);
|
||||
int wideWidth = abs(static_cast<int>(projection16x9.GetWidth()));
|
||||
int wideHeight = abs(static_cast<int>(projection16x9.GetHeight()));
|
||||
f32 wideLeft = -wideWidth / 2;
|
||||
f32 wideTop = wideHeight / 2;
|
||||
f32 wideRight = wideWidth / 2;
|
||||
nw4r::ut::Rect leftSide(wideLeft, wideTop,
|
||||
wideLeft + sideDescriptor->textureHeader->width,
|
||||
wideTop - sideDescriptor->textureHeader->height);
|
||||
nw4r::ut::Rect rightSide(wideRight - sideDescriptor->textureHeader->width,
|
||||
wideTop, wideRight, wideTop - sideDescriptor->textureHeader->height);
|
||||
f32 negHalfWideWidth = -wideWidth / 2;
|
||||
f32 posHalfWideWidth = wideWidth / 2;
|
||||
f32 posHalfWideHeight = wideHeight / 2;
|
||||
nw4r::ut::Rect leftSide(negHalfWideWidth, posHalfWideHeight,
|
||||
negHalfWideWidth + sideDescriptor->textureHeader->width,
|
||||
posHalfWideHeight - sideDescriptor->textureHeader->height);
|
||||
nw4r::ut::Rect rightSide(posHalfWideWidth - sideDescriptor->textureHeader->width,
|
||||
posHalfWideHeight, posHalfWideWidth,
|
||||
posHalfWideHeight - sideDescriptor->textureHeader->height);
|
||||
|
||||
if (browserScrollDirection != 0) {
|
||||
nw4r::lyt::Material* wideMaterial =
|
||||
@@ -1510,7 +1514,8 @@ namespace ipl {
|
||||
}
|
||||
|
||||
if (mpWiiSettingFlag->smthMsgData >= 2 && mpWiiSettingFlag->smthMsgData <= 7) {
|
||||
GXRenderModeObj renderMode = *System::getRenderModeObj();
|
||||
GXRenderModeObj renderMode;
|
||||
renderMode = *System::getRenderModeObj();
|
||||
u32 left;
|
||||
u32 top;
|
||||
u32 width;
|
||||
@@ -1606,10 +1611,10 @@ namespace ipl {
|
||||
OSReport("initKeyboard formId:%d\n", mpWiiSettingData->data[0x11]);
|
||||
memset(unk_0x938, 0, sizeof(unk_0x938));
|
||||
|
||||
int invalidInput = 0;
|
||||
int stringLimit;
|
||||
keyboard::Manager::KeyboardType keyboardType = keyboard::Manager::LETTER;
|
||||
int rowLimit = 0;
|
||||
int stringLimit = 0;
|
||||
int rowLimit;
|
||||
int invalidInput = 0;
|
||||
int productArea = static_cast<s8>(SCGetProductArea());
|
||||
|
||||
switch (mpWiiSettingData->data[0x11]) {
|
||||
@@ -1711,14 +1716,16 @@ namespace ipl {
|
||||
}
|
||||
|
||||
if (productArea == 11) {
|
||||
System::getKeyboard()->memoFrm()->setZiDictionary(System::getKeyboard()->getZiOemDic(), System::getKeyboard()->getZiSystemDic());
|
||||
void* sysDic = System::getKeyboard()->getZiSystemDic();
|
||||
void* oemDic = System::getKeyboard()->getZiOemDic();
|
||||
System::getKeyboard()->memoFrm()->setZiDictionary(oemDic, sysDic);
|
||||
}
|
||||
|
||||
keyboard::Manager::KeyboardSetting setting;
|
||||
setting.type = keyboardType;
|
||||
setting.rowLimit = rowLimit;
|
||||
setting.wcString = reinterpret_cast<const wchar_t*>(unk_0x938);
|
||||
setting.stringLimit = stringLimit;
|
||||
setting.rowLimit = rowLimit;
|
||||
setting.type = keyboardType;
|
||||
System::getKeyboard()->start(0, setting);
|
||||
|
||||
if (invalidInput != 0) {
|
||||
@@ -1738,7 +1745,6 @@ namespace ipl {
|
||||
if (mKeyboardState.pressOK) {
|
||||
onTextInputOK();
|
||||
u8 formId = mpWiiSettingData->data[0x11];
|
||||
formText = NULL;
|
||||
switch (formId) {
|
||||
case 1:
|
||||
formText = mpStringBuffer->nickname;
|
||||
@@ -1809,7 +1815,8 @@ namespace ipl {
|
||||
memcpy(mpStringBuffer->asterisks, mpStringBuffer->securityKey, sizeof(mpStringBuffer->securityKey));
|
||||
mpStringBuffer->asterisks[0x41] = 0;
|
||||
while (mpStringBuffer->asterisks[index] != 0) {
|
||||
mpStringBuffer->asterisks[index++] = '*';
|
||||
mpStringBuffer->asterisks[index] = '*';
|
||||
index++;
|
||||
}
|
||||
if (index > 0x20) {
|
||||
mpStringBuffer->asterisks[0x20] = '\n';
|
||||
@@ -1821,7 +1828,6 @@ namespace ipl {
|
||||
}
|
||||
} else {
|
||||
u8 formId = mpWiiSettingData->data[0x11];
|
||||
formText = NULL;
|
||||
switch (formId) {
|
||||
case 1:
|
||||
formText = mpStringBuffer->nickname;
|
||||
@@ -2716,34 +2722,34 @@ namespace ipl {
|
||||
case 6: {
|
||||
int animationIndex = unk_0x918;
|
||||
unk_0xB9C = 1;
|
||||
if (!mpMainLayout->getAnim(animationIndex)->isPlaying()) {
|
||||
unk_0x78 = 5;
|
||||
setAPDraw();
|
||||
if (unk_0x91C[0] != 0) {
|
||||
mpMainLayout->getAnim(0xa)->initAnmFrame();
|
||||
} else {
|
||||
mpMainLayout->getAnim(0xb)->initAnmFrame();
|
||||
}
|
||||
if (unk_0x914 == 0) {
|
||||
mpMainLayout->FindPaneByName("N_AP1")->SetVisible(false);
|
||||
} else if (unk_0x914 == 1) {
|
||||
mpMainLayout->FindPaneByName("N_AP1")->SetVisible(true);
|
||||
}
|
||||
if (mAPScanList.count == unk_0x914 + 4) {
|
||||
mpMainLayout->FindPaneByName("N_AP6")->SetVisible(false);
|
||||
} else if (mAPScanList.count == unk_0x914 + 5) {
|
||||
mpMainLayout->FindPaneByName("N_AP6")->SetVisible(true);
|
||||
}
|
||||
mpMainLayout->FindPaneByName("N_AP0")->SetVisible(true);
|
||||
mpMainLayout->FindPaneByName("N_AP7")->SetVisible(true);
|
||||
if (!(mpMainLayout->getAnim(animationIndex)->isPlaying() & 0x07FFFFFF)) {
|
||||
unk_0x78 = 5;
|
||||
setAPDraw();
|
||||
if (unk_0x91C[0] != 0) {
|
||||
mpMainLayout->getAnim(0xa)->initAnmFrame();
|
||||
} else {
|
||||
mpMainLayout->getAnim(0xb)->initAnmFrame();
|
||||
}
|
||||
if (unk_0x914 == 0) {
|
||||
mpMainLayout->FindPaneByName("N_AP1")->SetVisible(false);
|
||||
} else if (unk_0x914 == 1) {
|
||||
mpMainLayout->FindPaneByName("N_AP1")->SetVisible(true);
|
||||
}
|
||||
if (mAPScanList.count == unk_0x914 + 4) {
|
||||
mpMainLayout->FindPaneByName("N_AP6")->SetVisible(false);
|
||||
} else if (mAPScanList.count == unk_0x914 + 5) {
|
||||
mpMainLayout->FindPaneByName("N_AP6")->SetVisible(true);
|
||||
}
|
||||
mpMainLayout->FindPaneByName("N_AP0")->SetVisible(true);
|
||||
mpMainLayout->FindPaneByName("N_AP7")->SetVisible(true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
unk_0xB9C = 1;
|
||||
if (!mpMainLayout->getAnim(unk_0x918)->isPlaying()) {
|
||||
updateScroll();
|
||||
unk_0x78 = 6;
|
||||
if (!(mpMainLayout->getAnim(unk_0x918)->isPlaying() & 0x07FFFFFF)) {
|
||||
updateScroll();
|
||||
unk_0x78 = 6;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
@@ -2751,13 +2757,13 @@ namespace ipl {
|
||||
unk_0x91C[2] = 0;
|
||||
break;
|
||||
case 9:
|
||||
if (!mpMainLayout->getAnim(unk_0x918)->isPlaying()) {
|
||||
resetFuncMsgQ();
|
||||
unk_0x78 = 1;
|
||||
unk_0x918 = -1;
|
||||
mpPaneManager->init();
|
||||
mpMainLayout->getAnim(0x14)->initFrame();
|
||||
mpMainLayout->calc();
|
||||
if (!(mpMainLayout->getAnim(unk_0x918)->isPlaying() & 0x07FFFFFF)) {
|
||||
resetFuncMsgQ();
|
||||
unk_0x78 = 1;
|
||||
unk_0x918 = -1;
|
||||
mpPaneManager->init();
|
||||
mpMainLayout->getAnim(0x14)->initFrame();
|
||||
mpMainLayout->calc();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -3577,15 +3583,17 @@ namespace ipl {
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (HasUSBAPResult(&unk_0x91C[1])) {
|
||||
www::wiisetting::setFuncResult(unk_0x91C[1]);
|
||||
case 2: {
|
||||
volatile u8* result = &unk_0x91C[1];
|
||||
if (*result != 0) {
|
||||
www::wiisetting::setFuncResult(*result);
|
||||
unk_0x84 = 1;
|
||||
unk_0x91C[1] = 0;
|
||||
*result = 0;
|
||||
resetFuncMsgQ();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Setting::cancelUSBAP() {
|
||||
|
||||
Reference in New Issue
Block a user