Small things
This commit is contained in:
@@ -38,7 +38,7 @@ void KaizenGui::QueryDevices(SDL_Event event) {
|
||||
|
||||
void KaizenGui::HandleInput(SDL_Event event) {
|
||||
n64::Core& core = n64::Core::GetInstance();
|
||||
n64::PIF &pif = core.GetMem().mmio.si.pif;
|
||||
n64::PIF &pif = n64::Core::GetMem().mmio.si.pif;
|
||||
switch(event.type) {
|
||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||
if(!gamepad)
|
||||
@@ -89,8 +89,6 @@ void KaizenGui::HandleInput(SDL_Event event) {
|
||||
break;
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
case SDL_EVENT_KEY_UP:
|
||||
if(gamepad)
|
||||
break;
|
||||
{
|
||||
auto keys = SDL_GetKeyboardState(nullptr);
|
||||
if((keys[SDL_SCANCODE_LCTRL] || keys[SDL_SCANCODE_RCTRL]) && keys[SDL_SCANCODE_O]) {
|
||||
@@ -115,6 +113,9 @@ void KaizenGui::HandleInput(SDL_Event event) {
|
||||
}
|
||||
}
|
||||
|
||||
if(gamepad)
|
||||
break;
|
||||
|
||||
pif.UpdateButton(0, n64::Controller::Key::Z, keys[SDL_SCANCODE_Z]);
|
||||
pif.UpdateButton(0, n64::Controller::Key::CUp, keys[SDL_SCANCODE_HOME]);
|
||||
pif.UpdateButton(0, n64::Controller::Key::CDown, keys[SDL_SCANCODE_END]);
|
||||
@@ -211,7 +212,7 @@ void KaizenGui::RenderUI() {
|
||||
ImGui::EndMainMenuBar();
|
||||
}
|
||||
|
||||
if(!Util::Error::GetInstance().IsHandled()) {
|
||||
if(!Util::Error::IsHandled()) {
|
||||
ImGui::OpenPopup(Util::Error::GetSeverity().as_c_str());
|
||||
}
|
||||
|
||||
@@ -354,7 +355,7 @@ void KaizenGui::RenderUI() {
|
||||
fileDialogOpen = false;
|
||||
const SDL_DialogFileFilter filters[] = {{"All files", "*"}, {"Nintendo 64 executable", "n64;z64;v64"}, {"Nintendo 64 executable archive", "rar;tar;zip;7z"}};
|
||||
SDL_ShowOpenFileDialog([](void *userdata, const char * const *filelist, int filter) {
|
||||
KaizenGui* kaizen = (KaizenGui*)userdata;
|
||||
auto kaizen = (KaizenGui*)userdata;
|
||||
|
||||
if (!filelist) {
|
||||
panic("An error occured: {}", SDL_GetError());
|
||||
@@ -413,6 +414,6 @@ void KaizenGui::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void KaizenGui::LoadTAS(const std::string &path) const noexcept {
|
||||
void KaizenGui::LoadTAS(const std::string &path) noexcept {
|
||||
n64::Core::GetInstance().LoadTAS(fs::path(path));
|
||||
}
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
SDL_Gamepad* gamepad = nullptr;
|
||||
|
||||
void run();
|
||||
void LoadTAS(const std::string &path) const noexcept;
|
||||
static void LoadTAS(const std::string &path) noexcept;
|
||||
void LoadROM(const std::string &path) noexcept;
|
||||
private:
|
||||
bool aboutOpen = false;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
int main(int argc, char **argv) {
|
||||
KaizenGui kaizenGui;
|
||||
cflags::cflags flags;
|
||||
flags.add_string_callback('\0', "rom", [&kaizenGui](std::string v) { kaizenGui.LoadROM(v); }, "Rom to launch from command-line");
|
||||
flags.add_string_callback('\0', "movie", [&kaizenGui](std::string v) { kaizenGui.LoadTAS(v); }, "Mupen Movie to replay");
|
||||
flags.add_string_callback('\0', "rom", [&kaizenGui](const std::string& v) { kaizenGui.LoadROM(v); }, "Rom to launch from command-line");
|
||||
flags.add_string_callback('\0', "movie", [](const std::string& v) { KaizenGui::LoadTAS(v); }, "Mupen Movie to replay");
|
||||
|
||||
if(!flags.parse(argc, argv)) {
|
||||
return -1;
|
||||
|
||||
@@ -21,6 +21,8 @@ struct Error {
|
||||
case NON_FATAL: return "Error";
|
||||
case UNRECOVERABLE: return "Unrecoverable Error";
|
||||
}
|
||||
|
||||
return "Unknown";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user