diff options
Diffstat (limited to 'src/core/hle.cpp')
| -rw-r--r-- | src/core/hle.cpp | 28 |
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 | ||
| 14 | static std::vector<ModuleDef> g_module_db; | 14 | static std::vector<ModuleDef> g_module_db; |
| 15 | 15 | ||
| 16 | const 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 | |||
| 25 | void 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 | |||
| 16 | void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) { | 38 | void 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 | ||
| 21 | void RegisterAllModules() { | 43 | void RegisterAllModules() { |
| 22 | Register_SysCall(); | 44 | Register_Syscall(); |
| 23 | } | 45 | } |
| 24 | 46 | ||
| 25 | void Init() { | 47 | void Init() { |
| 26 | RegisterAllModules(); | 48 | RegisterAllModules(); |
| 49 | NOTICE_LOG(HLE, "initialized OK"); | ||
| 27 | } | 50 | } |
| 28 | 51 | ||
| 29 | void Shutdown() { | 52 | void 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 |