Fixing style and inputs

This commit is contained in:
SergioMartin86 2024-07-28 16:52:05 +02:00
parent 6ca0537d45
commit c7f1c233ca
102 changed files with 2483 additions and 1684 deletions

View File

@ -4,10 +4,10 @@
// by eien86
#include <cstdint>
#include <string>
#include <sstream>
#include <jaffarCommon/exceptions.hpp>
#include <jaffarCommon/json.hpp>
#include <sstream>
#include <string>
namespace jaffar
{
@ -22,12 +22,16 @@ struct input_t
port_t port2 = 0;
};
class InputParser
{
public:
enum controller_t { none, joypad, fourscore1, fourscore2 };
public:
enum controller_t
{
none,
joypad,
fourscore1,
fourscore2
};
InputParser(const nlohmann::json &config)
{
@ -35,10 +39,26 @@ public:
{
bool isTypeRecognized = false;
const auto controller1Type = jaffarCommon::json::getString(config, "Controller 1 Type");
if (controller1Type == "None") { _controller1Type = controller_t::none; isTypeRecognized = true; }
if (controller1Type == "Joypad") { _controller1Type = controller_t::joypad; isTypeRecognized = true; }
if (controller1Type == "FourScore1") { _controller1Type = controller_t::fourscore1; isTypeRecognized = true; }
if (controller1Type == "FourScore2") { _controller1Type = controller_t::fourscore2; isTypeRecognized = true; }
if (controller1Type == "None")
{
_controller1Type = controller_t::none;
isTypeRecognized = true;
}
if (controller1Type == "Joypad")
{
_controller1Type = controller_t::joypad;
isTypeRecognized = true;
}
if (controller1Type == "FourScore1")
{
_controller1Type = controller_t::fourscore1;
isTypeRecognized = true;
}
if (controller1Type == "FourScore2")
{
_controller1Type = controller_t::fourscore2;
isTypeRecognized = true;
}
if (isTypeRecognized == false) JAFFAR_THROW_LOGIC("Controller 1 type not recognized: '%s'\n", controller1Type.c_str());
}
@ -46,16 +66,31 @@ public:
{
bool isTypeRecognized = false;
const auto controller2Type = jaffarCommon::json::getString(config, "Controller 2 Type");
if (controller2Type == "None") { _controller2Type = controller_t::none; isTypeRecognized = true; }
if (controller2Type == "Joypad") { _controller2Type = controller_t::joypad; isTypeRecognized = true; }
if (controller2Type == "FourScore1") { _controller2Type = controller_t::fourscore1; isTypeRecognized = true; }
if (controller2Type == "FourScore2") { _controller2Type = controller_t::fourscore2; isTypeRecognized = true; }
if (controller2Type == "None")
{
_controller2Type = controller_t::none;
isTypeRecognized = true;
}
if (controller2Type == "Joypad")
{
_controller2Type = controller_t::joypad;
isTypeRecognized = true;
}
if (controller2Type == "FourScore1")
{
_controller2Type = controller_t::fourscore1;
isTypeRecognized = true;
}
if (controller2Type == "FourScore2")
{
_controller2Type = controller_t::fourscore2;
isTypeRecognized = true;
}
if (isTypeRecognized == false) JAFFAR_THROW_LOGIC("Controller 2 type not recognized: '%s'\n", controller2Type.c_str());
}
}
inline input_t parseInputString(const std::string& inputString) const
inline input_t parseInputString(const std::string &inputString) const
{
// Storage for the input
input_t input;
@ -86,13 +121,12 @@ public:
}
private:
static inline void reportBadInputString(const std::string& inputString)
static inline void reportBadInputString(const std::string &inputString)
{
JAFFAR_THROW_LOGIC("Could not decode input string: '%s'\n", inputString.c_str());
}
static void parseJoyPadInput(uint8_t& code, std::istringstream& ss, const std::string& inputString)
static void parseJoyPadInput(uint8_t &code, std::istringstream &ss, const std::string &inputString)
{
// Currently read character
char c;
@ -141,10 +175,14 @@ public:
if (c == 'A') code |= 0b00000001;
}
static void parseControllerInputs(const controller_t type, port_t& port, std::istringstream& ss, const std::string& inputString)
static void parseControllerInputs(const controller_t type, port_t &port, std::istringstream &ss, const std::string &inputString)
{
// If no controller assigned then, its port is all zeroes.
if (type == controller_t::none) { port = 0; return; }
if (type == controller_t::none)
{
port = 0;
return;
}
// Controller separator
if (ss.get() != '|') reportBadInputString(inputString);
@ -198,7 +236,7 @@ public:
}
}
static void parseConsoleInputs(bool& reset, bool& power, std::istringstream& ss, const std::string& inputString)
static void parseConsoleInputs(bool &reset, bool &power, std::istringstream &ss, const std::string &inputString)
{
// Currently read character
char c;

View File

@ -1,9 +1,9 @@
#pragma once
#include "inputParser.hpp"
#include "jaffarCommon/logger.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/serializers/differential.hpp"
#include "jaffarCommon/logger.hpp"
#include "inputParser.hpp"
// Size of image generated in graphics buffer
static const uint16_t image_width = 256;
@ -12,8 +12,7 @@ static const uint16_t image_height = 240;
class NESInstanceBase
{
public:
NESInstanceBase(const nlohmann::json& config)
NESInstanceBase(const nlohmann::json &config)
{
_inputParser = std::make_unique<jaffar::InputParser>(config);
}
@ -25,7 +24,7 @@ class NESInstanceBase
inline void enableRendering() { _doRendering = true; };
inline void disableRendering() { _doRendering = false; };
inline bool loadROM(const uint8_t* romData, const size_t romSize)
inline bool loadROM(const uint8_t *romData, const size_t romSize)
{
// Actually loading rom file
auto status = loadROMImpl(romData, romSize);
@ -37,7 +36,7 @@ class NESInstanceBase
return status;
}
void enableStateBlock(const std::string& block)
void enableStateBlock(const std::string &block)
{
// Calling implementation
enableStateBlockImpl(block);
@ -46,7 +45,7 @@ class NESInstanceBase
_stateSize = getFullStateSize();
}
void disableStateBlock(const std::string& block)
void disableStateBlock(const std::string &block)
{
// Calling implementation
disableStateBlockImpl(block);
@ -57,27 +56,26 @@ class NESInstanceBase
virtual size_t getFullStateSize() const = 0;
virtual size_t getDifferentialStateSize() const = 0;
inline jaffar::InputParser* getInputParser() const { return _inputParser.get(); }
inline jaffar::InputParser *getInputParser() const { return _inputParser.get(); }
// Virtual functions
virtual uint8_t *getLowMem() const = 0;
virtual size_t getLowMemSize() const = 0;
virtual void serializeState(jaffarCommon::serializer::Base& serializer) const = 0;
virtual void deserializeState(jaffarCommon::deserializer::Base& deserializer) = 0;
virtual void serializeState(jaffarCommon::serializer::Base &serializer) const = 0;
virtual void deserializeState(jaffarCommon::deserializer::Base &deserializer) = 0;
virtual void doSoftReset() = 0;
virtual void doHardReset() = 0;
virtual std::string getCoreName() const = 0;
virtual void *getInternalEmulatorPointer() = 0;
virtual void setNTABBlockSize(const size_t size) { };
virtual void setNTABBlockSize(const size_t size) {};
protected:
virtual void enableStateBlockImpl(const std::string& block) = 0;
virtual void disableStateBlockImpl(const std::string& block) = 0;
virtual bool loadROMImpl(const uint8_t* romData, const size_t romSize) = 0;
virtual void enableStateBlockImpl(const std::string &block) = 0;
virtual void disableStateBlockImpl(const std::string &block) = 0;
virtual bool loadROMImpl(const uint8_t *romData, const size_t romSize) = 0;
// Storage for the light state size
size_t _stateSize;
@ -86,8 +84,6 @@ class NESInstanceBase
bool _doRendering = true;
private:
// Input parser instance
std::unique_ptr<jaffar::InputParser> _inputParser;
};

View File

@ -1,15 +1,15 @@
#pragma once
#include <string>
#include <unistd.h>
#include "nesInstance.hpp"
#include <SDL.h>
#include <SDL_image.h>
#include <extern/hqn/hqn.h>
#include <extern/hqn/hqn_gui_controller.h>
#include <jaffarCommon/serializers/contiguous.hpp>
#include <jaffarCommon/deserializers/contiguous.hpp>
#include <jaffarCommon/hash.hpp>
#include "nesInstance.hpp"
#include <jaffarCommon/serializers/contiguous.hpp>
#include <string>
#include <unistd.h>
#define _INVERSE_FRAME_RATE 16667
@ -106,13 +106,13 @@ class PlaybackInstance
addStep("<End Of Sequence>");
}
void enableRendering(SDL_Window* window)
void enableRendering(SDL_Window *window)
{
// Allocating video buffer
_video_buffer = (uint8_t *)malloc(image_width * image_height);
// Setting video buffer
((emulator_t*)_emu->getInternalEmulatorPointer())->set_pixels(_video_buffer, image_width + 8);
((emulator_t *)_emu->getInternalEmulatorPointer())->set_pixels(_video_buffer, image_width + 8);
// Loading Emulator instance HQN
_hqnState.setEmulatorPointer(_emu->getInternalEmulatorPointer());
@ -233,7 +233,6 @@ class PlaybackInstance
}
private:
// Internal sequence information
std::vector<stepData_t> _stepSequence;

View File

@ -1,12 +1,12 @@
#include <cstdlib>
#include "argparse/argparse.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/deserializers/contiguous.hpp"
#include "jaffarCommon/file.hpp"
#include "jaffarCommon/logger.hpp"
#include "jaffarCommon/serializers/contiguous.hpp"
#include "jaffarCommon/string.hpp"
#include "nesInstance.hpp"
#include "playbackInstance.hpp"
#include <cstdlib>
SDL_Window *launchOutputWindow()
{
@ -120,7 +120,7 @@ int main(int argc, char *argv[])
// Loading ROM File
std::string romFileData;
if (jaffarCommon::file::loadStringFromFile(romFileData, romFilePath) == false) JAFFAR_THROW_LOGIC("Could not rom file: %s\n", romFilePath.c_str());
e.loadROM((uint8_t*)romFileData.data(), romFileData.size());
e.loadROM((uint8_t *)romFileData.data(), romFileData.size());
// If an initial state is provided, load it now
if (stateFilePath != "")
@ -135,7 +135,7 @@ int main(int argc, char *argv[])
auto p = PlaybackInstance(&e);
// If render is enabled then, create window now
SDL_Window* window = nullptr;
SDL_Window *window = nullptr;
if (disableRender == false)
{
window = launchOutputWindow();

View File

@ -1,10 +1,10 @@
#pragma once
#include "jaffarCommon/serializers/base.hpp"
#include "jaffarCommon/deserializers/base.hpp"
#include "../nesInstanceBase.hpp"
#include "core/nes_emu/Nes_Emu.h"
#include "core/nes_emu/Nes_State.h"
#include "../nesInstanceBase.hpp"
#include "jaffarCommon/deserializers/base.hpp"
#include "jaffarCommon/serializers/base.hpp"
#define _DUMMY_SIZE 65536
@ -17,8 +17,7 @@ extern void register_mapper_70();
class NESInstance final : public NESInstanceBase
{
public:
NESInstance(const nlohmann::json& config) : NESInstanceBase(config)
NESInstance(const nlohmann::json &config) : NESInstanceBase(config)
{
// If running the original QuickNES, register extra mappers now
register_misc_mappers();
@ -29,14 +28,14 @@ class NESInstance final : public NESInstanceBase
uint8_t *getLowMem() const override { return _nes.low_mem(); };
size_t getLowMemSize() const override { return 0x800; };
void serializeState(jaffarCommon::serializer::Base& serializer) const override
void serializeState(jaffarCommon::serializer::Base &serializer) const override
{
Mem_Writer w(serializer.getOutputDataBuffer(), _stateSize, 0);
Auto_File_Writer a(w);
_nes.save_state(a);
}
void deserializeState(jaffarCommon::deserializer::Base& deserializer) override
void deserializeState(jaffarCommon::deserializer::Base &deserializer) override
{
Mem_File_Reader r(deserializer.getInputDataBuffer(), _stateSize);
Auto_File_Reader a(r);
@ -68,8 +67,7 @@ class NESInstance final : public NESInstanceBase
}
protected:
bool loadROMImpl(const uint8_t* romData, const size_t romSize) override
bool loadROMImpl(const uint8_t *romData, const size_t romSize) override
{
// Loading rom data
Mem_File_Reader romReader(romData, (int)romSize);
@ -78,12 +76,10 @@ class NESInstance final : public NESInstanceBase
return result == 0;
}
void enableStateBlockImpl(const std::string& block) override {};
void disableStateBlockImpl(const std::string& block) override {};
void enableStateBlockImpl(const std::string &block) override {};
void disableStateBlockImpl(const std::string &block) override {};
private:
// Emulator instance
emulator_t _nes;
};

View File

@ -82,4 +82,4 @@ void Nes_Effects_Buffer::RestoreAudioBufferState()
{
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Effects_Buffer with non-linear sound
// Nes_Emu 0.7.0
#include "effectsBuffer.hpp"
#include "buffer.hpp"
#include "effectsBuffer.hpp"
namespace quickerNES
{
@ -38,4 +38,4 @@ class Nes_Effects_Buffer : public Effects_Buffer
friend Multi_Buffer *set_apu(Nes_Effects_Buffer *, Apu *);
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -372,4 +372,4 @@ int Apu::read_status(nes_time_t time)
return result;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// NES 2A03 APU sound chip emulator
// Snd_Emu 0.1.7
#include "oscs.hpp"
#include <climits>
#include <cstdint>
#include "oscs.hpp"
namespace quickerNES
{
@ -360,4 +360,4 @@ inline void Apu::load_state(apu_state_t const &state)
dmc.run(last_time, last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,11 +1,11 @@
// Blip_Buffer 0.4.0. http://www.slack.net/~ant/
#include "blipBuffer.hpp"
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include "blipBuffer.hpp"
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -419,4 +419,4 @@ void Blip_Buffer::RestoreAudioBufferState()
memcpy(buffer_, extra_buffer, sizeof(extra_buffer));
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -377,4 +377,4 @@ inline int Blip_Reader::begin(Blip_Buffer &blip_buf)
int const blip_max_length = 0;
int const blip_default_length = 250;
} // namespace quickNES
} // namespace quickerNES

View File

@ -227,4 +227,4 @@ void Nonlinearizer::RestoreAudioBufferState()
prev = extra_prev;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// NES non-linear audio buffer
// Emu 0.7.0
#include <cstdint>
#include "multiBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -79,4 +79,4 @@ class Buffer : public Multi_Buffer
virtual void RestoreAudioBufferState();
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,7 +1,7 @@
// Game_Music_Emu 0.3.0. http://www.slack.net/~ant/
#include <cstring>
#include "effectsBuffer.hpp"
#include <cstring>
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -515,4 +515,4 @@ void Effects_Buffer::mix_enhanced(blip_sample_t *out, long count)
r2.end(bufs[6]);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Multi-channel effects buffer with panning, echo and reverb
// Game_Music_Emu 0.3.0
#include <stdint.h>
#include "multiBuffer.hpp"
#include <stdint.h>
namespace quickerNES
{
@ -101,4 +101,4 @@ inline Effects_Buffer::channel_t Effects_Buffer::channel(int i)
return channels[i % chan_count];
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -105,4 +105,4 @@ void Fme7_Apu::run_until(blip_time_t end_time)
last_time = end_time;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Sunsoft FME-7 sound emulator
// Emu 0.7.0
#include <cstdint>
#include "../blipBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -152,4 +152,4 @@ inline void Fme7_Apu::load_state(fme7_apu_state_t const &in)
run_until(last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,8 +1,8 @@
// Blip_Buffer 0.4.0. http://www.slack.net/~ant/
#include <cstdint>
#include "multiBuffer.hpp"
#include <cstdint>
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -284,4 +284,4 @@ void Stereo_Buffer::RestoreAudioBufferState()
right()->RestoreAudioBufferState();
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -199,4 +199,4 @@ inline long Mono_Buffer::read_samples(blip_sample_t *p, long s) { return buf.rea
inline long Mono_Buffer::samples_avail() const { return buf.samples_avail(); }
} // namespace quickNES
} // namespace quickerNES

View File

@ -180,4 +180,4 @@ void Namco_Apu::load_state(namco_state_t const &in)
run_until(last_time);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// Namco 106 sound chip emulator
// Snd_Emu 0.1.7
#include <cstdint>
#include "../apu.hpp"
#include <cstdint>
namespace quickerNES
{
@ -112,4 +112,4 @@ inline void Namco_Apu::write_data(nes_time_t time, int data)
access() = data;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -679,4 +679,4 @@ void Noise::run(nes_time_t time, nes_time_t end_time)
delay = time - end_time;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -169,4 +169,4 @@ struct Dmc : Osc
nes_time_t next_read_time() const;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -212,4 +212,4 @@ void Vrc6_Apu::run_saw(nes_time_t end_time)
osc.last_amp = last_amp;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Konami VRC6 sound chip emulator
// Snd_Emu 0.1.7
#include <cstdint>
#include "../blipBuffer.hpp"
#include "../apu.hpp"
#include "../blipBuffer.hpp"
#include <cstdint>
namespace quickerNES
{
@ -109,4 +109,4 @@ inline void Vrc6_Apu::treble_eq(blip_eq_t const &eq)
square_synth.treble_eq(eq);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,6 +1,6 @@
#include <cstring>
#include "apu_vrc7.hpp"
#include "emu2413.hpp"
#include <cstring>
namespace quickerNES
{
@ -208,4 +208,4 @@ void Vrc7::update_last_amp()
}
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Konami VRC7 sound chip emulator
// Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
#include <cstdint>
#include "../blipBuffer.hpp"
#include "emu2413_state.hpp"
#include <cstdint>
namespace quickerNES
{
@ -76,4 +76,4 @@ inline void Vrc7::osc_output(int i, Blip_Buffer *buf)
oscs[i].output = buf;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -108,7 +108,7 @@ static const unsigned char default_inst[15][8] = {
/* AM speed(Hz) and depth(dB) */
#define AM_SPEED 3.7
//#define AM_DEPTH 4.8
// #define AM_DEPTH 4.8
#define AM_DEPTH 2.4
/* Cut the lower b bit(s) off. */
@ -243,7 +243,7 @@ static void makeDphaseTable(OPLL *opll)
static void makeTllTable(OPLL *opll)
{
#define dB2(x) ((x)*2)
#define dB2(x) ((x) * 2)
static const double kltable[16] = {
dB2(0.000), dB2(9.000), dB2(12.000), dB2(13.875), dB2(15.000), dB2(16.125), dB2(16.875), dB2(17.625), dB2(18.000), dB2(18.750), dB2(19.125), dB2(19.500), dB2(19.875), dB2(20.250), dB2(20.625), dB2(21.000)};
@ -1152,4 +1152,4 @@ void OPLL_writeIO(OPLL *opll, e_uint32 adr, e_uint32 val)
opll->adr = val;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -220,4 +220,4 @@ extern "C"
}
#endif
} // namespace quickNES
} // namespace quickerNES

View File

@ -38,4 +38,4 @@ extern "C"
}
#endif
} // namespace quickNES
} // namespace quickerNES

View File

@ -114,4 +114,4 @@ class Cart
unsigned mapper;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -15,16 +15,16 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Emu 0.7.0
#include <stdexcept>
#include "cpu.hpp"
#include "apu/apu.hpp"
#include "cpu.hpp"
#include "mappers/mapper.hpp"
#include "ppu/ppu.hpp"
#include <cstdio>
#include <string>
#include <cstdint>
#include <jaffarCommon/serializers/base.hpp>
#include <cstdio>
#include <jaffarCommon/deserializers/base.hpp>
#include <jaffarCommon/serializers/base.hpp>
#include <stdexcept>
#include <string>
namespace quickerNES
{
@ -58,7 +58,6 @@ struct nes_state_lite_t
uint8_t frame_count; // number of frames emulated since power-up
};
struct joypad_state_t
{
uint32_t joypad_latches[2]; // joypad 1 & 2 shift registers
@ -84,7 +83,6 @@ class Core : private Cpu
typedef Cpu cpu;
public:
size_t _NTABBlockSize = 0x1000;
// Flags for lite state storage
@ -156,7 +154,7 @@ class Core : private Cpu
reset(true, true);
}
inline void serializeState(jaffarCommon::serializer::Base& serializer) const
inline void serializeState(jaffarCommon::serializer::Base &serializer) const
{
// TIME Block
if (TIMEBlockEnabled == true)
@ -268,7 +266,7 @@ class Core : private Cpu
}
}
inline void deserializeState(jaffarCommon::deserializer::Base& deserializer)
inline void deserializeState(jaffarCommon::deserializer::Base &deserializer)
{
disable_rendering();
error_count = 0;
@ -277,7 +275,7 @@ class Core : private Cpu
// TIME Block
if (TIMEBlockEnabled == true)
{
const auto outputData = (uint8_t*) &nes;
const auto outputData = (uint8_t *)&nes;
const auto inputDataSize = sizeof(nes_state_t);
deserializer.popContiguous(outputData, inputDataSize);
@ -289,7 +287,7 @@ class Core : private Cpu
{
cpu_state_t s;
const auto outputData = (uint8_t*) &s;
const auto outputData = (uint8_t *)&s;
const auto inputDataSize = sizeof(cpu_state_t);
deserializer.popContiguous(outputData, inputDataSize);
@ -304,7 +302,7 @@ class Core : private Cpu
// PPUR Block
if (PPURBlockEnabled == true)
{
const auto outputData = (uint8_t*) &ppu;
const auto outputData = (uint8_t *)&ppu;
const auto inputDataSize = sizeof(ppu_state_t);
deserializer.popContiguous(outputData, inputDataSize);
}
@ -314,7 +312,7 @@ class Core : private Cpu
{
Apu::apu_state_t apuState;
const auto outputData = (uint8_t*) &apuState;
const auto outputData = (uint8_t *)&apuState;
const auto inputDataSize = sizeof(Apu::apu_state_t);
deserializer.popContiguous(outputData, inputDataSize);
@ -325,7 +323,7 @@ class Core : private Cpu
// CTRL Block
if (CTRLBlockEnabled == true)
{
const auto outputData = (uint8_t*) &joypad;
const auto outputData = (uint8_t *)&joypad;
const auto inputDataSize = sizeof(joypad_state_t);
deserializer.popContiguous(outputData, inputDataSize);
}
@ -335,7 +333,7 @@ class Core : private Cpu
{
mapper->default_reset_state();
const auto outputData = (uint8_t*) mapper->state;
const auto outputData = (uint8_t *)mapper->state;
const auto inputDataSize = mapper->state_size;
deserializer.popContiguous(outputData, inputDataSize);
@ -345,7 +343,7 @@ class Core : private Cpu
// LRAM Block
if (LRAMBlockEnabled == true)
{
const auto outputData = (uint8_t*) low_mem;
const auto outputData = (uint8_t *)low_mem;
const auto inputDataSize = low_ram_size;
deserializer.pop(outputData, inputDataSize);
}
@ -353,7 +351,7 @@ class Core : private Cpu
// SPRT Block
if (SPRTBlockEnabled == true)
{
const auto outputData = (uint8_t*) ppu.spr_ram;
const auto outputData = (uint8_t *)ppu.spr_ram;
const auto inputDataSize = Ppu::spr_ram_size;
deserializer.pop(outputData, inputDataSize);
}
@ -361,7 +359,7 @@ class Core : private Cpu
// NTAB Block
if (NTABBlockEnabled == true)
{
const auto outputData = (uint8_t*) ppu.impl->nt_ram;
const auto outputData = (uint8_t *)ppu.impl->nt_ram;
const auto inputDataSize = _NTABBlockSize;
deserializer.pop(outputData, inputDataSize);
}
@ -371,7 +369,7 @@ class Core : private Cpu
{
if (ppu.chr_is_writable)
{
const auto outputData = (uint8_t*) ppu.impl->chr_ram;
const auto outputData = (uint8_t *)ppu.impl->chr_ram;
const auto inputDataSize = ppu.chr_size;
deserializer.pop(outputData, inputDataSize);
@ -384,7 +382,7 @@ class Core : private Cpu
{
if (sram_present)
{
const auto outputData = (uint8_t*) impl->sram;
const auto outputData = (uint8_t *)impl->sram;
const auto inputDataSize = impl->sram_size;
deserializer.pop(outputData, inputDataSize);
}
@ -393,47 +391,141 @@ class Core : private Cpu
if (sram_present) enable_sram(true);
}
void setNTABBlockSize(const size_t size) { _NTABBlockSize = size; }
void setNTABBlockSize(const size_t size) { _NTABBlockSize = size; }
void enableStateBlock(const std::string& block)
{
void enableStateBlock(const std::string &block)
{
bool recognizedBlock = false;
if (block == "TIME") { TIMEBlockEnabled = true; recognizedBlock = true; }
if (block == "CPUR") { CPURBlockEnabled = true; recognizedBlock = true; }
if (block == "PPUR") { PPURBlockEnabled = true; recognizedBlock = true; }
if (block == "APUR") { APURBlockEnabled = true; recognizedBlock = true; }
if (block == "CTRL") { CTRLBlockEnabled = true; recognizedBlock = true; }
if (block == "MAPR") { MAPRBlockEnabled = true; recognizedBlock = true; }
if (block == "LRAM") { LRAMBlockEnabled = true; recognizedBlock = true; }
if (block == "SPRT") { SPRTBlockEnabled = true; recognizedBlock = true; }
if (block == "NTAB") { NTABBlockEnabled = true; recognizedBlock = true; }
if (block == "CHRR") { CHRRBlockEnabled = true; recognizedBlock = true; }
if (block == "SRAM") { SRAMBlockEnabled = true; recognizedBlock = true; }
if (block == "TIME")
{
TIMEBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CPUR")
{
CPURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "PPUR")
{
PPURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "APUR")
{
APURBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CTRL")
{
CTRLBlockEnabled = true;
recognizedBlock = true;
}
if (block == "MAPR")
{
MAPRBlockEnabled = true;
recognizedBlock = true;
}
if (block == "LRAM")
{
LRAMBlockEnabled = true;
recognizedBlock = true;
}
if (block == "SPRT")
{
SPRTBlockEnabled = true;
recognizedBlock = true;
}
if (block == "NTAB")
{
NTABBlockEnabled = true;
recognizedBlock = true;
}
if (block == "CHRR")
{
CHRRBlockEnabled = true;
recognizedBlock = true;
}
if (block == "SRAM")
{
SRAMBlockEnabled = true;
recognizedBlock = true;
}
if (recognizedBlock == false) { fprintf(stderr, "Unrecognized block type: %s\n", block.c_str()); exit(-1);}
};
if (recognizedBlock == false)
{
fprintf(stderr, "Unrecognized block type: %s\n", block.c_str());
exit(-1);
}
};
void disableStateBlock(const std::string& block)
{
void disableStateBlock(const std::string &block)
{
bool recognizedBlock = false;
if (block == "TIME") { TIMEBlockEnabled = false; recognizedBlock = true; }
if (block == "CPUR") { CPURBlockEnabled = false; recognizedBlock = true; }
if (block == "PPUR") { PPURBlockEnabled = false; recognizedBlock = true; }
if (block == "APUR") { APURBlockEnabled = false; recognizedBlock = true; }
if (block == "CTRL") { CTRLBlockEnabled = false; recognizedBlock = true; }
if (block == "MAPR") { MAPRBlockEnabled = false; recognizedBlock = true; }
if (block == "LRAM") { LRAMBlockEnabled = false; recognizedBlock = true; }
if (block == "SPRT") { SPRTBlockEnabled = false; recognizedBlock = true; }
if (block == "NTAB") { NTABBlockEnabled = false; recognizedBlock = true; }
if (block == "CHRR") { CHRRBlockEnabled = false; recognizedBlock = true; }
if (block == "SRAM") { SRAMBlockEnabled = false; recognizedBlock = true; }
if (recognizedBlock == false) { fprintf(stderr, "Unrecognized block type: %s\n", block.c_str()); exit(-1);}
};
if (block == "TIME")
{
TIMEBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CPUR")
{
CPURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "PPUR")
{
PPURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "APUR")
{
APURBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CTRL")
{
CTRLBlockEnabled = false;
recognizedBlock = true;
}
if (block == "MAPR")
{
MAPRBlockEnabled = false;
recognizedBlock = true;
}
if (block == "LRAM")
{
LRAMBlockEnabled = false;
recognizedBlock = true;
}
if (block == "SPRT")
{
SPRTBlockEnabled = false;
recognizedBlock = true;
}
if (block == "NTAB")
{
NTABBlockEnabled = false;
recognizedBlock = true;
}
if (block == "CHRR")
{
CHRRBlockEnabled = false;
recognizedBlock = true;
}
if (block == "SRAM")
{
SRAMBlockEnabled = false;
recognizedBlock = true;
}
if (recognizedBlock == false)
{
fprintf(stderr, "Unrecognized block type: %s\n", block.c_str());
exit(-1);
}
};
void reset(bool full_reset, bool erase_battery_ram)
{
@ -482,9 +574,9 @@ void disableStateBlock(const std::string& block)
nes_time_t emulate_frame(uint32_t joypad1, uint32_t joypad2)
{
#ifdef _QUICKERNES_DETECT_JOYPAD_READS
#ifdef _QUICKERNES_DETECT_JOYPAD_READS
joypad_read_count = 0;
#endif
#endif
current_joypad[0] = joypad1;
current_joypad[1] = joypad2;
@ -612,10 +704,10 @@ void disableStateBlock(const std::string& block)
{
if ((addr & 0xFFFE) == 0x4016)
{
// For performance's sake, this counter is only kept on demand
#ifdef _QUICKERNES_DETECT_JOYPAD_READS
// For performance's sake, this counter is only kept on demand
#ifdef _QUICKERNES_DETECT_JOYPAD_READS
joypad_read_count++;
#endif
#endif
// to do: to aid with recording, doesn't emulate transparent latch,
// so a game that held strobe at 1 and read $4016 or $4017 would not get
@ -1001,4 +1093,4 @@ inline void Core::cpu_write(nes_addr_t addr, int data, nes_time_t time)
static_cast<Core &>(*cpu).cpu_write(addr, data, time); \
}
} // namespace quickNES
} // namespace quickerNES

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@ typedef unsigned nes_addr_t; // 16-bit address
class Cpu
{
public:
void set_tracecb(void (*cb)(unsigned int *data))
{
tracecb = cb;
@ -158,4 +157,4 @@ class Cpu
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,10 +1,10 @@
// Emu 0.7.0. http://www.slack.net/~ant/
#include <cstring>
#include "mappers/mapper.hpp"
#include "emu.hpp"
#include "apu/NESEffectsBuffer.hpp"
#include "apu/buffer.hpp"
#include "mappers/mapper.hpp"
#include <cstring>
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
can redistribute it and/or modify it under the terms of the GNU Lesser
@ -22,12 +22,12 @@ namespace quickerNES
int const sound_fade_size = 384;
Emu::equalizer_t const Emu::nes_eq = { -1.0, 80 };
Emu::equalizer_t const Emu::famicom_eq = { -15.0, 80 };
Emu::equalizer_t const Emu::tv_eq = { -12.0, 180 };
Emu::equalizer_t const Emu::flat_eq = { 0.0, 1 };
Emu::equalizer_t const Emu::crisp_eq = { 5.0, 1 };
Emu::equalizer_t const Emu::tinny_eq = { -47.0, 2000 };
Emu::equalizer_t const Emu::nes_eq = {-1.0, 80};
Emu::equalizer_t const Emu::famicom_eq = {-15.0, 80};
Emu::equalizer_t const Emu::tv_eq = {-12.0, 180};
Emu::equalizer_t const Emu::flat_eq = {0.0, 1};
Emu::equalizer_t const Emu::crisp_eq = {5.0, 1};
Emu::equalizer_t const Emu::tinny_eq = {-47.0, 2000};
Emu::Emu()
{
@ -43,8 +43,8 @@ Emu::Emu()
single_frame.pixels = 0;
single_frame.top = 0;
init_called = false;
set_palette_range( 0 );
memset( single_frame.palette, 0, sizeof single_frame.palette );
set_palette_range(0);
memset(single_frame.palette, 0, sizeof single_frame.palette);
extra_fade_sound_in = false;
extra_fade_sound_out = false;
@ -56,14 +56,14 @@ Emu::~Emu()
delete default_sound_buf;
}
const char * Emu::init_()
const char *Emu::init_()
{
return emu.init();
}
inline const char * Emu::auto_init()
inline const char *Emu::auto_init()
{
if ( !init_called )
if (!init_called)
{
init_();
init_called = true;
@ -71,7 +71,6 @@ inline const char * Emu::auto_init()
return 0;
}
inline void Emu::clear_sound_buf()
{
fade_sound_out = false;
@ -79,33 +78,33 @@ inline void Emu::clear_sound_buf()
sound_buf->clear();
}
void Emu::set_cart( Cart const* new_cart )
void Emu::set_cart(Cart const *new_cart)
{
auto_init();
emu.open( new_cart );
emu.open(new_cart);
channel_count_ = Apu::osc_count + emu.mapper->channel_count();
sound_buf->set_channel_count( channel_count() );
set_equalizer( equalizer_ );
enable_sound( true );
sound_buf->set_channel_count(channel_count());
set_equalizer(equalizer_);
enable_sound(true);
reset();
}
void Emu::reset( bool full_reset, bool erase_battery_ram )
void Emu::reset(bool full_reset, bool erase_battery_ram)
{
clear_sound_buf();
set_timestamp( 0 );
emu.reset( full_reset, erase_battery_ram );
set_timestamp(0);
emu.reset(full_reset, erase_battery_ram);
}
void Emu::set_palette_range( int begin, int end )
void Emu::set_palette_range(int begin, int end)
{
// round up to alignment
emu.ppu.palette_begin = (begin + palette_alignment - 1) & ~(palette_alignment - 1);
host_palette_size = end - emu.ppu.palette_begin;
}
const char * Emu::emulate_skip_frame( uint32_t joypad1, uint32_t joypad2 )
const char *Emu::emulate_skip_frame(uint32_t joypad1, uint32_t joypad2)
{
char *old_host_pixels = host_pixels;
host_pixels = NULL;
@ -114,39 +113,39 @@ const char * Emu::emulate_skip_frame( uint32_t joypad1, uint32_t joypad2 )
return 0;
}
const char * Emu::emulate_frame( uint32_t joypad1, uint32_t joypad2 )
const char *Emu::emulate_frame(uint32_t joypad1, uint32_t joypad2)
{
emu.ppu.host_pixels = NULL;
unsigned changed_count = sound_buf->channels_changed_count();
bool new_enabled = (frame_ != NULL);
if ( sound_buf_changed_count != changed_count || sound_enabled != new_enabled )
if (sound_buf_changed_count != changed_count || sound_enabled != new_enabled)
{
sound_buf_changed_count = changed_count;
sound_enabled = new_enabled;
enable_sound( sound_enabled );
enable_sound(sound_enabled);
}
frame_t* f = frame_;
if ( f )
frame_t *f = frame_;
if (f)
{
emu.ppu.max_palette_size = host_palette_size;
emu.ppu.host_palette = f->palette + emu.ppu.palette_begin;
// add black and white for emulator to use (unless emulator uses entire
// palette for frame)
f->palette [252] = 0x0F;
f->palette [254] = 0x30;
f->palette [255] = 0x0F;
if ( host_pixels )
emu.ppu.host_pixels = (uint8_t*) host_pixels +
f->palette[252] = 0x0F;
f->palette[254] = 0x30;
f->palette[255] = 0x0F;
if (host_pixels)
emu.ppu.host_pixels = (uint8_t *)host_pixels +
emu.ppu.host_row_bytes * f->top;
if ( sound_buf->samples_avail() )
if (sound_buf->samples_avail())
clear_sound_buf();
nes_time_t frame_len = emu.emulate_frame(joypad1, joypad2);
sound_buf->end_frame( frame_len, false );
sound_buf->end_frame(frame_len, false);
f = frame_;
f->sample_count = sound_buf->samples_avail();
@ -168,17 +167,17 @@ const char * Emu::emulate_frame( uint32_t joypad1, uint32_t joypad2 )
// Extras
void Emu::load_ines( const uint8_t* buffer )
void Emu::load_ines(const uint8_t *buffer)
{
private_cart.load_ines( buffer );
set_cart( &private_cart );
private_cart.load_ines(buffer);
set_cart(&private_cart);
}
void Emu::write_chr( void const* p, long count, long offset )
void Emu::write_chr(void const *p, long count, long offset)
{
long end = offset + count;
memcpy( (uint8_t*) chr_mem() + offset, p, count );
emu.ppu.rebuild_chr( offset, end );
memcpy((uint8_t *)chr_mem() + offset, p, count);
emu.ppu.rebuild_chr(offset, end);
}
Multi_Buffer *set_apu(Nes_Effects_Buffer *buf, Apu *apu)
@ -193,93 +192,93 @@ Multi_Buffer *set_apu(Buffer *buf, Apu *apu)
return buf;
}
const char * Emu::set_sample_rate( long rate, class Buffer* buf )
const char *Emu::set_sample_rate(long rate, class Buffer *buf)
{
auto_init();
return set_sample_rate( rate, set_apu( buf, &emu.impl->apu ) );
return set_sample_rate(rate, set_apu(buf, &emu.impl->apu));
}
const char * Emu::set_sample_rate( long rate, class Nes_Effects_Buffer* buf )
const char *Emu::set_sample_rate(long rate, class Nes_Effects_Buffer *buf)
{
auto_init();
return set_sample_rate( rate, set_apu( buf, &emu.impl->apu ) );
return set_sample_rate(rate, set_apu(buf, &emu.impl->apu));
}
// Sound
void Emu::set_frame_rate( double rate )
void Emu::set_frame_rate(double rate)
{
sound_buf->clock_rate( (long) (1789773 / 60.0 * rate) );
sound_buf->clock_rate((long)(1789773 / 60.0 * rate));
}
const char * Emu::set_sample_rate( long rate, Multi_Buffer* new_buf )
const char *Emu::set_sample_rate(long rate, Multi_Buffer *new_buf)
{
auto_init();
emu.impl->apu.volume( 1.0 ); // cancel any previous non-linearity
new_buf->set_sample_rate( rate, 1200 / frame_rate );
emu.impl->apu.volume(1.0); // cancel any previous non-linearity
new_buf->set_sample_rate(rate, 1200 / frame_rate);
sound_buf = new_buf;
sound_buf_changed_count = 0;
if ( new_buf != default_sound_buf )
if (new_buf != default_sound_buf)
{
delete default_sound_buf;
default_sound_buf = NULL;
}
set_frame_rate( frame_rate );
set_frame_rate(frame_rate);
return 0;
}
const char * Emu::set_sample_rate( long rate )
const char *Emu::set_sample_rate(long rate)
{
if ( !default_sound_buf ) default_sound_buf = new Mono_Buffer;
return set_sample_rate( rate, default_sound_buf );
if (!default_sound_buf) default_sound_buf = new Mono_Buffer;
return set_sample_rate(rate, default_sound_buf);
}
void Emu::set_equalizer( equalizer_t const& eq )
void Emu::set_equalizer(equalizer_t const &eq)
{
equalizer_ = eq;
if ( cart() )
if (cart())
{
blip_eq_t blip_eq( eq.treble, 0, sound_buf->sample_rate() );
emu.impl->apu.treble_eq( blip_eq );
emu.mapper->set_treble( blip_eq );
sound_buf->bass_freq( equalizer_.bass );
blip_eq_t blip_eq(eq.treble, 0, sound_buf->sample_rate());
emu.impl->apu.treble_eq(blip_eq);
emu.mapper->set_treble(blip_eq);
sound_buf->bass_freq(equalizer_.bass);
}
}
void Emu::enable_sound( bool enabled )
void Emu::enable_sound(bool enabled)
{
if ( enabled )
if (enabled)
{
for ( int i = channel_count(); i-- > 0; )
for (int i = channel_count(); i-- > 0;)
{
Blip_Buffer* buf = sound_buf->channel( i ).center;
Blip_Buffer *buf = sound_buf->channel(i).center;
int mapper_index = i - Apu::osc_count;
if ( mapper_index < 0 )
emu.impl->apu.osc_output( i, buf );
if (mapper_index < 0)
emu.impl->apu.osc_output(i, buf);
else
emu.mapper->set_channel_buf( mapper_index, buf );
emu.mapper->set_channel_buf(mapper_index, buf);
}
}
else
{
emu.impl->apu.output( NULL );
for ( int i = channel_count() - Apu::osc_count; i-- > 0; )
emu.mapper->set_channel_buf( i, NULL );
emu.impl->apu.output(NULL);
for (int i = channel_count() - Apu::osc_count; i-- > 0;)
emu.mapper->set_channel_buf(i, NULL);
}
}
void Emu::fade_samples( blip_sample_t* p, int size, int step )
void Emu::fade_samples(blip_sample_t *p, int size, int step)
{
if ( size >= sound_fade_size )
if (size >= sound_fade_size)
{
if ( step < 0 )
if (step < 0)
p += size - sound_fade_size;
int const shift = 15;
int mul = (1 - step) << (shift - 1);
step *= (1 << shift) / sound_fade_size;
for ( int n = sound_fade_size; n--; )
for (int n = sound_fade_size; n--;)
{
*p = (*p * mul) >> 15;
++p;
@ -288,159 +287,542 @@ void Emu::fade_samples( blip_sample_t* p, int size, int step )
}
}
long Emu::read_samples( short* out, long out_size )
long Emu::read_samples(short *out, long out_size)
{
long count = sound_buf->read_samples( out, out_size );
if ( fade_sound_in )
long count = sound_buf->read_samples(out, out_size);
if (fade_sound_in)
{
fade_sound_in = false;
if (out != NULL)
fade_samples( out, count, 1 );
fade_samples(out, count, 1);
}
if ( fade_sound_out )
if (fade_sound_out)
{
fade_sound_out = false;
fade_sound_in = true; // next buffer should be faded in
if (out != NULL)
fade_samples( out, count, -1 );
fade_samples(out, count, -1);
}
return count;
}
Emu::rgb_t const Emu::nes_colors [color_table_size] =
{
Emu::rgb_t const Emu::nes_colors[color_table_size] =
{
// generated with nes_ntsc default settings
{102,102,102},{ 0, 42,136},{ 20, 18,168},{ 59, 0,164},
{ 92, 0,126},{110, 0, 64},{108, 7, 0},{ 87, 29, 0},
{ 52, 53, 0},{ 12, 73, 0},{ 0, 82, 0},{ 0, 79, 8},
{ 0, 64, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{174,174,174},{ 21, 95,218},{ 66, 64,254},{118, 39,255},
{161, 27,205},{184, 30,124},{181, 50, 32},{153, 79, 0},
{108,110, 0},{ 56,135, 0},{ 13,148, 0},{ 0,144, 50},
{ 0,124,142},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{254,254,254},{100,176,254},{147,144,254},{199,119,254},
{243,106,254},{254,110,205},{254,130,112},{235,159, 35},
{189,191, 0},{137,217, 0},{ 93,229, 48},{ 69,225,130},
{ 72,206,223},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{254,254,254},{193,224,254},{212,211,254},{233,200,254},
{251,195,254},{254,197,235},{254,205,198},{247,217,166},
{229,230,149},{208,240,151},{190,245,171},{180,243,205},
{181,236,243},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{102, 102, 102},
{0, 42, 136},
{20, 18, 168},
{59, 0, 164},
{92, 0, 126},
{110, 0, 64},
{108, 7, 0},
{87, 29, 0},
{52, 53, 0},
{12, 73, 0},
{0, 82, 0},
{0, 79, 8},
{0, 64, 78},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{174, 174, 174},
{21, 95, 218},
{66, 64, 254},
{118, 39, 255},
{161, 27, 205},
{184, 30, 124},
{181, 50, 32},
{153, 79, 0},
{108, 110, 0},
{56, 135, 0},
{13, 148, 0},
{0, 144, 50},
{0, 124, 142},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{254, 254, 254},
{100, 176, 254},
{147, 144, 254},
{199, 119, 254},
{243, 106, 254},
{254, 110, 205},
{254, 130, 112},
{235, 159, 35},
{189, 191, 0},
{137, 217, 0},
{93, 229, 48},
{69, 225, 130},
{72, 206, 223},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{254, 254, 254},
{193, 224, 254},
{212, 211, 254},
{233, 200, 254},
{251, 195, 254},
{254, 197, 235},
{254, 205, 198},
{247, 217, 166},
{229, 230, 149},
{208, 240, 151},
{190, 245, 171},
{180, 243, 205},
{181, 236, 243},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{114, 83, 79},{ 0, 23,113},{ 32, 0,145},{ 71, 0,141},
{104, 0,103},{122, 0, 41},{120, 0, 0},{ 99, 10, 0},
{ 64, 34, 0},{ 24, 54, 0},{ 0, 63, 0},{ 0, 60, 0},
{ 0, 45, 54},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{190,148,143},{ 37, 69,187},{ 83, 38,228},{134, 13,224},
{177, 1,174},{200, 4, 92},{198, 24, 1},{170, 53, 0},
{124, 84, 0},{ 73,109, 0},{ 30,122, 0},{ 6,118, 19},
{ 9, 98,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{254,222,215},{122,142,254},{168,110,254},{220, 85,254},
{254, 72,247},{254, 76,164},{254, 96, 71},{254,125, 0},
{210,157, 0},{158,183, 0},{114,195, 7},{ 90,191, 89},
{ 93,172,182},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{254,222,215},{214,190,233},{233,177,250},{254,166,248},
{254,161,228},{254,163,194},{254,171,157},{254,183,125},
{250,196,108},{229,206,110},{211,211,130},{201,210,164},
{203,202,202},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 75,106, 64},{ 0, 46, 98},{ 0, 22,130},{ 32, 3,126},
{ 65, 0, 88},{ 82, 0, 26},{ 80, 11, 0},{ 59, 34, 0},
{ 24, 58, 0},{ 0, 77, 0},{ 0, 86, 0},{ 0, 83, 0},
{ 0, 68, 39},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{136,180,122},{ 0,101,166},{ 29, 69,208},{ 80, 44,203},
{123, 32,153},{146, 36, 72},{144, 55, 0},{116, 84, 0},
{ 70,116, 0},{ 19,141, 0},{ 0,153, 0},{ 0,149, 0},
{ 0,130, 90},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{207,254,188},{ 51,183,233},{ 98,151,254},{150,126,254},
{193,113,220},{217,117,137},{214,137, 45},{186,166, 0},
{140,198, 0},{ 88,224, 0},{ 44,236, 0},{ 20,232, 63},
{ 23,213,155},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{207,254,188},{144,231,207},{163,218,224},{184,207,222},
{201,202,201},{211,204,168},{210,212,130},{198,224, 99},
{180,237, 81},{159,247, 83},{141,252,104},{131,251,137},
{132,243,175},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 83, 83, 55},{ 0, 23, 89},{ 0, 0,121},{ 40, 0,117},
{ 73, 0, 79},{ 90, 0, 17},{ 88, 0, 0},{ 67, 10, 0},
{ 32, 34, 0},{ 0, 53, 0},{ 0, 63, 0},{ 0, 60, 0},
{ 0, 45, 30},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{147,148,110},{ 0, 69,154},{ 40, 38,196},{ 91, 12,191},
{134, 0,141},{157, 4, 60},{155, 23, 0},{127, 52, 0},
{ 81, 84, 0},{ 30,109, 0},{ 0,121, 0},{ 0,117, 0},
{ 0, 98, 78},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{221,222,173},{ 65,142,217},{112,110,254},{164, 84,255},
{208, 72,204},{231, 76,122},{229, 95, 29},{200,125, 0},
{154,157, 0},{102,182, 0},{ 58,195, 0},{ 34,191, 47},
{ 37,171,140},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{221,222,173},{158,189,191},{177,176,208},{198,166,206},
{216,161,185},{225,163,152},{224,171,114},{213,183, 83},
{194,195, 66},{173,206, 68},{155,211, 88},{145,209,122},
{146,201,159},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 87, 87,133},{ 0, 26,167},{ 5, 2,198},{ 44, 0,195},
{ 77, 0,157},{ 95, 0, 94},{ 93, 0, 25},{ 71, 14, 0},
{ 36, 38, 0},{ 0, 57, 0},{ 0, 66, 0},{ 0, 63, 38},
{ 0, 49,108},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{153,153,216},{ 0, 74,254},{ 46, 43,254},{ 97, 17,254},
{140, 5,247},{164, 9,165},{161, 28, 74},{133, 57, 0},
{ 87, 89, 0},{ 36,114, 0},{ 0,126, 10},{ 0,122, 92},
{ 0,103,183},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{229,228,254},{ 74,148,254},{120,116,254},{172, 91,254},
{216, 78,254},{239, 82,254},{237,102,166},{208,131, 89},
{162,163, 46},{110,189, 51},{ 66,201,102},{ 42,197,184},
{ 45,178,254},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{229,228,254},{166,196,254},{185,183,254},{206,172,254},
{224,167,254},{233,169,254},{232,177,252},{221,189,220},
{202,202,203},{181,212,205},{163,217,226},{153,216,254},
{154,208,254},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 90, 71, 97},{ 0, 11,130},{ 8, 0,162},{ 47, 0,158},
{ 80, 0,120},{ 98, 0, 58},{ 96, 0, 0},{ 74, 0, 0},
{ 39, 22, 0},{ 0, 42, 0},{ 0, 51, 0},{ 0, 48, 2},
{ 0, 33, 72},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{158,132,166},{ 4, 53,210},{ 50, 22,252},{101, 0,247},
{144, 0,197},{168, 0,116},{165, 7, 25},{137, 36, 0},
{ 91, 68, 0},{ 40, 93, 0},{ 0,105, 0},{ 0,101, 42},
{ 0, 82,134},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{234,201,246},{ 79,121,254},{125, 89,254},{177, 63,254},
{221, 51,254},{245, 55,195},{242, 74,102},{214,104, 24},
{167,136, 0},{115,161, 0},{ 71,174, 37},{ 48,170,120},
{ 50,150,213},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{234,201,246},{171,168,254},{190,155,254},{211,145,254},
{229,140,254},{239,142,225},{237,150,187},{226,162,156},
{207,174,139},{186,185,141},{168,190,161},{159,188,195},
{160,180,232},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 66, 85, 88},{ 0, 25,121},{ 0, 1,153},{ 23, 0,149},
{ 56, 0,111},{ 74, 0, 49},{ 72, 0, 0},{ 51, 12, 0},
{ 16, 36, 0},{ 0, 55, 0},{ 0, 65, 0},{ 0, 62, 0},
{ 0, 47, 63},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{125,151,154},{ 0, 72,198},{ 17, 40,240},{ 69, 15,235},
{112, 3,185},{135, 7,104},{132, 26, 12},{104, 55, 0},
{ 59, 87, 0},{ 7,112, 0},{ 0,124, 0},{ 0,120, 30},
{ 0,101,121},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{192,225,230},{ 37,145,254},{ 83,114,254},{135, 88,254},
{179, 76,254},{202, 80,179},{200, 99, 86},{171,129, 8},
{125,160, 0},{ 73,186, 0},{ 29,198, 21},{ 5,194,104},
{ 8,175,197},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{192,225,230},{129,193,248},{148,180,254},{169,170,254},
{187,165,242},{196,166,209},{195,174,171},{184,186,140},
{165,199,123},{144,209,125},{126,214,145},{116,213,179},
{118,205,216},{184,184,184},{ 0, 0, 0},{ 0, 0, 0},
{ 69, 69, 69},{ 0, 16,110},{ 0, 0,142},{ 33, 0,138},
{ 66, 0,100},{ 84, 0, 38},{ 82, 0, 0},{ 60, 3, 0},
{ 25, 27, 0},{ 0, 46, 0},{ 0, 56, 0},{ 0, 53, 0},
{ 0, 38, 51},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{134,134,134},{ 0, 64,187},{ 35, 32,228},{ 86, 7,223},
{129, 0,174},{153, 0, 92},{150, 18, 1},{122, 47, 0},
{ 76, 79, 0},{ 25,104, 0},{ 0,116, 0},{ 0,112, 19},
{ 0, 93,110},{ 0, 0, 0},{ 0, 0, 0},{ 0, 0, 0},
{207,207,207},{ 60,136,254},{107,104,254},{159, 79,254},
{203, 66,248},{226, 70,165},{224, 90, 72},{195,119, 0},
{149,151, 0},{ 97,177, 0},{ 53,189, 8},{ 29,185, 91},
{ 32,166,183},{ 79, 79, 79},{ 0, 0, 0},{ 0, 0, 0},
{207,207,207},{148,178,229},{166,165,246},{188,155,244},
{205,150,224},{215,152,190},{214,159,152},{202,171,121},
{183,184,104},{162,195,106},{145,200,126},{135,198,160},
{136,190,197},{184,184,184},{ 0, 0, 0},{ 0, 0, 0}
};
{114, 83, 79},
{0, 23, 113},
{32, 0, 145},
{71, 0, 141},
{104, 0, 103},
{122, 0, 41},
{120, 0, 0},
{99, 10, 0},
{64, 34, 0},
{24, 54, 0},
{0, 63, 0},
{0, 60, 0},
{0, 45, 54},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{190, 148, 143},
{37, 69, 187},
{83, 38, 228},
{134, 13, 224},
{177, 1, 174},
{200, 4, 92},
{198, 24, 1},
{170, 53, 0},
{124, 84, 0},
{73, 109, 0},
{30, 122, 0},
{6, 118, 19},
{9, 98, 110},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{254, 222, 215},
{122, 142, 254},
{168, 110, 254},
{220, 85, 254},
{254, 72, 247},
{254, 76, 164},
{254, 96, 71},
{254, 125, 0},
{210, 157, 0},
{158, 183, 0},
{114, 195, 7},
{90, 191, 89},
{93, 172, 182},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{254, 222, 215},
{214, 190, 233},
{233, 177, 250},
{254, 166, 248},
{254, 161, 228},
{254, 163, 194},
{254, 171, 157},
{254, 183, 125},
{250, 196, 108},
{229, 206, 110},
{211, 211, 130},
{201, 210, 164},
{203, 202, 202},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{75, 106, 64},
{0, 46, 98},
{0, 22, 130},
{32, 3, 126},
{65, 0, 88},
{82, 0, 26},
{80, 11, 0},
{59, 34, 0},
{24, 58, 0},
{0, 77, 0},
{0, 86, 0},
{0, 83, 0},
{0, 68, 39},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{136, 180, 122},
{0, 101, 166},
{29, 69, 208},
{80, 44, 203},
{123, 32, 153},
{146, 36, 72},
{144, 55, 0},
{116, 84, 0},
{70, 116, 0},
{19, 141, 0},
{0, 153, 0},
{0, 149, 0},
{0, 130, 90},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{207, 254, 188},
{51, 183, 233},
{98, 151, 254},
{150, 126, 254},
{193, 113, 220},
{217, 117, 137},
{214, 137, 45},
{186, 166, 0},
{140, 198, 0},
{88, 224, 0},
{44, 236, 0},
{20, 232, 63},
{23, 213, 155},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{207, 254, 188},
{144, 231, 207},
{163, 218, 224},
{184, 207, 222},
{201, 202, 201},
{211, 204, 168},
{210, 212, 130},
{198, 224, 99},
{180, 237, 81},
{159, 247, 83},
{141, 252, 104},
{131, 251, 137},
{132, 243, 175},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{83, 83, 55},
{0, 23, 89},
{0, 0, 121},
{40, 0, 117},
{73, 0, 79},
{90, 0, 17},
{88, 0, 0},
{67, 10, 0},
{32, 34, 0},
{0, 53, 0},
{0, 63, 0},
{0, 60, 0},
{0, 45, 30},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{147, 148, 110},
{0, 69, 154},
{40, 38, 196},
{91, 12, 191},
{134, 0, 141},
{157, 4, 60},
{155, 23, 0},
{127, 52, 0},
{81, 84, 0},
{30, 109, 0},
{0, 121, 0},
{0, 117, 0},
{0, 98, 78},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{221, 222, 173},
{65, 142, 217},
{112, 110, 254},
{164, 84, 255},
{208, 72, 204},
{231, 76, 122},
{229, 95, 29},
{200, 125, 0},
{154, 157, 0},
{102, 182, 0},
{58, 195, 0},
{34, 191, 47},
{37, 171, 140},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{221, 222, 173},
{158, 189, 191},
{177, 176, 208},
{198, 166, 206},
{216, 161, 185},
{225, 163, 152},
{224, 171, 114},
{213, 183, 83},
{194, 195, 66},
{173, 206, 68},
{155, 211, 88},
{145, 209, 122},
{146, 201, 159},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{87, 87, 133},
{0, 26, 167},
{5, 2, 198},
{44, 0, 195},
{77, 0, 157},
{95, 0, 94},
{93, 0, 25},
{71, 14, 0},
{36, 38, 0},
{0, 57, 0},
{0, 66, 0},
{0, 63, 38},
{0, 49, 108},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{153, 153, 216},
{0, 74, 254},
{46, 43, 254},
{97, 17, 254},
{140, 5, 247},
{164, 9, 165},
{161, 28, 74},
{133, 57, 0},
{87, 89, 0},
{36, 114, 0},
{0, 126, 10},
{0, 122, 92},
{0, 103, 183},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{229, 228, 254},
{74, 148, 254},
{120, 116, 254},
{172, 91, 254},
{216, 78, 254},
{239, 82, 254},
{237, 102, 166},
{208, 131, 89},
{162, 163, 46},
{110, 189, 51},
{66, 201, 102},
{42, 197, 184},
{45, 178, 254},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{229, 228, 254},
{166, 196, 254},
{185, 183, 254},
{206, 172, 254},
{224, 167, 254},
{233, 169, 254},
{232, 177, 252},
{221, 189, 220},
{202, 202, 203},
{181, 212, 205},
{163, 217, 226},
{153, 216, 254},
{154, 208, 254},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{90, 71, 97},
{0, 11, 130},
{8, 0, 162},
{47, 0, 158},
{80, 0, 120},
{98, 0, 58},
{96, 0, 0},
{74, 0, 0},
{39, 22, 0},
{0, 42, 0},
{0, 51, 0},
{0, 48, 2},
{0, 33, 72},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{158, 132, 166},
{4, 53, 210},
{50, 22, 252},
{101, 0, 247},
{144, 0, 197},
{168, 0, 116},
{165, 7, 25},
{137, 36, 0},
{91, 68, 0},
{40, 93, 0},
{0, 105, 0},
{0, 101, 42},
{0, 82, 134},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{234, 201, 246},
{79, 121, 254},
{125, 89, 254},
{177, 63, 254},
{221, 51, 254},
{245, 55, 195},
{242, 74, 102},
{214, 104, 24},
{167, 136, 0},
{115, 161, 0},
{71, 174, 37},
{48, 170, 120},
{50, 150, 213},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{234, 201, 246},
{171, 168, 254},
{190, 155, 254},
{211, 145, 254},
{229, 140, 254},
{239, 142, 225},
{237, 150, 187},
{226, 162, 156},
{207, 174, 139},
{186, 185, 141},
{168, 190, 161},
{159, 188, 195},
{160, 180, 232},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{66, 85, 88},
{0, 25, 121},
{0, 1, 153},
{23, 0, 149},
{56, 0, 111},
{74, 0, 49},
{72, 0, 0},
{51, 12, 0},
{16, 36, 0},
{0, 55, 0},
{0, 65, 0},
{0, 62, 0},
{0, 47, 63},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{125, 151, 154},
{0, 72, 198},
{17, 40, 240},
{69, 15, 235},
{112, 3, 185},
{135, 7, 104},
{132, 26, 12},
{104, 55, 0},
{59, 87, 0},
{7, 112, 0},
{0, 124, 0},
{0, 120, 30},
{0, 101, 121},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{192, 225, 230},
{37, 145, 254},
{83, 114, 254},
{135, 88, 254},
{179, 76, 254},
{202, 80, 179},
{200, 99, 86},
{171, 129, 8},
{125, 160, 0},
{73, 186, 0},
{29, 198, 21},
{5, 194, 104},
{8, 175, 197},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{192, 225, 230},
{129, 193, 248},
{148, 180, 254},
{169, 170, 254},
{187, 165, 242},
{196, 166, 209},
{195, 174, 171},
{184, 186, 140},
{165, 199, 123},
{144, 209, 125},
{126, 214, 145},
{116, 213, 179},
{118, 205, 216},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0},
{69, 69, 69},
{0, 16, 110},
{0, 0, 142},
{33, 0, 138},
{66, 0, 100},
{84, 0, 38},
{82, 0, 0},
{60, 3, 0},
{25, 27, 0},
{0, 46, 0},
{0, 56, 0},
{0, 53, 0},
{0, 38, 51},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{134, 134, 134},
{0, 64, 187},
{35, 32, 228},
{86, 7, 223},
{129, 0, 174},
{153, 0, 92},
{150, 18, 1},
{122, 47, 0},
{76, 79, 0},
{25, 104, 0},
{0, 116, 0},
{0, 112, 19},
{0, 93, 110},
{0, 0, 0},
{0, 0, 0},
{0, 0, 0},
{207, 207, 207},
{60, 136, 254},
{107, 104, 254},
{159, 79, 254},
{203, 66, 248},
{226, 70, 165},
{224, 90, 72},
{195, 119, 0},
{149, 151, 0},
{97, 177, 0},
{53, 189, 8},
{29, 185, 91},
{32, 166, 183},
{79, 79, 79},
{0, 0, 0},
{0, 0, 0},
{207, 207, 207},
{148, 178, 229},
{166, 165, 246},
{188, 155, 244},
{205, 150, 224},
{215, 152, 190},
{214, 159, 152},
{202, 171, 121},
{183, 184, 104},
{162, 195, 106},
{145, 200, 126},
{135, 198, 160},
{136, 190, 197},
{184, 184, 184},
{0, 0, 0},
{0, 0, 0}};
void Emu::SaveAudioBufferState()
{
@ -457,4 +839,4 @@ void Emu::RestoreAudioBufferState()
sound_buf->RestoreAudioBufferState();
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -4,9 +4,9 @@
// Emu 0.7.0
#include "apu/multiBuffer.hpp"
#include "cart.hpp"
#include "core.hpp"
#include "apu/multiBuffer.hpp"
namespace quickerNES
{
@ -47,12 +47,12 @@ class Emu
int get_joypad_read_count() const { return emu.joypad_read_count; }
void set_tracecb(void (*cb)(unsigned int *dest)) { emu.set_tracecb(cb); }
// Save emulator state variants
void serializeState(jaffarCommon::serializer::Base& serializer) const { emu.serializeState(serializer); }
void deserializeState(jaffarCommon::deserializer::Base& deserializer) { emu.deserializeState(deserializer); }
// Save emulator state variants
void serializeState(jaffarCommon::serializer::Base &serializer) const { emu.serializeState(serializer); }
void deserializeState(jaffarCommon::deserializer::Base &deserializer) { emu.deserializeState(deserializer); }
void setNTABBlockSize(const size_t size) { emu.setNTABBlockSize(size); }
void enableStateBlock(const std::string& block) { emu.enableStateBlock(block); };
void disableStateBlock(const std::string& block) { emu.disableStateBlock(block); };
void enableStateBlock(const std::string &block) { emu.enableStateBlock(block); };
void disableStateBlock(const std::string &block) { emu.disableStateBlock(block); };
// Basic emulation
@ -207,7 +207,7 @@ class Emu
low_mem_size = 0x800
};
uint8_t *get_low_mem() const { return (uint8_t*)emu.low_mem; }
uint8_t *get_low_mem() const { return (uint8_t *)emu.low_mem; }
size_t get_low_mem_size() const { return low_mem_size; }
// Optional 8K memory
@ -257,7 +257,7 @@ class Emu
virtual void loading_state(State const &) {}
long timestamp() const { return 0; }
void set_timestamp(long t) { }
void set_timestamp(long t) {}
private:
// noncopyable
@ -276,7 +276,7 @@ class Emu
void clear_sound_buf();
void fade_samples(blip_sample_t *, int size, int step);
void* pixels_base_ptr;
void *pixels_base_ptr;
char *host_pixels;
int host_palette_size;
frame_t single_frame;
@ -294,14 +294,12 @@ class Emu
void SaveAudioBufferState();
void RestoreAudioBufferState();
inline void* get_pixels_base_ptr()
inline void *get_pixels_base_ptr()
{
return pixels_base_ptr;
}
};
inline void Emu::set_pixels(void *p, long n)
{
pixels_base_ptr = p;
@ -319,4 +317,4 @@ inline long Emu::chr_size() const
return cart()->chr_size() ? cart()->chr_size() : emu.ppu.chr_addr_size;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -291,4 +291,4 @@ Mapper *Mapper::getMapperFromCode(const int mapperCode)
return mapper;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// NES mapper interface
// Emu 0.7.0
#include <climits>
#include "../cart.hpp"
#include "../cpu.hpp"
#include <climits>
namespace quickerNES
{
@ -209,4 +209,4 @@ inline bool Mapper::write_intercepted(nes_time_t, nes_addr_t, int) { return fals
inline int Mapper::read(nes_time_t, nes_addr_t) { return -1; } // signal to caller
} // namespace quickNES
} // namespace quickerNES

View File

@ -35,4 +35,4 @@ class Mapper000 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -126,4 +126,4 @@ class Mapper001 : public Mapper, mmc1_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -45,4 +45,4 @@ class Mapper002 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -44,4 +44,4 @@ class Mapper003 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -255,4 +255,4 @@ class Mapper004 : public Mapper, mmc3_state_t
int counter_just_clocked; // used only for debugging
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -149,4 +149,4 @@ class Mapper005 : public Mapper, mmc5_state_t
nes_time_t irq_time;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper007 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -78,4 +78,4 @@ class Mapper009 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -76,4 +76,4 @@ class Mapper010 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper011 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -94,4 +94,4 @@ class Mapper015 : public Mapper, Mapper015_state_t
unsigned long int i;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -199,4 +199,4 @@ class Mapper019 : public Mapper, namco106_state_t
nes_time_t last_time;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -256,4 +256,4 @@ void Mapper_VRC2_4<type_a, type_b>::write_irq(nes_time_t time,
typedef Mapper_VRC2_4<true, true> Mapper021;
} // namespace quickNES
} // namespace quickerNES

View File

@ -34,4 +34,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<false, true> Mapper022;
} // namespace quickNES
} // namespace quickerNES

View File

@ -33,4 +33,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<false, false> Mapper023;
} // namespace quickNES
} // namespace quickerNES

View File

@ -233,4 +233,4 @@ class Mapper_Vrc6 : public Mapper, vrc6_state_t
typedef Mapper_Vrc6<0> Mapper024;
} // namespace quickNES
} // namespace quickerNES

View File

@ -33,4 +33,4 @@ namespace quickerNES
typedef Mapper_VRC2_4<true, false> Mapper025;
} // namespace quickNES
} // namespace quickerNES

View File

@ -11,4 +11,4 @@ namespace quickerNES
typedef Mapper_Vrc6<3> Mapper026;
} // namespace quickNES
} // namespace quickerNES

View File

@ -53,4 +53,4 @@ class Mapper030 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -126,4 +126,4 @@ class Mapper032 : public Mapper, mapper32_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -103,4 +103,4 @@ class Mapper033 : public Mapper, tc0190_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -44,4 +44,4 @@ class Mapper034 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -53,4 +53,4 @@ class Mapper060 : public Mapper
uint8_t game_sel, last_game;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -52,4 +52,4 @@ class Mapper066 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -190,4 +190,4 @@ class Mapper069 : public Mapper, fme7_state_t
Fme7_Apu sound;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -84,4 +84,4 @@ class Mapper_74x161x162x32 : public Mapper
typedef Mapper_74x161x162x32<70> Mapper070;
} // namespace quickNES
} // namespace quickerNES

View File

@ -54,4 +54,4 @@ class Mapper071 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -134,4 +134,4 @@ class Mapper073 : public Mapper, vrc3_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -110,4 +110,4 @@ class Mapper075 : public Mapper, vrc1_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -77,4 +77,4 @@ class Mapper078 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -95,4 +95,4 @@ void Mapper_AveNina<multicart>::write_regs()
typedef Mapper_AveNina<false> Mapper079;
} // namespace quickNES
} // namespace quickerNES

View File

@ -225,4 +225,4 @@ class Mapper085 : public Mapper, vrc7_state_t
};
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -26,4 +26,4 @@ namespace quickerNES
typedef Mapper_74x161x162x32<86> Mapper086;
} // namespace quickNES
} // namespace quickerNES

View File

@ -50,4 +50,4 @@ class Mapper087 : public Mapper
void write(nes_time_t, nes_addr_t, int) {}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -111,5 +111,4 @@ class Mapper_Namco_34x3 : public Mapper, namco_34x3_state_t
typedef Mapper_Namco_34x3<false> Mapper088;
} // namespace quickNES
} // namespace quickerNES

