feat: added a entrypoint for the runtime for now

This commit is contained in:
Ran-j
2025-04-17 02:18:08 -03:00
parent 1130a322a2
commit dc23e84400
6 changed files with 55 additions and 9 deletions
+7
View File
@@ -25,11 +25,18 @@ add_library(ps2_runtime STATIC
src/ps2_syscalls.cpp
)
add_executable(ps2EntryRunner
src/register_functions.cpp
src/main.cpp
)
target_include_directories(ps2_runtime PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
target_link_libraries(ps2_runtime PRIVATE raylib)
target_link_libraries(ps2EntryRunner PRIVATE raylib)
target_link_libraries(ps2EntryRunner PRIVATE ps2_runtime)
install(TARGETS ps2_runtime
LIBRARY DESTINATION lib
-2
View File
@@ -326,8 +326,6 @@ public:
void registerFunction(uint32_t address, RecompiledFunction func);
RecompiledFunction lookupFunction(uint32_t address);
void registerBuiltinStubs();
private:
PS2Memory m_memory;
R5900Context m_cpuContext;
+8
View File
@@ -0,0 +1,8 @@
#ifndef REGISTER_FUNCTIONS_H
#define REGISTER_FUNCTIONS_H
#include "ps2_runtime.h"
void registerAllFunctions(PS2Runtime &runtime);
#endif // REGISTER_FUNCTIONS_H
+34
View File
@@ -0,0 +1,34 @@
#include "ps2_runtime.h"
#include "register_functions.h"
#include <iostream>
#include <string>
int main(int argc, char *argv[])
{
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <elf_file>" << std::endl;
return 1;
}
std::string elfPath = argv[1];
PS2Runtime runtime;
if (!runtime.initialize())
{
std::cerr << "Failed to initialize PS2 runtime" << std::endl;
return 1;
}
registerAllFunctions(runtime);
if (!runtime.loadELF(elfPath))
{
std::cerr << "Failed to load ELF file: " << elfPath << std::endl;
return 1;
}
runtime.run();
return 0;
}
-7
View File
@@ -76,16 +76,9 @@ bool PS2Runtime::initialize()
return false;
}
registerBuiltinStubs();
return true;
}
void PS2Runtime::registerBuiltinStubs()
{
// TODO
}
bool PS2Runtime::loadELF(const std::string &elfPath)
{
std::ifstream file(elfPath, std::ios::binary);
+6
View File
@@ -0,0 +1,6 @@
#include "register_functions.h"
// Replace this file with the actual implementation of the functions that was generated by the compiler
void registerAllFunctions(PS2Runtime &runtime)
{
}