mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
Small clean-up
This commit is contained in:
@@ -6,28 +6,28 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
|
||||
u8 temp_t9;
|
||||
u8 new_var2;
|
||||
union {
|
||||
u8 sp38[40];
|
||||
u32 sp38_32[10];
|
||||
u8 data[40];
|
||||
u32 data32[10];
|
||||
} u;
|
||||
s32 i;
|
||||
|
||||
switch (hd->mode) {
|
||||
case 1:
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.sp38[39]);
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.data[39]);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
if (u.sp38[39] & 1) {
|
||||
if (u.data[39] & 1) {
|
||||
return CONT_ERR_NOT_READY;
|
||||
}
|
||||
|
||||
errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, u.sp38);
|
||||
errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, u.data);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
temp_t9 = u.sp38[0] & 7;
|
||||
temp_t9 = u.data[0] & 7;
|
||||
hd->status = temp_t9;
|
||||
D_8009CF60 = temp_t9;
|
||||
if ((temp_t9 != 0) && (temp_t9 != 7)) {
|
||||
@@ -36,17 +36,17 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
|
||||
case 2:
|
||||
hd->mode = 2;
|
||||
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.sp38[39]);
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.data[39]);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
if (u.sp38[39] & 2) {
|
||||
if (u.data[39] & 2) {
|
||||
return CONT_ERR_VOICE_NO_RESPONSE;
|
||||
}
|
||||
|
||||
u.sp38_32[0] = 0x600;
|
||||
errorCode = __osVoiceContWrite4(hd->mq, hd->port, 0, u.sp38);
|
||||
u.data32[0] = 0x600;
|
||||
errorCode = __osVoiceContWrite4(hd->mq, hd->port, 0, u.data);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
@@ -54,29 +54,29 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
|
||||
case 3:
|
||||
hd->mode = 3;
|
||||
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.sp38[39]);
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.data[39]);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
if (u.sp38[39] & 1) {
|
||||
if (u.data[39] & 1) {
|
||||
return CONT_ERR_VOICE_NO_RESPONSE;
|
||||
}
|
||||
|
||||
errorCode = __osVoiceContRead36(hd->mq, hd->port, 0, u.sp38);
|
||||
errorCode = __osVoiceContRead36(hd->mq, hd->port, 0, u.data);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
result->warning = u.sp38[4] + (u.sp38[5] << 8);
|
||||
result->answer_num = u.sp38[6];
|
||||
result->voice_level = u.sp38[8] + (u.sp38[9] << 8);
|
||||
result->voice_sn = u.sp38[10] + (u.sp38[11] << 8);
|
||||
result->voice_time = u.sp38[12] + (u.sp38[13] << 8);
|
||||
result->warning = u.data[4] + (u.data[5] << 8);
|
||||
result->answer_num = u.data[6];
|
||||
result->voice_level = u.data[8] + (u.data[9] << 8);
|
||||
result->voice_sn = u.data[10] + (u.data[11] << 8);
|
||||
result->voice_time = u.data[12] + (u.data[13] << 8);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
result->answer[i] = u.sp38[14 + 4 * (i ^ 0)] + (u.sp38[15 + 4 * (i ^ 0)] << 8);
|
||||
result->distance[i] = u.sp38[16 + 4 * (i ^ 0)] + (u.sp38[17 + 4 * (i ^ 0)] << 8);
|
||||
result->answer[i] = u.data[14 + 4 * (i ^ 0)] + (u.data[15 + 4 * (i ^ 0)] << 8);
|
||||
result->distance[i] = u.data[16 + 4 * (i ^ 0)] + (u.data[17 + 4 * (i ^ 0)] << 8);
|
||||
}
|
||||
|
||||
if (result->answer[0] == 0x7FFF) {
|
||||
@@ -84,7 +84,7 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
|
||||
}
|
||||
|
||||
new_var2 = D_8009CF60;
|
||||
temp_t9 = u.sp38[34] ^ 0;
|
||||
temp_t9 = u.data[34] ^ 0;
|
||||
hd->status = temp_t9 & 7;
|
||||
if ((new_var2 == 0) || (hd->status == 0)) {
|
||||
break;
|
||||
@@ -92,22 +92,22 @@ s32 osVoiceGetReadData(OSVoiceHandle* hd, OSVoiceData* result) {
|
||||
case 4:
|
||||
hd->mode = 4;
|
||||
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.sp38[39]);
|
||||
errorCode = __osVoiceGetStatus(hd->mq, hd->port, &u.data[39]);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
if (u.sp38[39] & 1) {
|
||||
if (u.data[39] & 1) {
|
||||
return CONT_ERR_VOICE_NO_RESPONSE;
|
||||
}
|
||||
|
||||
errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, u.sp38);
|
||||
errorCode = __osVoiceContRead2(hd->mq, hd->port, 0, u.data);
|
||||
if (errorCode != 0) {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
hd->status = u.sp38[0] & 7;
|
||||
if (u.sp38[0] & 7) {
|
||||
hd->status = u.data[0] & 7;
|
||||
if (u.data[0] & 7) {
|
||||
return CONT_ERR_VOICE_NO_RESPONSE;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user