added namespaces

This commit is contained in:
Sergio Martin 2024-01-20 12:33:31 +01:00
parent d8513ef867
commit d1993751f6
101 changed files with 534 additions and 56 deletions

6
extern/hqn/hqn.cpp vendored
View File

@ -10,7 +10,7 @@ namespace hqn
int32_t *_initF_VideoPalette()
{
static int32_t VideoPalette[512];
const Nes_Emu::rgb_t *palette = Nes_Emu::nes_colors;
const emulator_t::rgb_t *palette = emulator_t::nes_colors;
for (int i = 0; i < 512; i++)
{
VideoPalette[i] = palette[i].red << 16 | palette[i].green << 8
@ -25,7 +25,7 @@ const int32_t *HQNState::NES_VIDEO_PALETTE = _initF_VideoPalette();
// Constructor
HQNState::HQNState()
{
m_emu = new Nes_Emu();
m_emu = new emulator_t();
joypad[0] = 0x00;
joypad[1] = 0x00;
@ -50,7 +50,7 @@ error_t HQNState::setSampleRate(int rate)
{
const char *ret = m_emu->set_sample_rate(rate);
if (!ret)
m_emu->set_equalizer(Nes_Emu::nes_eq);
m_emu->set_equalizer(emulator_t::nes_eq);
return ret;
}

27
extern/hqn/hqn.h vendored
View File

@ -7,6 +7,17 @@
#define BLIT_SIZE 65536
// Creating emulator instance
#ifdef _USE_QUICKNES
typedef Nes_Emu emulator_t;
#endif
#ifdef _USE_QUICKERNES
typedef quickerNES::Nes_Emu emulator_t;
#endif
namespace hqn
{
@ -36,7 +47,7 @@ class HQNState
public:
/* A reference to the emulator instance. */
Nes_Emu *m_emu;
emulator_t *m_emu;
static const int32_t *NES_VIDEO_PALETTE;
@ -46,7 +57,7 @@ public:
HQNState();
~HQNState();
void setEmulatorPointer(void* const emuPtr) { m_emu = (Nes_Emu*)emuPtr; }
void setEmulatorPointer(void* const emuPtr) { m_emu = (emulator_t*)emuPtr; }
/*
The joypad data for the two joypads available to an NES.
@ -55,7 +66,7 @@ public:
uint32_t joypad[2];
/* Get the emulator this state uses. */
inline Nes_Emu *emu() const
inline emulator_t *emu() const
{ return m_emu; }
@ -146,7 +157,7 @@ inline void saveBlit(const void *ePtr, int32_t *dest, const int32_t *colors, int
{
// what is the point of the 256 color bitmap and the dynamic color allocation to it?
// why not just render directly to a 512 color bitmap with static palette positions?
// Nes_Emu *e = m_emu; // e was a parameter but since this is now part of a class, it's just in here
// emulator_t *e = m_emu; // e was a parameter but since this is now part of a class, it's just in here
// const int srcpitch = e->frame().pitch;
// const unsigned char *src = e->frame().pixels;
// const unsigned char *const srcend = src + (e->image_height - cropbottom) * srcpitch;
@ -166,16 +177,16 @@ inline void saveBlit(const void *ePtr, int32_t *dest, const int32_t *colors, int
// }
// }
const Nes_Emu *e = (Nes_Emu*) ePtr;
const emulator_t *e = (emulator_t*) ePtr;
const unsigned char *in_pixels = e->frame().pixels;
if (in_pixels == NULL) return;
int32_t *out_pixels = dest;
for (unsigned h = 0; h < Nes_Emu::image_height; h++, in_pixels += e->frame().pitch, out_pixels += Nes_Emu::image_width)
for (unsigned w = 0; w < Nes_Emu::image_width; w++)
for (unsigned h = 0; h < emulator_t::image_height; h++, in_pixels += e->frame().pitch, out_pixels += emulator_t::image_width)
for (unsigned w = 0; w < emulator_t::image_width; w++)
{
unsigned col = e->frame().palette[in_pixels[w]];
const Nes_Emu::rgb_t& rgb = e->nes_colors[col];
const emulator_t::rgb_t& rgb = e->nes_colors[col];
unsigned r = rgb.red;
unsigned g = rgb.green;
unsigned b = rgb.blue;

View File

@ -11,7 +11,14 @@
#define _INVERSE_FRAME_RATE 16667
class Nes_Emu;
// Creating emulator instance
#ifdef _USE_QUICKNES
typedef Nes_Emu emulator_t;
#endif
#ifdef _USE_QUICKERNES
typedef quickerNES::Nes_Emu emulator_t;
#endif
struct stepData_t
{
@ -43,8 +50,8 @@ class PlaybackInstance
// Loading Emulator instance HQN
_hqnState.setEmulatorPointer(_emu->getInternalEmulatorPointer());
static uint8_t video_buffer[Nes_Emu::image_width * Nes_Emu::image_height];
_hqnState.m_emu->set_pixels(video_buffer, Nes_Emu::image_width + 8);
static uint8_t video_buffer[emulator_t::image_width * emulator_t::image_height];
_hqnState.m_emu->set_pixels(video_buffer, emulator_t::image_width + 8);
// Building sequence information
for (const auto &input : sequence)

View File

@ -90,7 +90,7 @@ int main(int argc, char *argv[])
#endif
#ifdef _USE_QUICKERNES
auto e = QuickerNESInstance();
auto e = quickerNES::QuickerNESInstance();
#endif
// Loading ROM File

View File

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <cstdlib>
#include <cstring>
namespace quickerNES
{
class Nes_Cart
{
public:
@ -110,3 +113,5 @@ class Nes_Cart
long chr_size_;
unsigned mapper;
};
} // namespace quickNES

View File

@ -22,6 +22,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <cstdio>
#include <string>
namespace quickerNES
{
class Nes_Cart;
#undef NES_EMU_CPU_HOOK
@ -598,7 +601,7 @@ class Nes_Core : private Nes_Cpu
// extra byte allows CPU to always read operand of instruction, which
// might go past end of data
uint8_t unmapped_page[::Nes_Cpu::page_size + 1];
uint8_t unmapped_page[Nes_Cpu::page_size + 1];
};
impl_t *impl; // keep large arrays separate
unsigned long error_count;
@ -1043,3 +1046,5 @@ inline void Nes_Core::cpu_write(nes_addr_t addr, int data, nes_time_t time)
else \
static_cast<Nes_Core &>(*cpu).cpu_write(addr, data, time); \
}
} // namespace quickNES

View File

@ -22,6 +22,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
#define st_n 0x80
#define st_v 0x40
#define st_r 0x20
@ -1164,3 +1167,5 @@ uint8_t clock_table [256] = {
2,6,2,8,3,3,5,5,2,2,2,2,4,4,6,6,// E
3,5,2,8,4,4,6,6,2,4,2,7,4,4,7,7 // F
};
} // namespace quickNES

View File

@ -5,6 +5,9 @@
#include <cstdint>
namespace quickerNES
{
typedef long nes_time_t; // clock cycle count
typedef unsigned nes_addr_t; // 16-bit address
@ -136,3 +139,5 @@ class Nes_Cpu
return (uint8_t *)code_map[addr >> page_bits] + addr;
}
};
} // namespace quickNES

View File

@ -15,6 +15,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
int const sound_fade_size = 384;
Nes_Emu::equalizer_t const Nes_Emu::nes_eq = { -1.0, 80 };
@ -441,3 +444,5 @@ void Nes_Emu::RestoreAudioBufferState()
sound_buf_changed_count = extra_sound_buf_changed_count;
sound_buf->RestoreAudioBufferState();
}
} // namespace quickNES

View File

@ -8,6 +8,9 @@
#include "Nes_Core.hpp"
#include "apu/Multi_Buffer.hpp"
namespace quickerNES
{
class Nes_State;
class Nes_Emu
@ -281,3 +284,5 @@ inline long Nes_Emu::chr_size() const
{
return cart()->chr_size() ? cart()->chr_size() : emu.ppu.chr_addr_size;
}
} // namespace quickNES

View File

@ -18,6 +18,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
int const buffer_extra = blip_widest_impulse_ + 2;
Blip_Buffer::Blip_Buffer()
@ -415,3 +418,5 @@ void Blip_Buffer::RestoreAudioBufferState()
reader_accum = extra_reader_accum;
memcpy(buffer_, extra_buffer, sizeof(extra_buffer));
}
} // namespace quickNES

