mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-05-26 07:18:47 -04:00
8b4808da8a
* TRK full match * remove trk asm * ar done * cleanup some dolphin headers * more dolphin cleanup * cleanup / GD fully matched * almost all of GX fully matched * GX / Mtx full matched * most of OS done * pad done * most of VI * remove asm * forgot couple vec funcs * couple JUtility matches
63 lines
1.5 KiB
C
63 lines
1.5 KiB
C
#include "dolphin/dvd/dvderror.h"
|
|
#include "dolphin/os/OSRtc.h"
|
|
|
|
static u8 ErrorCode2Num(u32 errorCode);
|
|
void __DVDStoreErrorCode();
|
|
|
|
/* 803D16A8-803D16F0 02E7C8 0048+00 1/1 0/0 0/0 .data ErrorTable */
|
|
static u32 ErrorTable[] = {
|
|
0, 0x00023A00, 0x00062800, 0x00030200, 0x00031100, 0x00052000,
|
|
0x00052001, 0x00052100, 0x00052400, 0x00052401, 0x00052402, 0x000B5A01,
|
|
0x00056300, 0x00020401, 0x00020400, 0x00040800, 0x00100007, 0,
|
|
};
|
|
|
|
/* 8034BA6C-8034BB88 3463AC 011C+00 1/1 0/0 0/0 .text ErrorCode2Num */
|
|
static u8 ErrorCode2Num(u32 errorCode) {
|
|
u32 i;
|
|
|
|
for (i = 0; i < sizeof(ErrorTable) / sizeof(ErrorTable[0]); i++) {
|
|
if (ErrorTable[i] == errorCode) {
|
|
return (u8)i;
|
|
}
|
|
}
|
|
|
|
if ((errorCode >= 0x00100000) && (errorCode <= 0x00100008)) {
|
|
return 17;
|
|
}
|
|
|
|
return 29;
|
|
}
|
|
|
|
/* 8034BB88-8034BC04 3464C8 007C+00 0/0 12/12 0/0 .text __DVDStoreErrorCode */
|
|
static u8 Convert(u32 error) {
|
|
u32 statusCode;
|
|
u32 errorCode;
|
|
u8 errorNum;
|
|
|
|
if (error == 0x01234567)
|
|
return 255;
|
|
|
|
if (error == 0x01234568)
|
|
return 254;
|
|
|
|
statusCode = (error & 0xff000000) >> 24;
|
|
errorCode = error & 0x00ffffff;
|
|
|
|
errorNum = ErrorCode2Num(errorCode);
|
|
if (statusCode >= 6)
|
|
statusCode = 6;
|
|
|
|
return (u8)(statusCode * 30 + errorNum);
|
|
}
|
|
|
|
void __DVDStoreErrorCode(u32 error) {
|
|
OSSramEx* sram;
|
|
u8 num;
|
|
|
|
num = Convert(error);
|
|
|
|
sram = __OSLockSramEx();
|
|
sram->dvdErrorCode = num;
|
|
__OSUnlockSramEx(TRUE);
|
|
}
|