Merge branch 'master' into mii_selector

This commit is contained in:
wheremyfoodat 2023-08-10 12:18:43 +03:00
commit f614bcb005
26 changed files with 310 additions and 17 deletions

View file

@ -6,6 +6,7 @@
// Remember to initialize every field here to its default value otherwise bad things will happen
struct EmulatorConfig {
bool shaderJitEnabled = false;
bool discordRpcEnabled = false;
RendererType rendererType = RendererType::OpenGL;
EmulatorConfig(const std::filesystem::path& path);

23
include/discord_rpc.hpp Normal file
View file

@ -0,0 +1,23 @@
#pragma once
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
#include <discord_rpc.h>
#include <cstdint>
#include <string>
namespace Discord {
enum class RPCStatus { Idling, Playing };
class RPC {
std::uint64_t startTimestamp;
bool enabled = false;
public:
void init();
void update(RPCStatus status, const std::string& title);
void stop();
};
} // namespace Discord
#endif

View file

@ -11,6 +11,7 @@
#include "config.hpp"
#include "cpu.hpp"
#include "crypto/aes_engine.hpp"
#include "discord_rpc.hpp"
#include "io_file.hpp"
#include "memory.hpp"
@ -64,6 +65,11 @@ class Emulator {
friend struct HttpServer;
#endif
#ifdef PANDA3DS_ENABLE_DISCORD_RPC
Discord::RPC discordRpc;
#endif
void updateDiscord();
// Keep the handle for the ROM here to reload when necessary and to prevent deleting it
// This is currently only used for ELFs, NCSDs use the IOFile API instead
std::ifstream loadedELF;

View file

@ -20,7 +20,8 @@ namespace KernelHandles {
CFG, // CFG service (Console & region info)
DLP_SRVR, // Download Play: Server. Used for network play.
DSP, // DSP service (Used for audio decoding and output)
HID, // HID service (Handles everything input-related including gyro)
HID, // HID service (Handles input-related things including gyro. Does NOT handle New3DS controls or CirclePadPro)
HTTP, // HTTP service (Handles HTTP requests)
IR_USER, // One of 3 infrared communication services
FRD, // Friend service (Miiverse friend service)
FS, // Filesystem service
@ -69,6 +70,7 @@ namespace KernelHandles {
case DSP: return "DSP";
case DLP_SRVR: return "DLP::SRVR";
case HID: return "HID";
case HTTP: return "HTTP";
case IR_USER: return "IR:USER";
case FRD: return "FRD";
case FS: return "FS";

View file

@ -43,6 +43,7 @@ namespace Log {
static Logger<false> frdLogger;
static Logger<false> fsLogger;
static Logger<false> hidLogger;
static Logger<false> httpLogger;
static Logger<false> irUserLogger;
static Logger<false> gspGPULogger;
static Logger<false> gspLCDLogger;

View file

@ -1,5 +1,6 @@
#pragma once
#include "result_cfg.hpp"
#include "result_common.hpp"
#include "result_kernel.hpp"
#include "result_os.hpp"

View file

@ -0,0 +1,8 @@
#pragma once
#include "result_common.hpp"
DEFINE_HORIZON_RESULT_MODULE(Result::CFG, Config);
namespace Result::CFG {
DEFINE_HORIZON_RESULT(NotFound, 1018, WrongArgument, Permanent);
};

View file

@ -13,6 +13,7 @@ class ACTService {
// Service commands
void initialize(u32 messagePointer);
void generateUUID(u32 messagePointer);
void getAccountDataBlock(u32 messagePointer);
public:
ACTService(Memory& mem) : mem(mem) {}

View file

@ -11,6 +11,7 @@ class BOSSService {
MAKE_LOG_FUNCTION(log, bossLogger)
// Service commands
void cancelTask(u32 messagePointer);
void initializeSession(u32 messagePointer);
void getNsDataIdList(u32 messagePointer);
void getOptoutFlag(u32 messagePointer);

View file

@ -16,6 +16,7 @@ class CFGService {
// Service functions
void getConfigInfoBlk2(u32 messagePointer);
void getCountryCodeID(u32 messagePointer);
void getRegionCanadaUSA(u32 messagePointer);
void getSystemModel(u32 messagePointer);
void genUniqueConsoleHash(u32 messagePointer);

21
include/services/http.hpp Normal file
View file

@ -0,0 +1,21 @@
#pragma once
#include "helpers.hpp"
#include "kernel_types.hpp"
#include "logger.hpp"
#include "memory.hpp"
class HTTPService {
Handle handle = KernelHandles::HTTP;
Memory& mem;
MAKE_LOG_FUNCTION(log, httpLogger)
bool initialized = false;
// Service commands
void initialize(u32 messagePointer);
public:
HTTPService(Memory& mem) : mem(mem) {}
void reset();
void handleSyncRequest(u32 messagePointer);
};

View file

@ -21,6 +21,7 @@
#include "services/gsp_gpu.hpp"
#include "services/gsp_lcd.hpp"
#include "services/hid.hpp"
#include "services/http.hpp"
#include "services/ir_user.hpp"
#include "services/ldr_ro.hpp"
#include "services/mic.hpp"
@ -53,6 +54,7 @@ class ServiceManager {
DlpSrvrService dlp_srvr;
DSPService dsp;
HIDService hid;
HTTPService http;
IRUserService ir_user;
FRDService frd;
FSService fs;