mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 06:05:40 +12:00
Add svcOutputDebugString, booting our first test ROM
This commit is contained in:
parent
91356f1de9
commit
36453629d5
3 changed files with 14 additions and 1 deletions
|
@ -71,6 +71,7 @@ class Kernel {
|
|||
void sendSyncRequest();
|
||||
void svcCloseHandle();
|
||||
void connectToPort();
|
||||
void outputDebugString();
|
||||
|
||||
public:
|
||||
Kernel(std::array<u32, 16>& regs, Memory& mem) : regs(regs), mem(mem), handleCounter(0), serviceManager(regs, mem) {
|
||||
|
|
|
@ -12,6 +12,7 @@ void Kernel::serviceSVC(u32 svc) {
|
|||
case 0x38: getResourceLimit(); break;
|
||||
case 0x39: getResourceLimitLimitValues(); break;
|
||||
case 0x3A: getResourceLimitCurrentValues(); break;
|
||||
case 0x3D: outputDebugString(); break;
|
||||
default: Helpers::panic("Unimplemented svc: %X @ %08X", svc, regs[15]); break;
|
||||
}
|
||||
}
|
||||
|
@ -87,6 +88,17 @@ void Kernel::svcCloseHandle() {
|
|||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
// OutputDebugString(const char* str, int size)
|
||||
// TODO: Does this actually write an error code in r0?
|
||||
void Kernel::outputDebugString() {
|
||||
const u32 pointer = regs[0];
|
||||
const u32 size = regs[1];
|
||||
|
||||
std::string message = mem.readString(pointer, size);
|
||||
printf("OutputDebugString(message = \"%s\")\n", message.c_str());
|
||||
regs[0] = SVCResult::Success;
|
||||
}
|
||||
|
||||
std::string Kernel::getProcessName(u32 pid) {
|
||||
if (pid == KernelHandles::CurrentProcess) {
|
||||
return "current";
|
||||
|
|
|
@ -7,7 +7,7 @@ int main (int argc, char *argv[]) {
|
|||
Helpers::panic("Failed to initialize OpenGL");
|
||||
}
|
||||
|
||||
auto elfPath = std::filesystem::current_path() / (argc > 1 ? argv[1] : "simple_tri.elf");
|
||||
auto elfPath = std::filesystem::current_path() / (argc > 1 ? argv[1] : "OutputDebugString.elf");
|
||||
if (!emu.loadELF(elfPath)) {
|
||||
Helpers::panic("Failed to load ELF file: %s", elfPath.c_str());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue