Add Enter/ExitCriticalSection to Periphery code

This commit is contained in:
Jaby 2024-06-03 21:23:04 +02:00
parent cc92b848f9
commit 2623c0c22c
3 changed files with 35 additions and 33 deletions

View File

@ -111,7 +111,7 @@ namespace Assets {
namespace XAAudio {
void play_fox() {
CDXA::play(lba, FOX_XA, 1, true);
CDXA::play(lba, FOX_XA, 0, false);
}
}
}

View File

@ -176,7 +176,6 @@ namespace JabyEngine {
send_read_n0(cur_file.cur_lba);
}
void continue_reading() {
if(current_state == State::BufferFull) {
Command::wait_completed();

View File

@ -1,5 +1,6 @@
#include "../../internal-include/periphery_internal.hpp"
#include <PSX/Periphery/periphery.hpp>
#include <PSX/System/syscalls.hpp>
namespace JabyEngine {
namespace Periphery {
@ -87,6 +88,7 @@ namespace JabyEngine {
void query_controller() {
static constexpr auto TypeIDX = 1;
SysCall::EnterCriticalSection();
Periphery::connect_to(cur_controller_port);
for(uint32_t id = 0; id < Periphery::DeviceCount; id++) {
auto &cur_controller = controller[cur_controller_port][id];
@ -128,6 +130,7 @@ namespace JabyEngine {
if(Configuration::Periphery::include_portB()) {
cur_controller_port ^= 0x1;
}
SysCall::ExitCriticalSection();
}
}
}