Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit a94488c

Browse files
committed
ps2_memory_card: remove unused ecc, rename table
1 parent 5fdc1e0 commit a94488c

File tree

2 files changed

+2
-29
lines changed

2 files changed

+2
-29
lines changed

src/ps2/ps2_memory_card.c

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static inline void __time_critical_func(mc_respond_slow)(uint8_t ch) {
178178
pio_sm_put_blocking(pio0, dat_writer_slow.sm, ch);
179179
}
180180

181-
static uint8_t Table[] = {
181+
static uint8_t EccTable[] = {
182182
0x00, 0x87, 0x96, 0x11, 0xa5, 0x22, 0x33, 0xb4,0xb4, 0x33, 0x22, 0xa5, 0x11, 0x96, 0x87, 0x00,
183183
0xc3, 0x44, 0x55, 0xd2, 0x66, 0xe1, 0xf0, 0x77,0x77, 0xf0, 0xe1, 0x66, 0xd2, 0x55, 0x44, 0xc3,
184184
0xd2, 0x55, 0x44, 0xc3, 0x77, 0xf0, 0xe1, 0x66,0x66, 0xe1, 0xf0, 0x77, 0xc3, 0x44, 0x55, 0xd2,
@@ -197,33 +197,6 @@ static uint8_t Table[] = {
197197
0x00, 0x87, 0x96, 0x11, 0xa5, 0x22, 0x33, 0xb4,0xb4, 0x33, 0x22, 0xa5, 0x11, 0x96, 0x87, 0x00
198198
};
199199

200-
void calcECC(uint8_t *ecc, const uint8_t *data)
201-
{
202-
int i, c;
203-
204-
ecc[0] = ecc[1] = ecc[2] = 0;
205-
206-
for (i = 0 ; i < 0x80 ; i ++) {
207-
c = Table[data[i]];
208-
209-
ecc[0] ^= c;
210-
if (c & 0x80) {
211-
ecc[1] ^= ~i;
212-
ecc[2] ^= i;
213-
}
214-
}
215-
ecc[0] = ~ecc[0];
216-
ecc[0] &= 0x77;
217-
218-
ecc[1] = ~ecc[1];
219-
ecc[1] &= 0x7f;
220-
221-
ecc[2] = ~ecc[2];
222-
ecc[2] &= 0x7f;
223-
224-
return;
225-
}
226-
227200
// keysource and key are self generated values
228201
uint8_t keysource[] = { 0xf5, 0x80, 0x95, 0x3c, 0x4c, 0x84, 0xa9, 0xc0 };
229202
uint8_t dex_key[16] = { 0x17, 0x39, 0xd3, 0xbc, 0xd0, 0x2c, 0x18, 0x07, 0x4b, 0x17, 0xf0, 0xea, 0xc4, 0x66, 0x30, 0xf9 };

src/ps2/ps2_memory_card.in.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ if (ch == 0x11) {
182182
send(b);
183183

184184
if (readptr <= 512) {
185-
uint8_t c = Table[b];
185+
uint8_t c = EccTable[b];
186186
eccptr[0] ^= c;
187187
if (c & 0x80) {
188188
eccptr[1] ^= ~(readptr & 0x7F);

0 commit comments

Comments
 (0)