View File

@ -1,10 +1,10 @@
#pragma once
// Band-limited sound synthesis and buffering
// Blip_Buffer 0.4.0
#ifndef BLIP_BUFFER_H
#define BLIP_BUFFER_H
namespace quickerNES
{
// Time unit at source clock rate
typedef long blip_time_t;
@ -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;
#endif
} // namespace quickNES

View File

@ -14,6 +14,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
typedef long fixed_t;
#define TO_FIXED(f) fixed_t((f) * (1L << 15) + 0.5)
@ -511,3 +514,5 @@ void Effects_Buffer::mix_enhanced(blip_sample_t *out, long count)
l2.end(bufs[5]);
r2.end(bufs[6]);
}
} // namespace quickNES

View File

@ -6,6 +6,9 @@
#include "Multi_Buffer.hpp"
#include <stdint.h>
namespace quickerNES
{
// Effects_Buffer uses several buffers and outputs stereo sample pairs.
class Effects_Buffer : public Multi_Buffer
{
@ -97,3 +100,5 @@ inline Effects_Buffer::channel_t Effects_Buffer::channel(int i)
{
return channels[i % chan_count];
}
} // namespace quickNES

View File

@ -15,6 +15,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
Multi_Buffer::Multi_Buffer(int spf) : samples_per_frame_(spf)
{
length_ = 0;
@ -280,3 +283,5 @@ void Stereo_Buffer::RestoreAudioBufferState()
center()->RestoreAudioBufferState();
right()->RestoreAudioBufferState();
}
} // namespace quickNES

