diff options
Diffstat (limited to 'src/core/hle/hle.cpp')
| -rw-r--r-- | src/core/hle/hle.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp new file mode 100644 index 000000000..d62d2d0ce --- /dev/null +++ b/src/core/hle/hle.cpp | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <vector> | ||
| 6 | |||
| 7 | #include "core/hle/hle.h" | ||
| 8 | #include "core/hle/hle_syscall.h" | ||
| 9 | |||
| 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 11 | |||
| 12 | namespace HLE { | ||
| 13 | |||
| 14 | static std::vector<ModuleDef> g_module_db; | ||
| 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 | |||
| 38 | void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) { | ||
| 39 | ModuleDef module = {name, num_functions, func_table}; | ||
| 40 | g_module_db.push_back(module); | ||
| 41 | } | ||
| 42 | |||
| 43 | void RegisterAllModules() { | ||
| 44 | Register_Syscall(); | ||
| 45 | } | ||
| 46 | |||
| 47 | void Init() { | ||
| 48 | RegisterAllModules(); | ||
| 49 | NOTICE_LOG(HLE, "initialized OK"); | ||
| 50 | } | ||
| 51 | |||
| 52 | void Shutdown() { | ||
| 53 | g_module_db.clear(); | ||
| 54 | NOTICE_LOG(HLE, "shutdown OK"); | ||
| 55 | } | ||
| 56 | |||
| 57 | } // namespace | ||