summaryrefslogtreecommitdiff
path: root/src/core/hle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle.cpp')
-rw-r--r--src/core/hle.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/core/hle.cpp b/src/core/hle.cpp
index 8dad7695b..d62d2d0ce 100644
--- a/src/core/hle.cpp
+++ b/src/core/hle.cpp
@@ -13,21 +13,45 @@ namespace HLE {
13 13
14static std::vector<ModuleDef> g_module_db; 14static std::vector<ModuleDef> g_module_db;
15 15
16const FunctionDef* GetSyscallInfo(u32 opcode) {
17 u32 func_num = opcode & 0xFFFFFF; // 8 bits
18 if (func_num > 0xFF) {
19 ERROR_LOG(HLE,"Unknown syscall: 0x%02X", func_num);
20 return NULL;
21 }
22 return &g_module_db[0].func_table[func_num];
23}
24
25void CallSyscall(u32 opcode) {
26 const FunctionDef *info = GetSyscallInfo(opcode);
27
28 if (!info) {
29 return;
30 }
31 if (info->func) {
32 info->func();
33 } else {
34 ERROR_LOG(HLE, "Unimplemented HLE function %s", info->name);
35 }
36}
37
16void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) { 38void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
17 ModuleDef module = {name, num_functions, func_table}; 39 ModuleDef module = {name, num_functions, func_table};
18 g_module_db.push_back(module); 40 g_module_db.push_back(module);
19} 41}
20 42
21void RegisterAllModules() { 43void RegisterAllModules() {
22 Register_SysCall(); 44 Register_Syscall();
23} 45}
24 46
25void Init() { 47void Init() {
26 RegisterAllModules(); 48 RegisterAllModules();
49 NOTICE_LOG(HLE, "initialized OK");
27} 50}
28 51
29void Shutdown() { 52void Shutdown() {
30 g_module_db.clear(); 53 g_module_db.clear();
54 NOTICE_LOG(HLE, "shutdown OK");
31} 55}
32 56
33} // namespace 57} // namespace