View File

@ -6,6 +6,9 @@
#include "Blip_Buffer.hpp"
namespace quickerNES
{
// Interface to one or more Blip_Buffers mapped to one or more channels
// consisting of left, center, and right buffers.
class Multi_Buffer
@ -195,3 +198,5 @@ inline void Mono_Buffer::bass_freq(int freq) { buf.bass_freq(freq); }
inline long Mono_Buffer::read_samples(blip_sample_t *p, long s) { return buf.read_samples(p, s); }
inline long Mono_Buffer::samples_avail() const { return buf.samples_avail(); }
} // namespace quickNES

View File

@ -14,6 +14,9 @@ details. You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// Nes_Buffer
Nes_Buffer::Nes_Buffer() : Multi_Buffer(1) {}
@ -229,3 +232,5 @@ void Nes_Nonlinearizer::RestoreAudioBufferState()
accum = extra_accum;
prev = extra_prev;
}
} // namespace quickNES

View File

@ -6,6 +6,9 @@
#include "Multi_Buffer.hpp"
#include <cstdint>
namespace quickerNES
{
class Nes_Apu;
class Nes_Nonlinearizer
@ -75,3 +78,5 @@ class Nes_Buffer : public Multi_Buffer
virtual void SaveAudioBufferState();
virtual void RestoreAudioBufferState();
};
} // namespace quickNES

View File

@ -15,6 +15,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
Nes_Effects_Buffer::Nes_Effects_Buffer() : Effects_Buffer(true) // nes never uses stereo channels
{
config_t c;
@ -85,3 +88,5 @@ void Nes_Effects_Buffer::SaveAudioBufferState()
void Nes_Effects_Buffer::RestoreAudioBufferState()
{
}
} // namespace quickNES

View File

@ -6,6 +6,9 @@
#include "Effects_Buffer.hpp"
#include "Nes_Buffer.hpp"
namespace quickerNES
{
// Effects_Buffer uses several buffers and outputs stereo sample pairs.
class Nes_Effects_Buffer : public Effects_Buffer
{
@ -34,3 +37,5 @@ class Nes_Effects_Buffer : public Effects_Buffer
Nes_Nonlinearizer nonlin;
friend Multi_Buffer *set_apu(Nes_Effects_Buffer *, Nes_Apu *);
};
} // namespace quickNES

View File

@ -14,6 +14,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// Nes_Osc
void Nes_Osc::clock_length(int halt_mask)
@ -675,3 +678,5 @@ void Nes_Noise::run(nes_time_t time, nes_time_t end_time)
delay = time - end_time;
}
} // namespace quickNES

View File

@ -6,6 +6,9 @@
#include "Blip_Buffer.hpp"
namespace quickerNES
{
class Nes_Apu;
typedef long nes_time_t; // CPU clock cycle count
@ -165,3 +168,5 @@ struct Nes_Dmc : Nes_Osc
int count_reads(nes_time_t, nes_time_t *) const;
nes_time_t next_read_time() const;
};
} // namespace quickNES

View File

@ -13,6 +13,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
int const amp_range = 15;
Nes_Apu::Nes_Apu() : square1(&square_synth),
@ -368,3 +371,5 @@ int Nes_Apu::read_status(nes_time_t time)
return result;
}
} // namespace quickNES

View File

@ -3,9 +3,12 @@
// NES 2A03 APU sound chip emulator
// Nes_Snd_Emu 0.1.7
#include "Nes_Oscs.hpp"
#include <climits>
#include <cstdint>
#include "Nes_Oscs.hpp"
namespace quickerNES
{
class Nes_Apu
{
@ -356,3 +359,5 @@ inline void Nes_Apu::load_state(apu_state_t const &state)
noise.run(last_time, last_time);
dmc.run(last_time, last_time);
}
} // namespace quickNES

View File

@ -15,6 +15,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
void Nes_Fme7_Apu::reset()
{
last_time = 0;
@ -101,3 +104,5 @@ void Nes_Fme7_Apu::run_until(blip_time_t end_time)
last_time = end_time;
}
} // namespace quickNES

View File

@ -3,8 +3,11 @@
// Sunsoft FME-7 sound emulator
// Nes_Emu 0.7.0
#include "apu/Blip_Buffer.hpp"
#include <cstdint>
#include "apu/Blip_Buffer.hpp"
namespace quickerNES
{
struct fme7_apu_state_t
{
@ -148,3 +151,5 @@ inline void Nes_Fme7_Apu::load_state(fme7_apu_state_t const &in)
// Run sound channels for 0 cycles for clean audio after loading state
run_until(last_time);
}
} // namespace quickNES

View File

@ -15,6 +15,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
Nes_Namco_Apu::Nes_Namco_Apu()
{
output(0);
@ -176,3 +179,5 @@ void Nes_Namco_Apu::load_state(namco_state_t const &in)
run_until(last_time);
}
} // namespace quickNES

View File

@ -3,8 +3,11 @@
// Namco 106 sound chip emulator
// Nes_Snd_Emu 0.1.7
#include "apu/apu.hpp"
#include <cstdint>
#include "apu/apu.hpp"
namespace quickerNES
{
struct namco_state_t
{
@ -108,3 +111,5 @@ inline void Nes_Namco_Apu::write_data(nes_time_t time, int data)
run_until(time);
access() = data;
}
} // namespace quickNES

View File

@ -14,6 +14,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
Nes_Vrc6_Apu::Nes_Vrc6_Apu()
{
output(0);
@ -208,3 +211,5 @@ void Nes_Vrc6_Apu::run_saw(nes_time_t end_time)
osc.last_amp = last_amp;
}
} // namespace quickNES

View File

@ -4,9 +4,12 @@
// Konami VRC6 sound chip emulator
// Nes_Snd_Emu 0.1.7
#include <cstdint>
#include "apu/Blip_Buffer.hpp"
#include "apu/apu.hpp"
#include <cstdint>
namespace quickerNES
{
struct vrc6_apu_state_t;
@ -105,3 +108,5 @@ inline void Nes_Vrc6_Apu::treble_eq(blip_eq_t const &eq)
saw_synth.treble_eq(eq);
square_synth.treble_eq(eq);
}
} // namespace quickNES

View File

@ -1,6 +1,9 @@
#include <cstring>
#include "apu/vrc7/apu.hpp"
#include "apu/vrc7/emu2413.hpp"
#include <cstring>
namespace quickerNES
{
#define BYTESWAP(xxxx) \
{ \
@ -204,3 +207,5 @@ void Nes_Vrc7::update_last_amp()
}
}
}
} // namespace quickNES

View File

@ -4,9 +4,12 @@
// Konami VRC7 sound chip emulator
// Nes_Snd_Emu 0.1.7. Copyright (C) 2003-2005 Shay Green. GNU LGPL license.
#include <cstdint>
#include "apu/Blip_Buffer.hpp"
#include "apu/vrc7/emu2413_state.hpp"
#include <cstdint>
namespace quickerNES
{
struct vrc7_snapshot_t;
typedef long nes_time_t;
@ -72,3 +75,5 @@ inline void Nes_Vrc7::osc_output(int i, Blip_Buffer *buf)
{
oscs[i].output = buf;
}
} // namespace quickNES

View File

@ -61,6 +61,9 @@ if the origin of this software is not misrepresented.
#include <stdlib.h>
#include <string.h>
namespace quickerNES
{
static const unsigned char default_inst[15][8] = {
/* 2019-03-19 VRC7 instrument patchset dumped by Nuke.YKT */
/* https://wiki.nesdev.com/w/index.php/VRC7_audio */
@ -1148,3 +1151,5 @@ void OPLL_writeIO(OPLL *opll, e_uint32 adr, e_uint32 val)
else
opll->adr = val;
}
} // namespace quickNES

View File

@ -1,5 +1,8 @@
#pragma once
namespace quickerNES
{
typedef signed int e_int;
typedef unsigned int e_uint;
typedef signed char e_int8;
@ -216,3 +219,5 @@ extern "C"
#ifdef __cplusplus
}
#endif
} // namespace quickNES

View File

@ -1,6 +1,9 @@
#include "emu2413_state.hpp"
#include <stdint.h>
namespace quickerNES
{
#ifdef __cplusplus
extern "C"
{
@ -109,3 +112,5 @@ extern "C"
#ifdef __cplusplus
}
#endif
} // namespace quickNES

View File

@ -2,6 +2,9 @@
#include "emu2413.hpp"
namespace quickerNES
{
typedef struct
{
e_int32 feedback;
@ -34,3 +37,5 @@ extern "C"
#ifdef __cplusplus
}
#endif
} // namespace quickNES

View File

@ -76,6 +76,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "mappers/mapper244.hpp"
#include "mappers/mapper246.hpp"
namespace quickerNES
{
Nes_Mapper::Nes_Mapper()
{
emu_ = NULL;
@ -287,3 +290,5 @@ Nes_Mapper *Nes_Mapper::getMapperFromCode(const int mapperCode)
return mapper;
}
} // namespace quickNES

View File

@ -7,6 +7,9 @@
#include "Nes_Cpu.hpp"
#include <climits>
namespace quickerNES
{
class Blip_Buffer;
class blip_eq_t;
class Nes_Core;
@ -205,3 +208,5 @@ inline void Nes_Mapper::register_state(void *p, unsigned s)
inline bool Nes_Mapper::write_intercepted(nes_time_t, nes_addr_t, int) { return false; }
inline int Nes_Mapper::read(nes_time_t, nes_addr_t) { return -1; } // signal to caller
} // namespace quickNES

View File

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// NROM
namespace quickerNES
{
class Mapper000 : public Nes_Mapper
{
public:
@ -31,3 +34,5 @@ class Mapper000 : public Nes_Mapper
// empty
}
};
} // namespace quickNES

View File

@ -16,6 +16,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// MMC1
struct mmc1_state_t
@ -122,3 +125,5 @@ class Mapper001 : public Nes_Mapper, mmc1_state_t
}
}
};
} // namespace quickNES

View File

@ -17,6 +17,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// UNROM
class Mapper002 : public Nes_Mapper
@ -41,3 +44,5 @@ class Mapper002 : public Nes_Mapper
set_prg_bank(0x8000, bank_16k, data);
}
};
} // namespace quickNES

View File

@ -17,6 +17,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// CNROM
class Mapper003 : public Nes_Mapper
@ -40,3 +43,5 @@ class Mapper003 : public Nes_Mapper
set_chr_bank(0, bank_8k, bank & 7);
}
};
} // namespace quickNES

View File

@ -18,6 +18,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// 264 or less breaks Gargoyle's Quest II
// 267 or less breaks Magician
int const irq_fine_tune = 268;
@ -251,3 +254,5 @@ class Mapper004 : public Nes_Mapper, mmc3_state_t
nes_time_t next_time;
int counter_just_clocked; // used only for debugging
};
} // namespace quickNES

View File

@ -19,6 +19,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
struct mmc5_state_t
{
enum
@ -145,3 +148,5 @@ class Mapper005 : public Nes_Mapper, mmc5_state_t
nes_time_t irq_time;
};
} // namespace quickNES

View File

@ -17,6 +17,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// AOROM
class Mapper007 : public Nes_Mapper
@ -48,3 +51,5 @@ class Mapper007 : public Nes_Mapper
set_prg_bank(0x8000, bank_32k, bank & 7);
}
};
} // namespace quickNES

View File

@ -3,6 +3,9 @@
#include "mappers/mapper.hpp"
#include <cstring>
namespace quickerNES
{
// MMC2
class Mapper009 : public Nes_Mapper
@ -74,3 +77,5 @@ class Mapper009 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -2,6 +2,9 @@
#include "mappers/mapper.hpp"
#include <cstring>
namespace quickerNES
{
// MMC4
class Mapper010 : public Nes_Mapper
@ -72,3 +75,5 @@ class Mapper010 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -17,6 +17,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
// Color Dreams
class Mapper011 : public Nes_Mapper
@ -48,3 +51,5 @@ class Mapper011 : public Nes_Mapper
set_chr_bank(0, bank_8k, bank >> 4);
}
};
} // namespace quickNES

View File

@ -19,6 +19,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct Mapper015_state_t
{
uint8_t prg_bank[4];
@ -90,3 +93,5 @@ class Mapper015 : public Nes_Mapper, Mapper015_state_t
unsigned long int i;
};
} // namespace quickNES

View File

@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// to do: CHR mapping and nametable handling needs work
namespace quickerNES
{
struct namco106_state_t
{
uint8_t regs[16];
@ -195,3 +198,5 @@ class Mapper019 : public Nes_Mapper, namco106_state_t
Nes_Namco_Apu sound;
nes_time_t last_time;
};
} // namespace quickNES

View File

@ -28,6 +28,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct vrc2_state_t
{
uint8_t prg_banks[2];
@ -252,3 +255,5 @@ void Mapper_VRC2_4<type_a, type_b>::write_irq(nes_time_t time,
}
typedef Mapper_VRC2_4<true, true> Mapper021;
} // namespace quickNES

View File

@ -29,4 +29,9 @@
#include "mappers/mapper.hpp"
#include "mappers/mapper021.hpp"
namespace quickerNES
{
typedef Mapper_VRC2_4<false, true> Mapper022;
} // namespace quickNES

