mirror of
https://github.com/JaCzekanski/Avocado.git
synced 2024-05-20 04:50:32 -04:00
system: added 8MB ram size option
This commit is contained in:
parent
edb3989e11
commit
7112db1437
|
@ -306,6 +306,7 @@ set(SOURCES
|
|||
src/platform/windows/gui/options/bios.cpp
|
||||
src/platform/windows/gui/options/memory_card.cpp
|
||||
src/platform/windows/gui/options/options.cpp
|
||||
src/platform/windows/gui/options/system.cpp
|
||||
src/platform/windows/gui/toasts.cpp
|
||||
src/platform/windows/input/key.cpp
|
||||
src/platform/windows/input/sdl_input_manager.cpp
|
||||
|
|
|
@ -75,6 +75,10 @@ struct avocado_config_t {
|
|||
bool timeTravel = false;
|
||||
} emulator;
|
||||
|
||||
struct {
|
||||
bool ram8mb = false;
|
||||
} system;
|
||||
|
||||
} options;
|
||||
|
||||
struct {
|
||||
|
|
|
@ -20,7 +20,7 @@ struct Segment {
|
|||
};
|
||||
|
||||
namespace segments {
|
||||
Segment RAM = {"RAM", System::RAM_BASE, System::RAM_SIZE};
|
||||
Segment RAM = {"RAM", System::RAM_BASE, System::RAM_SIZE_8MB};
|
||||
Segment EXPANSION = {"EXPANSION", System::EXPANSION_BASE, System::EXPANSION_SIZE};
|
||||
Segment SCRATCHPAD = {"SCRATCHPAD", System::SCRATCHPAD_BASE, System::SCRATCHPAD_SIZE};
|
||||
Segment IO = {"IO", System::IO_BASE, System::IO_SIZE};
|
||||
|
@ -469,7 +469,7 @@ void CPU::watchWindow(System* sys) {
|
|||
|
||||
void CPU::ramWindow(System* sys) {
|
||||
editor.Open = ramWindowOpen;
|
||||
editor.DrawWindow("Ram", sys->ram.data(), System::RAM_SIZE);
|
||||
editor.DrawWindow("Ram", sys->ram.data(), sys->ram.size());
|
||||
ramWindowOpen = editor.Open;
|
||||
}
|
||||
|
||||
|
|
|
@ -217,6 +217,8 @@ void GUI::mainMenu(std::unique_ptr<System>& sys) {
|
|||
if (ImGui::MenuItem("Hotkeys", nullptr)) showHotkeysSetupWindow = true;
|
||||
ImGui::MenuItem("Memory Card", nullptr, &memoryCardOptions.memoryCardWindowOpen);
|
||||
|
||||
ImGui::MenuItem("System", nullptr, &systemOptions.systemWindowOpen);
|
||||
|
||||
bool soundEnabled = config.options.sound.enabled;
|
||||
if (ImGui::MenuItem("Sound", nullptr, &soundEnabled)) {
|
||||
config.options.sound.enabled = soundEnabled;
|
||||
|
@ -307,6 +309,7 @@ void GUI::render(std::unique_ptr<System>& sys) {
|
|||
|
||||
biosOptions.displayWindows();
|
||||
memoryCardOptions.displayWindows(sys.get());
|
||||
systemOptions.displayWindows();
|
||||
|
||||
// Help
|
||||
aboutHelp.displayWindows();
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "options/bios.h"
|
||||
#include "options/memory_card.h"
|
||||
#include "options/options.h"
|
||||
#include "options/system.h"
|
||||
#include "toasts.h"
|
||||
|
||||
struct System;
|
||||
|
@ -36,6 +37,7 @@ class GUI {
|
|||
|
||||
gui::options::Bios biosOptions;
|
||||
gui::options::MemoryCard memoryCardOptions;
|
||||
gui::options::System systemOptions;
|
||||
|
||||
gui::help::About aboutHelp;
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <imgui.h>
|
||||
#include <misc/cpp/imgui_stdlib.h>
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "../../../../system.h"
|
||||
|
||||
namespace gui::options {
|
||||
|
||||
|
|
23
src/platform/windows/gui/options/system.cpp
Normal file
23
src/platform/windows/gui/options/system.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
#include "system.h"
|
||||
#include "config.h"
|
||||
#include <imgui.h>
|
||||
|
||||
namespace gui::options {
|
||||
void System::displayWindows() {
|
||||
if (!systemWindowOpen) return;
|
||||
|
||||
ImGui::Begin("System", &systemWindowOpen, ImGuiWindowFlags_AlwaysAutoResize);
|
||||
|
||||
if (ImGui::Checkbox("8MB ram", &config.options.system.ram8mb)) {
|
||||
bus.notify(Event::System::HardReset{});
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.8f, 0.8f, 0.8f, 1.f));
|
||||
ImGui::Text(
|
||||
"Warning: Changing any of these settings\n"
|
||||
" will result in system hard reset.");
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
}; // namespace gui::options
|
10
src/platform/windows/gui/options/system.h
Normal file
10
src/platform/windows/gui/options/system.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace gui::options {
|
||||
class System {
|
||||
public:
|
||||
bool systemWindowOpen = false;
|
||||
|
||||
void displayWindows();
|
||||
};
|
||||
}; // namespace gui::options
|
|
@ -20,7 +20,7 @@ namespace state {
|
|||
const char* lastSaveName = "last.state";
|
||||
|
||||
struct StateMetadata {
|
||||
inline static const uint32_t SAVESTATE_VERSION = 7;
|
||||
inline static const uint32_t SAVESTATE_VERSION = 8;
|
||||
|
||||
uint32_t version = SAVESTATE_VERSION;
|
||||
std::string biosPath;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
System::System() {
|
||||
bios.fill(0);
|
||||
ram.fill(0);
|
||||
ram.resize(!config.options.system.ram8mb ? RAM_SIZE_2MB : RAM_SIZE_8MB, 0);
|
||||
scratchpad.fill(0);
|
||||
expansion.fill(0);
|
||||
|
||||
|
@ -147,8 +147,8 @@ INLINE T System::readMemory(uint32_t address) {
|
|||
|
||||
uint32_t addr = align_mips<T>(address);
|
||||
|
||||
if (in_range<RAM_BASE, RAM_SIZE * 4>(addr)) {
|
||||
return read_fast<T>(ram.data(), (addr - RAM_BASE) & (RAM_SIZE - 1));
|
||||
if (in_range<RAM_BASE, RAM_SIZE_8MB>(addr)) {
|
||||
return read_fast<T>(ram.data(), (addr - RAM_BASE) & (ram.size() - 1));
|
||||
}
|
||||
if (in_range<EXPANSION_BASE, EXPANSION_SIZE>(addr)) {
|
||||
return read_fast<T>(expansion.data(), addr - EXPANSION_BASE);
|
||||
|
@ -199,8 +199,8 @@ INLINE void System::writeMemory(uint32_t address, T data) {
|
|||
|
||||
uint32_t addr = align_mips<T>(address);
|
||||
|
||||
if (in_range<RAM_BASE, RAM_SIZE * 4>(addr)) {
|
||||
return write_fast<T>(ram.data(), (addr - RAM_BASE) & (RAM_SIZE - 1), data);
|
||||
if (in_range<RAM_BASE, RAM_SIZE_8MB>(addr)) {
|
||||
return write_fast<T>(ram.data(), (addr - RAM_BASE) & (ram.size() - 1), data);
|
||||
}
|
||||
if (in_range<EXPANSION_BASE, EXPANSION_SIZE>(addr)) {
|
||||
return write_fast<T>(expansion.data(), addr - EXPANSION_BASE, data);
|
||||
|
|
|
@ -52,14 +52,15 @@ struct System {
|
|||
static const int IO_BASE = 0x1f801000;
|
||||
|
||||
static const int BIOS_SIZE = 512 * 1024;
|
||||
static const int RAM_SIZE = 2 * 1024 * 1024;
|
||||
static const int RAM_SIZE_2MB = 2 * 1024 * 1024;
|
||||
static const int RAM_SIZE_8MB = 8 * 1024 * 1024;
|
||||
static const int SCRATCHPAD_SIZE = 1024;
|
||||
static const int EXPANSION_SIZE = 1 * 1024 * 1024;
|
||||
static const int IO_SIZE = 0x2000;
|
||||
State state = State::stop;
|
||||
|
||||
std::array<uint8_t, BIOS_SIZE> bios;
|
||||
std::array<uint8_t, RAM_SIZE> ram;
|
||||
std::vector<uint8_t> ram;
|
||||
std::array<uint8_t, SCRATCHPAD_SIZE> scratchpad;
|
||||
std::array<uint8_t, EXPANSION_SIZE> expansion;
|
||||
|
||||
|
|
Loading…
Reference in a new issue