diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp
index ccc83abf2..4e8f841f4 100644
--- a/src/citra_qt/debugger/disassembler.cpp
+++ b/src/citra_qt/debugger/disassembler.cpp
@@ -48,7 +48,7 @@ void DisassemblerWidget::Init()
unsigned int curInstAddr = base_addr;
char result[255];
- for (int i = 0; i < 10000; i++) // fixed for now
+ for (int i = 0; i < 20000; i++) // fixed for now
{
disasm->disasm(curInstAddr, Memory::Read32(curInstAddr), result);
model->setItem(i, 0, new QStandardItem(QString("0x%1").arg((uint)(curInstAddr), 8, 16, QLatin1Char('0'))));
diff --git a/src/common/console_listener.cpp b/src/common/console_listener.cpp
index b5f32d1bd..db48abbf6 100644
--- a/src/common/console_listener.cpp
+++ b/src/common/console_listener.cpp
@@ -259,14 +259,17 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
switch (Level)
{
+ case OS_LEVEL: // light yellow
+ Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
+ break;
case NOTICE_LEVEL: // light green
Color = FOREGROUND_GREEN | FOREGROUND_INTENSITY;
break;
case ERROR_LEVEL: // light red
Color = FOREGROUND_RED | FOREGROUND_INTENSITY;
break;
- case WARNING_LEVEL: // light yellow
- Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY;
+ case WARNING_LEVEL: // light purple
+ Color = FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
break;
case INFO_LEVEL: // cyan
Color = FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
@@ -278,15 +281,8 @@ void ConsoleListener::Log(LogTypes::LOG_LEVELS Level, const char *Text)
Color = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
break;
}
- if (strlen(Text) > 10)
- {
- // First 10 chars white
- SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- WriteConsole(hConsole, Text, 10, &cCharsWritten, NULL);
- Text += 10;
- }
SetConsoleTextAttribute(hConsole, Color);
- WriteConsole(hConsole, Text, (DWORD)strlen(Text), &cCharsWritten, NULL);
+ printf(Text);
#else
char ColorAttr[16] = "";
char ResetAttr[16] = "";
diff --git a/src/common/log.h b/src/common/log.h
index 71becd893..1a060dfff 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -7,11 +7,14 @@
#define LOGGING
-#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and OSReports.
-#define ERROR_LEVEL 2 // Critical errors
-#define WARNING_LEVEL 3 // Something is suspicious.
-#define INFO_LEVEL 4 // General information.
-#define DEBUG_LEVEL 5 // Detailed debugging - might make things slow.
+enum {
+ OS_LEVEL, // Printed by the emulated operating system
+ NOTICE_LEVEL, // VERY important information that is NOT errors. Like startup and OSReports.
+ ERROR_LEVEL, // Critical errors
+ WARNING_LEVEL, // Something is suspicious.
+ INFO_LEVEL, // General information.
+ DEBUG_LEVEL, // Detailed debugging - might make things slow.
+};
namespace LogTypes
{
@@ -71,6 +74,7 @@ enum LOG_TYPE {
// FIXME: should this be removed?
enum LOG_LEVELS {
+ LOS = OS_LEVEL,
LNOTICE = NOTICE_LEVEL,
LERROR = ERROR_LEVEL,
LWARNING = WARNING_LEVEL,
@@ -83,31 +87,34 @@ enum LOG_LEVELS {
} // namespace
-void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type,
- const char *file, int line, const char *fmt, ...)
+void GenericLog(LOGTYPES_LEVELS level, LOGTYPES_TYPE type, const char*file, int line,
+ const char* function, const char* fmt, ...)
#ifdef __GNUC__
- __attribute__((format(printf, 5, 6)))
+ __attribute__((format(printf, 6, 7)))
#endif
;
#if defined LOGGING || defined _DEBUG || defined DEBUGFAST
-#define MAX_LOGLEVEL DEBUG_LEVEL
+#define MAX_LOGLEVEL LDEBUG
#else
#ifndef MAX_LOGLEVEL
-#define MAX_LOGLEVEL WARNING_LEVEL
+#define MAX_LOGLEVEL LWARNING
#endif // loglevel
#endif // logging
-#ifdef GEKKO
-#define GENERIC_LOG(t, v, ...)
-#else
-// Let the compiler optimize this out
-#define GENERIC_LOG(t, v, ...) { \
- if (v <= MAX_LOGLEVEL) \
- GenericLog(v, t, __FILE__, __LINE__, __VA_ARGS__); \
- }
+#ifdef _WIN32
+#ifndef __func__
+#define __func__ __FUNCTION__
+#endif
#endif
+// Let the compiler optimize this out
+#define GENERIC_LOG(t, v, ...) { \
+ if (v <= LogTypes::MAX_LOGLEVEL) \
+ GenericLog(v, t, __FILE__, __LINE__, __func__, __VA_ARGS__); \
+ }
+
+#define OS_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LOS, __VA_ARGS__) } while (0)
#define ERROR_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LERROR, __VA_ARGS__) } while (0)
#define WARN_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LWARNING, __VA_ARGS__) } while (0)
#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0)
diff --git a/src/common/log_manager.cpp b/src/common/log_manager.cpp
index 734e25728..883e22903 100644
--- a/src/common/log_manager.cpp
+++ b/src/common/log_manager.cpp
@@ -10,14 +10,16 @@
#include "common/thread.h"
#include "common/file_util.h"
-void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
- const char *file, int line, const char* fmt, ...)
+void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
+ const char* function, const char* fmt, ...)
{
va_list args;
va_start(args, fmt);
- if (LogManager::GetInstance())
+
+ if (LogManager::GetInstance()) {
LogManager::GetInstance()->Log(level, type,
- file, line, fmt, args);
+ file, line, function, fmt, args);
+ }
va_end(args);
}
@@ -89,6 +91,8 @@ LogManager::LogManager()
m_Log[i]->AddListener(m_debuggerLog);
#endif
}
+
+ m_consoleLog->Open();
}
LogManager::~LogManager()
@@ -108,8 +112,8 @@ LogManager::~LogManager()
delete m_debuggerLog;
}
-void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
- const char *file, int line, const char *format, va_list args)
+void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file,
+ int line, const char* function, const char *fmt, va_list args)
{
char temp[MAX_MSGLEN];
char msg[MAX_MSGLEN * 2];
@@ -118,17 +122,15 @@ void LogManager::Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
if (!log->IsEnabled() || level > log->GetLevel() || ! log->HasListeners())
return;
- CharArrayFromFormatV(temp, MAX_MSGLEN, format, args);
+ CharArrayFromFormatV(temp, MAX_MSGLEN, fmt, args);
- static const char level_to_char[7] = "-NEWID";
- sprintf(msg, "%s %s:%u %c[%s]: %s\n",
- Common::Timer::GetTimeFormatted().c_str(),
- file, line, level_to_char[(int)level],
- log->GetShortName(), temp);
+ static const char level_to_char[7] = "ONEWID";
+ sprintf(msg, "%s %s:%u %c[%s] %s: %s\n", Common::Timer::GetTimeFormatted().c_str(), file, line,
+ level_to_char[(int)level], log->GetShortName(), function, temp);
+
#ifdef ANDROID
Host_SysMessage(msg);
#endif
- printf(msg); // TODO(ShizZy): RemoveMe when I no longer need this
log->Trigger(level, msg);
}
@@ -148,7 +150,7 @@ LogContainer::LogContainer(const char* shortName, const char* fullName, bool ena
{
strncpy(m_fullName, fullName, 128);
strncpy(m_shortName, shortName, 32);
- m_level = (LogTypes::LOG_LEVELS)MAX_LOGLEVEL;
+ m_level = LogTypes::MAX_LOGLEVEL;
}
// LogContainer
diff --git a/src/common/log_manager.h b/src/common/log_manager.h
index 580860b4d..6d3d7c7ff 100644
--- a/src/common/log_manager.h
+++ b/src/common/log_manager.h
@@ -97,10 +97,10 @@ private:
~LogManager();
public:
- static u32 GetMaxLevel() { return MAX_LOGLEVEL; }
+ static u32 GetMaxLevel() { return LogTypes::MAX_LOGLEVEL; }
- void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
- const char *file, int line, const char *fmt, va_list args);
+ void Log(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type, const char* file, int line,
+ const char* function, const char *fmt, va_list args);
void SetLogLevel(LogTypes::LOG_TYPE type, LogTypes::LOG_LEVELS level)
{
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 8a4975dd0..ddf64ef46 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -34,6 +34,7 @@ set(SRCS core.cpp
hle/config_mem.cpp
hle/coprocessor.cpp
hle/svc.cpp
+ hle/kernel/event.cpp
hle/kernel/kernel.cpp
hle/kernel/mutex.cpp
hle/kernel/shared_memory.cpp
@@ -41,6 +42,7 @@ set(SRCS core.cpp
hle/service/apt.cpp
hle/service/gsp.cpp
hle/service/hid.cpp
+ hle/service/ndm.cpp
hle/service/service.cpp
hle/service/srv.cpp
hw/gpu.cpp
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 34a2eba1b..be677ae20 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -89,6 +89,9 @@ public:
*/
virtual void LoadContext(const ThreadContext& ctx) = 0;
+ /// Prepare core for thread reschedule (if needed to correctly handle state)
+ virtual void PrepareReschedule() = 0;
+
/// Getter for num_instructions
u64 GetNumInstructions() {
return num_instructions;
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index 17f787b86..0e893f182 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -98,7 +98,7 @@ u64 ARM_Interpreter::GetTicks() const {
* @param num_instructions Number of instructions to executes
*/
void ARM_Interpreter::ExecuteInstructions(int num_instructions) {
- state->NumInstrsToExecute = num_instructions;
+ state->NumInstrsToExecute = num_instructions - 1;
ARMul_Emulate32(state);
}
@@ -118,6 +118,9 @@ void ARM_Interpreter::SaveContext(ThreadContext& ctx) {
ctx.fpscr = state->VFP[1];
ctx.fpexc = state->VFP[2];
+
+ ctx.reg_15 = state->Reg[15];
+ ctx.mode = state->NextInstr;
}
/**
@@ -137,6 +140,11 @@ void ARM_Interpreter::LoadContext(const ThreadContext& ctx) {
state->VFP[1] = ctx.fpscr;
state->VFP[2] = ctx.fpexc;
- state->Reg[15] = ctx.pc;
- state->NextInstr = RESUME;
+ state->Reg[15] = ctx.reg_15;
+ state->NextInstr = ctx.mode;
+}
+
+/// Prepare core for thread reschedule (if needed to correctly handle state)
+void ARM_Interpreter::PrepareReschedule() {
+ state->NumInstrsToExecute = 0;
}
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index 6a531e497..1e82883a2 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -72,6 +72,9 @@ public:
*/
void LoadContext(const ThreadContext& ctx);
+ /// Prepare core for thread reschedule (if needed to correctly handle state)
+ void PrepareReschedule();
+
protected:
/**
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index e5dc7bd44..f3c14e608 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -4456,6 +4456,7 @@ ARMul_Emulate26 (ARMul_State * state)
}
/* Drop through. */
+ case 0xe0:
case 0xe4:
case 0xe6:
case 0xe8:
@@ -4489,7 +4490,6 @@ ARMul_Emulate26 (ARMul_State * state)
/* Co-Processor Register Transfers (MRC) and Data Ops. */
- case 0xe0:
case 0xe1:
case 0xe3:
case 0xe5:
@@ -4533,23 +4533,7 @@ ARMul_Emulate26 (ARMul_State * state)
case 0xfd:
case 0xfe:
case 0xff:
- if (instr == ARMul_ABORTWORD
- && state->AbortAddr == pc) {
- /* A prefetch abort. */
- XScale_set_fsr_far (state,
- ARMul_CP15_R5_MMU_EXCPT,
- pc);
- ARMul_Abort (state,
- ARMul_PrefetchAbortV);
- break;
- }
- //sky_pref_t* pref = get_skyeye_pref();
- //if(pref->user_mode_sim){
- // ARMul_OSHandleSWI (state, BITS (0, 23));
- // break;
- //}
HLE::CallSVC(instr);
- ARMul_Abort (state, ARMul_SWIV);
break;
}
}
diff --git a/src/core/core.cpp b/src/core/core.cpp
index f88bcd704..7dc0809d0 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -9,21 +9,24 @@
#include "core/core.h"
#include "core/mem_map.h"
#include "core/hw/hw.h"
+#include "core/hw/gpu.h"
#include "core/arm/disassembler/arm_disasm.h"
#include "core/arm/interpreter/arm_interpreter.h"
+#include "core/hle/hle.h"
#include "core/hle/kernel/thread.h"
namespace Core {
-ARM_Disasm* g_disasm = NULL; ///< ARM disassembler
-ARM_Interface* g_app_core = NULL; ///< ARM11 application core
-ARM_Interface* g_sys_core = NULL; ///< ARM11 system (OS) core
+u64 g_last_ticks = 0; ///< Last CPU ticks
+ARM_Disasm* g_disasm = nullptr; ///< ARM disassembler
+ARM_Interface* g_app_core = nullptr; ///< ARM11 application core
+ARM_Interface* g_sys_core = nullptr; ///< ARM11 system (OS) core
/// Run the core CPU loop
void RunLoop() {
for (;;){
- g_app_core->Run(100);
+ g_app_core->Run(GPU::kFrameTicks);
HW::Update();
Kernel::Reschedule();
}
@@ -32,8 +35,14 @@ void RunLoop() {
/// Step the CPU one instruction
void SingleStep() {
g_app_core->Step();
- HW::Update();
- Kernel::Reschedule();
+
+ // Update and reschedule after approx. 1 frame
+ u64 current_ticks = Core::g_app_core->GetTicks();
+ if ((current_ticks - g_last_ticks) >= GPU::kFrameTicks || HLE::g_reschedule) {
+ g_last_ticks = current_ticks;
+ HW::Update();
+ Kernel::Reschedule();
+ }
}
/// Halt the core
@@ -54,6 +63,8 @@ int Init() {
g_app_core = new ARM_Interpreter();
g_sys_core = new ARM_Interpreter();
+ g_last_ticks = Core::g_app_core->GetTicks();
+
return 0;
}
diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj
index 2c4e48032..6572d7bb4 100644
--- a/src/core/core.vcxproj
+++ b/src/core/core.vcxproj
@@ -178,6 +178,7 @@
+
@@ -185,6 +186,7 @@
+
@@ -229,6 +231,7 @@
+
@@ -236,6 +239,7 @@
+
@@ -253,4 +257,4 @@
-
\ No newline at end of file
+
diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters
index 63cfc5194..fdf4f4c82 100644
--- a/src/core/core.vcxproj.filters
+++ b/src/core/core.vcxproj.filters
@@ -167,9 +167,13 @@
hw
+
+ hle\kernel
hle\kernel
+
+ hle\service
@@ -301,6 +305,12 @@
hle\kernel
+
+ hle\kernel
+
+
+ hle\service
+
hw
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp
index 48aa878cc..8c898b265 100644
--- a/src/core/hle/config_mem.cpp
+++ b/src/core/hle/config_mem.cpp
@@ -55,7 +55,7 @@ inline void Read(T &var, const u32 addr) {
break;
default:
- ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr);
+ ERROR_LOG(HLE, "unknown addr=0x%08X", addr);
}
}
diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp
index 39674ee64..9a5b0deda 100644
--- a/src/core/hle/coprocessor.cpp
+++ b/src/core/hle/coprocessor.cpp
@@ -25,7 +25,7 @@ s32 CallMRC(u32 instruction) {
return GetThreadCommandBuffer();
default:
- //DEBUG_LOG(OSHLE, "unknown MRC call 0x%08X", instruction);
+ DEBUG_LOG(OSHLE, "unknown MRC call 0x%08X", instruction);
break;
}
return -1;
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index 801865d49..0bed78653 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -1,19 +1,6 @@
-// Copyright (c) 2012- PPSSPP Project.
-
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 2.0 or later versions.
-
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License 2.0 for more details.
-
-// A copy of the GPL 2.0 should have been included with the program.
-// If not, see http://www.gnu.org/licenses/
-
-// Official git repository and contact information can be found at
-// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
#pragma once
@@ -21,725 +8,107 @@
#include "core/mem_map.h"
#include "core/hle/hle.h"
-// For easy parameter parsing and return value processing.
+namespace HLE {
-//32bit wrappers
-template void WrapV_V() {
- func();
+#define PARAM(n) Core::g_app_core->GetReg(n)
+#define RETURN(n) Core::g_app_core->SetReg(0, n)
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function wrappers that return type s32
+
+template void Wrap() {
+ RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3)));
}
-template void WrapU_V() {
+template void Wrap() {
+ RETURN(func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4)));
+}
+
+template void Wrap(){
+ u32 param_1 = 0;
+ u32 retval = func(¶m_1, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
+ Core::g_app_core->SetReg(1, param_1);
+ RETURN(retval);
+}
+
+template void Wrap() {
+ s32 param_1 = 0;
+ s32 retval = func(¶m_1, (Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2),
+ (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)));
+ Core::g_app_core->SetReg(1, (u32)param_1);
+ RETURN(retval);
+}
+
+// TODO(bunnei): Is this correct? Probably not
+template void Wrap() {
+ RETURN(func(PARAM(5), PARAM(1), PARAM(2), PARAM(3), (((s64)PARAM(4) << 32) | PARAM(0))));
+}
+
+template void Wrap() {
+ RETURN(func(PARAM(0), (((s64)PARAM(3) << 32) | PARAM(2))));
+}
+
+template void Wrap(){
+ RETURN(func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2)));
+}
+
+template void Wrap(){
+ s32 param_1 = 0;
+ u32 retval = func(¶m_1, PARAM(1));
+ Core::g_app_core->SetReg(1, param_1);
+ RETURN(retval);
+}
+
+template void Wrap() {
+ RETURN(func(PARAM(0), (s32)PARAM(1)));
+}
+
+template void Wrap(){
+ u32 param_1 = 0;
+ u32 retval = func(¶m_1, PARAM(1));
+ Core::g_app_core->SetReg(1, param_1);
+ RETURN(retval);
+}
+
+template void Wrap() {
+ RETURN(func(PARAM(0)));
+}
+
+template void Wrap() {
+ RETURN(func(Memory::GetPointer(PARAM(0))));
+}
+
+template void Wrap(){
+ RETURN(func((s64*)Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)),
+ (s32)PARAM(3)));
+}
+
+template void Wrap() {
+ u32 param_1 = 0;
+ u32 retval = func(¶m_1, Memory::GetCharPointer(PARAM(1)));
+ Core::g_app_core->SetReg(1, param_1);
+ RETURN(retval);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////////
+// Function wrappers that return type u32
+
+template void Wrap() {
RETURN(func());
}
-template void WrapI_VC() {
- u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)));
- RETURN(retval);
-}
-
-template void WrapU_IVI() {
- u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_CIIU() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_ICUVVUI() {
- u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)),Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
- RETURN(retval);
-}
-
-// Hm, do so many params get passed in registers?
-template void WrapI_CICIIIII() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), Memory::GetCharPointer(PARAM(2)),
- PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7));
- RETURN(retval);
-}
-
-// Hm, do so many params get passed in registers?
-template void WrapI_CIIIIII() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-// Hm, do so many params get passed in registers?
-template void WrapI_IIIIIIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-// Hm, do so many params get passed in registers?
-template void WrapI_IIIIIIIIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6), PARAM(7), PARAM(8));
- RETURN(retval);
-}
-
-template void WrapU_IV() {
- u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)));
- RETURN(retval);
-}
-
-template void WrapU_U() {
- u32 retval = func(PARAM(0));
- RETURN(retval);
-}
-
-template void WrapU_UI() {
- u32 retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_U() {
- int retval = func(PARAM(0));
- RETURN(retval);
-}
-
-template void WrapI_UI() {
- int retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_UIIU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_IUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_UU() {
- int retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_UUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_UUUI() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UUUIIII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-template void WrapI_UUUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UUUUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_V() {
- u32 retval = func(Memory::GetPointer(PARAM(0)));
- RETURN(retval);
-}
-
-template void WrapU_I() {
- u32 retval = func(PARAM(0));
- RETURN(retval);
-}
-
-template void WrapU_IIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_I() {
- int retval = func(PARAM(0));
- RETURN(retval);
-}
-
-template void WrapV_U() {
- func(PARAM(0));
-}
-
-template void WrapV_I() {
- func(PARAM(0));
-}
-
-template void WrapV_UU() {
- func(PARAM(0), PARAM(1));
-}
-
-template void WrapV_II() {
- func(PARAM(0), PARAM(1));
-}
-
-template void WrapV_UC() {
- func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
-}
-
-template void WrapI_UC() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
- RETURN(retval);
-}
-
-template void WrapI_UCI() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_UIIIII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapU_UIIIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_UIIIIII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-template void WrapU_UU() {
- u32 retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapU_UUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_UUII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_CUUU() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapV_UIUII() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
-}
-
-template void WrapU_UIUII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_UIUII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_UIUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UIUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_UIUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_UIIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UIIUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_UUII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UUIII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapV_UIII() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
-}
-
-template void WrapV_UIIIII() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
-}
-
-template void WrapV_UII() {
- func(PARAM(0), PARAM(1), PARAM(2));
-}
-
-template void WrapU_IU() {
- int retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_IU() {
- int retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_UUI() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_UUIU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_II() {
- int retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_III() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_IUI() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_IIII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_UIII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_IIIUI() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_IUUII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_ICIUU() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_IIU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapV_IU() {
- func(PARAM(0), PARAM(1));
-}
-
-template void WrapV_UI() {
- func(PARAM(0), PARAM(1));
-}
-
-template void WrapU_C() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)));
- RETURN(retval);
-}
-
-template void WrapU_CCCU() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)),
- Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)),
- PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_C() {
- int retval = func(Memory::GetCharPointer(PARAM(0)));
- RETURN(retval);
-}
-
-template void WrapI_CU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_CUI() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_ICIU() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_CIU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_CUU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_CUUU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_CCII() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_CUUIUU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapI_CIIUII() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapI_CIUUU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_CUUUUU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapU_CU() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
- RETURN((u32) retval);
-}
-
-template void WrapU_UC() {
- u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
- RETURN(retval);
-}
-
-template void WrapU_CUU() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN((u32) retval);
-}
-
-template void WrapU_III() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_II() {
- u32 retval = func(PARAM(0), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapU_IIII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_IUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_IUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_IUUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_UUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapV_IUU() {
- func(PARAM(0), PARAM(1), PARAM(2));
-}
-
-template void WrapV_IIU() {
- func(PARAM(0), PARAM(1), PARAM(2));
-}
-
-template void WrapV_UIU() {
- func(PARAM(0), PARAM(1), PARAM(2));
-}
-
-template void WrapI_UIU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapV_IUUUU() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
-}
-
-template void WrapV_UUU() {
- func(PARAM(0), PARAM(1), PARAM(2));
-}
-
-template void WrapV_UUUU() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
-}
-
-template void WrapV_CUIU() {
- func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
-}
-
-template void WrapI_CUIU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapV_UCUIU() {
- func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3),
- PARAM(4));
-}
-
-template void WrapI_UCUIU() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2),
- PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapV_CUIIU() {
- func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2), PARAM(3),
- PARAM(4));
-}
-
-template void WrapI_CUIIU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_UUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UCUU() {
- u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UUUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UUUIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_UUUIUI() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapU_UUIU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapU_UIII() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_IUUUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_IUUUUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapI_IUII() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-template void WrapU_UUUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapV_UUUUU() {
- func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
-}
+////////////////////////////////////////////////////////////////////////////////////////////////////
+/// Function wrappers that return type void
-template void WrapU_CC() {
- int retval = func(Memory::GetCharPointer(PARAM(0)),
- Memory::GetCharPointer(PARAM(1)));
- RETURN(retval);
+template void Wrap() {
+ func(((s64)PARAM(1) << 32) | PARAM(0));
}
-template void WrapV_C() {
+template void Wrap() {
func(Memory::GetCharPointer(PARAM(0)));
}
-template void WrapV_CI() {
- func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
-}
+#undef PARAM
+#undef RETURN
-template void WrapU_CI() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapU_CII() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_CIUIU() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapU_CIUIUI() {
- u32 retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2),
- PARAM(3), PARAM(4), PARAM(5));
- RETURN(retval);
-}
-
-template void WrapU_UUUUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4),
- PARAM(5));
- RETURN(retval);
-}
-
-template void WrapI_IUUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_IUU() {
- int retval = func(PARAM(0), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapU_UUUUUUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-template void WrapI_UIUU() {
- u32 retval = func(PARAM(0), PARAM(1), PARAM(2), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_IC() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)));
- RETURN(retval);
-}
-
-template void WrapI_ICCUI() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_ICCI() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), Memory::GetCharPointer(PARAM(2)), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_CII() {
- int retval = func(Memory::GetCharPointer(PARAM(0)), PARAM(1), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_ICI() {
- int retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_IVVVVUI(){
- u32 retval = func(PARAM(0), Memory::GetPointer(PARAM(1)), Memory::GetPointer(PARAM(2)), Memory::GetPointer(PARAM(3)), Memory::GetPointer(PARAM(4)), PARAM(5), PARAM(6) );
- RETURN(retval);
-}
-
-template void WrapI_ICUVIII(){
- u32 retval = func(PARAM(0), Memory::GetCharPointer(PARAM(1)), PARAM(2), Memory::GetPointer(PARAM(3)), PARAM(4), PARAM(5), PARAM(6));
- RETURN(retval);
-}
-
-template void WrapI_VU(){
- u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1));
- RETURN(retval);
-}
-
-template void WrapI_VVU(){
- u32 retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2));
- RETURN(retval);
-}
-
-template void WrapI_VUVI(){
- u32 retval = func(Memory::GetPointer(PARAM(0)), PARAM(1), Memory::GetPointer(PARAM(2)), PARAM(3));
- RETURN(retval);
-}
-
-template void WrapI_VUUUUU(){
- u32 retval = func(NULL, PARAM(0), PARAM(1), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
-
-template void WrapI_US64() {
- int retval = func(PARAM(0), PARAM64(1));
- RETURN(retval);
-}
-
-template void WrapI_VVUUS64() {
- int retval = func(Memory::GetPointer(PARAM(0)), Memory::GetPointer(PARAM(1)), PARAM(2), PARAM(3), PARAM(4));
- RETURN(retval);
-}
+} // namespace HLE
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index 080c36abf..53cda4a61 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -7,6 +7,7 @@
#include "core/mem_map.h"
#include "core/hle/hle.h"
#include "core/hle/svc.h"
+#include "core/hle/kernel/thread.h"
#include "core/hle/service/service.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -15,11 +16,13 @@ namespace HLE {
static std::vector g_module_db;
+bool g_reschedule = false; ///< If true, immediately reschedules the CPU to a new thread
+
const FunctionDef* GetSVCInfo(u32 opcode) {
u32 func_num = opcode & 0xFFFFFF; // 8 bits
if (func_num > 0xFF) {
- ERROR_LOG(HLE,"Unknown SVC: 0x%02X", func_num);
- return NULL;
+ ERROR_LOG(HLE,"unknown svc=0x%02X", func_num);
+ return nullptr;
}
return &g_module_db[0].func_table[func_num];
}
@@ -33,19 +36,16 @@ void CallSVC(u32 opcode) {
if (info->func) {
info->func();
} else {
- ERROR_LOG(HLE, "Unimplemented SVC function %s(..)", info->name.c_str());
+ ERROR_LOG(HLE, "unimplemented SVC function %s(..)", info->name.c_str());
}
}
-void EatCycles(u32 cycles) {
- // TODO: ImplementMe
-}
-
-void ReSchedule(const char *reason) {
+void Reschedule(const char *reason) {
#ifdef _DEBUG
- _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "ReSchedule: Invalid or too long reason.");
+ _dbg_assert_msg_(HLE, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
#endif
- // TODO: ImplementMe
+ Core::g_app_core->PrepareReschedule();
+ g_reschedule = true;
}
void RegisterModule(std::string name, int num_functions, const FunctionDef* func_table) {
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index c075147c3..bf4d84575 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -9,14 +9,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-#define PARAM(n) Core::g_app_core->GetReg(n)
-#define PARAM64(n) (Core::g_app_core->GetReg(n) | ((u64)Core::g_app_core->GetReg(n + 1) << 32))
-#define RETURN(n) Core::g_app_core->SetReg(0, n)
-
-////////////////////////////////////////////////////////////////////////////////////////////////////
-
namespace HLE {
+extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
+
typedef u32 Addr;
typedef void (*Func)();
@@ -36,9 +32,7 @@ void RegisterModule(std::string name, int num_functions, const FunctionDef *func
void CallSVC(u32 opcode);
-void EatCycles(u32 cycles);
-
-void ReSchedule(const char *reason);
+void Reschedule(const char *reason);
void Init();
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
new file mode 100644
index 000000000..127c0cfc6
--- /dev/null
+++ b/src/core/hle/kernel/event.cpp
@@ -0,0 +1,159 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#include