diff --git a/Source/Core/Core/Boot/Boot.cpp b/Source/Core/Core/Boot/Boot.cpp index aedd11c417..2b695073e5 100644 --- a/Source/Core/Core/Boot/Boot.cpp +++ b/Source/Core/Core/Boot/Boot.cpp @@ -232,6 +232,7 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) constexpr u32 JAP_v1_0 = 0x6DAC1F2A; // https://bugs.dolphin-emu.org/issues/8936 constexpr u32 JAP_v1_1 = 0xD235E3F9; + constexpr u32 JAP_v1_2 = 0x8BDABBD4; // Redump constexpr u32 PAL_v1_0 = 0x4F319F43; // https://forums.dolphin-emu.org/Thread-ipl-with-unknown-hash-dd8cab7c-problem-caused-by-my-pal-gamecube-bios?pid=435463#pid435463 @@ -258,6 +259,7 @@ bool CBoot::Load_BS2(const std::string& boot_rom_filename) break; case JAP_v1_0: case JAP_v1_1: + case JAP_v1_2: ipl_region = DiscIO::Region::NTSC_J; break; case PAL_v1_0: diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp index ced544be98..8eaf746154 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/UCodes.cpp @@ -260,7 +260,7 @@ std::unique_ptr UCodeFactory(u32 crc, DSPHLE* dsphle, bool wii) case 0x6ca33a6d: // Zelda TP GC - US case 0xd643001f: // Super Mario Galaxy - US case 0x6ba3b3ea: // GC IPL - PAL - case 0x24b22038: // GC IPL - US + case 0x24b22038: // GC IPL - NTSC case 0x2fcdf1ec: // Zelda FSA - US case 0x4be6a5cb: // Pikmin 1 GC - US case 0x267fd05a: // Pikmin 1 GC - PAL diff --git a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp index ae1cc5496a..0ad5d6a318 100644 --- a/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp +++ b/Source/Core/Core/HW/DSPHLE/UCodes/Zelda.cpp @@ -78,7 +78,7 @@ static const std::map UCODE_FLAGS = { {0x24B22038, LIGHT_PROTOCOL | FOUR_MIXING_DESTS | TINY_VPB | VOLUME_EXPLICIT_STEP | NO_CMD_0D | WEIRD_CMD_0C}, // GameCube IPL/BIOS, PAL. - {0x6BA3B3EA, LIGHT_PROTOCOL | FOUR_MIXING_DESTS | NO_CMD_0D | WEIRD_CMD_0C}, + {0x6BA3B3EA, LIGHT_PROTOCOL | FOUR_MIXING_DESTS | NO_CMD_0D}, // Pikmin 1 GC NTSC. // Animal Crossing. {0x4BE6A5CB, LIGHT_PROTOCOL | NO_CMD_0D | SUPPORTS_GBA_CRYPTO}, @@ -427,8 +427,8 @@ void ZeldaUCode::RunPendingCommands() switch (command) { case 0x00: - case 0x0A: - case 0x0B: + case 0x0A: // not a NOP in the NTSC IPL ucode but seems unused + case 0x0B: // not a NOP in both IPL ucodes but seems unused case 0x0F: // NOP commands. Log anyway in case we encounter a new version // where these are not NOPs anymore. @@ -483,10 +483,15 @@ void ZeldaUCode::RunPendingCommands() const_patterns[i] = Common::swap16(data_ptr[0x100 + i]); m_renderer.SetConstPatterns(std::move(const_patterns)); - std::array sine_table; - for (size_t i = 0; i < 0x80; ++i) - sine_table[i] = Common::swap16(data_ptr[0x200 + i]); - m_renderer.SetSineTable(std::move(sine_table)); + // The sine table is only used for Dolby mixing + // which the light protocol doesn't support. + if ((m_flags & LIGHT_PROTOCOL) == 0) + { + std::array sine_table; + for (size_t i = 0; i < 0x80; ++i) + sine_table[i] = Common::swap16(data_ptr[0x200 + i]); + m_renderer.SetSineTable(std::move(sine_table)); + } u16* afc_coeffs_ptr = (u16*)HLEMemory_Get_Pointer(Read32()); std::array afc_coeffs; @@ -532,7 +537,7 @@ void ZeldaUCode::RunPendingCommands() return; // Command 0C: used for multiple purpose depending on the UCode version: - // * IPL NTSC/PAL, Luigi's Mansion: TODO (unknown as of now). + // * IPL NTSC, Luigi's Mansion: TODO (unknown as of now). // * Pikmin/AC: GBA crypto. // * SMS and onwards: NOP. case 0x0C: @@ -590,6 +595,7 @@ void ZeldaUCode::SendCommandAck(CommandAck ack_type, u16 sync_value) { // The light protocol uses the address of the command handler in the // DSP code instead of the command id... go figure. + // FIXME: LLE returns a different value sync_value = 2 * ((sync_value >> 8) & 0x7F) + 0x62; m_mail_handler.PushMail(0x80000000 | sync_value); } @@ -843,6 +849,7 @@ struct ZeldaAudioRenderer::VPB // Samples stored in MRAM at an arbitrary sample rate (resampling is // applied, unlike PCM16_FROM_MRAM_RAW). SRC_PCM16_FROM_MRAM = 33, + // TODO: 2, 6 }; u16 samples_source_type; @@ -1264,7 +1271,7 @@ void ZeldaAudioRenderer::AddVoice(u16 voice_id) // providing a target volume. s16 volume_delta; if (m_flags & VOLUME_EXPLICIT_STEP) - volume_delta = (vpb.channels[i].target_volume << 16); + volume_delta = vpb.channels[i].target_volume; else volume_delta = vpb.channels[i].target_volume - vpb.channels[i].current_volume; @@ -1432,8 +1439,8 @@ void ZeldaAudioRenderer::LoadInputSamples(MixingBuffer* buffer, VPB* vpb) u16 pattern_offset = pattern_info.idx * PATTERN_SIZE; s16* pattern = m_const_patterns.data() + pattern_offset; - u32 pos = vpb->current_pos_frac << 6; // log2(PATTERN_SIZE) - u32 step = vpb->resampling_ratio << 5; + u32 pos = vpb->current_pos_frac << 6; // log2(PATTERN_SIZE) + u32 step = vpb->resampling_ratio << 5; // FIXME: ucode 24B22038 shifts by 6 (?) for (size_t i = 0; i < buffer->size(); ++i) {