View File

@ -59,4 +59,4 @@ class Mapper089 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -58,4 +58,4 @@ class Mapper093 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper094 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper097 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -30,4 +30,4 @@ namespace quickerNES
typedef Mapper_AveNina<true> Mapper113;
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper140 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -26,4 +26,4 @@ namespace quickerNES
typedef Mapper_74x161x162x32<152> Mapper152;
} // namespace quickNES
} // namespace quickerNES

View File

@ -30,4 +30,4 @@ namespace quickerNES
typedef Mapper_Namco_34x3<true> Mapper154;
} // namespace quickNES
} // namespace quickerNES

View File

@ -62,4 +62,4 @@ class Mapper156 : public Mapper, m156_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper180 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -67,4 +67,4 @@ class Mapper184 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -57,4 +57,4 @@ class Mapper190 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -78,4 +78,4 @@ class Mapper193 : public Mapper
uint8_t regs[4];
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -100,4 +100,4 @@ class Mapper206 : public Mapper, namco_34xx_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -93,4 +93,4 @@ class Mapper207 : public Mapper, taito_x1005_state_t
virtual void write(nes_time_t, nes_addr_t addr, int data) {}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -56,4 +56,4 @@ class Mapper232 : public Mapper
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -66,4 +66,4 @@ class Mapper240 : public Mapper
uint8_t regs;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -55,4 +55,4 @@ class Mapper241 : public Mapper
uint8_t bank;
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -72,4 +72,4 @@ class Mapper244 : public Mapper, mapper244_state_t
}
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -77,4 +77,4 @@ class Mapper246 : public Mapper
uint8_t regs[8];
};
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,9 +3,9 @@
// Emu 0.7.0. http://www.slack.net/~ant/
#include <cstring>
#include "ppu.hpp"
#include "../core.hpp"
#include <cstring>
namespace quickerNES
{
@ -656,4 +656,4 @@ nes_time_t Ppu::earliest_open_bus_decay()
return (decay_low < decay_high) ? decay_low : decay_high;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -3,8 +3,8 @@
// NES PPU emulator
// Emu 0.7.0
#include <climits>
#include "ppuRendering.hpp"
#include <climits>
namespace quickerNES
{
@ -143,4 +143,4 @@ inline void Ppu::update_open_bus(nes_time_t time)
if (time >= decay_high) open_bus &= ~0xE0;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -433,4 +433,4 @@ long Ppu_Impl::recalc_sprite_max(int scanline)
return 0;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -89,7 +89,7 @@ class Ppu_Impl : public ppu_state_t
};
impl_t *impl;
long map_chr_addr_peek( unsigned a ) const
long map_chr_addr_peek(unsigned a) const
{
return chr_pages[a / chr_page_size] + a;
}
@ -104,10 +104,10 @@ class Ppu_Impl : public ppu_state_t
static const uint16_t scanline_len = 341;
uint8_t *getSpriteRAM() const { return (uint8_t*)spr_ram; }
uint8_t *getSpriteRAM() const { return (uint8_t *)spr_ram; }
uint16_t getSpriteRAMSize() const { return spr_ram_size; }
uint8_t *getPaletteRAM() const { return (uint8_t*)palette; }
uint8_t *getPaletteRAM() const { return (uint8_t *)palette; }
uint16_t getPaletteRAMSize() const { return sizeof(palette); }
uint8_t spr_ram[spr_ram_size];
@ -260,4 +260,4 @@ inline void Ppu_Impl::begin_frame()
addr_inc = w2000 & 4 ? 32 : 1;
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -503,4 +503,4 @@ void Ppu_Rendering::draw_background(int start, int count)
}
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -61,4 +61,4 @@ inline void Ppu_Rendering::draw_sprites(int start, int count)
draw_scanlines(start, count, host_pixels + host_row_bytes * start, host_row_bytes, 2);
}
} // namespace quickNES
} // namespace quickerNES

