mirror of
https://github.com/BluestormDNA/ProjectPSX.git
synced 2025-04-02 10:52:34 -04:00
Minor refactor
This commit is contained in:
parent
a2bd5b5816
commit
33291cb9ad
1 changed files with 7 additions and 17 deletions
|
@ -7,6 +7,8 @@ namespace ProjectPSX {
|
||||||
const int PSX_MHZ = 33868800;
|
const int PSX_MHZ = 33868800;
|
||||||
const int SYNC_CYCLES = 100;
|
const int SYNC_CYCLES = 100;
|
||||||
const int MIPS_UNDERCLOCK = 3; //Testing: This compensates the ausence of HALT instruction on MIPS Architecture, may broke some games.
|
const int MIPS_UNDERCLOCK = 3; //Testing: This compensates the ausence of HALT instruction on MIPS Architecture, may broke some games.
|
||||||
|
const int CYCLES_PER_FRAME = PSX_MHZ / 60;
|
||||||
|
const int SYNC_LOOPS = (CYCLES_PER_FRAME / (SYNC_CYCLES * MIPS_UNDERCLOCK)) + 1;
|
||||||
|
|
||||||
private CPU cpu;
|
private CPU cpu;
|
||||||
private BUS bus;
|
private BUS bus;
|
||||||
|
@ -42,10 +44,7 @@ namespace ProjectPSX {
|
||||||
|
|
||||||
public void RunFrame() {
|
public void RunFrame() {
|
||||||
//A lame mainloop with a workaround to be able to underclock.
|
//A lame mainloop with a workaround to be able to underclock.
|
||||||
int cyclesPerFrame = PSX_MHZ / 60;
|
for (int i = 0; i < SYNC_LOOPS; i++) {
|
||||||
int syncLoops = (cyclesPerFrame / (SYNC_CYCLES * MIPS_UNDERCLOCK)) + 1;
|
|
||||||
|
|
||||||
for (int i = 0; i < syncLoops; i++) {
|
|
||||||
for (int j = 0; j < SYNC_CYCLES; j++) {
|
for (int j = 0; j < SYNC_CYCLES; j++) {
|
||||||
cpu.Run();
|
cpu.Run();
|
||||||
//cpu.handleInterrupts();
|
//cpu.handleInterrupts();
|
||||||
|
@ -55,22 +54,13 @@ namespace ProjectPSX {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void JoyPadUp(GamepadInputsEnum button) {
|
public void JoyPadUp(GamepadInputsEnum button) => controller.handleJoyPadUp(button);
|
||||||
controller.handleJoyPadUp(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void JoyPadDown(GamepadInputsEnum button) {
|
public void JoyPadDown(GamepadInputsEnum button) => controller.handleJoyPadDown(button);
|
||||||
controller.handleJoyPadDown(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void toggleDebug() {
|
public void toggleDebug() {
|
||||||
if (!cpu.debug) {
|
cpu.debug = !cpu.debug;
|
||||||
cpu.debug = true;
|
gpu.debug = !gpu.debug;
|
||||||
gpu.debug = true;
|
|
||||||
} else {
|
|
||||||
cpu.debug = false;
|
|
||||||
gpu.debug = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue