mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-03-24 11:30:10 +00:00
Clean up a number of Xcode build warnings
This commit is contained in:
parent
570147712c
commit
53459c9e78
Apple2Mac
src
@ -12,7 +12,6 @@
|
||||
// Based on sample code from https://developer.apple.com/library/mac/samplecode/GLEssentials/Introduction/Intro.html
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <QuartzCore/CVDisplayLink.h>
|
||||
|
||||
#import "modelUtil.h"
|
||||
#import "imageUtil.h"
|
||||
|
@ -357,6 +357,7 @@ static CVReturn displayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)application
|
||||
{
|
||||
cpu_pause();
|
||||
disk6_eject(0);
|
||||
disk6_eject(1);
|
||||
return NSTerminateNow;
|
||||
|
@ -13,4 +13,6 @@
|
||||
|
||||
@interface EmulatorJoystickController : NSObject
|
||||
|
||||
+ (EmulatorJoystickController *)sharedInstance;
|
||||
|
||||
@end
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#import "DDHidQueue.h"
|
||||
#import "DDHidElement.h"
|
||||
#import "DDHIdEvent.h"
|
||||
#import "DDHidEvent.h"
|
||||
#import "NSXReturnThrowError.h"
|
||||
|
||||
static void queueCallbackFunction(void* target, IOReturn result, void* refcon,
|
||||
|
@ -237,7 +237,14 @@ static void sound_init( CAY8910 *_this, const char *device, unsigned long nSampl
|
||||
|
||||
// sound_generator_freq =
|
||||
// settings_current.sound_hifi ? HIFI_FREQ : settings_current.sound_freq;
|
||||
#ifdef APPLE2IX
|
||||
sound_generator_freq = (int)nSampleRate;
|
||||
if (UNLIKELY(nSampleRate > INT_MAX)) {
|
||||
assert(0);
|
||||
}
|
||||
#else
|
||||
sound_generator_freq = nSampleRate;
|
||||
#endif
|
||||
sound_generator_framesiz = sound_generator_freq / (int)hz;
|
||||
|
||||
#if 0
|
||||
@ -365,6 +372,7 @@ sound_unpause( void )
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(APPLE2IX)
|
||||
static void sound_end( CAY8910 *_this )
|
||||
{
|
||||
#if 0
|
||||
@ -399,6 +407,7 @@ static void sound_end( CAY8910 *_this )
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
|
@ -849,7 +849,8 @@ static void SSI263_Write(uint8_t nDevice, uint8_t nReg, uint8_t nValue)
|
||||
|
||||
//-------------------------------------
|
||||
|
||||
static uint8_t Votrax2SSI263[64] =
|
||||
#if 0 // ENABLE_SSI263
|
||||
static uint8_t Votrax2SSI263[64] =
|
||||
{
|
||||
0x02, // 00: EH3 jackEt -> E1 bEnt
|
||||
0x0A, // 01: EH2 Enlist -> EH nEst
|
||||
@ -919,6 +920,7 @@ static uint8_t Votrax2SSI263[64] =
|
||||
0x00, // 3E: PA1 no sound -> PA
|
||||
0x00, // 3F: STOP no sound -> PA
|
||||
};
|
||||
#endif
|
||||
|
||||
#if 0 // ENABLE_SSI263
|
||||
static void Votrax_Write(uint8_t nDevice, uint8_t nValue)
|
||||
@ -1036,7 +1038,7 @@ static void MB_Update()
|
||||
unsigned long dwDSLockedBufferSize0 = 0;
|
||||
int16_t *pDSLockedBuffer0 = NULL;
|
||||
unsigned long dwCurrentPlayCursor;
|
||||
int hr = MockingboardVoice->GetCurrentPosition(MockingboardVoice, &dwCurrentPlayCursor);
|
||||
int hr = (int)MockingboardVoice->GetCurrentPosition(MockingboardVoice, &dwCurrentPlayCursor);
|
||||
#else
|
||||
DWORD dwDSLockedBufferSize0, dwDSLockedBufferSize1;
|
||||
SHORT *pDSLockedBuffer0, *pDSLockedBuffer1;
|
||||
@ -1503,13 +1505,15 @@ static bool MB_DSInit()
|
||||
// Create single Mockingboard voice
|
||||
//
|
||||
|
||||
#if 0 // !APPLE2IX
|
||||
unsigned long dwDSLockedBufferSize = 0; // Size of the locked DirectSound buffer
|
||||
int16_t* pDSLockedBuffer;
|
||||
#endif
|
||||
|
||||
if(!audio_isAvailable)
|
||||
return false;
|
||||
|
||||
int hr = audio_createSoundBuffer(&MockingboardVoice);
|
||||
int hr = (int)audio_createSoundBuffer(&MockingboardVoice);
|
||||
LOG("MB_DSInit: DSGetSoundBuffer(), hr=0x%08X\n", (unsigned int)hr);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
@ -2192,7 +2196,12 @@ static BYTE __stdcall MB_Write(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, UL
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#if 1 // APPLE2IX
|
||||
GLUE_C_READ(PhasorIO)
|
||||
uint8_t c_PhasorIOR (uint16_t);
|
||||
GLUE_C_WRITE(PhasorIOW)
|
||||
{
|
||||
c_PhasorIOR(ea);
|
||||
}
|
||||
GLUE_C_READ(PhasorIOR)
|
||||
#else
|
||||
static BYTE __stdcall PhasorIO(WORD PC, WORD nAddr, BYTE bWrite, BYTE nValue, ULONG nCyclesLeft)
|
||||
#endif
|
||||
@ -2231,8 +2240,9 @@ void mb_io_initialize(unsigned int slot4, unsigned int slot5)
|
||||
}
|
||||
|
||||
//typedef uint8_t (*iofunction)(uint16_t nPC, uint16_t nAddr, uint8_t nWriteFlag, uint8_t nWriteValue, unsigned long nCyclesLeft);
|
||||
typedef void (*iofunction)(void);
|
||||
static void RegisterIoHandler(unsigned int uSlot, iofunction IOReadC0, iofunction IOWriteC0, iofunction IOReadCx, iofunction IOWriteCx, void *unused_lpSlotParameter, uint8_t* unused_pExpansionRom)
|
||||
typedef void (*iowfunction)(uint16_t, uint8_t);
|
||||
typedef uint8_t (*iorfunction)(uint16_t);
|
||||
static void RegisterIoHandler(unsigned int uSlot, iorfunction IOReadC0, iowfunction IOWriteC0, iorfunction IOReadCx, iowfunction IOWriteCx, void *unused_lpSlotParameter, uint8_t* unused_pExpansionRom)
|
||||
{
|
||||
|
||||
// card softswitches
|
||||
@ -2272,7 +2282,7 @@ void MB_InitializeIO(char *unused_pCxRomPeripheral, unsigned int uSlot4, unsigne
|
||||
if (g_Slot4 == CT_MockingboardC)
|
||||
RegisterIoHandler(uSlot4, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
|
||||
else // Phasor
|
||||
RegisterIoHandler(uSlot4, PhasorIO, PhasorIO, MB_Read, MB_Write, NULL, NULL);
|
||||
RegisterIoHandler(uSlot4, PhasorIOR, PhasorIOW, MB_Read, MB_Write, NULL, NULL);
|
||||
|
||||
if (g_Slot5 == CT_MockingboardC)
|
||||
RegisterIoHandler(uSlot5, IO_Null, IO_Null, MB_Read, MB_Write, NULL, NULL);
|
||||
|
@ -220,7 +220,7 @@ void playq_destroyPlayQueue(INOUT PlayQueue_s **queue) {
|
||||
FREE(*queue);
|
||||
}
|
||||
|
||||
PlayQueue_s *playq_createPlayQueue(const long *nodeIdPtr, unsigned long numBuffers) {
|
||||
PlayQueue_s *playq_createPlayQueue(const unsigned int *nodeIdPtr, unsigned long numBuffers) {
|
||||
PlayQueue_s *playq = NULL;
|
||||
|
||||
assert(numBuffers <= MAX_PLAYQ_BUFFERS);
|
||||
@ -242,7 +242,7 @@ PlayQueue_s *playq_createPlayQueue(const long *nodeIdPtr, unsigned long numBuffe
|
||||
bool allocSuccess = true;
|
||||
for (unsigned long i=0; i<numBuffers; i++) {
|
||||
PQListNode_s *listNode = CALLOC(1, sizeof(PQListNode_s));
|
||||
LOG("CREATING PlayNode_s node ID: %ld", nodeIdPtr[i]);
|
||||
LOG("CREATING PlayNode_s node ID: %u", nodeIdPtr[i]);
|
||||
listNode->node.nodeId = nodeIdPtr[i];
|
||||
if (!listNode) {
|
||||
LOG("no memory");
|
||||
|
@ -23,8 +23,8 @@
|
||||
#define INVALID_NODE_ID INT_MIN
|
||||
|
||||
typedef struct PlayNode_s {
|
||||
long nodeId;
|
||||
unsigned long numBytes;
|
||||
unsigned int nodeId;
|
||||
int numBytes;
|
||||
uint8_t *bytes;
|
||||
} PlayNode_s;
|
||||
|
||||
@ -54,7 +54,7 @@ typedef struct PlayQueue_s {
|
||||
} PlayQueue_s;
|
||||
|
||||
// create a play queue object
|
||||
PlayQueue_s *playq_createPlayQueue(const long *nodeIdPtr, unsigned long numBuffers);
|
||||
PlayQueue_s *playq_createPlayQueue(const unsigned int *nodeIdPtr, unsigned long numBuffers);
|
||||
|
||||
// destroy a play queue object
|
||||
void playq_destroyPlayQueue(INOUT PlayQueue_s **queue);
|
||||
|
@ -400,17 +400,17 @@ static ALVoice *_openal_createVoice(unsigned long numChannels) {
|
||||
}
|
||||
#endif
|
||||
|
||||
long longBuffers[OPENAL_NUM_BUFFERS];
|
||||
unsigned int bufs[OPENAL_NUM_BUFFERS];
|
||||
for (unsigned int i=0; i<OPENAL_NUM_BUFFERS; i++) {
|
||||
longBuffers[i] = (long)(voice->buffers[i]);
|
||||
bufs[i] = voice->buffers[i];
|
||||
}
|
||||
voice->playq = playq_createPlayQueue(longBuffers, OPENAL_NUM_BUFFERS);
|
||||
voice->playq = playq_createPlayQueue(bufs, OPENAL_NUM_BUFFERS);
|
||||
if (!voice->playq) {
|
||||
LOG("OOPS, Not enough memory for PlayQueue");
|
||||
break;
|
||||
}
|
||||
|
||||
voice->rate = openal_audio_backend.systemSettings.sampleRateHz;
|
||||
voice->rate = (ALuint)openal_audio_backend.systemSettings.sampleRateHz;
|
||||
|
||||
// Emulator supports only mono and stereo
|
||||
if (numChannels == 2) {
|
||||
@ -422,7 +422,7 @@ static ALVoice *_openal_createVoice(unsigned long numChannels) {
|
||||
/* Allocate enough space for the temp buffer, given the format */
|
||||
assert(numChannels == 1 || numChannels == 2);
|
||||
unsigned long maxSamples = openal_audio_backend.systemSettings.monoBufferSizeSamples * numChannels;
|
||||
voice->buffersize = maxSamples * openal_audio_backend.systemSettings.bytesPerSample;
|
||||
voice->buffersize = (ALsizei)maxSamples * (ALsizei)openal_audio_backend.systemSettings.bytesPerSample;
|
||||
|
||||
voice->data = CALLOC(1, voice->buffersize);
|
||||
if (voice->data == NULL) {
|
||||
|
@ -40,7 +40,7 @@ static bool speaker_isAvailable = false;
|
||||
|
||||
static int16_t *samples_buffer = NULL; // holds max 1 second of samples
|
||||
static int16_t *remainder_buffer = NULL; // holds enough to create one sample (averaged)
|
||||
static unsigned int samples_buffer_idx = 0;
|
||||
static unsigned long samples_buffer_idx = 0;
|
||||
static unsigned int remainder_buffer_size = 0;
|
||||
static unsigned long remainder_buffer_size_max = 0;
|
||||
static unsigned int remainder_buffer_idx = 0;
|
||||
@ -257,7 +257,7 @@ static void _submit_samples_buffer_fullspeed(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int num_samples_pad = (bufferSizeIdealMax - bytes_queued) / sizeof(int16_t);
|
||||
unsigned long num_samples_pad = (bufferSizeIdealMax - bytes_queued) / sizeof(int16_t);
|
||||
if (num_samples_pad == 0) {
|
||||
return;
|
||||
}
|
||||
@ -282,7 +282,7 @@ static void _submit_samples_buffer_fullspeed(void) {
|
||||
// Submits samples from the samples_buffer to the audio system backend when running at a normal scaled-speed. This also
|
||||
// generates cycles feedback to the main CPU timing routine depending on the needs of the streaming audio (more or less
|
||||
// data).
|
||||
static unsigned int _submit_samples_buffer(const unsigned long num_channel_samples) {
|
||||
static unsigned long _submit_samples_buffer(const unsigned long num_channel_samples) {
|
||||
|
||||
assert(num_channel_samples);
|
||||
|
||||
@ -319,7 +319,7 @@ static unsigned int _submit_samples_buffer(const unsigned long num_channel_sampl
|
||||
// copy samples to audio system backend
|
||||
//
|
||||
|
||||
const unsigned int bytes_free = bufferTotalSize - bytes_queued;
|
||||
const unsigned long bytes_free = bufferTotalSize - bytes_queued;
|
||||
unsigned long requested_samples = num_channel_samples;
|
||||
unsigned long requested_buffer_size = num_channel_samples * sizeof(int16_t);
|
||||
|
||||
@ -481,7 +481,7 @@ void speaker_flush(void) {
|
||||
}
|
||||
_speaker_update(/*toggled:false*/);
|
||||
|
||||
unsigned int samples_used = 0;
|
||||
unsigned long samples_used = 0;
|
||||
if (is_fullspeed) {
|
||||
assert(!samples_buffer_idx && "should be all quiet samples");
|
||||
_submit_samples_buffer_fullspeed();
|
||||
|
40
src/disk.c
40
src/disk.c
@ -424,10 +424,10 @@ static void denibblize_track(const uint8_t * const src, int drive, uint8_t * con
|
||||
}
|
||||
}
|
||||
|
||||
static size_t load_track_data(int drive) {
|
||||
static unsigned int load_track_data(int drive) {
|
||||
SCOPE_TRACE_DISK("load_track_data");
|
||||
|
||||
size_t expected = 0;
|
||||
unsigned int expected = 0;
|
||||
|
||||
if (disk6.disk[drive].nibblized) {
|
||||
expected = NIB_TRACK_SIZE;
|
||||
@ -436,7 +436,11 @@ static size_t load_track_data(int drive) {
|
||||
unsigned int trk = (disk6.disk[drive].phase >> 1);
|
||||
uintptr_t dskoff = DSK_TRACK_SIZE * trk;
|
||||
uintptr_t niboff = NIB_TRACK_SIZE * trk;
|
||||
expected = nibblize_track(disk6.disk[drive].raw_image_data+dskoff, drive, disk6.disk[drive].nib_image_data+niboff);
|
||||
unsigned long ex0 = nibblize_track(disk6.disk[drive].raw_image_data+dskoff, drive, disk6.disk[drive].nib_image_data+niboff);
|
||||
expected = (unsigned int)ex0;
|
||||
if (UNLIKELY(ex0 > UINT_MAX)) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
return expected;
|
||||
@ -780,11 +784,7 @@ void disk6_init(void) {
|
||||
const char *disk6_eject(int drive) {
|
||||
|
||||
#if !TESTING
|
||||
# if TARGET_OS_MAC || TARGET_OS_PHONE
|
||||
# warning FIXME TODO ...
|
||||
# else
|
||||
assert(cpu_isPaused() && "CPU must be paused for disk ejection");
|
||||
# endif
|
||||
#endif
|
||||
assert(drive == 0 || drive == 1);
|
||||
|
||||
@ -885,7 +885,7 @@ const char *disk6_insert(int fd, int drive, const char * const file_name, int re
|
||||
|
||||
disk6.disk[drive].file_name = STRDUP(file_name);
|
||||
|
||||
int expected = NIB_SIZE;
|
||||
unsigned int expected = NIB_SIZE;
|
||||
disk6.disk[drive].nibblized = true;
|
||||
if (!is_nib(disk6.disk[drive].file_name)) {
|
||||
expected = DSK_SIZE;
|
||||
@ -925,7 +925,7 @@ const char *disk6_insert(int fd, int drive, const char * const file_name, int re
|
||||
break;
|
||||
}
|
||||
|
||||
TEMP_FAILURE_RETRY(disk6.disk[drive].raw_image_data = mmap(NULL, disk6.disk[drive].whole_len, (readonly ? PROT_READ : PROT_READ|PROT_WRITE), MAP_SHARED|MAP_FILE, disk6.disk[drive].fd, /*offset:*/0));
|
||||
TEMP_FAILURE_RETRY( (long)(disk6.disk[drive].raw_image_data = mmap(NULL, disk6.disk[drive].whole_len, (readonly ? PROT_READ : PROT_READ|PROT_WRITE), MAP_SHARED|MAP_FILE, disk6.disk[drive].fd, /*offset:*/0)) );
|
||||
if (disk6.disk[drive].raw_image_data == MAP_FAILED) {
|
||||
LOG("OOPS, could not mmap file %s", disk6.disk[drive].file_name);
|
||||
err = ERR_MMAP_FAILED;
|
||||
@ -948,7 +948,7 @@ const char *disk6_insert(int fd, int drive, const char * const file_name, int re
|
||||
for (unsigned int trk=0; trk<NUM_TRACKS; trk++) {
|
||||
|
||||
disk6.disk[drive].phase = (trk<<1); // HACK : load_track_data()/nibblize_track() expects this set properly
|
||||
size_t track_width = load_track_data(drive);
|
||||
unsigned int track_width = load_track_data(drive);
|
||||
if (disk6.disk[drive].nibblized) {
|
||||
assert(track_width == NIB_TRACK_SIZE);
|
||||
} else {
|
||||
@ -1021,30 +1021,26 @@ bool disk6_saveState(StateHelper_s *helper) {
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE motor_off = %02x", state);
|
||||
|
||||
state = (uint8_t)disk6.drive;
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE drive = %02x", state);
|
||||
|
||||
state = (uint8_t)disk6.ddrw;
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE ddrw = %02x", state);
|
||||
|
||||
state = (uint8_t)disk6.disk_byte;
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE disk_byte = %02x", state);
|
||||
|
||||
// Drive A/B
|
||||
|
||||
bool saved_drives = false;
|
||||
for (unsigned long i=0; i<3; i++) {
|
||||
for (unsigned int i=0; i<3; i++) {
|
||||
if (i >= 2) {
|
||||
saved_drives = true;
|
||||
break;
|
||||
@ -1056,12 +1052,15 @@ bool disk6_saveState(StateHelper_s *helper) {
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE is_protected[%lu] = %02x", i, state);
|
||||
|
||||
uint8_t serialized[4] = { 0 };
|
||||
|
||||
if (disk6.disk[i].file_name != NULL) {
|
||||
uint32_t namelen = strlen(disk6.disk[i].file_name);
|
||||
size_t name0 = strlen(disk6.disk[i].file_name);
|
||||
uint32_t namelen = (uint32_t)name0;
|
||||
if (name0 > UINT_MAX) {
|
||||
assert(false);
|
||||
}
|
||||
serialized[0] = (uint8_t)((namelen & 0xFF000000) >> 24);
|
||||
serialized[1] = (uint8_t)((namelen & 0xFF0000 ) >> 16);
|
||||
serialized[2] = (uint8_t)((namelen & 0xFF00 ) >> 8);
|
||||
@ -1074,20 +1073,17 @@ bool disk6_saveState(StateHelper_s *helper) {
|
||||
break;
|
||||
}
|
||||
|
||||
LOG("SAVE disk[%lu] : (%u) %s", i, namelen, disk6.disk[i].file_name);
|
||||
} else {
|
||||
memset(serialized, 0x0, sizeof(serialized));
|
||||
if (!helper->save(fd, serialized, 4)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE disk[%lu] (0) <NULL>", i);
|
||||
}
|
||||
|
||||
state = (uint8_t)stepper_phases;
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE stepper_phases[%lu] = %02x", i, stepper_phases);
|
||||
|
||||
state = 0; // placeholder ...
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
@ -1098,14 +1094,12 @@ bool disk6_saveState(StateHelper_s *helper) {
|
||||
if (!helper->save(fd, &state, 1)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE phase[%lu] = %02x", i, state);
|
||||
|
||||
serialized[0] = (uint8_t)((disk6.disk[i].run_byte & 0xFF00) >> 8);
|
||||
serialized[1] = (uint8_t)((disk6.disk[i].run_byte & 0xFF ) >> 0);
|
||||
if (!helper->save(fd, serialized, 2)) {
|
||||
break;
|
||||
}
|
||||
LOG("SAVE run_byte[%lu] = %04x", i, disk6.disk[i].run_byte);
|
||||
}
|
||||
|
||||
if (!saved_drives) {
|
||||
@ -1166,7 +1160,7 @@ static bool _disk6_loadState(StateHelper_s *helper, JSON_ref json) {
|
||||
|
||||
bool loaded_drives = false;
|
||||
|
||||
for (unsigned long i=0; i<3; i++) {
|
||||
for (unsigned int i=0; i<3; i++) {
|
||||
if (i >= 2) {
|
||||
loaded_drives = true;
|
||||
break;
|
||||
|
@ -52,14 +52,14 @@ typedef struct diskette_t {
|
||||
int fd;
|
||||
int fd2;
|
||||
uint8_t *raw_image_data;
|
||||
size_t whole_len;
|
||||
unsigned int whole_len;
|
||||
uint8_t *nib_image_data;
|
||||
bool nibblized;
|
||||
bool is_protected;
|
||||
bool track_valid;
|
||||
bool track_dirty;
|
||||
int *skew_table;
|
||||
long track_width;
|
||||
unsigned int track_width;
|
||||
int phase;
|
||||
int run_byte;
|
||||
} diskette_t;
|
||||
|
@ -16,6 +16,15 @@
|
||||
#include "common.h"
|
||||
#include "video/video.h"
|
||||
|
||||
#if __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-variable"
|
||||
#elif __GNUC__
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic ignored "-Wunused-const-variable"
|
||||
#endif
|
||||
|
||||
#define SCANSTEP (SCANWIDTH-12)
|
||||
#define SCANDSTEP (SCANWIDTH-6)
|
||||
|
||||
@ -1394,6 +1403,7 @@ unsigned long video_clearDirty(unsigned long flags) {
|
||||
|
||||
extern unsigned int CpuGetCyclesThisVideoFrame(void);
|
||||
uint16_t video_scanner_get_address(bool *vblBarOut) {
|
||||
|
||||
const bool SW_HIRES = (softswitches & SS_HIRES);
|
||||
const bool SW_TEXT = (softswitches & SS_TEXT);
|
||||
const bool SW_PAGE2 = (softswitches & SS_PAGE2);
|
||||
@ -1533,3 +1543,9 @@ static __attribute__((constructor)) void __init_interface(void) {
|
||||
emulator_registerStartupCallback(CTOR_PRIORITY_LATE, &_init_interface);
|
||||
}
|
||||
|
||||
#if __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#elif __GNUC__
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@ -20,12 +20,6 @@
|
||||
int64_t (*interface_onTouchEvent)(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) = NULL;
|
||||
#endif
|
||||
|
||||
static uint8_t *stagingFB = NULL;
|
||||
|
||||
static bool isShowing = false;
|
||||
|
||||
static char disk_path[PATH_MAX] = { 0 };
|
||||
|
||||
// 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected
|
||||
// to render HUD messages on desktop and mobile. Nothing special or pretty here, but has "just worked" for 20+ years ;-)
|
||||
|
||||
@ -134,6 +128,12 @@ void interface_plotMessage(uint8_t *fb, const interface_colorscheme_t cs, char *
|
||||
|
||||
#if INTERFACE_CLASSIC
|
||||
|
||||
static uint8_t *stagingFB = NULL;
|
||||
|
||||
static bool isShowing = false;
|
||||
|
||||
static char disk_path[PATH_MAX] = { 0 };
|
||||
|
||||
void interface_setStagingFramebuffer(uint8_t *fb) {
|
||||
stagingFB = fb;
|
||||
}
|
||||
@ -533,8 +533,8 @@ void c_interface_select_diskette( int drive )
|
||||
"| |",
|
||||
"||||||||||||||||||||||||||||||||||||||||" };
|
||||
|
||||
submenu[ 2 ][ 14 ] = MOUSETEXT_UP;
|
||||
submenu[ 2 ][ 20 ] = MOUSETEXT_DOWN;
|
||||
submenu[ 2 ][ 14 ] = (char)MOUSETEXT_UP;
|
||||
submenu[ 2 ][ 20 ] = (char)MOUSETEXT_DOWN;
|
||||
c_interface_print_submenu_centered(submenu[0], DISKHELP_SUBMENU_W, DISKHELP_SUBMENU_H);
|
||||
while ((ch = c_mygetch(1)) == -1)
|
||||
{
|
||||
@ -758,8 +758,8 @@ void c_interface_parameters()
|
||||
/* reset the x position, so we don't lose our cursor if path changes */
|
||||
cur_x = 0;
|
||||
|
||||
screen[ 2 ][ 33 ] = MOUSETEXT_OPENAPPLE;
|
||||
screen[ 2 ][ 46 ] = MOUSETEXT_CLOSEDAPPLE;
|
||||
screen[ 2 ][ 33 ] = (char)MOUSETEXT_OPENAPPLE;
|
||||
screen[ 2 ][ 46 ] = (char)MOUSETEXT_CLOSEDAPPLE;
|
||||
|
||||
c_interface_translate_screen( screen );
|
||||
c_interface_print_screen( screen );
|
||||
@ -1124,10 +1124,10 @@ void c_interface_parameters()
|
||||
"| Ctrl-LeftAlt-End Reboots //e |",
|
||||
"| Pause/Brk : Pause Emulator |",
|
||||
"||||||||||||||||||||||||||||||||||||||||" };
|
||||
submenu[ 1 ][ 14 ] = MOUSETEXT_UP;
|
||||
submenu[ 1 ][ 20 ] = MOUSETEXT_DOWN;
|
||||
submenu[ 3 ][ 14 ] = MOUSETEXT_LEFT;
|
||||
submenu[ 3 ][ 20 ] = MOUSETEXT_RIGHT;
|
||||
submenu[ 1 ][ 14 ] = (char)MOUSETEXT_UP;
|
||||
submenu[ 1 ][ 20 ] = (char)MOUSETEXT_DOWN;
|
||||
submenu[ 3 ][ 14 ] = (char)MOUSETEXT_LEFT;
|
||||
submenu[ 3 ][ 20 ] = (char)MOUSETEXT_RIGHT;
|
||||
|
||||
c_interface_print_submenu_centered(submenu[0], MAINHELP_SUBMENU_W, MAINHELP_SUBMENU_H);
|
||||
while ((ch = c_mygetch(1)) == -1)
|
||||
@ -1305,11 +1305,11 @@ void c_interface_credits()
|
||||
#define SCROLL_AREA_Y 5
|
||||
#define SCROLL_AREA_HEIGHT 16
|
||||
|
||||
screen[ 2 ][ 33 ] = MOUSETEXT_OPENAPPLE;
|
||||
screen[ 2 ][ 46 ] = MOUSETEXT_CLOSEDAPPLE;
|
||||
screen[ 2 ][ 33 ] = (char)MOUSETEXT_OPENAPPLE;
|
||||
screen[ 2 ][ 46 ] = (char)MOUSETEXT_CLOSEDAPPLE;
|
||||
|
||||
screen[ 22 ][ 18 ] = MOUSETEXT_UP;
|
||||
screen[ 22 ][ 20 ] = MOUSETEXT_DOWN;
|
||||
screen[ 22 ][ 18 ] = (char)MOUSETEXT_UP;
|
||||
screen[ 22 ][ 20 ] = (char)MOUSETEXT_DOWN;
|
||||
|
||||
#define SCROLL_LENGTH 58
|
||||
#define SCROLL_WIDTH (INTERFACE_SCREEN_X+1-(SCROLL_AREA_X*2))
|
||||
@ -1392,8 +1392,8 @@ void c_interface_credits()
|
||||
if (!count)
|
||||
{
|
||||
mt_idx = (mt_idx+1) % 2;
|
||||
credits[ 3 ][ 20 ] = MOUSETEXT_BEGIN + mt_idx;
|
||||
credits[ 3 ][ 55 ] = MOUSETEXT_BEGIN + ((mt_idx+1) % 2);
|
||||
credits[ 3 ][ 20 ] = (char)(MOUSETEXT_BEGIN + mt_idx);
|
||||
credits[ 3 ][ 55 ] = (char)(MOUSETEXT_BEGIN + ((mt_idx+1) % 2));
|
||||
}
|
||||
|
||||
for (int i=0, p=pos; i<SCROLL_AREA_HEIGHT; i++)
|
||||
@ -1463,15 +1463,15 @@ void c_interface_keyboard_layout()
|
||||
"| (Press any key to exit) |",
|
||||
"||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||" };
|
||||
|
||||
screen[ 6 ][ 68 ] = MOUSETEXT_UP;
|
||||
screen[ 7 ][ 67 ] = MOUSETEXT_LEFT;
|
||||
screen[ 7 ][ 69 ] = MOUSETEXT_RIGHT;
|
||||
screen[ 8 ][ 68 ] = MOUSETEXT_DOWN;
|
||||
screen[ 6 ][ 68 ] = (char)MOUSETEXT_UP;
|
||||
screen[ 7 ][ 67 ] = (char)MOUSETEXT_LEFT;
|
||||
screen[ 7 ][ 69 ] = (char)MOUSETEXT_RIGHT;
|
||||
screen[ 8 ][ 68 ] = (char)MOUSETEXT_DOWN;
|
||||
|
||||
screen[ 8 ][ 25 ] = MOUSETEXT_OPENAPPLE;
|
||||
screen[ 8 ][ 47 ] = MOUSETEXT_CLOSEDAPPLE;
|
||||
screen[ 11 ][ 14 ] = MOUSETEXT_OPENAPPLE;
|
||||
screen[ 12 ][ 15 ] = MOUSETEXT_CLOSEDAPPLE;
|
||||
screen[ 8 ][ 25 ] = (char)MOUSETEXT_OPENAPPLE;
|
||||
screen[ 8 ][ 47 ] = (char)MOUSETEXT_CLOSEDAPPLE;
|
||||
screen[ 11 ][ 14 ] = (char)MOUSETEXT_OPENAPPLE;
|
||||
screen[ 12 ][ 15 ] = (char)MOUSETEXT_CLOSEDAPPLE;
|
||||
|
||||
c_interface_translate_screen(screen);
|
||||
c_interface_print_screen( screen );
|
||||
|
@ -167,10 +167,10 @@ static void c_calibrate_keypad_joystick()
|
||||
"| Alt btn1:@ Alt btn2:@ x:@@ y:@@ |",
|
||||
"||||||||||||||||||||||||||||||||||||||||" };
|
||||
|
||||
submenu[8][29] = MOUSETEXT_BEGIN + 0x0b;
|
||||
submenu[9][27] = MOUSETEXT_BEGIN + 0x08;
|
||||
submenu[9][31] = MOUSETEXT_BEGIN + 0x15;
|
||||
submenu[10][29] = MOUSETEXT_BEGIN + 0x0a;
|
||||
submenu[8][29] = (char)(MOUSETEXT_BEGIN + 0x0b);
|
||||
submenu[9][27] = (char)(MOUSETEXT_BEGIN + 0x08);
|
||||
submenu[9][31] = (char)(MOUSETEXT_BEGIN + 0x15);
|
||||
submenu[10][29] = (char)(MOUSETEXT_BEGIN + 0x0a);
|
||||
|
||||
joy_x = HALF_JOY_RANGE;
|
||||
joy_y = HALF_JOY_RANGE;
|
||||
|
@ -414,7 +414,7 @@ static bool _json_mapGetStringValue(const JSON_s *map, const char *key, INOUT in
|
||||
}
|
||||
|
||||
int idx=0;
|
||||
const int keySize = strlen(key);
|
||||
const size_t keySize = strlen(key);
|
||||
|
||||
// should begin as map ...
|
||||
if (map->jsonTokens[idx].type != JSMN_OBJECT) {
|
||||
@ -553,7 +553,7 @@ bool json_mapParseLongValue(const JSON_ref jsonRef, const char *key, INOUT long
|
||||
char *str = &map->jsonString[tok.start];
|
||||
char ch = str[len];
|
||||
str[len] = '\0';
|
||||
*val = strtol(str, NULL, base);
|
||||
*val = strtol(str, NULL, (int)base);
|
||||
str[len] = ch;
|
||||
|
||||
foundMatch = true;
|
||||
@ -687,7 +687,7 @@ static bool _json_mapSetValue(const JSON_ref jsonRef, const char *key, const cha
|
||||
size_t quoLen = (valType == JSMN_STRING) ? QUOTE_LEN : 0;
|
||||
size_t comLen = tok.size ? COMMA_LEN : 0;
|
||||
|
||||
int keyValLen = QUOTE_LEN + keyLen + QUOTE_LEN + COLON_LEN + quoLen + valLen + quoLen + comLen;
|
||||
size_t keyValLen = QUOTE_LEN + keyLen + QUOTE_LEN + COLON_LEN + quoLen + valLen + quoLen + comLen;
|
||||
newVal = MALLOC(keyValLen+1);
|
||||
if (!newVal) {
|
||||
break;
|
||||
@ -733,10 +733,10 @@ static bool _json_mapSetValue(const JSON_ref jsonRef, const char *key, const cha
|
||||
assert(spliceBegin > 0); // must always begin with '{'
|
||||
assert(spliceEnd < map->jsonLen); // must always close with '}'
|
||||
|
||||
int prefixLen = spliceBegin;
|
||||
int suffixLen = (map->jsonLen - spliceEnd);
|
||||
size_t prefixLen = spliceBegin;
|
||||
size_t suffixLen = (map->jsonLen - spliceEnd);
|
||||
|
||||
int newLen = prefixLen+valLen+suffixLen;
|
||||
size_t newLen = prefixLen+valLen+suffixLen;
|
||||
|
||||
char *jsonString = MALLOC(newLen + 1);
|
||||
if (!jsonString) {
|
||||
@ -981,7 +981,7 @@ bool json_arrayParseLongValueAtIndex(const JSON_ref jsonRef, unsigned long index
|
||||
char *str = &array->jsonString[tok.start];
|
||||
char ch = str[len];
|
||||
str[len] = '\0';
|
||||
*val = strtol(str, NULL, base);
|
||||
*val = strtol(str, NULL, (int)base);
|
||||
str[len] = ch;
|
||||
|
||||
ret = true;
|
||||
|
@ -9,7 +9,7 @@
|
||||
#define FLEX_SCANNER
|
||||
#define YY_FLEX_MAJOR_VERSION 2
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
#define YY_FLEX_SUBMINOR_VERSION 39
|
||||
#define YY_FLEX_SUBMINOR_VERSION 35
|
||||
#if YY_FLEX_SUBMINOR_VERSION > 0
|
||||
#define FLEX_BETA
|
||||
#endif
|
||||
@ -47,6 +47,7 @@ typedef int16_t flex_int16_t;
|
||||
typedef uint16_t flex_uint16_t;
|
||||
typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
typedef uint64_t flex_uint64_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
@ -54,6 +55,7 @@ typedef int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
#endif /* ! C99 */
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
@ -84,8 +86,6 @@ typedef unsigned int flex_uint32_t;
|
||||
#define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#endif /* ! C99 */
|
||||
|
||||
#endif /* ! FLEXINT_H */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -142,15 +142,7 @@ typedef unsigned int flex_uint32_t;
|
||||
|
||||
/* Size of default input buffer. */
|
||||
#ifndef YY_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k.
|
||||
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
|
||||
* Ditto for the __ia64__ case accordingly.
|
||||
*/
|
||||
#define YY_BUF_SIZE 32768
|
||||
#else
|
||||
#define YY_BUF_SIZE 16384
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* The state buf must be large enough to hold one state per character in the main buffer.
|
||||
@ -176,7 +168,6 @@ extern FILE *yyin, *yyout;
|
||||
#define EOB_ACT_LAST_MATCH 2
|
||||
|
||||
#define YY_LESS_LINENO(n)
|
||||
#define YY_LINENO_REWIND_TO(ptr)
|
||||
|
||||
/* Return all but the first "n" matched characters back to the input stream. */
|
||||
#define yyless(n) \
|
||||
@ -365,7 +356,7 @@ static void yy_fatal_error (yyconst char msg[] );
|
||||
*/
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
(yytext_ptr) = yy_bp; \
|
||||
yyleng = (size_t) (yy_cp - yy_bp); \
|
||||
yyleng = (yy_size_t) (yy_cp - yy_bp); \
|
||||
(yy_hold_char) = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
(yy_c_buf_p) = yy_cp;
|
||||
@ -1136,7 +1127,7 @@ extern void fb_sha1();
|
||||
(? | h{elp})
|
||||
*/
|
||||
|
||||
#line 1140 "src/meta/debug.c"
|
||||
#line 1131 "src/meta/debug.c"
|
||||
|
||||
#define INITIAL 0
|
||||
|
||||
@ -1217,12 +1208,7 @@ static int input (void );
|
||||
|
||||
/* Amount of stuff to slurp up with each read. */
|
||||
#ifndef YY_READ_BUF_SIZE
|
||||
#ifdef __ia64__
|
||||
/* On IA-64, the buffer size is 16k, not 8k */
|
||||
#define YY_READ_BUF_SIZE 16384
|
||||
#else
|
||||
#define YY_READ_BUF_SIZE 8192
|
||||
#endif /* __ia64__ */
|
||||
#endif
|
||||
|
||||
/* Copy whatever the last rule matched to the standard output. */
|
||||
@ -1230,7 +1216,7 @@ static int input (void );
|
||||
/* This used to be an fputs(), but since the string might contain NUL's,
|
||||
* we now use fwrite().
|
||||
*/
|
||||
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
|
||||
#define ECHO fwrite( yytext, yyleng, 1, yyout )
|
||||
#endif
|
||||
|
||||
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
|
||||
@ -1241,7 +1227,7 @@ static int input (void );
|
||||
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
|
||||
{ \
|
||||
int c = '*'; \
|
||||
int n; \
|
||||
yy_size_t n; \
|
||||
for ( n = 0; n < max_size && \
|
||||
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
|
||||
buf[n] = (char) c; \
|
||||
@ -1254,7 +1240,7 @@ static int input (void );
|
||||
else \
|
||||
{ \
|
||||
errno=0; \
|
||||
while ( (result = fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
|
||||
while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
|
||||
{ \
|
||||
if( errno != EINTR) \
|
||||
{ \
|
||||
@ -1326,6 +1312,13 @@ YY_DECL
|
||||
register char *yy_cp, *yy_bp;
|
||||
register int yy_act;
|
||||
|
||||
#line 103 "src/meta/debug.l"
|
||||
|
||||
|
||||
|
||||
|
||||
#line 1321 "src/meta/debug.c"
|
||||
|
||||
if ( !(yy_init) )
|
||||
{
|
||||
(yy_init) = 1;
|
||||
@ -1352,14 +1345,6 @@ YY_DECL
|
||||
yy_load_buffer_state( );
|
||||
}
|
||||
|
||||
{
|
||||
#line 103 "src/meta/debug.l"
|
||||
|
||||
|
||||
|
||||
|
||||
#line 1362 "src/meta/debug.c"
|
||||
|
||||
while ( 1 ) /* loops until end-of-file is reached */
|
||||
{
|
||||
yy_cp = (yy_c_buf_p);
|
||||
@ -1377,7 +1362,7 @@ YY_DECL
|
||||
yy_match:
|
||||
do
|
||||
{
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
|
||||
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
|
||||
if ( yy_accept[yy_current_state] )
|
||||
{
|
||||
(yy_last_accepting_state) = yy_current_state;
|
||||
@ -2538,7 +2523,7 @@ YY_RULE_SETUP
|
||||
#line 977 "src/meta/debug.l"
|
||||
ECHO;
|
||||
YY_BREAK
|
||||
#line 2542 "src/meta/debug.c"
|
||||
#line 2527 "src/meta/debug.c"
|
||||
case YY_STATE_EOF(INITIAL):
|
||||
yyterminate();
|
||||
|
||||
@ -2669,7 +2654,6 @@ case YY_STATE_EOF(INITIAL):
|
||||
"fatal flex scanner internal error--no action found" );
|
||||
} /* end of action switch */
|
||||
} /* end of scanning one token */
|
||||
} /* end of user's declarations */
|
||||
} /* end of yylex */
|
||||
|
||||
/* yy_get_next_buffer - try to read in a new buffer
|
||||
@ -2725,14 +2709,14 @@ static int yy_get_next_buffer (void)
|
||||
|
||||
else
|
||||
{
|
||||
int num_to_read =
|
||||
yy_size_t num_to_read =
|
||||
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
|
||||
|
||||
while ( num_to_read <= 0 )
|
||||
{ /* Not enough room in the buffer - grow it. */
|
||||
|
||||
/* just a shorter name for the current buffer */
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
|
||||
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
|
||||
|
||||
int yy_c_buf_p_offset =
|
||||
(int) ((yy_c_buf_p) - b->yy_ch_buf);
|
||||
@ -2866,7 +2850,7 @@ static int yy_get_next_buffer (void)
|
||||
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
|
||||
yy_is_jam = (yy_current_state == 410);
|
||||
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
return yy_is_jam ? 0 : yy_current_state;
|
||||
}
|
||||
|
||||
static void yyunput (int c, register char * yy_bp )
|
||||
@ -2954,7 +2938,7 @@ static int yy_get_next_buffer (void)
|
||||
case EOB_ACT_END_OF_FILE:
|
||||
{
|
||||
if ( yywrap( ) )
|
||||
return EOF;
|
||||
return 0;
|
||||
|
||||
if ( ! (yy_did_buffer_switch_on_eof) )
|
||||
YY_NEW_FILE;
|
||||
@ -3092,6 +3076,10 @@ static void yy_load_buffer_state (void)
|
||||
yyfree((void *) b );
|
||||
}
|
||||
|
||||
#ifndef __cplusplus
|
||||
extern int isatty (int );
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Initializes or reinitializes a buffer.
|
||||
* This function is sometimes called more than once on the same buffer,
|
||||
* such as during a yyrestart() or at EOF.
|
||||
@ -3296,8 +3284,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
|
||||
|
||||
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
|
||||
* scan from a @e copy of @a bytes.
|
||||
* @param yybytes the byte buffer to scan
|
||||
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
|
||||
* @param bytes the byte buffer to scan
|
||||
* @param len the number of bytes in the buffer pointed to by @a bytes.
|
||||
*
|
||||
* @return the newly allocated buffer state object.
|
||||
*/
|
||||
@ -3305,8 +3293,7 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
|
||||
{
|
||||
YY_BUFFER_STATE b;
|
||||
char *buf;
|
||||
yy_size_t n;
|
||||
yy_size_t i;
|
||||
yy_size_t n, i;
|
||||
|
||||
/* Get memory for full buffer, including space for trailing EOB's. */
|
||||
n = _yybytes_len + 2;
|
||||
@ -3536,7 +3523,7 @@ void yyfree (void * ptr )
|
||||
|
||||
#define YYTABLES_NAME "yytables"
|
||||
|
||||
#line 976 "src/meta/debug.l"
|
||||
#line 977 "src/meta/debug.l"
|
||||
|
||||
|
||||
|
||||
|
@ -1103,8 +1103,8 @@ void fb_sha1() {
|
||||
sprintf(buf+i, "%c", '\0');
|
||||
LOG("SHA1 : %s", buf);
|
||||
|
||||
int ch = -1;
|
||||
#ifdef INTERFACE_CLASSIC
|
||||
int ch = -1;
|
||||
while ((ch = c_mygetch(1)) == -1) {
|
||||
// ...
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ bool do_logging = true;
|
||||
bool do_std_logging = true;
|
||||
|
||||
static int logFd = -1;
|
||||
static int logSiz = 0;
|
||||
static off_t logSiz = 0;
|
||||
static const unsigned int logRotateSize = 1024 * 1024;
|
||||
static const unsigned int logRotateCount = 4;
|
||||
|
||||
@ -117,8 +117,8 @@ void log_outputString(const char * const str) {
|
||||
|
||||
pthread_mutex_lock(&log_mutex);
|
||||
|
||||
int expected_bytescount = strlen(str);
|
||||
int bytescount = 0;
|
||||
size_t expected_bytescount = strlen(str);
|
||||
size_t bytescount = 0;
|
||||
|
||||
do {
|
||||
ssize_t byteswritten = 0;
|
||||
|
@ -39,6 +39,8 @@
|
||||
*/
|
||||
|
||||
#include "sha1.h"
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
/*
|
||||
* Define the circular shift macro
|
||||
@ -374,7 +376,11 @@ void SHA1PadMessage(SHA1Context *context)
|
||||
void SHA1(const unsigned char *d, size_t n, unsigned char *md) {
|
||||
SHA1Context sha = { { 0 } };
|
||||
SHA1Reset(&sha);
|
||||
SHA1Input(&sha, d, n);
|
||||
unsigned int len = (unsigned int)n;
|
||||
if (__builtin_expect((n > UINT_MAX), 0)) {
|
||||
assert(0);
|
||||
}
|
||||
SHA1Input(&sha, d, len);
|
||||
if (!SHA1Result(&sha)) {
|
||||
memset(md, '\0', SHA_DIGEST_LENGTH);
|
||||
} else {
|
||||
|
@ -172,11 +172,7 @@ void reinitialize(void) {
|
||||
|
||||
void timing_initialize(void) {
|
||||
#if !TESTING
|
||||
# if (TARGET_OS_MAC || TARGET_OS_PHONE)
|
||||
# warning FIXME TODO : this assert is firing on iOS port ... but the assert is valid ... fix soon
|
||||
# else
|
||||
assert(cpu_isPaused() || (pthread_self() == cpu_thread_id));
|
||||
# endif
|
||||
#endif
|
||||
_timing_initialize(alt_speed_enabled ? cpu_altscale_factor : cpu_scale_factor);
|
||||
}
|
||||
@ -583,7 +579,7 @@ bool timing_saveState(StateHelper_s *helper) {
|
||||
assert(cpu_scale_factor >= 0);
|
||||
assert(cpu_altscale_factor >= 0);
|
||||
|
||||
lVal = (uint32_t)(cpu_scale_factor * 100.);
|
||||
lVal = (cpu_scale_factor * 100.);
|
||||
serialized[0] = (uint8_t)((lVal & 0xFF000000) >> 24);
|
||||
serialized[1] = (uint8_t)((lVal & 0xFF0000 ) >> 16);
|
||||
serialized[2] = (uint8_t)((lVal & 0xFF00 ) >> 8);
|
||||
@ -592,7 +588,7 @@ bool timing_saveState(StateHelper_s *helper) {
|
||||
break;
|
||||
}
|
||||
|
||||
lVal = (long)(cpu_altscale_factor * 100.);
|
||||
lVal = (cpu_altscale_factor * 100.);
|
||||
serialized[0] = (uint8_t)((lVal & 0xFF000000) >> 24);
|
||||
serialized[1] = (uint8_t)((lVal & 0xFF0000 ) >> 16);
|
||||
serialized[2] = (uint8_t)((lVal & 0xFF00 ) >> 8);
|
||||
|
@ -266,7 +266,7 @@ static void _animation_showPaused(void) {
|
||||
static char pausedTemplate[PAUSED_ANIMATION_ROWS][PAUSED_ANIMATION_COLS+1] = {
|
||||
" @ ",
|
||||
};
|
||||
pausedTemplate[0][1] = MOUSETEXT_HOURGLASS;
|
||||
pausedTemplate[0][1] = (char)MOUSETEXT_HOURGLASS;
|
||||
_animation_showMessage(pausedTemplate[0], PAUSED_ANIMATION_COLS, PAUSED_ANIMATION_ROWS);
|
||||
}
|
||||
|
||||
@ -321,17 +321,17 @@ static void _animation_showDiskChosen(int drive) {
|
||||
"DD ",
|
||||
" >1L",
|
||||
};
|
||||
diskInsertedTemplate[2][3] = ICONTEXT_UNLOCK;
|
||||
diskInsertedTemplate[2][3] = (char)ICONTEXT_UNLOCK;
|
||||
template = diskInsertedTemplate[0];
|
||||
}
|
||||
|
||||
const unsigned int x = (shownCols+1);// stride
|
||||
(template+x*0)[0] = ICONTEXT_DISK_UL;
|
||||
(template+x*0)[1] = ICONTEXT_DISK_UR;
|
||||
(template+x*1)[0] = ICONTEXT_DISK_LL;
|
||||
(template+x*1)[1] = ICONTEXT_DISK_LR;
|
||||
(template+x*0)[0] = (char)ICONTEXT_DISK_UL;
|
||||
(template+x*0)[1] = (char)ICONTEXT_DISK_UR;
|
||||
(template+x*1)[0] = (char)ICONTEXT_DISK_LL;
|
||||
(template+x*1)[1] = (char)ICONTEXT_DISK_LR;
|
||||
|
||||
(template+x*2)[1] = ICONTEXT_GOTO;
|
||||
(template+x*2)[1] = (char)ICONTEXT_GOTO;
|
||||
(template+x*2)[2] = (drive == 0) ? '1' : '2';
|
||||
|
||||
_animation_showMessage(template, shownCols, DISK_ANIMATION_ROWS);
|
||||
@ -390,7 +390,7 @@ static void alert_applyPrefs(void) {
|
||||
long height = prefs_parseLongValue (PREF_DOMAIN_INTERFACE, PREF_DEVICE_HEIGHT, &lVal, 10) ? lVal : (long)(SCANHEIGHT*1.5);
|
||||
bool isLandscape = prefs_parseBoolValue (PREF_DOMAIN_INTERFACE, PREF_DEVICE_LANDSCAPE, &bVal) ? bVal : true;
|
||||
|
||||
alert_reshape(width, height, isLandscape);
|
||||
alert_reshape((int)width, (int)height, isLandscape);
|
||||
}
|
||||
|
||||
static void alert_prefsChanged(const char *domain) {
|
||||
|
@ -242,7 +242,11 @@ static void glvideo_init(void) {
|
||||
// Check for errors to make sure all of our setup went ok
|
||||
GL_MAYBELOG("finished initialization");
|
||||
|
||||
#if __APPLE__
|
||||
if (1) {
|
||||
#else
|
||||
if (glCheckFramebufferStatus != NULL) {
|
||||
#endif
|
||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||
ERRQUIT("framebuffer status: %04X", status);
|
||||
@ -445,7 +449,7 @@ static void glvideo_applyPrefs(void) {
|
||||
long height = prefs_parseLongValue (PREF_DOMAIN_INTERFACE, PREF_DEVICE_HEIGHT, &lVal, 10) ? lVal : (long)(SCANHEIGHT*1.5);
|
||||
bool isLandscape = prefs_parseBoolValue (PREF_DOMAIN_INTERFACE, PREF_DEVICE_LANDSCAPE, &bVal) ? bVal : true;
|
||||
|
||||
glvideo_reshape(width, height, isLandscape);
|
||||
glvideo_reshape((int)width, (int)height, isLandscape);
|
||||
}
|
||||
|
||||
static void glvideo_prefsChanged(const char *domain) {
|
||||
|
@ -31,7 +31,7 @@ static const char* const _gzerr(gzFile gzf) {
|
||||
}
|
||||
}
|
||||
|
||||
static int _gzread_data(gzFile gzsource, uint8_t *buf, const int expected_bytescount) {
|
||||
static int _gzread_data(gzFile gzsource, uint8_t *buf, const unsigned int expected_bytescount) {
|
||||
int bytescount = 0;
|
||||
|
||||
int maxtries = 10;
|
||||
@ -58,12 +58,12 @@ static int _gzread_data(gzFile gzsource, uint8_t *buf, const int expected_bytesc
|
||||
return bytescount;
|
||||
}
|
||||
|
||||
static int _read_data(int fd_own, uint8_t *buf, const int expected_bytescount) {
|
||||
int bytescount = 0;
|
||||
static ssize_t _read_data(int fd_own, uint8_t *buf, const off_t expected_bytescount) {
|
||||
ssize_t bytescount = 0;
|
||||
|
||||
int maxtries = 10;
|
||||
do {
|
||||
int bytesread = 0;
|
||||
ssize_t bytesread = 0;
|
||||
TEMP_FAILURE_RETRY(bytesread = read(fd_own, buf+bytescount, expected_bytescount-bytescount));
|
||||
if (bytesread <= 0) {
|
||||
if (--maxtries == 0) {
|
||||
@ -78,7 +78,7 @@ static int _read_data(int fd_own, uint8_t *buf, const int expected_bytescount) {
|
||||
bytescount += bytesread;
|
||||
|
||||
if (bytescount >= expected_bytescount) {
|
||||
bytescount = expected_bytescount;
|
||||
bytescount = (int)expected_bytescount;
|
||||
break; // DONE
|
||||
}
|
||||
} while (1);
|
||||
@ -87,8 +87,8 @@ static int _read_data(int fd_own, uint8_t *buf, const int expected_bytescount) {
|
||||
}
|
||||
|
||||
|
||||
static int _write_data(int fd_own, uint8_t *buf, const int expected_bytescount) {
|
||||
int bytescount = 0;
|
||||
static ssize_t _write_data(int fd_own, uint8_t *buf, const unsigned int expected_bytescount) {
|
||||
ssize_t bytescount = 0;
|
||||
|
||||
int maxtries = 10;
|
||||
do {
|
||||
@ -116,13 +116,13 @@ static int _write_data(int fd_own, uint8_t *buf, const int expected_bytescount)
|
||||
return bytescount;
|
||||
}
|
||||
|
||||
static a2gzip_t _check_gzip_magick(int fd_own, const int expected_bytescount) {
|
||||
static a2gzip_t _check_gzip_magick(int fd_own, const unsigned int expected_bytescount) {
|
||||
|
||||
a2gzip_t ret = A2GZT_ERR;
|
||||
|
||||
do {
|
||||
uint8_t stkbuf[2];
|
||||
int bytescount = _read_data(fd_own, &stkbuf[0], sizeof(stkbuf));
|
||||
off_t bytescount = _read_data(fd_own, &stkbuf[0], sizeof(stkbuf));
|
||||
if (bytescount != sizeof(stkbuf)) {
|
||||
LOG("OOPS, could not read file magick for file descriptor");
|
||||
break;
|
||||
@ -146,7 +146,7 @@ static a2gzip_t _check_gzip_magick(int fd_own, const int expected_bytescount) {
|
||||
if (bytescount >= expected_bytescount) {
|
||||
ret = A2GZT_NOT_GZ;
|
||||
} else {
|
||||
LOG("OOPS, did not find gzip magick, and file is %d bytes, not expected size of %d", bytescount, expected_bytescount);
|
||||
LOG("OOPS, did not find gzip magick, and file is %lld bytes, not expected size of %u", (long long)bytescount, expected_bytescount);
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
@ -158,14 +158,14 @@ static a2gzip_t _check_gzip_magick(int fd_own, const int expected_bytescount) {
|
||||
*
|
||||
* Return NULL on success, or error string (possibly from zlib) on failure.
|
||||
*/
|
||||
const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_t *buf) {
|
||||
const char *zlib_inflate_to_buffer(int fd, const unsigned int expected_bytescount, uint8_t *buf) {
|
||||
gzFile gzsource = NULL;
|
||||
int fd_own = -1;
|
||||
|
||||
assert(buf != NULL);
|
||||
assert(expected_bytescount > 0);
|
||||
|
||||
int bytescount = 0;
|
||||
ssize_t bytescount = 0;
|
||||
char *err = NULL;
|
||||
do {
|
||||
|
||||
@ -204,7 +204,7 @@ const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_
|
||||
bytescount = _gzread_data(gzsource, buf, expected_bytescount);
|
||||
if (bytescount != expected_bytescount) {
|
||||
// could not gzread(), maybe it's not actually a gzip stream? ...
|
||||
LOG("OOPS, did not gzread() expected_bytescount of %d ... apparently read %d ... checking file length heuristic ...", expected_bytescount, bytescount);
|
||||
LOG("OOPS, did not gzread() expected_bytescount of %u ... apparently read %zd ... checking file length heuristic ...", expected_bytescount, bytescount);
|
||||
|
||||
if (lseek(fd_own, 0L, SEEK_SET) == -1) {
|
||||
LOG("OOPS, cannot seek to start of file descriptor!");
|
||||
@ -226,7 +226,7 @@ const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_
|
||||
} while (0);
|
||||
|
||||
if (bytescount != expected_bytescount) {
|
||||
LOG("OOPS did not read expected_bytescount of %d ... apparently read %d", expected_bytescount, bytescount);
|
||||
LOG("OOPS did not read expected_bytescount of %u ... apparently read %zd", expected_bytescount, bytescount);
|
||||
if (gzsource) {
|
||||
err = (char *)_gzerr(gzsource);
|
||||
}
|
||||
@ -251,7 +251,7 @@ const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_
|
||||
*
|
||||
* Return NULL on success, or error string (possibly from zlib) on failure.
|
||||
*/
|
||||
const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is_gzipped) {
|
||||
const char *zlib_inflate_inplace(int fd, const unsigned int expected_bytescount, bool *is_gzipped) {
|
||||
gzFile gzsource = NULL;
|
||||
int fd_own = -1;
|
||||
uint8_t *buf = NULL;
|
||||
@ -260,7 +260,7 @@ const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is
|
||||
|
||||
assert(expected_bytescount > 2);
|
||||
|
||||
int bytescount = 0;
|
||||
off_t bytescount = 0;
|
||||
do {
|
||||
|
||||
TEMP_FAILURE_RETRY(fd_own = dup(fd)); // balance gzclose()
|
||||
@ -302,7 +302,7 @@ const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is
|
||||
bytescount = _gzread_data(gzsource, buf, expected_bytescount);
|
||||
if (bytescount != expected_bytescount) {
|
||||
// could not gzread(), maybe it's not actually a gzip stream? ...
|
||||
LOG("OOPS, did not in-place gzread() expected_bytescount of %d ... apparently read %d ... checking file length heuristic ...", expected_bytescount, bytescount);
|
||||
LOG("OOPS, did not in-place gzread() expected_bytescount of %u ... apparently read %lld ... checking file length heuristic ...", expected_bytescount, (long long)bytescount);
|
||||
|
||||
bytescount = lseek(fd_own, 0L, SEEK_END);
|
||||
if (bytescount == -1) {
|
||||
@ -345,7 +345,7 @@ const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is
|
||||
|
||||
char *err = NULL;
|
||||
if (bytescount != expected_bytescount) {
|
||||
LOG("OOPS, did not write expected_bytescount of %d ... apparently wrote %d", expected_bytescount, bytescount);
|
||||
LOG("OOPS, did not write expected_bytescount of %u ... apparently wrote %lld", expected_bytescount, (long long)bytescount);
|
||||
if (gzsource) {
|
||||
err = (char *)_gzerr(gzsource);
|
||||
}
|
||||
@ -374,17 +374,16 @@ const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is
|
||||
*
|
||||
* Return NULL on success, or error string (possibly from zlib) on failure.
|
||||
*/
|
||||
const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size) {
|
||||
const char *zlib_deflate_buffer(const uint8_t *src, const unsigned int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size) {
|
||||
char *gzPath = NULL;
|
||||
gzFile gzdest = NULL;
|
||||
int fd_own = -1;
|
||||
|
||||
assert(src_bytescount > 0);
|
||||
int expected_bytescount = src_bytescount;
|
||||
off_t expected_bytescount = src_bytescount;
|
||||
|
||||
*dst_size = -1;
|
||||
|
||||
int bytescount = 0;
|
||||
off_t bytescount = 0;
|
||||
char *err = NULL;
|
||||
do {
|
||||
ASPRINTF(&gzPath, "%s/tmp.img", data_dir);
|
||||
@ -403,7 +402,12 @@ const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, ui
|
||||
}
|
||||
|
||||
do {
|
||||
int byteswritten = gzwrite(gzdest, src+bytescount, expected_bytescount-bytescount);
|
||||
ssize_t len0 = expected_bytescount-bytescount;
|
||||
unsigned int len = (unsigned int)len0;
|
||||
if (UNLIKELY(len0 > UINT_MAX || len0 < 0)) {
|
||||
assert(false);
|
||||
}
|
||||
int byteswritten = gzwrite(gzdest, src+bytescount, len);
|
||||
if (byteswritten <= 0) {
|
||||
LOG("OOPS, gzwrite() returned %d", byteswritten);
|
||||
break;
|
||||
@ -430,7 +434,7 @@ const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, ui
|
||||
// now read compressed data into buffer ...
|
||||
|
||||
{
|
||||
int compressed_size = lseek(fd_own, 0L, SEEK_CUR);
|
||||
off_t compressed_size = lseek(fd_own, 0L, SEEK_CUR);
|
||||
assert(compressed_size > 0 && compressed_size < expected_bytescount);
|
||||
expected_bytescount = compressed_size;
|
||||
}
|
||||
@ -450,7 +454,7 @@ const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, ui
|
||||
} while (0);
|
||||
|
||||
if (bytescount != expected_bytescount) {
|
||||
LOG("OOPS, did not write/read expected number of bytes of %d ... apparently wrote %d", expected_bytescount, bytescount);
|
||||
LOG("OOPS, did not write/read expected number of bytes of %lld ... apparently wrote %lld", (long long)expected_bytescount, (long long)bytescount);
|
||||
if (gzdest) {
|
||||
err = (char *)_gzerr(gzdest);
|
||||
}
|
||||
|
@ -23,13 +23,13 @@
|
||||
|
||||
// Inflate/uncompress from file descriptor into previously allocated buffer of expected_bytes length. Underlying file
|
||||
// can either be gzipped or not. This is meant for readonly disk images.
|
||||
const char *zlib_inflate_to_buffer(int fd, const int expected_bytescount, uint8_t *buf);
|
||||
const char *zlib_inflate_to_buffer(int fd, const unsigned int expected_bytescount, uint8_t *buf);
|
||||
|
||||
// Inflate/uncompress from file descriptor back into itself. Underlying file can either be gzipped or not. This is
|
||||
// meant for read/write disk images.
|
||||
const char *zlib_inflate_inplace(int fd, const int expected_bytescount, bool *is_gzipped);
|
||||
const char *zlib_inflate_inplace(int fd, const unsigned int expected_bytescount, bool *is_gzipped);
|
||||
|
||||
// Deflate/compress from buffer to buffer. This is meant for ejecting read/write disk images.
|
||||
const char *zlib_deflate_buffer(const uint8_t *src, const int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size);
|
||||
const char *zlib_deflate_buffer(const uint8_t *src, const unsigned int src_bytescount, uint8_t *dst, OUTPARM off_t *dst_size);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user