cdvdgigaherz: s/itob/dec_to_bcd/

There's no need to have 2 ways to convert a u8 to a binary coded
decimal. Remove the macro version.
This commit is contained in:
Jonathan Li 2016-10-17 20:17:47 +01:00
parent 852ed21e88
commit 86a6f5d67c
1 changed files with 9 additions and 11 deletions

View File

@ -489,22 +489,20 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
tocBuff[0] = 0x41;
tocBuff[1] = 0x00;
#define itob(n) ((((n) / 10) << 4) + ((n) % 10))
//Number of FirstTrack
tocBuff[2] = 0xA0;
tocBuff[7] = itob(diskInfo.strack);
tocBuff[7] = dec_to_bcd(diskInfo.strack);
//Number of LastTrack
tocBuff[12] = 0xA1;
tocBuff[17] = itob(diskInfo.etrack);
tocBuff[17] = dec_to_bcd(diskInfo.etrack);
//DiskLength
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[22] = 0xA2;
tocBuff[27] = itob(min);
tocBuff[28] = itob(sec);
tocBuff[29] = itob(frm);
tocBuff[27] = dec_to_bcd(min);
tocBuff[28] = dec_to_bcd(sec);
tocBuff[29] = dec_to_bcd(frm);
fprintf(stderr, "Track 0: %u mins %u secs %u frames\n", min, sec, frm);
@ -512,10 +510,10 @@ s32 CALLBACK CDVDgetTOC(u8 *tocBuff)
err = CDVDgetTD(i, &trackInfo);
lba_to_msf(trackInfo.lsn, &min, &sec, &frm);
tocBuff[i * 10 + 30] = trackInfo.type;
tocBuff[i * 10 + 32] = err == -1 ? 0 : itob(i); //number
tocBuff[i * 10 + 37] = itob(min);
tocBuff[i * 10 + 38] = itob(sec);
tocBuff[i * 10 + 39] = itob(frm);
tocBuff[i * 10 + 32] = err == -1 ? 0 : dec_to_bcd(i); //number
tocBuff[i * 10 + 37] = dec_to_bcd(min);
tocBuff[i * 10 + 38] = dec_to_bcd(sec);
tocBuff[i * 10 + 39] = dec_to_bcd(frm);
fprintf(stderr, "Track %u: %u mins %u secs %u frames\n", i, min, sec, frm);
}
} else