mirror of
https://github.com/JaCzekanski/Avocado.git
synced 2024-05-20 12:57:38 -04:00
debug: fixed Cdrom window
silenced warning
This commit is contained in:
parent
c19e4e407f
commit
249e996e10
|
@ -28,3 +28,10 @@ project "chdr"
|
|||
"4244", -- 'conversion' conversion from 'type1' to 'type2', possible loss of data
|
||||
"4267", -- 'var' : conversion from 'size_t' to 'type', possible loss of data
|
||||
}
|
||||
|
||||
filter "system:linux or system:macosx or system:android"
|
||||
disablewarnings {
|
||||
"unused-parameter",
|
||||
"unused-function",
|
||||
"sign-compare",
|
||||
}
|
|
@ -52,3 +52,9 @@ project "flac"
|
|||
"4334", -- 'operator' : result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
|
||||
"4996", -- The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: new_name.
|
||||
}
|
||||
|
||||
filter "system:linux or system:macosx or system:android"
|
||||
disablewarnings {
|
||||
"unused-parameter",
|
||||
"unused-function",
|
||||
}
|
|
@ -118,17 +118,17 @@ bool Instruction::isBranch() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
std::string reg(int n) {
|
||||
std::string reg(unsigned int n) {
|
||||
if (mapRegisterNames) return regNames[n];
|
||||
return string_format("r%d", n);
|
||||
}
|
||||
|
||||
std::string cop0reg(int n) {
|
||||
std::string cop0reg(unsigned int n) {
|
||||
if (mapRegisterNames && n < cop0RegNames.size()) return cop0RegNames.at(n);
|
||||
return string_format("cop0r%d", n);
|
||||
}
|
||||
|
||||
std::string cop2reg(int n) {
|
||||
std::string cop2reg(unsigned int n) {
|
||||
if (mapRegisterNames && n < cop2RegNames.size()) return cop2RegNames.at(n);
|
||||
return string_format("cop2r%d", n);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,6 @@ struct Instruction {
|
|||
|
||||
extern bool mapRegisterNames;
|
||||
extern bool followPC;
|
||||
std::string reg(int n);
|
||||
std::string reg(unsigned int n);
|
||||
Instruction decodeInstruction(mips::Opcode& i);
|
||||
}; // namespace debugger
|
||||
|
|
|
@ -87,9 +87,9 @@ void CDROM::step() {
|
|||
return;
|
||||
}
|
||||
|
||||
uint8_t minute = rawSector[12];
|
||||
uint8_t second = rawSector[13];
|
||||
uint8_t frame = rawSector[14];
|
||||
// uint8_t minute = rawSector[12];
|
||||
// uint8_t second = rawSector[13];
|
||||
// uint8_t frame = rawSector[14];
|
||||
uint8_t mode = rawSector[15];
|
||||
|
||||
uint8_t file = rawSector[16];
|
||||
|
|
|
@ -82,6 +82,7 @@ uint8_t AnalogController::handle(uint8_t byte) {
|
|||
}
|
||||
|
||||
uint8_t AnalogController::handleReadAnalog(uint8_t byte) {
|
||||
(void)byte;
|
||||
switch (state) {
|
||||
case 2: state++; return 0x5a;
|
||||
case 3: state++; return ~buttons._byte[0];
|
||||
|
@ -152,6 +153,7 @@ uint8_t AnalogController::handleSetLed(uint8_t byte) {
|
|||
}
|
||||
|
||||
uint8_t AnalogController::handleLedStatus(uint8_t byte) {
|
||||
(void)byte;
|
||||
switch (state) {
|
||||
case 2: state++; return 0x5a;
|
||||
case 3: state++; return 1;
|
||||
|
@ -220,6 +222,7 @@ uint8_t AnalogController::handleUnknown46(uint8_t byte) {
|
|||
}
|
||||
|
||||
uint8_t AnalogController::handleUnknown47(uint8_t byte) {
|
||||
(void)byte;
|
||||
switch (state) {
|
||||
case 2: state++; return 0x5a;
|
||||
case 3: state++; return 0;
|
||||
|
|
|
@ -54,6 +54,7 @@ uint8_t DigitalController::handle(uint8_t byte) {
|
|||
}
|
||||
|
||||
uint8_t DigitalController::handleRead(uint8_t byte) {
|
||||
(void)byte;
|
||||
switch (state) {
|
||||
case 2: state++; return 0x5a;
|
||||
case 3: state++; return ~buttons._byte[0];
|
||||
|
|
|
@ -3,5 +3,8 @@
|
|||
namespace peripherals {
|
||||
None::None(int port) : AbstractDevice(Type::None, port) {}
|
||||
|
||||
uint8_t None::handle(uint8_t byte) { return 0xff; }
|
||||
uint8_t None::handle(uint8_t byte) {
|
||||
(void)byte;
|
||||
return 0xff;
|
||||
}
|
||||
}; // namespace peripherals
|
|
@ -6,17 +6,29 @@ namespace disc {
|
|||
struct Empty : public Disc {
|
||||
~Empty() = default;
|
||||
|
||||
Sector read(Position pos) { return std::make_pair(std::vector<uint8_t>(), TrackType::INVALID); }
|
||||
Sector read(Position pos) {
|
||||
(void)pos;
|
||||
return std::make_pair(std::vector<uint8_t>(), TrackType::INVALID);
|
||||
}
|
||||
|
||||
std::string getFile() const { return "No CD"; }
|
||||
|
||||
size_t getTrackCount() const { return 0; }
|
||||
|
||||
int getTrackByPosition(Position pos) const { return 0; }
|
||||
int getTrackByPosition(Position pos) const {
|
||||
(void)pos;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Position getTrackStart(int track) const { return Position{0, 0, 0}; }
|
||||
Position getTrackStart(int track) const {
|
||||
(void)track;
|
||||
return Position{0, 0, 0};
|
||||
}
|
||||
|
||||
Position getTrackLength(int track) const { return Position{0, 0, 0}; }
|
||||
Position getTrackLength(int track) const {
|
||||
(void)track;
|
||||
return Position{0, 0, 0};
|
||||
}
|
||||
|
||||
Position getDiskSize() const { return Position{0, 0, 0}; }
|
||||
};
|
||||
|
|
|
@ -255,8 +255,10 @@ void gpuLogWindow(System *sys) {
|
|||
auto arguments = entry.args;
|
||||
if (command >= 0x20 && command < 0x40) {
|
||||
auto arg = gpu::PolygonArgs(command);
|
||||
(void)arg; // TODO: Parse Polygon commands
|
||||
} else if (command >= 0x40 && command < 0x60) {
|
||||
auto arg = gpu::LineArgs(command);
|
||||
(void)arg; // TODO: Parse Line commands
|
||||
} else if (command >= 0x60 && command < 0x80) {
|
||||
auto arg = gpu::RectangleArgs(command);
|
||||
int16_t w = arg.getSize();
|
||||
|
|
48
src/platform/windows/gui/debug/cdrom/cdrom.cpp
Normal file
48
src/platform/windows/gui/debug/cdrom/cdrom.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "cdrom.h"
|
||||
#include <imgui.h>
|
||||
#include "disc/empty.h"
|
||||
#include "disc/format/cue.h"
|
||||
#include "system.h"
|
||||
#include "utils/string.h"
|
||||
|
||||
using namespace disc;
|
||||
#define POSITION(x) ((useFrames) ? string_format("%d", (x).toLba()).c_str() : (x).toString().c_str())
|
||||
|
||||
namespace gui::debug::cdrom {
|
||||
|
||||
void Cdrom::cdromWindow(System* sys) {
|
||||
ImGui::Begin("CDROM", &cdromWindowOpen);
|
||||
|
||||
Disc* disc = sys->cdrom->disc.get();
|
||||
|
||||
if (auto noCd = dynamic_cast<Empty*>(disc)) {
|
||||
ImGui::Text("No CD");
|
||||
} else if (auto cue = dynamic_cast<format::Cue*>(disc)) {
|
||||
ImGui::Text("%s", cue->file.c_str());
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
ImGui::Text("Track Pregap Start End Offset Type File");
|
||||
|
||||
ImGuiListClipper clipper((int)cue->getTrackCount());
|
||||
while (clipper.Step()) {
|
||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
auto track = cue->tracks[i];
|
||||
|
||||
auto line = string_format("%5d %-8s %-8s %-8s %-9zu %-5s %s", i + 1, POSITION(track.pregap), POSITION(track.index1),
|
||||
POSITION(track.index1 + Position::fromLba(track.frames)), track.offset,
|
||||
track.type == TrackType::DATA ? "DATA" : "AUDIO", getFilenameExt(track.filename).c_str());
|
||||
|
||||
ImGui::Selectable(line.c_str());
|
||||
}
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
ImGui::Checkbox("Use frames", &useFrames);
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
void Cdrom::displayWindows(System* sys) {
|
||||
if (cdromWindowOpen) cdromWindow(sys);
|
||||
}
|
||||
} // namespace gui::debug::cdrom
|
14
src/platform/windows/gui/debug/cdrom/cdrom.h
Normal file
14
src/platform/windows/gui/debug/cdrom/cdrom.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
struct System;
|
||||
|
||||
namespace gui::debug::cdrom {
|
||||
class Cdrom {
|
||||
bool useFrames = false;
|
||||
void cdromWindow(System* sys);
|
||||
|
||||
public:
|
||||
bool cdromWindowOpen = false;
|
||||
void displayWindows(System* sys);
|
||||
};
|
||||
} // namespace gui::debug::cdrom
|
|
@ -95,7 +95,7 @@ void CPU::debuggerWindow(System* sys) {
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
const int col_num = 4;
|
||||
std::vector<float> columnsWidth(col_num);
|
||||
int n = 0;
|
||||
unsigned int n = 0;
|
||||
|
||||
auto column = [&](const char* reg, uint32_t val) {
|
||||
auto width = glyphSize * 13 + 8;
|
||||
|
|
|
@ -89,11 +89,11 @@ struct Field {
|
|||
};
|
||||
|
||||
void drawRegisterFields(const char* name, const std::vector<Field>& fields) {
|
||||
const int colNum = 3;
|
||||
const size_t colNum = 3;
|
||||
ImVec2 charSize = ImGui::CalcTextSize("_");
|
||||
std::vector<int> columnsWidth(colNum);
|
||||
std::vector<unsigned int> columnsWidth(colNum);
|
||||
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
for (size_t i = 0; i < fields.size(); i++) {
|
||||
auto& f = fields[i];
|
||||
if (f.bits.size() > columnsWidth[0]) {
|
||||
columnsWidth[0] = f.bits.size();
|
||||
|
@ -121,7 +121,7 @@ void drawRegisterFields(const char* name, const std::vector<Field>& fields) {
|
|||
if (ImGui::BeginChild(name, windowSize, true)) {
|
||||
ImGui::Columns(3, name, true);
|
||||
|
||||
for (int i = 0; i < colNum; i++) {
|
||||
for (size_t i = 0; i < colNum; i++) {
|
||||
ImGui::SetColumnWidth(i, columnsWidth[i] * charSize.x + spacing.x);
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ void drawRegisterFields(const char* name, const std::vector<Field>& fields) {
|
|||
|
||||
ImVec4 color(1, 1, 1, 1);
|
||||
if (!f.active) color.w = 0.25;
|
||||
ImGui::TextColored(color, f.value.c_str());
|
||||
ImGui::TextColored(color, "%s", f.value.c_str());
|
||||
ImGui::NextColumn();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
struct System;
|
||||
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
#include <imgui.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <vector>
|
||||
#include "gui.h"
|
||||
#include "system.h"
|
||||
#include "utils/string.h"
|
||||
|
||||
extern bool showCdromWindow;
|
||||
|
||||
#define POSITION(x) ((useFrames) ? string_format("%d", (x).toLba()).c_str() : (x).toString().c_str())
|
||||
|
||||
void cdromWindow(System* sys) {
|
||||
if (!showCdromWindow) {
|
||||
return;
|
||||
}
|
||||
static bool useFrames = false;
|
||||
|
||||
ImGui::Begin("CDROM", &showCdromWindow);
|
||||
|
||||
// auto cue = sys->cdrom->cue;
|
||||
|
||||
// if (cue.file.empty()) {
|
||||
// ImGui::Text("No CD");
|
||||
// } else {
|
||||
// ImGui::Text("%s", cue.file.c_str());
|
||||
|
||||
// ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
|
||||
// ImGui::Text("Track Pregap Start End Offset Type File");
|
||||
|
||||
// ImGuiListClipper clipper((int)cue.getTrackCount());
|
||||
// while (clipper.Step()) {
|
||||
// for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
// auto track = cue.tracks[i];
|
||||
|
||||
// bool nodeOpened
|
||||
// = ImGui::TreeNode((void*)(intptr_t)i, "%02d %-8s %-8s %-8s %-9zu %-5s %s", i, POSITION(track.pregap),
|
||||
// POSITION(track.index1), POSITION(track.index1 + Position::fromLba(track.frames)), track.offset,
|
||||
// track.type == utils::Track::Type::DATA ? "DATA" : "AUDIO", getFilenameExt(track.filename).c_str());
|
||||
|
||||
// if (nodeOpened) {
|
||||
// ImGui::TreePop();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// ImGui::PopStyleVar();
|
||||
|
||||
// ImGui::Checkbox("Use frames", &useFrames);
|
||||
// }
|
||||
ImGui::End();
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
#include <imgui.h>
|
||||
#include "config.h"
|
||||
#include "cpu/gte/gte.h"
|
||||
#include "debug/cdrom/cdrom.h"
|
||||
#include "debug/cpu/cpu.h"
|
||||
#include "debug/gpu/gpu.h"
|
||||
#include "debug/kernel/kernel.h"
|
||||
|
@ -20,7 +21,6 @@ void gpuLogWindow(System* sys);
|
|||
void vramWindow(gpu::GPU* gpu);
|
||||
void watchWindow(System* sys);
|
||||
void ramWindow(System* sys);
|
||||
void cdromWindow(System* sys);
|
||||
void spuWindow(spu::SPU* spu);
|
||||
|
||||
bool showGui = true;
|
||||
|
@ -35,11 +35,11 @@ bool notInitializedWindowShown = false;
|
|||
bool showVramWindow = false;
|
||||
bool showWatchWindow = false;
|
||||
bool showRamWindow = false;
|
||||
bool showCdromWindow = false;
|
||||
bool showSpuWindow = false;
|
||||
|
||||
bool showAboutWindow = false;
|
||||
|
||||
gui::debug::cdrom::Cdrom cdromDebug;
|
||||
gui::debug::cpu::CPU cpuDebug;
|
||||
gui::debug::timers::Timers timersDebug;
|
||||
|
||||
|
@ -119,7 +119,7 @@ void renderImgui(System* sys) {
|
|||
ImGui::MenuItem("Debugger", nullptr, &cpuDebug.debuggerWindowOpen);
|
||||
ImGui::MenuItem("Breakpoints", nullptr, &cpuDebug.breakpointsWindowOpen);
|
||||
ImGui::MenuItem("Watch", nullptr, &showWatchWindow);
|
||||
ImGui::MenuItem("CDROM", nullptr, &showCdromWindow);
|
||||
ImGui::MenuItem("CDROM", nullptr, &cdromDebug.cdromWindowOpen);
|
||||
ImGui::MenuItem("Kernel", nullptr, &showKernelWindow);
|
||||
ImGui::MenuItem("GPU", nullptr, &showGpuWindow);
|
||||
ImGui::MenuItem("SPU", nullptr, &showSpuWindow);
|
||||
|
@ -149,13 +149,13 @@ void renderImgui(System* sys) {
|
|||
if (showRamWindow) ramWindow(sys);
|
||||
if (showVramWindow) vramWindow(sys->gpu.get());
|
||||
if (showWatchWindow) watchWindow(sys);
|
||||
if (showCdromWindow) cdromWindow(sys);
|
||||
if (showKernelWindow) kernelWindow(sys);
|
||||
if (showGpuWindow) gpuWindow(sys);
|
||||
if (showSpuWindow) spuWindow(sys->spu.get());
|
||||
|
||||
timersDebug.displayWindows(sys);
|
||||
cdromDebug.displayWindows(sys);
|
||||
cpuDebug.displayWindows(sys);
|
||||
timersDebug.displayWindows(sys);
|
||||
|
||||
// Options
|
||||
if (showGraphicsOptionsWindow) graphicsOptionsWindow();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "tools.h"
|
||||
|
||||
namespace gui::tools {
|
||||
void Columns(const std::vector<std::string>& list, int col_num) {
|
||||
void Columns(const std::vector<std::string>& list, size_t col_num) {
|
||||
std::vector<float> columnsWidth(col_num);
|
||||
int n = 0;
|
||||
size_t n = 0;
|
||||
|
||||
auto column = [&](const std::string& str) {
|
||||
ImVec2 size = ImGui::CalcTextSize(str.c_str());
|
||||
|
@ -15,7 +15,7 @@ void Columns(const std::vector<std::string>& list, int col_num) {
|
|||
};
|
||||
|
||||
ImGui::Columns(col_num, nullptr, true);
|
||||
for (int c = 0; c < col_num; c++) {
|
||||
for (size_t c = 0; c < col_num; c++) {
|
||||
ImGui::SetColumnWidth(c, columnsWidth[c]);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ Key::Key(std::string& s) {
|
|||
event = event.substr(1);
|
||||
|
||||
auto a = SDL_GameControllerGetAxisFromString(event.c_str());
|
||||
if (a != SDL_CONTROLLER_BUTTON_INVALID) {
|
||||
if (a != SDL_CONTROLLER_AXIS_INVALID) {
|
||||
type = Type::ControllerMove;
|
||||
controller.id = which;
|
||||
controller.axis = a;
|
||||
|
|
|
@ -10,6 +10,8 @@ namespace {
|
|||
SDL_AudioDeviceID dev = 0;
|
||||
|
||||
void audioCallback(void* userdata, Uint8* raw_stream, int len) {
|
||||
(void)userdata;
|
||||
|
||||
for (int i = 0; i < len; i++) raw_stream[i] = 0;
|
||||
|
||||
std::unique_lock<std::mutex> lock(Sound::audioMutex);
|
||||
|
|
|
@ -337,7 +337,7 @@ void OpenGL::renderVertices(gpu::GPU* gpu) {
|
|||
int lastType = gpu::Vertex::Type::Polygon;
|
||||
int begin = 0;
|
||||
int count = 0;
|
||||
for (int i = 0; i < (int)buffer.size(); i++) {
|
||||
for (size_t i = 0; i < buffer.size(); i++) {
|
||||
++count;
|
||||
int type = buffer[i].type;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "texture.h"
|
||||
|
||||
Texture::Texture(int width, int height, GLint internalFormat, GLint dataFormat, GLenum type, bool filter)
|
||||
: width(width), height(height), internalFormat(internalFormat), dataFormat(dataFormat), type(type), success(false) {
|
||||
: width(width), height(height), dataFormat(dataFormat), type(type), success(false) {
|
||||
GLint lastTexture;
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &lastTexture);
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ class Texture {
|
|||
GLuint id;
|
||||
int width;
|
||||
int height;
|
||||
GLint internalFormat;
|
||||
GLint dataFormat;
|
||||
GLenum type;
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ void System::writeMemory32(uint32_t address, uint32_t data) { writeMemory<uint32
|
|||
|
||||
void System::printFunctionInfo(const char* functionNum, const bios::Function& f) {
|
||||
printf(" %s: %s(", functionNum, f.name.c_str());
|
||||
int a = 0;
|
||||
unsigned int a = 0;
|
||||
for (auto arg : f.args) {
|
||||
uint32_t param = cpu->reg[4 + a];
|
||||
if (true) {
|
||||
|
|
Loading…
Reference in a new issue