mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 22:55:40 +12:00
Merge pull request #338 from wheremyfoodat/y2r
Better KTimer implementation
This commit is contained in:
commit
11f42f8c16
3 changed files with 9 additions and 3 deletions
|
@ -36,6 +36,7 @@ class Kernel {
|
||||||
std::vector<KernelObject> objects;
|
std::vector<KernelObject> objects;
|
||||||
std::vector<Handle> portHandles;
|
std::vector<Handle> portHandles;
|
||||||
std::vector<Handle> mutexHandles;
|
std::vector<Handle> mutexHandles;
|
||||||
|
std::vector<Handle> timerHandles;
|
||||||
|
|
||||||
// Thread indices, sorted by priority
|
// Thread indices, sorted by priority
|
||||||
std::vector<int> threadIndices;
|
std::vector<int> threadIndices;
|
||||||
|
|
|
@ -148,6 +148,7 @@ void Kernel::reset() {
|
||||||
}
|
}
|
||||||
objects.clear();
|
objects.clear();
|
||||||
mutexHandles.clear();
|
mutexHandles.clear();
|
||||||
|
timerHandles.clear();
|
||||||
portHandles.clear();
|
portHandles.clear();
|
||||||
threadIndices.clear();
|
threadIndices.clear();
|
||||||
serviceManager.reset();
|
serviceManager.reset();
|
||||||
|
|
|
@ -9,7 +9,7 @@ Handle Kernel::makeTimer(ResetType type) {
|
||||||
Helpers::panic("Created pulse timer");
|
Helpers::panic("Created pulse timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
// timerHandles.push_back(ret);
|
timerHandles.push_back(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,10 @@ void Kernel::signalTimer(Handle timerHandle, Timer* timer) {
|
||||||
case ResetType::Pulse: Helpers::panic("Signalled pulsing timer"); break;
|
case ResetType::Pulse: Helpers::panic("Signalled pulsing timer"); break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (timer->interval == 0) {
|
||||||
|
cancelTimer(timer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kernel::svcCreateTimer() {
|
void Kernel::svcCreateTimer() {
|
||||||
|
@ -70,8 +74,8 @@ void Kernel::svcCreateTimer() {
|
||||||
void Kernel::svcSetTimer() {
|
void Kernel::svcSetTimer() {
|
||||||
Handle handle = regs[0];
|
Handle handle = regs[0];
|
||||||
// TODO: Is this actually s64 or u64? 3DBrew says s64, but u64 makes more sense
|
// TODO: Is this actually s64 or u64? 3DBrew says s64, but u64 makes more sense
|
||||||
const s64 initial = s64(u64(regs[1]) | (u64(regs[2]) << 32));
|
const s64 initial = s64(u64(regs[2]) | (u64(regs[3]) << 32));
|
||||||
const s64 interval = s64(u64(regs[3]) | (u64(regs[4]) << 32));
|
const s64 interval = s64(u64(regs[1]) | (u64(regs[4]) << 32));
|
||||||
logSVC("SetTimer (handle = %X, initial delay = %llX, interval delay = %llX)\n", handle, initial, interval);
|
logSVC("SetTimer (handle = %X, initial delay = %llX, interval delay = %llX)\n", handle, initial, interval);
|
||||||
|
|
||||||
KernelObject* object = getObject(handle, KernelObjectType::Timer);
|
KernelObject* object = getObject(handle, KernelObjectType::Timer);
|
||||||
|
|
Loading…
Add table
Reference in a new issue