threading part 1

This commit is contained in:
georgemoralis 2023-08-09 10:31:18 +03:00
parent 08bfc06cc9
commit 3e1386666b
4 changed files with 30 additions and 5 deletions

View File

@ -41,7 +41,7 @@ add_executable(shadps4
src/Core/PS4/HLE/Kernel/Objects/physical_memory.cpp
src/Util/string_util.cpp
src/Util/string_util.cpp
"src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h")
"src/Util/Singleton.h" "src/Util/Disassembler.cpp" "src/Util/Disassembler.h" "src/Core/PS4/Util/aerolib.h" "src/Core/PS4/Loader/SymbolsResolver.h" "src/Core/PS4/Loader/SymbolsResolver.cpp" "src/Core/PS4/HLE/Libs.cpp" "src/Core/PS4/HLE/Libs.h" "src/Core/PS4/HLE/LibC.cpp" "src/Core/PS4/HLE/LibC.h" "src/Lib/Timer.cpp" "src/Lib/Timer.h" "src/Core/PS4/HLE/LibKernel.cpp" "src/Core/PS4/HLE/LibKernel.h" "src/Core/PS4/HLE/LibSceVideoOut.cpp" "src/Core/PS4/HLE/LibSceVideoOut.h" "src/Core/PS4/HLE/LibSceGnmDriver.cpp" "src/Core/PS4/HLE/LibSceGnmDriver.h" "src/Core/PS4/HLE/Kernel/ThreadManagement.cpp" "src/Core/PS4/HLE/Kernel/ThreadManagement.h" "src/Core/PS4/HLE/ErrorCodes.h" "src/debug.h" "src/Core/PS4/HLE/Kernel/memory_management.cpp" "src/Core/PS4/HLE/Kernel/memory_management.h" "src/Core/PS4/GPU/gpu_memory.cpp" "src/Core/PS4/GPU/gpu_memory.h" "src/emulator.cpp" "src/emulator.h")
find_package(OpenGL REQUIRED)
target_link_libraries(shadps4 PUBLIC fmt mincore spdlog IMGUI SDL3-shared ${OPENGL_LIBRARY})

9
src/emulator.cpp Normal file
View File

@ -0,0 +1,9 @@
#include "emulator.h"
namespace Emulator {
void emuInit() {}
void emuRun() {
for (;;) {
}
}
} // namespace emulator

6
src/emulator.h Normal file
View File

@ -0,0 +1,6 @@
#pragma once
namespace Emulator {
void emuInit();
void emuRun();
}

View File

@ -30,6 +30,7 @@
#include <Zydis/Zydis.h>
#include "Core/PS4/HLE/Libs.h"
#include "Lib/Threads.h"
#include <emulator.h>
// Main code
int main(int argc, char* argv[])
@ -40,15 +41,24 @@ int main(int argc, char* argv[])
}
logging::init(true); // init logging
Emulator::emuInit();
Lib::InitThreads();
const char* const path = argv[1]; //argument 1 is the path of self file to boot
// const char* const path = "F:\\ps4games\\CUSA03840 - Resident Evil 6\\eboot.bin";
const char* const path = argv[1]; // argument 1 is the path of self file to boot
auto* linker = Singleton<Linker>::Instance();
HLE::Libs::Init_HLE_Libs(linker->getHLESymbols());
auto *module =linker->LoadModule(path);//load main executable
Lib::Thread mainthread(
[](void*) {
auto* linker = Singleton<Linker>::Instance();
linker->Execute();
},
nullptr);
mainthread.DetachThread();
Emulator::emuRun();
mainthread.JoinThread();
#if 0
// Setup SDL
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0)