mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Merge pull request #17189 from unknownbrackets/minor-cleanup
Miscellaneous cleanup from recent changes
This commit is contained in:
commit
acb61e4781
@ -2030,8 +2030,6 @@ add_library(${CoreLibName} ${CoreLinkType}
|
||||
Core/HW/SasReverb.h
|
||||
Core/HW/StereoResampler.cpp
|
||||
Core/HW/StereoResampler.h
|
||||
Core/Host.cpp
|
||||
Core/Host.h
|
||||
Core/Loaders.cpp
|
||||
Core/Loaders.h
|
||||
Core/FileLoaders/CachingFileLoader.cpp
|
||||
@ -2413,8 +2411,8 @@ set(NativeAssets
|
||||
if(HEADLESS)
|
||||
set(HeadlessSource
|
||||
headless/Headless.cpp
|
||||
headless/StubHost.cpp
|
||||
headless/StubHost.h
|
||||
headless/HeadlessHost.cpp
|
||||
headless/HeadlessHost.h
|
||||
headless/Compare.cpp
|
||||
headless/Compare.h
|
||||
headless/SDLHeadlessHost.cpp
|
||||
|
@ -19,14 +19,14 @@ bool RequestManager::MakeSystemRequest(SystemRequestType type, RequestCallback c
|
||||
int requestId = idCounter_++;
|
||||
|
||||
// NOTE: We need to register immediately, in order to support synchronous implementations.
|
||||
{
|
||||
if (callback || failedCallback) {
|
||||
std::lock_guard<std::mutex> guard(callbackMutex_);
|
||||
callbackMap_[requestId] = { callback, failedCallback };
|
||||
}
|
||||
|
||||
INFO_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId);
|
||||
DEBUG_LOG(SYSTEM, "Making system request %s: id %d", RequestTypeAsString(type), requestId);
|
||||
if (!System_MakeRequest(type, requestId, param1, param2, param3)) {
|
||||
{
|
||||
if (callback || failedCallback) {
|
||||
std::lock_guard<std::mutex> guard(callbackMutex_);
|
||||
callbackMap_.erase(requestId);
|
||||
}
|
||||
@ -50,7 +50,7 @@ void RequestManager::PostSystemSuccess(int requestId, const char *responseString
|
||||
response.responseString = responseString;
|
||||
response.responseValue = responseValue;
|
||||
pendingSuccesses_.push_back(response);
|
||||
INFO_LOG(SYSTEM, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue);
|
||||
DEBUG_LOG(SYSTEM, "PostSystemSuccess: Request %d (%s, %d)", requestId, responseString, responseValue);
|
||||
callbackMap_.erase(iter);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ void RequestManager::PostSystemFailure(int requestId) {
|
||||
return;
|
||||
}
|
||||
|
||||
INFO_LOG(SYSTEM, "PostSystemFailure: Request %d failed", requestId);
|
||||
WARN_LOG(SYSTEM, "PostSystemFailure: Request %d failed", requestId);
|
||||
|
||||
std::lock_guard<std::mutex> responseGuard(responseMutex_);
|
||||
PendingFailure response;
|
||||
|
@ -142,6 +142,14 @@ inline void System_SetWindowTitle(const std::string ¶m) {
|
||||
g_requestManager.MakeSystemRequest(SystemRequestType::SET_WINDOW_TITLE, nullptr, nullptr, param, "", 0);
|
||||
}
|
||||
|
||||
inline void System_SendDebugOutput(const std::string &string) {
|
||||
g_requestManager.MakeSystemRequest(SystemRequestType::SEND_DEBUG_OUTPUT, nullptr, nullptr, string, "", 0);
|
||||
}
|
||||
|
||||
inline void System_SendDebugScreenshot(const std::string &data, int height) {
|
||||
g_requestManager.MakeSystemRequest(SystemRequestType::SEND_DEBUG_SCREENSHOT, nullptr, nullptr, data, "", height);
|
||||
}
|
||||
|
||||
// Non-inline to avoid including Path.h
|
||||
void System_CreateGameShortcut(const Path &path, const std::string &title);
|
||||
|
||||
|
@ -6,8 +6,7 @@
|
||||
|
||||
// Platform integration
|
||||
|
||||
// To run the PPSSPP core, a platform needs to implement all the System_ functions in this file,
|
||||
// plus derive an object from Host (see Host.h). The latter will be phased out.
|
||||
// To run the PPSSPP core, a platform needs to implement all the System_ functions in this file.
|
||||
// Failure to implement all of these will simply cause linker failures. There are a few that are
|
||||
// only implemented on specific platforms, but they're also only called on those platforms.
|
||||
|
||||
@ -70,6 +69,11 @@ enum class SystemRequestType {
|
||||
GRAPHICS_BACKEND_FAILED_ALERT,
|
||||
CREATE_GAME_SHORTCUT,
|
||||
|
||||
// Commonly ignored, used when automated tests generate output.
|
||||
SEND_DEBUG_OUTPUT,
|
||||
// Note: height specified as param3, width based on param1.size() / param3.
|
||||
SEND_DEBUG_SCREENSHOT,
|
||||
|
||||
NOTIFY_UI_STATE, // Used on Android only. Not a SystemNotification since it takes a parameter.
|
||||
|
||||
// High-level hardware control
|
||||
|
@ -711,7 +711,6 @@
|
||||
<ClCompile Include="HLE\sceUtility.cpp" />
|
||||
<ClCompile Include="HLE\sceVaudio.cpp" />
|
||||
<ClCompile Include="HLE\__sceAudio.cpp" />
|
||||
<ClCompile Include="Host.cpp" />
|
||||
<ClCompile Include="HW\MediaEngine.cpp" />
|
||||
<ClCompile Include="HW\MemoryStick.cpp" />
|
||||
<ClCompile Include="HW\MpegDemux.cpp" />
|
||||
@ -1265,7 +1264,6 @@
|
||||
<ClInclude Include="HLE\sceVaudio.h" />
|
||||
<ClInclude Include="HLE\ThreadQueueList.h" />
|
||||
<ClInclude Include="HLE\__sceAudio.h" />
|
||||
<ClInclude Include="Host.h" />
|
||||
<ClInclude Include="HW\BufferQueue.h" />
|
||||
<ClInclude Include="HW\MediaEngine.h" />
|
||||
<ClInclude Include="HW\MpegDemux.h" />
|
||||
|
@ -300,9 +300,6 @@
|
||||
<ClCompile Include="CoreTiming.cpp">
|
||||
<Filter>Core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Host.cpp">
|
||||
<Filter>Core</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Loaders.cpp">
|
||||
<Filter>Core</Filter>
|
||||
</ClCompile>
|
||||
@ -1401,9 +1398,6 @@
|
||||
<ClInclude Include="CoreTiming.h">
|
||||
<Filter>Core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Host.h">
|
||||
<Filter>Core</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Loaders.h">
|
||||
<Filter>Core</Filter>
|
||||
</ClInclude>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "Common/Serialize/SerializeMap.h"
|
||||
#include "Common/Serialize/SerializeSet.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
@ -37,7 +38,6 @@
|
||||
#include "Core/MemMapHelpers.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/HDRemaster.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "Core/HLE/HLEHelperThread.h"
|
||||
@ -2012,8 +2012,8 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
case EMULATOR_DEVCTL__SEND_OUTPUT:
|
||||
{
|
||||
std::string data(Memory::GetCharPointer(argAddr), argLen);
|
||||
if (PSP_CoreParameter().printfEmuLog && host) {
|
||||
host->SendDebugOutput(data);
|
||||
if (PSP_CoreParameter().printfEmuLog) {
|
||||
System_SendDebugOutput(data);
|
||||
} else {
|
||||
if (PSP_CoreParameter().collectEmuLog) {
|
||||
*PSP_CoreParameter().collectEmuLog += data;
|
||||
@ -2040,9 +2040,7 @@ static u32 sceIoDevctl(const char *name, int cmd, u32 argAddr, int argLen, u32 o
|
||||
|
||||
__DisplayGetFramebuf(&topaddr, &linesize, nullptr, 0);
|
||||
// TODO: Convert based on pixel format / mode / something?
|
||||
if (host) {
|
||||
host->SendDebugScreenshot(topaddr, linesize, 272);
|
||||
}
|
||||
System_SendDebugScreenshot(std::string((const char *)&topaddr[0], linesize * 272), 272);
|
||||
return 0;
|
||||
}
|
||||
case EMULATOR_DEVCTL__TOGGLE_FASTFORWARD:
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Common/Serialize/SerializeSet.h"
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/System/System.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
@ -37,7 +38,6 @@
|
||||
#include "Core/HLE/ReplaceTables.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/MIPS/MIPS.h"
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
@ -1934,9 +1934,7 @@ void __KernelGPUReplay() {
|
||||
PSPPointer<u8> topaddr;
|
||||
u32 linesize = 512;
|
||||
__DisplayGetFramebuf(&topaddr, &linesize, nullptr, 0);
|
||||
if (host) {
|
||||
host->SendDebugScreenshot(topaddr, linesize, 272);
|
||||
}
|
||||
System_SendDebugScreenshot(std::string((const char *)&topaddr[0], linesize * 272), 272);
|
||||
Core_Stop();
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +0,0 @@
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Core/Host.h"
|
||||
|
||||
Host *host = nullptr;
|
34
Core/Host.h
34
Core/Host.h
@ -1,34 +0,0 @@
|
||||
// Copyright (c) 2012- PPSSPP Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official git repository and contact information can be found at
|
||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
|
||||
class GraphicsContext;
|
||||
|
||||
class Host {
|
||||
public:
|
||||
virtual ~Host() {}
|
||||
|
||||
virtual void SendDebugOutput(const std::string &output) {}
|
||||
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {}
|
||||
};
|
||||
|
||||
extern Host *host;
|
@ -45,8 +45,6 @@
|
||||
#include "Core/MIPS/MIPSAnalyst.h"
|
||||
#include "Core/MIPS/MIPSCodeUtils.h"
|
||||
|
||||
#include "Host.h"
|
||||
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/System.h"
|
||||
|
@ -720,8 +720,10 @@ bool ReplacedTexture::CopyLevelTo(int level, uint8_t *out, size_t outDataSize, i
|
||||
}
|
||||
}, 0, info.h, MIN_LINES_PER_THREAD);
|
||||
#else
|
||||
int extraPixels = outW - info.w;
|
||||
for (int y = 0; y < info.h; ++y) {
|
||||
memcpy((uint8_t *)out + rowPitch * y, data.data() + info.w * 4 * y, info.w * 4);
|
||||
memset((uint8_t *)out + rowPitch * y + info.w * 4, 0, extraPixels * 4);
|
||||
}
|
||||
#endif
|
||||
// Memset the rest of the padding to avoid leaky edge pixels. Guess we could parallelize this too, but meh.
|
||||
|
@ -47,7 +47,6 @@
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/HW/Camera.h"
|
||||
#include "Core/Debugger/SymbolMap.h"
|
||||
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/HLE/sceCtrl.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Config.h"
|
||||
|
@ -55,7 +55,6 @@ using namespace std::placeholders;
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/CwCheat.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "Core/MemFault.h"
|
||||
#include "Core/Reporting.h"
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "Common/System/System.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/System.h"
|
||||
|
@ -60,7 +60,6 @@
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "Core/TiltEventProcessor.h"
|
||||
#include "Core/Instance.h"
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/ELF/PBPReader.h"
|
||||
#include "Core/ELF/ParamSFO.h"
|
||||
@ -541,8 +540,7 @@ UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) {
|
||||
|
||||
UI::EventReturn GameBrowser::BrowseClick(UI::EventParams &e) {
|
||||
auto mm = GetI18NCategory("MainMenu");
|
||||
System_BrowseForFolder(mm->T("Choose folder"), [this](const std::string &value, int) {
|
||||
std::string filename = value;
|
||||
System_BrowseForFolder(mm->T("Choose folder"), [this](const std::string &filename, int) {
|
||||
this->SetPath(Path(filename));
|
||||
});
|
||||
return UI::EVENT_DONE;
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/MIPS/JitCommon/JitCommon.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
|
@ -87,7 +87,6 @@
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/FileLoaders/DiskCachingFileLoader.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/KeyMap.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/SaveState.h"
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/Loaders.h"
|
||||
#include "Core/SaveState.h"
|
||||
|
@ -417,7 +417,6 @@
|
||||
<ClInclude Include="..\..\Core\HLE\sceVaudio.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\ThreadQueueList.h" />
|
||||
<ClInclude Include="..\..\Core\HLE\__sceAudio.h" />
|
||||
<ClInclude Include="..\..\Core\Host.h" />
|
||||
<ClInclude Include="..\..\Core\HW\AsyncIOManager.h" />
|
||||
<ClInclude Include="..\..\Core\HW\BufferQueue.h" />
|
||||
<ClInclude Include="..\..\Core\HW\Camera.h" />
|
||||
@ -652,7 +651,6 @@
|
||||
<ClCompile Include="..\..\Core\HLE\sceUtility.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\sceVaudio.cpp" />
|
||||
<ClCompile Include="..\..\Core\HLE\__sceAudio.cpp" />
|
||||
<ClCompile Include="..\..\Core\Host.cpp" />
|
||||
<ClCompile Include="..\..\Core\HW\AsyncIOManager.cpp" />
|
||||
<ClCompile Include="..\..\Core\HW\BufferQueue.cpp" />
|
||||
<ClCompile Include="..\..\Core\HW\Camera.cpp" />
|
||||
|
@ -96,7 +96,6 @@
|
||||
<ClCompile Include="..\..\Core\CwCheat.cpp" />
|
||||
<ClCompile Include="..\..\Core\HDRemaster.cpp" />
|
||||
<ClCompile Include="..\..\Core\Instance.cpp" />
|
||||
<ClCompile Include="..\..\Core\Host.cpp" />
|
||||
<ClCompile Include="..\..\Core\Loaders.cpp" />
|
||||
<ClCompile Include="..\..\Core\MemFault.cpp" />
|
||||
<ClCompile Include="..\..\Core\MemMap.cpp" />
|
||||
@ -1136,7 +1135,6 @@
|
||||
<ClInclude Include="..\..\Core\CwCheat.h" />
|
||||
<ClInclude Include="..\..\Core\HDRemaster.h" />
|
||||
<ClInclude Include="..\..\Core\Instance.h" />
|
||||
<ClInclude Include="..\..\Core\Host.h" />
|
||||
<ClInclude Include="..\..\Core\Loaders.h" />
|
||||
<ClInclude Include="..\..\Core\MemFault.h" />
|
||||
<ClInclude Include="..\..\Core\MemMap.h" />
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/Core.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
@ -336,6 +335,7 @@ shutdown:
|
||||
|
||||
g_graphicsContext->Shutdown();
|
||||
|
||||
UpdateConsolePosition();
|
||||
NativeShutdown();
|
||||
|
||||
PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_UPDATE_UI, 0, 0);
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "Windows/GEDebugger/TabDisplayLists.h"
|
||||
#include "Windows/GEDebugger/GEDebugger.h"
|
||||
#include "Windows/GEDebugger/CtrlDisplayListView.h"
|
||||
#include "Windows/WindowsHost.h"
|
||||
#include "Windows/MainWindow.h"
|
||||
#include "Windows/main.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
|
@ -111,9 +111,6 @@ static std::string restartArgs;
|
||||
|
||||
int g_activeWindow = 0;
|
||||
|
||||
// Used for all the system dialogs.
|
||||
static std::thread g_dialogThread;
|
||||
|
||||
WindowsInputManager g_inputManager;
|
||||
|
||||
int g_lastNumInstances = 0;
|
||||
@ -496,24 +493,17 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::INPUT_TEXT_MODAL:
|
||||
if (g_dialogThread.joinable())
|
||||
g_dialogThread.join();
|
||||
|
||||
g_dialogThread = std::thread([=] {
|
||||
std::thread([=] {
|
||||
std::string out;
|
||||
if (InputBox_GetString(MainWindow::GetHInstance(), MainWindow::GetHWND(), ConvertUTF8ToWString(param1).c_str(), param2, out)) {
|
||||
g_requestManager.PostSystemSuccess(requestId, out.c_str());
|
||||
} else {
|
||||
g_requestManager.PostSystemFailure(requestId);
|
||||
}
|
||||
});
|
||||
g_dialogThread.detach();
|
||||
}).detach();
|
||||
return true;
|
||||
case SystemRequestType::BROWSE_FOR_IMAGE:
|
||||
if (g_dialogThread.joinable())
|
||||
g_dialogThread.join();
|
||||
|
||||
g_dialogThread = std::thread([=] {
|
||||
std::thread([=] {
|
||||
std::string out;
|
||||
if (W32Util::BrowseForFileName(true, MainWindow::GetHWND(), ConvertUTF8ToWString(param1).c_str(), nullptr,
|
||||
MakeFilter(L"All supported images (*.jpg *.jpeg *.png)|*.jpg;*.jpeg;*.png|All files (*.*)|*.*||").c_str(), L"jpg", out)) {
|
||||
@ -521,8 +511,7 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
} else {
|
||||
g_requestManager.PostSystemFailure(requestId);
|
||||
}
|
||||
});
|
||||
g_dialogThread.detach();
|
||||
}).detach();
|
||||
return true;
|
||||
case SystemRequestType::BROWSE_FOR_FILE:
|
||||
{
|
||||
@ -545,28 +534,26 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
|
||||
return false;
|
||||
}
|
||||
|
||||
g_dialogThread = std::thread([=] {
|
||||
std::thread([=] {
|
||||
std::string out;
|
||||
if (W32Util::BrowseForFileName(true, MainWindow::GetHWND(), ConvertUTF8ToWString(param1).c_str(), nullptr, filter.c_str(), L"", out)) {
|
||||
g_requestManager.PostSystemSuccess(requestId, out.c_str());
|
||||
} else {
|
||||
g_requestManager.PostSystemFailure(requestId);
|
||||
}
|
||||
});
|
||||
g_dialogThread.detach();
|
||||
}).detach();
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::BROWSE_FOR_FOLDER:
|
||||
{
|
||||
g_dialogThread = std::thread([=] {
|
||||
std::thread([=] {
|
||||
std::string folder = W32Util::BrowseForFolder(MainWindow::GetHWND(), param1.c_str());
|
||||
if (folder.size()) {
|
||||
g_requestManager.PostSystemSuccess(requestId, folder.c_str());
|
||||
} else {
|
||||
g_requestManager.PostSystemFailure(requestId);
|
||||
}
|
||||
});
|
||||
g_dialogThread.detach();
|
||||
}).detach();
|
||||
return true;
|
||||
}
|
||||
case SystemRequestType::TOGGLE_FULLSCREEN_STATE:
|
||||
@ -728,9 +715,8 @@ static void WinMainInit() {
|
||||
}
|
||||
|
||||
static void WinMainCleanup() {
|
||||
if (g_dialogThread.joinable()) {
|
||||
g_dialogThread.join();
|
||||
}
|
||||
// This will ensure no further callbacks are called, which may prevent crashing.
|
||||
g_requestManager.Clear();
|
||||
net::Shutdown();
|
||||
CoUninitialize();
|
||||
|
||||
|
@ -445,7 +445,6 @@ EXEC_AND_LIB_FILES := \
|
||||
$(SRC)/Core/Instance.cpp \
|
||||
$(SRC)/Core/KeyMap.cpp \
|
||||
$(SRC)/Core/KeyMapDefaults.cpp \
|
||||
$(SRC)/Core/Host.cpp \
|
||||
$(SRC)/Core/Loaders.cpp \
|
||||
$(SRC)/Core/PSPLoaders.cpp \
|
||||
$(SRC)/Core/FileLoaders/CachingFileLoader.cpp \
|
||||
@ -764,7 +763,7 @@ ifeq ($(HEADLESS),1)
|
||||
LOCAL_MODULE := ppsspp_headless
|
||||
LOCAL_SRC_FILES := \
|
||||
$(SRC)/headless/Headless.cpp \
|
||||
$(SRC)/headless/StubHost.cpp \
|
||||
$(SRC)/headless/HeadlessHost.cpp \
|
||||
$(SRC)/headless/Compare.cpp
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "Common/Data/Format/PNGLoad.h"
|
||||
#include "Common/File/FileUtil.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/Loaders.h"
|
||||
|
||||
#include "GPU/GPUState.h"
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include "Common/Profiler/Profiler.h"
|
||||
#include "Common/System/NativeApp.h"
|
||||
#include "Common/System/Request.h"
|
||||
#include "Common/System/System.h"
|
||||
|
||||
#include "Common/CommonWindows.h"
|
||||
@ -37,20 +38,21 @@
|
||||
#include "Core/System.h"
|
||||
#include "Core/WebServer.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/SaveState.h"
|
||||
#include "GPU/Common/FramebufferManagerCommon.h"
|
||||
#include "Log.h"
|
||||
#include "LogManager.h"
|
||||
|
||||
#include "Compare.h"
|
||||
#include "StubHost.h"
|
||||
#include "HeadlessHost.h"
|
||||
#if defined(_WIN32)
|
||||
#include "WindowsHeadlessHost.h"
|
||||
#elif defined(SDL)
|
||||
#include "SDLHeadlessHost.h"
|
||||
#endif
|
||||
|
||||
static HeadlessHost *g_headlessHost;
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
JNIEnv *getEnv() {
|
||||
return nullptr;
|
||||
@ -117,7 +119,23 @@ bool System_GetPropertyBool(SystemProperty prop) {
|
||||
void System_Notify(SystemNotification notification) {}
|
||||
void System_PostUIMessage(const std::string &message, const std::string ¶m) {}
|
||||
void System_NotifyUserMessage(const std::string &message, float duration, u32 color, const char *id) {}
|
||||
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int param3) { return false; }
|
||||
bool System_MakeRequest(SystemRequestType type, int requestId, const std::string ¶m1, const std::string ¶m2, int param3) {
|
||||
switch (type) {
|
||||
case SystemRequestType::SEND_DEBUG_OUTPUT:
|
||||
if (g_headlessHost) {
|
||||
g_headlessHost->SendDebugOutput(param1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case SystemRequestType::SEND_DEBUG_SCREENSHOT:
|
||||
if (g_headlessHost) {
|
||||
g_headlessHost->SendDebugScreenshot((const u8 *)param1.data(), (uint32_t)(param1.size() / param3), param3);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void System_InputBoxGetString(const std::string &title, const std::string &defaultValue, std::function<void(bool, const std::string &)> cb) { cb(false, ""); }
|
||||
void System_AskForPermission(SystemPermission permission) {}
|
||||
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
|
||||
@ -238,7 +256,7 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, const
|
||||
if (!opt.bench) {
|
||||
printf("%s", output.c_str());
|
||||
|
||||
host->SendDebugOutput("TIMEOUT\n");
|
||||
System_SendDebugOutput("TIMEOUT\n");
|
||||
TeamCityPrint("testFailed name='%s' message='Test timeout'", currentTestName.c_str());
|
||||
GitHubActionsPrint("error", "Test timeout for %s", currentTestName.c_str());
|
||||
}
|
||||
@ -414,7 +432,7 @@ int main(int argc, const char* argv[])
|
||||
g_threadManager.Init(cpu_info.num_cores, cpu_info.logical_cpu_count);
|
||||
|
||||
HeadlessHost *headlessHost = getHost(gpuCore);
|
||||
host = headlessHost;
|
||||
g_headlessHost = headlessHost;
|
||||
|
||||
std::string error_string;
|
||||
GraphicsContext *graphicsContext = nullptr;
|
||||
@ -583,9 +601,9 @@ int main(int argc, const char* argv[])
|
||||
}
|
||||
|
||||
headlessHost->ShutdownGraphics();
|
||||
delete host;
|
||||
host = nullptr;
|
||||
delete headlessHost;
|
||||
headlessHost = nullptr;
|
||||
g_headlessHost = nullptr;
|
||||
|
||||
g_VFS.Clear();
|
||||
LogManager::Shutdown();
|
||||
|
@ -477,7 +477,7 @@
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StubHost.cpp" />
|
||||
<ClCompile Include="HeadlessHost.cpp" />
|
||||
<ClCompile Include="WindowsHeadlessHost.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -510,7 +510,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Compare.h" />
|
||||
<ClInclude Include="SDLHeadlessHost.h" />
|
||||
<ClInclude Include="StubHost.h" />
|
||||
<ClInclude Include="HeadlessHost.h" />
|
||||
<ClInclude Include="WindowsHeadlessHost.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
@ -22,20 +22,19 @@
|
||||
<ClCompile Include="..\Windows\GPU\D3D11Context.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StubHost.cpp" />
|
||||
<ClCompile Include="SDLHeadlessHost.cpp">
|
||||
<Filter>Other Platforms</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Windows\CaptureDevice.cpp">
|
||||
<Filter>Windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HeadlessHost.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="headless.txt" />
|
||||
<None Include="..\test.py" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="StubHost.h" />
|
||||
<ClInclude Include="Compare.h" />
|
||||
<ClInclude Include="WindowsHeadlessHost.h">
|
||||
<Filter>Windows</Filter>
|
||||
@ -43,6 +42,7 @@
|
||||
<ClInclude Include="SDLHeadlessHost.h">
|
||||
<Filter>Other Platforms</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HeadlessHost.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Windows">
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "Core/System.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "headless/Compare.h"
|
||||
#include "headless/StubHost.h"
|
||||
#include "headless/HeadlessHost.h"
|
||||
|
||||
void HeadlessHost::SendOrCollectDebugOutput(const std::string &data)
|
||||
{
|
@ -17,17 +17,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/File/Path.h"
|
||||
|
||||
#include "Core/CoreParameter.h"
|
||||
#include "Core/Host.h"
|
||||
|
||||
class HeadlessHost : public Host {
|
||||
class HeadlessHost {
|
||||
public:
|
||||
virtual ~HeadlessHost() {}
|
||||
virtual bool InitGraphics(std::string *error_message, GraphicsContext **ctx, GPUCore core) {return false;}
|
||||
virtual void ShutdownGraphics() {}
|
||||
|
||||
void SendDebugOutput(const std::string &output) override {
|
||||
virtual void SendDebugOutput(const std::string &output) {
|
||||
if (output.find('\n') != output.npos) {
|
||||
DoFlushDebugOutput();
|
||||
fwrite(output.data(), sizeof(char), output.length(), stdout);
|
||||
@ -53,7 +54,7 @@ public:
|
||||
writeFailureScreenshot_ = flag;
|
||||
}
|
||||
|
||||
void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) override;
|
||||
virtual void SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h);
|
||||
|
||||
// Unique for HeadlessHost
|
||||
virtual void SwapBuffers() {}
|
@ -19,7 +19,7 @@
|
||||
|
||||
#ifdef SDL
|
||||
|
||||
#include "headless/StubHost.h"
|
||||
#include "headless/HeadlessHost.h"
|
||||
|
||||
#undef HEADLESSHOST_CLASS
|
||||
#define HEADLESSHOST_CLASS SDLHeadlessHost
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "headless/StubHost.h"
|
||||
#include "headless/HeadlessHost.h"
|
||||
#include <thread>
|
||||
|
||||
#undef HEADLESSHOST_CLASS
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "Core/System.h"
|
||||
#include "Core/HLE/sceUsbCam.h"
|
||||
#include "Core/HLE/sceUsbGps.h"
|
||||
#include "Core/Host.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
@ -523,7 +523,7 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/Dialog/PSPGamedataInstallDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPMsgDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPNetconfDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPNpSigninDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPNpSigninDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPOskDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPSaveDialog.cpp \
|
||||
$(COREDIR)/Dialog/PSPScreenshotDialog.cpp \
|
||||
@ -611,7 +611,7 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/HLE/sceVaudio.cpp \
|
||||
$(COREDIR)/HLE/scePspNpDrm_user.cpp \
|
||||
$(COREDIR)/HLE/sceNp.cpp \
|
||||
$(COREDIR)/HLE/sceNp2.cpp \
|
||||
$(COREDIR)/HLE/sceNp2.cpp \
|
||||
$(COREDIR)/HLE/scePauth.cpp \
|
||||
$(COREDIR)/HLE/sceUsbGps.cpp \
|
||||
$(COREDIR)/HW/BufferQueue.cpp \
|
||||
@ -626,7 +626,6 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/HW/SasReverb.cpp \
|
||||
$(COREDIR)/HW/StereoResampler.cpp \
|
||||
$(COREDIR)/Compatibility.cpp \
|
||||
$(COREDIR)/Host.cpp \
|
||||
$(COREDIR)/Loaders.cpp \
|
||||
$(COREDIR)/MIPS/JitCommon/JitCommon.cpp \
|
||||
$(COREDIR)/MIPS/JitCommon/JitState.cpp \
|
||||
@ -666,7 +665,7 @@ SOURCES_CXX += \
|
||||
$(COREDIR)/Util/PPGeDraw.cpp \
|
||||
$(COREDIR)/Util/AudioFormat.cpp \
|
||||
$(COREDIR)/Util/PortManager.cpp \
|
||||
$(CORE_DIR)/UI/GameInfoCache.cpp
|
||||
$(CORE_DIR)/UI/GameInfoCache.cpp
|
||||
|
||||
SOURCES_CXX += $(COREDIR)/HLE/__sceAudio.cpp
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "Core/HLE/__sceAudio.h"
|
||||
#include "Core/HW/MemoryStick.h"
|
||||
#include "Core/HW/StereoResampler.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/MemMap.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
@ -385,8 +384,6 @@ namespace Libretro
|
||||
|
||||
using namespace Libretro;
|
||||
|
||||
class LibretroHost : public Host {};
|
||||
|
||||
class PrintfLogger : public LogListener
|
||||
{
|
||||
public:
|
||||
@ -1268,8 +1265,6 @@ void retro_init(void)
|
||||
g_Config.bDiscordPresence = false;
|
||||
|
||||
g_VFS.Register("", new DirectoryReader(retro_base_dir));
|
||||
|
||||
host = new LibretroHost();
|
||||
}
|
||||
|
||||
void retro_deinit(void)
|
||||
@ -1280,9 +1275,6 @@ void retro_deinit(void)
|
||||
delete printfLogger;
|
||||
printfLogger = nullptr;
|
||||
|
||||
delete host;
|
||||
host = nullptr;
|
||||
|
||||
libretro_supports_bitmasks = false;
|
||||
libretro_supports_option_categories = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user