Skip to content

Commit 04f178a

Browse files
committed
Deobfuscate comparisons
1 parent 725a9f4 commit 04f178a

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

libogc/dvd.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ static u8 convert(u32 errorcode)
401401
{
402402
u8 err,err_num;
403403

404-
if((errorcode-0x01230000)==0x4567) return 255;
405-
else if((errorcode-0x01230000)==0x4568) return 254;
404+
if(errorcode==0x01234567) return 255;
405+
else if(errorcode==0x01234568) return 254;
406406

407407
err = _SHIFTR(errorcode,24,8);
408408
err_num = err2num((errorcode&0x00ffffff));
@@ -514,28 +514,28 @@ static u32 __dvd_categorizeerror(u32 errorcode)
514514
#ifdef _DVD_DEBUG
515515
printf("__dvd_categorizeerror(%08x)\n",errorcode);
516516
#endif
517-
if((errorcode-0x20000)==0x0400) {
517+
if(errorcode==DVD_ERROR_MOTOR_STOPPED) {
518518
__dvd_lasterror = errorcode;
519519
return 1;
520520
}
521521

522-
if(DVD_ERROR(errorcode)==DVD_ERROR_MEDIUM_CHANGED
523-
|| DVD_ERROR(errorcode)==DVD_ERROR_MEDIUM_NOT_PRESENT
524-
|| DVD_ERROR(errorcode)==DVD_ERROR_MEDIUM_CHANGE_REQ
525-
|| (DVD_ERROR(errorcode)-0x40000)==0x3100) return 0;
522+
errorcode = DVD_ERROR(errorcode);
523+
if(errorcode==DVD_ERROR_MEDIUM_CHANGED
524+
|| errorcode==DVD_ERROR_MEDIUM_NOT_PRESENT
525+
|| errorcode==DVD_ERROR_MEDIUM_CHANGE_REQ) return 0;
526526

527527
__dvd_internalretries++;
528528
if(__dvd_internalretries==2) {
529-
if(__dvd_lasterror==DVD_ERROR(errorcode)) {
530-
__dvd_lasterror = DVD_ERROR(errorcode);
529+
if(__dvd_lasterror==errorcode) {
530+
__dvd_lasterror = errorcode;
531531
return 1;
532532
}
533-
__dvd_lasterror = DVD_ERROR(errorcode);
533+
__dvd_lasterror = errorcode;
534534
return 2;
535535
}
536536

537-
__dvd_lasterror = DVD_ERROR(errorcode);
538-
if(DVD_ERROR(errorcode)!=DVD_ERROR_UNRECOVERABLE_READ) {
537+
__dvd_lasterror = errorcode;
538+
if(errorcode!=DVD_ERROR_UNRECOVERABLE_READ) {
539539
if(__dvd_executing->cmd!=0x0005) return 3;
540540
}
541541
return 2;

libogc/gx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static const u32 _gxtexregionaddrtable[48] =
121121
};
122122

123123
static struct __gx_regdef __gxregs __attribute__((section(".sbss")));
124-
static struct __gx_regdef* __gx = &__gxregs;
124+
static struct __gx_regdef *__gx = &__gxregs;
125125
static struct __gx_regdef _gx_saved_data;
126126

127127
static s32 __gx_onreset(s32 final);

libogc/pad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ static void __pad_typeandstatuscallback(s32 chan,u32 type)
384384
return;
385385
}
386386

387-
__pad_type[__pad_resettingchan] = (type&~0xff);
388-
if(((type&SI_TYPE_MASK)-SI_TYPE_GC)
387+
__pad_type[__pad_resettingchan] = type&~0xff;
388+
if((type&SI_TYPE_MASK)!=SI_TYPE_GC
389389
|| !(type&SI_GC_STANDARD)) {
390390
__pad_doreset();
391391
return;

libogc/si.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static void __si_gettypecallback(s32 chan,u32 type)
282282
sipad_en = __PADFixBits&SI_CHAN_BIT(chan);
283283
__PADFixBits &= ~SI_CHAN_BIT(chan);
284284

285-
if(type&0x0f || ((si_type[chan]&SI_TYPE_MASK)-SI_TYPE_GC)
285+
if(type&0x0f || (si_type[chan]&SI_TYPE_MASK)!=SI_TYPE_GC
286286
|| !(si_type[chan]&SI_GC_WIRELESS) || si_type[chan]&SI_WIRELESS_IR) {
287287
SYS_SetWirelessID(chan,0);
288288
__si_calltypeandstatuscallback(chan,si_type[chan]);

0 commit comments

Comments
 (0)