Fix AVCodec deprecations and fix warnings
Fix AVCodec deprecations and fix warnings
This commit is contained in:
parent
ed013bd22c
commit
07c7bb40a1
|
@ -119,24 +119,48 @@ recording::MediaRet recording::MediaRecorder::setup_audio_stream()
|
|||
// audio codec context
|
||||
aenc = avcodec_alloc_context3(acodec);
|
||||
if (!aenc) return MRET_ERR_BUFSIZE;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
aenc->sample_fmt = acodec->sample_fmts ? acodec->sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
#else
|
||||
const enum AVSampleFormat *sample_fmts = NULL;
|
||||
if (acodec) {
|
||||
avcodec_get_supported_config (aenc, acodec, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0,
|
||||
(const void **)&sample_fmts, NULL);
|
||||
aenc->sample_fmt = sample_fmts ? sample_fmts[0] : AV_SAMPLE_FMT_FLTP;
|
||||
}
|
||||
#endif
|
||||
aenc->bit_rate = 128000; // mp3
|
||||
aenc->sample_rate = sampleRate;
|
||||
// this might be useful to check if the codec suports the
|
||||
// sample rate, but it is not strictly needed for now
|
||||
bool isSupported = false;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
if (acodec->supported_samplerates)
|
||||
{
|
||||
for (int i = 0; acodec->supported_samplerates[i]; ++i)
|
||||
{
|
||||
if (acodec->supported_samplerates[i] == sampleRate)
|
||||
#else
|
||||
const int *supported_samplerates = NULL;
|
||||
int num_supported_samplerates = 0;
|
||||
if (acodec) {
|
||||
avcodec_get_supported_config(aenc, acodec, AV_CODEC_CONFIG_SAMPLE_RATE, 0,
|
||||
(const void **) &supported_samplerates, &num_supported_samplerates);
|
||||
for (int i = 0; i < num_supported_samplerates; i++)
|
||||
{
|
||||
if (supported_samplerates[i] == sampleRate)
|
||||
#endif
|
||||
{
|
||||
isSupported = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
if (!isSupported && acodec->supported_samplerates) return MRET_ERR_NOCODEC;
|
||||
#else
|
||||
if (!isSupported && num_supported_samplerates) return MRET_ERR_NOCODEC;
|
||||
#endif
|
||||
#if LIBAVCODEC_VERSION_MAJOR >= 60
|
||||
av_channel_layout_from_mask(&(aenc->ch_layout), AV_CH_LAYOUT_STEREO);
|
||||
#else
|
||||
|
@ -461,7 +485,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
|
|||
if (enc)
|
||||
{
|
||||
avcodec_free_context(&enc);
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
avcodec_close(enc);
|
||||
#endif
|
||||
enc = NULL;
|
||||
}
|
||||
if (vcodec)
|
||||
|
@ -510,7 +536,9 @@ void recording::MediaRecorder::Stop(bool initSuccess)
|
|||
if (aenc)
|
||||
{
|
||||
avcodec_free_context(&aenc);
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(61, 13, 100)
|
||||
avcodec_close(aenc);
|
||||
#endif
|
||||
aenc = NULL;
|
||||
}
|
||||
samplesCount = 0;
|
||||
|
@ -624,7 +652,7 @@ recording::MediaRet recording::MediaRecorder::AddFrame(const uint16_t *aud, int
|
|||
return MRET_ERR_RECORDING;
|
||||
}
|
||||
|
||||
int dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
||||
int64_t dst_nb_samples = av_rescale_rnd(swr_get_delay(swr, c->sample_rate) + audioframeTmp->nb_samples, c->sample_rate, c->sample_rate, AV_ROUND_UP);
|
||||
av_assert0(dst_nb_samples == audioframeTmp->nb_samples);
|
||||
|
||||
if (swr_convert(swr, audioframe->data, audioframe->nb_samples, (const uint8_t **)audioframeTmp->data, audioframeTmp->nb_samples) < 0)
|
||||
|
|
|
@ -105,7 +105,7 @@ class MediaRecorder
|
|||
const AVCodec *acodec;
|
||||
AVStream *ast;
|
||||
AVCodecContext *aenc;
|
||||
int samplesCount; // for audio frame pts generation
|
||||
int64_t samplesCount; // for audio frame pts generation
|
||||
AVFrame *audioframe;
|
||||
AVFrame *audioframeTmp;
|
||||
// audio buffer
|
||||
|
|
|
@ -58,7 +58,7 @@ void drawText(uint8_t* screen, int pitch, int x, int y,
|
|||
char c = *string++;
|
||||
uint8_t* scr = screen;
|
||||
|
||||
uint16_t mask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t mask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
int h, w;
|
||||
uint16_t* s = (uint16_t*)scr;
|
||||
for (h = 0; h < 8; h++) {
|
||||
|
|
|
@ -620,7 +620,7 @@ void SuperEagle (uint8_t *srcPtr, uint32_t srcPitch, uint8_t *deltaPtr,
|
|||
|
||||
*((uint32_t *) dP) = product1a;
|
||||
*((uint32_t *) (dP + dstPitch)) = product2a;
|
||||
*xP = color5;
|
||||
*xP = (uint16_t)color5;
|
||||
|
||||
bP += inc_bP;
|
||||
xP += inc_bP;
|
||||
|
@ -1169,7 +1169,7 @@ void Scale_2xSaI (uint8_t *srcPtr, uint32_t srcPitch, uint8_t * /* deltaPtr */,
|
|||
uint32_t E, F, G, H;
|
||||
uint32_t I, J, K, L;
|
||||
uint32_t x1, x2, a1, f1, f2;
|
||||
uint32_t position, product1;
|
||||
uint32_t position, product1 = 0;
|
||||
|
||||
position = w >> 16;
|
||||
A = bP[position]; // current pixel
|
||||
|
|
|
@ -166,7 +166,7 @@ void SmartIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int hei
|
|||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + srcPitch * starty;
|
||||
|
@ -217,7 +217,7 @@ void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int heig
|
|||
}
|
||||
#endif
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
|
||||
uint16_t *src1 = (uint16_t *)frm1 + srcPitch * starty / 2;
|
||||
|
@ -587,7 +587,7 @@ void MotionBlurIB8(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, in
|
|||
InterframeFilterInit();
|
||||
}
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint8_t *src0 = (uint8_t *)srcPtr + starty * srcPitch;
|
||||
uint8_t *src1 = (uint8_t *)frm1 + starty * srcPitch;
|
||||
|
@ -624,7 +624,7 @@ void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int
|
|||
}
|
||||
#endif
|
||||
|
||||
uint16_t colorMask = ~RGB_LOW_BITS_MASK;
|
||||
uint16_t colorMask = (uint16_t)(~RGB_LOW_BITS_MASK);
|
||||
|
||||
uint16_t *src0 = (uint16_t *)srcPtr + starty * srcPitch / 2;
|
||||
uint16_t *src1 = (uint16_t *)frm1 + starty * srcPitch / 2;
|
||||
|
|
|
@ -553,9 +553,9 @@ inline void Blip_Synth<quality, range>::offset_resampled(blip_resampled_time_t t
|
|||
|
||||
blip_long i0 = *imp;
|
||||
BLIP_FWD(0)
|
||||
if (quality > 8)
|
||||
if constexpr (quality > 8)
|
||||
BLIP_FWD(2)
|
||||
if (quality > 12)
|
||||
if constexpr (quality > 12)
|
||||
BLIP_FWD(4)
|
||||
{
|
||||
blip_long t0 = i0 * delta + buf[fwd + mid - 1];
|
||||
|
@ -565,9 +565,9 @@ inline void Blip_Synth<quality, range>::offset_resampled(blip_resampled_time_t t
|
|||
buf[fwd + mid - 1] = t0;
|
||||
buf[fwd + mid] = t1;
|
||||
}
|
||||
if (quality > 12)
|
||||
if constexpr (quality > 12)
|
||||
BLIP_REV(6)
|
||||
if (quality > 8)
|
||||
if constexpr (quality > 8)
|
||||
BLIP_REV(4)
|
||||
BLIP_REV(2)
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ blargg_err_t Effects_Buffer::set_channel_count( int count, int const* types )
|
|||
for ( auto& buf : bufs )
|
||||
RETURN_ERR( buf.set_sample_rate( sample_rate(), length() ) );
|
||||
|
||||
for ( int i = chans.size(); --i >= 0; )
|
||||
for ( int i = (int)chans.size(); --i >= 0; )
|
||||
{
|
||||
chan_t& ch = chans [i];
|
||||
ch.cfg.vol = 1.0f;
|
||||
|
@ -266,7 +266,7 @@ void Effects_Buffer::apply_config()
|
|||
}
|
||||
|
||||
// convert volumes
|
||||
for ( i = chans.size(); --i >= 0; )
|
||||
for ( i = (int)chans.size(); --i >= 0; )
|
||||
{
|
||||
chan_t& ch = chans [i];
|
||||
ch.vol [0] = TO_FIXED( ch.cfg.vol - ch.cfg.vol * ch.cfg.pan );
|
||||
|
@ -278,7 +278,7 @@ void Effects_Buffer::apply_config()
|
|||
assign_buffers();
|
||||
|
||||
// set side channels
|
||||
for ( i = chans.size(); --i >= 0; )
|
||||
for ( i = (int)chans.size(); --i >= 0; )
|
||||
{
|
||||
chan_t& ch = chans [i];
|
||||
ch.channel.left = chans [ch.cfg.echo*2 ].channel.center;
|
||||
|
@ -290,7 +290,7 @@ void Effects_Buffer::apply_config()
|
|||
// determine whether effects and echo are needed at all
|
||||
no_effects = true;
|
||||
no_echo = true;
|
||||
for ( i = chans.size(); --i >= extra_chans; )
|
||||
for ( i = (int)chans.size(); --i >= extra_chans; )
|
||||
{
|
||||
chan_t& ch = chans [i];
|
||||
if ( ch.cfg.echo && s.feedback )
|
||||
|
@ -313,7 +313,7 @@ void Effects_Buffer::apply_config()
|
|||
|
||||
if ( no_effects )
|
||||
{
|
||||
for ( i = chans.size(); --i >= 0; )
|
||||
for ( i = (int)chans.size(); --i >= 0; )
|
||||
{
|
||||
chan_t& ch = chans [i];
|
||||
ch.channel.center = &bufs [2];
|
||||
|
@ -343,8 +343,8 @@ void Effects_Buffer::assign_buffers()
|
|||
int x = i;
|
||||
if ( i > 1 )
|
||||
x += 2;
|
||||
if ( x >= (int) chans.size() )
|
||||
x -= (chans.size() - 2);
|
||||
if ( x >= (int)chans.size() )
|
||||
x -= (int)(chans.size() - 2);
|
||||
chan_t& ch = chans [x];
|
||||
|
||||
int b = 0;
|
||||
|
@ -488,7 +488,7 @@ void Effects_Buffer::mix_effects( blip_sample_t* out_, int pair_count )
|
|||
// mix any modified buffers
|
||||
{
|
||||
buf_t* buf = bufs.data();
|
||||
int bufs_remain = bufs.size();
|
||||
int bufs_remain = (int)bufs.size();
|
||||
do
|
||||
{
|
||||
if ( buf->non_silent() && ( buf->echo == !!echo_phase ) )
|
||||
|
@ -513,11 +513,11 @@ void Effects_Buffer::mix_effects( blip_sample_t* out_, int pair_count )
|
|||
int offset = -count;
|
||||
do
|
||||
{
|
||||
fixed_t s = BLIP_READER_READ( in );
|
||||
fixed_t _s = BLIP_READER_READ( in );
|
||||
BLIP_READER_NEXT_IDX_( in, bass, offset );
|
||||
|
||||
out [offset] [0] += s * vol_0;
|
||||
out [offset] [1] += s * vol_1;
|
||||
out [offset] [0] += _s * vol_0;
|
||||
out [offset] [1] += _s * vol_1;
|
||||
}
|
||||
while ( ++offset );
|
||||
|
||||
|
|
|
@ -285,8 +285,8 @@ static bool patchApplyUPS(const char* patchname, uint8_t** rom, int* size)
|
|||
return false;
|
||||
}
|
||||
if (dataSize > *size) {
|
||||
*rom = (uint8_t*)realloc(*rom, dataSize);
|
||||
memset(*rom + *size, 0, dataSize - *size);
|
||||
*rom = (uint8_t*)realloc(*rom, (size_t)dataSize);
|
||||
memset(*rom + *size, 0, (size_t)(dataSize - *size));
|
||||
*size = (int)(dataSize);
|
||||
}
|
||||
|
||||
|
|
|
@ -919,18 +919,18 @@ static SRes SzReadHeader2(
|
|||
SzFile_Init(files + i);
|
||||
|
||||
for (;;) {
|
||||
UInt64 type;
|
||||
UInt64 _type;
|
||||
UInt64 size;
|
||||
RINOK(SzReadID(sd, &type));
|
||||
RINOK(SzReadID(sd, &_type));
|
||||
if (type == k7zIdEnd)
|
||||
break;
|
||||
RINOK(SzReadNumber(sd, &size));
|
||||
if (size > sd->Size)
|
||||
return SZ_ERROR_ARCHIVE;
|
||||
if ((UInt64)(int)type != type) {
|
||||
if ((UInt64)(int)_type != _type) {
|
||||
RINOK(SzSkeepDataSize(sd, size));
|
||||
} else
|
||||
switch ((int)type) {
|
||||
switch ((int)_type) {
|
||||
case k7zIdName: {
|
||||
size_t namesSize;
|
||||
RINOK(SzReadSwitch(sd));
|
||||
|
|
|
@ -71,9 +71,9 @@ int Bcj2_Decode(
|
|||
UInt32 range, code;
|
||||
Byte prevByte = 0;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof(p) / sizeof(p[0]); i++)
|
||||
p[i] = kBitModelTotal >> 1;
|
||||
unsigned int _i;
|
||||
for (_i = 0; _i < sizeof(p) / sizeof(p[0]); _i++)
|
||||
p[_i] = kBitModelTotal >> 1;
|
||||
|
||||
buffer = buf3;
|
||||
bufferLim = buffer + size3;
|
||||
|
@ -92,12 +92,12 @@ int Bcj2_Decode(
|
|||
if (outSize - outPos < limit)
|
||||
limit = outSize - outPos;
|
||||
while (limit != 0) {
|
||||
Byte b = buf0[inPos];
|
||||
outBuf[outPos++] = b;
|
||||
if (IsJ(prevByte, b))
|
||||
Byte _b = buf0[inPos];
|
||||
outBuf[outPos++] = _b;
|
||||
if (IsJ(prevByte, _b))
|
||||
break;
|
||||
inPos++;
|
||||
prevByte = b;
|
||||
prevByte = _b;
|
||||
limit--;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,13 +144,65 @@ Bool CPU_Is_InOrder()
|
|||
}
|
||||
|
||||
#if !defined(MY_CPU_AMD64) && defined(_WIN32)
|
||||
#include <windows.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int GetOSMajorVersion()
|
||||
{
|
||||
WCHAR path[2048] = {};
|
||||
if (!GetSystemDirectoryW(path, 2048))
|
||||
return 0;
|
||||
|
||||
#if __STDC_WANT_SECURE_LIB__
|
||||
wcscat_s(path, 2048, L"\\kernel32.dll" );
|
||||
#else
|
||||
wcscat(path, L"\\kernel32.dll");
|
||||
#endif
|
||||
|
||||
//
|
||||
// Based on example code from this article
|
||||
// http://support.microsoft.com/kb/167597
|
||||
//
|
||||
|
||||
DWORD handle;
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
DWORD len = GetFileVersionInfoSizeExW(FILE_VER_GET_NEUTRAL, path, &handle);
|
||||
#else
|
||||
DWORD len = GetFileVersionInfoSizeW(path, &handle);
|
||||
#endif
|
||||
if (!len)
|
||||
return 0;
|
||||
|
||||
uint8_t *buff = (uint8_t *)malloc(len + 1);
|
||||
if (!buff)
|
||||
return 0;
|
||||
|
||||
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
if (!GetFileVersionInfoExW(FILE_VER_GET_NEUTRAL, path, 0, len, buff))
|
||||
#else
|
||||
if (!GetFileVersionInfoW(path, 0, len, buff))
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
VS_FIXEDFILEINFO *vInfo = NULL;
|
||||
UINT infoSize;
|
||||
|
||||
if (!VerQueryValueW(buff, L"\\", (LPVOID*)(&vInfo), &infoSize))
|
||||
return 0;
|
||||
|
||||
if (buff)
|
||||
free(buff);
|
||||
|
||||
if (!infoSize)
|
||||
return 0;
|
||||
|
||||
return HIWORD(vInfo->dwFileVersionMS);
|
||||
}
|
||||
|
||||
static Bool CPU_Sys_Is_SSE_Supported()
|
||||
{
|
||||
OSVERSIONINFO vi;
|
||||
vi.dwOSVersionInfoSize = sizeof(vi);
|
||||
if (!GetVersionEx(&vi))
|
||||
return False;
|
||||
return (vi.dwMajorVersion >= 5);
|
||||
return (GetOSMajorVersion() >= 5);
|
||||
}
|
||||
#define CHECK_SYS_SSE_SUPPORT \
|
||||
if (!CPU_Sys_Is_SSE_Supported()) \
|
||||
|
|
|
@ -105,8 +105,11 @@ Stop_Compiling_Bad_Endian
|
|||
|
||||
#if defined(MY_CPU_LE_UNALIGN) && defined(_WIN64) && (_MSC_VER >= 1300)
|
||||
|
||||
#ifndef _M_X64
|
||||
#pragma intrinsic(_byteswap_ulong)
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#endif
|
||||
|
||||
#define GetBe32(p) _byteswap_ulong(*(const UInt32*)(const Byte*)(p))
|
||||
#define GetBe64(p) _byteswap_uint64(*(const UInt64*)(const Byte*)(p))
|
||||
|
||||
|
|
|
@ -315,14 +315,14 @@ Out:
|
|||
prob = probs + RepLenCoder;
|
||||
}
|
||||
{
|
||||
unsigned limit, offset;
|
||||
unsigned _limit, offset;
|
||||
CLzmaProb* probLen = prob + LenChoice;
|
||||
IF_BIT_0(probLen)
|
||||
{
|
||||
UPDATE_0(probLen);
|
||||
probLen = prob + LenLow + (posState << kLenNumLowBits);
|
||||
offset = 0;
|
||||
limit = (1 << kLenNumLowBits);
|
||||
_limit = (1 << kLenNumLowBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -333,17 +333,17 @@ Out:
|
|||
UPDATE_0(probLen);
|
||||
probLen = prob + LenMid + (posState << kLenNumMidBits);
|
||||
offset = kLenNumLowSymbols;
|
||||
limit = (1 << kLenNumMidBits);
|
||||
_limit = (1 << kLenNumMidBits);
|
||||
}
|
||||
else
|
||||
{
|
||||
UPDATE_1(probLen);
|
||||
probLen = prob + LenHigh;
|
||||
offset = kLenNumLowSymbols + kLenNumMidSymbols;
|
||||
limit = (1 << kLenNumHighBits);
|
||||
_limit = (1 << kLenNumHighBits);
|
||||
}
|
||||
}
|
||||
TREE_DECODE(probLen, limit, len);
|
||||
TREE_DECODE(probLen, _limit, len);
|
||||
len += offset;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,12 +8,12 @@ This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
|
|||
|
||||
Bool Ppmd7z_RangeDec_Init(CPpmd7z_RangeDec* p)
|
||||
{
|
||||
unsigned i;
|
||||
unsigned _i;
|
||||
p->Code = 0;
|
||||
p->Range = 0xFFFFFFFF;
|
||||
if (p->Stream->Read((void*)p->Stream) != 0)
|
||||
return False;
|
||||
for (i = 0; i < 4; i++)
|
||||
for (_i = 0; _i < 4; _i++)
|
||||
p->Code = (p->Code << 8) | p->Stream->Read((void*)p->Stream);
|
||||
return (p->Code < 0xFFFFFFFF);
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
size_t charMask[256 / sizeof(size_t)];
|
||||
if (p->MinContext->NumStats != 1) {
|
||||
CPpmd_State* s = Ppmd7_GetStats(p, p->MinContext);
|
||||
unsigned i;
|
||||
unsigned _i;
|
||||
UInt32 count, hiCnt;
|
||||
if ((count = rc->GetThreshold(rc, p->MinContext->SummFreq)) < (hiCnt = s->Freq)) {
|
||||
Byte symbol;
|
||||
|
@ -86,7 +86,7 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
return symbol;
|
||||
}
|
||||
p->PrevSuccess = 0;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
_i = p->MinContext->NumStats - 1;
|
||||
do {
|
||||
if ((hiCnt += (++s)->Freq) > count) {
|
||||
Byte symbol;
|
||||
|
@ -96,17 +96,17 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
Ppmd7_Update1(p);
|
||||
return symbol;
|
||||
}
|
||||
} while (--i);
|
||||
} while (--_i);
|
||||
if (count >= p->MinContext->SummFreq)
|
||||
return -2;
|
||||
p->HiBitsFlag = p->HB2Flag[p->FoundState->Symbol];
|
||||
rc->Decode(rc, hiCnt, p->MinContext->SummFreq - hiCnt);
|
||||
PPMD_SetAllBitsIn256Bytes(charMask);
|
||||
MASK(s->Symbol) = 0;
|
||||
i = p->MinContext->NumStats - 1;
|
||||
_i = p->MinContext->NumStats - 1;
|
||||
do {
|
||||
MASK((--s)->Symbol) = 0;
|
||||
} while (--i);
|
||||
} while (--_i);
|
||||
} else {
|
||||
UInt16* prob = Ppmd7_GetBinSumm(p);
|
||||
if (rc->DecodeBit(rc, *prob) == 0) {
|
||||
|
@ -126,7 +126,7 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
CPpmd_State *ps[256], *s;
|
||||
UInt32 freqSum, count, hiCnt;
|
||||
CPpmd_See* see;
|
||||
unsigned i, num, numMasked = p->MinContext->NumStats;
|
||||
unsigned _i, num, numMasked = p->MinContext->NumStats;
|
||||
do {
|
||||
p->OrderFall++;
|
||||
if (!p->MinContext->Suffix)
|
||||
|
@ -135,14 +135,14 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
} while (p->MinContext->NumStats == numMasked);
|
||||
hiCnt = 0;
|
||||
s = Ppmd7_GetStats(p, p->MinContext);
|
||||
i = 0;
|
||||
_i = 0;
|
||||
num = p->MinContext->NumStats - numMasked;
|
||||
do {
|
||||
int k = (int)(MASK(s->Symbol));
|
||||
hiCnt += (s->Freq & k);
|
||||
ps[i] = s++;
|
||||
i -= k;
|
||||
} while (i != num);
|
||||
ps[_i] = s++;
|
||||
_i -= k;
|
||||
} while (_i != num);
|
||||
|
||||
see = Ppmd7_MakeEscFreq(p, numMasked, &freqSum);
|
||||
freqSum += hiCnt;
|
||||
|
@ -166,7 +166,7 @@ int Ppmd7_DecodeSymbol(CPpmd7* p, IPpmd7_RangeDec* rc)
|
|||
rc->Decode(rc, hiCnt, freqSum - hiCnt);
|
||||
see->Summ = (UInt16)(see->Summ + freqSum);
|
||||
do {
|
||||
MASK(ps[--i]->Symbol) = 0;
|
||||
} while (i != 0);
|
||||
MASK(ps[--_i]->Symbol) = 0;
|
||||
} while (_i != 0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ size_t utf8_encode_char( unsigned wide, char * target )
|
|||
wide |= 0xC0;
|
||||
break;
|
||||
case 1:
|
||||
target[0] = wide;
|
||||
target[0] = (char)wide;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ blargg_err_t File_Extractor::data_v( void const** out )
|
|||
RETURN_ERR( own_data_.resize( size() ) );
|
||||
*out = own_data_.begin();
|
||||
|
||||
blargg_err_t err = extract_v( own_data_.begin(), own_data_.size() );
|
||||
blargg_err_t err = extract_v( own_data_.begin(), (int)own_data_.size() );
|
||||
if ( err )
|
||||
own_data_.clear();
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ extern "C"
|
|||
ISeekInStream* stream = STATIC_CAST(ISeekInStream*,vstream);
|
||||
Zip7_Extractor_Impl* impl = STATIC_CAST(Zip7_Extractor_Impl*,stream);
|
||||
|
||||
long lsize = *size;
|
||||
long lsize = (long)*size;
|
||||
blargg_err_t err = impl->in->read_avail( out, &lsize );
|
||||
if ( err )
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ extern "C"
|
|||
}
|
||||
|
||||
// assert( mode == SZ_SEEK_SET );
|
||||
blargg_err_t err = impl->in->seek( *pos );
|
||||
blargg_err_t err = impl->in->seek( (int)*pos );
|
||||
if ( err )
|
||||
{
|
||||
// don't set in_err in this case, since it might be benign
|
||||
|
@ -306,7 +306,7 @@ blargg_err_t Zip7_Extractor::next_v()
|
|||
name8.resize( utf8_length + 1 );
|
||||
memcpy( name8.begin(), temp, utf8_length + 1 );
|
||||
set_name( name8.begin(), name16.begin() );
|
||||
set_info( item.Size, 0, (item.CrcDefined ? item.Crc : 0) );
|
||||
set_info( (int)item.Size, 0, (item.CrcDefined ? item.Crc : 0) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,10 +146,10 @@ blargg_err_t Zip_Extractor::open_v()
|
|||
file_pos -= file_pos % disk_block_size;
|
||||
RETURN_ERR( catalog.resize( arc().size() - file_pos ) );
|
||||
RETURN_ERR( arc().seek( file_pos ) );
|
||||
RETURN_ERR( arc().read( catalog.begin(), catalog.size() ) );
|
||||
RETURN_ERR( arc().read( catalog.begin(), (int)catalog.size() ) );
|
||||
|
||||
// Find end-of-catalog entry
|
||||
int end_pos = catalog.size() - end_entry_size;
|
||||
int end_pos = (int)(catalog.size() - end_entry_size);
|
||||
while ( end_pos >= 0 && memcmp( &catalog [end_pos], "PK\5\6", 4 ) )
|
||||
end_pos--;
|
||||
if ( end_pos < 0 )
|
||||
|
@ -177,7 +177,7 @@ blargg_err_t Zip_Extractor::open_v()
|
|||
{
|
||||
// Catalog begins before bytes read, so it needs to be read
|
||||
RETURN_ERR( arc().seek( catalog_begin ) );
|
||||
RETURN_ERR( arc().read( catalog.begin(), catalog.size() ) );
|
||||
RETURN_ERR( arc().read( catalog.begin(), (int)catalog.size() ) );
|
||||
}
|
||||
|
||||
// First entry in catalog should be a file or end of archive
|
||||
|
|
|
@ -200,7 +200,7 @@ blargg_err_t Zlib_Inflater::read( void* out, int* count_io )
|
|||
return blargg_err_file_corrupt;
|
||||
}
|
||||
|
||||
RETURN_ERR( fill_buf( buf.size() ) );
|
||||
RETURN_ERR( fill_buf( (int)buf.size() ) );
|
||||
if ( !zbuf.avail_in )
|
||||
return blargg_err_file_corrupt; // stream didn't end but there's no more data
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ blargg_err_t Zlib_Inflater::read( void* out, int* count_io )
|
|||
if ( !remain )
|
||||
break;
|
||||
|
||||
RETURN_ERR( fill_buf( buf.size() - zbuf.total_out % block_size ) );
|
||||
RETURN_ERR( fill_buf( (int)(buf.size() - zbuf.total_out % block_size) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ bool ReadBatteryFile(const char* file_name) {
|
|||
bool ret = true;
|
||||
int total_read = 0;
|
||||
for (const VBamIoVec& vec : g_vbamIoVecs) {
|
||||
const int sizeToRead = vec.length;
|
||||
const int sizeToRead = (const int)vec.length;
|
||||
const int sizeToReadWithLeeway = sizeToRead + vec.leeway;
|
||||
const int read = gzread(gzFile, vec.data, sizeToRead);
|
||||
total_read += read;
|
||||
|
@ -185,7 +185,7 @@ bool ReadBatteryFile(const char* file_name) {
|
|||
|
||||
// Check if the battery file is larger than expected.
|
||||
uint8_t data = 0;
|
||||
const int read = gzread(gzFile, &data, 1);
|
||||
const int read = (const int)gzread(gzFile, &data, 1);
|
||||
total_read += read;
|
||||
if (read != 0) {
|
||||
systemMessage(
|
||||
|
@ -276,7 +276,7 @@ void gbGenFilter() {
|
|||
b) -
|
||||
4;
|
||||
gbColorFilter[(b << 10) | (g << 5) | r] =
|
||||
(nb << 10) | (ng << 5) | nr;
|
||||
(uint16_t)((nb << 10) | (ng << 5) | nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1280,10 +1280,10 @@ void gbDoHdma()
|
|||
gbHdmaSource = 0xa000;
|
||||
|
||||
register_HDMA2 = gbHdmaSource & 0xff;
|
||||
register_HDMA1 = gbHdmaSource >> 8;
|
||||
register_HDMA1 = (uint8_t)(gbHdmaSource >> 8);
|
||||
|
||||
register_HDMA4 = gbHdmaDestination & 0xff;
|
||||
register_HDMA3 = gbHdmaDestination >> 8;
|
||||
register_HDMA3 = (uint8_t)(gbHdmaDestination >> 8);
|
||||
|
||||
gbHdmaBytes -= 0x10;
|
||||
gbMemory[0xff55] = --register_HDMA5;
|
||||
|
@ -1807,7 +1807,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
|
|||
int source = value * 0x0100;
|
||||
|
||||
gbCopyMemory(0xfe00,
|
||||
source,
|
||||
(uint16_t)source,
|
||||
0xa0);
|
||||
gbMemory[0xff46] = register_DMA = value;
|
||||
return;
|
||||
|
@ -2053,7 +2053,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
|
|||
if (gbMemory[0xff68] & 0x80) {
|
||||
int index = ((gbMemory[0xff68] & 0x3f) + 1) & 0x3f;
|
||||
|
||||
gbMemory[0xff68] = (gbMemory[0xff68] & 0x80) | index;
|
||||
gbMemory[0xff68] = (uint8_t)((gbMemory[0xff68] & 0x80) | index);
|
||||
gbMemory[0xff69] = (index & 1 ? (gbPalette[index >> 1] >> 8) : (gbPalette[index >> 1] & 0x00ff));
|
||||
}
|
||||
return;
|
||||
|
@ -2093,7 +2093,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
|
|||
if (gbMemory[0xff6a] & 0x80) {
|
||||
int index = ((gbMemory[0xff6a] & 0x3f) + 1) & 0x3f;
|
||||
|
||||
gbMemory[0xff6a] = (gbMemory[0xff6a] & 0x80) | index;
|
||||
gbMemory[0xff6a] = (uint8_t)((gbMemory[0xff6a] & 0x80) | index);
|
||||
|
||||
gbMemory[0xff6b] = (index & 1 ? (gbPalette[(index >> 1) + 32] >> 8) : (gbPalette[(index >> 1) + 32] & 0x00ff));
|
||||
}
|
||||
|
@ -2227,7 +2227,7 @@ uint8_t gbReadMemory(uint16_t address)
|
|||
if (!(joystate & 16))
|
||||
b |= 0x01;
|
||||
|
||||
gbMemory[0xff00] = b;
|
||||
gbMemory[0xff00] = (uint8_t)b;
|
||||
} else if ((b & 0x30) == 0x10) {
|
||||
b &= 0xf0;
|
||||
|
||||
|
@ -2260,7 +2260,7 @@ uint8_t gbReadMemory(uint16_t address)
|
|||
if (!(joystate & 1))
|
||||
b |= 0x01;
|
||||
|
||||
gbMemory[0xff00] = b;
|
||||
gbMemory[0xff00] = (uint8_t)b;
|
||||
} else {
|
||||
if (gbSgbMode && gbSgbMultiplayer) {
|
||||
gbMemory[0xff00] = 0xf0 | gbSgbNextController;
|
||||
|
@ -2633,13 +2633,13 @@ static void gbSelectColorizationPalette()
|
|||
// No idea how that works. But it works.
|
||||
for (size_t i = idx - 0x41, j = 0; i < sizeof(gbColorizationDisambigChars); i += 14, j += 14) {
|
||||
if (gbRom[0x0137] == gbColorizationDisambigChars[i]) {
|
||||
infoIdx = idx + j;
|
||||
infoIdx = (int)(idx + j);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Lower indexes just use the index from the checksum list.
|
||||
infoIdx = idx;
|
||||
infoIdx = (int)idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3054,7 +3054,7 @@ void gbReset()
|
|||
}
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
gbBgp[i] = gbObp0[i] = gbObp1[i] = i;
|
||||
gbBgp[i] = gbObp0[i] = gbObp1[i] = (uint8_t)i;
|
||||
|
||||
memset(&gbDataMBC1, 0, sizeof(gbDataMBC1));
|
||||
gbDataMBC1.mapperROMBank = 1;
|
||||
|
@ -3311,8 +3311,8 @@ static bool gbWriteSaveState(gzFile gzFile)
|
|||
|
||||
if (g_gbCartData.HasRam()) {
|
||||
const size_t ramSize = g_gbCartData.ram_size();
|
||||
utilWriteInt(gzFile, ramSize);
|
||||
utilGzWrite(gzFile, gbRam, ramSize);
|
||||
utilWriteInt(gzFile, (int)ramSize);
|
||||
utilGzWrite(gzFile, gbRam, (int)ramSize);
|
||||
}
|
||||
|
||||
if (gbCgbMode) {
|
||||
|
@ -3497,21 +3497,21 @@ static bool gbReadSaveState(gzFile gzFile)
|
|||
const size_t ram_size = g_gbCartData.ram_size();
|
||||
if (version < 11)
|
||||
if (coreOptions.skipSaveGameBattery) {
|
||||
utilGzSeek(gzFile, ram_size, SEEK_CUR); //skip
|
||||
utilGzSeek(gzFile, (long)ram_size, SEEK_CUR); //skip
|
||||
} else {
|
||||
utilGzRead(gzFile, gbRam, ram_size); //read
|
||||
utilGzRead(gzFile, gbRam, (long)ram_size); //read
|
||||
}
|
||||
else {
|
||||
const size_t stateRamSize = utilReadInt(gzFile);
|
||||
if (coreOptions.skipSaveGameBattery) {
|
||||
// Skip over the save game RAM.
|
||||
utilGzSeek(gzFile, std::min(ram_size, stateRamSize), SEEK_CUR);
|
||||
utilGzSeek(gzFile, (long)std::min(ram_size, stateRamSize), SEEK_CUR);
|
||||
} else {
|
||||
// Ovewrite the save game RAM.
|
||||
utilGzRead(gzFile, gbRam, std::min(ram_size, stateRamSize));
|
||||
utilGzRead(gzFile, gbRam, (long)std::min(ram_size, stateRamSize));
|
||||
}
|
||||
if (stateRamSize > ram_size) {
|
||||
utilGzSeek(gzFile, stateRamSize - ram_size, SEEK_CUR);
|
||||
utilGzSeek(gzFile, (long)(stateRamSize - ram_size), SEEK_CUR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3690,7 +3690,7 @@ static bool gbReadSaveState(gzFile gzFile)
|
|||
gbTimerOnChange = (utilReadInt(gzFile) ? true : false);
|
||||
gbHardware = utilReadInt(gzFile);
|
||||
gbBlackScreen = (utilReadInt(gzFile) ? true : false);
|
||||
oldRegister_WY = utilReadInt(gzFile);
|
||||
oldRegister_WY = (uint8_t)utilReadInt(gzFile);
|
||||
gbWindowLine = utilReadInt(gzFile);
|
||||
inUseRegister_WY = utilReadInt(gzFile);
|
||||
gbScreenOn = (utilReadInt(gzFile) ? true : false);
|
||||
|
@ -4163,7 +4163,7 @@ void gbEmulate(int ticksToStop)
|
|||
IFF |= 1;
|
||||
} else
|
||||
tempIFF -= clockTicks;
|
||||
IFF = (IFF & 0xCF) | (tempIFF << 4);
|
||||
IFF = (uint16_t)((IFF & 0xCF) | (tempIFF << 4));
|
||||
|
||||
if (IFF & 0x08)
|
||||
IFF &= 0x82;
|
||||
|
@ -4403,16 +4403,16 @@ void gbEmulate(int ticksToStop)
|
|||
else {
|
||||
if (!speedup_throttle_set && coreOptions.throttle != coreOptions.speedup_throttle) {
|
||||
last_throttle = coreOptions.throttle;
|
||||
soundSetThrottle(coreOptions.speedup_throttle);
|
||||
soundSetThrottle((unsigned short)coreOptions.speedup_throttle);
|
||||
speedup_throttle_set = true;
|
||||
}
|
||||
|
||||
if (coreOptions.speedup_throttle_frame_skip)
|
||||
framesToSkip += std::ceil(double(coreOptions.speedup_throttle) / 100.0) - 1;
|
||||
framesToSkip += (int)(std::ceil(double(coreOptions.speedup_throttle) / 100.0) - 1);
|
||||
}
|
||||
}
|
||||
else if (speedup_throttle_set) {
|
||||
soundSetThrottle(last_throttle);
|
||||
soundSetThrottle((unsigned short)last_throttle);
|
||||
speedup_throttle_set = false;
|
||||
}
|
||||
#else
|
||||
|
@ -4592,7 +4592,7 @@ void gbEmulate(int ticksToStop)
|
|||
}
|
||||
}
|
||||
gbMemory[0xff0f] = register_IF;
|
||||
gbMemory[0xff41] = register_STAT = (register_STAT & 0xfc) | gbLcdModeDelayed;
|
||||
gbMemory[0xff41] = register_STAT = (uint8_t)((register_STAT & 0xfc) | gbLcdModeDelayed);
|
||||
} else {
|
||||
|
||||
// Used to update the screen with white lines when it's off.
|
||||
|
@ -4978,7 +4978,7 @@ bool gbLoadRomData(const char* data, size_t size) {
|
|||
|
||||
#ifndef __LIBRETRO__
|
||||
bool gbApplyPatch(const char* patchName) {
|
||||
int size = g_gbCartData.rom_size();
|
||||
int size = (int)g_gbCartData.rom_size();
|
||||
if (!applyPatch(patchName, &gbRom, &size)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -335,7 +335,7 @@ bool gbAddGgCheat(const char* code, const char* desc)
|
|||
compare = (compare >> 2) | ((compare << 6) & 0xc0);
|
||||
compare ^= 0x45;
|
||||
|
||||
gbCheatList[i].compare = compare;
|
||||
gbCheatList[i].compare = (uint8_t)compare;
|
||||
//gbCheatList[i].code = 0;
|
||||
gbCheatList[i].code = 0x100; // fix for compare value
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ void gbCheatWrite(bool reboot)
|
|||
int oldbank = gbMemory[0xff70];
|
||||
gbWriteMemory(0xff70, gbCheatList[i].code & 0xf);
|
||||
gbWriteMemory(address, gbCheatList[i].value);
|
||||
gbWriteMemory(0xff70, oldbank);
|
||||
gbWriteMemory(0xff70, (uint8_t)oldbank);
|
||||
gbNextCheat = i + 1;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -91,9 +91,9 @@ void gbRenderLine()
|
|||
|
||||
int tile_map_address = tile_map_line_y + tx;
|
||||
|
||||
uint8_t attrs = 0;
|
||||
uint8_t _attrs = 0;
|
||||
if (bank1 != nullptr)
|
||||
attrs = bank1[tile_map_address];
|
||||
_attrs = bank1[tile_map_address];
|
||||
|
||||
uint8_t tile = bank0[tile_map_address];
|
||||
|
||||
|
@ -111,11 +111,11 @@ void gbRenderLine()
|
|||
uint8_t tile_a = 0;
|
||||
uint8_t tile_b = 0;
|
||||
|
||||
if (attrs & 0x40) {
|
||||
if (_attrs & 0x40) {
|
||||
tile_pattern_address = tile_pattern + tile * 16 + (7 - by) * 2;
|
||||
}
|
||||
|
||||
if (attrs & 0x08) {
|
||||
if (_attrs & 0x08) {
|
||||
tile_a = bank1[tile_pattern_address++];
|
||||
tile_b = bank1[tile_pattern_address];
|
||||
} else {
|
||||
|
@ -123,7 +123,7 @@ void gbRenderLine()
|
|||
tile_b = bank0[tile_pattern_address];
|
||||
}
|
||||
|
||||
if (attrs & 0x20) {
|
||||
if (_attrs & 0x20) {
|
||||
tile_a = gbInvertTab[tile_a];
|
||||
tile_b = gbInvertTab[tile_b];
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void gbRenderLine()
|
|||
|
||||
gbLineBuffer[x] = c; // mark the gbLineBuffer color
|
||||
|
||||
if (attrs & 0x80)
|
||||
if (_attrs & 0x80)
|
||||
gbLineBuffer[x] |= 0x300;
|
||||
|
||||
if (gbCgbMode) {
|
||||
|
@ -142,7 +142,7 @@ void gbRenderLine()
|
|||
if (gbMemory[0xff6c] & 1) {
|
||||
c = gbBgp[c];
|
||||
} else {
|
||||
c = c + (attrs & 7) * 4;
|
||||
c = c + (_attrs & 7) * 4;
|
||||
}
|
||||
} else {
|
||||
c = (gbBgpLine[x + (gbSpeed ? 5 : 11) + SpritesTicks] >> (c << 1)) & 3;
|
||||
|
@ -155,7 +155,7 @@ void gbRenderLine()
|
|||
if (c == 0)
|
||||
palette = 0;
|
||||
|
||||
c = c + 4 * palette;
|
||||
c = (uint8_t)(c + 4 * palette);
|
||||
}
|
||||
}
|
||||
gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] : gbPalette[c] & 0x7FFF;
|
||||
|
@ -190,7 +190,7 @@ void gbRenderLine()
|
|||
tile_map_address = tile_map_line_y + tx;
|
||||
|
||||
if (bank1)
|
||||
attrs = bank1[tile_map_line_y + tx];
|
||||
_attrs = bank1[tile_map_line_y + tx];
|
||||
|
||||
tile = bank0[tile_map_line_y + tx];
|
||||
|
||||
|
@ -279,9 +279,9 @@ void gbRenderLine()
|
|||
x = wx;
|
||||
|
||||
tile = bank0[tile_map_address];
|
||||
uint8_t attrs = 0;
|
||||
_attrs = 0;
|
||||
if (bank1)
|
||||
attrs = bank1[tile_map_address];
|
||||
_attrs = bank1[tile_map_address];
|
||||
tile_map_address++;
|
||||
|
||||
if ((register_LCDC & 16) == 0) {
|
||||
|
@ -301,11 +301,11 @@ void gbRenderLine()
|
|||
uint8_t tile_a = 0;
|
||||
uint8_t tile_b = 0;
|
||||
|
||||
if (attrs & 0x40) {
|
||||
if (_attrs & 0x40) {
|
||||
tile_pattern_address = tile_pattern + tile * 16 + (7 - by) * 2;
|
||||
}
|
||||
|
||||
if (attrs & 0x08) {
|
||||
if (_attrs & 0x08) {
|
||||
tile_a = bank1[tile_pattern_address++];
|
||||
tile_b = bank1[tile_pattern_address];
|
||||
} else {
|
||||
|
@ -313,7 +313,7 @@ void gbRenderLine()
|
|||
tile_b = bank0[tile_pattern_address];
|
||||
}
|
||||
|
||||
if (attrs & 0x20) {
|
||||
if (_attrs & 0x20) {
|
||||
tile_a = gbInvertTab[tile_a];
|
||||
tile_b = gbInvertTab[tile_b];
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void gbRenderLine()
|
|||
c += ((tile_b & bx) != 0 ? 2 : 0);
|
||||
|
||||
if (x >= 0) {
|
||||
if (attrs & 0x80)
|
||||
if (_attrs & 0x80)
|
||||
gbLineBuffer[x] = 0x300 + c;
|
||||
else
|
||||
gbLineBuffer[x] = 0x100 + c;
|
||||
|
@ -333,7 +333,7 @@ void gbRenderLine()
|
|||
if (gbMemory[0xff6c] & 1) {
|
||||
c = gbBgp[c];
|
||||
} else {
|
||||
c = c + (attrs & 7) * 4;
|
||||
c = c + (_attrs & 7) * 4;
|
||||
}
|
||||
} else {
|
||||
c = (gbBgpLine[x + (gbSpeed ? 5 : 11) + gbSpritesTicks[x] * (gbSpeed ? 2 : 4)] >> (c << 1)) & 3;
|
||||
|
@ -346,7 +346,7 @@ void gbRenderLine()
|
|||
if (c == 0)
|
||||
palette = 0;
|
||||
|
||||
c = c + 4 * palette;
|
||||
c = (uint8_t)(c + 4 * palette);
|
||||
}
|
||||
}
|
||||
gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] : gbPalette[c] & 0x7FFF;
|
||||
|
@ -362,7 +362,7 @@ void gbRenderLine()
|
|||
bx = 128;
|
||||
tile = bank0[tile_map_line_y + tx];
|
||||
if (bank1)
|
||||
attrs = bank1[tile_map_line_y + tx];
|
||||
_attrs = bank1[tile_map_line_y + tx];
|
||||
|
||||
if ((register_LCDC & 16) == 0) {
|
||||
if (tile < 128)
|
||||
|
@ -491,7 +491,7 @@ void gbDrawSpriteTile(int tile, int x, int y, int t, int flags,
|
|||
}
|
||||
}
|
||||
|
||||
gbLineBuffer[xxx] = 0x200 + spriteNumber;
|
||||
gbLineBuffer[xxx] = (uint16_t)(0x200 + spriteNumber);
|
||||
|
||||
// make sure that sprites will work even in CGB mode
|
||||
if (gbCgbMode) {
|
||||
|
@ -513,7 +513,7 @@ void gbDrawSpriteTile(int tile, int x, int y, int t, int flags,
|
|||
if (c == 0)
|
||||
palette = 0;
|
||||
|
||||
c = c + 4 * palette;
|
||||
c = (uint8_t)(c + 4 * palette);
|
||||
} else {
|
||||
c += 4;
|
||||
}
|
||||
|
|
|
@ -671,15 +671,15 @@ uint8_t mapperMBC7ReadRAM(uint16_t address)
|
|||
return systemGetSensorX() & 255;
|
||||
case 0xa030:
|
||||
// sensor X high byte
|
||||
return systemGetSensorX() >> 8;
|
||||
return (uint8_t)(systemGetSensorX() >> 8);
|
||||
case 0xa040:
|
||||
// sensor Y low byte
|
||||
return systemGetSensorY() & 255;
|
||||
case 0xa050:
|
||||
// sensor Y high byte
|
||||
return systemGetSensorY() >> 8;
|
||||
return (uint8_t)(systemGetSensorY() >> 8);
|
||||
case 0xa080:
|
||||
return gbDataMBC7.value;
|
||||
return (uint8_t)gbDataMBC7.value;
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
|
@ -698,7 +698,7 @@ void mapperMBC7RAM(uint16_t address, uint8_t value)
|
|||
if (!oldCs && gbDataMBC7.cs) {
|
||||
if (gbDataMBC7.state == 5) {
|
||||
if (gbDataMBC7.writeEnable) {
|
||||
gbRam[gbDataMBC7.address * 2] = gbDataMBC7.buffer >> 8;
|
||||
gbRam[gbDataMBC7.address * 2] = (uint8_t)(gbDataMBC7.buffer >> 8);
|
||||
gbRam[gbDataMBC7.address * 2 + 1] = gbDataMBC7.buffer & 0xff;
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ void mapperMBC7RAM(uint16_t address, uint8_t value)
|
|||
} else if ((gbDataMBC7.address >> 6) == 1) {
|
||||
if (gbDataMBC7.writeEnable) {
|
||||
for (int i = 0; i < 256; i++) {
|
||||
gbRam[i * 2] = gbDataMBC7.buffer >> 8;
|
||||
gbRam[i * 2] = (uint8_t)(gbDataMBC7.buffer >> 8);
|
||||
gbRam[i * 2 + 1] = gbDataMBC7.buffer & 0xff;
|
||||
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
|
||||
}
|
||||
|
@ -1330,17 +1330,17 @@ void mapperTAMA5RAM(uint16_t address, uint8_t value)
|
|||
gbDataTAMA5.mapperLYears = gbDataTAMA5.mapperYears;
|
||||
gbDataTAMA5.mapperLControl = gbDataTAMA5.mapperControl;
|
||||
|
||||
uint8_t seconds = (gbDataTAMA5.mapperLSeconds / 10) * 16 + gbDataTAMA5.mapperLSeconds % 10;
|
||||
uint8_t seconds = (uint8_t)((gbDataTAMA5.mapperLSeconds / 10) * 16 + gbDataTAMA5.mapperLSeconds % 10);
|
||||
uint8_t secondsL = (gbDataTAMA5.mapperLSeconds % 10);
|
||||
uint8_t secondsH = (gbDataTAMA5.mapperLSeconds / 10);
|
||||
uint8_t minutes = (gbDataTAMA5.mapperLMinutes / 10) * 16 + gbDataTAMA5.mapperLMinutes % 10;
|
||||
uint8_t hours = (gbDataTAMA5.mapperLHours / 10) * 16 + gbDataTAMA5.mapperLHours % 10;
|
||||
uint8_t secondsH = (uint8_t)(gbDataTAMA5.mapperLSeconds / 10);
|
||||
uint8_t minutes = (uint8_t)((gbDataTAMA5.mapperLMinutes / 10) * 16 + gbDataTAMA5.mapperLMinutes % 10);
|
||||
uint8_t hours = (uint8_t)((gbDataTAMA5.mapperLHours / 10) * 16 + gbDataTAMA5.mapperLHours % 10);
|
||||
uint8_t DaysL = gbDataTAMA5.mapperLDays % 10;
|
||||
uint8_t DaysH = gbDataTAMA5.mapperLDays / 10;
|
||||
uint8_t DaysH = (uint8_t)(gbDataTAMA5.mapperLDays / 10);
|
||||
uint8_t MonthsL = gbDataTAMA5.mapperLMonths % 10;
|
||||
uint8_t MonthsH = gbDataTAMA5.mapperLMonths / 10;
|
||||
uint8_t MonthsH = (uint8_t)(gbDataTAMA5.mapperLMonths / 10);
|
||||
uint8_t Years3 = (gbDataTAMA5.mapperLYears / 100) % 10;
|
||||
uint8_t Years4 = (gbDataTAMA5.mapperLYears / 1000);
|
||||
uint8_t Years4 = (uint8_t)(gbDataTAMA5.mapperLYears / 1000);
|
||||
|
||||
switch (data & 0x0f) {
|
||||
// I guess cases 0 and 1 are used for secondsL and secondsH
|
||||
|
@ -1392,14 +1392,15 @@ void mapperTAMA5RAM(uint16_t address, uint8_t value)
|
|||
} else if (gbDataTAMA5.mapperRamByteSelect == 0x54) {
|
||||
gbDataTAMA5.mapperHours = (data / 16) * 10 + data % 16;
|
||||
} else {
|
||||
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = data;
|
||||
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = (uint8_t)data;
|
||||
}
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 1: // 'Commands' Register
|
||||
{
|
||||
gbMemoryMap[0xa][1] = gbDataTAMA5.mapperCommandNumber = value;
|
||||
gbDataTAMA5.mapperCommandNumber = value;
|
||||
gbMemoryMap[0xa][1] = value;
|
||||
|
||||
// This should be only a 'is the flashrom ready ?' command.
|
||||
// However as I couldn't find any 'copy' command
|
||||
|
@ -1414,7 +1415,8 @@ void mapperTAMA5RAM(uint16_t address, uint8_t value)
|
|||
/*for (int k = 0; k<0x100; k++)
|
||||
gbMemoryMap[0xe][k] = gbTAMA5ram[k];*/
|
||||
|
||||
gbMemoryMap[0xa][0] = gbDataTAMA5.mapperRAMEnable = 1;
|
||||
gbDataTAMA5.mapperRAMEnable = 1;
|
||||
gbMemoryMap[0xa][0] = 1;
|
||||
} else {
|
||||
if ((value & 0x0e) == 0x0c) {
|
||||
gbDataTAMA5.mapperRamByteSelect = gbDataTAMA5.mapperCommands[6] | (gbDataTAMA5.mapperCommands[7] << 4);
|
||||
|
|
|
@ -653,7 +653,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
if (extended & 4) {
|
||||
CPUWriteByte(cheatsList[i - 1].value, cheatsList[i].address);
|
||||
CPUWriteByte(cheatsList[i - 1].value, (uint8_t)cheatsList[i].address);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -661,7 +661,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
if (extended & 4) {
|
||||
CPUWriteHalfWord(cheatsList[i - 1].value, cheatsList[i].address);
|
||||
CPUWriteHalfWord(cheatsList[i - 1].value, (uint16_t)cheatsList[i].address);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -678,7 +678,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
if (CPUReadHalfWord(cheatsList[i].address) != cheatsList[i].value) {
|
||||
cheatsList[i].oldValue = CPUReadHalfWord(cheatsList[i].address);
|
||||
cheatsList[i].status |= 1;
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, cheatsList[i].value);
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, (uint16_t)cheatsList[i].value);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -686,7 +686,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
rompatch2addr[0] = ((cheatsList[i - 1].value & 0x00FFFFFF) << 1) + 0x8000000;
|
||||
rompatch2oldval[0] = CPUReadHalfWord(rompatch2addr[0]);
|
||||
rompatch2oldval[0] = (uint16_t)CPUReadHalfWord(rompatch2addr[0]);
|
||||
rompatch2val[0] = cheatsList[i].rawaddress & 0xFFFF;
|
||||
}
|
||||
break;
|
||||
|
@ -694,7 +694,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
rompatch2addr[1] = ((cheatsList[i - 1].value & 0x00FFFFFF) << 1) + 0x8000000;
|
||||
rompatch2oldval[1] = CPUReadHalfWord(rompatch2addr[1]);
|
||||
rompatch2oldval[1] = (uint16_t)CPUReadHalfWord(rompatch2addr[1]);
|
||||
rompatch2val[1] = cheatsList[i].rawaddress & 0xFFFF;
|
||||
}
|
||||
break;
|
||||
|
@ -702,7 +702,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
rompatch2addr[2] = ((cheatsList[i - 1].value & 0x00FFFFFF) << 1) + 0x8000000;
|
||||
rompatch2oldval[2] = CPUReadHalfWord(rompatch2addr[2]);
|
||||
rompatch2oldval[2] = (uint16_t)CPUReadHalfWord(rompatch2addr[2]);
|
||||
rompatch2val[2] = cheatsList[i].rawaddress & 0xFFFF;
|
||||
}
|
||||
break;
|
||||
|
@ -710,7 +710,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
rompatch2addr[3] = ((cheatsList[i - 1].value & 0x00FFFFFF) << 1) + 0x8000000;
|
||||
rompatch2oldval[3] = CPUReadHalfWord(rompatch2addr[3]);
|
||||
rompatch2oldval[3] = (uint16_t)CPUReadHalfWord(rompatch2addr[3]);
|
||||
rompatch2val[3] = cheatsList[i].rawaddress & 0xFFFF;
|
||||
}
|
||||
break;
|
||||
|
@ -721,22 +721,22 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
if (onoff) {
|
||||
switch (cheatsList[i].size) {
|
||||
case INT_8_BIT_WRITE:
|
||||
CPUWriteByte(cheatsList[i].address, cheatsList[i].value);
|
||||
CPUWriteByte(cheatsList[i].address, (uint8_t)cheatsList[i].value);
|
||||
break;
|
||||
case INT_16_BIT_WRITE:
|
||||
CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value);
|
||||
CPUWriteHalfWord(cheatsList[i].address, (uint16_t)cheatsList[i].value);
|
||||
break;
|
||||
case INT_32_BIT_WRITE:
|
||||
CPUWriteMemory(cheatsList[i].address, cheatsList[i].value);
|
||||
break;
|
||||
case GSA_8_BIT_GS_WRITE:
|
||||
if (extended & 4) {
|
||||
CPUWriteByte(cheatsList[i].address, cheatsList[i].value);
|
||||
CPUWriteByte(cheatsList[i].address, (uint8_t)cheatsList[i].value);
|
||||
}
|
||||
break;
|
||||
case GSA_16_BIT_GS_WRITE:
|
||||
if (extended & 4) {
|
||||
CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value);
|
||||
CPUWriteHalfWord(cheatsList[i].address, (uint16_t)cheatsList[i].value);
|
||||
}
|
||||
break;
|
||||
case GSA_32_BIT_GS_WRITE:
|
||||
|
@ -745,7 +745,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
}
|
||||
break;
|
||||
case CBA_IF_KEYS_PRESSED: {
|
||||
uint16_t value = cheatsList[i].value;
|
||||
uint16_t value = (uint16_t)cheatsList[i].value;
|
||||
uint32_t addr = cheatsList[i].address;
|
||||
if ((addr & 0xF0) == 0x20) {
|
||||
if ((keys & value) == 0) {
|
||||
|
@ -768,7 +768,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case CBA_SLIDE_CODE: {
|
||||
uint32_t address = cheatsList[i].address;
|
||||
uint16_t value = cheatsList[i].value;
|
||||
uint16_t value = (uint16_t)cheatsList[i].value;
|
||||
i++;
|
||||
if (i < cheatsNumber) {
|
||||
int count = ((cheatsList[i].address - 1) & 0xFFFF);
|
||||
|
@ -788,7 +788,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case CBA_AND:
|
||||
CPUWriteHalfWord(cheatsList[i].address,
|
||||
CPUReadHalfWord(cheatsList[i].address) & cheatsList[i].value);
|
||||
CPUReadHalfWord(cheatsList[i].address) & (uint16_t)cheatsList[i].value);
|
||||
break;
|
||||
case GSA_8_BIT_IF_TRUE:
|
||||
if (CPUReadByte(cheatsList[i].address) != cheatsList[i].value) {
|
||||
|
@ -861,7 +861,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
case CBA_ADD:
|
||||
if ((cheatsList[i].address & 1) == 0) {
|
||||
CPUWriteHalfWord(cheatsList[i].address,
|
||||
CPUReadHalfWord(cheatsList[i].address) + cheatsList[i].value);
|
||||
(uint16_t)(CPUReadHalfWord(cheatsList[i].address) + cheatsList[i].value));
|
||||
} else {
|
||||
CPUWriteMemory(cheatsList[i].address & 0x0FFFFFFE,
|
||||
CPUReadMemory(cheatsList[i].address & 0x0FFFFFFE) + cheatsList[i].value);
|
||||
|
@ -869,7 +869,7 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case CBA_OR:
|
||||
CPUWriteHalfWord(cheatsList[i].address,
|
||||
CPUReadHalfWord(cheatsList[i].address) | cheatsList[i].value);
|
||||
(uint16_t)(CPUReadHalfWord(cheatsList[i].address) | cheatsList[i].value));
|
||||
break;
|
||||
case CBA_GT:
|
||||
if (!(CPUReadHalfWord(cheatsList[i].address) > cheatsList[i].value)) {
|
||||
|
@ -1085,15 +1085,15 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case GSA_16_BIT_WRITE_IOREGS:
|
||||
if ((cheatsList[i].address <= 0x3FF) && (cheatsList[i].address != 0x6) && (cheatsList[i].address != 0x130))
|
||||
g_ioMem[cheatsList[i].address & 0x3FE] = cheatsList[i].value & 0xFFFF;
|
||||
g_ioMem[cheatsList[i].address & 0x3FE] = (uint8_t)(cheatsList[i].value & 0xFFFF);
|
||||
break;
|
||||
case GSA_32_BIT_WRITE_IOREGS:
|
||||
if (cheatsList[i].address <= 0x3FF) {
|
||||
uint32_t cheat_addr = cheatsList[i].address & 0x3FC;
|
||||
if ((cheat_addr != 6) && (cheat_addr != 0x130))
|
||||
g_ioMem[cheat_addr] = (cheatsList[i].value & 0xFFFF);
|
||||
g_ioMem[cheat_addr] = (uint8_t)(cheatsList[i].value & 0xFFFF);
|
||||
if (((cheat_addr + 2) != 0x6) && (cheat_addr + 2) != 0x130)
|
||||
g_ioMem[cheat_addr + 2] = ((cheatsList[i].value >> 16) & 0xFFFF);
|
||||
g_ioMem[cheat_addr + 2] = (uint8_t)((cheatsList[i].value >> 16) & 0xFFFF);
|
||||
}
|
||||
break;
|
||||
case GSA_8_BIT_IF_TRUE3:
|
||||
|
@ -1263,9 +1263,9 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
|
|||
break;
|
||||
case CHEATS_16_BIT_WRITE:
|
||||
if ((cheatsList[i].address >> 24) >= 0x08) {
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, cheatsList[i].value);
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[i].address, (uint16_t)cheatsList[i].value);
|
||||
} else {
|
||||
CPUWriteHalfWord(cheatsList[i].address, cheatsList[i].value);
|
||||
CPUWriteHalfWord(cheatsList[i].address, (uint16_t)cheatsList[i].value);
|
||||
}
|
||||
break;
|
||||
case CHEATS_32_BIT_WRITE:
|
||||
|
@ -1345,9 +1345,9 @@ void cheatsDelete(int number, bool restore)
|
|||
break;
|
||||
case CHEATS_16_BIT_WRITE:
|
||||
if ((cheatsList[x].address >> 24) >= 0x08) {
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[x].address, cheatsList[x].oldValue);
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[x].address, (uint16_t)cheatsList[x].oldValue);
|
||||
} else {
|
||||
CPUWriteHalfWord(cheatsList[x].address, cheatsList[x].oldValue);
|
||||
CPUWriteHalfWord(cheatsList[x].address, (uint16_t)cheatsList[x].oldValue);
|
||||
}
|
||||
break;
|
||||
case CHEATS_32_BIT_WRITE:
|
||||
|
@ -1361,7 +1361,7 @@ void cheatsDelete(int number, bool restore)
|
|||
if (cheatsList[x].status & 1) {
|
||||
cheatsList[x].status &= ~1;
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[x].address,
|
||||
cheatsList[x].oldValue);
|
||||
(uint16_t)cheatsList[x].oldValue);
|
||||
}
|
||||
break;
|
||||
case GSA_16_BIT_ROM_PATCH2C:
|
||||
|
@ -1407,7 +1407,7 @@ void cheatsDisable(int i)
|
|||
if (cheatsList[i].status & 1) {
|
||||
cheatsList[i].status &= ~1;
|
||||
CHEAT_PATCH_ROM_16BIT(cheatsList[i].address,
|
||||
cheatsList[i].oldValue);
|
||||
(uint16_t)cheatsList[i].oldValue);
|
||||
}
|
||||
break;
|
||||
case GSA_16_BIT_ROM_PATCH2C:
|
||||
|
@ -1519,12 +1519,12 @@ void cheatsGSAChangeEncryption(uint16_t value, bool v3)
|
|||
deadtable1 = (uint8_t*)(&v3_deadtable1);
|
||||
deadtable2 = (uint8_t*)(&v3_deadtable2);
|
||||
for (i = 0; i < 4; i++)
|
||||
seeds_v3[i] = seed_gen(((value & 0xFF00) >> 8), (value & 0xFF) + i, deadtable1, deadtable2);
|
||||
seeds_v3[i] = seed_gen((uint8_t)((value & 0xFF00) >> 8), (uint8_t)((value & 0xFF) + i), deadtable1, deadtable2);
|
||||
} else {
|
||||
deadtable1 = (uint8_t*)(&v1_deadtable1);
|
||||
deadtable2 = (uint8_t*)(&v1_deadtable2);
|
||||
for (i = 0; i < 4; i++) {
|
||||
seeds_v1[i] = seed_gen(((value & 0xFF00) >> 8), (value & 0xFF) + i, deadtable1, deadtable2);
|
||||
seeds_v1[i] = seed_gen((uint8_t)((value & 0xFF00) >> 8), (uint8_t)((value & 0xFF) + i), deadtable1, deadtable2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2130,11 +2130,11 @@ void chatsCBAScramble(uint8_t* array, int count, uint8_t b)
|
|||
z = 1;
|
||||
if ((*y & (1 << (b & 7))) != 0)
|
||||
x0 |= (1 << (count & 7));
|
||||
*x = x0;
|
||||
*x = (uint8_t)x0;
|
||||
uint32_t temp = *y & (~(1 << (b & 7)));
|
||||
if (z != 0)
|
||||
temp |= (1 << (b & 7));
|
||||
*y = temp;
|
||||
*y = (uint8_t)temp;
|
||||
}
|
||||
|
||||
uint32_t cheatsCBAGetValue(uint8_t* array)
|
||||
|
@ -2265,13 +2265,13 @@ void cheatsCBAUpdateSeedBuffer(uint32_t address, uint8_t* buffer, int count)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
buffer[i] = i;
|
||||
buffer[i] = (uint8_t)i;
|
||||
for (i = 0; (uint32_t)i < address; i++) {
|
||||
uint32_t a = cheatsCBACalcIndex(cheatsCBAEncWorker(), count);
|
||||
uint32_t b = cheatsCBACalcIndex(cheatsCBAEncWorker(), count);
|
||||
uint32_t t = buffer[a];
|
||||
buffer[a] = buffer[b];
|
||||
buffer[b] = t;
|
||||
buffer[b] = (uint8_t)t;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2386,13 +2386,13 @@ void cheatsCBADecrypt(uint8_t* decrypt)
|
|||
|
||||
uint32_t cs = cheatsCBAGetValue(cheatsCBACurrentSeed);
|
||||
for (int i = 0; i <= 4; i++) {
|
||||
array[i] = ((cs >> 8) ^ array[i + 1]) ^ array[i];
|
||||
array[i] = (uint8_t)(((cs >> 8) ^ array[i + 1]) ^ array[i]);
|
||||
}
|
||||
|
||||
array[5] = (cs >> 8) ^ array[5];
|
||||
array[5] = (uint8_t)((cs >> 8) ^ array[5]);
|
||||
|
||||
for (int j = 5; j >= 0; j--) {
|
||||
array[j] = (cs ^ array[j - 1]) ^ array[j];
|
||||
array[j] = (uint8_t)((cs ^ array[j - 1]) ^ array[j]);
|
||||
}
|
||||
|
||||
cheatsCBAArrayToValue(array, decrypt);
|
||||
|
@ -2531,7 +2531,7 @@ void cheatsAddCBACode(const char* code, const char* desc)
|
|||
case 0x05:
|
||||
cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512,
|
||||
CBA_SUPER);
|
||||
super = getCodeLength(cheatsNumber - 1);
|
||||
super = (uint16_t)getCodeLength(cheatsNumber - 1);
|
||||
break;
|
||||
case 0x06:
|
||||
cheatsAdd(code, desc, address, address & 0x0FFFFFFE, value, 512,
|
||||
|
|
|
@ -119,9 +119,9 @@ int eepromRead(uint32_t /* address */)
|
|||
return data;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void eepromWrite(uint32_t /* address */, uint8_t value)
|
||||
|
@ -133,7 +133,7 @@ void eepromWrite(uint32_t /* address */, uint8_t value)
|
|||
case EEPROM_IDLE:
|
||||
eepromByte = 0;
|
||||
eepromBits = 1;
|
||||
eepromBuffer[eepromByte] = bit;
|
||||
eepromBuffer[eepromByte] = (uint8_t)bit;
|
||||
eepromMode = EEPROM_READADDRESS;
|
||||
break;
|
||||
case EEPROM_READADDRESS:
|
||||
|
@ -149,7 +149,7 @@ void eepromWrite(uint32_t /* address */, uint8_t value)
|
|||
eepromSize = SIZE_EEPROM_8K;
|
||||
eepromAddress = ((eepromBuffer[0] & 0x3F) << 8) | ((eepromBuffer[1] & 0xFF));
|
||||
if (!(eepromBuffer[0] & 0x40)) {
|
||||
eepromBuffer[0] = bit;
|
||||
eepromBuffer[0] = (uint8_t)bit;
|
||||
eepromBits = 1;
|
||||
eepromByte = 0;
|
||||
eepromMode = EEPROM_WRITEDATA;
|
||||
|
@ -164,7 +164,7 @@ void eepromWrite(uint32_t /* address */, uint8_t value)
|
|||
eepromInUse = true;
|
||||
eepromAddress = (eepromBuffer[0] & 0x3F);
|
||||
if (!(eepromBuffer[0] & 0x40)) {
|
||||
eepromBuffer[0] = bit;
|
||||
eepromBuffer[0] = (uint8_t)bit;
|
||||
eepromBits = 1;
|
||||
eepromByte = 0;
|
||||
eepromMode = EEPROM_WRITEDATA;
|
||||
|
|
|
@ -499,8 +499,8 @@ void elfExecuteCFAInstructions(ELFFrameState* state, uint8_t* data, uint32_t len
|
|||
uint32_t pc)
|
||||
{
|
||||
uint8_t* end = data + len;
|
||||
int bytes;
|
||||
int reg;
|
||||
int _bytes;
|
||||
int _reg;
|
||||
ELFFrameStateRegisters* fs;
|
||||
|
||||
while (data < end && state->pc < pc) {
|
||||
|
@ -511,10 +511,10 @@ void elfExecuteCFAInstructions(ELFFrameState* state, uint8_t* data, uint32_t len
|
|||
state->pc += (op & 0x3f) * state->codeAlign;
|
||||
break;
|
||||
case DW_CFA_offset:
|
||||
reg = op & 0x3f;
|
||||
state->registers.regs[reg].mode = REG_OFFSET;
|
||||
state->registers.regs[reg].offset = state->dataAlign * (int32_t)elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
_reg = op & 0x3f;
|
||||
state->registers.regs[_reg].mode = REG_OFFSET;
|
||||
state->registers.regs[_reg].offset = state->dataAlign * (int32_t)elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
break;
|
||||
case DW_CFA_restore:
|
||||
// we don't care much about the other possible settings,
|
||||
|
@ -537,25 +537,25 @@ void elfExecuteCFAInstructions(ELFFrameState* state, uint8_t* data, uint32_t len
|
|||
data += 4;
|
||||
break;
|
||||
case DW_CFA_offset_extended:
|
||||
reg = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->registers.regs[reg].mode = REG_OFFSET;
|
||||
state->registers.regs[reg].offset = state->dataAlign * (int32_t)elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
_reg = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->registers.regs[_reg].mode = REG_OFFSET;
|
||||
state->registers.regs[_reg].offset = state->dataAlign * (int32_t)elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
break;
|
||||
case DW_CFA_restore_extended:
|
||||
case DW_CFA_undefined:
|
||||
case DW_CFA_same_value:
|
||||
reg = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->registers.regs[reg].mode = REG_NOT_SET;
|
||||
_reg = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->registers.regs[_reg].mode = REG_NOT_SET;
|
||||
break;
|
||||
case DW_CFA_register:
|
||||
reg = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->registers.regs[reg].mode = REG_REGISTER;
|
||||
state->registers.regs[reg].reg = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
_reg = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->registers.regs[_reg].mode = REG_REGISTER;
|
||||
state->registers.regs[_reg].reg = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
break;
|
||||
case DW_CFA_remember_state:
|
||||
fs = (ELFFrameStateRegisters*)calloc(1,
|
||||
|
@ -573,20 +573,20 @@ void elfExecuteCFAInstructions(ELFFrameState* state, uint8_t* data, uint32_t len
|
|||
free(fs);
|
||||
break;
|
||||
case DW_CFA_def_cfa:
|
||||
state->cfaRegister = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->cfaOffset = (int32_t)elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->cfaRegister = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->cfaOffset = (int32_t)elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->cfaMode = CFA_REG_OFFSET;
|
||||
break;
|
||||
case DW_CFA_def_cfa_register:
|
||||
state->cfaRegister = elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->cfaRegister = elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->cfaMode = CFA_REG_OFFSET;
|
||||
break;
|
||||
case DW_CFA_def_cfa_offset:
|
||||
state->cfaOffset = (int32_t)elfReadLEB128(data, &bytes);
|
||||
data += bytes;
|
||||
state->cfaOffset = (int32_t)elfReadLEB128(data, &_bytes);
|
||||
data += _bytes;
|
||||
state->cfaMode = CFA_REG_OFFSET;
|
||||
break;
|
||||
default:
|
||||
|
@ -651,7 +651,7 @@ void elfPrintCallChain(uint32_t address)
|
|||
|
||||
if (state->cfaMode == CFA_REG_OFFSET) {
|
||||
memcpy(&newRegs[0], ®s[0], sizeof(reg_pair) * 15);
|
||||
uint32_t addr = 0;
|
||||
uint32_t _addr = 0;
|
||||
for (int i = 0; i < 15; i++) {
|
||||
ELFFrameStateRegister* r = &state->registers.regs[i];
|
||||
|
||||
|
@ -671,9 +671,9 @@ void elfPrintCallChain(uint32_t address)
|
|||
}
|
||||
}
|
||||
memcpy(regs, newRegs, sizeof(reg_pair) * 15);
|
||||
addr = newRegs[14].I;
|
||||
addr &= 0xfffffffe;
|
||||
address = addr;
|
||||
_addr = newRegs[14].I;
|
||||
_addr &= 0xfffffffe;
|
||||
address = _addr;
|
||||
count++;
|
||||
} else {
|
||||
printf("CFA not set\n");
|
||||
|
@ -724,7 +724,7 @@ uint32_t elfDecodeLocation(Function* f, ELFBlock* o, LocationType* type, uint32_
|
|||
|
||||
ELFBlock* loc = o;
|
||||
uint32_t location = 0;
|
||||
int bytes = 0;
|
||||
int _bytes = 0;
|
||||
if (loc) {
|
||||
switch (*loc->data) {
|
||||
case DW_OP_addr:
|
||||
|
@ -732,7 +732,7 @@ uint32_t elfDecodeLocation(Function* f, ELFBlock* o, LocationType* type, uint32_
|
|||
*type = LOCATION_memory;
|
||||
break;
|
||||
case DW_OP_plus_uconst:
|
||||
location = base + elfReadLEB128(loc->data + 1, &bytes);
|
||||
location = base + elfReadLEB128(loc->data + 1, &_bytes);
|
||||
*type = LOCATION_memory;
|
||||
break;
|
||||
case DW_OP_reg0:
|
||||
|
@ -1738,14 +1738,14 @@ void elfParseType(uint8_t* data, uint32_t offset, ELFAbbrev* abbrev, CompileUnit
|
|||
} break;
|
||||
case DW_TAG_array_type: {
|
||||
uint32_t typeref = 0;
|
||||
int i;
|
||||
int _i;
|
||||
Array* array = (Array*)calloc(sizeof(Array), 1);
|
||||
Type* t = (Type*)calloc(sizeof(Type), 1);
|
||||
t->type = TYPE_array;
|
||||
elfAddType(t, unit, offset);
|
||||
|
||||
for (i = 0; i < abbrev->numAttrs; i++) {
|
||||
ELFAttr* attr = &abbrev->attrs[i];
|
||||
for (_i = 0; _i < abbrev->numAttrs; _i++) {
|
||||
ELFAttr* attr = &abbrev->attrs[_i];
|
||||
data = elfReadAttribute(data, attr);
|
||||
switch (attr->name) {
|
||||
case DW_AT_sibling:
|
||||
|
@ -1801,8 +1801,8 @@ void elfParseType(uint8_t* data, uint32_t offset, ELFAbbrev* abbrev, CompileUnit
|
|||
array->maxBounds = index;
|
||||
}
|
||||
t->size = array->type->size;
|
||||
for (i = 0; i < array->maxBounds; i++)
|
||||
t->size *= array->bounds[i];
|
||||
for (_i = 0; _i < array->maxBounds; _i++)
|
||||
t->size *= array->bounds[_i];
|
||||
t->array = array;
|
||||
*type = t;
|
||||
return;
|
||||
|
@ -1815,12 +1815,12 @@ void elfParseType(uint8_t* data, uint32_t offset, ELFAbbrev* abbrev, CompileUnit
|
|||
|
||||
Type* elfParseType(CompileUnit* unit, uint32_t offset)
|
||||
{
|
||||
Type* t = unit->types;
|
||||
Type* _t = unit->types;
|
||||
|
||||
while (t) {
|
||||
if (t->offset == offset)
|
||||
return t;
|
||||
t = t->next;
|
||||
while (_t) {
|
||||
if (_t->offset == offset)
|
||||
return _t;
|
||||
_t = _t->next;
|
||||
}
|
||||
if (offset == 0) {
|
||||
Type* t = (Type*)calloc(sizeof(Type), 1);
|
||||
|
@ -2456,7 +2456,7 @@ void elfParseAranges(uint8_t* data)
|
|||
int index = 0;
|
||||
|
||||
while (data < end) {
|
||||
uint32_t len = elfRead4Bytes(data);
|
||||
uint32_t _len = elfRead4Bytes(data);
|
||||
data += 4;
|
||||
// uint16_t version = elfRead2Bytes(data);
|
||||
data += 2;
|
||||
|
@ -2466,9 +2466,9 @@ void elfParseAranges(uint8_t* data)
|
|||
// uint8_t segSize = *data++;
|
||||
data += 2; // remove if uncommenting above
|
||||
data += 4;
|
||||
ranges[index].count = (len - 20) / 8;
|
||||
ranges[index].count = (_len - 20) / 8;
|
||||
ranges[index].offset = offset;
|
||||
ranges[index].ranges = (ARange*)calloc(sizeof(ARange), (len - 20) / 8);
|
||||
ranges[index].ranges = (ARange*)calloc(sizeof(ARange), (_len - 20) / 8);
|
||||
int i = 0;
|
||||
while (true) {
|
||||
uint32_t addr = elfRead4Bytes(data);
|
||||
|
@ -2544,7 +2544,7 @@ void elfReadSymtab(uint8_t* data)
|
|||
bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int& size, bool parseDebug)
|
||||
{
|
||||
int count = READ16LE(&eh->e_phnum);
|
||||
int i;
|
||||
int _i;
|
||||
|
||||
if (READ32LE(&eh->e_entry) == 0x2000000)
|
||||
coreOptions.cpuIsMultiBoot = true;
|
||||
|
@ -2552,7 +2552,7 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
|||
// read program headers... should probably move this code down
|
||||
uint8_t* p = data + READ32LE(&eh->e_phoff);
|
||||
size = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
for (_i = 0; _i < count; _i++) {
|
||||
ELFProgramHeader* ph = (ELFProgramHeader*)p;
|
||||
p += sizeof(ELFProgramHeader);
|
||||
if (READ16LE(&eh->e_phentsize) != sizeof(ELFProgramHeader)) {
|
||||
|
@ -2604,8 +2604,8 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
|||
sh = (ELFSectionHeader**)
|
||||
malloc(sizeof(ELFSectionHeader*) * count);
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
sh[i] = (ELFSectionHeader*)p;
|
||||
for (_i = 0; _i < count; _i++) {
|
||||
sh[_i] = (ELFSectionHeader*)p;
|
||||
p += sizeof(ELFSectionHeader);
|
||||
if (READ16LE(&eh->e_shentsize) != sizeof(ELFSectionHeader))
|
||||
p += READ16LE(&eh->e_shentsize) - sizeof(ELFSectionHeader);
|
||||
|
@ -2617,24 +2617,24 @@ bool elfReadProgram(ELFHeader* eh, uint8_t* data, unsigned long data_size, int&
|
|||
elfSectionHeadersStringTable = stringTable;
|
||||
elfSectionHeadersCount = count;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
for (_i = 0; _i < count; _i++) {
|
||||
// printf("SH %d %-20s %08x %08x %08x %08x %08x %08x %08x %08x\n",
|
||||
// i, &stringTable[sh[i]->name], sh[i]->name, sh[i]->type,
|
||||
// sh[i]->flags, sh[i]->addr, sh[i]->offset, sh[i]->size,
|
||||
// sh[i]->link, sh[i]->info);
|
||||
if (READ32LE(&sh[i]->flags) & 2) { // load section
|
||||
// i, &stringTable[sh[_i]->name], sh[_i]->name, sh[_i]->type,
|
||||
// sh[_i]->flags, sh[_i]->addr, sh[_i]->offset, sh[_i]->size,
|
||||
// sh[_i]->link, sh[_i]->info);
|
||||
if (READ32LE(&sh[_i]->flags) & 2) { // load section
|
||||
if (coreOptions.cpuIsMultiBoot) {
|
||||
if (READ32LE(&sh[i]->addr) >= 0x2000000 && READ32LE(&sh[i]->addr) <= 0x203ffff) {
|
||||
memcpy(&g_workRAM[READ32LE(&sh[i]->addr) & 0x3ffff], data + READ32LE(&sh[i]->offset),
|
||||
READ32LE(&sh[i]->size));
|
||||
size += READ32LE(&sh[i]->size);
|
||||
if (READ32LE(&sh[_i]->addr) >= 0x2000000 && READ32LE(&sh[_i]->addr) <= 0x203ffff) {
|
||||
memcpy(&g_workRAM[READ32LE(&sh[_i]->addr) & 0x3ffff], data + READ32LE(&sh[_i]->offset),
|
||||
READ32LE(&sh[_i]->size));
|
||||
size += READ32LE(&sh[_i]->size);
|
||||
}
|
||||
} else {
|
||||
if (READ32LE(&sh[i]->addr) >= 0x8000000 && READ32LE(&sh[i]->addr) <= 0x9ffffff) {
|
||||
memcpy(&g_rom[READ32LE(&sh[i]->addr) & 0x1ffffff],
|
||||
data + READ32LE(&sh[i]->offset),
|
||||
READ32LE(&sh[i]->size));
|
||||
size += READ32LE(&sh[i]->size);
|
||||
if (READ32LE(&sh[_i]->addr) >= 0x8000000 && READ32LE(&sh[_i]->addr) <= 0x9ffffff) {
|
||||
memcpy(&g_rom[READ32LE(&sh[_i]->addr) & 0x1ffffff],
|
||||
data + READ32LE(&sh[_i]->offset),
|
||||
READ32LE(&sh[_i]->size));
|
||||
size += READ32LE(&sh[_i]->size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2720,7 +2720,7 @@ bool elfRead(const char* name, int& siz, FILE* f)
|
|||
unsigned long size = ftell(f);
|
||||
elfFileData = (uint8_t*)malloc(size);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
int res = fread(elfFileData, 1, size, f);
|
||||
int res = (int)fread(elfFileData, 1, size, f);
|
||||
fclose(f);
|
||||
|
||||
if (res < 0) {
|
||||
|
|
|
@ -128,10 +128,10 @@ uint8_t flashRead(uint32_t address)
|
|||
switch (address & 0xFF) {
|
||||
case 0:
|
||||
// manufacturer ID
|
||||
return flashManufacturerID;
|
||||
return (uint8_t)flashManufacturerID;
|
||||
case 1:
|
||||
// device ID
|
||||
return flashDeviceID;
|
||||
return (uint8_t)flashDeviceID;
|
||||
}
|
||||
break;
|
||||
case FLASH_ERASE_COMPLETE:
|
||||
|
|
|
@ -592,7 +592,7 @@ void SetLinkTimeout(int value)
|
|||
void EnableLinkServer(bool enable, int numSlaves)
|
||||
{
|
||||
lanlink.server = enable;
|
||||
lanlink.numslaves = numSlaves;
|
||||
lanlink.numslaves = (uint16_t)numSlaves;
|
||||
}
|
||||
|
||||
void EnableSpeedHacks(bool enable)
|
||||
|
@ -806,26 +806,26 @@ void CableServer::Send(void)
|
|||
if (lanlink.numslaves == 1) {
|
||||
if (lanlink.type == 0) {
|
||||
outbuffer[0] = 8;
|
||||
tcpsocket[1].send(outbuffer, 8);
|
||||
(void)tcpsocket[1].send(outbuffer, 8);
|
||||
}
|
||||
} else if (lanlink.numslaves == 2) {
|
||||
WRITE16LE(&uint16_toutbuffer[4], cable_data[2]);
|
||||
if (lanlink.type == 0) {
|
||||
outbuffer[0] = 10;
|
||||
tcpsocket[1].send(outbuffer, 10);
|
||||
(void)tcpsocket[1].send(outbuffer, 10);
|
||||
WRITE16LE(&uint16_toutbuffer[4], cable_data[1]);
|
||||
tcpsocket[2].send(outbuffer, 10);
|
||||
(void)tcpsocket[2].send(outbuffer, 10);
|
||||
}
|
||||
} else {
|
||||
if (lanlink.type == 0) {
|
||||
outbuffer[0] = 12;
|
||||
WRITE16LE(&uint16_toutbuffer[4], cable_data[2]);
|
||||
WRITE16LE(&uint16_toutbuffer[5], cable_data[3]);
|
||||
tcpsocket[1].send(outbuffer, 12);
|
||||
(void)tcpsocket[1].send(outbuffer, 12);
|
||||
WRITE16LE(&uint16_toutbuffer[4], cable_data[1]);
|
||||
tcpsocket[2].send(outbuffer, 12);
|
||||
(void)tcpsocket[2].send(outbuffer, 12);
|
||||
WRITE16LE(&uint16_toutbuffer[5], cable_data[2]);
|
||||
tcpsocket[3].send(outbuffer, 12);
|
||||
(void)tcpsocket[3].send(outbuffer, 12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -851,8 +851,8 @@ void CableServer::Recv(void)
|
|||
inbuffer[0] = 1;
|
||||
while (numbytes < inbuffer[0]) {
|
||||
size_t nr;
|
||||
tcpsocket[i + 1].receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += nr;
|
||||
(void)tcpsocket[i + 1].receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += (int)nr;
|
||||
}
|
||||
if (inbuffer[1] == -32) {
|
||||
char message[30];
|
||||
|
@ -861,9 +861,9 @@ void CableServer::Recv(void)
|
|||
outbuffer[0] = 4;
|
||||
outbuffer[1] = -32;
|
||||
for (i = 1; i < lanlink.numslaves; i++) {
|
||||
tcpsocket[i].send(outbuffer, 12);
|
||||
(void)tcpsocket[i].send(outbuffer, 12);
|
||||
size_t nr;
|
||||
tcpsocket[i].receive(inbuffer, 256, nr);
|
||||
(void)tcpsocket[i].receive(inbuffer, 256, nr);
|
||||
tcpsocket[i].disconnect();
|
||||
}
|
||||
CloseLink();
|
||||
|
@ -883,7 +883,7 @@ void CableServer::SendGB(void)
|
|||
if (lanlink.type == 0) { // TCP
|
||||
if (lanlink.numslaves == 1) {
|
||||
if (lanlink.type == 0) {
|
||||
tcpsocket[1].send(&cable_gb_data[0], 1);
|
||||
(void)tcpsocket[1].send(&cable_gb_data[0], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -912,8 +912,8 @@ bool CableServer::RecvGB(void)
|
|||
uint8_t recv_byte = 0;
|
||||
|
||||
size_t nr;
|
||||
tcpsocket[i + 1].receive(&recv_byte, 1, nr);
|
||||
numbytes += nr;
|
||||
(void)tcpsocket[i + 1].receive(&recv_byte, 1, nr);
|
||||
numbytes += (int)nr;
|
||||
|
||||
if (numbytes != 0)
|
||||
counter = 1;
|
||||
|
@ -950,16 +950,16 @@ CableClient::CableClient(void)
|
|||
void CableClient::CheckConn(void)
|
||||
{
|
||||
size_t nr;
|
||||
lanlink.tcpsocket.receive(inbuffer, 1, nr);
|
||||
numbytes = nr;
|
||||
(void)lanlink.tcpsocket.receive(inbuffer, 1, nr);
|
||||
numbytes = (int)nr;
|
||||
if (numbytes > 0) {
|
||||
while (numbytes < inbuffer[0]) {
|
||||
lanlink.tcpsocket.receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += nr;
|
||||
(void)lanlink.tcpsocket.receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += (int)nr;
|
||||
}
|
||||
if (inbuffer[1] == -32) {
|
||||
outbuffer[0] = 4;
|
||||
lanlink.tcpsocket.send(outbuffer, 4);
|
||||
(void)lanlink.tcpsocket.send(outbuffer, 4);
|
||||
systemScreenMessage(_("Server disconnected."));
|
||||
CloseLink();
|
||||
return;
|
||||
|
@ -993,8 +993,8 @@ bool CableClient::RecvGB(void)
|
|||
size_t nr;
|
||||
uint8_t recv_byte = 0;
|
||||
|
||||
lanlink.tcpsocket.receive(&recv_byte, 1, nr);
|
||||
numbytes += nr;
|
||||
(void)lanlink.tcpsocket.receive(&recv_byte, 1, nr);
|
||||
numbytes += (int)nr;
|
||||
|
||||
if (numbytes != 0)
|
||||
transferring = false;
|
||||
|
@ -1015,7 +1015,7 @@ void CableClient::SendGB()
|
|||
if (transferring)
|
||||
return;
|
||||
|
||||
lanlink.tcpsocket.send(&cable_gb_data[1], 1);
|
||||
(void)lanlink.tcpsocket.send(&cable_gb_data[1], 1);
|
||||
|
||||
transferring = true;
|
||||
}
|
||||
|
@ -1034,12 +1034,12 @@ void CableClient::Recv(void)
|
|||
inbuffer[0] = 1;
|
||||
size_t nr;
|
||||
while (numbytes < inbuffer[0]) {
|
||||
lanlink.tcpsocket.receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += nr;
|
||||
(void)lanlink.tcpsocket.receive(inbuffer + numbytes, inbuffer[0] - numbytes, nr);
|
||||
numbytes += (int)nr;
|
||||
}
|
||||
if (inbuffer[1] == -32) {
|
||||
outbuffer[0] = 4;
|
||||
lanlink.tcpsocket.send(outbuffer, 4);
|
||||
(void)lanlink.tcpsocket.send(outbuffer, 4);
|
||||
systemScreenMessage(_("Server disconnected."));
|
||||
CloseLink();
|
||||
return;
|
||||
|
@ -1058,9 +1058,9 @@ void CableClient::Recv(void)
|
|||
void CableClient::Send()
|
||||
{
|
||||
outbuffer[0] = 4;
|
||||
outbuffer[1] = linkid << 2;
|
||||
outbuffer[1] = (char)(linkid << 2);
|
||||
WRITE16LE(&uint16_toutbuffer[1], cable_data[linkid]);
|
||||
lanlink.tcpsocket.send(outbuffer, 4);
|
||||
(void)lanlink.tcpsocket.send(outbuffer, 4);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||
fdset.add(lanlink.tcplistener);
|
||||
|
||||
if (fdset.wait(sf::milliseconds(150))) {
|
||||
uint16_t nextSlave = lanlink.connectedSlaves + 1;
|
||||
uint16_t nextSlave = (uint16_t)(lanlink.connectedSlaves + 1);
|
||||
|
||||
sf::Socket::Status st = lanlink.tcplistener.accept(ls.tcpsocket[nextSlave]);
|
||||
|
||||
|
@ -1137,7 +1137,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||
sf::Packet packet;
|
||||
packet << nextSlave << lanlink.numslaves;
|
||||
|
||||
ls.tcpsocket[nextSlave].send(packet);
|
||||
(void)ls.tcpsocket[nextSlave].send(packet);
|
||||
|
||||
snprintf(message, size, N_("Player %d connected"), nextSlave);
|
||||
|
||||
|
@ -1150,7 +1150,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||
sf::Packet packet;
|
||||
packet << true;
|
||||
|
||||
ls.tcpsocket[i].send(packet);
|
||||
(void)ls.tcpsocket[i].send(packet);
|
||||
}
|
||||
|
||||
snprintf(message, size, N_("All players connected"));
|
||||
|
@ -1189,7 +1189,7 @@ static ConnectionState ConnectUpdateSocket(char* const message, size_t size)
|
|||
|
||||
sf::SocketSelector fdset;
|
||||
fdset.add(lanlink.tcpsocket);
|
||||
fdset.wait(sf::milliseconds(150));
|
||||
(void)fdset.wait(sf::milliseconds(150));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ void StartCableSocket(uint16_t value)
|
|||
cable_data[0] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
transfer_start_time_from_master = linktime;
|
||||
tspeed = value & 3;
|
||||
ls.Send();
|
||||
(void)ls.Send();
|
||||
transfer_direction = RECEIVING;
|
||||
linktime = 0;
|
||||
UPDATE_REG(COMM_SIOMULTI0, cable_data[0]);
|
||||
|
@ -1252,7 +1252,7 @@ static void UpdateCableSocket(int ticks)
|
|||
if (linkid && transfer_direction == SENDING && lc.transferring && linktime >= transfer_start_time_from_master) {
|
||||
cable_data[linkid] = READ16LE(&g_ioMem[COMM_SIODATA8]);
|
||||
|
||||
lc.Send();
|
||||
(void)lc.Send();
|
||||
UPDATE_REG(COMM_SIODATA32_L, cable_data[0]);
|
||||
UPDATE_REG(COMM_SIOCNT, READ16LE(&g_ioMem[COMM_SIOCNT]) | 0x80);
|
||||
transfer_direction = RECEIVING;
|
||||
|
@ -1288,7 +1288,7 @@ static void CloseSocket()
|
|||
outbuffer[0] = 4;
|
||||
outbuffer[1] = -32;
|
||||
if (lanlink.type == 0)
|
||||
lanlink.tcpsocket.send(outbuffer, 4);
|
||||
(void)lanlink.tcpsocket.send(outbuffer, 4);
|
||||
} else {
|
||||
char outbuffer[12];
|
||||
int i;
|
||||
|
@ -1296,7 +1296,7 @@ static void CloseSocket()
|
|||
outbuffer[1] = -32;
|
||||
for (i = 1; i <= lanlink.numslaves; i++) {
|
||||
if (lanlink.type == 0) {
|
||||
ls.tcpsocket[i].send(outbuffer, 12);
|
||||
(void)ls.tcpsocket[i].send(outbuffer, 12);
|
||||
}
|
||||
ls.tcpsocket[i].disconnect();
|
||||
}
|
||||
|
@ -1495,7 +1495,7 @@ void RFUServer::DeSerialize(sf::Packet& packet, int slave)
|
|||
packet >> slave_is_host;
|
||||
packet >> rfu_data.rfu_reqid[slave];
|
||||
if (slave_is_host) {
|
||||
current_host = slave;
|
||||
current_host = (uint8_t)slave;
|
||||
for (int j = 0; j < 7; j++)
|
||||
packet >> rfu_data.rfu_broadcastdata[slave][j];
|
||||
}
|
||||
|
@ -1527,18 +1527,18 @@ void RFUServer::Send(void)
|
|||
sf::Packet packet;
|
||||
if (lanlink.numslaves == 1) {
|
||||
if (lanlink.type == 0) {
|
||||
tcpsocket[1].send(Serialize(packet, 1));
|
||||
(void)tcpsocket[1].send(Serialize(packet, 1));
|
||||
}
|
||||
} else if (lanlink.numslaves == 2) {
|
||||
if (lanlink.type == 0) {
|
||||
tcpsocket[1].send(Serialize(packet, 1));
|
||||
tcpsocket[2].send(Serialize(packet, 2));
|
||||
(void)tcpsocket[1].send(Serialize(packet, 1));
|
||||
(void)tcpsocket[2].send(Serialize(packet, 2));
|
||||
}
|
||||
} else {
|
||||
if (lanlink.type == 0) {
|
||||
tcpsocket[1].send(Serialize(packet, 1));
|
||||
tcpsocket[2].send(Serialize(packet, 2));
|
||||
tcpsocket[3].send(Serialize(packet, 3));
|
||||
(void)tcpsocket[1].send(Serialize(packet, 1));
|
||||
(void)tcpsocket[2].send(Serialize(packet, 2));
|
||||
(void)tcpsocket[3].send(Serialize(packet, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1663,7 +1663,7 @@ void RFUClient::DeSerialize(sf::Packet& packet)
|
|||
void RFUClient::Send()
|
||||
{
|
||||
sf::Packet packet;
|
||||
lanlink.tcpsocket.send(Serialize(packet));
|
||||
(void)lanlink.tcpsocket.send(Serialize(packet));
|
||||
}
|
||||
|
||||
void RFUClient::Recv(void)
|
||||
|
@ -1713,7 +1713,7 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||
sf::Packet packet;
|
||||
packet << nextSlave << lanlink.numslaves;
|
||||
|
||||
rfu_server.tcpsocket[nextSlave].send(packet);
|
||||
(void)rfu_server.tcpsocket[nextSlave].send(packet);
|
||||
|
||||
snprintf(message, size, N_("Player %d connected"), nextSlave);
|
||||
lanlink.connectedSlaves++;
|
||||
|
@ -1725,7 +1725,7 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||
sf::Packet packet;
|
||||
packet << true;
|
||||
|
||||
rfu_server.tcpsocket[i].send(packet);
|
||||
(void)rfu_server.tcpsocket[i].send(packet);
|
||||
rfu_server.tcpsocket[i].setBlocking(false);
|
||||
}
|
||||
|
||||
|
@ -1766,11 +1766,11 @@ static ConnectionState ConnectUpdateRFUSocket(char* const message, size_t size)
|
|||
|
||||
sf::SocketSelector fdset;
|
||||
fdset.add(lanlink.tcpsocket);
|
||||
fdset.wait(sf::milliseconds(150));
|
||||
(void)fdset.wait(sf::milliseconds(150));
|
||||
}
|
||||
}
|
||||
|
||||
rfu_data.numgbas = lanlink.numslaves + 1;
|
||||
rfu_data.numgbas = (uint8_t)(lanlink.numslaves + 1);
|
||||
log("num gbas: %d\n", rfu_data.numgbas);
|
||||
|
||||
return newState;
|
||||
|
@ -1850,7 +1850,7 @@ static void StartRFUSocket(uint16_t value)
|
|||
CurCOM = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (siodata_h == 0x9966) //initialize cmd
|
||||
{
|
||||
uint8_t tmpcmd = CurCOM;
|
||||
uint8_t tmpcmd = (uint8_t)CurCOM;
|
||||
if (tmpcmd != 0x10 && tmpcmd != 0x11 && tmpcmd != 0x13 && tmpcmd != 0x14 && tmpcmd != 0x16 && tmpcmd != 0x17 && tmpcmd != 0x19 && tmpcmd != 0x1a && tmpcmd != 0x1b && tmpcmd != 0x1c && tmpcmd != 0x1d && tmpcmd != 0x1e && tmpcmd != 0x1f && tmpcmd != 0x20 && tmpcmd != 0x21 && tmpcmd != 0x24 && tmpcmd != 0x25 && tmpcmd != 0x26 && tmpcmd != 0x27 && tmpcmd != 0x30 && tmpcmd != 0x32 && tmpcmd != 0x33 && tmpcmd != 0x34 && tmpcmd != 0x3d && tmpcmd != 0xa8 && tmpcmd != 0xee) {
|
||||
}
|
||||
rfu_counter = 0;
|
||||
|
@ -1945,13 +1945,13 @@ static void StartRFUSocket(uint16_t value)
|
|||
for (int i = 0; i < rfu_numclients; i++)
|
||||
rfu_masterdata[i] = rfu_clientlist[i];
|
||||
}
|
||||
rfu_id = (gbaid << 3) + 0x61f1;
|
||||
rfu_id = (uint16_t)((gbaid << 3) + 0x61f1);
|
||||
rfu_cmd ^= 0x80;
|
||||
break;
|
||||
case 0x1f: // join a room as client
|
||||
// TODO: to fix infinte send&recv w/o giving much cance to update the screen when both side acting as client
|
||||
// on MarioGolfAdv lobby(might be due to leftover data when switching from host to join mode at the same time?)
|
||||
rfu_id = rfu_masterdata[0];
|
||||
rfu_id = (uint16_t)rfu_masterdata[0];
|
||||
gbaid = (rfu_id - 0x61f1) >> 3;
|
||||
rfu_idx = rfu_id;
|
||||
gbaidx = gbaid;
|
||||
|
@ -2188,7 +2188,7 @@ static void StartRFUSocket(uint16_t value)
|
|||
if (qdata_len >= rfu_qrecv_broadcast_data_len) {
|
||||
rfu_masterq = rfu_qrecv_broadcast_data_len = qdata_len;
|
||||
gbaid = rfu_data.rfu_datalist[linkid][rfu_data.rfu_listfront[linkid]].gbaid;
|
||||
rfu_id = (gbaid << 3) + 0x61f1;
|
||||
rfu_id = (uint16_t)((gbaid << 3) + 0x61f1);
|
||||
if (rfu_ishost) {
|
||||
rfu_curclient = (uint8_t)rfu_data.rfu_clientidx[gbaid];
|
||||
}
|
||||
|
@ -2223,14 +2223,14 @@ static void StartRFUSocket(uint16_t value)
|
|||
for (int j = 0; j < rfu_data.numgbas; j++)
|
||||
if (j != linkid) {
|
||||
memcpy(rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].len = rfu_qsend2;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].time = linktime;
|
||||
rfu_data.rfu_listback[j]++;
|
||||
}
|
||||
} else if (linkid != gbaid) {
|
||||
memcpy(rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].len = rfu_qsend2;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].time = linktime;
|
||||
rfu_data.rfu_listback[gbaid]++;
|
||||
|
@ -2250,14 +2250,14 @@ static void StartRFUSocket(uint16_t value)
|
|||
for (int j = 0; j < rfu_data.numgbas; j++)
|
||||
if (j != linkid) {
|
||||
memcpy(rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].len = rfu_qsend2;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].time = linktime;
|
||||
rfu_data.rfu_listback[j]++;
|
||||
}
|
||||
} else if (linkid != gbaid) {
|
||||
memcpy(rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].len = rfu_qsend2;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].time = linktime;
|
||||
rfu_data.rfu_listback[gbaid]++;
|
||||
|
@ -2274,13 +2274,13 @@ static void StartRFUSocket(uint16_t value)
|
|||
if (rfu_ishost) {
|
||||
for (int j = 0; j < rfu_data.numgbas; j++)
|
||||
if (j != linkid) {
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].len = 0; //rfu_qsend2;
|
||||
rfu_data.rfu_datalist[j][rfu_data.rfu_listback[j]].time = linktime;
|
||||
rfu_data.rfu_listback[j]++;
|
||||
}
|
||||
} else if (linkid != gbaid) {
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].gbaid = (uint8_t)linkid;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].len = 0; //rfu_qsend2;
|
||||
rfu_data.rfu_datalist[gbaid][rfu_data.rfu_listback[gbaid]].time = linktime;
|
||||
rfu_data.rfu_listback[gbaid]++;
|
||||
|
@ -2461,7 +2461,7 @@ bool LinkRFUUpdateSocket()
|
|||
rfu_waiting = false;
|
||||
}
|
||||
}
|
||||
UPDATE_REG(COMM_SIODATA32_L, rfu_buf);
|
||||
UPDATE_REG(COMM_SIODATA32_L, (uint16_t)rfu_buf);
|
||||
UPDATE_REG(COMM_SIODATA32_H, rfu_buf >> 16);
|
||||
}
|
||||
}
|
||||
|
@ -2476,9 +2476,9 @@ static void UpdateRFUSocket(int ticks)
|
|||
if (linkid == 0) {
|
||||
linktime = 0;
|
||||
rfu_server.Recv(); // recv broadcast data
|
||||
rfu_server.Send(); // send broadcast data
|
||||
(void)rfu_server.Send(); // send broadcast data
|
||||
} else {
|
||||
rfu_client.Send(); // send broadcast data
|
||||
(void)rfu_client.Send(); // send broadcast data
|
||||
rfu_client.Recv(); // recv broadcast data
|
||||
}
|
||||
{
|
||||
|
@ -2691,10 +2691,10 @@ static ConnectionState InitIPC()
|
|||
return LINK_ERROR;
|
||||
}
|
||||
if (vbaid == n)
|
||||
linkmem->numgbas = n + 1;
|
||||
linkmem->linkflags = f | (1 << vbaid);
|
||||
linkmem->numgbas = (uint8_t)(n + 1);
|
||||
linkmem->linkflags = (uint8_t)(f | (1 << vbaid));
|
||||
}
|
||||
linkid = vbaid;
|
||||
linkid = (uint16_t)vbaid;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
linkevent[sizeof(linkevent) - 2] = (char)i + '1';
|
||||
|
@ -2760,7 +2760,7 @@ static void StartCableIPC(uint16_t value)
|
|||
n--;
|
||||
m = (1 << n) - 1;
|
||||
} while ((f & m) != m);
|
||||
linkmem->trgbas = n;
|
||||
linkmem->trgbas = (uint8_t)n;
|
||||
|
||||
// before starting xfer, make pathetic attempt
|
||||
// at clearing out any previous stuck xfer
|
||||
|
@ -2830,7 +2830,7 @@ static void ReconnectCableIPC()
|
|||
}
|
||||
linkmem->linkflags |= 1 << linkid;
|
||||
if (n < linkid + 1)
|
||||
linkmem->numgbas = linkid + 1;
|
||||
linkmem->numgbas = (uint8_t)(linkid + 1);
|
||||
numtransfers = linkmem->numtransfers;
|
||||
systemScreenMessage(_("Lost link; reconnected"));
|
||||
}
|
||||
|
@ -2899,12 +2899,12 @@ static void UpdateCableIPC(int)
|
|||
if (WaitForSingleObject(linksync[transfer_direction - 1], linktimeout) == WAIT_TIMEOUT) {
|
||||
// assume slave has dropped off if timed out
|
||||
if (!linkid) {
|
||||
linkmem->trgbas = transfer_direction - 1;
|
||||
linkmem->trgbas = (uint8_t)(transfer_direction - 1);
|
||||
int f = linkmem->linkflags;
|
||||
f &= ~(1 << (transfer_direction - 1));
|
||||
linkmem->linkflags = f;
|
||||
linkmem->linkflags = (uint8_t)f;
|
||||
if (f < (1 << transfer_direction) - 1)
|
||||
linkmem->numgbas = transfer_direction - 1;
|
||||
linkmem->numgbas = (uint8_t)(transfer_direction - 1);
|
||||
char message[30];
|
||||
snprintf(message, sizeof(message), _("Player %d disconnected."), transfer_direction - 1);
|
||||
systemScreenMessage(message);
|
||||
|
@ -3055,7 +3055,7 @@ static void StartRFU(uint16_t value)
|
|||
CurCOM = READ32LE(&g_ioMem[COMM_SIODATA32_L]);
|
||||
if (siodata_h == 0x9966) //initialize cmd
|
||||
{
|
||||
uint8_t tmpcmd = CurCOM;
|
||||
uint8_t tmpcmd = (uint8_t)CurCOM;
|
||||
if (tmpcmd != 0x10 && tmpcmd != 0x11 && tmpcmd != 0x13 && tmpcmd != 0x14 && tmpcmd != 0x16 && tmpcmd != 0x17 && tmpcmd != 0x19 && tmpcmd != 0x1a && tmpcmd != 0x1b && tmpcmd != 0x1c && tmpcmd != 0x1d && tmpcmd != 0x1e && tmpcmd != 0x1f && tmpcmd != 0x20 && tmpcmd != 0x21 && tmpcmd != 0x24 && tmpcmd != 0x25 && tmpcmd != 0x26 && tmpcmd != 0x27 && tmpcmd != 0x30 && tmpcmd != 0x32 && tmpcmd != 0x33 && tmpcmd != 0x34 && tmpcmd != 0x3d && tmpcmd != 0xa8 && tmpcmd != 0xee) {
|
||||
log("%08X : UnkCMD %08X %04X %08X %08X\n", GetTickCount(), CurCOM, PrevVAL, PrevCOM, PrevDAT);
|
||||
}
|
||||
|
@ -3210,13 +3210,13 @@ static void StartRFU(uint16_t value)
|
|||
for (int i = 0; i < rfu_numclients; i++)
|
||||
rfu_masterdata[i] = rfu_clientlist[i];
|
||||
}
|
||||
rfu_id = (gbaid << 3) + 0x61f1;
|
||||
rfu_id = (uint16_t)((gbaid << 3) + 0x61f1);
|
||||
rfu_cmd ^= 0x80;
|
||||
break;
|
||||
case 0x1f: // join a room as client
|
||||
// TODO: to fix infinte send&recv w/o giving much cance to update the screen when both side acting as client
|
||||
// on MarioGolfAdv lobby(might be due to leftover data when switching from host to join mode at the same time?)
|
||||
rfu_id = rfu_masterdata[0];
|
||||
rfu_id = (uint16_t)rfu_masterdata[0];
|
||||
gbaid = (rfu_id - 0x61f1) >> 3;
|
||||
rfu_idx = rfu_id;
|
||||
gbaidx = gbaid;
|
||||
|
@ -3583,7 +3583,7 @@ static void StartRFU(uint16_t value)
|
|||
if (tmpq >= rfu_qrecv_broadcast_data_len) {
|
||||
rfu_masterq = rfu_qrecv_broadcast_data_len = tmpq;
|
||||
gbaid = linkmem->rfu_datalist[vbaid][linkmem->rfu_listfront[vbaid]].gbaid;
|
||||
rfu_id = (gbaid << 3) + 0x61f1;
|
||||
rfu_id = (uint16_t)((gbaid << 3) + 0x61f1);
|
||||
if (rfu_ishost)
|
||||
rfu_curclient = (uint8_t)linkmem->rfu_clientidx[gbaid];
|
||||
if (rfu_qrecv_broadcast_data_len != 0) { //data size > 0
|
||||
|
@ -3638,7 +3638,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[j], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[j]); //lock it so noone can access it
|
||||
memcpy(linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].len = rfu_qsend2;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].time = linktime;
|
||||
linkmem->rfu_listback[j]++;
|
||||
|
@ -3648,7 +3648,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[gbaid], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[gbaid]); //lock it so noone can access it
|
||||
memcpy(linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].len = rfu_qsend2;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].time = linktime;
|
||||
linkmem->rfu_listback[gbaid]++;
|
||||
|
@ -3684,7 +3684,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[j], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[j]); //lock it so noone can access it
|
||||
memcpy(linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].len = rfu_qsend2;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].time = linktime;
|
||||
linkmem->rfu_listback[j]++;
|
||||
|
@ -3694,7 +3694,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[gbaid], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[gbaid]); //lock it so noone can access it
|
||||
memcpy(linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].data, rfu_masterdata, 4 * rfu_qsend2);
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].len = rfu_qsend2;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].time = linktime;
|
||||
linkmem->rfu_listback[gbaid]++;
|
||||
|
@ -3723,7 +3723,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[j], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[j]); //lock it so noone can access it
|
||||
//memcpy(linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].data,rfu_masterdata,4*rfu_qsend2);
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].len = 0; //rfu_qsend2;
|
||||
linkmem->rfu_datalist[j][linkmem->rfu_listback[j]].time = linktime;
|
||||
linkmem->rfu_listback[j]++;
|
||||
|
@ -3733,7 +3733,7 @@ static void StartRFU(uint16_t value)
|
|||
WaitForSingleObject(linksync[gbaid], linktimeout); //wait until unlocked
|
||||
ResetEvent(linksync[gbaid]); //lock it so noone can access it
|
||||
//memcpy(linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].data,rfu_masterdata,4*rfu_qsend2);
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].gbaid = (uint8_t)vbaid;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].len = 0; //rfu_qsend2;
|
||||
linkmem->rfu_datalist[gbaid][linkmem->rfu_listback[gbaid]].time = linktime;
|
||||
linkmem->rfu_listback[gbaid]++;
|
||||
|
@ -3991,7 +3991,7 @@ bool LinkRFUUpdate()
|
|||
rfu_waiting = false;
|
||||
}
|
||||
}
|
||||
UPDATE_REG(COMM_SIODATA32_L, rfu_buf);
|
||||
UPDATE_REG(COMM_SIODATA32_L, (uint16_t)rfu_buf);
|
||||
UPDATE_REG(COMM_SIODATA32_H, rfu_buf >> 16);
|
||||
}
|
||||
}
|
||||
|
@ -4128,11 +4128,11 @@ static void CloseIPC()
|
|||
int f = linkmem->linkflags;
|
||||
f &= ~(1 << linkid);
|
||||
if (f & 0xf) {
|
||||
linkmem->linkflags = f;
|
||||
linkmem->linkflags = (uint8_t)f;
|
||||
int n = linkmem->numgbas;
|
||||
for (int i = 0; i < n; i--)
|
||||
if (f <= (1 << (i + 1)) - 1) {
|
||||
linkmem->numgbas = i + 1;
|
||||
linkmem->numgbas = (uint8_t)(i + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,8 +57,8 @@ extern void CPUUpdateCPSR();
|
|||
|
||||
int remotePort = 0;
|
||||
int remoteSignal = 5;
|
||||
SOCKET remoteSocket = -1;
|
||||
SOCKET remoteListenSocket = -1;
|
||||
SOCKET remoteSocket = (SOCKET)(-1);
|
||||
SOCKET remoteListenSocket = (SOCKET)(-1);
|
||||
bool remoteConnected = false;
|
||||
bool remoteResumed = false;
|
||||
|
||||
|
@ -167,25 +167,25 @@ void breakReg_check(int i)
|
|||
if (brkR->flags != 0) {
|
||||
uint32_t regVal = (i == 15 ? (armState ? reg[15].I - 4 : reg[15].I - 2) : reg[i].I);
|
||||
if ((brkR->flags & 0x1) && (regVal == brkR->intVal)) {
|
||||
debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 1);
|
||||
debuggerBreakOnRegisterCondition((uint8_t)i, brkR->intVal, regVal, 1);
|
||||
notFound = false;
|
||||
}
|
||||
if ((brkR->flags & 0x8)) {
|
||||
if ((brkR->flags & 0x4) && ((int)regVal < (int)brkR->intVal)) {
|
||||
debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 4);
|
||||
debuggerBreakOnRegisterCondition((uint8_t)i, brkR->intVal, regVal, 4);
|
||||
notFound = false;
|
||||
}
|
||||
if ((brkR->flags & 0x2) && ((int)regVal > (int)brkR->intVal)) {
|
||||
debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 5);
|
||||
debuggerBreakOnRegisterCondition((uint8_t)i, brkR->intVal, regVal, 5);
|
||||
notFound = false;
|
||||
}
|
||||
}
|
||||
if ((brkR->flags & 0x4) && (regVal < brkR->intVal)) {
|
||||
debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 2);
|
||||
debuggerBreakOnRegisterCondition((uint8_t)i, brkR->intVal, regVal, 2);
|
||||
notFound = false;
|
||||
}
|
||||
if ((brkR->flags & 0x2) && (regVal > brkR->intVal)) {
|
||||
debuggerBreakOnRegisterCondition(i, brkR->intVal, regVal, 3);
|
||||
debuggerBreakOnRegisterCondition((uint8_t)i, brkR->intVal, regVal, 3);
|
||||
notFound = false;
|
||||
}
|
||||
}
|
||||
|
@ -409,7 +409,7 @@ void debuggerDumpLoad(int n, char** args)
|
|||
c = fgetc(f);
|
||||
if (c == -1)
|
||||
break;
|
||||
debuggerWriteByte(address, c);
|
||||
debuggerWriteByte(address, (uint8_t)c);
|
||||
address++;
|
||||
}
|
||||
|
||||
|
@ -480,7 +480,7 @@ void debuggerEditByte(int n, char** args)
|
|||
monprintf(monbuf);
|
||||
}
|
||||
}
|
||||
debuggerWriteByte(address, (uint16_t)value);
|
||||
debuggerWriteByte(address, (uint8_t)value);
|
||||
address++;
|
||||
}
|
||||
} else
|
||||
|
@ -776,21 +776,21 @@ unsigned int SearchResults;
|
|||
unsigned int AddressToGBA(uint8_t* mem)
|
||||
{
|
||||
if (mem >= &g_bios[0] && mem <= &g_bios[0x3fff])
|
||||
return 0x00000000 + (mem - &g_bios[0]);
|
||||
return (unsigned int)(0x00000000 + (mem - &g_bios[0]));
|
||||
else if (mem >= &g_workRAM[0] && mem <= &g_workRAM[0x3ffff])
|
||||
return 0x02000000 + (mem - &g_workRAM[0]);
|
||||
return (unsigned int)(0x02000000 + (mem - &g_workRAM[0]));
|
||||
else if (mem >= &g_internalRAM[0] && mem <= &g_internalRAM[0x7fff])
|
||||
return 0x03000000 + (mem - &g_internalRAM[0]);
|
||||
return (unsigned int)(0x03000000 + (mem - &g_internalRAM[0]));
|
||||
else if (mem >= &g_ioMem[0] && mem <= &g_ioMem[0x3ff])
|
||||
return 0x04000000 + (mem - &g_ioMem[0]);
|
||||
return (unsigned int)(0x04000000 + (mem - &g_ioMem[0]));
|
||||
else if (mem >= &g_paletteRAM[0] && mem <= &g_paletteRAM[0x3ff])
|
||||
return 0x05000000 + (mem - &g_paletteRAM[0]);
|
||||
return (unsigned int)(0x05000000 + (mem - &g_paletteRAM[0]));
|
||||
else if (mem >= &g_vram[0] && mem <= &g_vram[0x1ffff])
|
||||
return 0x06000000 + (mem - &g_vram[0]);
|
||||
return (unsigned int)(0x06000000 + (mem - &g_vram[0]));
|
||||
else if (mem >= &g_oam[0] && mem <= &g_oam[0x3ff])
|
||||
return 0x07000000 + (mem - &g_oam[0]);
|
||||
return (unsigned int)(0x07000000 + (mem - &g_oam[0]));
|
||||
else if (mem >= &g_rom[0] && mem <= &g_rom[0x1ffffff])
|
||||
return 0x08000000 + (mem - &g_rom[0]);
|
||||
return (unsigned int)(0x08000000 + (mem - &g_rom[0]));
|
||||
else
|
||||
return 0xFFFFFFFF;
|
||||
};
|
||||
|
@ -936,10 +936,10 @@ void debuggerFindText(int n, char** args)
|
|||
if (n == 4) {
|
||||
sscanf(args[2], "%u", &SearchMaxMatches);
|
||||
strncpy((char*)SearchData, args[3], 64);
|
||||
SearchLength = strlen(args[3]);
|
||||
SearchLength = (unsigned int)strlen(args[3]);
|
||||
} else if (n == 3) {
|
||||
strncpy((char*)SearchData, args[2], 64);
|
||||
SearchLength = strlen(args[2]);
|
||||
SearchLength = (unsigned int)strlen(args[2]);
|
||||
};
|
||||
|
||||
if (SearchLength > 64) {
|
||||
|
@ -972,10 +972,10 @@ void debuggerFindHex(int n, char** args)
|
|||
if (n == 4) {
|
||||
sscanf(args[2], "%u", &SearchMaxMatches);
|
||||
strncpy(SearchHex, args[3], 128);
|
||||
SearchLength = strlen(args[3]);
|
||||
SearchLength = (unsigned int)strlen(args[3]);
|
||||
} else if (n == 3) {
|
||||
strncpy(SearchHex, args[2], 128);
|
||||
SearchLength = strlen(args[2]);
|
||||
SearchLength = (unsigned int)strlen(args[2]);
|
||||
};
|
||||
|
||||
if (SearchLength & 1) {
|
||||
|
@ -996,7 +996,7 @@ void debuggerFindHex(int n, char** args)
|
|||
for (unsigned int i = 0; i < SearchLength; i++) {
|
||||
unsigned int cbuf = 0;
|
||||
sscanf(&SearchHex[i << 1], "%02x", &cbuf);
|
||||
SearchData[i] = cbuf;
|
||||
SearchData[i] = (uint8_t)cbuf;
|
||||
};
|
||||
|
||||
debuggerDoSearch();
|
||||
|
@ -1544,7 +1544,7 @@ void debuggerReadCharTable(int n, char** args)
|
|||
wordSymbol[slot] = (char*)' ';
|
||||
|
||||
if (largestSymbol < strlen(character))
|
||||
largestSymbol = strlen(character);
|
||||
largestSymbol = (uint8_t)strlen(character);
|
||||
|
||||
character = (char*)malloc(10);
|
||||
}
|
||||
|
@ -1567,7 +1567,7 @@ void printCharGroup(uint32_t addr, bool useAscii)
|
|||
snprintf(monbuf, sizeof(monbuf), "%s", c);
|
||||
monprintf(monbuf);
|
||||
}
|
||||
j = strlen(c);
|
||||
j = (int)strlen(c);
|
||||
} else {
|
||||
j = 0;
|
||||
}
|
||||
|
@ -1854,7 +1854,7 @@ void debuggerSymbols(int argc, char** argv)
|
|||
|
||||
if (argc == 2) {
|
||||
match = true;
|
||||
matchSize = strlen(argv[1]);
|
||||
matchSize = (int)strlen(argv[1]);
|
||||
matchStr = argv[1];
|
||||
}
|
||||
{
|
||||
|
@ -2066,7 +2066,7 @@ uint8_t getFlags(char* flagName)
|
|||
{
|
||||
|
||||
for (int i = 0; flagName[i] != '\0'; i++) {
|
||||
flagName[i] = toupper(flagName[i]);
|
||||
flagName[i] = (char)toupper(flagName[i]);
|
||||
}
|
||||
|
||||
if (strcmp(flagName, "ALWAYS") == 0) {
|
||||
|
@ -2119,7 +2119,7 @@ void debuggerBreakRegister(int n, char** args)
|
|||
printFlagHelp();
|
||||
return;
|
||||
}
|
||||
uint8_t reg = (uint8_t)getRegisterNumber(args[0]);
|
||||
uint8_t _reg = (uint8_t)getRegisterNumber(args[0]);
|
||||
uint8_t flag = getFlags(args[1]);
|
||||
uint32_t value;
|
||||
if (!dexp_eval(args[2], &value)) {
|
||||
|
@ -2130,9 +2130,9 @@ void debuggerBreakRegister(int n, char** args)
|
|||
return;
|
||||
}
|
||||
if (flag != 0) {
|
||||
addBreakRegToList(reg, flag, value);
|
||||
addBreakRegToList(_reg, flag, value);
|
||||
{
|
||||
snprintf(monbuf, sizeof(monbuf), "Added breakpoint on register R%02d, value %08x\n", reg, value);
|
||||
snprintf(monbuf, sizeof(monbuf), "Added breakpoint on register R%02d, value %08x\n", _reg, value);
|
||||
monprintf(monbuf);
|
||||
}
|
||||
}
|
||||
|
@ -2184,7 +2184,7 @@ void debuggerBreakRegisterDelete(int n, char** args)
|
|||
}
|
||||
return;
|
||||
}
|
||||
deleteFromBreakRegList(r, num);
|
||||
deleteFromBreakRegList((uint8_t)r, num);
|
||||
{
|
||||
snprintf(monbuf, sizeof(monbuf), "Deleted Breakpoint %d of regsiter %s.\n", num, args[0]);
|
||||
monprintf(monbuf);
|
||||
|
@ -2733,7 +2733,7 @@ void listBreaks(uint32_t address, uint8_t flags, char** expression, int howToLis
|
|||
void executeBreakCommands(int n, char** cmd)
|
||||
{
|
||||
char* command = cmd[0];
|
||||
int len = strlen(command);
|
||||
int len = (int)strlen(command);
|
||||
bool changed = false;
|
||||
if (len <= 4) {
|
||||
command = breakSymbolCombo(command, &len);
|
||||
|
@ -2770,7 +2770,7 @@ void executeBreakCommands(int n, char** cmd)
|
|||
}
|
||||
|
||||
for (int i = 0; cmd[0][i]; i++) {
|
||||
cmd[0][i] = tolower(cmd[0][i]);
|
||||
cmd[0][i] = (char)tolower(cmd[0][i]);
|
||||
}
|
||||
const char* replaced = replaceAlias(cmd[0], breakAliasTable);
|
||||
if (replaced == cmd[0]) {
|
||||
|
@ -2798,7 +2798,7 @@ void executeBreakCommands(int n, char** cmd)
|
|||
}
|
||||
|
||||
for (int i = 0; cmd[0][i]; i++) {
|
||||
cmd[0][i] = tolower(cmd[0][i]);
|
||||
cmd[0][i] = (char)tolower(cmd[0][i]);
|
||||
}
|
||||
ope = replaceAlias(cmd[0], breakAliasTable)[0];
|
||||
if ((ope == 'c') || (ope == 'd') || (ope == 'l') || (ope == 'm')) {
|
||||
|
@ -2951,7 +2951,7 @@ void debuggerDisable(int n, char** args)
|
|||
while (n > 1) {
|
||||
int i = 0;
|
||||
while (args[3 - n][i]) {
|
||||
args[3 - n][i] = tolower(args[2 - n][i]);
|
||||
args[3 - n][i] = (char)tolower(args[2 - n][i]);
|
||||
i++;
|
||||
}
|
||||
if (strcmp(args[3 - n], "breg")) {
|
||||
|
@ -2987,7 +2987,7 @@ void debuggerEnable(int n, char** args)
|
|||
while (n > 1) {
|
||||
int i = 0;
|
||||
while (args[3 - n][i]) {
|
||||
args[3 - n][i] = tolower(args[2 - n][i]);
|
||||
args[3 - n][i] = (char)tolower(args[2 - n][i]);
|
||||
i++;
|
||||
}
|
||||
if (strcmp(args[3 - n], "breg")) {
|
||||
|
@ -3347,7 +3347,7 @@ void dbgExecute(char* toRun)
|
|||
//first, convert the command name to a standart lowercase form
|
||||
//if more lowercasing needed, do it on the caller.
|
||||
for (int i = 0; commands[0][i]; i++) {
|
||||
commands[0][i] = tolower(commands[0][i]);
|
||||
commands[0][i] = (char)tolower(commands[0][i]);
|
||||
}
|
||||
|
||||
// checks if it is a quit command, if so quits.
|
||||
|
@ -3408,7 +3408,12 @@ bool remoteTcpInit()
|
|||
if (remoteSocket == -1) {
|
||||
#ifdef _WIN32
|
||||
WSADATA wsaData;
|
||||
#ifdef _DEBUG
|
||||
int error = WSAStartup(MAKEWORD(1, 1), &wsaData);
|
||||
fprintf(stderr, "WSAStartup: %d\n", error);
|
||||
#else
|
||||
WSAStartup(MAKEWORD(1, 1), &wsaData);
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
|
||||
|
||||
|
@ -3429,7 +3434,7 @@ bool remoteTcpInit()
|
|||
|
||||
sockaddr_in addr;
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(remotePort);
|
||||
addr.sin_port = htons((unsigned short)remotePort);
|
||||
addr.sin_addr.s_addr = htonl(0);
|
||||
int count = 0;
|
||||
while (count < 3) {
|
||||
|
@ -3463,7 +3468,10 @@ bool remoteTcpInit()
|
|||
ntohs(addr.sin_port));
|
||||
} else {
|
||||
#ifdef _WIN32
|
||||
int error = WSAGetLastError();
|
||||
#ifdef _DEBUG
|
||||
int _error = WSAGetLastError();
|
||||
fprintf(stderr, "WSA Error: %d\n", _error);
|
||||
#endif
|
||||
#endif // _WIN32
|
||||
}
|
||||
//char dummy;
|
||||
|
@ -3483,12 +3491,12 @@ void remoteTcpCleanUp()
|
|||
if (remoteSocket > 0) {
|
||||
fprintf(stderr, "Closing remote socket\n");
|
||||
close(remoteSocket);
|
||||
remoteSocket = -1;
|
||||
remoteSocket = (SOCKET)(-1);
|
||||
}
|
||||
if (remoteListenSocket > 0) {
|
||||
fprintf(stderr, "Closing listen socket\n");
|
||||
close(remoteListenSocket);
|
||||
remoteListenSocket = -1;
|
||||
remoteListenSocket = (SOCKET)(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
for (i = 0, j = 0; i < 12; i++)
|
||||
j ^= DotCodeData[i];
|
||||
if (dotcodesize == 0x81C) {
|
||||
LongDotCodeHeader[0x2E] = j;
|
||||
LongDotCodeHeader[0x2E] = (unsigned char)j;
|
||||
LongDotCodeHeader[0x0D] = DotCodeData[0];
|
||||
LongDotCodeHeader[0x0C] = DotCodeData[1];
|
||||
LongDotCodeHeader[0x11] = DotCodeData[2];
|
||||
|
@ -383,10 +383,10 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
global2 += j;
|
||||
global2 &= 0xFF;
|
||||
global2 ^= 0xFF;
|
||||
LongDotCodeHeader[0x2F] = global2;
|
||||
LongDotCodeHeader[0x2F] = (unsigned char)global2;
|
||||
|
||||
} else {
|
||||
ShortDotCodeHeader[0x2E] = j;
|
||||
ShortDotCodeHeader[0x2E] = (unsigned char)j;
|
||||
ShortDotCodeHeader[0x0D] = DotCodeData[0];
|
||||
ShortDotCodeHeader[0x0C] = DotCodeData[1];
|
||||
ShortDotCodeHeader[0x11] = DotCodeData[2];
|
||||
|
@ -427,7 +427,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
global2 += j;
|
||||
global2 &= 0xFF;
|
||||
global2 ^= 0xFF;
|
||||
ShortDotCodeHeader[0x2F] = global2;
|
||||
ShortDotCodeHeader[0x2F] = (unsigned char)global2;
|
||||
}
|
||||
|
||||
} else if (swi_num == 0xE2) //Header
|
||||
|
@ -465,9 +465,9 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
else
|
||||
j = CPUReadByte(GFpow + CPUReadByte(GFpow + 0x200 + i)) ^ 0xFF;
|
||||
|
||||
dotcodeheader[(0x17 - i)] = j;
|
||||
dotcodeheader[(0x17 - i) + 0x18] = j;
|
||||
dotcodeheader[(0x17 - i) + 0x30] = j;
|
||||
dotcodeheader[(0x17 - i)] = (unsigned char)j;
|
||||
dotcodeheader[(0x17 - i) + 0x18] = (unsigned char)j;
|
||||
dotcodeheader[(0x17 - i) + 0x30] = (unsigned char)j;
|
||||
}
|
||||
for (i = 0; i < 28; i++)
|
||||
for (j = 0; j < 2; j++)
|
||||
|
@ -480,7 +480,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
j = CPUReadByte(GFpow + CPUReadByte(GFpow + 0x200 + i));
|
||||
else
|
||||
j = CPUReadByte(GFpow + CPUReadByte(GFpow + 0x200 + i)) ^ 0xFF;
|
||||
dotcodetemp[((0x3F - i) * dotcodeinterleave) + dotcodepointer] = j;
|
||||
dotcodetemp[((0x3F - i) * dotcodeinterleave) + dotcodepointer] = (unsigned char)j;
|
||||
}
|
||||
dotcodepointer++;
|
||||
|
||||
|
@ -557,7 +557,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
else
|
||||
j = CPUReadByte(GFpow + 0x100 + (j ^ 0xFF));
|
||||
|
||||
CPUWriteByte(GFpow + 0x200 + (0x17 - i), j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x17 - i), (uint8_t)j);
|
||||
}
|
||||
} else {
|
||||
if (dotcodepointer == 0) {
|
||||
|
@ -568,7 +568,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
j = ShortDotCodeHeader[i];
|
||||
|
||||
j = CPUReadByte(GFpow + 0x100 + j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i), j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i), (uint8_t)j);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -576,7 +576,7 @@ void BIOS_EReader_ScanCard(int swi_num)
|
|||
|
||||
j = DotCodeData[((dotcodepointer - 1) * 0x30) + 0x0C + i];
|
||||
j = CPUReadByte(GFpow + 0x100 + j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i), j);
|
||||
CPUWriteByte(GFpow + 0x200 + (0x3F - i), (uint8_t)j);
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 16; i++)
|
||||
|
|
|
@ -10,10 +10,10 @@ GBASockClient::GBASockClient(sf::IpAddress _server_addr)
|
|||
{
|
||||
server_addr = _server_addr;
|
||||
|
||||
client.connect(server_addr, 0xd6ba);
|
||||
(void)client.connect(server_addr, 0xd6ba);
|
||||
client.setBlocking(false);
|
||||
|
||||
clock_client.connect(server_addr, 0xc10c);
|
||||
(void)clock_client.connect(server_addr, 0xc10c);
|
||||
clock_client.setBlocking(false);
|
||||
|
||||
clock_sync = 0;
|
||||
|
@ -33,7 +33,7 @@ void GBASockClient::Send(std::vector<char> data)
|
|||
char* plain_data = new char[data.size()];
|
||||
std::copy(data.begin(), data.end(), plain_data);
|
||||
|
||||
client.send(plain_data, data.size());
|
||||
(void)client.send(plain_data, data.size());
|
||||
|
||||
delete[] plain_data;
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ char GBASockClient::ReceiveCmd(char* data_in, bool block)
|
|||
if (block || clock_sync == 0) {
|
||||
sf::SocketSelector Selector;
|
||||
Selector.add(client);
|
||||
Selector.wait(sf::seconds(6));
|
||||
(void)Selector.wait(sf::seconds(6));
|
||||
}
|
||||
if (client.receive(data_in, 5, num_received) == sf::Socket::Status::Disconnected) {
|
||||
Disconnect();
|
||||
|
|
|
@ -386,9 +386,9 @@ bool sdlCheckDirectory(const char* dir)
|
|||
char* sdlGetFilename(const char* name)
|
||||
{
|
||||
char path[1024];
|
||||
const char *filename = strrchr(name, kFileSep);
|
||||
if (filename)
|
||||
strcpy(path, filename + 1);
|
||||
const char *_filename = strrchr(name, kFileSep);
|
||||
if (_filename)
|
||||
strcpy(path, _filename + 1);
|
||||
else
|
||||
strcpy(path, name);
|
||||
return strdup(path);
|
||||
|
@ -397,9 +397,9 @@ char* sdlGetFilename(const char* name)
|
|||
char* sdlGetFilePath(const char* name)
|
||||
{
|
||||
char path[1024];
|
||||
const char *filename = strrchr(name, kFileSep);
|
||||
if (filename) {
|
||||
size_t length = strlen(name) - strlen(filename);
|
||||
const char *_filename = strrchr(name, kFileSep);
|
||||
if (_filename) {
|
||||
size_t length = strlen(name) - strlen(_filename);
|
||||
memcpy(path, name, length);
|
||||
path[length] = '\0';
|
||||
}
|
||||
|
@ -456,11 +456,11 @@ FILE* sdlFindFile(const char* name)
|
|||
}
|
||||
|
||||
if (!strchr(home, '/') && !strchr(home, '\\')) {
|
||||
char* path = getenv("PATH");
|
||||
char* _path = getenv("PATH");
|
||||
|
||||
if (path != NULL) {
|
||||
if (_path != NULL) {
|
||||
fprintf(stdout, "Searching PATH\n");
|
||||
strcpy(buffer, path);
|
||||
strcpy(buffer, _path);
|
||||
buffer[sizeof(buffer) - 1] = 0;
|
||||
char* tok = strtok(buffer, PATH_SEP);
|
||||
|
||||
|
@ -1477,10 +1477,10 @@ void sdlPollEvents()
|
|||
}
|
||||
break;
|
||||
case SDLK_KP_DIVIDE:
|
||||
sdlChangeVolume(-0.1);
|
||||
sdlChangeVolume((float)-0.1);
|
||||
break;
|
||||
case SDLK_KP_MULTIPLY:
|
||||
sdlChangeVolume(0.1);
|
||||
sdlChangeVolume((float)0.1);
|
||||
break;
|
||||
case SDLK_KP_MINUS:
|
||||
if (gb_effects_config.stereo > 0.0) {
|
||||
|
@ -1490,7 +1490,7 @@ void sdlPollEvents()
|
|||
}
|
||||
systemScreenMessage("Stereo off");
|
||||
} else {
|
||||
gb_effects_config.stereo = SOUND_STEREO;
|
||||
gb_effects_config.stereo = (float)SOUND_STEREO;
|
||||
gb_effects_config.enabled = true;
|
||||
systemScreenMessage("Stereo on");
|
||||
}
|
||||
|
@ -1503,7 +1503,7 @@ void sdlPollEvents()
|
|||
}
|
||||
systemScreenMessage("Echo off");
|
||||
} else {
|
||||
gb_effects_config.echo = SOUND_ECHO;
|
||||
gb_effects_config.echo = (float)SOUND_ECHO;
|
||||
gb_effects_config.enabled = true;
|
||||
systemScreenMessage("Echo on");
|
||||
}
|
||||
|
@ -2087,26 +2087,26 @@ int main(int argc, char** argv)
|
|||
if (autoPatch && patchNum == 0) {
|
||||
char* tmp;
|
||||
// no patch given yet - look for ROMBASENAME.ips
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 1);
|
||||
snprintf(tmp, strlen(filename) + 4, "%s.ips", filename);
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 2);
|
||||
snprintf(tmp, strlen(filename) + 4 + 1, "%s.ips", filename);
|
||||
patchNames[patchNum] = tmp;
|
||||
patchNum++;
|
||||
|
||||
// no patch given yet - look for ROMBASENAME.ups
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 1);
|
||||
snprintf(tmp, strlen(filename) + 4, "%s.ups", filename);
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 2);
|
||||
snprintf(tmp, strlen(filename) + 4 + 1, "%s.ups", filename);
|
||||
patchNames[patchNum] = tmp;
|
||||
patchNum++;
|
||||
|
||||
// no patch given yet - look for ROMBASENAME.bps
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 1);
|
||||
snprintf(tmp, strlen(filename) + 4, "%s.bps", filename);
|
||||
snprintf(tmp, strlen(filename) + 4 + 1, "%s.bps", filename);
|
||||
patchNames[patchNum] = tmp;
|
||||
patchNum++;
|
||||
|
||||
// no patch given yet - look for ROMBASENAME.ppf
|
||||
tmp = (char*)malloc(strlen(filename) + 4 + 1);
|
||||
snprintf(tmp, strlen(filename) + 4, "%s.ppf", filename);
|
||||
snprintf(tmp, strlen(filename) + 4 + 1, "%s.ppf", filename);
|
||||
patchNames[patchNum] = tmp;
|
||||
patchNum++;
|
||||
}
|
||||
|
@ -2294,7 +2294,7 @@ int main(int argc, char** argv)
|
|||
const char* p;
|
||||
int l;
|
||||
p = preparedCheatCodes[i];
|
||||
l = strlen(p);
|
||||
l = (int)strlen(p);
|
||||
if (l == 17 && p[8] == ':') {
|
||||
fprintf(stdout, "Adding cheat code %s\n", p);
|
||||
cheatsAddCheatCode(p, p);
|
||||
|
@ -2658,7 +2658,7 @@ void systemLoadRecent()
|
|||
|
||||
uint32_t systemGetClock()
|
||||
{
|
||||
return SDL_GetTicks();
|
||||
return (uint32_t)SDL_GetTicks();
|
||||
}
|
||||
|
||||
void systemGbPrint(uint8_t* data, int len, int pages, int feed, int palette, int contrast)
|
||||
|
|
|
@ -616,6 +616,7 @@ int yytype;
|
|||
YYSTYPE const* const yyvaluep;
|
||||
#endif
|
||||
{
|
||||
(void)yytype;
|
||||
if (!yyvaluep)
|
||||
return;
|
||||
#ifdef YYPRINT
|
||||
|
@ -624,10 +625,6 @@ YYSTYPE const* const yyvaluep;
|
|||
#else
|
||||
YYUSE(yyoutput);
|
||||
#endif
|
||||
switch (yytype) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*--------------------------------.
|
||||
|
@ -960,17 +957,12 @@ int yytype;
|
|||
YYSTYPE* yyvaluep;
|
||||
#endif
|
||||
{
|
||||
(void)yytype;
|
||||
YYUSE(yyvaluep);
|
||||
|
||||
if (!yymsg)
|
||||
yymsg = "Deleting";
|
||||
YY_SYMBOL_PRINT(yymsg, yytype, yyvaluep, yylocationp);
|
||||
|
||||
switch (yytype) {
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Prevent warnings from -Wmissing-prototypes. */
|
||||
|
@ -1045,12 +1037,12 @@ int yyparse()
|
|||
|
||||
/* The state stack. */
|
||||
yytype_int16 yyssa[YYINITDEPTH];
|
||||
yytype_int16* yyss = yyssa;
|
||||
yytype_int16* yyss = (yytype_int16 *)yyssa;
|
||||
yytype_int16* yyssp;
|
||||
|
||||
/* The semantic value stack. */
|
||||
YYSTYPE yyvsa[YYINITDEPTH];
|
||||
YYSTYPE* yyvs = yyvsa;
|
||||
YYSTYPE* yyvs = (YYSTYPE *)yyvsa;
|
||||
YYSTYPE* yyvsp;
|
||||
|
||||
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
|
||||
|
@ -1091,7 +1083,7 @@ yynewstate:
|
|||
yyssp++;
|
||||
|
||||
yysetstate:
|
||||
*yyssp = yystate;
|
||||
*yyssp = (yytype_int16)yystate;
|
||||
|
||||
if (yyss + yystacksize - 1 <= yyssp) {
|
||||
/* Get the current used size of the three stacks, in elements. */
|
||||
|
@ -1130,7 +1122,7 @@ yysetstate:
|
|||
yystacksize = YYMAXDEPTH;
|
||||
|
||||
{
|
||||
yytype_int16* yyss1 = yyss;
|
||||
yytype_int16* yyss1 = (yytype_int16 *)yyss;
|
||||
union yyalloc* yyptr = (union yyalloc*)YYSTACK_ALLOC(YYSTACK_BYTES(yystacksize));
|
||||
if (!yyptr)
|
||||
goto yyexhaustedlab;
|
||||
|
|
|
@ -305,13 +305,13 @@ void SDLAudio::write(uint16_t* finalWave, int length) {
|
|||
#ifdef ENABLE_SDL3
|
||||
res = (int)SDL_PutAudioStreamData(sound_stream, finalWave, length) == true;
|
||||
|
||||
while (res && SDL_GetAudioStreamQueued(sound_stream) > (2048 * audio.channels * sizeof(uint16_t))) {
|
||||
while (res && ((size_t)SDL_GetAudioStreamQueued(sound_stream) > (size_t)(2048 * audio.channels * sizeof(uint16_t)))) {
|
||||
SDL_Delay(1);
|
||||
}
|
||||
#else
|
||||
res = SDL_QueueAudio(sound_device, finalWave, length) == 0;
|
||||
|
||||
while (res && SDL_GetQueuedAudioSize(sound_device) > (audio.samples * audio.channels * sizeof(uint16_t))) {
|
||||
while (res && ((size_t)SDL_GetQueuedAudioSize(sound_device) > (size_t)(audio.samples * audio.channels * sizeof(uint16_t)))) {
|
||||
SDL_Delay(1);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -257,8 +257,12 @@ void XAudio2_Output::close() {
|
|||
|
||||
if (sVoice) {
|
||||
if (playing) {
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->Stop(0);
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->Stop(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
sVoice->DestroyVoice();
|
||||
|
@ -498,8 +502,13 @@ void XAudio2_Output::write(uint16_t* finalWave, int) {
|
|||
buf.pAudioData = &buffers[currentBuffer * soundBufferLen];
|
||||
currentBuffer++;
|
||||
currentBuffer %= (bufferCount + 1); // + 1 because we need one temporary buffer
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->SubmitSourceBuffer(&buf); // send buffer to queue
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->SubmitSourceBuffer(&buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void XAudio2_Output::pause() {
|
||||
|
@ -507,8 +516,13 @@ void XAudio2_Output::pause() {
|
|||
return;
|
||||
|
||||
if (playing) {
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->Stop(0);
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->Stop(0);
|
||||
#endif
|
||||
|
||||
playing = false;
|
||||
}
|
||||
}
|
||||
|
@ -518,8 +532,13 @@ void XAudio2_Output::resume() {
|
|||
return;
|
||||
|
||||
if (!playing) {
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->Start(0);
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->Start(0);
|
||||
#endif
|
||||
|
||||
playing = true;
|
||||
}
|
||||
}
|
||||
|
@ -529,8 +548,12 @@ void XAudio2_Output::reset() {
|
|||
return;
|
||||
|
||||
if (playing) {
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->Stop(0);
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->Stop(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
sVoice->FlushSourceBuffers();
|
||||
|
@ -545,8 +568,12 @@ void XAudio2_Output::setThrottle(unsigned short throttle_) {
|
|||
if (throttle_ == 0)
|
||||
throttle_ = 100;
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT hr = sVoice->SetFrequencyRatio((float)throttle_ / 100.0f);
|
||||
assert(hr == S_OK);
|
||||
#else
|
||||
sVoice->SetFrequencyRatio((float)throttle_ / 100.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
void xaudio2_device_changed(XAudio2_Output* instance) {
|
||||
|
|
|
@ -16,7 +16,10 @@
|
|||
|
||||
#include <unordered_map>
|
||||
|
||||
#undef NO_ERROR
|
||||
#define NO_ERROR (wxThread::ExitCode)0
|
||||
|
||||
#undef ANY_ERROR
|
||||
#define ANY_ERROR (wxThread::ExitCode)1
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
|
|
|
@ -1105,23 +1105,23 @@ public:
|
|||
addr++;
|
||||
}
|
||||
} else {
|
||||
wxString s;
|
||||
wxString _s;
|
||||
|
||||
switch (size) {
|
||||
case BITS_8:
|
||||
s.Printf(wxT(":%02X"), val);
|
||||
_s.Printf(wxT(":%02X"), val);
|
||||
break;
|
||||
|
||||
case BITS_16:
|
||||
s.Printf(wxT(":%04X"), val);
|
||||
_s.Printf(wxT(":%04X"), val);
|
||||
break;
|
||||
|
||||
case BITS_32:
|
||||
s.Printf(wxT(":%08X"), val);
|
||||
_s.Printf(wxT(":%08X"), val);
|
||||
break;
|
||||
}
|
||||
|
||||
addr_s.append(s);
|
||||
addr_s.append(_s);
|
||||
cheatsAddCheatCode(addr_s.utf8_str(), ca_desc.utf8_str());
|
||||
}
|
||||
}
|
||||
|
@ -1145,12 +1145,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t GetValue(wxString& s, int fmt)
|
||||
uint32_t GetValue(wxString& s, int _fmt)
|
||||
{
|
||||
long val;
|
||||
// FIXME: probably ought to throw an error if ToLong
|
||||
// returns false or val is out of range
|
||||
s.ToLong(&val, fmt == CFVFMT_UH ? 16 : 10);
|
||||
s.ToLong(&val, _fmt == CFVFMT_UH ? 16 : 10);
|
||||
|
||||
if (size != BITS_32)
|
||||
val &= size == BITS_8 ? 0xff : 0xffff;
|
||||
|
@ -1158,9 +1158,9 @@ public:
|
|||
return val;
|
||||
}
|
||||
|
||||
uint32_t GetValue(int fmt)
|
||||
uint32_t GetValue(int _fmt)
|
||||
{
|
||||
return GetValue(val_s, fmt);
|
||||
return GetValue(val_s, _fmt);
|
||||
}
|
||||
|
||||
uint32_t GetValue()
|
||||
|
@ -1168,9 +1168,9 @@ public:
|
|||
return GetValue(fmt);
|
||||
}
|
||||
|
||||
int32_t SignedValue(wxString& s, int fmt)
|
||||
int32_t SignedValue(wxString& s, int _fmt)
|
||||
{
|
||||
int32_t val = GetValue(s, fmt);
|
||||
int32_t val = GetValue(s, _fmt);
|
||||
|
||||
if (fmt == CFVFMT_SD) {
|
||||
if (size == BITS_8)
|
||||
|
@ -1182,9 +1182,9 @@ public:
|
|||
return val;
|
||||
}
|
||||
|
||||
int32_t SignedValue(int fmt)
|
||||
int32_t SignedValue(int _fmt)
|
||||
{
|
||||
return SignedValue(val_s, fmt);
|
||||
return SignedValue(val_s, _fmt);
|
||||
}
|
||||
|
||||
int32_t SignedValue()
|
||||
|
|
|
@ -2420,7 +2420,6 @@ void SDLDrawingPanel::DrawingPanelInit()
|
|||
renderer = SDL_CreateRenderer(sdlwindow, NULL);
|
||||
log("SDL renderer: default");
|
||||
} else {
|
||||
wxString renderer_name = OPTION(kSDLRenderer);
|
||||
renderer = SDL_CreateRenderer(sdlwindow, renderer_name.mb_str());
|
||||
log("SDL renderer: %s", (const char *)renderer_name.mb_str());
|
||||
|
||||
|
|
|
@ -459,14 +459,14 @@ public:
|
|||
void Update(int sel)
|
||||
{
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&g_ioMem[ioregs[sel].offset];
|
||||
uint16_t mask, reg = *addr;
|
||||
uint16_t mask, _reg = *addr;
|
||||
int i;
|
||||
|
||||
for (mask = 1, i = 0; mask; mask <<= 1, i++)
|
||||
bit[i]->SetValue(mask & reg);
|
||||
bit[i]->SetValue(mask & _reg);
|
||||
|
||||
wxString s;
|
||||
s.Printf(wxT("%04X"), reg);
|
||||
s.Printf(wxT("%04X"), _reg);
|
||||
val->SetLabel(s);
|
||||
}
|
||||
|
||||
|
@ -476,15 +476,15 @@ public:
|
|||
if (ev.GetEventObject() == bit[i]) {
|
||||
// it'd be faster to store the value and just flip
|
||||
// the bit, but it's easier this way
|
||||
uint16_t mask, reg = 0;
|
||||
uint16_t mask, _reg = 0;
|
||||
int j;
|
||||
|
||||
for (mask = 1, j = 0; mask; mask <<= 1, j++)
|
||||
if (bit[j]->GetValue())
|
||||
reg |= mask;
|
||||
_reg |= mask;
|
||||
|
||||
wxString s;
|
||||
s.Printf(wxT("%04X"), reg);
|
||||
s.Printf(wxT("%04X"), _reg);
|
||||
val->SetLabel(s);
|
||||
return;
|
||||
}
|
||||
|
@ -503,16 +503,16 @@ public:
|
|||
(void)ev; // unused params
|
||||
int sel = addr_->GetSelection();
|
||||
uint16_t* addr = ioregs[sel].address ? ioregs[sel].address : (uint16_t*)&g_ioMem[ioregs[sel].offset];
|
||||
uint16_t mask, reg = *addr;
|
||||
reg &= ~ioregs[sel].write;
|
||||
uint16_t mask, _reg = *addr;
|
||||
_reg &= ~ioregs[sel].write;
|
||||
int i;
|
||||
|
||||
for (mask = 1, i = 0; mask; mask <<= 1, i++) {
|
||||
if ((mask & ioregs[sel].write) && bit[i]->GetValue())
|
||||
reg |= mask;
|
||||
_reg |= mask;
|
||||
}
|
||||
|
||||
CPUWriteHalfWord(0x4000000 + ioregs[sel].offset, reg);
|
||||
CPUWriteHalfWord(0x4000000 + ioregs[sel].offset, _reg);
|
||||
Update(sel);
|
||||
}
|
||||
|
||||
|
@ -674,8 +674,8 @@ public:
|
|||
Goto(0);
|
||||
// initialize load/save support dialog already
|
||||
{
|
||||
const wxString dname = wxT("MemSelRegion");
|
||||
selregion = wxXmlResource::Get()->LoadDialog(this, dname);
|
||||
const wxString _dname = wxT("MemSelRegion");
|
||||
selregion = wxXmlResource::Get()->LoadDialog(this, _dname);
|
||||
|
||||
if (!selregion)
|
||||
baddialog();
|
||||
|
|
|
@ -4,8 +4,8 @@ namespace widgets {
|
|||
|
||||
TestApp::TestApp() : previous_app_(wxApp::GetInstance()) {
|
||||
// Initialize the wxWidgets app.
|
||||
int argc = 0;
|
||||
wxApp::Initialize(argc, nullptr);
|
||||
int _argc = 0;
|
||||
wxApp::Initialize(_argc, nullptr);
|
||||
|
||||
// Set the wxApp instance to this object.
|
||||
wxApp::SetInstance(this);
|
||||
|
|
Loading…
Reference in New Issue