mirror of
https://github.com/ran-j/PS2Recomp.git
synced 2026-09-26 08:51:05 -04:00
feat: added a entrypoint for the runtime for now
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef REGISTER_FUNCTIONS_H
|
||||
#define REGISTER_FUNCTIONS_H
|
||||
|
||||
#include "ps2_runtime.h"
|
||||
|
||||
void registerAllFunctions(PS2Runtime &runtime);
|
||||
|
||||
#endif // REGISTER_FUNCTIONS_H
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user