This commit is contained in:
Simone
2024-01-22 08:50:37 +01:00
parent 346895a86b
commit e42f619896
7 changed files with 17 additions and 37 deletions

View File

@@ -1,4 +1,8 @@
file(GLOB_RECURSE SOURCES *.cpp)
file(GLOB_RECURSE HEADERS *.hpp)
add_library(mmio ${SOURCES} ${HEADERS} ../../../../external/cic_nus_6105/n64_cic_nus_6105.cpp)
find_package(gainput REQUIRED)
add_library(mmio ${SOURCES} ${HEADERS} ../../../../external/cic_nus_6105/n64_cic_nus_6105.cpp)
target_link_libraries(mmio PRIVATE gainput)

View File

@@ -186,6 +186,7 @@ void PIF::ProcessCommands(Mem &mem) {
channel++;
break;
case 1:
UpdateController();
if(!ReadButtons(res)) {
cmd[1] |= 0x80;
}
@@ -333,8 +334,8 @@ void PIF::EepromWrite(const u8* cmd, u8* res, const Mem& mem) {
}
}
void PIF::UpdateController(Controller value) {
joybusDevices[channel].controller = value;
void PIF::UpdateController() {
//joybusDevices[channel].controller = value;
if (joybusDevices[channel].controller.joy_reset) {
joybusDevices[channel].controller.start = false;

View File

@@ -115,7 +115,7 @@ struct PIF {
void CICChallenge();
static void ExecutePIF(Mem& mem, Registers& regs);
static void DoPIFHLE(Mem& mem, Registers& regs, bool pal, CICType cicType);
void UpdateController(Controller);
void UpdateController();
bool ReadButtons(u8*) const;
void ControllerID(u8*) const;
void MempakRead(const u8*, u8*);

View File

@@ -16,6 +16,7 @@ include_directories(
../backend
../backend/core
../backend/core/mmio
../backend/core/mmio/PIF
../backend/core/registers
../backend/core/rsp
../../external/

View File

@@ -10,8 +10,6 @@ MainWindowController::MainWindowController() noexcept {
view.actionStop->setDisabled(true);
view.vulkanWidget->hide();
ConnectSignalsToSlots();
setFocusPolicy(Qt::FocusPolicy::StrongFocus);
setFocus();
}
void MainWindowController::ConnectSignalsToSlots() noexcept {
@@ -57,33 +55,4 @@ void MainWindowController::ConnectSignalsToSlots() noexcept {
"Kaizen is licensed under the BSD 3-clause license.\n"
"Nintendo 64 is a registered trademarks of Nintendo Co., Ltd."));
});
}
void MainWindowController::keyPressEvent(QKeyEvent* e) {
n64::Controller data{};
data.z = (e->key() == Qt::Key::Key_Z);
data.a = (e->key() == Qt::Key::Key_X);
data.b = (e->key() == Qt::Key::Key_C);
data.start = e->key() == Qt::Key::Key_Enter || e->key() == Qt::Key::Key_Return;
data.dp_up = (e->key() == Qt::Key::Key_I);
data.dp_down = (e->key() == Qt::Key::Key_K);
data.dp_left = (e->key() == Qt::Key::Key_J);
data.dp_right = (e->key() == Qt::Key::Key_L);
data.l = (e->key() == Qt::Key::Key_A);
data.r = (e->key() == Qt::Key::Key_S);
data.c_up = (e->key() == Qt::Key::Key_8);
data.c_down = (e->key() == Qt::Key::Key_2);
data.c_left = (e->key() == Qt::Key::Key_4);
data.c_right = (e->key() == Qt::Key::Key_6);
data.joy_y = (e->key() == Qt::Key::Key_Up) ? 127 : 0;
data.joy_y = (e->key() == Qt::Key::Key_Down) ? -127 : 0;
data.joy_x = (e->key() == Qt::Key::Key_Left) ? -127 : 0;
data.joy_x = (e->key() == Qt::Key::Key_Right) ? 127 : 0;
emuThread->core.pause = true;
emuThread->core.cpu->mem.mmio.si.pif.UpdateController(data);
emuThread->core.pause = false;
QWidget::keyPressEvent(e);
setFocus();
}

View File

@@ -15,7 +15,6 @@ public:
EmuThread* emuThread = nullptr;
private:
void ConnectSignalsToSlots() noexcept;
void keyPressEvent(QKeyEvent* event) override;
bool textPauseToggle = false;

View File

@@ -2,6 +2,7 @@
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <MupenMovie.hpp>
int main(int argc, char** argv) {
QApplication app(argc, argv);
@@ -12,11 +13,16 @@ int main(int argc, char** argv) {
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addPositionalArgument("rom", "Rom to launch from command-line");
parser.addPositionalArgument("m64", "Mupen Movie to replay");
parser.process(app);
KaizenQt kaizenQt;
if (!parser.positionalArguments().isEmpty())
if (parser.positionalArguments().size() > 0) {
kaizenQt.LoadROM(parser.positionalArguments().first());
if (parser.positionalArguments().size() > 1) {
LoadTAS(parser.positionalArguments()[1].toStdString().c_str());
}
}
return app.exec();
}