From 084e805a0a44ed8564bf72f4ce6cbd609031bad0 Mon Sep 17 00:00:00 2001 From: R2DLiu Date: Mon, 7 Dec 2020 00:58:00 -0500 Subject: [PATCH] even with ishii 148fc7f36727c5a6947386368acf6066d61c11a4 --- Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp | 22 ++++++++++++++++++- Source/Core/Core/HW/EXI/EXI_DeviceSlippi.h | 5 +++-- Source/Core/DolphinNoGUI/MainNoGUI.cpp | 2 ++ .../ControllerInterface/Pipes/Pipes.cpp | 4 ++++ Source/Core/UICommon/CommandLineParse.cpp | 2 ++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp index d5e1c90d36..3971d606c0 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.cpp @@ -956,6 +956,8 @@ void CEXISlippi::prepareGeckoList() {0x80376200, true}, // Binary/LagReduction/PD+VB.bin {0x801A5018, true}, // Binary/LagReduction/PD+VB.bin {0x80218D68, true}, // Binary/LagReduction/PD+VB.bin + {0x8016E9AC, true}, // Binary/Force2PCenterHud.bin + {0x80030E44, true}, // Binary/DisableScreenShake.bin {0x800055f0, true}, // Common/EXITransferBuffer.asm {0x800055f8, true}, // Common/GetIsFollower.asm @@ -986,7 +988,6 @@ void CEXISlippi::prepareGeckoList() {0x800C0148, true}, // External/FlashRedFailedLCancel/ChangeColor.asm {0x8008D690, true}, // External/FlashRedFailedLCancel/TriggerColor.asm - {0x8006A880, true}, // Online/Core/BrawlOffscreenDamage.asm {0x801A4DB4, true}, // Online/Core/ForceEngineOnRollback.asm {0x8016D310, true}, // Online/Core/HandleLRAS.asm {0x8034DED8, true}, // Online/Core/HandleRumble.asm @@ -1013,6 +1014,10 @@ void CEXISlippi::prepareGeckoList() {0x801A45BC, true}, // Online/Slippi Online Scene/main.asm {0x801a45b8, true}, // Online/Slippi Online Scene/main.asm (https://bit.ly/3kxohf4) {0x801BFA20, true}, // Online/Slippi Online Scene/boot.asm + {0x800cc818, true}, // External/GreenDuringWait/fall.asm + {0x8008a478, true}, // External/GreenDuringWait/wait.asm + + {0x802f6690, true}, // HUD Transparency v1.1 }; std::unordered_map blacklist; @@ -1583,8 +1588,10 @@ void CEXISlippi::prepareOpponentInputs(u8* payload) void CEXISlippi::handleCaptureSavestate(u8* payload) { +#ifndef IS_PLAYBACK if (isDisconnected()) return; +#endif s32 frame = payload[0] << 24 | payload[1] << 16 | payload[2] << 8 | payload[3]; @@ -2106,6 +2113,15 @@ void CEXISlippi::handleConnectionCleanup() ERROR_LOG(SLIPPI_ONLINE, "Connection cleanup completed..."); } +void CEXISlippi::prepareNewSeed() +{ + m_read_queue.clear(); + + u32 newSeed = generator() % 0xFFFFFFFF; + + appendWordToBuffer(&m_read_queue, newSeed); +} + void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize) { u8* memPtr = Memory::GetPointer(_uAddr); @@ -2136,6 +2152,7 @@ void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize) if (byte == CMD_MENU_FRAME) { SlippiSpectateServer::getInstance().write(&memPtr[0], _uSize); + // g_needInputForFrame = true; } INFO_LOG(EXPANSIONINTERFACE, "EXI SLIPPI DMAWrite: addr: 0x%08x size: %d, bufLoc:[%02x %02x %02x %02x %02x]", @@ -2224,6 +2241,9 @@ void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize) case CMD_UPDATE: handleUpdateAppRequest(); break; + case CMD_GET_NEW_SEED: + prepareNewSeed(); + break; default: writeToFileAsync(&memPtr[bufLoc], payloadLen + 1, ""); SlippiSpectateServer::getInstance().write(&memPtr[bufLoc], payloadLen + 1); diff --git a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.h b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.h index 6cf384c8bd..554da5b7f7 100644 --- a/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.h +++ b/Source/Core/Core/HW/EXI/EXI_DeviceSlippi.h @@ -70,7 +70,7 @@ namespace ExpansionInterface CMD_UPDATE = 0xB8, CMD_GET_ONLINE_STATUS = 0xB9, CMD_CLEANUP_CONNECTION = 0xBA, - + CMD_GET_NEW_SEED = 0xBC, // Misc CMD_LOG_MESSAGE = 0xD0, CMD_FILE_LENGTH = 0xD1, @@ -112,7 +112,7 @@ namespace ExpansionInterface {CMD_UPDATE, 0}, {CMD_GET_ONLINE_STATUS, 0}, {CMD_CLEANUP_CONNECTION, 0}, - + {CMD_GET_NEW_SEED, 0}, // Misc {CMD_LOG_MESSAGE, 0xFFFF}, // Variable size... will only work if by itself {CMD_FILE_LENGTH, 0x40}, @@ -165,6 +165,7 @@ namespace ExpansionInterface void handleUpdateAppRequest(); void prepareOnlineStatus(); void handleConnectionCleanup(); + void prepareNewSeed(); // replay playback stuff void prepareGameInfo(u8* payload); diff --git a/Source/Core/DolphinNoGUI/MainNoGUI.cpp b/Source/Core/DolphinNoGUI/MainNoGUI.cpp index be260aa6b7..b29e46b91f 100644 --- a/Source/Core/DolphinNoGUI/MainNoGUI.cpp +++ b/Source/Core/DolphinNoGUI/MainNoGUI.cpp @@ -210,12 +210,14 @@ int main(int argc, char* argv[]) UICommon::SetUserDirectory(user_directory); UICommon::Init(); +#ifdef IS_PLAYBACK std::optional slippi_input_path; if (options.is_set("slippi_input")) { slippi_input_path = static_cast(options.get("slippi_input")); SConfig::GetInstance().m_strSlippiInput = slippi_input_path.value(); } +#endif s_platform = GetPlatform(options); if (!s_platform || !s_platform->Init()) diff --git a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp index 47d1d6aa97..8a3982145b 100644 --- a/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp +++ b/Source/Core/InputCommon/ControllerInterface/Pipes/Pipes.cpp @@ -162,6 +162,10 @@ void PipeDevice::UpdateInput() // then dequeue a command off the front of m_buf and parse it. char buf[32]; s32 bytes_read = readFromPipe(m_fd, buf, sizeof buf); + if (bytes_read == 0) { + // Pipe died, so just quit out + return; + } while (bytes_read > 0) { m_buf.append(buf, bytes_read); diff --git a/Source/Core/UICommon/CommandLineParse.cpp b/Source/Core/UICommon/CommandLineParse.cpp index 3fc59b0b09..c7043ba4da 100644 --- a/Source/Core/UICommon/CommandLineParse.cpp +++ b/Source/Core/UICommon/CommandLineParse.cpp @@ -118,11 +118,13 @@ std::unique_ptr CreateParser(ParserOptions options) parser->add_option("-a", "--audio_emulation") .choices({"HLE", "LLE"}) .help("Choose audio emulation from [%choices]"); +#ifdef IS_PLAYBACK parser->add_option("-i", "--slippi_input") .action("store") .metavar("") .type("string") .help("Path to Slippi replay config file (default: Slippi/playback.txt)"); +#endif parser->add_option("-hs", "--hide-seekbar") .action("store_true") .help("Disable and hide seekbar during playback");