diff --git a/ext/vgm/vgmwrite.c b/ext/vgm/vgmwrite.c index f055952cb..b89056895 100644 --- a/ext/vgm/vgmwrite.c +++ b/ext/vgm/vgmwrite.c @@ -296,6 +296,7 @@ void vgm_start(struct RunningMachine *machine) return; // start the timer + //PINMAME change: if also done if not logging (like in original source), then cpu slices change, leading to timing issues on some machines timer_pulse(TIME_IN_HZ(44100), 0, vgmfile_callback); //44.1 KHz VGM pulse timer // Get the Game Information and write the GD3 Tag diff --git a/release/whatsnew.txt b/release/whatsnew.txt index 31fdf500c..58223f8fa 100644 --- a/release/whatsnew.txt +++ b/release/whatsnew.txt @@ -45,6 +45,7 @@ Refined Bally-32 sound emulation (so it also does not require the sample package Disabled mechanical sample use (solenoids, bumpers, etc) via the pinmame.zip sample package if running VPinMAME or libPinMAME (as this should be handled by the table itself then) Fixed 6 million dollar man 7 digit conversion display Fixed inverted switches for ffv101 +Fixed im_185 fast flip detection Fixed regressions by reducing the pre-shutdown time for Joctronic, NSM, Juegos Populares, after fixing timeslice issue related to the VGM file dump feature (which uses a fast timer) Added support for the old SC-01 Votrax ROM version (wired only to the Mars - God of War Prototype so far) Fixed regression/crashes for Elvis and Monopoly (introduced in 3.1) diff --git a/src/cpu/adsp2100/2100dasm.c b/src/cpu/adsp2100/2100dasm.c index 56aa1edfd..43b0c7ae0 100644 --- a/src/cpu/adsp2100/2100dasm.c +++ b/src/cpu/adsp2100/2100dasm.c @@ -262,7 +262,7 @@ unsigned dasm2100(char *buffer, unsigned pc) buffer += sprintf(buffer, "??? (%06X)", op); break; case 0x0a: - /* 00001010 00000000 0000xxxx conditional return */ + /* 00001010 00000000 000xxxxx conditional return */ if ((op & 0x00ffe0) == 0x000000) { buffer += sprintf(buffer, "%s", condition[op & 15]); diff --git a/src/cpu/arm7/arm7core.c b/src/cpu/arm7/arm7core.c index eeb097212..ffb956e89 100644 --- a/src/cpu/arm7/arm7core.c +++ b/src/cpu/arm7/arm7core.c @@ -437,7 +437,6 @@ INLINE data32_t decodeShift( data32_t insn, data32_t *pCarry) static int loadInc ( data32_t pat, data32_t rbv, data32_t s) { int i, result; - UINT32 data; result = 0; rbv &= ~3; @@ -446,7 +445,7 @@ static int loadInc ( data32_t pat, data32_t rbv, data32_t s) if ((pat >> i) & 1) { if (ARM7.pendingAbtD == 0) { - data = READ32(rbv += 4); + UINT32 data = READ32(rbv += 4); if (i == 15) { //if (s) /* Pull full contents from stack */ SET_REGISTER( 15, data ); @@ -465,7 +464,6 @@ static int loadInc ( data32_t pat, data32_t rbv, data32_t s) static int loadIncMode(data32_t pat, data32_t rbv, data32_t s, int mode) { int i, result; - UINT32 data; result = 0; rbv &= ~3; @@ -475,7 +473,7 @@ static int loadIncMode(data32_t pat, data32_t rbv, data32_t s, int mode) { if (ARM7.pendingAbtD == 0) // "Overwriting of registers stops when the abort happens." { - data = READ32(rbv += 4); + UINT32 data = READ32(rbv += 4); if (i == 15) { //if (s) /* Pull full contents from stack */ SET_MODE_REGISTER(mode, 15, data); @@ -493,7 +491,6 @@ static int loadIncMode(data32_t pat, data32_t rbv, data32_t s, int mode) static int loadDec( data32_t pat, data32_t rbv, data32_t s) { int i, result; - UINT32 data; result = 0; rbv &= ~3; @@ -502,7 +499,7 @@ static int loadDec( data32_t pat, data32_t rbv, data32_t s) if ((pat >> i) & 1) { if (ARM7.pendingAbtD == 0) { - data = READ32(rbv -= 4); + UINT32 data = READ32(rbv -= 4); if (i == 15) { //if (s) /* Pull full contents from stack */ SET_REGISTER( 15, data ); @@ -521,7 +518,6 @@ static int loadDec( data32_t pat, data32_t rbv, data32_t s) static int loadDecMode(data32_t pat, data32_t rbv, data32_t s, int mode) { int i, result; - UINT32 data; result = 0; rbv &= ~3; @@ -531,7 +527,7 @@ static int loadDecMode(data32_t pat, data32_t rbv, data32_t s, int mode) { if (ARM7.pendingAbtD == 0) // "Overwriting of registers stops when the abort happens." { - data = READ32(rbv -= 4); + UINT32 data = READ32(rbv -= 4); if (i == 15) { //if (s) /* Pull full contents from stack */ SET_MODE_REGISTER(mode, 15, data); @@ -590,7 +586,7 @@ static int storeIncMode(data32_t pat, data32_t rbv, int mode) // classic CV: 3005aa0 does the DMA thing static int storeDec( data32_t pat, data32_t rbv) { - int i, result = 0, cnt; + int i, result = 0, cnt; // pre-count the # of registers doing DMA for (i = 15; i >= 0; i--) @@ -852,7 +848,6 @@ static void HandleCoProcDO(data32_t insn) //Co-Processor Register Transfer - To/From Arm to Co-Proc static void HandleCoProcRT(data32_t insn) { - /* xxxx 1110 oooL nnnn dddd cccc ppp1 mmmm */ // Load (MRC) data from Co-Proc to ARM7 register diff --git a/src/cpu/arm7/arm7core.h b/src/cpu/arm7/arm7core.h index d03608a73..0c6c0fb80 100644 --- a/src/cpu/arm7/arm7core.h +++ b/src/cpu/arm7/arm7core.h @@ -389,4 +389,3 @@ EXTERN char *(*arm7_dasm_cop_do_callback)( char *pBuf, data32_t opcode, char *pC #endif #endif /* ARM7CORE_H */ - diff --git a/src/cpu/at91/at91.c b/src/cpu/at91/at91.c index 86ee91b22..2edf599c7 100644 --- a/src/cpu/at91/at91.c +++ b/src/cpu/at91/at91.c @@ -76,7 +76,7 @@ extern int activecpu; //Flags for Testing #define INT_BLOCK_FIQ 0 //Turn on/off blocking of specified Interrupt (Leave OFF for non-test situation) -#define INT_BLOCK_IRQ0 0 +#define INT_BLOCK_IRQ0 0 #define INT_BLOCK_TC0 0 #define INT_BLOCK_TC1 0 #define INT_BLOCK_TC2 0 @@ -120,10 +120,10 @@ static void timer_trigger_event(int timer_num); #define WRITE32(addr,data) at91_cpu_write32(addr,data) #define PTR_READ32 &at91_cpu_read32 #define PTR_WRITE32 &at91_cpu_write32 -#define PTR_READ16 &arm7_cpu_read16 -#define PTR_WRITE16 &arm7_cpu_write16 -#define PTR_READ8 &arm7_cpu_read8 -#define PTR_WRITE8 &arm7_cpu_write8 +#define PTR_READ16 &arm7_cpu_read16 +#define PTR_WRITE16 &arm7_cpu_write16 +#define PTR_READ8 &arm7_cpu_read8 +#define PTR_WRITE8 &arm7_cpu_write8 /* Macros that need to be defined according to the cpu implementation specific need */ #define ARMREG(reg) at91.sArmRegister[reg] @@ -179,8 +179,8 @@ typedef struct ARM7CORE_REGS //these must be included in your cpu specific register implementation int prev_cycles; //# of previous cycles used since last opcode was performed. int tot_prev_cycles; //# of total previous cycles - int remap; //flag if remap of ram occurred - data32_t aic_vectors[32]; //holds vector address for each interrupt 0-31 + int remap; //flag if remap of ram occurred + data32_t aic_vectors[32]; //holds vector address for each interrupt 0-31 data32_t aic_smr[32]; //Holds IRQ priorities data32_t aic_irqmask; //holds the irq enabled mask for each interrupt 0-31 (0 = disabled, 1 = enabled) - 1 bit per interrupt. data32_t aic_irqstatus; //holds the status of the current interrupt # - 0-31 are valid # @@ -204,7 +204,7 @@ typedef struct int cpunum; //CPU num data32_t *page0_ram_ptr; //holder for the pointer set by the driver to ram @ page 0. data32_t *reset_ram_ptr; //holder for the pointer set by the driver to ram swap location. - data32_t page0[0x100000]; //Hold copy of original boot rom data @ page 0. + data32_t page0[0x100000/4]; //Hold copy of original boot rom data @ page 0. #if USE_MAME_TIMERS mame_timer* timer[MAX_TIMER]; //handle to mame timer for each clock #endif @@ -1196,7 +1196,7 @@ INLINE void internal_write (int addr, data32_t data) break; } - default: + default: LOG(("%08x: AT91-OCP WRITE: %08x = %08x\n",activecpu_get_pc(),addr,data)); } } @@ -1766,7 +1766,7 @@ void at91_fire_irq(int irqline) // { // return; // } -// Always mark as pending, but don't fire if masked. +// Always mark as pending, but don't fire if masked. if(irqline == AT91_FIQ_IRQ) { @@ -1961,12 +1961,11 @@ INLINE BeforeOpCodeHook(void) if( (TC_RUNNING(0) || TC_RUNNING(1) || TC_RUNNING(2)) ) //for speed we use this, but really it should loop and check using MAX_TIMER var { int i; - int cycles = 0; //Check each timer for(i=0; ipathcount != 0) { int pathindex; - + for (pathindex = 0; pathindex < list->pathcount; pathindex++) { free((void *)list->path[pathindex]); - } - + } + free((void *)list->path); } - + list->path = NULL; list->pathcount = 0; - - list->rawpath = new_rawpath; + + list->rawpath = new_rawpath; } /** @@ -77,7 +77,7 @@ static char* find_reverse_path_sep(char* name) { char* p = name + strlen(name) - 1; while (p >= name && !is_pathsep(*p)) { p--; - } + } return (p >= name) ? p : NULL; } @@ -86,26 +86,26 @@ static char* find_reverse_path_sep(char* name) { */ static void create_path(char* path, int has_filename) { - struct stat st; + struct stat st; char* sep = find_reverse_path_sep(path); - - if (sep && sep > path && !is_pathsep(sep[-1])) { + + if (sep && sep > path && !is_pathsep(sep[-1])) { *sep = 0; create_path(path, 0); *sep = '/'; } - + if (has_filename) { return; - } - + } + if (!stat(path, &st)) { return; } - + ipinmame_logger("create_path(): creating path - path=%s, has_filename=%d", path, has_filename); - + mkdir(path, 0777); } @@ -123,22 +123,22 @@ INLINE int is_variablechar(char c) { static const char* parse_variable(const char** start, const char* end) { const char* src = *start; - const char* var; - + const char* var; + char variable[1024]; char *dest = variable; - + for (src = *start; src < end && is_variablechar(*src); src++) { *dest++ = *src; - } - + } + if(src == *start) { return("$"); - } - + } + *dest = 0; *start = src; - + var = getenv(variable); return (var) ? var : ""; } @@ -151,7 +151,7 @@ static char* copy_and_expand_variables(const char* path, int len) { char *dst, *result; const char *src; int length = 0; - + for (src = path; src < path + len; ) { if (*src++ == '$') { length += strlen(parse_variable(&src, path + len)); @@ -160,13 +160,13 @@ static char* copy_and_expand_variables(const char* path, int len) { length++; } } - + result = malloc(length + 1); if (!result) { exit(1); } - + for (src = path, dst = result; src < path + len;) { char c = *src++; if (c == '$') { @@ -176,7 +176,7 @@ static char* copy_and_expand_variables(const char* path, int len) { *dst++ = c; } } - + *dst = 0; return result; } @@ -188,48 +188,48 @@ static char* copy_and_expand_variables(const char* path, int len) { static void expand_pathlist(struct pathdata *list) { const char *rawpath = (list->rawpath) ? list->rawpath : ""; const char *token; - + if (list->pathcount != 0) { int pathindex; - + for (pathindex = 0; pathindex < list->pathcount; pathindex++) { free((void *)list->path[pathindex]); } - + free((void *)list->path); } - + list->path = NULL; list->pathcount = 0; - + token = strchr(rawpath, ';'); if (!token) { token = rawpath + strlen(rawpath); } - + while (1) { list->path = realloc((void *)list->path, (list->pathcount + 1) * sizeof(char *)); if (!list->path) { exit(1); } - + list->path[list->pathcount++] = copy_and_expand_variables(rawpath, token - rawpath); - + if (*token == 0) { break; } - + rawpath = token + 1; - + token = strchr(rawpath, ';'); if (!token) { token = rawpath + strlen(rawpath); } } - - return; + + return; } /** @@ -238,19 +238,19 @@ static void expand_pathlist(struct pathdata *list) { static const char* get_path_for_filetype(int filetype, int pathindex, UINT32* count) { struct pathdata* list; - + switch (filetype) { #ifndef MESS case FILETYPE_IMAGE: list = &pathlist[FILETYPE_ROM]; break; #endif - + default: list = &pathlist[filetype]; break; } - + if (list->pathcount == 0 || list->rawpath) { if (list == &pathlist[FILETYPE_ROM] && rompath_extra) { const char* rawpath = (list->rawpath) ? list->rawpath : ""; @@ -258,37 +258,37 @@ static const char* get_path_for_filetype(int filetype, int pathindex, UINT32* co sprintf(newpath, "%s;%s", rompath_extra, rawpath); list->rawpath = newpath; } - + expand_pathlist(list); } - + if (count) { *count = list->pathcount; - } - + } + return (pathindex < list->pathcount) ? list->path[pathindex] : ""; } /** * compose_path */ - + static void compose_path(char* output, int pathtype, int pathindex, const char* filename) { const char* basepath = get_path_for_filetype(pathtype, pathindex, NULL); char* p; - + *output = 0; if (basepath) { strcat(output, basepath); } - + if (*output && !is_pathsep(output[strlen(output) - 1])) { strcat(output, "/"); } - + strcat(output, filename); - + for (p = output; *p; p++) { if (*p == '\\') { *p = '/'; @@ -301,14 +301,14 @@ static void compose_path(char* output, int pathtype, int pathindex, const char* */ int osd_display_loading_rom_message(const char* name,struct rom_load_data *romdata) { - if (name) { + if (name) { ipinmame_logger("osd_display_loading_rom_message(): loading %-12s...", name); - } + } else { ipinmame_logger("osd_display_loading_rom_message():"); - } - - return 0; + } + + return 0; } /** @@ -317,10 +317,10 @@ int osd_display_loading_rom_message(const char* name,struct rom_load_data *romda int osd_get_path_count(int pathtype) { UINT32 count; - + get_path_for_filetype(pathtype, 0, &count); - - return (int)count; + + return (int)count; } /** @@ -354,57 +354,57 @@ osd_file* osd_fopen(int pathtype, int pathindex, const char *filename, const cha int i; struct stat st; char fullpath[1024]; - + for (i = 0; i < MAX_OPEN_FILES; i++) { if (openfile[i].handle == (int)NULL || openfile[i].handle == INVALID_HANDLE_VALUE) { break; } } - + if (i == MAX_OPEN_FILES) { return NULL; } - + file = &openfile[i]; memset(file, 0, sizeof(*file)); - + if (strchr(mode, 'r')) { access = O_RDONLY; } else if (strchr(mode, 'w')) { - access = O_WRONLY; + access = O_WRONLY; access |= (O_CREAT | O_TRUNC); } else if (strchr(mode, '+')) { access = O_RDWR; } - - compose_path(fullpath, pathtype, pathindex, filename); + + compose_path(fullpath, pathtype, pathindex, filename); ipinmame_logger("osd_fopen(): access=%08X, fullpath=%s", access, fullpath); - + stat(fullpath, &st); - + file->handle = open(fullpath, access, 0666); - + if (file->handle == INVALID_HANDLE_VALUE) { if (!(access & O_WRONLY) || errno != ENOENT) { ipinmame_logger("osd_fopen(): unable to open"); return NULL; } - + create_path(fullpath, 1); file->handle = open(fullpath, access, 0666); - + if (file->handle == INVALID_HANDLE_VALUE) { ipinmame_logger("osd_fopen(): unable to open"); return NULL; } } - + fstat(file->handle, &st); file->end = st.st_size; - - return file; + + return file; } /** @@ -426,25 +426,25 @@ UINT32 osd_fread(osd_file *file, void *buffer, UINT32 length) { UINT32 bytes_left = length; int bytes_to_copy; UINT32 result; - + if (file->offset >= file->bufferbase && file->offset < file->bufferbase + file->bufferbytes) { bytes_to_copy = file->bufferbase + file->bufferbytes - file->offset; - - if (bytes_to_copy > length) { + + if (bytes_to_copy > length) { bytes_to_copy = length; - } - + } + memcpy(buffer, &file->buffer[file->offset - file->bufferbase], bytes_to_copy); - + bytes_left -= bytes_to_copy; file->offset += bytes_to_copy; buffer = (UINT8 *)buffer + bytes_to_copy; - + if (bytes_left == 0) { return length; - } + } } - + if (file->offset != file->filepos) { if (lseek(file->handle, file->offset, SEEK_SET) == -1) { file->filepos = ~0; @@ -452,29 +452,29 @@ UINT32 osd_fread(osd_file *file, void *buffer, UINT32 length) { } file->filepos = file->offset; } - + if (length < FILE_BUFFER_SIZE / 2) { file->bufferbase = file->offset; file->bufferbytes = read(file->handle, file->buffer, FILE_BUFFER_SIZE); - + file->filepos += file->bufferbytes; - + bytes_to_copy = bytes_left; - + if (bytes_to_copy > file->bufferbytes) { bytes_to_copy = file->bufferbytes; } - + memcpy(buffer, file->buffer, bytes_to_copy); - + file->offset += bytes_to_copy; bytes_left -= bytes_to_copy; return length - bytes_left; } else { - result = read(file->handle, buffer, bytes_left); + result = read(file->handle, buffer, bytes_left); file->filepos += result; - + file->offset += result; bytes_left -= result; return length - bytes_left; @@ -487,22 +487,22 @@ UINT32 osd_fread(osd_file *file, void *buffer, UINT32 length) { UINT32 osd_fwrite(osd_file *file, const void *buffer, UINT32 length) { UINT32 result; - + file->bufferbytes = 0; - + if (lseek(file->handle, file->offset, SEEK_SET) == -1) { return 0; } - + result = write(file->handle, buffer, length); - + file->filepos += result; file->offset += result; - + if (file->offset > file->end) { file->end = file->offset; } - + return result; } @@ -520,10 +520,10 @@ UINT64 osd_fsize(osd_file *file) int osd_fseek(osd_file *file, INT64 offset, int whence) { switch (whence) { default: - case SEEK_SET: - file->offset = offset; + case SEEK_SET: + file->offset = offset; break; - case SEEK_CUR: + case SEEK_CUR: file->offset += offset; break; case SEEK_END: diff --git a/src/libpinmame/fileio.c b/src/libpinmame/fileio.c index a96210f34..90b51d836 100644 --- a/src/libpinmame/fileio.c +++ b/src/libpinmame/fileio.c @@ -107,7 +107,7 @@ struct _osd_file #if defined(_WIN32) || defined(_WIN64) DWORD bufferbytes; #else - unsigned long bufferbytes; + size_t bufferbytes; #endif UINT8 buffer[FILE_BUFFER_SIZE]; }; diff --git a/src/sound/2203intf.c b/src/sound/2203intf.c index deeb47651..c74a6460d 100644 --- a/src/sound/2203intf.c +++ b/src/sound/2203intf.c @@ -87,7 +87,7 @@ int YM2203_sh_start(const struct MachineSound *msound) volume = intf->mixing_level[i]>>16; /* high 16 bit */ stream[i] = stream_init(name,volume,rate,i,YM2203UpdateOne/*YM2203UpdateCallback*/); } - /* Initialize FM emurator */ + /* Initialize FM emulator */ if (YM2203Init(intf->num,intf->baseclock,rate,TimerHandler,IRQHandler) == 0) { /* Ready */ diff --git a/src/sound/adpcm.c b/src/sound/adpcm.c index 42aa1afd6..33bf7c666 100644 --- a/src/sound/adpcm.c +++ b/src/sound/adpcm.c @@ -75,7 +75,7 @@ static UINT8 num_voices; static struct ADPCMVoice adpcm[MAX_ADPCM]; /* step size index shift table */ -static int index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; +static const int index_shift[8] = { -1, -1, -1, -1, 2, 4, 6, 8 }; /* lookup table for the precomputed difference */ static int diff_lookup[49*16]; @@ -115,7 +115,7 @@ const UINT8 okim6295_volume_table[16] = static void compute_tables(void) { /* nibble to bit map */ - static int nbl2bit[16][4] = + static const int nbl2bit[16][4] = { { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, diff --git a/src/sound/tms320av120.c b/src/sound/tms320av120.c index e64ad8dac..f7986782e 100644 --- a/src/sound/tms320av120.c +++ b/src/sound/tms320av120.c @@ -542,7 +542,7 @@ int TMS320AV120_sh_start(const struct MachineSound *msound) intf = msound->sound_interface; /* initialize the chips */ - memset(&tms320av120, 0, sizeof(tms320av120)); + memset(tms320av120, 0, sizeof(tms320av120)); for (i = 0; i < intf->num; i++) { char stream_name[40]; diff --git a/src/state.c b/src/state.c index 3753da225..e900a139d 100644 --- a/src/state.c +++ b/src/state.c @@ -48,7 +48,7 @@ enum { #ifdef VERBOSE static const char *ss_type[] = { "i8", "u8", "i16", "u16", "i32", "u32", "int", "dbl", "flt" }; #endif -static int ss_size[] = { 1, 1, 2, 2, 4, 4, 4, 8, 4 }; +static const int ss_size[] = { 1, 1, 2, 2, 4, 4, 4, 8, 4 }; static void ss_c2(unsigned char *, unsigned); static void ss_c4(unsigned char *, unsigned); diff --git a/src/win32com/DisplayInfoList.cpp b/src/win32com/DisplayInfoList.cpp index 1f800fbc1..2c106cae8 100644 --- a/src/win32com/DisplayInfoList.cpp +++ b/src/win32com/DisplayInfoList.cpp @@ -143,4 +143,4 @@ size_t CDisplayInfoList::Count(void) const CDisplayInfo* CDisplayInfoList::Item(size_t index) { return &mDisplays.at( index ); -} \ No newline at end of file +}