static void controller_read_pak_command(struct game_controller* cont, uint8_t* cmd) { enum pak_type pak; int connected = controller_input_is_connected(cont->cin, &pak); if (!connected) { cmd[1] |= 0x80; return; } switch (pak) { case PAK_NONE: memset(&cmd[5], 0, 0x20); break; case PAK_MEM: mempak_read_command(&cont->mempak, cmd); break; case PAK_RUMBLE: rumblepak_read_command(&cont->rumblepak, cmd); break; case PAK_TRANSFER: /* TODO */ break; default: DebugMessage(M64MSG_WARNING, "Unknown plugged pak %d", (int)pak); } cmd[0x25] = pak_data_crc(&cmd[5]); }
static void controller_read_pak_command(struct game_controller* cont, uint8_t* cmd) { enum pak_type pak; uint16_t address; uint8_t* data; uint8_t* crc; int connected = controller_input_is_connected(cont->cin, &pak); if (!connected) { cmd[1] |= 0x80; return; } address = (cmd[3] << 8) | (cmd[4] & 0xe0); data = &cmd[5]; crc = &cmd[5 + PAK_CHUNK_SIZE]; switch (pak) { case PAK_NONE: memset(data, 0, PAK_CHUNK_SIZE); break; case PAK_MEM: mempak_read_command(&cont->mempak, address, data, PAK_CHUNK_SIZE); break; case PAK_RUMBLE: rumblepak_read_command(&cont->rumblepak, address, data, PAK_CHUNK_SIZE); break; case PAK_TRANSFER: /* TODO */ break; default: DebugMessage(M64MSG_WARNING, "Unknown plugged pak %d", (int)pak); } *crc = pak_data_crc(data); }
static void controller_read_pak_command(struct game_controller* cont, uint8_t* cmd) { enum pak_type pak; uint16_t address; uint8_t *data = NULL; int connected = game_controller_is_connected(cont, &pak); if (!connected) { cmd[1] |= 0x80; return; } address = (cmd[3] << 8) | (cmd[4] & 0xe0); data = &cmd[5]; switch (pak) { case PAK_NONE: memset(data, 0, 0x20); break; case PAK_MEM: mempak_read_command(&cont->mempak, address, data); break; case PAK_RUMBLE: rumblepak_read_command(&cont->rumblepak, address, data); break; case PAK_TRANSFER: transferpak_read_command(&cont->transferpak, address, data); break; default: DebugMessage(M64MSG_WARNING, "Unknown plugged pak %d", (int)pak); } cmd[0x25] = pak_data_crc(data); }