mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-09 07:35:41 +12:00
Remove globals, change conditional compilation, doormat
This commit is contained in:
parent
b8fa5fc86d
commit
57c45cf58a
4 changed files with 15 additions and 12 deletions
|
@ -90,6 +90,7 @@ endif()
|
||||||
|
|
||||||
set(SOURCE_FILES src/main.cpp src/emulator.cpp src/io_file.cpp src/gl_state.cpp src/config.cpp
|
set(SOURCE_FILES src/main.cpp src/emulator.cpp src/io_file.cpp src/gl_state.cpp src/config.cpp
|
||||||
src/core/CPU/cpu_dynarmic.cpp src/core/CPU/dynarmic_cycles.cpp src/core/memory.cpp
|
src/core/CPU/cpu_dynarmic.cpp src/core/CPU/dynarmic_cycles.cpp src/core/memory.cpp
|
||||||
|
src/httpserver.cpp
|
||||||
)
|
)
|
||||||
set(CRYPTO_SOURCE_FILES src/core/crypto/aes_engine.cpp)
|
set(CRYPTO_SOURCE_FILES src/core/crypto/aes_engine.cpp)
|
||||||
set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limits.cpp
|
set(KERNEL_SOURCE_FILES src/core/kernel/kernel.cpp src/core/kernel/resource_limits.cpp
|
||||||
|
@ -145,7 +146,7 @@ set(HEADER_FILES include/emulator.hpp include/helpers.hpp include/opengl.hpp inc
|
||||||
include/result/result_common.hpp include/result/result_fs.hpp include/result/result_fnd.hpp
|
include/result/result_common.hpp include/result/result_fs.hpp include/result/result_fnd.hpp
|
||||||
include/result/result_gsp.hpp include/result/result_kernel.hpp include/result/result_os.hpp
|
include/result/result_gsp.hpp include/result/result_kernel.hpp include/result/result_os.hpp
|
||||||
include/crypto/aes_engine.hpp include/metaprogramming.hpp include/PICA/pica_vertex.hpp include/gl_state.hpp
|
include/crypto/aes_engine.hpp include/metaprogramming.hpp include/PICA/pica_vertex.hpp include/gl_state.hpp
|
||||||
include/config.hpp include/services/ir_user.hpp
|
include/config.hpp include/services/ir_user.hpp include/httpserver.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
||||||
|
@ -158,10 +159,6 @@ set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
|
||||||
third_party/xxhash/xxhash.c
|
third_party/xxhash/xxhash.c
|
||||||
)
|
)
|
||||||
|
|
||||||
if (ENABLE_HTTP_SERVER)
|
|
||||||
set(HTTPSERVER_SOURCE_FILES src/httpserver.cpp)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
source_group("Header Files\\Core" FILES ${HEADER_FILES})
|
source_group("Header Files\\Core" FILES ${HEADER_FILES})
|
||||||
source_group("Source Files\\Core" FILES ${SOURCE_FILES})
|
source_group("Source Files\\Core" FILES ${SOURCE_FILES})
|
||||||
source_group("Source Files\\Core\\Crypto" FILES ${CRYPTO_SOURCE_FILES})
|
source_group("Source Files\\Core\\Crypto" FILES ${CRYPTO_SOURCE_FILES})
|
||||||
|
|
|
@ -1,19 +1,22 @@
|
||||||
|
#ifdef PANDA3DS_ENABLE_HTTP_SERVER
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#include "helpers.hpp"
|
#include "helpers.hpp"
|
||||||
|
|
||||||
enum class HttpAction { None, Screenshot, PressKey, ReleaseKey };
|
enum class HttpAction { None, Screenshot, PressKey, ReleaseKey };
|
||||||
|
|
||||||
constexpr const char* httpServerScreenshotPath = "screenshot.png";
|
struct HttpServer {
|
||||||
|
static constexpr const char* httpServerScreenshotPath = "screenshot.png";
|
||||||
|
|
||||||
struct HttpServer
|
std::atomic_bool pendingAction = false;
|
||||||
{
|
|
||||||
std::atomic_bool pendingAction = false;
|
|
||||||
HttpAction action = HttpAction::None;
|
HttpAction action = HttpAction::None;
|
||||||
std::mutex actionMutex = {};
|
std::mutex actionMutex = {};
|
||||||
u32 pendingKey = 0;
|
u32 pendingKey = 0;
|
||||||
|
|
||||||
void startHttpServer();
|
void startHttpServer();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // PANDA3DS_ENABLE_HTTP_SERVER
|
|
@ -429,7 +429,7 @@ void Emulator::pollHttpServer() {
|
||||||
if (httpServer.pendingAction) {
|
if (httpServer.pendingAction) {
|
||||||
switch (httpServer.action) {
|
switch (httpServer.action) {
|
||||||
case HttpAction::Screenshot: {
|
case HttpAction::Screenshot: {
|
||||||
screenshot(httpServerScreenshotPath);
|
screenshot(HttpServer::httpServerScreenshotPath);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case HttpAction::PressKey: {
|
case HttpAction::PressKey: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef PANDA3DS_ENABLE_HTTP_SERVER
|
||||||
#include "httpserver.hpp"
|
#include "httpserver.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -97,4 +98,6 @@ void HttpServer::startHttpServer() {
|
||||||
server.listen("localhost", 1234);
|
server.listen("localhost", 1234);
|
||||||
});
|
});
|
||||||
http_thread.detach();
|
http_thread.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // PANDA3DS_ENABLE_HTTP_SERVER
|
Loading…
Add table
Reference in a new issue