Merge pull request #16 from SergioMartin86/refactoring
Refactoring for better use in JaffarPlus
This commit is contained in:
commit
06b4d82898
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <emuInstance.hpp>
|
#include <nesInstance.hpp>
|
||||||
|
|
||||||
#define BLIT_SIZE 65536
|
#define BLIT_SIZE 65536
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdexcept>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
// If we use NCurses, we need to use the appropriate printing function
|
||||||
|
#ifdef NCURSES
|
||||||
|
#include <ncurses.h>
|
||||||
|
#define LOG printw
|
||||||
|
#else
|
||||||
|
#define LOG printf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define EXIT_WITH_ERROR(...) exitWithError(__FILE__, __LINE__, __VA_ARGS__)
|
||||||
|
inline void exitWithError [[noreturn]] (const char *fileName, const int lineNumber, const char *format, ...)
|
||||||
|
{
|
||||||
|
char *outstr = 0;
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
int ret = vasprintf(&outstr, format, ap);
|
||||||
|
if (ret < 0) exit(-1);
|
||||||
|
|
||||||
|
std::string outString = outstr;
|
||||||
|
free(outstr);
|
||||||
|
|
||||||
|
char info[1024];
|
||||||
|
|
||||||
|
snprintf(info, sizeof(info) - 1, " + From %s:%d\n", fileName, lineNumber);
|
||||||
|
outString += info;
|
||||||
|
|
||||||
|
throw std::runtime_error(outString.c_str());
|
||||||
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "sha1/sha1.hpp"
|
#include "logger.hpp"
|
||||||
#include <utils.hpp>
|
#include "controller.hpp"
|
||||||
#include <controller.hpp>
|
|
||||||
|
|
||||||
#define _LOW_MEM_SIZE 0x800
|
#define _LOW_MEM_SIZE 0x800
|
||||||
#define _HIGH_MEM_SIZE 0x2000
|
#define _HIGH_MEM_SIZE 0x2000
|
||||||
|
@ -12,12 +11,12 @@
|
||||||
static const uint16_t image_width = 256;
|
static const uint16_t image_width = 256;
|
||||||
static const uint16_t image_height = 240;
|
static const uint16_t image_height = 240;
|
||||||
|
|
||||||
class EmuInstanceBase
|
class NESInstanceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
EmuInstanceBase() = default;
|
NESInstanceBase() = default;
|
||||||
virtual ~EmuInstanceBase() = default;
|
virtual ~NESInstanceBase() = default;
|
||||||
|
|
||||||
inline void advanceState(const std::string &move)
|
inline void advanceState(const std::string &move)
|
||||||
{
|
{
|
||||||
|
@ -61,56 +60,19 @@ class EmuInstanceBase
|
||||||
if (isTypeRecognized == false) EXIT_WITH_ERROR("Input type not recognized: '%s'\n", type.c_str());
|
if (isTypeRecognized == false) EXIT_WITH_ERROR("Input type not recognized: '%s'\n", type.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string getRomSHA1() const { return _romSHA1String; }
|
|
||||||
|
|
||||||
inline hash_t getStateHash() const
|
|
||||||
{
|
|
||||||
MetroHash128 hash;
|
|
||||||
|
|
||||||
hash.Update(getLowMem(), _LOW_MEM_SIZE);
|
|
||||||
// hash.Update(getHighMem(), _HIGH_MEM_SIZE);
|
|
||||||
// hash.Update(getNametableMem(), _NAMETABLES_MEM_SIZE);
|
|
||||||
// hash.Update(getChrMem(), getChrMemSize());
|
|
||||||
|
|
||||||
hash_t result;
|
|
||||||
hash.Finalize(reinterpret_cast<uint8_t *>(&result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void enableRendering() { _doRendering = true; };
|
inline void enableRendering() { _doRendering = true; };
|
||||||
inline void disableRendering() { _doRendering = false; };
|
inline void disableRendering() { _doRendering = false; };
|
||||||
|
|
||||||
inline void loadStateFile(const std::string &stateFilePath)
|
inline bool loadROM(const uint8_t* romData, const size_t romSize)
|
||||||
{
|
{
|
||||||
std::string stateData;
|
|
||||||
bool status = loadStringFromFile(stateData, stateFilePath);
|
|
||||||
if (status == false) EXIT_WITH_ERROR("Could not find/read state file: %s\n", stateFilePath.c_str());
|
|
||||||
deserializeState((uint8_t *)stateData.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void saveStateFile(const std::string &stateFilePath) const
|
|
||||||
{
|
|
||||||
std::string stateData;
|
|
||||||
stateData.resize(_stateSize);
|
|
||||||
serializeState((uint8_t *)stateData.data());
|
|
||||||
saveStringToFile(stateData, stateFilePath.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void loadROMFile(const std::string &romFilePath)
|
|
||||||
{
|
|
||||||
// Loading ROM data
|
|
||||||
bool status = loadStringFromFile(_romData, romFilePath);
|
|
||||||
if (status == false) EXIT_WITH_ERROR("Could not find/read ROM file: %s\n", romFilePath.c_str());
|
|
||||||
|
|
||||||
// Calculating ROM hash value
|
|
||||||
_romSHA1String = SHA1::GetHash((uint8_t *)_romData.data(), _romData.size());
|
|
||||||
|
|
||||||
// Actually loading rom file
|
// Actually loading rom file
|
||||||
status = loadROMFileImpl(_romData);
|
auto status = loadROMImpl(romData, romSize);
|
||||||
if (status == false) EXIT_WITH_ERROR("Could not process ROM file: %s\n", romFilePath.c_str());
|
|
||||||
|
|
||||||
// Detecting full state size
|
// Detecting full state size
|
||||||
_stateSize = getStateSize();
|
_stateSize = getStateSize();
|
||||||
|
|
||||||
|
// Returning status
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableStateBlock(const std::string& block)
|
void enableStateBlock(const std::string& block)
|
||||||
|
@ -151,7 +113,7 @@ class EmuInstanceBase
|
||||||
|
|
||||||
virtual void enableStateBlockImpl(const std::string& block) = 0;
|
virtual void enableStateBlockImpl(const std::string& block) = 0;
|
||||||
virtual void disableStateBlockImpl(const std::string& block) = 0;
|
virtual void disableStateBlockImpl(const std::string& block) = 0;
|
||||||
virtual bool loadROMFileImpl(const std::string &romFilePath) = 0;
|
virtual bool loadROMImpl(const uint8_t* romData, const size_t romSize) = 0;
|
||||||
virtual void advanceStateImpl(const Controller::port_t controller1, const Controller::port_t controller2) = 0;
|
virtual void advanceStateImpl(const Controller::port_t controller1, const Controller::port_t controller2) = 0;
|
||||||
|
|
||||||
// Storage for the light state size
|
// Storage for the light state size
|
||||||
|
@ -161,11 +123,6 @@ class EmuInstanceBase
|
||||||
bool _doRendering = true;
|
bool _doRendering = true;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Storage for the ROM data
|
|
||||||
std::string _romData;
|
|
||||||
|
|
||||||
// SHA1 rom hash
|
|
||||||
std::string _romSHA1String;
|
|
||||||
|
|
||||||
// Controller class for input parsing
|
// Controller class for input parsing
|
||||||
Controller _controller;
|
Controller _controller;
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "emuInstance.hpp"
|
#include "nesInstance.hpp"
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include <SDL_image.h>
|
#include <SDL_image.h>
|
||||||
#include <hqn/hqn.h>
|
#include <hqn/hqn.h>
|
||||||
|
@ -30,14 +30,14 @@ class PlaybackInstance
|
||||||
step.input = input;
|
step.input = input;
|
||||||
step.stateData = (uint8_t *)malloc(_emu->getStateSize());
|
step.stateData = (uint8_t *)malloc(_emu->getStateSize());
|
||||||
_emu->serializeState(step.stateData);
|
_emu->serializeState(step.stateData);
|
||||||
step.hash = _emu->getStateHash();
|
step.hash = calculateStateHash(_emu);
|
||||||
|
|
||||||
// Adding the step into the sequence
|
// Adding the step into the sequence
|
||||||
_stepSequence.push_back(step);
|
_stepSequence.push_back(step);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializes the playback module instance
|
// Initializes the playback module instance
|
||||||
PlaybackInstance(EmuInstance *emu, const std::vector<std::string> &sequence, const std::string &overlayPath = "") : _emu(emu)
|
PlaybackInstance(NESInstance *emu, const std::vector<std::string> &sequence, const std::string &overlayPath = "") : _emu(emu)
|
||||||
{
|
{
|
||||||
// Enabling emulation rendering
|
// Enabling emulation rendering
|
||||||
_emu->enableRendering();
|
_emu->enableRendering();
|
||||||
|
@ -234,7 +234,7 @@ class PlaybackInstance
|
||||||
hqn::GUIController *_hqnGUI;
|
hqn::GUIController *_hqnGUI;
|
||||||
|
|
||||||
// Pointer to the contained emulator instance
|
// Pointer to the contained emulator instance
|
||||||
EmuInstance *const _emu;
|
NESInstance *const _emu;
|
||||||
|
|
||||||
// Flag to store whether to use the button overlay
|
// Flag to store whether to use the button overlay
|
||||||
bool _useOverlay = false;
|
bool _useOverlay = false;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#include "argparse/argparse.hpp"
|
#include "argparse/argparse.hpp"
|
||||||
#include "emuInstance.hpp"
|
#include "nesInstance.hpp"
|
||||||
#include "playbackInstance.hpp"
|
#include "playbackInstance.hpp"
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -91,17 +91,24 @@ int main(int argc, char *argv[])
|
||||||
refreshTerminal();
|
refreshTerminal();
|
||||||
|
|
||||||
// Creating emulator instance
|
// Creating emulator instance
|
||||||
EmuInstance e;
|
NESInstance e;
|
||||||
|
|
||||||
// Setting controller types
|
// Setting controller types
|
||||||
e.setController1Type(controller1Type);
|
e.setController1Type(controller1Type);
|
||||||
e.setController2Type(controller2Type);
|
e.setController2Type(controller2Type);
|
||||||
|
|
||||||
// Loading ROM File
|
// Loading ROM File
|
||||||
e.loadROMFile(romFilePath);
|
std::string romFileData;
|
||||||
|
if (loadStringFromFile(romFileData, romFilePath) == false) EXIT_WITH_ERROR("Could not rom file: %s\n", romFilePath.c_str());
|
||||||
|
e.loadROM((uint8_t*)romFileData.data(), romFileData.size());
|
||||||
|
|
||||||
// If an initial state is provided, load it now
|
// If an initial state is provided, load it now
|
||||||
if (stateFilePath != "") e.loadStateFile(stateFilePath);
|
if (stateFilePath != "")
|
||||||
|
{
|
||||||
|
std::string stateFileData;
|
||||||
|
if (loadStringFromFile(stateFileData, stateFilePath) == false) EXIT_WITH_ERROR("Could not initial state file: %s\n", stateFilePath.c_str());
|
||||||
|
e.deserializeState((uint8_t*)stateFileData.data());
|
||||||
|
}
|
||||||
|
|
||||||
// Creating playback instance
|
// Creating playback instance
|
||||||
auto p = PlaybackInstance(&e, sequence);
|
auto p = PlaybackInstance(&e, sequence);
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <Nes_Emu.h>
|
#include <quickNES/core/nes_emu/Nes_Emu.h>
|
||||||
#include <Nes_State.h>
|
#include <quickNES/core/nes_emu/Nes_State.h>
|
||||||
#include <emuInstanceBase.hpp>
|
#include <nesInstanceBase.hpp>
|
||||||
|
|
||||||
#define _DUMMY_SIZE 65536
|
#define _DUMMY_SIZE 65536
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ extern void register_misc_mappers();
|
||||||
extern void register_extra_mappers();
|
extern void register_extra_mappers();
|
||||||
extern void register_mapper_70();
|
extern void register_mapper_70();
|
||||||
|
|
||||||
class EmuInstance : public EmuInstanceBase
|
class NESInstance : public NESInstanceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmuInstance() : EmuInstanceBase()
|
NESInstance() : NESInstanceBase()
|
||||||
{
|
{
|
||||||
// Creating new emulator
|
// Creating new emulator
|
||||||
_nes = new Nes_Emu;
|
_nes = new Nes_Emu;
|
||||||
|
@ -32,10 +32,10 @@ class EmuInstance : public EmuInstanceBase
|
||||||
register_mapper_70();
|
register_mapper_70();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool loadROMFileImpl(const std::string &romData) override
|
virtual bool loadROMImpl(const uint8_t* romData, const size_t romSize) override
|
||||||
{
|
{
|
||||||
// Loading rom data
|
// Loading rom data
|
||||||
Mem_File_Reader romReader(romData.data(), (int)romData.size());
|
Mem_File_Reader romReader(romData, (int)romSize);
|
||||||
Auto_File_Reader romFile(romReader);
|
Auto_File_Reader romFile(romReader);
|
||||||
auto result = _nes->load_ines(romFile);
|
auto result = _nes->load_ines(romFile);
|
||||||
return result == 0;
|
return result == 0;
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
// Nes_Emu 0.7.0. http://www.slack.net/~ant/libs/
|
// Nes_Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||||
|
|
||||||
#include "apu/NESEffectsBuffer.hpp"
|
#include "NESEffectsBuffer.hpp"
|
||||||
#include "apu/apu.hpp"
|
#include "apu.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/libs/
|
// Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||||
|
|
||||||
#include "apu/buffer.hpp"
|
#include "buffer.hpp"
|
||||||
#include "apu/apu.hpp"
|
#include "apu.hpp"
|
||||||
|
|
||||||
/* Library Copyright (C) 2003-2006 Shay Green. This library is free software;
|
/* Library Copyright (C) 2003-2006 Shay Green. This library is free software;
|
||||||
you can redistribute it and/or modify it under the terms of the GNU Lesser
|
you can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/fme7/apu.hpp"
|
#include "apu.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Emu 0.7.0
|
// Emu 0.7.0
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "apu/blipBuffer.hpp"
|
#include "../blipBuffer.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
// Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
// Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/namco/apu.hpp"
|
#include "apu.hpp"
|
||||||
#include "apu/blipBuffer.hpp"
|
#include "../blipBuffer.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// Snd_Emu 0.1.7
|
// Snd_Emu 0.1.7
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "apu/apu.hpp"
|
#include "../apu.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
// Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
// Snd_Emu 0.1.7. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/vrc6/apu.hpp"
|
#include "apu.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2003-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
// Snd_Emu 0.1.7
|
// Snd_Emu 0.1.7
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "apu/blipBuffer.hpp"
|
#include "../blipBuffer.hpp"
|
||||||
#include "apu/apu.hpp"
|
#include "../apu.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "apu/vrc7/apu.hpp"
|
#include "apu.hpp"
|
||||||
#include "apu/vrc7/emu2413.hpp"
|
#include "emu2413.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
// Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
|
// Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include "apu/blipBuffer.hpp"
|
#include "../blipBuffer.hpp"
|
||||||
#include "apu/vrc7/emu2413_state.hpp"
|
#include "emu2413_state.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include "core.hpp"
|
#include "../core.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
@ -20,61 +20,61 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
New mapping distribution by Sergio Martin (eien86)
|
New mapping distribution by Sergio Martin (eien86)
|
||||||
https://github.com/SergioMartin86/jaffarPlus
|
https://github.com/SergioMartin86/jaffarPlus
|
||||||
*/
|
*/
|
||||||
#include "mappers/mapper000.hpp"
|
#include "mapper000.hpp"
|
||||||
#include "mappers/mapper001.hpp"
|
#include "mapper001.hpp"
|
||||||
#include "mappers/mapper002.hpp"
|
#include "mapper002.hpp"
|
||||||
#include "mappers/mapper003.hpp"
|
#include "mapper003.hpp"
|
||||||
#include "mappers/mapper004.hpp"
|
#include "mapper004.hpp"
|
||||||
#include "mappers/mapper005.hpp"
|
#include "mapper005.hpp"
|
||||||
#include "mappers/mapper007.hpp"
|
#include "mapper007.hpp"
|
||||||
#include "mappers/mapper009.hpp"
|
#include "mapper009.hpp"
|
||||||
#include "mappers/mapper010.hpp"
|
#include "mapper010.hpp"
|
||||||
#include "mappers/mapper011.hpp"
|
#include "mapper011.hpp"
|
||||||
#include "mappers/mapper015.hpp"
|
#include "mapper015.hpp"
|
||||||
#include "mappers/mapper019.hpp"
|
#include "mapper019.hpp"
|
||||||
#include "mappers/mapper021.hpp"
|
#include "mapper021.hpp"
|
||||||
#include "mappers/mapper022.hpp"
|
#include "mapper022.hpp"
|
||||||
#include "mappers/mapper023.hpp"
|
#include "mapper023.hpp"
|
||||||
#include "mappers/mapper024.hpp"
|
#include "mapper024.hpp"
|
||||||
#include "mappers/mapper025.hpp"
|
#include "mapper025.hpp"
|
||||||
#include "mappers/mapper026.hpp"
|
#include "mapper026.hpp"
|
||||||
#include "mappers/mapper030.hpp"
|
#include "mapper030.hpp"
|
||||||
#include "mappers/mapper032.hpp"
|
#include "mapper032.hpp"
|
||||||
#include "mappers/mapper033.hpp"
|
#include "mapper033.hpp"
|
||||||
#include "mappers/mapper034.hpp"
|
#include "mapper034.hpp"
|
||||||
#include "mappers/mapper060.hpp"
|
#include "mapper060.hpp"
|
||||||
#include "mappers/mapper066.hpp"
|
#include "mapper066.hpp"
|
||||||
#include "mappers/mapper069.hpp"
|
#include "mapper069.hpp"
|
||||||
#include "mappers/mapper070.hpp"
|
#include "mapper070.hpp"
|
||||||
#include "mappers/mapper071.hpp"
|
#include "mapper071.hpp"
|
||||||
#include "mappers/mapper073.hpp"
|
#include "mapper073.hpp"
|
||||||
#include "mappers/mapper075.hpp"
|
#include "mapper075.hpp"
|
||||||
#include "mappers/mapper078.hpp"
|
#include "mapper078.hpp"
|
||||||
#include "mappers/mapper079.hpp"
|
#include "mapper079.hpp"
|
||||||
#include "mappers/mapper085.hpp"
|
#include "mapper085.hpp"
|
||||||
#include "mappers/mapper086.hpp"
|
#include "mapper086.hpp"
|
||||||
#include "mappers/mapper087.hpp"
|
#include "mapper087.hpp"
|
||||||
#include "mappers/mapper088.hpp"
|
#include "mapper088.hpp"
|
||||||
#include "mappers/mapper089.hpp"
|
#include "mapper089.hpp"
|
||||||
#include "mappers/mapper093.hpp"
|
#include "mapper093.hpp"
|
||||||
#include "mappers/mapper094.hpp"
|
#include "mapper094.hpp"
|
||||||
#include "mappers/mapper097.hpp"
|
#include "mapper097.hpp"
|
||||||
#include "mappers/mapper113.hpp"
|
#include "mapper113.hpp"
|
||||||
#include "mappers/mapper140.hpp"
|
#include "mapper140.hpp"
|
||||||
#include "mappers/mapper152.hpp"
|
#include "mapper152.hpp"
|
||||||
#include "mappers/mapper154.hpp"
|
#include "mapper154.hpp"
|
||||||
#include "mappers/mapper156.hpp"
|
#include "mapper156.hpp"
|
||||||
#include "mappers/mapper180.hpp"
|
#include "mapper180.hpp"
|
||||||
#include "mappers/mapper184.hpp"
|
#include "mapper184.hpp"
|
||||||
#include "mappers/mapper190.hpp"
|
#include "mapper190.hpp"
|
||||||
#include "mappers/mapper193.hpp"
|
#include "mapper193.hpp"
|
||||||
#include "mappers/mapper206.hpp"
|
#include "mapper206.hpp"
|
||||||
#include "mappers/mapper207.hpp"
|
#include "mapper207.hpp"
|
||||||
#include "mappers/mapper232.hpp"
|
#include "mapper232.hpp"
|
||||||
#include "mappers/mapper240.hpp"
|
#include "mapper240.hpp"
|
||||||
#include "mappers/mapper241.hpp"
|
#include "mapper241.hpp"
|
||||||
#include "mappers/mapper244.hpp"
|
#include "mapper244.hpp"
|
||||||
#include "mappers/mapper246.hpp"
|
#include "mapper246.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
// Emu 0.7.0
|
// Emu 0.7.0
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include "cart.hpp"
|
#include "../cart.hpp"
|
||||||
#include "cpu.hpp"
|
#include "../cpu.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
#include "core.hpp"
|
#include "../core.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "core.hpp"
|
#include "../core.hpp"
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* 100-in-1 Contra Function 16
|
* 100-in-1 Contra Function 16
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/namco/apu.hpp"
|
#include "../apu/namco/apu.hpp"
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* VRC-2/VRC-4 Konami
|
* VRC-2/VRC-4 Konami
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
* VRC-2/VRC-4 Konami
|
* VRC-2/VRC-4 Konami
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include "mappers/mapper021.hpp"
|
#include "mapper021.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* VRC-2/VRC-4 Konami
|
* VRC-2/VRC-4 Konami
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
// Konami VRC6 mapper
|
// Konami VRC6 mapper
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/vrc6/apu.hpp"
|
#include "../apu/vrc6/apu.hpp"
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
* VRC-2/VRC-4 Konami
|
* VRC-2/VRC-4 Konami
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* Tested only on Troll Burner and Mystic Origins demo.
|
* Tested only on Troll Burner and Mystic Origins demo.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Unrom512
|
// Unrom512
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* 4-in-1 Multicart ( Reset-based )
|
* 4-in-1 Multicart ( Reset-based )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// NROM-128 4-in-1 multicart
|
// NROM-128 4-in-1 multicart
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -4,8 +4,8 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/libs/
|
// Emu 0.7.0. http://www.slack.net/~ant/libs/
|
||||||
|
|
||||||
#include "apu/fme7/apu.hpp"
|
#include "../apu/fme7/apu.hpp"
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2005 Chris Moeller */
|
/* Copyright (C) 2005 Chris Moeller */
|
||||||
/* Copyright (C) 2005-2006 Shay Green. This module is free software; you
|
/* Copyright (C) 2005-2006 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Mapper_74x161x162x32
|
// Mapper_74x161x162x32
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* VRC-3 Konami, Salamander
|
* VRC-3 Konami, Salamander
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* VRC-1 Konami
|
* VRC-1 Konami
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Holy Diver and Uchuusen - Cosmo Carrier.
|
// Holy Diver and Uchuusen - Cosmo Carrier.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* Nina-03 / Nina-06
|
* Nina-03 / Nina-06
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
// Emu 0.5.4. http://www.slack.net/~ant/
|
// Emu 0.5.4. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "apu/vrc7/apu.hpp"
|
#include "../apu/vrc7/apu.hpp"
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
/* Copyright (C) 2004-2005 Shay Green. This module is free software; you
|
/* Copyright (C) 2004-2005 Shay Green. This module is free software; you
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
// Optional less-common simple mappers
|
// Optional less-common simple mappers
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* Mapper 206
|
* Mapper 206
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* Mapper 93 - Sunsoft-2
|
* Mapper 93 - Sunsoft-2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Sunsoft2b
|
// Sunsoft2b
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* Mapper 93 - Sunsoft-2
|
* Mapper 93 - Sunsoft-2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Sunsoft2a
|
// Sunsoft2a
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Un1rom
|
// Un1rom
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Irem_Tam_S1
|
// Irem_Tam_S1
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Jaleco_JF11
|
// Jaleco_JF11
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// DIS23C01 DAOU ROM CONTROLLER
|
// DIS23C01 DAOU ROM CONTROLLER
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// UxROM (inverted)
|
// UxROM (inverted)
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
* Mapper 184 - Sunsoft-1
|
* Mapper 184 - Sunsoft-1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Sunsoft1
|
// Sunsoft1
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// Magic Kid Googoo
|
// Magic Kid Googoo
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// NTDEC's TC-112 mapper IC.
|
// NTDEC's TC-112 mapper IC.
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
* Mapper 206
|
* Mapper 206
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
// Emu 0.7.0. http://www.slack.net/~ant/
|
// Emu 0.7.0. http://www.slack.net/~ant/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
/* Copyright (C) 2004-2006 Shay Green. This module is free software; you
|
/* 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
|
can redistribute it and/or modify it under the terms of the GNU Lesser
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// https://www.nesdev.org/wiki/INES_Mapper240
|
// https://www.nesdev.org/wiki/INES_Mapper240
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// https://www.nesdev.org/wiki/INES_Mapper241
|
// https://www.nesdev.org/wiki/INES_Mapper241
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// https://www.nesdev.org/wiki/INES_Mapper244
|
// https://www.nesdev.org/wiki/INES_Mapper244
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mappers/mapper.hpp"
|
#include "mapper.hpp"
|
||||||
|
|
||||||
// https://www.nesdev.org/wiki/INES_Mapper246
|
// https://www.nesdev.org/wiki/INES_Mapper246
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "ppu.hpp"
|
#include "ppu.hpp"
|
||||||
#include "core.hpp"
|
#include "../core.hpp"
|
||||||
|
|
||||||
namespace quickerNES
|
namespace quickerNES
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,6 +32,6 @@ quickerNESSrc = quickerNESAPUSrc + quickerNESPPUSrc + [
|
||||||
|
|
||||||
quickerNESDependency = declare_dependency(
|
quickerNESDependency = declare_dependency(
|
||||||
compile_args : [ '-D_PAGE_SIZE="' + pageSize.to_string() + '"'],
|
compile_args : [ '-D_PAGE_SIZE="' + pageSize.to_string() + '"'],
|
||||||
include_directories : include_directories(['.', 'core']),
|
include_directories : include_directories(['.']),
|
||||||
sources : [ quickerNESSrc ]
|
sources : [ quickerNESSrc ]
|
||||||
)
|
)
|
|
@ -1,14 +1,14 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <core/emu.hpp>
|
#include <quickerNES/core/emu.hpp>
|
||||||
#include <emuInstanceBase.hpp>
|
#include <nesInstanceBase.hpp>
|
||||||
|
|
||||||
typedef quickerNES::Emu emulator_t;
|
typedef quickerNES::Emu emulator_t;
|
||||||
|
|
||||||
class EmuInstance : public EmuInstanceBase
|
class NESInstance : public NESInstanceBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EmuInstance() : EmuInstanceBase()
|
NESInstance() : NESInstanceBase()
|
||||||
{
|
{
|
||||||
// Creating new emulator
|
// Creating new emulator
|
||||||
_nes = new emulator_t;
|
_nes = new emulator_t;
|
||||||
|
@ -20,12 +20,12 @@ class EmuInstance : public EmuInstanceBase
|
||||||
_nes->set_pixels(video_buffer, image_width + 8);
|
_nes->set_pixels(video_buffer, image_width + 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
~EmuInstance() = default;
|
~NESInstance() = default;
|
||||||
|
|
||||||
virtual bool loadROMFileImpl(const std::string &romData) override
|
virtual bool loadROMImpl(const uint8_t* romData, const size_t romSize) override
|
||||||
{
|
{
|
||||||
// Loading rom data
|
// Loading rom data
|
||||||
_nes->load_ines((uint8_t *)romData.data());
|
_nes->load_ines(romData);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#include "nlohmann/json.hpp"
|
#include "nlohmann/json.hpp"
|
||||||
#include "sha1/sha1.hpp"
|
#include "sha1/sha1.hpp"
|
||||||
#include "utils.hpp"
|
#include "utils.hpp"
|
||||||
#include "emuInstance.hpp"
|
#include "nesInstance.hpp"
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -94,18 +94,28 @@ int main(int argc, char *argv[])
|
||||||
std::string controller2Type = scriptJson["Controller 2 Type"].get<std::string>();
|
std::string controller2Type = scriptJson["Controller 2 Type"].get<std::string>();
|
||||||
|
|
||||||
// Creating emulator instance
|
// Creating emulator instance
|
||||||
EmuInstance e;
|
NESInstance e;
|
||||||
|
|
||||||
// Setting controller types
|
// Setting controller types
|
||||||
e.setController1Type(controller1Type);
|
e.setController1Type(controller1Type);
|
||||||
e.setController2Type(controller2Type);
|
e.setController2Type(controller2Type);
|
||||||
|
|
||||||
// Loading ROM File
|
// Loading ROM File
|
||||||
e.loadROMFile(romFilePath);
|
std::string romFileData;
|
||||||
|
if (loadStringFromFile(romFileData, romFilePath) == false) EXIT_WITH_ERROR("Could not rom file: %s\n", romFilePath.c_str());
|
||||||
|
e.loadROM((uint8_t*)romFileData.data(), romFileData.size());
|
||||||
|
|
||||||
|
// Calculating ROM SHA1
|
||||||
|
auto romSHA1 = SHA1::GetHash((uint8_t *)romFileData.data(), romFileData.size());
|
||||||
|
|
||||||
// If an initial state is provided, load it now
|
// If an initial state is provided, load it now
|
||||||
if (initialStateFilePath != "") e.loadStateFile(initialStateFilePath);
|
if (initialStateFilePath != "")
|
||||||
|
{
|
||||||
|
std::string stateFileData;
|
||||||
|
if (loadStringFromFile(stateFileData, initialStateFilePath) == false) EXIT_WITH_ERROR("Could not initial state file: %s\n", initialStateFilePath.c_str());
|
||||||
|
e.deserializeState((uint8_t*)stateFileData.data());
|
||||||
|
}
|
||||||
|
|
||||||
// Disabling requested blocks from state serialization
|
// Disabling requested blocks from state serialization
|
||||||
for (const auto& block : stateDisabledBlocks) e.disableStateBlock(block);
|
for (const auto& block : stateDisabledBlocks) e.disableStateBlock(block);
|
||||||
|
|
||||||
|
@ -115,9 +125,6 @@ int main(int argc, char *argv[])
|
||||||
// Getting state size
|
// Getting state size
|
||||||
const auto stateSize = e.getStateSize();
|
const auto stateSize = e.getStateSize();
|
||||||
|
|
||||||
// Getting actual ROM SHA1
|
|
||||||
auto romSHA1 = e.getRomSHA1();
|
|
||||||
|
|
||||||
// Checking with the expected SHA1 hash
|
// Checking with the expected SHA1 hash
|
||||||
if (romSHA1 != expectedROMSHA1) EXIT_WITH_ERROR("Wrong ROM SHA1. Found: '%s', Expected: '%s'\n", romSHA1.c_str(), expectedROMSHA1.c_str());
|
if (romSHA1 != expectedROMSHA1) EXIT_WITH_ERROR("Wrong ROM SHA1. Found: '%s', Expected: '%s'\n", romSHA1.c_str(), expectedROMSHA1.c_str());
|
||||||
|
|
||||||
|
@ -174,11 +181,11 @@ int main(int argc, char *argv[])
|
||||||
double elapsedTimeSeconds = (double)dt * 1.0e-9;
|
double elapsedTimeSeconds = (double)dt * 1.0e-9;
|
||||||
|
|
||||||
// Calculating final state hash
|
// Calculating final state hash
|
||||||
const auto finalStateHash = e.getStateHash();
|
auto result = calculateStateHash(&e);
|
||||||
|
|
||||||
// Creating hash string
|
// Creating hash string
|
||||||
char hashStringBuffer[256];
|
char hashStringBuffer[256];
|
||||||
sprintf(hashStringBuffer, "0x%lX%lX", finalStateHash.first, finalStateHash.second);
|
sprintf(hashStringBuffer, "0x%lX%lX", result.first, result.second);
|
||||||
|
|
||||||
// Printing time information
|
// Printing time information
|
||||||
printf("[] Elapsed time: %3.3fs\n", (double)dt * 1.0e-9);
|
printf("[] Elapsed time: %3.3fs\n", (double)dt * 1.0e-9);
|
||||||
|
|
117
source/utils.hpp
117
source/utils.hpp
|
@ -2,25 +2,20 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <metrohash128/metrohash128.h>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <metrohash128/metrohash128.h>
|
||||||
// If we use NCurses, we need to use the appropriate printing function
|
#include "nesInstance.hpp"
|
||||||
#ifdef NCURSES
|
|
||||||
#include <ncurses.h>
|
|
||||||
#define LOG printw
|
|
||||||
#else
|
|
||||||
#define LOG printf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If we use NCurses, define the following useful functions
|
// If we use NCurses, define the following useful functions
|
||||||
#ifdef NCURSES
|
#ifdef NCURSES
|
||||||
|
|
||||||
|
#include <ncurses.h>
|
||||||
|
|
||||||
// Function to check for keypress taken from https://github.com/ajpaulson/learning-ncurses/blob/master/kbhit.c
|
// Function to check for keypress taken from https://github.com/ajpaulson/learning-ncurses/blob/master/kbhit.c
|
||||||
inline int kbhit()
|
inline int kbhit()
|
||||||
{
|
{
|
||||||
|
@ -84,16 +79,6 @@ inline void refreshTerminal()
|
||||||
|
|
||||||
#endif // NCURSES
|
#endif // NCURSES
|
||||||
|
|
||||||
typedef _uint128_t hash_t;
|
|
||||||
inline hash_t calculateMetroHash(uint8_t *data, size_t size)
|
|
||||||
{
|
|
||||||
MetroHash128 hash;
|
|
||||||
hash.Update(data, size);
|
|
||||||
hash_t result;
|
|
||||||
hash.Finalize(reinterpret_cast<uint8_t *>(&result));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to split a string into a sub-strings delimited by a character
|
// Function to split a string into a sub-strings delimited by a character
|
||||||
// Taken from stack overflow answer to https://stackoverflow.com/questions/236129/how-do-i-iterate-over-the-words-of-a-string
|
// Taken from stack overflow answer to https://stackoverflow.com/questions/236129/how-do-i-iterate-over-the-words-of-a-string
|
||||||
// By Evan Teran
|
// By Evan Teran
|
||||||
|
@ -126,26 +111,6 @@ inline std::string slurp(std::ifstream &in)
|
||||||
return sstr.str();
|
return sstr.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EXIT_WITH_ERROR(...) exitWithError(__FILE__, __LINE__, __VA_ARGS__)
|
|
||||||
inline void exitWithError [[noreturn]] (const char *fileName, const int lineNumber, const char *format, ...)
|
|
||||||
{
|
|
||||||
char *outstr = 0;
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, format);
|
|
||||||
int ret = vasprintf(&outstr, format, ap);
|
|
||||||
if (ret < 0) exit(-1);
|
|
||||||
|
|
||||||
std::string outString = outstr;
|
|
||||||
free(outstr);
|
|
||||||
|
|
||||||
char info[1024];
|
|
||||||
|
|
||||||
snprintf(info, sizeof(info) - 1, " + From %s:%d\n", fileName, lineNumber);
|
|
||||||
outString += info;
|
|
||||||
|
|
||||||
throw std::runtime_error(outString.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loads a string from a given file
|
// Loads a string from a given file
|
||||||
inline bool loadStringFromFile(std::string &dst, const std::string path)
|
inline bool loadStringFromFile(std::string &dst, const std::string path)
|
||||||
{
|
{
|
||||||
|
@ -191,70 +156,18 @@ inline std::vector<T> splitVector(const T size, const T n)
|
||||||
return subSizes;
|
return subSizes;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::string simplifyMove(const std::string &move)
|
typedef _uint128_t hash_t;
|
||||||
{
|
|
||||||
std::string simpleMove;
|
|
||||||
|
|
||||||
bool isEmptyMove = true;
|
inline hash_t calculateMetroHash(uint8_t *data, size_t size)
|
||||||
for (size_t i = 0; i < move.size(); i++)
|
{
|
||||||
if (move[i] != '.' && move[i] != '|')
|
MetroHash128 hash;
|
||||||
{
|
hash.Update(data, size);
|
||||||
simpleMove += move[i];
|
hash_t result;
|
||||||
isEmptyMove = false;
|
hash.Finalize(reinterpret_cast<uint8_t *>(&result));
|
||||||
}
|
return result;
|
||||||
if (isEmptyMove) return ".";
|
|
||||||
return simpleMove;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool getBitFlag(const uint8_t value, const uint8_t idx)
|
inline hash_t calculateStateHash(const NESInstance* nes)
|
||||||
{
|
{
|
||||||
if (((idx == 7) && (value & 0b10000000)) ||
|
return calculateMetroHash(nes->getLowMem(), _LOW_MEM_SIZE);
|
||||||
((idx == 6) && (value & 0b01000000)) ||
|
}
|
||||||
((idx == 5) && (value & 0b00100000)) ||
|
|
||||||
((idx == 4) && (value & 0b00010000)) ||
|
|
||||||
((idx == 3) && (value & 0b00001000)) ||
|
|
||||||
((idx == 2) && (value & 0b00000100)) ||
|
|
||||||
((idx == 1) && (value & 0b00000010)) ||
|
|
||||||
((idx == 0) && (value & 0b00000001))) return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline size_t countButtonsPressedString(const std::string &input)
|
|
||||||
{
|
|
||||||
size_t count = 0;
|
|
||||||
for (size_t i = 0; i < input.size(); i++)
|
|
||||||
if (input[i] != '.') count++;
|
|
||||||
return count;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
inline uint16_t countButtonsPressedNumber(const T &input)
|
|
||||||
{
|
|
||||||
uint16_t count = 0;
|
|
||||||
if (input & 0b0000000000000001) count++;
|
|
||||||
if (input & 0b0000000000000010) count++;
|
|
||||||
if (input & 0b0000000000000100) count++;
|
|
||||||
if (input & 0b0000000000001000) count++;
|
|
||||||
if (input & 0b0000000000010000) count++;
|
|
||||||
if (input & 0b0000000000100000) count++;
|
|
||||||
if (input & 0b0000000001000000) count++;
|
|
||||||
if (input & 0b0000000010000000) count++;
|
|
||||||
if (input & 0b0000000100000000) count++;
|
|
||||||
if (input & 0b0000001000000000) count++;
|
|
||||||
if (input & 0b0000010000000000) count++;
|
|
||||||
if (input & 0b0000100000000000) count++;
|
|
||||||
if (input & 0b0001000000000000) count++;
|
|
||||||
if (input & 0b0010000000000000) count++;
|
|
||||||
if (input & 0b0100000000000000) count++;
|
|
||||||
if (input & 0b1000000000000000) count++;
|
|
||||||
return count;
|
|
||||||
};
|
|
||||||
|
|
||||||
static auto moveCountComparerString = [](const std::string &a, const std::string &b)
|
|
||||||
{
|
|
||||||
return countButtonsPressedString(a) < countButtonsPressedString(b);
|
|
||||||
};
|
|
||||||
static auto moveCountComparerNumber = [](const uint8_t a, const uint8_t b)
|
|
||||||
{
|
|
||||||
return countButtonsPressedNumber(a) < countButtonsPressedNumber(b);
|
|
||||||
};
|
|
Loading…
Reference in New Issue