View File

@ -28,4 +28,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
typedef Mapper_VRC2_4<false, false> Mapper023;
} // namespace quickNES

View File

@ -18,6 +18,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
struct vrc6_state_t
{
// written registers
@ -229,3 +232,5 @@ class Mapper_Vrc6 : public Nes_Mapper, vrc6_state_t
};
typedef Mapper_Vrc6<0> Mapper024;
} // namespace quickNES

View File

@ -28,4 +28,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
typedef Mapper_VRC2_4<true, false> Mapper025;
} // namespace quickNES

View File

@ -6,4 +6,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
typedef Mapper_Vrc6<3> Mapper026;
} // namespace quickNES

View File

@ -31,6 +31,9 @@
// Unrom512
namespace quickerNES
{
class Mapper030 : public Nes_Mapper
{
public:
@ -49,3 +52,5 @@ class Mapper030 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct mapper32_state_t
{
uint8_t chr_bank[8];
@ -122,3 +125,5 @@ class Mapper032 : public Nes_Mapper, mapper32_state_t
}
}
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct tc0190_state_t
{
uint8_t preg[2];
@ -99,3 +102,5 @@ class Mapper033 : public Nes_Mapper, tc0190_state_t
}
}
};
} // namespace quickNES

View File

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Nina-1 (Deadly Towers only)
namespace quickerNES
{
class Mapper034 : public Nes_Mapper
{
uint8_t bank;
@ -40,3 +43,5 @@ class Mapper034 : public Nes_Mapper
set_prg_bank(0x8000, bank_32k, bank);
}
};
} // namespace quickNES

View File

@ -21,6 +21,9 @@
// NROM-128 4-in-1 multicart
namespace quickerNES
{
class Mapper060 : public Nes_Mapper
{
public:
@ -49,3 +52,5 @@ class Mapper060 : public Nes_Mapper
uint8_t game_sel, last_game;
};
} // namespace quickNES

View File

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// GNROM
namespace quickerNES
{
class Mapper066 : public Nes_Mapper
{
uint8_t bank;
@ -48,3 +51,5 @@ class Mapper066 : public Nes_Mapper
set_chr_bank(0, bank_8k, bank & 3);
}
};
} // namespace quickNES

View File

@ -19,6 +19,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
struct fme7_state_t
{
// first 16 bytes in register order
@ -186,3 +189,5 @@ class Mapper069 : public Nes_Mapper, fme7_state_t
nes_time_t last_time;
Nes_Fme7_Apu sound;
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
// Mapper_74x161x162x32
namespace quickerNES
{
template <int mapperId>
class Mapper_74x161x162x32 : public Nes_Mapper
{
@ -80,3 +83,5 @@ class Mapper_74x161x162x32 : public Nes_Mapper
};
typedef Mapper_74x161x162x32<70> Mapper070;
} // namespace quickNES

View File

@ -19,6 +19,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Camerica
namespace quickerNES
{
class Mapper071 : public Nes_Mapper
{
uint8_t regs[3];
@ -50,3 +53,5 @@ class Mapper071 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct vrc3_state_t
{
bool irq_enable;
@ -131,8 +134,4 @@ class Mapper073 : public Nes_Mapper, vrc3_state_t
}
};
// void register_vrc3_mapper();
// void register_vrc3_mapper()
// {
// register_mapper< Mapper073> ( 73 );
// }
} // namespace quickNES

View File

@ -19,6 +19,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct vrc1_state_t
{
uint8_t prg_banks[3];
@ -106,3 +109,5 @@ class Mapper075 : public Nes_Mapper, vrc1_state_t
}
}
};
} // namespace quickNES

View File

@ -4,6 +4,9 @@
// Holy Diver and Uchuusen - Cosmo Carrier.
namespace quickerNES
{
class Mapper078 : public Nes_Mapper
{
// lower 8 bits are the reg at 8000:ffff
@ -73,3 +76,5 @@ class Mapper078 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
template <bool multicart>
class Mapper_AveNina : public Nes_Mapper
{
@ -91,3 +94,5 @@ void Mapper_AveNina<multicart>::write_regs()
}
typedef Mapper_AveNina<false> Mapper079;
} // namespace quickNES

View File

@ -17,6 +17,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
struct vrc7_state_t
{
// written registers
@ -221,3 +224,5 @@ class Mapper085 : public Nes_Mapper, vrc7_state_t
timer_period = 113 * 4 + 3
};
};
} // namespace quickNES

View File

@ -21,4 +21,9 @@
*
*/
namespace quickerNES
{
typedef Mapper_74x161x162x32<86> Mapper086;
} // namespace quickNES

