Fix Windows CI (linux still bork)

Update unarr
Add new log options
Minor improvements
This commit is contained in:
SimoneN64
2023-06-12 18:32:13 +02:00
parent 6a7f2e144c
commit 9242fe986f
22 changed files with 157 additions and 174 deletions

View File

@@ -48,20 +48,14 @@ void App::Run() {
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
case SDLK_o: {
nfdchar_t *outpath;
const nfdu8filteritem_t filter{"Nintendo 64 roms/archives", "n64,z64,v64,N64,Z64,V64,zip,tar,rar,7z"};
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
if (result == NFD_OKAY) {
LoadROM(outpath);
NFD_FreePath(outpath);
}
OpenROMDialog(window, core);
} break;
}
break;
case SDL_DROPFILE: {
char *droppedDir = event.drop.file;
if (droppedDir) {
LoadROM(droppedDir);
window.LoadROM(core, droppedDir);
free(droppedDir);
}
} break;

View File

@@ -6,10 +6,6 @@ struct App {
App();
~App() { Util::ClearRPC(); }
void Run();
FORCE_INLINE void LoadROM(const std::string& path) {
window.LoadROM(core, path);
}
private:
n64::Core core;
Window window;
};

View File

@@ -70,6 +70,7 @@ Settings::~Settings() {
void Settings::RenderWidget(bool& show) {
if(show) {
static float oldVolumeL = volumeL, oldVolumeR = volumeR;
ImGui::OpenPopup("Settings");
if(ImGui::BeginPopupModal("Settings", &show)) {
enum class SelectedSetting { Audio, COUNT };
@@ -80,15 +81,36 @@ void Settings::RenderWidget(bool& show) {
switch (selectedSetting) {
case SelectedSetting::Audio:
ImGui::Checkbox("Lock channels", &lockChannels);
ImGui::SliderFloat("Volume L", &volumeL, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
if (!lockChannels) {
ImGui::SliderFloat("Volume R", &volumeR, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
} else {
volumeR = volumeL;
ImGui::Checkbox("Mute", &mute);
if(mute) {
volumeL = 0;
volumeR = 0;
ImGui::BeginDisabled();
ImGui::SliderFloat("Volume R", &volumeR, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
ImGui::SliderFloat("Volume L", &oldVolumeL, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
if (lockChannels) {
oldVolumeR = oldVolumeL;
}
ImGui::SliderFloat("Volume R", &oldVolumeR, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
ImGui::EndDisabled();
} else {
volumeL = oldVolumeL;
volumeR = oldVolumeR;
ImGui::SliderFloat("Volume L", &volumeL, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
if (!lockChannels) {
ImGui::SliderFloat("Volume R", &volumeR, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
} else {
volumeR = volumeL;
ImGui::BeginDisabled();
ImGui::SliderFloat("Volume R", &volumeR, 0, 1, "%.2f", ImGuiSliderFlags_NoInput);
ImGui::EndDisabled();
}
oldVolumeL = volumeL;
oldVolumeR = volumeR;
}
break;
case SelectedSetting::COUNT:
Util::panic("BRUH");

View File

@@ -17,5 +17,6 @@ struct Settings {
private:
float volumeL = 0.0, volumeR = 0.0;
bool lockChannels = true;
bool mute = false;
json settings;
};

View File

@@ -1,6 +1,5 @@
#include <filesystem>
#include <Window.hpp>
#include <nfd.hpp>
#include <Core.hpp>
#include <Audio.hpp>
#include <SDL2/SDL.h>
@@ -171,14 +170,7 @@ void Window::RenderMainMenuBar(n64::Core &core) {
if (ImGui::BeginMenu("File")) {
if (ImGui::MenuItem("Open", "O")) {
nfdchar_t *outpath;
const nfdu8filteritem_t filter{"Nintendo 64 roms", "n64,z64,v64,N64,Z64,V64"};
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
if (result == NFD_OKAY) {
LoadROM(core, outpath);
Util::UpdateRPC(Util::Playing, gameName);
NFD_FreePath(outpath);
}
OpenROMDialog(*this, core);
}
if (ImGui::MenuItem("Dump RDRAM")) {
core.cpu.mem.DumpRDRAM();

View File

@@ -6,6 +6,8 @@
#include <SDL2/SDL.h>
#include <vector>
#include <frontend/imgui/Settings.hpp>
#include <nfd.hpp>
#include "Discord.hpp"
struct Window {
explicit Window(n64::Core& core);
@@ -17,12 +19,12 @@ struct Window {
Settings settings;
void LoadROM(n64::Core& core, const std::string& path);
bool done = false;
std::string gameName{};
private:
bool showSettings = false;
SDL_Window* window{};
std::string windowTitle{"Kaizen"};
std::string shadowWindowTitle{windowTitle};
std::string gameName{};
void InitSDL();
void InitImgui();
void Render(n64::Core& core);
@@ -38,3 +40,13 @@ private:
u32 minImageCount = 2;
};
static void FORCE_INLINE OpenROMDialog(Window& window, n64::Core& core) {
nfdchar_t *outpath;
const nfdu8filteritem_t filter{"Nintendo 64 roms/archives", "n64,z64,v64,N64,Z64,V64,zip,tar,rar,7z"};
nfdresult_t result = NFD_OpenDialog(&outpath, &filter, 1, nullptr);
if (result == NFD_OKAY) {
window.LoadROM(core, outpath);
NFD_FreePath(outpath);
}
}