mirror of
https://github.com/n64dev/cen64.git
synced 2024-06-15 18:48:02 -04:00
si: Fix Memory Pak initialization
Thanks to bryc for researching this issue and reviewing this fix
This commit is contained in:
parent
6f9f5784bf
commit
a54cbe042f
18
si/pak.c
18
si/pak.c
|
@ -109,9 +109,7 @@ uint8_t controller_pak_crc(uint8_t *data) {
|
|||
}
|
||||
|
||||
void controller_pak_format(uint8_t *ptr) {
|
||||
off_t pos;
|
||||
|
||||
static uint8_t init[] = {
|
||||
static uint8_t init_id_area[] = {
|
||||
0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
|
||||
0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
|
@ -128,12 +126,16 @@ void controller_pak_format(uint8_t *ptr) {
|
|||
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0x66, 0x25, 0x99, 0xCD,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x71, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03,
|
||||
};
|
||||
|
||||
memcpy(ptr, init, sizeof(init));
|
||||
for (pos = sizeof(init); pos < MEMPAK_SIZE; pos += 2) {
|
||||
ptr[pos+0] = 0x00;
|
||||
ptr[pos+1] = 0x03;
|
||||
memset(ptr, 0, MEMPAK_SIZE);
|
||||
memcpy(ptr, init_id_area, sizeof(init_id_area));
|
||||
|
||||
ptr[(MEMPAK_PAGE_SIZE * 1) + 1] = 0x71;
|
||||
ptr[(MEMPAK_PAGE_SIZE * 2) + 1] = 0x71;
|
||||
|
||||
for (off_t i = 5; i < MEMPAK_NUM_PAGES; i++) {
|
||||
ptr[(MEMPAK_PAGE_SIZE * 1) + (i * 2) + 1] = 0x03;
|
||||
ptr[(MEMPAK_PAGE_SIZE * 2) + (i * 2) + 1] = 0x03;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue