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