Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/mips/psyqo/gpu.hh
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class GPU {
enum class Interlace { PROGRESSIVE, INTERLACED };
enum class MiscSetting { CLEAR_VRAM, KEEP_VRAM };
void initialize(const Configuration &config);
void reinitialize(const Configuration &config);

static constexpr uint32_t US_PER_HBLANK = 64;
static constexpr unsigned c_chainThreshold = 56;
Expand Down
12 changes: 8 additions & 4 deletions src/mips/psyqo/src/gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,63 +51,67 @@
}
}

void psyqo::GPU::initialize(const psyqo::GPU::Configuration &config) {
void psyqo::GPU::reinitialize(const psyqo::GPU::Configuration &config) {
// Reset
Hardware::GPU::Ctrl = 0;
// FIFO polling mode
Hardware::GPU::Ctrl = 0x04000001;
// Display Mode
Hardware::GPU::Ctrl = 0x08000000 | (config.config.hResolution << 0) | (config.config.vResolution << 2) |
(config.config.videoMode << 3) | (config.config.colorDepth << 4) |
(config.config.videoInterlace << 5) | (config.config.hResolutionExtended << 6);
// Horizontal Range
Hardware::GPU::Ctrl = 0x06000000 | 0x260 | (0xc60 << 12);

// Vertical Range
if (config.config.videoMode == Configuration::VM_NTSC) {
Hardware::GPU::Ctrl = 0x07000000 | 16 | (255 << 10);
} else {
Hardware::GPU::Ctrl = 0x07046c2b;
}

// Display Area
Hardware::GPU::Ctrl = 0x05000000;

COUNTERS[1].mode = 0x100;
COUNTERS[1].value = 0;

if (config.config.videoInterlace == Configuration::VI_ON) {
m_interlaced = true;
m_height = 480;
} else {
m_interlaced = false;
m_height = 240;
}

if (config.config.hResolutionExtended == Configuration::HRE_NORMAL) {
switch (config.config.hResolution) {
case Configuration::HR_256:
m_width = 256;
break;
case Configuration::HR_320:
m_width = 320;
break;
case Configuration::HR_512:
m_width = 512;
break;
case Configuration::HR_640:
m_width = 640;
break;
}
} else {
m_width = 368;
}

if (config.config.videoMode == Configuration::VM_NTSC) {
m_refreshRate = 60;
} else {
m_refreshRate = 50;
}
}

Check warning on line 108 in src/mips/psyqo/src/gpu.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Complex Method

psyqo::GPU::reinitialize has a cyclomatic complexity of 9, threshold = 9 This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

void psyqo::GPU::initialize(const psyqo::GPU::Configuration &config) {
COUNTERS[1].mode = 0x100;
COUNTERS[1].value = 0;

reinitialize(config);

Check notice on line 114 in src/mips/psyqo/src/gpu.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ Getting better: Complex Method

psyqo::GPU::initialize decreases in cyclomatic complexity from 19 to 11, threshold = 9 This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.

Check notice on line 114 in src/mips/psyqo/src/gpu.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ Getting better: Bumpy Road Ahead

psyqo::GPU::initialize decreases from 3 to 2 logical blocks with deeply nested code, threshold is 2 blocks per function The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

// Install VBlank interrupt handler
if (Kernel::isKernelTakenOver()) {
Expand Down
Loading