2023-10-13 08:40:59 +02:00
|
|
|
#include <SDL3/SDL.h>
|
2023-10-26 22:15:11 +02:00
|
|
|
#include <cstdio>
|
2023-10-26 22:29:05 +02:00
|
|
|
#include <fmt/core.h>
|
2023-11-05 12:41:10 +01:00
|
|
|
#include "common/discord.h"
|
|
|
|
#include "common/types.h"
|
|
|
|
#include "common/log.h"
|
|
|
|
#include "common/singleton.h"
|
2023-10-31 07:47:58 +01:00
|
|
|
#include <core/PS4/HLE/Graphics/video_out.h>
|
2023-10-13 08:40:59 +02:00
|
|
|
#include <Util/config.h>
|
2023-06-08 10:58:29 +02:00
|
|
|
#include <Zydis/Zydis.h>
|
2023-10-13 08:40:59 +02:00
|
|
|
#include <emulator.h>
|
2023-10-26 22:15:11 +02:00
|
|
|
#include <cinttypes>
|
2023-10-22 16:10:25 +02:00
|
|
|
#include <thread>
|
2023-10-31 07:47:58 +01:00
|
|
|
#include "core/PS4/HLE/Libs.h"
|
|
|
|
#include "core/PS4/Linker.h"
|
2023-10-30 07:48:52 +01:00
|
|
|
#include "emuTimer.h"
|
2023-08-22 22:59:59 +02:00
|
|
|
|
2023-10-13 08:40:59 +02:00
|
|
|
int main(int argc, char* argv[]) {
|
2023-08-03 12:06:23 +02:00
|
|
|
if (argc == 1) {
|
2023-10-26 22:29:05 +02:00
|
|
|
fmt::print("Usage: {} <elf or eboot.bin path>\n", argv[0]);
|
2023-07-07 12:54:44 +02:00
|
|
|
return -1;
|
2023-08-03 12:06:23 +02:00
|
|
|
}
|
2023-08-14 19:17:01 +02:00
|
|
|
Config::load("config.toml");
|
2023-11-05 15:56:28 +01:00
|
|
|
Common::Log::Init(true);
|
2023-08-22 22:59:59 +02:00
|
|
|
auto width = Config::getScreenWidth();
|
|
|
|
auto height = Config::getScreenHeight();
|
2023-10-13 08:40:59 +02:00
|
|
|
Emu::emuInit(width, height);
|
2023-08-22 22:59:59 +02:00
|
|
|
HLE::Libs::Graphics::VideoOut::videoOutInit(width, height);
|
2023-10-30 07:48:52 +01:00
|
|
|
Emulator::emuTimer::start();
|
2023-08-22 22:59:59 +02:00
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
// Argument 1 is the path of self file to boot
|
|
|
|
const char* const path = argv[1];
|
2023-09-12 18:39:08 +02:00
|
|
|
|
2023-11-05 15:56:28 +01:00
|
|
|
auto linker = Common::Singleton<Linker>::Instance();
|
2023-10-26 22:13:07 +02:00
|
|
|
HLE::Libs::Init_HLE_Libs(&linker->getHLESymbols());
|
2023-11-05 15:56:28 +01:00
|
|
|
linker->LoadModule(path);
|
2023-10-22 16:10:25 +02:00
|
|
|
std::jthread mainthread(
|
2023-11-05 15:56:28 +01:00
|
|
|
[linker](std::stop_token stop_token, void*) {
|
2023-08-09 09:31:18 +02:00
|
|
|
linker->Execute();
|
|
|
|
},
|
|
|
|
nullptr);
|
2023-08-11 19:22:26 +02:00
|
|
|
Discord::RPC discordRPC;
|
|
|
|
discordRPC.init();
|
|
|
|
discordRPC.update(Discord::RPCStatus::Idling, "");
|
2023-10-13 08:40:59 +02:00
|
|
|
Emu::emuRun();
|
2023-08-12 00:02:42 +02:00
|
|
|
|
2023-08-11 19:22:26 +02:00
|
|
|
discordRPC.stop();
|
2023-04-27 18:13:19 +02:00
|
|
|
return 0;
|
|
|
|
}
|