View File

@ -18,6 +18,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Jaleco/Konami/Taito
namespace quickerNES
{
class Mapper087 : public Nes_Mapper
{
uint8_t bank;
@ -46,3 +49,5 @@ class Mapper087 : public Nes_Mapper
void write(nes_time_t, nes_addr_t, int) {}
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct namco_34x3_state_t
{
uint8_t bank[8];
@ -108,10 +111,5 @@ class Mapper_Namco_34x3 : public Nes_Mapper, namco_34x3_state_t
typedef Mapper_Namco_34x3<false> Mapper088;
// void register_mapper_namco_34xx();
// void register_mapper_namco_34xx()
// {
// register_mapper< Mapper_Namco_34x3 <false> > ( 88 );
// register_mapper< Mapper_Namco_34x3 <true> > ( 154 );
// register_mapper< Mapper_Namco_34xx > ( 206 );
// }
} // namespace quickNES

View File

@ -26,6 +26,9 @@
// Sunsoft2b
namespace quickerNES
{
class Mapper089 : public Nes_Mapper
{
public:
@ -55,3 +58,5 @@ class Mapper089 : public Nes_Mapper
uint8_t regs;
};
} // namespace quickNES

View File

@ -26,6 +26,9 @@
// Sunsoft2a
namespace quickerNES
{
class Mapper093 : public Nes_Mapper
{
public:
@ -54,3 +57,5 @@ class Mapper093 : public Nes_Mapper
uint8_t regs;
};
} // namespace quickNES

View File

@ -28,6 +28,9 @@
// Un1rom
namespace quickerNES
{
class Mapper094 : public Nes_Mapper
{
public:
@ -53,3 +56,5 @@ class Mapper094 : public Nes_Mapper
uint8_t bank;
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
// Irem_Tam_S1
namespace quickerNES
{
class Mapper097 : public Nes_Mapper
{
public:
@ -62,3 +65,5 @@ class Mapper097 : public Nes_Mapper
uint8_t bank;
};
} // namespace quickNES

View File

@ -25,4 +25,9 @@
* Nina-03 / Nina-06
*/
namespace quickerNES
{
typedef Mapper_AveNina<true> Mapper113;
} // namespace quickNES

View File

@ -28,6 +28,9 @@
// Jaleco_JF11
namespace quickerNES
{
class Mapper140 : public Nes_Mapper
{
public:
@ -62,3 +65,5 @@ class Mapper140 : public Nes_Mapper
uint8_t regs;
};
} // namespace quickNES

View File

@ -21,4 +21,9 @@
*
*/
namespace quickerNES
{
typedef Mapper_74x161x162x32<152> Mapper152;
} // namespace quickNES

View File

@ -25,4 +25,9 @@
* Mapper 206
*/
namespace quickerNES
{
typedef Mapper_Namco_34x3<true> Mapper154;
} // namespace quickNES

View File

@ -4,6 +4,9 @@
// DIS23C01 DAOU ROM CONTROLLER
namespace quickerNES
{
struct m156_state_t
{
uint8_t prg_bank;
@ -58,3 +61,5 @@ class Mapper156 : public Nes_Mapper, m156_state_t
}
}
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
// UxROM (inverted)
namespace quickerNES
{
class Mapper180 : public Nes_Mapper
{
public:
@ -53,3 +56,5 @@ class Mapper180 : public Nes_Mapper
uint8_t bank;
};
} // namespace quickNES

View File

@ -26,6 +26,9 @@
// Sunsoft1
namespace quickerNES
{
class Mapper184 : public Nes_Mapper
{
public:
@ -63,3 +66,5 @@ class Mapper184 : public Nes_Mapper
uint8_t regs;
};
} // namespace quickNES

View File

@ -4,6 +4,9 @@
// Magic Kid Googoo
namespace quickerNES
{
class Mapper190 : public Nes_Mapper
{
public:
@ -53,3 +56,5 @@ class Mapper190 : public Nes_Mapper
}
}
};
} // namespace quickNES

View File

@ -29,6 +29,9 @@
// NTDEC's TC-112 mapper IC.
namespace quickerNES
{
class Mapper193 : public Nes_Mapper
{
public:
@ -74,3 +77,5 @@ class Mapper193 : public Nes_Mapper
uint8_t regs[4];
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct namco_34xx_state_t
{
uint8_t bank[8];
@ -96,3 +99,5 @@ class Mapper206 : public Nes_Mapper, namco_34xx_state_t
}
}
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
#include "mappers/mapper.hpp"
namespace quickerNES
{
struct taito_x1005_state_t
{
uint8_t preg[3];
@ -89,3 +92,5 @@ class Mapper207 : public Nes_Mapper, taito_x1005_state_t
virtual void write(nes_time_t, nes_addr_t addr, int data) {}
};
} // namespace quickNES

View File

@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Quattro
namespace quickerNES
{
class Mapper232 : public Nes_Mapper
{
uint8_t regs[2];
@ -52,3 +55,5 @@ class Mapper232 : public Nes_Mapper
Mapper232::apply_mapping();
}
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
// https://www.nesdev.org/wiki/INES_Mapper240
namespace quickerNES
{
class Mapper240 : public Nes_Mapper
{
public:
@ -62,3 +65,5 @@ class Mapper240 : public Nes_Mapper
uint8_t regs;
};
} // namespace quickNES

View File

@ -25,6 +25,9 @@
// https://www.nesdev.org/wiki/INES_Mapper241
namespace quickerNES
{
class Mapper241 : public Nes_Mapper
{
public:
@ -51,3 +54,5 @@ class Mapper241 : public Nes_Mapper
uint8_t bank;
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
// https://www.nesdev.org/wiki/INES_Mapper244
namespace quickerNES
{
struct mapper244_state_t
{
uint8_t preg;
@ -68,3 +71,5 @@ class Mapper244 : public Nes_Mapper, mapper244_state_t
}
}
};
} // namespace quickNES

View File

@ -27,6 +27,9 @@
// https://www.nesdev.org/wiki/INES_Mapper246
namespace quickerNES
{
class Mapper246 : public Nes_Mapper
{
public:
@ -73,3 +76,5 @@ class Mapper246 : public Nes_Mapper
uint8_t regs[8];
};
} // namespace quickNES

View File

@ -3,9 +3,12 @@
// Nes_Emu 0.7.0. http://www.slack.net/~ant/
#include <cstring>
#include "Nes_Ppu.hpp"
#include "Nes_Core.hpp"
#include <cstring>
namespace quickerNES
{
/* 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
@ -652,3 +655,5 @@ nes_time_t Nes_Ppu::earliest_open_bus_decay()
{
return (decay_low < decay_high) ? decay_low : decay_high;
}
} // namespace quickNES

View File

@ -3,8 +3,11 @@
// NES PPU emulator
// Nes_Emu 0.7.0
#include "Nes_Ppu_Rendering.hpp"
#include <climits>
#include "Nes_Ppu_Rendering.hpp"
namespace quickerNES
{
class Nes_Mapper;
class Nes_Core;
@ -139,3 +142,5 @@ inline void Nes_Ppu::update_open_bus(nes_time_t time)
if (time >= decay_low) open_bus &= ~0x1F;
if (time >= decay_high) open_bus &= ~0xE0;
}
} // namespace quickNES

View File

@ -16,6 +16,9 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
namespace quickerNES
{
int const cache_line_size = 128; // tile cache is kept aligned to this boundary
inline void set_be32(void *p, unsigned long n)
@ -429,3 +432,5 @@ long Nes_Ppu_Impl::recalc_sprite_max(int scanline)
return 0;
}
} // namespace quickNES

View File

@ -5,6 +5,9 @@
#include <cstdint>
namespace quickerNES
{
struct ppu_state_t
{
uint8_t w2000; // control
@ -239,3 +242,5 @@ inline void Nes_Ppu_Impl::begin_frame()
palette_offset = palette_begin * 0x01010101;
addr_inc = w2000 & 4 ? 32 : 1;
}
} // namespace quickNES

View File

@ -16,7 +16,8 @@ more details. You should have received a copy of the GNU Lesser General
Public License along with this module; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Nes_Ppu_Impl
namespace quickerNES
{
static unsigned zero = 0; // helps CodeWarrior optimizer when added to constants
@ -501,3 +502,5 @@ void Nes_Ppu_Rendering::draw_background(int start, int count)
}
}
}
} // namespace quickNES

View File

@ -5,6 +5,9 @@
#include "Nes_Ppu_Impl.hpp"
namespace quickerNES
{
class Nes_Ppu_Rendering : public Nes_Ppu_Impl
{
typedef Nes_Ppu_Impl base;
@ -57,3 +60,5 @@ inline void Nes_Ppu_Rendering::draw_sprites(int start, int count)
{
draw_scanlines(start, count, host_pixels + host_row_bytes * start, host_row_bytes, 2);
}
} // namespace quickNES

View File

@ -3,6 +3,9 @@
#include <Nes_Emu.hpp>
#include <emuInstance.hpp>
namespace quickerNES
{
class QuickerNESInstance : public EmuInstance
{
public:
@ -72,3 +75,5 @@ class QuickerNESInstance : public EmuInstance
// Emulator instance
Nes_Emu *_nes;
};
} // namespace quickNES

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