View File

@ -1,15 +1,14 @@
#pragma once
#include "core/emu.hpp"
#include "../nesInstanceBase.hpp"
#include "core/emu.hpp"
typedef quickerNES::Emu emulator_t;
class NESInstance final : public NESInstanceBase
{
public:
NESInstance(const nlohmann::json& config) : NESInstanceBase(config) {}
NESInstance(const nlohmann::json &config) : NESInstanceBase(config) {}
uint8_t *getLowMem() const override { return _nes.get_low_mem(); };
size_t getLowMemSize() const override { return _nes.get_low_mem_size(); };
@ -26,8 +25,8 @@ class NESInstance final : public NESInstanceBase
uint8_t *getCHRMem() const { return _nes.chr_mem(); };
size_t getCHRMemSize() const { return _nes.chr_size(); };
void serializeState(jaffarCommon::serializer::Base& serializer) const override { _nes.serializeState(serializer); }
void deserializeState(jaffarCommon::deserializer::Base& deserializer) override { _nes.deserializeState(deserializer); }
void serializeState(jaffarCommon::serializer::Base &serializer) const override { _nes.serializeState(serializer); }
void deserializeState(jaffarCommon::deserializer::Base &deserializer) override { _nes.deserializeState(deserializer); }
std::string getCoreName() const override { return "QuickerNES"; }
@ -59,20 +58,17 @@ class NESInstance final : public NESInstanceBase
}
protected:
bool loadROMImpl(const uint8_t* romData, const size_t romSize) override
bool loadROMImpl(const uint8_t *romData, const size_t romSize) override
{
// Loading rom data
_nes.load_ines(romData);
return true;
}
void enableStateBlockImpl(const std::string& block) override { _nes.enableStateBlock(block); };
void disableStateBlockImpl(const std::string& block) override { _nes.disableStateBlock(block); };
void enableStateBlockImpl(const std::string &block) override { _nes.enableStateBlock(block); };
void disableStateBlockImpl(const std::string &block) override { _nes.disableStateBlock(block); };
private:
// Emulator instance
emulator_t _nes;
};

Some files were not shown because too many files have changed in this diff Show More