Skip to content

Commit

Permalink
[CDROM] Add logger before it's too late
Browse files Browse the repository at this point in the history
  • Loading branch information
liuk7071 committed Sep 18, 2023
1 parent 216aecf commit fc2155a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions external/Panda3DS/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Logger {
static auto cpuTraceLogger = Logger<false>("[CPU TRACE] ");
static auto dmaLogger = Logger<false>("[ DMA ] ");
static auto gpuLogger = Logger<false>("[ GPU ] ");
static auto cdromLogger = Logger<true> ("[ CDROM ] ");


#define MAKE_LOG_FUNCTION(functionName, logger) \
Expand Down
10 changes: 10 additions & 0 deletions src/cdrom/cdrom.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include <cdrom.hpp>


MAKE_LOG_FUNCTION(log, cdromLogger)

CDROM::CDROM(Scheduler* scheduler) : scheduler(scheduler) {
statusReg.prmempt = 1; // Parameter fifo empty
statusReg.prmwrdy = 1; // Parameter fifo not full
Expand All @@ -14,6 +16,8 @@ void CDROM::executeCommand(u8 data) {
case CDROMCommands::GetStat: {
response.push(statusCode.raw);
scheduler->push(&int3, scheduler->time + int3Delay, this);

log("GetStat (stat: 0x%02x)\n", statusCode.raw);
break;
}

Expand All @@ -26,6 +30,8 @@ void CDROM::executeCommand(u8 data) {

response.push(statusCode.raw);
scheduler->push(&int3, scheduler->time + int3Delay, this);

log("SetLoc (loc: %d)\n", seekLoc);
break;
}

Expand All @@ -44,6 +50,8 @@ void CDROM::executeCommand(u8 data) {
}

scheduler->push(&int3, scheduler->time + int3Delay, this);

log("Test\n", statusCode.raw);
break;
}

Expand Down Expand Up @@ -74,6 +82,8 @@ void CDROM::executeCommand(u8 data) {

scheduler->push(&int3, scheduler->time + int3Delay, this);
scheduler->push(&int2, scheduler->time + int3Delay + getIDDelay, this);

log("GetID\n", statusCode.raw);
break;
}

Expand Down
1 change: 1 addition & 0 deletions src/cdrom/cdrom.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <helpers.hpp>
#include <logger.hpp>
#include <BitField.hpp>
#include <queue>
#include <scheduler.hpp>
Expand Down

0 comments on commit fc2155a

Please sign in to comment.