mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Headless: Allow connecting the web debugger.
This commit is contained in:
parent
720c5b4176
commit
114e73ffc9
1 changed files with 22 additions and 2 deletions
|
@ -24,6 +24,7 @@
|
|||
#include "Core/Core.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/WebServer.h"
|
||||
#include "Core/HLE/sceUtility.h"
|
||||
#include "Core/Host.h"
|
||||
#include "Core/SaveState.h"
|
||||
|
@ -106,6 +107,7 @@ int printUsage(const char *progname, const char *reason)
|
|||
fprintf(stderr, " -m, --mount umd.cso mount iso on umd1:\n");
|
||||
fprintf(stderr, " -r, --root some/path mount path on host0: (elfs must be in here)\n");
|
||||
fprintf(stderr, " -l, --log full log output, not just emulated printfs\n");
|
||||
fprintf(stderr, " --debugger=PORT enable websocket debugger and break at start\n");
|
||||
|
||||
#if defined(HEADLESSHOST_CLASS)
|
||||
{
|
||||
|
@ -177,8 +179,8 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
|
|||
if (coreParameter.graphicsContext && coreParameter.graphicsContext->GetDrawContext())
|
||||
coreParameter.graphicsContext->GetDrawContext()->BeginFrame();
|
||||
|
||||
coreState = CORE_RUNNING;
|
||||
while (coreState == CORE_RUNNING)
|
||||
coreState = coreParameter.startBreak ? CORE_STEPPING : CORE_RUNNING;
|
||||
while (coreState == CORE_RUNNING || coreState == CORE_STEPPING)
|
||||
{
|
||||
int blockTicks = usToCycles(1000000 / 10);
|
||||
PSP_RunLoopFor(blockTicks);
|
||||
|
@ -188,6 +190,9 @@ bool RunAutoTest(HeadlessHost *headlessHost, CoreParameter &coreParameter, bool
|
|||
coreState = CORE_RUNNING;
|
||||
headlessHost->SwapBuffers();
|
||||
}
|
||||
if (coreState == CORE_STEPPING && !coreParameter.startBreak) {
|
||||
break;
|
||||
}
|
||||
if (time_now_d() > deadline) {
|
||||
// Don't compare, print the output at least up to this point, and bail.
|
||||
printf("%s", output.c_str());
|
||||
|
@ -230,6 +235,7 @@ int main(int argc, const char* argv[])
|
|||
const char *stateToLoad = 0;
|
||||
GPUCore gpuCore = GPUCORE_SOFTWARE;
|
||||
CPUCore cpuCore = CPUCore::JIT;
|
||||
int debuggerPort = -1;
|
||||
|
||||
std::vector<std::string> testFilenames;
|
||||
const char *mountIso = 0;
|
||||
|
@ -291,6 +297,8 @@ int main(int argc, const char* argv[])
|
|||
screenshotFilename = argv[i] + strlen("--screenshot=");
|
||||
else if (!strncmp(argv[i], "--timeout=", strlen("--timeout=")) && strlen(argv[i]) > strlen("--timeout="))
|
||||
timeout = strtod(argv[i] + strlen("--timeout="), NULL);
|
||||
else if (!strncmp(argv[i], "--debugger=", strlen("--debugger=")) && strlen(argv[i]) > strlen("--debugger="))
|
||||
debuggerPort = (int)strtoul(argv[i] + strlen("--debugger="), NULL, 10);
|
||||
else if (!strcmp(argv[i], "--teamcity"))
|
||||
teamCityMode = true;
|
||||
else if (!strncmp(argv[i], "--state=", strlen("--state=")) && strlen(argv[i]) > strlen("--state="))
|
||||
|
@ -420,6 +428,14 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
UpdateUIState(UISTATE_INGAME);
|
||||
|
||||
if (debuggerPort > 0) {
|
||||
g_Config.iRemoteISOPort = debuggerPort;
|
||||
coreParameter.startBreak = true;
|
||||
StartWebServer(WebServerFlags::DEBUGGER);
|
||||
}
|
||||
|
||||
if (stateToLoad != NULL)
|
||||
SaveState::Load(stateToLoad, -1);
|
||||
|
||||
|
@ -456,6 +472,10 @@ int main(int argc, const char* argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (debuggerPort > 0) {
|
||||
ShutdownWebServer();
|
||||
}
|
||||
|
||||
host->ShutdownGraphics();
|
||||
delete host;
|
||||
host = nullptr;
|
||||
|
|
Loading…
Add table
Reference in a new issue