parent
18b97b4342
commit
07e490254c
|
@ -28,8 +28,6 @@ Effects_Buffer::Effects_Buffer( int max_bufs, long echo_size_ ) : Multi_Buffer(
|
||||||
echo_size = max( max_read * (long) stereo, echo_size_ & ~1 );
|
echo_size = max( max_read * (long) stereo, echo_size_ & ~1 );
|
||||||
clock_rate_ = 0;
|
clock_rate_ = 0;
|
||||||
bass_freq_ = 90;
|
bass_freq_ = 90;
|
||||||
bufs = 0;
|
|
||||||
bufs_size = 0;
|
|
||||||
bufs_max = max( max_bufs, (int) extra_chans );
|
bufs_max = max( max_bufs, (int) extra_chans );
|
||||||
no_echo = true;
|
no_echo = true;
|
||||||
no_effects = true;
|
no_effects = true;
|
||||||
|
@ -59,24 +57,13 @@ Effects_Buffer::~Effects_Buffer()
|
||||||
// avoid using new []
|
// avoid using new []
|
||||||
blargg_err_t Effects_Buffer::new_bufs( int size )
|
blargg_err_t Effects_Buffer::new_bufs( int size )
|
||||||
{
|
{
|
||||||
bufs = (buf_t*) malloc( size * sizeof *bufs );
|
bufs = std::vector<buf_t>( size );
|
||||||
CHECK_ALLOC( bufs );
|
|
||||||
for ( int i = 0; i < size; i++ )
|
|
||||||
new (bufs + i) buf_t;
|
|
||||||
bufs_size = size;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effects_Buffer::delete_bufs()
|
void Effects_Buffer::delete_bufs()
|
||||||
{
|
{
|
||||||
if ( bufs )
|
bufs.clear();
|
||||||
{
|
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
|
||||||
bufs [i].~buf_t();
|
|
||||||
free( bufs );
|
|
||||||
bufs = 0;
|
|
||||||
}
|
|
||||||
bufs_size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
blargg_err_t Effects_Buffer::set_sample_rate( long rate, int msec )
|
blargg_err_t Effects_Buffer::set_sample_rate( long rate, int msec )
|
||||||
|
@ -90,15 +77,15 @@ blargg_err_t Effects_Buffer::set_sample_rate( long rate, int msec )
|
||||||
void Effects_Buffer::clock_rate( long rate )
|
void Effects_Buffer::clock_rate( long rate )
|
||||||
{
|
{
|
||||||
clock_rate_ = rate;
|
clock_rate_ = rate;
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( auto& buf : bufs )
|
||||||
bufs [i].clock_rate( clock_rate_ );
|
buf.clock_rate( clock_rate_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Effects_Buffer::bass_freq( int freq )
|
void Effects_Buffer::bass_freq( int freq )
|
||||||
{
|
{
|
||||||
bass_freq_ = freq;
|
bass_freq_ = freq;
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( auto& buf : bufs )
|
||||||
bufs [i].bass_freq( bass_freq_ );
|
buf.bass_freq( bass_freq_ );
|
||||||
}
|
}
|
||||||
|
|
||||||
blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types )
|
blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types )
|
||||||
|
@ -113,8 +100,8 @@ blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types )
|
||||||
|
|
||||||
RETURN_ERR( new_bufs( min( bufs_max, count + extra_chans ) ) );
|
RETURN_ERR( new_bufs( min( bufs_max, count + extra_chans ) ) );
|
||||||
|
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( auto& buf : bufs )
|
||||||
RETURN_ERR( bufs [i].set_sample_rate( sample_rate(), length() ) );
|
RETURN_ERR( buf.set_sample_rate( sample_rate(), length() ) );
|
||||||
|
|
||||||
for ( int i = chans.size(); --i >= 0; )
|
for ( int i = chans.size(); --i >= 0; )
|
||||||
{
|
{
|
||||||
|
@ -149,8 +136,8 @@ void Effects_Buffer::clear()
|
||||||
s.low_pass [1] = 0;
|
s.low_pass [1] = 0;
|
||||||
mixer.samples_read = 0;
|
mixer.samples_read = 0;
|
||||||
|
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( auto& buf : bufs )
|
||||||
bufs [i].clear();
|
buf.clear();
|
||||||
clear_echo();
|
clear_echo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +233,7 @@ void Effects_Buffer::apply_config()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if ( !bufs_size )
|
if ( bufs.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
s.treble = TO_FIXED( config_.treble );
|
s.treble = TO_FIXED( config_.treble );
|
||||||
|
@ -427,8 +414,8 @@ void Effects_Buffer::assign_buffers()
|
||||||
|
|
||||||
void Effects_Buffer::end_frame( blip_time_t time )
|
void Effects_Buffer::end_frame( blip_time_t time )
|
||||||
{
|
{
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( auto& buf : bufs )
|
||||||
bufs [i].end_frame( time );
|
buf.end_frame( time );
|
||||||
}
|
}
|
||||||
|
|
||||||
long Effects_Buffer::read_samples( blip_sample_t* out, long out_size )
|
long Effects_Buffer::read_samples( blip_sample_t* out, long out_size )
|
||||||
|
@ -476,14 +463,13 @@ long Effects_Buffer::read_samples( blip_sample_t* out, long out_size )
|
||||||
|
|
||||||
if ( samples_avail() <= 0 || immediate_removal() )
|
if ( samples_avail() <= 0 || immediate_removal() )
|
||||||
{
|
{
|
||||||
for ( int i = bufs_size; --i >= 0; )
|
for ( buf_t& buf : bufs )
|
||||||
{
|
{
|
||||||
buf_t& b = bufs [i];
|
|
||||||
// TODO: might miss non-silence settling since it checks END of last read
|
// TODO: might miss non-silence settling since it checks END of last read
|
||||||
if ( b.non_silent() )
|
if ( buf.non_silent() )
|
||||||
b.remove_samples( mixer.samples_read );
|
buf.remove_samples( mixer.samples_read );
|
||||||
else
|
else
|
||||||
b.remove_silence( mixer.samples_read );
|
buf.remove_silence( mixer.samples_read );
|
||||||
}
|
}
|
||||||
mixer.samples_read = 0;
|
mixer.samples_read = 0;
|
||||||
}
|
}
|
||||||
|
@ -501,8 +487,8 @@ void Effects_Buffer::mix_effects( blip_sample_t* out_, int pair_count )
|
||||||
{
|
{
|
||||||
// mix any modified buffers
|
// mix any modified buffers
|
||||||
{
|
{
|
||||||
buf_t* buf = bufs;
|
buf_t* buf = bufs.data();
|
||||||
int bufs_remain = bufs_size;
|
int bufs_remain = bufs.size();
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( buf->non_silent() && ( buf->echo == !!echo_phase ) )
|
if ( buf->non_silent() && ( buf->echo == !!echo_phase ) )
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#ifndef EFFECTS_BUFFER_H
|
#ifndef EFFECTS_BUFFER_H
|
||||||
#define EFFECTS_BUFFER_H
|
#define EFFECTS_BUFFER_H
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "Multi_Buffer.h"
|
#include "Multi_Buffer.h"
|
||||||
|
|
||||||
// See Simple_Effects_Buffer (below) for a simpler interface
|
// See Simple_Effects_Buffer (below) for a simpler interface
|
||||||
|
@ -94,21 +96,8 @@ class Effects_Buffer : public Multi_Buffer
|
||||||
struct buf_t : Tracked_Blip_Buffer {
|
struct buf_t : Tracked_Blip_Buffer {
|
||||||
fixed_t vol[stereo];
|
fixed_t vol[stereo];
|
||||||
bool echo;
|
bool echo;
|
||||||
|
|
||||||
void *operator new(size_t, void *p)
|
|
||||||
{
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
void operator delete(void *)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~buf_t()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
buf_t *bufs;
|
std::vector<buf_t> bufs;
|
||||||
int bufs_size;
|
|
||||||
int bufs_max; // bufs_size <= bufs_max, to limit memory usage
|
int bufs_max; // bufs_size <= bufs_max, to limit memory usage
|
||||||
Stereo_Mixer mixer;
|
Stereo_Mixer mixer;
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ unsigned dictionary_hash(const char *key)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
unsigned hash;
|
unsigned hash;
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
len = strlen(key);
|
len = strlen(key);
|
||||||
for (hash = 0, i = 0; i < len; i++) {
|
for (hash = 0, i = 0; i < len; i++) {
|
||||||
|
|
|
@ -4,6 +4,25 @@
|
||||||
#define STREAM_PIXEL_FORMAT AV_PIX_FMT_YUV420P
|
#define STREAM_PIXEL_FORMAT AV_PIX_FMT_YUV420P
|
||||||
#define IN_SOUND_FORMAT AV_SAMPLE_FMT_S16
|
#define IN_SOUND_FORMAT AV_SAMPLE_FMT_S16
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Wrapper around an AVPacket that frees the underlying packet on destruction.
|
||||||
|
class ScopedAVPacket {
|
||||||
|
public:
|
||||||
|
ScopedAVPacket() : av_packet_(av_packet_alloc()) {}
|
||||||
|
~ScopedAVPacket() {
|
||||||
|
av_packet_free(&av_packet_);
|
||||||
|
}
|
||||||
|
|
||||||
|
AVPacket* operator->() { return av_packet_; }
|
||||||
|
AVPacket* get() { return av_packet_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
AVPacket* av_packet_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
struct supportedCodecs {
|
struct supportedCodecs {
|
||||||
AVCodecID codecId;
|
AVCodecID codecId;
|
||||||
char const *longName;
|
char const *longName;
|
||||||
|
@ -377,10 +396,9 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint8_t *vid)
|
||||||
if (!isRecording) return MRET_OK;
|
if (!isRecording) return MRET_OK;
|
||||||
// fill and encode frame variables
|
// fill and encode frame variables
|
||||||
int got_packet = 0, ret = 0;
|
int got_packet = 0, ret = 0;
|
||||||
AVPacket pkt;
|
ScopedAVPacket pkt;
|
||||||
av_init_packet(&pkt);
|
pkt->data = NULL;
|
||||||
pkt.data = NULL;
|
pkt->size = 0;
|
||||||
pkt.size = 0;
|
|
||||||
// fill frame with current pic
|
// fill frame with current pic
|
||||||
ret = av_image_fill_arrays(frameIn->data, frameIn->linesize,
|
ret = av_image_fill_arrays(frameIn->data, frameIn->linesize,
|
||||||
(uint8_t *)vid + tbord * (linesize + pixsize * rbord),
|
(uint8_t *)vid + tbord * (linesize + pixsize * rbord),
|
||||||
|
@ -393,17 +411,17 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint8_t *vid)
|
||||||
// set valid pts for frame
|
// set valid pts for frame
|
||||||
frameOut->pts = npts++;
|
frameOut->pts = npts++;
|
||||||
// finally, encode frame
|
// finally, encode frame
|
||||||
got_packet = avcodec_receive_packet(enc, &pkt);
|
got_packet = avcodec_receive_packet(enc, pkt.get());
|
||||||
ret = avcodec_send_frame(enc, frameOut);
|
ret = avcodec_send_frame(enc, frameOut);
|
||||||
if (ret < 0) return MRET_ERR_RECORDING;
|
if (ret < 0) return MRET_ERR_RECORDING;
|
||||||
if (!got_packet)
|
if (!got_packet)
|
||||||
{
|
{
|
||||||
// rescale output packet timestamp values from codec
|
// rescale output packet timestamp values from codec
|
||||||
// to stream timebase
|
// to stream timebase
|
||||||
av_packet_rescale_ts(&pkt, enc->time_base, st->time_base);
|
av_packet_rescale_ts(pkt.get(), enc->time_base, st->time_base);
|
||||||
pkt.stream_index = st->index;
|
pkt->stream_index = st->index;
|
||||||
//log_packet(oc, &pkt);
|
//log_packet(oc, pkt.get());
|
||||||
ret = av_interleaved_write_frame(oc, &pkt);
|
ret = av_interleaved_write_frame(oc, pkt.get());
|
||||||
if (ret < 0) return MRET_ERR_RECORDING;
|
if (ret < 0) return MRET_ERR_RECORDING;
|
||||||
}
|
}
|
||||||
return MRET_OK;
|
return MRET_OK;
|
||||||
|
@ -584,10 +602,9 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
||||||
}
|
}
|
||||||
|
|
||||||
int got_packet;
|
int got_packet;
|
||||||
AVPacket pkt;
|
ScopedAVPacket pkt;
|
||||||
av_init_packet(&pkt);
|
pkt->data = NULL;
|
||||||
pkt.data = NULL;
|
pkt->size = 0;
|
||||||
pkt.size = 0;
|
|
||||||
|
|
||||||
if (avcodec_fill_audio_frame(audioframeTmp, c->channels, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
if (avcodec_fill_audio_frame(audioframeTmp, c->channels, IN_SOUND_FORMAT, (const uint8_t *)audioBuffer, samples_size, 1) < 0)
|
||||||
{
|
{
|
||||||
|
@ -604,17 +621,17 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
||||||
audioframe->pts = av_rescale_q(samplesCount, {1, c->sample_rate}, c->time_base);
|
audioframe->pts = av_rescale_q(samplesCount, {1, c->sample_rate}, c->time_base);
|
||||||
samplesCount += dst_nb_samples;
|
samplesCount += dst_nb_samples;
|
||||||
|
|
||||||
got_packet = avcodec_receive_packet(c, &pkt);
|
got_packet = avcodec_receive_packet(c, pkt.get());
|
||||||
if (avcodec_send_frame(c, audioframe) < 0)
|
if (avcodec_send_frame(c, audioframe) < 0)
|
||||||
{
|
{
|
||||||
return MRET_ERR_RECORDING;
|
return MRET_ERR_RECORDING;
|
||||||
}
|
}
|
||||||
if (!got_packet)
|
if (!got_packet)
|
||||||
{
|
{
|
||||||
av_packet_rescale_ts(&pkt, { 1, c->sample_rate }, ast->time_base);
|
av_packet_rescale_ts(pkt.get(), { 1, c->sample_rate }, ast->time_base);
|
||||||
pkt.stream_index = ast->index;
|
pkt->stream_index = ast->index;
|
||||||
//log_packet(oc, &pkt);
|
//log_packet(oc, pkt.get());
|
||||||
if (av_interleaved_write_frame(oc, &pkt) < 0)
|
if (av_interleaved_write_frame(oc, pkt.get()) < 0)
|
||||||
{
|
{
|
||||||
return MRET_ERR_RECORDING;
|
return MRET_ERR_RECORDING;
|
||||||
}
|
}
|
||||||
|
@ -637,11 +654,10 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
||||||
// "X frames left in the queue on closing"
|
// "X frames left in the queue on closing"
|
||||||
void recording::MediaRecorder::flush_frames()
|
void recording::MediaRecorder::flush_frames()
|
||||||
{
|
{
|
||||||
AVPacket pkt;
|
ScopedAVPacket pkt;
|
||||||
av_init_packet(&pkt);
|
pkt->data = NULL;
|
||||||
pkt.data = NULL;
|
pkt->size = 0;
|
||||||
pkt.size = 0;
|
|
||||||
// flush last audio frames
|
// flush last audio frames
|
||||||
while (avcodec_receive_packet(aenc, &pkt) >= 0)
|
while (avcodec_receive_packet(aenc, pkt.get()) >= 0)
|
||||||
avcodec_send_frame(aenc, NULL);
|
avcodec_send_frame(aenc, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,7 @@ void blendPixel(const Kernel_3x3& ker,
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
//make sure there is no second blending in an adjacent rotation for this pixel: handles insular pixels, mario eyes
|
//make sure there is no second blending in an adjacent rotation for this pixel: handles insular pixels, mario eyes
|
||||||
if (getTopR(blend) != BLEND_NONE && !eq(e, g)) //but support double-blending for 90° corners
|
if (getTopR(blend) != BLEND_NONE && !eq(e, g)) //but support double-blending for 90<EFBFBD> corners
|
||||||
return false;
|
return false;
|
||||||
if (getBottomL(blend) != BLEND_NONE && !eq(e, c))
|
if (getBottomL(blend) != BLEND_NONE && !eq(e, c))
|
||||||
return false;
|
return false;
|
||||||
|
@ -1019,7 +1019,7 @@ struct Scaler6x : public ColorGradient
|
||||||
|
|
||||||
struct ColorDistanceRGB
|
struct ColorDistanceRGB
|
||||||
{
|
{
|
||||||
static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight)
|
static double dist(uint32_t pix1, uint32_t pix2, double /* luminanceWeight */)
|
||||||
{
|
{
|
||||||
return distYCbCrBuffered(pix1, pix2);
|
return distYCbCrBuffered(pix1, pix2);
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ struct ColorDistanceRGB
|
||||||
|
|
||||||
struct ColorDistanceARGB
|
struct ColorDistanceARGB
|
||||||
{
|
{
|
||||||
static double dist(uint32_t pix1, uint32_t pix2, double luminanceWeight)
|
static double dist(uint32_t pix1, uint32_t pix2, double /* luminanceWeight */)
|
||||||
{
|
{
|
||||||
const double a1 = getAlpha(pix1) / 255.0 ;
|
const double a1 = getAlpha(pix1) / 255.0 ;
|
||||||
const double a2 = getAlpha(pix2) / 255.0 ;
|
const double a2 = getAlpha(pix2) / 255.0 ;
|
||||||
|
|
|
@ -3392,7 +3392,7 @@ static bool gbReadSaveState(gzFile gzFile)
|
||||||
ub = utilReadInt(gzFile) ? true : false;
|
ub = utilReadInt(gzFile) ? true : false;
|
||||||
ib = utilReadInt(gzFile) ? true : false;
|
ib = utilReadInt(gzFile) ? true : false;
|
||||||
|
|
||||||
if ((ub != coreOptions.useBios) && (ib)) {
|
if ((ub != (bool)(coreOptions.useBios)) && (ib)) {
|
||||||
if (coreOptions.useBios)
|
if (coreOptions.useBios)
|
||||||
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
systemMessage(MSG_SAVE_GAME_NOT_USING_BIOS,
|
||||||
N_("Save game is not using the BIOS files"));
|
N_("Save game is not using the BIOS files"));
|
||||||
|
|
|
@ -692,21 +692,20 @@ uint8_t parseExpressionType(char* given_type)
|
||||||
}
|
}
|
||||||
if ((type[0] == 'S') || type[0] == 'U') {
|
if ((type[0] == 'S') || type[0] == 'U') {
|
||||||
flags |= (4 - ((type[0] - 'S') << 1));
|
flags |= (4 - ((type[0] - 'S') << 1));
|
||||||
type++;
|
if (type[1] == 'H') {
|
||||||
if (type[0] == 'H') {
|
type[1] = '1';
|
||||||
type[0] = '1';
|
type[2] = '6';
|
||||||
type[1] = '6';
|
type[3] = '\0';
|
||||||
|
} else if (type[1] == 'W') {
|
||||||
|
type[1] = '3';
|
||||||
|
type[2] = '2';
|
||||||
|
type[3] = '\0';
|
||||||
|
} else if (type[1] == 'B') {
|
||||||
|
type[1] = '8';
|
||||||
type[2] = '\0';
|
type[2] = '\0';
|
||||||
} else if (type[0] == 'W') {
|
|
||||||
type[0] = '3';
|
|
||||||
type[1] = '2';
|
|
||||||
type[2] = '\0';
|
|
||||||
} else if (type[0] == 'B') {
|
|
||||||
type[0] = '8';
|
|
||||||
type[1] = '\0';
|
|
||||||
}
|
}
|
||||||
int size;
|
int size;
|
||||||
sscanf(type, "%d", &size);
|
sscanf(type + 1, "%d", &size);
|
||||||
size = (size >> 3) - 1;
|
size = (size >> 3) - 1;
|
||||||
flags |= (size >= 2 ? 2 : ((uint8_t)size));
|
flags |= (size >= 2 ? 2 : ((uint8_t)size));
|
||||||
free(type);
|
free(type);
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ int CPULoadRomData(const char* data, int size)
|
||||||
|
|
||||||
void doMirroring(bool b)
|
void doMirroring(bool b)
|
||||||
{
|
{
|
||||||
if (romSize > k32MiB)
|
if (static_cast<size_t>(romSize) > k32MiB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int romSizeRounded = romSize;
|
int romSizeRounded = romSize;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This file was written by denopqrihg
|
// This file was written by denopqrihg
|
||||||
// with major changes by tjm
|
// with major changes by tjm
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ const char* MakeInstanceFilename(const char* Input)
|
||||||
#ifndef NO_LINK
|
#ifndef NO_LINK
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SENDING = false,
|
SENDING = 0,
|
||||||
RECEIVING = true
|
RECEIVING = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum siocnt_lo_32bit {
|
enum siocnt_lo_32bit {
|
||||||
|
@ -472,7 +472,7 @@ static const int trtimeend[3][4] = {
|
||||||
|
|
||||||
// Hodgepodge
|
// Hodgepodge
|
||||||
static uint8_t tspeed = 3;
|
static uint8_t tspeed = 3;
|
||||||
static bool transfer_direction = false;
|
static int transfer_direction = 0;
|
||||||
static uint16_t linkid = 0;
|
static uint16_t linkid = 0;
|
||||||
#if (defined __WIN32__ || defined _WIN32)
|
#if (defined __WIN32__ || defined _WIN32)
|
||||||
static HANDLE linksync[4];
|
static HANDLE linksync[4];
|
||||||
|
@ -2451,7 +2451,8 @@ static void UpdateRFUSocket(int ticks)
|
||||||
rfu_client.Recv(); // recv broadcast data
|
rfu_client.Recv(); // recv broadcast data
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CLIENTS; i++) {
|
const int max_clients = MAX_CLIENTS > 5 ? 5 : MAX_CLIENTS;
|
||||||
|
for (int i = 0; i < max_clients; i++) {
|
||||||
if (i != linkid) {
|
if (i != linkid) {
|
||||||
rfu_data.rfu_listback[i] = 0; // Flush the queue
|
rfu_data.rfu_listback[i] = 0; // Flush the queue
|
||||||
}
|
}
|
||||||
|
|
|
@ -543,7 +543,8 @@ static inline void CPUWriteMemory(uint32_t address, uint32_t value)
|
||||||
(*cpuSaveGameFunc)(address, (uint8_t)value);
|
(*cpuSaveGameFunc)(address, (uint8_t)value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// default
|
goto unwritable;
|
||||||
|
// fallthrough
|
||||||
default:
|
default:
|
||||||
unwritable:
|
unwritable:
|
||||||
#ifdef GBA_LOGGING
|
#ifdef GBA_LOGGING
|
||||||
|
@ -802,6 +803,7 @@ static inline void CPUWriteByte(uint32_t address, uint8_t b)
|
||||||
(*cpuSaveGameFunc)(address, b);
|
(*cpuSaveGameFunc)(address, b);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
goto unwritable;
|
||||||
// default
|
// default
|
||||||
default:
|
default:
|
||||||
unwritable:
|
unwritable:
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#include "../common/Port.h"
|
#include "../common/Port.h"
|
||||||
#include "GBA.h"
|
#include "GBA.h"
|
||||||
|
@ -769,18 +770,22 @@ static void soundReadGameOld(gzFile in, int version)
|
||||||
skip_read(in, 6 * 735 + 2 * 735);
|
skip_read(in, 6 * 735 + 2 * 735);
|
||||||
|
|
||||||
// Copy APU regs
|
// Copy APU regs
|
||||||
static int const regs_to_copy[] = {
|
static constexpr std::array<int, 21> regs_to_copy {
|
||||||
NR10, NR11, NR12, NR13, NR14,
|
NR10, NR11, NR12, NR13, NR14,
|
||||||
NR21, NR22, NR23, NR24,
|
NR21, NR22, NR23, NR24,
|
||||||
NR30, NR31, NR32, NR33, NR34,
|
NR30, NR31, NR32, NR33, NR34,
|
||||||
NR41, NR42, NR43, NR44,
|
NR41, NR42, NR43, NR44,
|
||||||
NR50, NR51, NR52, -1
|
NR50, NR51, NR52,
|
||||||
};
|
};
|
||||||
|
|
||||||
g_ioMem[NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
g_ioMem[NR52] |= 0x80; // old sound played even when this wasn't set (power on)
|
||||||
|
|
||||||
for (int i = 0; regs_to_copy[i] >= 0; i++)
|
for (const int gba_reg: regs_to_copy) {
|
||||||
state.apu.regs[gba_to_gb_sound(regs_to_copy[i]) - 0xFF10] = g_ioMem[regs_to_copy[i]];
|
const int gb_reg = gba_to_gb_sound(gba_reg);
|
||||||
|
if (gb_reg >= 0xFF10) {
|
||||||
|
state.apu.regs[gb_reg - 0xFF10] = g_ioMem[gba_reg];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Copy wave RAM to both banks
|
// Copy wave RAM to both banks
|
||||||
memcpy(&state.apu.regs[0x20], &g_ioMem[0x90], 0x10);
|
memcpy(&state.apu.regs[0x20], &g_ioMem[0x90], 0x10);
|
||||||
|
|
|
@ -239,8 +239,8 @@ int sdlMirroringEnable = 1;
|
||||||
void systemConsoleMessage(const char*);
|
void systemConsoleMessage(const char*);
|
||||||
|
|
||||||
char* home;
|
char* home;
|
||||||
char homeConfigDir[1024];
|
char homeConfigDir[1024] = "";
|
||||||
char homeDataDir[1024];
|
char homeDataDir[1024] = "";
|
||||||
|
|
||||||
bool screenMessage = false;
|
bool screenMessage = false;
|
||||||
char screenMessageBuffer[21];
|
char screenMessageBuffer[21];
|
||||||
|
@ -399,7 +399,7 @@ FILE* sdlFindFile(const char* name)
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (homeDataDir) {
|
if (strlen(homeDataDir)) {
|
||||||
fprintf(stdout, "Searching home directory: %s\n", homeDataDir);
|
fprintf(stdout, "Searching home directory: %s\n", homeDataDir);
|
||||||
sprintf(path, "%s%c%s", homeDataDir, FILE_SEP, name);
|
sprintf(path, "%s%c%s", homeDataDir, FILE_SEP, name);
|
||||||
f = fopen(path, "r");
|
f = fopen(path, "r");
|
||||||
|
|
|
@ -18,10 +18,8 @@
|
||||||
#include "config/option.h"
|
#include "config/option.h"
|
||||||
#include "dialogs/validated-child.h"
|
#include "dialogs/validated-child.h"
|
||||||
#include "rpi.h"
|
#include "rpi.h"
|
||||||
#include "wayland.h"
|
|
||||||
#include "widgets/option-validator.h"
|
#include "widgets/option-validator.h"
|
||||||
#include "widgets/render-plugin.h"
|
#include "widgets/render-plugin.h"
|
||||||
#include "widgets/wx/wxmisc.h"
|
|
||||||
#include "wxvbam.h"
|
#include "wxvbam.h"
|
||||||
|
|
||||||
namespace dialogs {
|
namespace dialogs {
|
||||||
|
|
|
@ -88,22 +88,22 @@ bool wxCheckedListCtrl::Init()
|
||||||
wxMemoryDC renderer_dc;
|
wxMemoryDC renderer_dc;
|
||||||
// Unchecked
|
// Unchecked
|
||||||
renderer_dc.SelectObject(unchecked_bmp);
|
renderer_dc.SelectObject(unchecked_bmp);
|
||||||
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
|
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
|
||||||
renderer_dc.Clear();
|
renderer_dc.Clear();
|
||||||
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), 0);
|
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), 0);
|
||||||
// Checked
|
// Checked
|
||||||
renderer_dc.SelectObject(checked_bmp);
|
renderer_dc.SelectObject(checked_bmp);
|
||||||
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
|
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
|
||||||
renderer_dc.Clear();
|
renderer_dc.Clear();
|
||||||
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), wxCONTROL_CHECKED);
|
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), wxCONTROL_CHECKED);
|
||||||
// Unchecked and Disabled
|
// Unchecked and Disabled
|
||||||
renderer_dc.SelectObject(unchecked_disabled_bmp);
|
renderer_dc.SelectObject(unchecked_disabled_bmp);
|
||||||
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
|
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
|
||||||
renderer_dc.Clear();
|
renderer_dc.Clear();
|
||||||
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), 0 | wxCONTROL_DISABLED);
|
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), 0 | wxCONTROL_DISABLED);
|
||||||
// Checked and Disabled
|
// Checked and Disabled
|
||||||
renderer_dc.SelectObject(checked_disabled_bmp);
|
renderer_dc.SelectObject(checked_disabled_bmp);
|
||||||
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID));
|
renderer_dc.SetBackground(*wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxBRUSHSTYLE_SOLID));
|
||||||
renderer_dc.Clear();
|
renderer_dc.Clear();
|
||||||
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), wxCONTROL_CHECKED | wxCONTROL_DISABLED);
|
wxRendererNative::Get().DrawCheckBox(this, renderer_dc, wxRect(0, 0, 16, 16), wxCONTROL_CHECKED | wxCONTROL_DISABLED);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,24 +40,6 @@
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBUPDATE, wxEVT_COMMAND_LIST_ITEM_CHECKED, -1);
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBUPDATE, wxEVT_COMMAND_LIST_ITEM_CHECKED, -1);
|
||||||
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBUPDATE, wxEVT_COMMAND_LIST_ITEM_UNCHECKED, -1);
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBUPDATE, wxEVT_COMMAND_LIST_ITEM_UNCHECKED, -1);
|
||||||
|
|
||||||
#define EVT_LIST_ITEM_CHECKED(id, fn) \
|
|
||||||
DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_LIST_ITEM_CHECKED, \
|
|
||||||
id, \
|
|
||||||
-1, \
|
|
||||||
(wxObjectEventFunction)(wxEventFunction)( \
|
|
||||||
wxListEventFunction)&fn, \
|
|
||||||
(wxObject*)NULL) \
|
|
||||||
,
|
|
||||||
|
|
||||||
#define EVT_LIST_ITEM_UNCHECKED(id, fn) \
|
|
||||||
DECLARE_EVENT_TABLE_ENTRY(wxEVT_COMMAND_LIST_ITEM_UNCHECKED, \
|
|
||||||
id, \
|
|
||||||
-1, \
|
|
||||||
(wxObjectEventFunction)(wxEventFunction)( \
|
|
||||||
wxListEventFunction)&fn, \
|
|
||||||
(wxObject*)NULL) \
|
|
||||||
,
|
|
||||||
|
|
||||||
//! This is the class which performs all transactions with the server.
|
//! This is the class which performs all transactions with the server.
|
||||||
//! It uses the wxSocket facilities.
|
//! It uses the wxSocket facilities.
|
||||||
class WXDLLIMPEXP_WEBUPDATE wxCheckedListCtrl : public wxListCtrl {
|
class WXDLLIMPEXP_WEBUPDATE wxCheckedListCtrl : public wxListCtrl {
|
||||||
|
|
|
@ -308,7 +308,9 @@ wxString wxvbamApp::GetAbsolutePath(wxString path)
|
||||||
|
|
||||||
if (fn.IsRelative()) {
|
if (fn.IsRelative()) {
|
||||||
fn.MakeRelativeTo(GetConfigurationPath());
|
fn.MakeRelativeTo(GetConfigurationPath());
|
||||||
fn.Normalize();
|
fn.Normalize(wxPATH_NORM_ENV_VARS | wxPATH_NORM_DOTS | wxPATH_NORM_TILDE |
|
||||||
|
wxPATH_NORM_CASE | wxPATH_NORM_ABSOLUTE | wxPATH_NORM_LONG |
|
||||||
|
wxPATH_NORM_SHORTCUT);
|
||||||
return fn.GetFullPath();
|
return fn.GetFullPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -265,7 +265,7 @@ public:
|
||||||
void ResetMenuAccelerators();
|
void ResetMenuAccelerators();
|
||||||
|
|
||||||
// 2.8 has no HasFocus(), and FindFocus() doesn't work right
|
// 2.8 has no HasFocus(), and FindFocus() doesn't work right
|
||||||
bool HasFocus() const
|
bool HasFocus() const override
|
||||||
{
|
{
|
||||||
return focused;
|
return focused;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue