From 9deeec3f9cec92bcf06ae2ee87381e2410d81a83 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 Apr 2015 09:46:24 +1000 Subject: [PATCH 01/10] Attempt Leopard compatibility --- src/osd/modules/sound/coreaudio_sound.c | 12 ++++++++++++ src/osd/sdl/aueffectutil.m | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/osd/modules/sound/coreaudio_sound.c b/src/osd/modules/sound/coreaudio_sound.c index 4dd9af04c8f..9090a937826 100644 --- a/src/osd/modules/sound/coreaudio_sound.c +++ b/src/osd/modules/sound/coreaudio_sound.c @@ -15,6 +15,7 @@ #ifdef SDLMAME_MACOSX +#include #include #include #include @@ -24,6 +25,17 @@ #include +#ifdef MAC_OS_X_VERSION_MAX_ALLOWED + +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + +typedef ComponentDescription AudioComponentDescription; + +#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1060 + +#endif // MAC_OS_X_VERSION_MAX_ALLOWED + + class sound_coreaudio : public osd_module, public sound_module { public: diff --git a/src/osd/sdl/aueffectutil.m b/src/osd/sdl/aueffectutil.m index f29bbf840d8..03dea64112d 100644 --- a/src/osd/sdl/aueffectutil.m +++ b/src/osd/sdl/aueffectutil.m @@ -18,6 +18,8 @@ #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +typedef ComponentDescription AudioComponentDescription; + @protocol NSWindowDelegate @end From 94149cd5a6a54aea6ae9099ba57fd96ade1c5338 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 Apr 2015 18:05:44 +1000 Subject: [PATCH 02/10] Proper C++ for DirectSound module, get rid of all static variables, some encapsulation --- src/osd/modules/sound/direct_sound.c | 533 ++++++++++++++++----------- 1 file changed, 323 insertions(+), 210 deletions(-) diff --git a/src/osd/modules/sound/direct_sound.c b/src/osd/modules/sound/direct_sound.c index 203ffc7c5e9..6bf2f7c40e4 100644 --- a/src/osd/modules/sound/direct_sound.c +++ b/src/osd/modules/sound/direct_sound.c @@ -43,135 +43,249 @@ // DEBUGGING //============================================================ -#define LOG_SOUND 0 +#define LOG_SOUND 0 + +#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0) -#define LOG(x) do { if (LOG_SOUND) logerror x; } while(0) class sound_direct_sound : public osd_module, public sound_module { public: - sound_direct_sound() - : osd_module(OSD_SOUND_PROVIDER, "dsound"), sound_module() + sound_direct_sound() : + osd_module(OSD_SOUND_PROVIDER, "dsound"), + sound_module(), + m_dsound(NULL), + m_bytes_per_sample(0), + m_primary_buffer(), + m_stream_buffer(), + m_stream_buffer_in(0), + m_buffer_underflows(0), + m_buffer_overflows(0) { } virtual ~sound_direct_sound() { } - virtual int init(const osd_options &options); + virtual int init(osd_options const &options); virtual void exit(); // sound_module - - virtual void update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame); + virtual void update_audio_stream(bool is_throttled, INT16 const *buffer, int samples_this_frame); virtual void set_mastervolume(int attenuation); private: - HRESULT dsound_init(); - void dsound_kill(); - HRESULT dsound_create_buffers(); - void dsound_destroy_buffers(); - void copy_sample_data(const INT16 *data, int bytes_to_copy); + class buffer + { + public: + buffer() : m_buffer(NULL) { } + ~buffer() { release(); } + ULONG release() + { + ULONG const result = m_buffer ? m_buffer->Release() : 0; + m_buffer = NULL; + return result; + } + + operator bool() const { return m_buffer; } + + protected: + LPDIRECTSOUNDBUFFER m_buffer; + }; + + class primary_buffer : public buffer + { + public: + HRESULT create(LPDIRECTSOUND dsound) + { + assert(!m_buffer); + DSBUFFERDESC desc; + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GETCURRENTPOSITION2; + desc.lpwfxFormat = NULL; + return dsound->CreateSoundBuffer(&desc, &m_buffer, NULL); + } + + HRESULT get_format(WAVEFORMATEX &format) + { + assert(m_buffer); + return m_buffer->GetFormat(&format, sizeof(format), NULL); + } + HRESULT set_format(WAVEFORMATEX const &format) + { + assert(m_buffer); + return m_buffer->SetFormat(&format); + } + }; + + class stream_buffer : public buffer + { + public: + stream_buffer() : m_size(0), m_bytes1(NULL), m_bytes2(NULL), m_locked1(0), m_locked2(0) { } + + HRESULT create(LPDIRECTSOUND dsound, DWORD size, WAVEFORMATEX &format) + { + assert(!m_buffer); + DSBUFFERDESC desc; + memset(&desc, 0, sizeof(desc)); + desc.dwSize = sizeof(desc); + desc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2; + desc.dwBufferBytes = size; + desc.lpwfxFormat = &format; + m_size = size; + return dsound->CreateSoundBuffer(&desc, &m_buffer, NULL); + } + + HRESULT play_looping() + { + assert(m_buffer); + return m_buffer->Play(0, 0, DSBPLAY_LOOPING); + } + HRESULT stop() + { + assert(m_buffer); + return m_buffer->Stop(); + } + HRESULT set_volume(LONG volume) + { + assert(m_buffer); + return m_buffer->SetVolume(volume); + } + HRESULT set_min_volume() { return set_volume(DSBVOLUME_MIN); } + + HRESULT get_current_positions(DWORD &play_pos, DWORD &write_pos) + { + assert(m_buffer); + return m_buffer->GetCurrentPosition(&play_pos, &write_pos); + } + HRESULT copy_data(DWORD cursor, DWORD bytes, void const *data) + { + HRESULT result = lock(cursor, bytes); + if (DS_OK != result) + return result; + + assert(m_bytes1); + assert((m_locked1 + m_locked2) >= bytes); + memcpy(m_bytes1, data, MIN(m_locked1, bytes)); + if (m_locked1 < bytes) + { + assert(m_bytes2); + memcpy(m_bytes2, (UINT8 const *)data + m_locked1, bytes - m_locked1); + } + + result = unlock(); + return DS_OK; + } + HRESULT clear() + { + HRESULT result = lock_all(); + if (DS_OK != result) + return result; + + assert(m_bytes1); + assert(!m_bytes2); + assert(m_size == m_locked1); + assert(0U == m_locked2); + memset(m_bytes1, 0, m_locked1); + + result = unlock(); + return DS_OK; + } + + DWORD size() const { return m_size; } + + protected: + HRESULT lock(DWORD cursor, DWORD bytes) + { + assert(cursor < m_size); + assert(bytes <= m_size); + assert(m_buffer); + assert(!m_bytes1); + return m_buffer->Lock( + cursor, bytes, + &m_bytes1, + &m_locked1, + &m_bytes2, + &m_locked2, + 0); + } + HRESULT lock_all() { return lock(0, m_size); } + HRESULT unlock() + { + assert(m_buffer); + assert(m_bytes1); + HRESULT const result = m_buffer->Unlock( + m_bytes1, + m_locked1, + m_bytes2, + m_locked2); + m_bytes1 = m_bytes2 = NULL; + m_locked1 = m_locked2 = 0; + return result; + } + + DWORD m_size; + void *m_bytes1, *m_bytes2; + DWORD m_locked1, m_locked2; + }; + + HRESULT dsound_init(); + void dsound_kill(); + HRESULT create_buffers(DWORD size, WAVEFORMATEX &format); + void destroy_buffers(); + + // DirectSound objects + LPDIRECTSOUND m_dsound; + + // descriptors and formats + UINT32 m_bytes_per_sample; + + // sound buffers + primary_buffer m_primary_buffer; + stream_buffer m_stream_buffer; + UINT32 m_stream_buffer_in; + + // buffer over/underflow counts + unsigned m_buffer_underflows; + unsigned m_buffer_overflows; }; - //============================================================ -// LOCAL VARIABLES +// init //============================================================ -// DirectSound objects -static LPDIRECTSOUND dsound; -static DSCAPS dsound_caps; - -// sound buffers -static LPDIRECTSOUNDBUFFER primary_buffer; -static LPDIRECTSOUNDBUFFER stream_buffer; -static UINT32 stream_buffer_size; -static UINT32 stream_buffer_in; - -// descriptors and formats -static DSBUFFERDESC primary_desc; -static DSBUFFERDESC stream_desc; -static WAVEFORMATEX primary_format; -static WAVEFORMATEX stream_format; - -// buffer over/underflow counts -static int buffer_underflows; -static int buffer_overflows; - -//============================================================ -// PROTOTYPES -//============================================================ - -//------------------------------------------------- -// sound_direct_sound - constructor -//------------------------------------------------- - -int sound_direct_sound::init(const osd_options &options) +int sound_direct_sound::init(osd_options const &options) { // attempt to initialize directsound // don't make it fatal if we can't -- we'll just run without sound dsound_init(); + m_buffer_underflows = m_buffer_overflows = 0; return 0; } +//============================================================ +// exit +//============================================================ + void sound_direct_sound::exit() { // kill the buffers and dsound - dsound_destroy_buffers(); + destroy_buffers(); dsound_kill(); // print out over/underflow stats - if (buffer_overflows || buffer_underflows) - osd_printf_verbose("Sound: buffer overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows); - - LOG(("Sound buffer: overflows=%d underflows=%d\n", buffer_overflows, buffer_underflows)); -} - - -//============================================================ -// copy_sample_data -//============================================================ - -void sound_direct_sound::copy_sample_data(const INT16 *data, int bytes_to_copy) -{ - void *buffer1, *buffer2; - DWORD length1, length2; - HRESULT result; - int cur_bytes; - - // attempt to lock the stream buffer - result = IDirectSoundBuffer_Lock(stream_buffer, stream_buffer_in, bytes_to_copy, &buffer1, &length1, &buffer2, &length2, 0); - - // if we failed, assume it was an underflow (i.e., - if (result != DS_OK) + if (m_buffer_overflows || m_buffer_underflows) { - buffer_underflows++; - return; + osd_printf_verbose( + "Sound: buffer overflows=%u underflows=%u\n", + m_buffer_overflows, + m_buffer_underflows); } - // adjust the input pointer - stream_buffer_in = (stream_buffer_in + bytes_to_copy) % stream_buffer_size; - - // copy the first chunk - cur_bytes = (bytes_to_copy > length1) ? length1 : bytes_to_copy; - memcpy(buffer1, data, cur_bytes); - - // adjust for the number of bytes - bytes_to_copy -= cur_bytes; - data = (INT16 *)((UINT8 *)data + cur_bytes); - - // copy the second chunk - if (bytes_to_copy != 0) - { - cur_bytes = (bytes_to_copy > length2) ? length2 : bytes_to_copy; - memcpy(buffer2, data, cur_bytes); - } - - // unlock - result = IDirectSoundBuffer_Unlock(stream_buffer, buffer1, length1, buffer2, length2); + LOG(("Sound buffer: overflows=%u underflows=%u\n", m_buffer_overflows, m_buffer_underflows)); } @@ -179,55 +293,66 @@ void sound_direct_sound::copy_sample_data(const INT16 *data, int bytes_to_copy) // update_audio_stream //============================================================ -void sound_direct_sound::update_audio_stream(bool is_throttled, const INT16 *buffer, int samples_this_frame) +void sound_direct_sound::update_audio_stream( + bool is_throttled, + INT16 const *buffer, + int samples_this_frame) { - int bytes_this_frame = samples_this_frame * stream_format.nBlockAlign; - DWORD play_position, write_position; + int const bytes_this_frame = samples_this_frame * m_bytes_per_sample; HRESULT result; // if no sound, there is no buffer - if (stream_buffer == NULL) + if (!m_stream_buffer) return; // determine the current play position - result = IDirectSoundBuffer_GetCurrentPosition(stream_buffer, &play_position, &write_position); - if (result == DS_OK) - { - DWORD stream_in; + DWORD play_position, write_position; + result = m_stream_buffer.get_current_positions(play_position, write_position); + if (DS_OK != result) + return; //DWORD orig_write = write_position; - // normalize the write position so it is always after the play position - if (write_position < play_position) - write_position += stream_buffer_size; + // normalize the write position so it is always after the play position + if (write_position < play_position) + write_position += m_stream_buffer.size(); - // normalize the stream in position so it is always after the write position - stream_in = stream_buffer_in; - if (stream_in < write_position) - stream_in += stream_buffer_size; + // normalize the stream in position so it is always after the write position + DWORD stream_in = m_stream_buffer_in; + if (stream_in < write_position) + stream_in += m_stream_buffer.size(); - // now we should have, in order: - // <------pp---wp---si---------------> + // now we should have, in order: + // <------pp---wp---si---------------> - // if we're between play and write positions, then bump forward, but only in full chunks - while (stream_in < write_position) - { -//printf("Underflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)stream_buffer_in, (int)bytes_this_frame); - buffer_underflows++; - stream_in += bytes_this_frame; - } - - // if we're going to overlap the play position, just skip this chunk - if (stream_in + bytes_this_frame > play_position + stream_buffer_size) - { -//printf("Overflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)stream_buffer_in, (int)bytes_this_frame); - buffer_overflows++; - return; - } - - // now we know where to copy; let's do it - stream_buffer_in = stream_in % stream_buffer_size; - copy_sample_data(buffer, bytes_this_frame); + // if we're between play and write positions, then bump forward, but only in full chunks + while (stream_in < write_position) + { +//printf("Underflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame); + m_buffer_underflows++; + stream_in += bytes_this_frame; } + + // if we're going to overlap the play position, just skip this chunk + if ((stream_in + bytes_this_frame) > (play_position + m_stream_buffer.size())) + { +//printf("Overflow: PP=%d WP=%d(%d) SI=%d(%d) BTF=%d\n", (int)play_position, (int)write_position, (int)orig_write, (int)stream_in, (int)m_stream_buffer_in, (int)bytes_this_frame); + m_buffer_overflows++; + return; + } + + // now we know where to copy; let's do it + m_stream_buffer_in = stream_in % m_stream_buffer.size(); + result = m_stream_buffer.copy_data(m_stream_buffer_in, bytes_this_frame, buffer); + + // if we failed, assume it was an underflow (i.e., + if (result != DS_OK) + { + m_buffer_underflows++; + return; + } + + // adjust the input pointer + m_stream_buffer_in = (m_stream_buffer_in + bytes_this_frame) % m_stream_buffer.size(); } @@ -238,14 +363,16 @@ void sound_direct_sound::update_audio_stream(bool is_throttled, const INT16 *buf void sound_direct_sound::set_mastervolume(int attenuation) { // clamp the attenuation to 0-32 range - if (attenuation > 0) - attenuation = 0; - if (attenuation < -32) - attenuation = -32; + attenuation = MAX(MIN(attenuation, 0), -32); // set the master volume - if (stream_buffer != NULL) - IDirectSoundBuffer_SetVolume(stream_buffer, (attenuation == -32) ? DSBVOLUME_MIN : attenuation * 100); + if (m_stream_buffer) + { + if (-32 == attenuation) + m_stream_buffer.set_min_volume(); + else + m_stream_buffer.set_volume(100 * attenuation); + } } @@ -255,22 +382,24 @@ void sound_direct_sound::set_mastervolume(int attenuation) HRESULT sound_direct_sound::dsound_init() { + assert(!m_dsound); HRESULT result; // create the DirectSound object - result = DirectSoundCreate(NULL, &dsound, NULL); + result = DirectSoundCreate(NULL, &m_dsound, NULL); if (result != DS_OK) { - osd_printf_error("Error creating DirectSound: %08x\n", (UINT32)result); + osd_printf_error("Error creating DirectSound: %08x\n", (unsigned)result); goto error; } // get the capabilities + DSCAPS dsound_caps; dsound_caps.dwSize = sizeof(dsound_caps); - result = IDirectSound_GetCaps(dsound, &dsound_caps); + result = m_dsound->GetCaps(&dsound_caps); if (result != DS_OK) { - osd_printf_error("Error getting DirectSound capabilities: %08x\n", (UINT32)result); + osd_printf_error("Error getting DirectSound capabilities: %08x\n", (unsigned)result); goto error; } @@ -280,47 +409,46 @@ HRESULT sound_direct_sound::dsound_init() SDL_VERSION(&wminfo.version); #if (SDLMAME_SDL2) SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo); - result = IDirectSound_SetCooperativeLevel(dsound, wminfo.info.win.window, DSSCL_PRIORITY); + result = m_dsound->SetCooperativeLevel(wminfo.info.win.window, DSSCL_PRIORITY); #else SDL_GetWMInfo(&wminfo); - result = IDirectSound_SetCooperativeLevel(dsound, wminfo.window, DSSCL_PRIORITY); + result = m_dsound->SetCooperativeLevel(wminfo.window, DSSCL_PRIORITY); #endif #else - result = IDirectSound_SetCooperativeLevel(dsound, win_window_list->m_hwnd, DSSCL_PRIORITY); + result = m_dsound->SetCooperativeLevel(win_window_list->m_hwnd, DSSCL_PRIORITY); #endif if (result != DS_OK) { - osd_printf_error("Error setting DirectSound cooperative level: %08x\n", (UINT32)result); + osd_printf_error("Error setting DirectSound cooperative level: %08x\n", (unsigned)result); goto error; } - // make a format description for what we want - stream_format.wBitsPerSample = 16; - stream_format.wFormatTag = WAVE_FORMAT_PCM; - stream_format.nChannels = 2; - stream_format.nSamplesPerSec = sample_rate(); - stream_format.nBlockAlign = stream_format.wBitsPerSample * stream_format.nChannels / 8; - stream_format.nAvgBytesPerSec = stream_format.nSamplesPerSec * stream_format.nBlockAlign; + { + // make a format description for what we want + WAVEFORMATEX stream_format; + stream_format.wBitsPerSample = 16; + stream_format.wFormatTag = WAVE_FORMAT_PCM; + stream_format.nChannels = 2; + stream_format.nSamplesPerSec = sample_rate(); + stream_format.nBlockAlign = stream_format.wBitsPerSample * stream_format.nChannels / 8; + stream_format.nAvgBytesPerSec = stream_format.nSamplesPerSec * stream_format.nBlockAlign; + // compute the buffer size based on the output sample rate + DWORD stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * m_audio_latency / 10; + stream_buffer_size = MAX(1024, (stream_buffer_size / 1024) * 1024); - // compute the buffer size based on the output sample rate - int audio_latency; - audio_latency = m_audio_latency; + LOG(("stream_buffer_size = %u\n", (unsigned)stream_buffer_size)); - stream_buffer_size = stream_format.nSamplesPerSec * stream_format.nBlockAlign * audio_latency / 10; - stream_buffer_size = (stream_buffer_size / 1024) * 1024; - if (stream_buffer_size < 1024) - stream_buffer_size = 1024; - - LOG(("stream_buffer_size = %d\n", stream_buffer_size)); - - // create the buffers - result = dsound_create_buffers(); - if (result != DS_OK) - goto error; + // create the buffers + m_bytes_per_sample = stream_format.nBlockAlign; + m_stream_buffer_in = 0; + result = create_buffers(stream_buffer_size, stream_format); + if (result != DS_OK) + goto error; + } // start playing - result = IDirectSoundBuffer_Play(stream_buffer, 0, 0, DSBPLAY_LOOPING); + result = m_stream_buffer.play_looping(); if (result != DS_OK) { osd_printf_error("Error playing: %08x\n", (UINT32)result); @@ -330,7 +458,7 @@ HRESULT sound_direct_sound::dsound_init() // error handling error: - dsound_destroy_buffers(); + destroy_buffers(); dsound_kill(); return result; } @@ -343,108 +471,93 @@ error: void sound_direct_sound::dsound_kill() { // release the object - if (dsound != NULL) - IDirectSound_Release(dsound); - dsound = NULL; + if (m_dsound) + m_dsound->Release(); + m_dsound = NULL; } //============================================================ -// dsound_create_buffers +// create_buffers //============================================================ -HRESULT sound_direct_sound::dsound_create_buffers() +HRESULT sound_direct_sound::create_buffers(DWORD size, WAVEFORMATEX &format) { + assert(m_dsound); + assert(!m_primary_buffer); + assert(!m_stream_buffer); HRESULT result; - void *buffer; - DWORD locked; - - // create a buffer desc for the primary buffer - memset(&primary_desc, 0, sizeof(primary_desc)); - primary_desc.dwSize = sizeof(primary_desc); - primary_desc.dwFlags = DSBCAPS_PRIMARYBUFFER | DSBCAPS_GETCURRENTPOSITION2; - primary_desc.lpwfxFormat = NULL; // create the primary buffer - result = IDirectSound_CreateSoundBuffer(dsound, &primary_desc, &primary_buffer, NULL); + result = m_primary_buffer.create(m_dsound); if (result != DS_OK) { - osd_printf_error("Error creating primary DirectSound buffer: %08x\n", (UINT32)result); + osd_printf_error("Error creating primary DirectSound buffer: %08x\n", (unsigned)result); goto error; } // attempt to set the primary format - result = IDirectSoundBuffer_SetFormat(primary_buffer, &stream_format); + result = m_primary_buffer.set_format(format); if (result != DS_OK) { - osd_printf_error("Error setting primary DirectSound buffer format: %08x\n", (UINT32)result); + osd_printf_error("Error setting primary DirectSound buffer format: %08x\n", (unsigned)result); goto error; } - // get the primary format - result = IDirectSoundBuffer_GetFormat(primary_buffer, &primary_format, sizeof(primary_format), NULL); + // log the primary format + WAVEFORMATEX primary_format; + result = m_primary_buffer.get_format(primary_format); if (result != DS_OK) { - osd_printf_error("Error getting primary DirectSound buffer format: %08x\n", (UINT32)result); + osd_printf_error("Error getting primary DirectSound buffer format: %08x\n", (unsigned)result); goto error; } - osd_printf_verbose("DirectSound: Primary buffer: %d Hz, %d bits, %d channels\n", - (int)primary_format.nSamplesPerSec, (int)primary_format.wBitsPerSample, (int)primary_format.nChannels); - - // create a buffer desc for the stream buffer - memset(&stream_desc, 0, sizeof(stream_desc)); - stream_desc.dwSize = sizeof(stream_desc); - stream_desc.dwFlags = DSBCAPS_CTRLVOLUME | DSBCAPS_GLOBALFOCUS | DSBCAPS_GETCURRENTPOSITION2; - stream_desc.dwBufferBytes = stream_buffer_size; - stream_desc.lpwfxFormat = &stream_format; + osd_printf_verbose( + "DirectSound: Primary buffer: %d Hz, %d bits, %d channels\n", + (int)primary_format.nSamplesPerSec, + (int)primary_format.wBitsPerSample, + (int)primary_format.nChannels); // create the stream buffer - result = IDirectSound_CreateSoundBuffer(dsound, &stream_desc, &stream_buffer, NULL); + result = m_stream_buffer.create(m_dsound, size, format); if (result != DS_OK) { - osd_printf_error("Error creating DirectSound stream buffer: %08x\n", (UINT32)result); + osd_printf_error("Error creating DirectSound stream buffer: %08x\n", (unsigned)result); goto error; } - // lock the buffer - result = IDirectSoundBuffer_Lock(stream_buffer, 0, stream_buffer_size, &buffer, &locked, NULL, NULL, 0); + // clear the buffer + result = m_stream_buffer.clear(); if (result != DS_OK) { - osd_printf_error("Error locking DirectSound stream buffer: %08x\n", (UINT32)result); + osd_printf_error("Error locking DirectSound stream buffer: %08x\n", (unsigned)result); goto error; } - // clear the buffer and unlock it - memset(buffer, 0, locked); - IDirectSoundBuffer_Unlock(stream_buffer, buffer, locked, NULL, 0); return DS_OK; // error handling error: - dsound_destroy_buffers(); + destroy_buffers(); return result; } //============================================================ -// dsound_destroy_buffers +// destroy_buffers //============================================================ -void sound_direct_sound::dsound_destroy_buffers(void) +void sound_direct_sound::destroy_buffers(void) { // stop any playback - if (stream_buffer != NULL) - IDirectSoundBuffer_Stop(stream_buffer); + if (m_stream_buffer) + m_stream_buffer.stop(); // release the stream buffer - if (stream_buffer != NULL) - IDirectSoundBuffer_Release(stream_buffer); - stream_buffer = NULL; + m_stream_buffer.release(); // release the primary buffer - if (primary_buffer != NULL) - IDirectSoundBuffer_Release(primary_buffer); - primary_buffer = NULL; + m_primary_buffer.release(); } #else /* SDLMAME_UNIX */ From 5523e7fffe24fbb1bdd7bd35dfa814c2c1761c08 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 Apr 2015 18:32:00 +1000 Subject: [PATCH 03/10] Small cleanup --- src/osd/modules/sound/direct_sound.c | 31 +++++++++++++++------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/osd/modules/sound/direct_sound.c b/src/osd/modules/sound/direct_sound.c index 6bf2f7c40e4..d82cdbe1298 100644 --- a/src/osd/modules/sound/direct_sound.c +++ b/src/osd/modules/sound/direct_sound.c @@ -404,19 +404,22 @@ HRESULT sound_direct_sound::dsound_init() } // set the cooperative level + { #ifdef SDLMAME_WIN32 - SDL_SysWMinfo wminfo; - SDL_VERSION(&wminfo.version); -#if (SDLMAME_SDL2) - SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo); - result = m_dsound->SetCooperativeLevel(wminfo.info.win.window, DSSCL_PRIORITY); -#else - SDL_GetWMInfo(&wminfo); - result = m_dsound->SetCooperativeLevel(wminfo.window, DSSCL_PRIORITY); -#endif - #else - result = m_dsound->SetCooperativeLevel(win_window_list->m_hwnd, DSSCL_PRIORITY); -#endif + SDL_SysWMinfo wminfo; + SDL_VERSION(&wminfo.version); +#if SDLMAME_SDL2 + SDL_GetWindowWMInfo(sdl_window_list->sdl_window(), &wminfo); + HWND const window = wminfo.info.win.window; +#else // SDLMAME_SDL2 + SDL_GetWMInfo(&wminfo); + HWND const window = wminfo.window; +#endif // SDLMAME_SDL2 +#else // SDLMAME_WIN32 + HWND const window = win_window_list->m_hwnd; +#endif // SDLMAME_WIN32 + result = m_dsound->SetCooperativeLevel(window, DSSCL_PRIORITY); + } if (result != DS_OK) { osd_printf_error("Error setting DirectSound cooperative level: %08x\n", (unsigned)result); @@ -560,8 +563,8 @@ void sound_direct_sound::destroy_buffers(void) m_primary_buffer.release(); } -#else /* SDLMAME_UNIX */ +#else // defined(OSD_WINDOWS) || defined(SDLMAME_WIN32) MODULE_NOT_SUPPORTED(sound_direct_sound, OSD_SOUND_PROVIDER, "dsound") -#endif +#endif // defined(OSD_WINDOWS) || defined(SDLMAME_WIN32) MODULE_DEFINITION(SOUND_DSOUND, sound_direct_sound) From b5dcd729f4f5b963961b0171216470853cc4be15 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 9 Apr 2015 10:59:07 +0200 Subject: [PATCH 04/10] (MESS)New working game added ----------------- Entex Space Invader [hap, Sean Riddle] --- src/mess/drivers/hh_hmcs40.c | 5 +- src/mess/drivers/hh_tms1k.c | 180 ++++++++++++++++++++++++++++------- src/mess/layout/einvader.lay | 85 +++++++++++++++++ src/mess/mess.lst | 1 + 4 files changed, 237 insertions(+), 34 deletions(-) create mode 100644 src/mess/layout/einvader.lay diff --git a/src/mess/drivers/hh_hmcs40.c b/src/mess/drivers/hh_hmcs40.c index 14ccef23591..ba936567bd5 100644 --- a/src/mess/drivers/hh_hmcs40.c +++ b/src/mess/drivers/hh_hmcs40.c @@ -989,6 +989,8 @@ MACHINE_CONFIG_END - P1 Up: Eat & Run - P1 Down: Demo + BTANB note: 1st version doesn't show the whole maze on power-on + NOTE!: MESS external artwork is recommended ***************************************************************************/ @@ -1103,8 +1105,7 @@ MACHINE_CONFIG_END - P1 Down: Head-to-Head Ms. Pac-Man (2-player mode) - P1 Up: Demo - BTANB note: in demo-mode, she hardly walks to the upper two rows, never - finishing the level. + BTANB note: in demo-mode, she hardly ever walks to the upper two rows NOTE!: MESS external artwork is recommended diff --git a/src/mess/drivers/hh_tms1k.c b/src/mess/drivers/hh_tms1k.c index 5a1008f8a15..8a5bfe45e35 100644 --- a/src/mess/drivers/hh_tms1k.c +++ b/src/mess/drivers/hh_tms1k.c @@ -19,6 +19,7 @@ @MP1030 TMS1100 1980, APF Mathemagician @MP1133 TMS1470 1979, Kosmos Astro @MP1204 TMS1100 1980, Entex Baseball 3 + @MP1211 TMS1100 1980, Entex Space Invader *MP1221 TMS1100 1980, Entex Raise The Devil *MP1312 TMS1100 198?, Tandy/RadioShack Science Fair Microcomputer Trainer *MP2105 TMS1370 1979, Gakken Poker, Entex Electronic Poker @@ -69,8 +70,8 @@ electronically (mpla is usually the default, opla is often custom) - unknown MCU clocks for some: TMS1000 and TMS1100 RC curve is documented in the data manual, but for TMS1400 it's unknown. TMS0970/0980 osc. is on-die. - - some of the games rely on the fact that faster(longer) strobed leds appear - brighter: tc4(offensive players), bankshot(cue ball) + - some of the games rely on the fact that faster/longer strobed leds appear + brighter: tc4(offensive players), bankshot(cue ball), ... - add softwarelist for tc4 cartridges? - stopthiep: unable to start a game (may be intentional?) @@ -86,6 +87,7 @@ #include "ebball.lh" #include "ebball2.lh" #include "ebball3.lh" +#include "einvader.lh" // test-layout(but still playable) #include "elecdet.lh" #include "comp4.lh" #include "mathmagi.lh" @@ -526,7 +528,7 @@ WRITE16_MEMBER(amaztron_state::write_r) WRITE16_MEMBER(amaztron_state::write_o) { - // O0-O6: digit segments + // O0-O6: led segments A-G // O7: N/C m_o = data & 0x7f; prepare_display(); @@ -688,7 +690,7 @@ WRITE16_MEMBER(tc4_state::write_r) WRITE16_MEMBER(tc4_state::write_o) { - // O0-O7: led row + // O0-O7: led state m_o = data; prepare_display(); } @@ -838,14 +840,14 @@ WRITE16_MEMBER(ebball_state::write_r) // R9: speaker out m_speaker->level_w(data >> 9 & 1); - // R0-R8: led columns + // R0-R8: led select m_r = data; prepare_display(); } WRITE16_MEMBER(ebball_state::write_o) { - // O0-O6: led row + // O0-O6: led state // O7: N/C m_o = data; prepare_display(); @@ -973,14 +975,14 @@ WRITE16_MEMBER(ebball2_state::write_r) // R10: speaker out m_speaker->level_w(data >> 10 & 1); - // R0-R9: led columns + // R0-R9: led select m_r = data; prepare_display(); } WRITE16_MEMBER(ebball2_state::write_o) { - // O0-O7: led row/segment + // O0-O7: led state m_o = data; prepare_display(); } @@ -1120,14 +1122,14 @@ WRITE16_MEMBER(ebball3_state::write_r) // R10: speaker out m_speaker->level_w(data >> 10 & 1); - // R0-R9: led columns + // R0-R9: led select m_r = data; prepare_display(); } WRITE16_MEMBER(ebball3_state::write_o) { - // O0-O6: led row + // O0-O6: led state // O7: N/C m_o = data & 0x7f; prepare_display(); @@ -1223,6 +1225,122 @@ MACHINE_CONFIG_END +/*************************************************************************** + + Entex Space Invader + * TMS1100 MP1211 (die labeled MP1211) + * 3 7seg LEDs, LED matrix and overlay mask, 1bit sound + + There are two versions of this game: the first release(this one) is on + TMS1100, the second more widespread release runs on a COP400. There are + also differences with the overlay mask. + + NOTE!: MESS external artwork is recommended + +***************************************************************************/ + +class einvader_state : public hh_tms1k_state +{ +public: + einvader_state(const machine_config &mconfig, device_type type, const char *tag) + : hh_tms1k_state(mconfig, type, tag) + { } + + void prepare_display(); + DECLARE_WRITE16_MEMBER(write_r); + DECLARE_WRITE16_MEMBER(write_o); + + void set_clock(); + DECLARE_INPUT_CHANGED_MEMBER(difficulty_switch); + +protected: + virtual void machine_reset(); +}; + +// handlers + +void einvader_state::prepare_display() +{ + // R7-R9 are 7segs + for (int y = 7; y < 10; y++) + m_display_segmask[y] = 0x7f; + + display_matrix(8, 10, m_o, m_r); +} + +WRITE16_MEMBER(einvader_state::write_r) +{ + // R10: speaker out + m_speaker->level_w(data >> 10 & 1); + + // R0-R9: led select + m_r = data; + prepare_display(); +} + +WRITE16_MEMBER(einvader_state::write_o) +{ + // O0-O7: led state + m_o = data; + prepare_display(); +} + + +// config + +static INPUT_PORTS_START( einvader ) + PORT_START("IN.0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_16WAY // separate directional buttons, hence 16way + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_16WAY // " + PORT_CONFNAME( 0x08, 0x00, DEF_STR( Difficulty ) ) PORT_CHANGED_MEMBER(DEVICE_SELF, einvader_state, difficulty_switch, NULL) + PORT_CONFSETTING( 0x00, "Amateur" ) + PORT_CONFSETTING( 0x08, "Professional" ) +INPUT_PORTS_END + +INPUT_CHANGED_MEMBER(einvader_state::difficulty_switch) +{ + set_clock(); +} + + +void einvader_state::set_clock() +{ + // MCU clock is from an RC circuit(R=47K, C=56pf) oscillating by default at ~320kHz, + // but on PRO, the difficulty switch adds an extra 180K resistor to Vdd to speed + // it up to around ~400kHz. + m_maincpu->set_unscaled_clock((m_inp_matrix[0]->read() & 8) ? 400000 : 320000); +} + +void einvader_state::machine_reset() +{ + hh_tms1k_state::machine_reset(); + set_clock(); +} + +static MACHINE_CONFIG_START( einvader, einvader_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1100, 320000) // see set_clock + MCFG_TMS1XXX_READ_K_CB(IOPORT("IN.0")) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(einvader_state, write_r)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(einvader_state, write_o)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) + MCFG_DEFAULT_LAYOUT(layout_einvader) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + + + /*************************************************************************** Ideal Electronic Detective @@ -1396,14 +1514,14 @@ WRITE16_MEMBER(starwbc_state::write_r) // R9: speaker out m_speaker->level_w(data >> 9 & 1); - // R0,R2,R4,R6,R8: led columns + // R0,R2,R4,R6,R8: led select m_r = data & 0x155; prepare_display(); } WRITE16_MEMBER(starwbc_state::write_o) { - // O0-O7: led row + // O0-O7: led state m_o = (data << 4 & 0xf0) | (data >> 4 & 0x0f); prepare_display(); } @@ -1521,14 +1639,14 @@ WRITE16_MEMBER(astro_state::write_r) // R0-R7: input mux m_inp_mux = data & 0xff; - // R0-R9: select digit/leds + // R0-R9: led select m_r = data; prepare_display(); } WRITE16_MEMBER(astro_state::write_o) { - // O0-O7: digit segments/leds + // O0-O7: led state m_o = data; prepare_display(); } @@ -1732,7 +1850,6 @@ public: { } DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); DECLARE_READ8_MEMBER(read_k); }; @@ -1756,11 +1873,6 @@ WRITE16_MEMBER(simon_state::write_r) m_inp_mux = (data & 7) | (data >> 6 & 8); } -WRITE16_MEMBER(simon_state::write_o) -{ - // N/C -} - READ8_MEMBER(simon_state::read_k) { return read_inputs(4); @@ -1803,7 +1915,6 @@ static MACHINE_CONFIG_START( simon, simon_state ) MCFG_CPU_ADD("maincpu", TMS1000, 350000) // RC osc. R=33K, C=100pf -> ~350kHz MCFG_TMS1XXX_READ_K_CB(READ8(simon_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(simon_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(simon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_simon) @@ -1839,7 +1950,6 @@ public: { } DECLARE_WRITE16_MEMBER(write_r); - DECLARE_WRITE16_MEMBER(write_o); DECLARE_READ8_MEMBER(read_k); void set_clock(); @@ -1866,11 +1976,6 @@ WRITE16_MEMBER(ssimon_state::write_r) m_speaker->level_w(data >> 8 & 1); } -WRITE16_MEMBER(ssimon_state::write_o) -{ - // N/C -} - READ8_MEMBER(ssimon_state::read_k) { return read_inputs(6); @@ -1954,7 +2059,6 @@ static MACHINE_CONFIG_START( ssimon, ssimon_state ) MCFG_CPU_ADD("maincpu", TMS1100, 275000) // see set_clock MCFG_TMS1XXX_READ_K_CB(READ8(ssimon_state, read_k)) MCFG_TMS1XXX_WRITE_R_CB(WRITE16(ssimon_state, write_r)) - MCFG_TMS1XXX_WRITE_O_CB(WRITE16(ssimon_state, write_o)) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_decay", hh_tms1k_state, display_decay_tick, attotime::from_msec(1)) MCFG_DEFAULT_LAYOUT(layout_ssimon) @@ -2360,14 +2464,14 @@ WRITE16_MEMBER(bankshot_state::write_r) // R2,R3: input mux m_inp_mux = data >> 2 & 3; - // R2-R10: led columns + // R2-R10: led select m_r = data & ~3; display_matrix(7, 11, m_o, m_r); } WRITE16_MEMBER(bankshot_state::write_o) { - // O0-O6: led row + // O0-O6: led state // O7: N/C m_o = data; display_matrix(7, 11, m_o, m_r); @@ -2484,14 +2588,14 @@ WRITE16_MEMBER(splitsec_state::write_r) // R9,R10: input mux m_inp_mux = data >> 9 & 3; - // R0-R7: led columns + // R0-R7: led select m_r = data; display_matrix(7, 8, m_o, m_r); } WRITE16_MEMBER(splitsec_state::write_o) { - // O0-O6: led row + // O0-O6: led state // O7: N/C m_o = data; display_matrix(7, 8, m_o, m_r); @@ -2774,6 +2878,17 @@ ROM_START( ebball3 ) ROM_END +ROM_START( einvader ) + ROM_REGION( 0x0800, "maincpu", 0 ) + ROM_LOAD( "mp1211", 0x0000, 0x0800, CRC(b6efbe8e) SHA1(d7d54921dab22bb0c2956c896a5d5b56b6f64969) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_einvader_mpla.pla", 0, 867, CRC(7cc90264) SHA1(c6e1cf1ffb178061da9e31858514f7cd94e86990) ) + ROM_REGION( 365, "maincpu:opla", 0 ) + ROM_LOAD( "tms1100_einvader_opla.pla", 0, 365, CRC(490158e1) SHA1(61cace1eb09244663de98d8fb04d9459b19668fd) ) +ROM_END + + ROM_START( elecdet ) ROM_REGION( 0x1000, "maincpu", 0 ) ROM_LOAD( "mp6100a", 0x0000, 0x1000, CRC(6f396bb8) SHA1(1f104d4ca9bee0d4572be4779b7551dfe20c4f04) ) @@ -2956,6 +3071,7 @@ CONS( 1981, tc4, 0, 0, tc4, tc4, driver_device, 0, "Col CONS( 1979, ebball, 0, 0, ebball, ebball, driver_device, 0, "Entex", "Electronic Baseball (Entex)", GAME_SUPPORTS_SAVE ) CONS( 1979, ebball2, 0, 0, ebball2, ebball2, driver_device, 0, "Entex", "Electronic Baseball 2 (Entex)", GAME_SUPPORTS_SAVE ) CONS( 1980, ebball3, 0, 0, ebball3, ebball3, driver_device, 0, "Entex", "Electronic Baseball 3 (Entex)", GAME_SUPPORTS_SAVE ) +CONS( 1980, einvader, 0, 0, einvader, einvader, driver_device, 0, "Entex", "Space Invader (Entex, TMS1100)", GAME_SUPPORTS_SAVE | GAME_REQUIRES_ARTWORK ) CONS( 1979, elecdet, 0, 0, elecdet, elecdet, driver_device, 0, "Ideal", "Electronic Detective", GAME_SUPPORTS_SAVE ) // *** diff --git a/src/mess/layout/einvader.lay b/src/mess/layout/einvader.lay new file mode 100644 index 00000000000..81021899dbf --- /dev/null +++ b/src/mess/layout/einvader.lay @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mess/mess.lst b/src/mess/mess.lst index b385b9910f8..78a0f58c654 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -2205,6 +2205,7 @@ tc4 // Coleco ebball // Entex ebball2 // Entex ebball3 // Entex +einvader // Entex elecdet // Ideal starwbc // Kenner starwbcp // Kenner (prototype) From e02dc16bc58d7baf11e98126150ebc8f14f14e25 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Thu, 9 Apr 2015 19:01:28 +1000 Subject: [PATCH 05/10] hng64: fix for Kale (nw) --- src/mame/audio/hng64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mame/audio/hng64.c b/src/mame/audio/hng64.c index 023882aa895..7283097d7a7 100644 --- a/src/mame/audio/hng64.c +++ b/src/mame/audio/hng64.c @@ -379,7 +379,7 @@ WRITE_LINE_MEMBER(hng64_state::tcu_tm2_cb) MACHINE_CONFIG_FRAGMENT( hng64_audio ) - MCFG_CPU_ADD("audiocpu", V53A, 32000000*2) // V53A, 16? mhz! + MCFG_CPU_ADD("audiocpu", V53A, 32000000/2) // V53A, 16? mhz! MCFG_CPU_PROGRAM_MAP(hng_sound_map) MCFG_CPU_IO_MAP(hng_sound_io) MCFG_V53_DMAU_OUT_HREQ_CB(WRITELINE(hng64_state, dma_hreq_cb)) From 73dfafaa95821a8983bc639004e849ae59e7e5c4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 9 Apr 2015 13:05:10 +0200 Subject: [PATCH 06/10] removed vconv, updated warnings/error for vs and icl (nw) --- scripts/genie.lua | 168 +++++------ src/osd/windows/vconv.c | 596 ---------------------------------------- 2 files changed, 84 insertions(+), 680 deletions(-) delete mode 100644 src/osd/windows/vconv.c diff --git a/scripts/genie.lua b/scripts/genie.lua index c907c87cf13..60539aca51b 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -946,95 +946,95 @@ configuration { "vs*" } } buildoptions { - "/wd4025", - "/wd4003", - "/wd4018", - "/wd4061", - "/wd4100", - "/wd4127", - "/wd4131", - "/wd4141", - "/wd4146", - "/wd4150", - "/wd4189", - "/wd4191", - "/wd4201", - "/wd4232", - "/wd4242", - "/wd4244", - "/wd4250", - "/wd4255", - "/wd4296", - "/wd4306", - "/wd4310", - "/wd4312", - "/wd4324", - "/wd4347", - "/wd4435", - "/wd4510", - "/wd4512", - "/wd4514", - "/wd4571", - "/wd4610", - "/wd4611", - "/wd4619", - "/wd4625", - "/wd4626", - "/wd4640", - "/wd4668", - "/wd4702", - "/wd4706", - "/wd4710", - "/wd4711", - "/wd4805", - "/wd4820", - "/wd4826", - "/wd4365", - "/wd4389", - "/wd4245", - "/wd4388", - "/wd4267", - "/wd4005", - "/wd4350", - "/wd4996", - "/wd4191", - "/wd4060", - "/wd4065", - "/wd4640", - "/wd4290", - "/wd4355", - "/wd4800", - "/wd4371", - "/wd4548", + "/wd4025", -- warning C4025: 'number' : based pointer passed to function with variable arguments: parameter number + "/wd4003", -- warning C4003: not enough actual parameters for macro 'xxx' + "/wd4018", -- warning C4018: 'x' : signed/unsigned mismatch + "/wd4061", -- warning C4061: enumerator 'xxx' in switch of enum 'xxx' is not explicitly handled by a case label + "/wd4100", -- warning C4100: 'xxx' : unreferenced formal parameter + "/wd4127", -- warning C4127: conditional expression is constant + "/wd4131", -- warning C4131: 'xxx' : uses old-style declarator + "/wd4141", -- warning C4141: 'xxx' : used more than once + "/wd4146", -- warning C4146: unary minus operator applied to unsigned type, result still unsigned + "/wd4150", -- warning C4150: deletion of pointer to incomplete type 'xxx'; no destructor called + "/wd4189", -- warning C4189: 'xxx' : local variable is initialized but not referenced + "/wd4191", -- warning C4191: 'type cast' : unsafe conversion from 'xxx' to 'xxx' // 64-bit only + "/wd4201", -- warning C4201: nonstandard extension used : nameless struct/union + "/wd4232", -- warning C4232: nonstandard extension used : 'xxx' : address of dllimport 'xxx' is not static, identity not guaranteed + "/wd4242", -- warning C4242: 'x' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4244", -- warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data + "/wd4250", -- warning C4250: 'xxx' : inherits 'xxx' via dominance + "/wd4255", -- warning C4255: 'xxx' : no function prototype given: converting '()' to '(void)' + "/wd4296", -- warning C4296: 'x' : expression is always false + "/wd4306", -- warning C4306: 'xxx': conversion from 'type1' to 'type2' of greater size // 64-bit only + "/wd4310", -- warning C4310: cast truncates constant value + "/wd4312", -- warning C4312: 'type cast' : conversion from 'xxx' to 'xxx' of greater size + "/wd4324", -- warning C4324: 'xxx' : structure was padded due to __declspec(align()) + "/wd4347", -- warning C4347: behavior change: 'xxx' is called instead of 'xxx' // obsolete VS2005 - VS2010 only + "/wd4435", -- warning C4435: 'xxx' : Object layout under /vd2 will change due to virtual base 'xxx' + "/wd4510", -- warning C4510: 'xxx' : default constructor could not be generated + "/wd4512", -- warning C4512: 'xxx' : assignment operator could not be generated + "/wd4514", -- warning C4514: 'xxx' : unreferenced inline function has been removed + "/wd4571", -- warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable + "/wd4610", -- warning C4619: #pragma warning : there is no warning number 'xxx' + "/wd4611", -- warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught + "/wd4619", -- warning C4610: struct 'xxx' can never be instantiated - user defined constructor required + "/wd4625", -- warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted + "/wd4626", -- warning C4626: 'xxx' : assignment operator could not be generated because a base class assignment operator is inaccessible or deleted + "/wd4640", -- warning C4640: 'xxx' : construction of local static object is not thread-safe + "/wd4668", -- warning C4668: 'xxx' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' + "/wd4702", -- warning C4702: unreachable code + "/wd4706", -- warning C4706: assignment within conditional expression + "/wd4710", -- warning C4710: 'xxx' : function not inlined + "/wd4711", -- warning C4711: function 'xxx' selected for automatic inline expansion // optimized only + "/wd4805", -- warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation + "/wd4820", -- warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx' + "/wd4826", -- warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only + "/wd4365", -- warning C4365: 'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch + "/wd4389", -- warning C4389: 'operator' : signed/unsigned mismatch + "/wd4245", -- warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch + "/wd4388", -- warning C4388: + "/wd4267", -- warning C4267: 'var' : conversion from 'size_t' to 'type', possible loss of data + "/wd4005", -- warning C4005: The macro identifier is defined twice. The compiler uses the second macro definition + "/wd4350", -- warning C4350: behavior change: 'member1' called instead of 'member2' + "/wd4996", -- warning C4996: 'function': was declared deprecated + "/wd4191", -- warning C4191: 'operator/operation' : unsafe conversion from 'type of expression' to 'type required' + "/wd4060", -- warning C4060: switch statement contains no 'case' or 'default' labels + "/wd4065", -- warning C4065: switch statement contains 'default' but no 'case' labels + "/wd4640", -- warning C4640: 'instance' : construction of local static object is not thread-safe + "/wd4290", -- warning C4290: + "/wd4355", -- warning C4355: 'this' : used in base member initializer list + "/wd4800", -- warning C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) + "/wd4371", -- warning C4371: + "/wd4548", -- warning C4548: expression before comma has no effect; expected expression with side-effect } if _OPTIONS["vs"]=="intel-15" then buildoptions { - "/Qwd9", - "/Qwd82", - "/Qwd111", - "/Qwd128", - "/Qwd177", - "/Qwd181", - "/Qwd185", - "/Qwd280", - "/Qwd344", - "/Qwd411", - "/Qwd869", - "/Qwd2545", - "/Qwd2553", - "/Qwd2557", - "/Qwd3280", + "/Qwd9", -- remark #9: nested comment is not allowed + "/Qwd82", -- remark #82: storage class is not first + "/Qwd111", -- remark #111: statement is unreachable + "/Qwd128", -- remark #128: loop is not reachable + "/Qwd177", -- remark #177: function "xxx" was declared but never referenced + "/Qwd181", -- remark #181: argument of type "UINT32={unsigned int}" is incompatible with format "%d", expecting argument of type "int" + "/Qwd185", -- remark #185: dynamic initialization in unreachable code + "/Qwd280", -- remark #280: selector expression is constant + "/Qwd344", -- remark #344: typedef name has already been declared (with same type) + "/Qwd411", -- remark #411: class "xxx" defines no constructor to initialize the following + "/Qwd869", -- remark #869: parameter "xxx" was never referenced + "/Qwd2545", -- remark #2545: empty dependent statement in "else" clause of if - statement + "/Qwd2553", -- remark #2553: nonstandard second parameter "TCHAR={WCHAR = { __wchar_t } } **" of "main", expected "char *[]" or "char **" extern "C" int _tmain(int argc, TCHAR **argv) + "/Qwd2557", -- remark #2557: comparison between signed and unsigned operands + "/Qwd3280", -- remark #3280: declaration hides member "attotime::seconds" (declared at line 126) static attotime from_seconds(INT32 seconds) { return attotime(seconds, 0); } - "/Qwd170", - "/Qwd188", + "/Qwd170", -- error #170: pointer points outside of underlying object + "/Qwd188", -- error #188: enumerated type mixed with another type - "/Qwd63", - "/Qwd177", - "/Qwd186", - "/Qwd488", - "/Qwd1478", - "/Qwd1879", - "/Qwd3291", + "/Qwd63", -- warning #63: shift count is too large + "/Qwd177", -- warning #177: label "xxx" was declared but never referenced + "/Qwd186", -- warning #186: pointless comparison of unsigned integer with zero + "/Qwd488", -- warning #488: template parameter "_FunctionClass" is not used in declaring the parameter types of function template "device_delegate<_Signature>::device_delegate<_FunctionClass>(delegate<_Signature>: + "/Qwd1478", -- warning #1478: function "xxx" (declared at line yyy of "zzz") was declared deprecated + "/Qwd1879", -- warning #1879: unimplemented pragma ignored + "/Qwd3291", -- warning #3291: invalid narrowing conversion from "double" to "int" "/Qwd1195", "/Qwd1786", "/Qwd592", -- For lua, false positive? diff --git a/src/osd/windows/vconv.c b/src/osd/windows/vconv.c deleted file mode 100644 index 01d6d8307b3..00000000000 --- a/src/osd/windows/vconv.c +++ /dev/null @@ -1,596 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -//============================================================ -// -// vconv.c - VC++ parameter conversion code -// -//============================================================ - -#define WIN32_LEAN_AND_MEAN -#include - -#include -#include - -//============================================================ -// CONSTANTS -//============================================================ - -#define PRINT_COMMAND_LINE 0 - -#define VS6 0x00060000 -#define VS7 0x00070000 -#define VS71 0x0007000a -#define VS2005 0x00080000 -#define VS2008 0x00090000 -#define VS2010 0x00100000 -#define VS2012 0x00110000 -#define VS2013 0x00120000 - - - -//============================================================ -// TYPE DEFINITIONS -//============================================================ - -typedef struct -{ - DWORD vc_version; - const char *gcc_option; - const char *vc_option; -} translation_info; - - - -//============================================================ -// TRANSLATION TABLES -//============================================================ - -static const translation_info gcc_translate[] = -{ - { 0, "-D*", "/D*" }, - { 0, "-U*", "/U*" }, - { 0, "-I*", "/I*" }, - { 0, "-o*", "~*" }, - { 0, "-include*", "/FI*" }, - { 0, "-c", "/c~/Fo" }, - { 0, "-E", "/c~/E >" }, - { 0, "-S", "/c~/Fa" }, - { VS7, "-O0", "/Od /GS /Oi" }, - { 0, "-O0", "/Od" }, - { 0, "-O1", "/O2" }, - { 0, "-O2", "/O2" }, - { 0, "-O3", "/Ox" }, - { 0, "-Os", "/O1" }, - { 0, "-g*", "/Zi" }, - { VS2005, "-fno-strict-aliasing", "" }, // deprecated in VS2005 - { 0, "-fno-strict-aliasing", "/Oa" }, - { 0, "-fno-omit-frame-pointer", "" }, - { 0, "-fomit-frame-pointer", "" }, - { 0, "-Werror", "/WX" }, - // warning C4003: not enough actual parameters for macro 'xxx' - // warning C4018: 'x' : signed/unsigned mismatch - // warning C4061: enumerator 'xxx' in switch of enum 'xxx' is not explicitly handled by a case label - // warning C4100: 'xxx' : unreferenced formal parameter - // warning C4127: conditional expression is constant - // warning C4131: 'xxx' : uses old-style declarator - // warning C4141: 'xxx' : used more than once - // warning C4146: unary minus operator applied to unsigned type, result still unsigned - // warning C4150: deletion of pointer to incomplete type 'xxx'; no destructor called - // warning C4189: 'xxx' : local variable is initialized but not referenced - // warning C4191: 'type cast' : unsafe conversion from 'xxx' to 'xxx' // 64-bit only - // warning C4201: nonstandard extension used : nameless struct/union - // warning C4232: nonstandard extension used : 'xxx' : address of dllimport 'xxx' is not static, identity not guaranteed - // warning C4242: 'x' : conversion from 'xxx' to 'xxx', possible loss of data - // warning C4244: 'argument' : conversion from 'xxx' to 'xxx', possible loss of data - // warning C4250: 'xxx' : inherits 'xxx' via dominance - // warning C4255: 'xxx' : no function prototype given: converting '()' to '(void)' - // warning C4296: 'x' : expression is always false - // warning C4306: 'xxx': conversion from 'type1' to 'type2' of greater size // 64-bit only - // warning C4310: cast truncates constant value - // warning C4312: 'type cast' : conversion from 'xxx' to 'xxx' of greater size - // warning C4324: 'xxx' : structure was padded due to __declspec(align()) - // warning C4347: behavior change: 'xxx' is called instead of 'xxx' // obsolete VS2005 - VS2010 only - // warning C4435: 'xxx' : Object layout under /vd2 will change due to virtual base 'xxx' - // warning C4510: 'xxx' : default constructor could not be generated - // warning C4512: 'xxx' : assignment operator could not be generated - // warning C4514: 'xxx' : unreferenced inline function has been removed - // warning C4611: interaction between '_setjmp' and C++ object destruction is non-portable - // warning C4619: #pragma warning : there is no warning number 'xxx' - // warning C4571: Informational: catch(...) semantics changed since Visual C++ 7.1; structured exceptions (SEH) are no longer caught - // warning C4610: struct 'xxx' can never be instantiated - user defined constructor required - // warning C4625: 'xxx' : copy constructor could not be generated because a base class copy constructor is inaccessible or deleted - // warning C4626: 'xxx' : assignment operator could not be generated because a base class assignment operator is inaccessible or deleted - // warning C4640: 'xxx' : construction of local static object is not thread-safe - // warning C4668: 'xxx' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif' - // warning C4702: unreachable code - // warning C4706: assignment within conditional expression - // warning C4710: 'xxx' : function not inlined - // warning C4711: function 'xxx' selected for automatic inline expansion // optimized only - // warning C4805: 'x' : unsafe mix of type 'xxx' and type 'xxx' in operation - // warning C4820: 'xxx' : 'x' bytes padding added after data member 'xxx' - // warning C4826: Conversion from 'type1 ' to 'type_2' is sign-extended. This may cause unexpected runtime behavior. // 32-bit only - { VS7, "-Wall", "/Wall /W4 /wd4003 /wd4018 /wd4061 /wd4100 /wd4127 /wd4131 /wd4141 /wd4146 /wd4150 /wd4189 /wd4191 /wd4201 /wd4232 /wd4242 /wd4244 /wd4250 /wd4255 /wd4296 /wd4306 /wd4310 /wd4312 /wd4324 /wd4347 /wd4435 /wd4510 /wd4512 /wd4514 /wd4571 /wd4610 /wd4611 /wd4619 /wd4625 /wd4626 /wd4640 /wd4668 /wd4702 /wd4706 /wd4710 /wd4711 /wd4805 /wd4820 /wd4826" }, - { 0, "-Wall", "/W0" }, - { VS7, "-Wno-unused", "/wd4100 /wd4101 /wd4102 /wd4505" }, - { 0, "-Wno-sign-compare", "/wd4365 /wd4389 /wd4245 /wd4388" }, - { 0, "-W*", "" }, - { VS2005, "-march=*", "" }, // deprecated in VS2005 - { 0, "-march=pentium", "/G5" }, - { 0, "-march=pentiumpro", "/G6" }, - { 0, "-march=pentium3", "/G6" }, - { 0, "-march=pentium-m", "/G6" }, - { 0, "-march=athlon", "/G7" }, - { 0, "-march=pentium4", "/G7" }, - { 0, "-march=athlon64", "/G7" }, - // TODO: the x64 compiler doesn't have the /arch:SSE* - { VS71, "-msse", "/arch:SSE" }, - { 0, "-msse", "" }, - { VS71, "-msse2", "/arch:SSE2" }, - { 0, "-msse2", "" }, - { 0, "-msse3", "" }, - { VS2010, "-mavx", "/arch:AVX" }, - // TODO: introduced in Visual Studio 2013 Update 2, version 12.0.34567.1 - //{ 0, "-mavx2", "/arch:AVX2" }, - { 0, "-mwindows", "" }, - { 0, "-mno-cygwin", "" }, - { 0, "-std=gnu89", "" }, - { 0, "-std=gnu++98", "/TP" }, - { 0, "-pipe", "" }, - { 0, "-x", "" }, - { 0, "c++", "" }, - { 0, "-flto", "/GL" }, - { 0, "-fno-optimize-sibling-calls", "" }, - { VS2005, "-fopenmp", "/openmp" }, - { 0 } -}; - -static const translation_info ld_translate[] = -{ - { VS2008, "-lbufferoverflowu", "" }, - { 0, "-l*", "*.lib" }, - { 0, "-o*", "/out:*" }, - { 0, "-Wl,-Map,*", "/map:*" }, - { 0, "-Wl,--allow-multiple-definition", "/force:multiple" }, - { 0, "-Wl,--warn-common", "" }, - { 0, "-mno-cygwin", "" }, - { 0, "-s", "" }, - { 0, "-WO", "" }, - { 0, "-mconsole", "/subsystem:console" }, - { 0, "-mwindows", "/subsystem:windows" }, - { 0, "-municode", "" }, - { 0, "-static-libgcc", "" }, - { 0, "-static-libstdc++", "" }, - { 0, "-shared", "/dll" }, - { 0, "-flto", "/LTCG" }, - { 0 } -}; - -static const translation_info ar_translate[] = -{ - { 0, "-cr", "" }, - { 0, "/LTCG", "/LTCG" }, - { 0 } -}; - - -static const translation_info windres_translate[] = -{ - { 0, "-D*", "/D*" }, - { 0, "-U*", "/U*" }, - { 0, "-I*", "/I*" }, - { 0, "--include-dir*", "/I*" }, - { 0, "-o*", "/fo*" }, - { 0, "-O*", "" }, - { 0, "-i*", "*" }, - { 0 } -}; - - - -//============================================================ -// GLOBALS -//============================================================ - -static char command_line[32768]; - - - -//============================================================ -// get_exe_version -//============================================================ - -static DWORD get_exe_version(const char *executable) -{ - char path[MAX_PATH]; - void *version_info; - DWORD version_info_size, dummy; - void *sub_buffer; - UINT sub_buffer_size; - VS_FIXEDFILEINFO *info; - DWORD product_version; - char sub_block[2] = { '\\', '\0' }; - - // try to locate the executable - if (!SearchPath(NULL, executable, NULL, sizeof(path) / sizeof(path[0]), path, NULL)) - { - fprintf(stderr, "Cannot find %s\n", executable); - exit(-100); - } - - // determine the size of the version info - version_info_size = GetFileVersionInfoSize(path, &dummy); - if (version_info_size == 0) - { - switch(GetLastError()) - { - case ERROR_RESOURCE_TYPE_NOT_FOUND: - fprintf(stderr, "\"%s\" does not contain version info; this is probably not a MSVC executable\n", path); - break; - - default: - fprintf(stderr, "GetFileVersionInfoSize() failed\n"); - break; - } - exit(-100); - } - - // allocate the memory; using GlobalAlloc() so that we do not - // unintentionally uses malloc() overrides - version_info = GlobalAlloc(GMEM_FIXED, version_info_size); - if (!version_info) - { - fprintf(stderr, "Out of memory\n"); - exit(-100); - } - - // retrieve the version info - if (!GetFileVersionInfo(path, 0, version_info_size, version_info)) - { - GlobalFree(version_info); - fprintf(stderr, "GetFileVersionInfo() failed\n"); - exit(-100); - } - - // extract the VS_FIXEDFILEINFO from the version info - if (!VerQueryValue(version_info, sub_block, &sub_buffer, &sub_buffer_size)) - { - GlobalFree(version_info); - fprintf(stderr, "VerQueryValue() failed\n"); - exit(-100); - } - - info = (VS_FIXEDFILEINFO *) sub_buffer; - product_version = info->dwProductVersionMS; - - GlobalFree(version_info); - return product_version; -} - - - -//============================================================ -// build_command_line -//============================================================ - -// TODO: VS2012 and up enable SSE2 instructions by default for x86 - we should make older versions consistent with this -static void build_command_line(int argc, char *argv[]) -{ - const translation_info *transtable; - const char *executable; - const char *outstring = ""; - char *dst = command_line; - int output_is_first = 0; - int icl_compile = 0; - int parampos = 2; - int param; - DWORD exe_version = 0; - - // if no parameters, show usage - if (argc < 2) - { - fprintf(stderr, "Usage:\n vconv {gcc|ar|ld} [-icl] [param [...]]\n"); - exit(0); - } - - if (!strcmp(argv[2], "-icl")) - { - icl_compile = 1; - parampos = 3; - } - - // first parameter determines the type - if (!strcmp(argv[1], "gcc")) - { - transtable = gcc_translate; - - if (!icl_compile) - { - executable = "cl.exe"; - dst += sprintf(dst, "cl /nologo "); - } - else - { - executable = "icl.exe"; - dst += sprintf(dst, "icl /nologo"); - - /* ICL 14.0 generates more warnings than MSVC, for now turn them off */ - - dst += sprintf(dst, " /Qwd9 "); /* remark #9: nested comment is not allowed */ - dst += sprintf(dst, " /Qwd82 "); /* remark #82: storage class is not first */ - dst += sprintf(dst, " /Qwd111 "); /* remark #111: statement is unreachable */ - dst += sprintf(dst, " /Qwd128 "); /* remark #128: loop is not reachable */ - dst += sprintf(dst, " /Qwd177 "); /* remark #177: function "xxx" was declared but never referenced */ - dst += sprintf(dst, " /Qwd181 "); /* remark #181: argument of type "UINT32={unsigned int}" is incompatible with format "%d", expecting argument of type "int" */ - dst += sprintf(dst, " /Qwd185 "); /* remark #185: dynamic initialization in unreachable code */ - dst += sprintf(dst, " /Qwd280 "); /* remark #280: selector expression is constant */ - dst += sprintf(dst, " /Qwd344 "); /* remark #344: typedef name has already been declared (with same type) */ - dst += sprintf(dst, " /Qwd411 "); /* remark #411: class "xxx" defines no constructor to initialize the following */ - dst += sprintf(dst, " /Qwd869 "); /* remark #869: parameter "xxx" was never referenced */ - dst += sprintf(dst, " /Qwd2545 "); /* remark #2545: empty dependent statement in "else" clause of if - statement */ - dst += sprintf(dst, " /Qwd2553 "); /* remark #2553: nonstandard second parameter "TCHAR={WCHAR = { __wchar_t } } **" of "main", expected "char *[]" or "char **" extern "C" int _tmain(int argc, TCHAR **argv) */ - dst += sprintf(dst, " /Qwd2557 "); /* remark #2557: comparison between signed and unsigned operands */ - dst += sprintf(dst, " /Qwd3280 "); /* remark #3280: declaration hides member "attotime::seconds" (declared at line 126) static attotime from_seconds(INT32 seconds) { return attotime(seconds, 0); } */ - - dst += sprintf(dst, " /Qwd170 "); /* error #170: pointer points outside of underlying object */ - dst += sprintf(dst, " /Qwd188 "); /* error #188: enumerated type mixed with another type */ - - dst += sprintf(dst, " /Qwd63 "); /* warning #63: shift count is too large */ - dst += sprintf(dst, " /Qwd177 "); /* warning #177: label "xxx" was declared but never referenced */ - dst += sprintf(dst, " /Qwd186 "); /* warning #186: pointless comparison of unsigned integer with zero */ - dst += sprintf(dst, " /Qwd488 "); /* warning #488: template parameter "_FunctionClass" is not used in declaring the parameter types of function template "device_delegate<_Signature>::device_delegate<_FunctionClass>(delegate<_Signature>: */ - dst += sprintf(dst, " /Qwd1478 "); /* warning #1478: function "xxx" (declared at line yyy of "zzz") was declared deprecated */ - dst += sprintf(dst, " /Qwd1879 "); /* warning #1879: unimplemented pragma ignored */ - dst += sprintf(dst, " /Qwd3291 "); /* warning #3291: invalid narrowing conversion from "double" to "int" */ - - // icl: command line warning #10120: overriding '/O2' with '/Od' - } - } - else if (!strcmp(argv[1], "windres")) - { - transtable = windres_translate; - executable = "rc.exe"; - dst += sprintf(dst, "rc "); - } - else if (!strcmp(argv[1], "ld")) - { - transtable = ld_translate; - - if (!icl_compile) - { - executable = "link.exe"; - dst += sprintf(dst, "link /nologo /debug "); - } - else - { - executable = "xilink.exe"; - dst += sprintf(dst, "xilink /nologo /debug "); - } - } - else if (!strcmp(argv[1], "ar")) - { - transtable = ar_translate; - - if (!icl_compile) - { - executable = "link.exe"; - dst += sprintf(dst, "link /lib /nologo "); - outstring = "/out:"; - output_is_first = 1; - } - else - { - executable = "xilink.exe"; - dst += sprintf(dst, "xilink /lib /nologo "); - outstring = "/out:"; - output_is_first = 1; - } - } - else - { - fprintf(stderr, "Error: unknown translation type '%s'\n", argv[1]); - exit(-100); - } - - // identify the version number of the EXE - if (!icl_compile) - exe_version = get_exe_version(executable); - else - exe_version = 0x00110000; // assume this for ICL - - // special cases - if (!icl_compile && !strcmp(executable, "cl.exe")) { - if (exe_version >= 0x00070000) - dst += sprintf(dst, "/wd4025 "); - // fixes -j compiles with VS2013 - if (exe_version >= 0x000C0000) - dst += sprintf(dst, "/FS "); - } - - // iterate over parameters - for (param = parampos; param < argc; param++) - { - const char *src = argv[param]; - int firstchar = src[0]; - int srclen = strlen(src); - int matched = FALSE; - int i; - - // find a match - for (i = 0; !matched && transtable[i].gcc_option != NULL; i++) - { - const char *compare = transtable[i].gcc_option; - const char *replace; - int j; - - // check version number - if (exe_version < transtable[i].vc_version) - continue; - - // find a match - for (j = 0; j < srclen; j++) - if (src[j] != compare[j]) - break; - - // if we hit an asterisk, we're ok - if (compare[j] == '*') - { - // if this is the end of the parameter, use the next one - if (src[j] == 0) - src = argv[++param]; - else - src += j; - - // copy the replacement up to the asterisk - replace = transtable[i].vc_option; - while (*replace && *replace != '*') - { - if (*replace == '~') - { - dst += sprintf(dst, "%s", outstring); - replace++; - } - else - *dst++ = *replace++; - } - - // if we have an asterisk in the replacement, copy the rest of the source - if (*replace == '*') - { - int addquote = (strchr(src, ' ') != NULL); - - if (addquote) - *dst++ = '"'; - while (*src) - { - *dst++ = (*src == '/') ? '\\' : *src; - src++; - } - if (addquote) - *dst++ = '"'; - - // if there's stuff after the asterisk, copy that - replace++; - while (*replace) - *dst++ = *replace++; - } - - // append a final space - *dst++ = ' '; - matched = TRUE; - } - - // if we hit the end, we're also ok - else if (compare[j] == 0 && j == srclen) - { - // copy the replacement up to the tilde - replace = transtable[i].vc_option; - while (*replace && *replace != '~') - *dst++ = *replace++; - - // if we hit a tilde, set the new output - if (*replace == '~') - outstring = replace + 1; - - // append a final space - *dst++ = ' '; - matched = TRUE; - } - - // else keep looking - } - - // if we didn't match, process - if (!matched) - { - // warn if we missed a parameter - if (transtable[i].gcc_option == NULL && firstchar == '-') - fprintf(stderr, "Unable to match parameter '%s'\n", src); - - // otherwise, assume it's a filename and copy translating slashes - // it can also be a Windows-specific option which is passed through unscathed - else if (firstchar != '-') - { - int dotrans = (*src != '/'); - - // if the output filename is implicitly first, append the out parameter - if (output_is_first) - { - dst += sprintf(dst, "%s", outstring); - output_is_first = 0; - } - - // now copy the rest of the string - while (*src) - { - *dst++ = (dotrans && *src == '/') ? '\\' : *src; - src++; - } - *dst++ = ' '; - } - } - } - - // trim remaining spaces and NULL terminate - while (dst > command_line && dst[-1] == ' ') - dst--; - *dst = 0; -} - - - -//============================================================ -// main -//============================================================ - -int main(int argc, char *argv[]) -{ - PROCESS_INFORMATION pi; - STARTUPINFO si; - DWORD exitcode; - int uses_redirection, in_quotes, i; - static const char cmd_prefix[] = "cmd.exe /c "; - - // build the new command line - build_command_line(argc, argv); - - // do we use redirection? if so, use cmd.exe - uses_redirection = FALSE; - in_quotes = FALSE; - for (i = 0; command_line[i]; i++) - { - if (command_line[i] == '\"') - in_quotes = !in_quotes; - if (!in_quotes && strchr("|<>", command_line[i])) - uses_redirection = TRUE; - } - if (uses_redirection) - { - memmove(command_line + strlen(cmd_prefix), command_line, strlen(command_line) + 1); - memcpy(command_line, cmd_prefix, strlen(cmd_prefix)); - } - - if (PRINT_COMMAND_LINE) - printf("%s\n", command_line); - - // create the process information structures - memset(&si, 0, sizeof(si)); - si.cb = sizeof(si); - memset(&pi, 0, sizeof(pi)); - - // create and execute the process - if (!CreateProcess(NULL, command_line, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi) || - pi.hProcess == INVALID_HANDLE_VALUE) - return -101; - - // block until done and fetch the error code - WaitForSingleObject(pi.hProcess, INFINITE); - GetExitCodeProcess(pi.hProcess, &exitcode); - - // clean up the handles - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - - // return the child's error code - return exitcode; -} From ec2d6ac0869317581b1d6f12ba7d8316d6a75b07 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 9 Apr 2015 13:16:40 +0200 Subject: [PATCH 07/10] removed two more unused files (nw) --- src/build/makedep.c | 464 ------------------------ src/build/makemak.c | 843 -------------------------------------------- 2 files changed, 1307 deletions(-) delete mode 100644 src/build/makedep.c delete mode 100644 src/build/makemak.c diff --git a/src/build/makedep.c b/src/build/makedep.c deleted file mode 100644 index 09ca9a75b49..00000000000 --- a/src/build/makedep.c +++ /dev/null @@ -1,464 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - MAME source code dependency generator - -***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "osdcore.h" -#include "astring.h" -#include "corefile.h" -#include "tagmap.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define HASH_SIZE 193 - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -struct include_path -{ - include_path * next; - astring path; -}; - - -struct exclude_path -{ - exclude_path * next; - astring path; - int pathlen; - UINT8 recursive; -}; - - -struct list_entry -{ - list_entry * next; - astring name; -}; - - -struct file_entry; - -struct dependency -{ - dependency * next; - file_entry * file; -}; - - -struct file_entry -{ - astring name; - dependency * deplist; -}; - -typedef tagmap_t dependency_map; - - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -static include_path *incpaths; -static exclude_path *excpaths; -static tagmap_t file_map; - - - -/*************************************************************************** - PROTOTYPES -***************************************************************************/ - -// core output functions -static int recurse_dir(int srcrootlen, astring &srcdir); -static file_entry &compute_dependencies(int srcrootlen, astring &srcfile); - -// path helpers -static bool find_include_file(astring &srcincpath, int srcrootlen, const astring &srcfile, const astring &filename); - - - -/*************************************************************************** - MAIN -***************************************************************************/ - -/*------------------------------------------------- - main - main entry point --------------------------------------------------*/ - -void ATTR_NORETURN usage(const char *argv0) -{ - fprintf(stderr, "Usage:\n%s [-Iincpath [-Iincpath [...]]]\n", argv0); - exit(1); -} - -int main(int argc, char *argv[]) -{ - include_path **incpathhead = &incpaths; - exclude_path **excpathhead = &excpaths; - astring srcdir; - int unadorned = 0; - - // loop over arguments - for (int argnum = 1; argnum < argc; argnum++) - { - char *arg = argv[argnum]; - - // include path? - if (arg[0] == '-' && arg[1] == 'I') - { - *incpathhead = new include_path; - (*incpathhead)->next = NULL; - (*incpathhead)->path.cpy(&arg[2]).replacechr('/', PATH_SEPARATOR[0]); - incpathhead = &(*incpathhead)->next; - } - - // exclude path? - else if (arg[0] == '-' && arg[1] == 'X') - { - *excpathhead = new exclude_path; - (*excpathhead)->next = NULL; - (*excpathhead)->path.cpy(&arg[2]).replacechr(PATH_SEPARATOR[0], '/'); - (*excpathhead)->recursive = ((*excpathhead)->path.replace((*excpathhead)->path.len() - 4, "/...", "") != 0); - (*excpathhead)->pathlen = (*excpathhead)->path.len(); - excpathhead = &(*excpathhead)->next; - } - - else if (arg[0] == '-' && arg[1] == 'F') - { - argnum++; - } - - else if (arg[0] == '-' && arg[1] == 'D') - { - // some pkgconfigs return defines (e.g. pkg-config QtGui --cflags) ==> ignore - argnum++; - } - - // ignore -include which is used by sdlmame to include sdlprefix.h before all other includes - else if (strcmp(arg,"-include") == 0) - { - argnum++; - } - - // other parameter - else if (arg[0] != '-' && unadorned == 0) - { - srcdir.cpy(arg).replacechr('/', PATH_SEPARATOR[0]); - unadorned++; - } - else - usage(argv[0]); - } - - // make sure we got 1 parameter - if (srcdir.len() == 0) - usage(argv[0]); - - // recurse over subdirectories - return recurse_dir(srcdir.len(), srcdir); -} - - - -/*************************************************************************** - CORE OUTPUT FUNCTIONS -***************************************************************************/ - -static int compare_list_entries(const void *p1, const void *p2) -{ - const list_entry *entry1 = *(const list_entry **)p1; - const list_entry *entry2 = *(const list_entry **)p2; - return entry1->name.cmp(entry2->name); -} - - -/*------------------------------------------------- - recurse_dependencies - recurse through the - dependencies found, adding the mto the tagmap - unless we already exist in the map --------------------------------------------------*/ - -static void recurse_dependencies(file_entry &file, dependency_map &map) -{ - // skip if we're in an exclude path - int filelen = file.name.len(); - for (exclude_path *exclude = excpaths; exclude != NULL; exclude = exclude->next) - if (exclude->pathlen < filelen && strncmp(file.name, exclude->path, exclude->pathlen) == 0) - if (exclude->recursive || file.name.chr(exclude->pathlen + 1, '/') == -1) - return; - - // attempt to add; if we get an error, we're already present - if (map.add(file.name, 0) != TMERR_NONE) - return; - - // recurse the list from there - for (dependency *dep = file.deplist; dep != NULL; dep = dep->next) - recurse_dependencies(*dep->file, map); -} - - -/*------------------------------------------------- - recurse_dir - recurse through a directory --------------------------------------------------*/ - -static int recurse_dir(int srcrootlen, astring &srcdir) -{ - static const osd_dir_entry_type typelist[] = { ENTTYPE_DIR, ENTTYPE_FILE }; - int result = 0; - - // iterate first over directories, then over files - for (int entindex = 0; entindex < ARRAY_LENGTH(typelist) && result == 0; entindex++) - { - osd_dir_entry_type entry_type = typelist[entindex]; - - // open the directory and iterate through it - osd_directory *dir = osd_opendir(srcdir); - if (dir == NULL) - { - result = 1; - goto error; - } - - // build up the list of files - const osd_directory_entry *entry; - list_entry *list = NULL; - int found = 0; - while ((entry = osd_readdir(dir)) != NULL) - if (entry->type == entry_type && entry->name[0] != '.') - { - list_entry *lentry = new list_entry; - lentry->name.cpy(entry->name); - lentry->next = list; - list = lentry; - found++; - } - - // close the directory - osd_closedir(dir); - - // skip if nothing found - if (found == 0) - continue; - - // allocate memory for sorting - list_entry **listarray = new list_entry *[found]; - found = 0; - for (list_entry *curlist = list; curlist != NULL; curlist = curlist->next) - listarray[found++] = curlist; - - // sort the list - qsort(listarray, found, sizeof(listarray[0]), compare_list_entries); - - // rebuild the list - list = NULL; - while (--found >= 0) - { - listarray[found]->next = list; - list = listarray[found]; - } - delete[] listarray; - - // iterate through each file - for (list_entry *curlist = list; curlist != NULL && result == 0; curlist = curlist->next) - { - astring srcfile; - - // build the source filename - srcfile.printf("%s%c%s", srcdir.cstr(), PATH_SEPARATOR[0], curlist->name.cstr()); - - // if we have a file, output it - if (entry_type == ENTTYPE_FILE) - { - // make sure we care, first - if (core_filename_ends_with(curlist->name, ".c")) - { - dependency_map depend_map; - - // find dependencies - file_entry &file = compute_dependencies(srcrootlen, srcfile); - recurse_dependencies(file, depend_map); - - // convert the target from source to object (makes assumptions about rules) - astring target(file.name); - target.replace(0, "src/", "$(OBJ)/"); - target.replace(0, ".c", ".o"); - printf("\n%s : \\\n", target.cstr()); - - // iterate over the hashed dependencies and output them as well - for (dependency_map::entry_t *entry = depend_map.first(); entry != NULL; entry = depend_map.next(entry)) - printf("\t%s \\\n", entry->tag().cstr()); - } - } - - // if we have a directory, recurse - else - result = recurse_dir(srcrootlen, srcfile); - } - - // free all the allocated entries - while (list != NULL) - { - list_entry *next = list->next; - delete list; - list = next; - } - } - -error: - return result; -} - - -/*------------------------------------------------- - output_file - output a file, converting to - HTML --------------------------------------------------*/ - -static file_entry &compute_dependencies(int srcrootlen, astring &srcfile) -{ - // see if we already have an entry - astring normalfile(srcfile); - normalfile.replacechr(PATH_SEPARATOR[0], '/'); - file_entry *foundfile = file_map.find(normalfile); - if (foundfile != NULL) - return *foundfile; - - // create a new header entry - file_entry &file = *new file_entry; - file.deplist = NULL; - file.name = normalfile; - file_map.add(file.name, &file); - - // read the source file - UINT32 filelength; - char *filedata; - if (core_fload(srcfile, (void **)&filedata, &filelength) != FILERR_NONE) - { - fprintf(stderr, "Unable to read file '%s'\n", srcfile.cstr()); - return file; - } - - // find the #include directives in this file - for (int index = 0; index < filelength; index++) - if (filedata[index] == '#' && strncmp(&filedata[index + 1], "include", 7) == 0) - { - // first make sure we're not commented or quoted - bool just_continue = false; - for (int scan = index; scan > 2 && filedata[scan] != 13 && filedata[scan] != 10; scan--) - if ((filedata[scan] == '/' && filedata[scan - 1] == '/') || filedata[scan] == '"') - { - just_continue = true; - break; - } - if (just_continue) - continue; - - // scan forward to find the quotes or bracket - index += 7; - int scan; - for (scan = index; scan < filelength && filedata[scan] != '<' && filedata[scan] != '"' && filedata[scan] != 13 && filedata[scan] != 10; scan++) ; - - // ignore if not found or if it's bracketed - if (scan >= filelength || filedata[scan] != '"') - continue; - int start = ++scan; - - // find the closing quote - while (scan < filelength && filedata[scan] != '"') - scan++; - if (scan >= filelength) - continue; - - // find the include file - astring filename(&filedata[start], scan - start); - astring target; - - // create a new dependency - if (find_include_file(target, srcrootlen, srcfile, filename)) - { - dependency *dep = new dependency; - dep->next = file.deplist; - file.deplist = dep; - dep->file = &compute_dependencies(srcrootlen, target); - } - } - - osd_free(filedata); - return file; -} - - - -/*************************************************************************** - HELPERS -***************************************************************************/ - -/*------------------------------------------------- - find_include_file - find an include file --------------------------------------------------*/ - -static bool find_include_file(astring &srcincpath, int srcrootlen, const astring &srcfile, const astring &filename) -{ - // iterate over include paths and find the file - for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next) - { - // a '.' include path is specially treated - if (curpath->path == ".") - srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0])); - else - srcincpath.cpy(curpath->path); - - // append the filename piecemeal to account for directories - int lastsepindex = 0; - int sepindex; - while ((sepindex = filename.chr(lastsepindex, '/')) != -1) - { - astring pathpart(filename, lastsepindex, sepindex - lastsepindex); - - // handle .. by removing a chunk from the incpath - if (pathpart == "..") - { - int sepindex_part = srcincpath.rchr(0, PATH_SEPARATOR[0]); - if (sepindex_part != -1) - srcincpath.substr(0, sepindex_part); - } - - // otherwise, append a path separator and the pathpart - else - srcincpath.cat(PATH_SEPARATOR).cat(pathpart); - - // advance past the previous index - lastsepindex = sepindex + 1; - } - - // now append the filename - srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1); - - // see if we can open it - core_file *testfile; - if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE) - { - // close the file - core_fclose(testfile); - return true; - } - } - return false; -} diff --git a/src/build/makemak.c b/src/build/makemak.c deleted file mode 100644 index dfbd36cfef3..00000000000 --- a/src/build/makemak.c +++ /dev/null @@ -1,843 +0,0 @@ -// license:BSD-3-Clause -// copyright-holders:Aaron Giles -/*************************************************************************** - - MAME source code dependency generator - -***************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include "osdcore.h" -#include "astring.h" -#include "corefile.h" -#include "corestr.h" -#include "tagmap.h" - - -/*************************************************************************** - CONSTANTS -***************************************************************************/ - -#define HASH_SIZE 193 -#define MAX_SOURCES 65536 - - -/*************************************************************************** - TYPE DEFINITIONS -***************************************************************************/ - -struct include_path -{ - include_path * next; - astring path; -}; - - -struct exclude_path -{ - exclude_path * next; - astring path; - int pathlen; - UINT8 recursive; -}; - - -struct list_entry -{ - list_entry * next; - astring name; -}; - -struct librarylist_entry -{ - librarylist_entry * next; - list_entry * sourcefiles; - astring name; -}; - -struct file_entry; - -struct dependency -{ - dependency * next; - file_entry * file; -}; - - -struct file_entry -{ - astring name; - dependency * deplist; -}; - -typedef tagmap_t dependency_map; - - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -static include_path *incpaths; -static exclude_path *excpaths; -static tagmap_t file_map; -static librarylist_entry *librarylist; - -static librarylist_entry *last_libraryitem; -static list_entry *last_sourceitem; - -static tagmap_t include_map; - - -/*************************************************************************** - PROTOTYPES -***************************************************************************/ - -// core output functions -static int recurse_dir(astring &srcdir); -static file_entry &compute_dependencies(astring &srcfile); - -// path helpers -static bool find_include_file(astring &srcincpath, const astring &srcfile, const astring &filename); - -static bool check_file(astring &srcincpath) -{ - // see if we can open it - core_file *testfile; - if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE) - { - // close the file - core_fclose(testfile); - return true; - } - return false; -} -int include_mapping(const char *srcfile) -{ - // read source file - void *buffer; - UINT32 length; - file_error filerr = core_fload(srcfile, &buffer, &length); - if (filerr != FILERR_NONE) - { - fprintf(stderr, "Unable to read source file '%s'\n", srcfile); - return 1; - } - - // rip through it to find all drivers - char *srcptr = (char *)buffer; - char *endptr = srcptr + length; - while (srcptr < endptr) - { - char c = *srcptr++; - // count newlines - if (c == 13 || c == 10) - { - if (c == 13 && *srcptr == 10) - srcptr++; - continue; - } - // look for start of C comment - if (c == '#' && *srcptr == '@') - { - srcptr++; - //mapping - char filename[256]; - filename[0] = 0; - for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(filename) - 1 && (*srcptr!=','); pos++) - { - filename[pos] = *srcptr++; - filename[pos+1] = 0; - } - srcptr++; // skip comma - char mapping[256]; - mapping[0] = 0; - for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(mapping) - 1 && (*srcptr!=10) && (*srcptr!=13); pos++) - { - mapping[pos] = *srcptr++; - mapping[pos+1] = 0; - } - include_map.add(filename,core_strdup(mapping)); - continue; - } - - for (int pos = 0; srcptr < endptr && !isspace(*srcptr); pos++) - { - c = *srcptr++; - } - } - - osd_free(buffer); - - return 0; -} - -//------------------------------------------------- -// parse_file - parse a single file, may be -// called recursively -//------------------------------------------------- - -int parse_file(const char *srcfile) -{ - // read source file - void *buffer; - UINT32 length; - file_error filerr = core_fload(srcfile, &buffer, &length); - if (filerr != FILERR_NONE) - { - fprintf(stderr, "Unable to read source file '%s'\n", srcfile); - return 1; - } - - // rip through it to find all drivers - char *srcptr = (char *)buffer; - char *endptr = srcptr + length; - int linenum = 1; - bool in_comment = false; - while (srcptr < endptr) - { - char c = *srcptr++; - - // count newlines - if (c == 13 || c == 10) - { - if (c == 13 && *srcptr == 10) - srcptr++; - linenum++; - continue; - } - - // skip any spaces - if (isspace(c)) - continue; - - // look for end of C comment - if (in_comment && c == '*' && *srcptr == '/') - { - srcptr++; - in_comment = false; - continue; - } - - // skip anything else inside a C comment - if (in_comment) - continue; - - // look for start of C comment - if (c == '/' && *srcptr == '*') - { - srcptr++; - in_comment = true; - continue; - } - - // if we hit a C++ comment, scan to the end of line - if (c == '/' && *srcptr == '/') - { - while (srcptr < endptr && *srcptr != 13 && *srcptr != 10) - srcptr++; - continue; - } - - // look for an import directive - if (c == '#') - { - char filename[256]; - filename[0] = 0; - for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(filename) - 1 && !isspace(*srcptr); pos++) - { - filename[pos] = *srcptr++; - filename[pos+1] = 0; - } - fprintf(stderr, "Importing drivers from '%s'\n", filename); - parse_file(filename); - continue; - } - if (c == '@') - { - // Used for makemak tool - char drivname[256]; - drivname[0] = 0; - for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++) - { - drivname[pos] = *srcptr++; - drivname[pos+1] = 0; - } - - librarylist_entry *lentry = new librarylist_entry; - lentry->name.cpy(drivname); - lentry->next = NULL; - lentry->sourcefiles = NULL; - if (last_libraryitem!=NULL) - { - last_libraryitem->next = lentry; - } - last_libraryitem = lentry; - last_sourceitem = NULL; - - if (librarylist==NULL) - { - librarylist = lentry; - } - - continue; - } - - srcptr--; - // Used for makemak tool - char drivname[256]; - drivname[0] = 0; - for (int pos = 0; srcptr < endptr && pos < ARRAY_LENGTH(drivname) - 1 && !isspace(*srcptr); pos++) - { - drivname[pos] = *srcptr++; - drivname[pos+1] = 0; - } - - list_entry *lentry = new list_entry; - lentry->name.cpy(drivname); - lentry->next = NULL; - if (last_sourceitem!=NULL) - { - last_sourceitem->next = lentry; - } - last_sourceitem = lentry; - if (last_libraryitem->sourcefiles==NULL) - { - last_libraryitem->sourcefiles = lentry; - } - } - - osd_free(buffer); - - return 0; -} - -int parse_for_drivers(const char *srcfile) -{ - // read source file - core_file *file = NULL; - - file_error filerr = core_fopen(srcfile, OPEN_FLAG_READ, &file); - if (filerr != FILERR_NONE) - { - fprintf(stderr, "Unable to read source file '%s'\n", srcfile); - return 1; - } - // loop over lines in the file - char buffer[4096]; - while (core_fgets(buffer, ARRAY_LENGTH(buffer), file) != NULL) - { - astring line; - - // rip through it to find all drivers - char *srcptr = (char *)buffer; - char *endptr = srcptr + strlen(buffer); - bool in_comment = false; - while (srcptr < endptr) - { - char c = *srcptr++; - - // skip any spaces - if (isspace(c)) - continue; - - // look for end of C comment - if (in_comment && c == '*' && *srcptr == '/') - { - srcptr++; - in_comment = false; - continue; - } - - // skip anything else inside a C comment - if (in_comment) - continue; - - // look for start of C comment - if (c == '/' && *srcptr == '*') - { - srcptr++; - in_comment = true; - continue; - } - - // if we hit a C++ comment, scan to the end of line - if (c == '/' && *srcptr == '/') - { - while (srcptr < endptr && *srcptr != 13 && *srcptr != 10) - srcptr++; - continue; - } - - srcptr--; - for (int pos = 0; srcptr < endptr && !isspace(*srcptr); pos++) - { - line.cat(*srcptr++); - } - } - - if ((line.find(0,"GAME(")==0) || (line.find(0,"GAMEL(")==0) || - (line.find(0,"COMP(")==0) || (line.find(0,"CONS(")==0) || - (line.find(0,"SYST(")==0)) - { - int p1 = line.find(0,","); - if (p1<0) continue; - int p2 = line.find(p1+1,","); - if (p2<0) continue; - - printf("%s\n",line.substr(p1+1,p2-p1-1).cstr()); - } - } - core_fclose(file); - return 0; -} - -/*************************************************************************** - MAIN -***************************************************************************/ - -/*------------------------------------------------- - main - main entry point --------------------------------------------------*/ - -void ATTR_NORETURN usage(const char *argv0) -{ - fprintf(stderr, "Usage:\n%s [-Iincpath [-Iincpath [...]]]\n", argv0); - exit(1); -} - -int main(int argc, char *argv[]) -{ - include_path **incpathhead = &incpaths; - exclude_path **excpathhead = &excpaths; - astring srcdir; - int unadorned = 0; - - librarylist = NULL; - last_libraryitem = NULL; - last_sourceitem = NULL; - - - // extract arguments - const char *srcfile = argv[1]; - if (parse_file(srcfile)) - return 1; - - // loop over arguments - for (int argnum = 2; argnum < argc; argnum++) - { - char *arg = argv[argnum]; - - // include path? - if (arg[0] == '-' && arg[1] == 'I') - { - *incpathhead = new include_path; - (*incpathhead)->next = NULL; - (*incpathhead)->path.cpy(&arg[2]).replacechr('/', PATH_SEPARATOR[0]); - incpathhead = &(*incpathhead)->next; - } - - // exclude path? - else if (arg[0] == '-' && arg[1] == 'X') - { - *excpathhead = new exclude_path; - (*excpathhead)->next = NULL; - (*excpathhead)->path.cpy(&arg[2]).replacechr(PATH_SEPARATOR[0], '/'); - (*excpathhead)->recursive = ((*excpathhead)->path.replace((*excpathhead)->path.len() - 4, "/...", "") != 0); - (*excpathhead)->pathlen = (*excpathhead)->path.len(); - excpathhead = &(*excpathhead)->next; - } - - // ignore -include which is used by sdlmame to include sdlprefix.h before all other includes - else if (strcmp(arg,"-include") == 0) - { - argnum++; - } - - // other parameter - else if (arg[0] != '-' && unadorned == 0) - { - srcdir.cpy(arg).replacechr('/', PATH_SEPARATOR[0]); - unadorned++; - } - else - usage(argv[0]); - } - - // generate list of drivers - if (srcdir.len() == 0) - { - for (librarylist_entry *lib = librarylist; lib != NULL; lib = lib->next) - { - for (list_entry *src = lib->sourcefiles; src != NULL; src = src->next) - { - printf("// Drivers from %s.c\n",src->name.cstr()); - astring srcfile; - // build the source filename - srcfile.printf("%s%c%s.c", "src", PATH_SEPARATOR[0], src->name.cstr()); - parse_for_drivers(srcfile); - - astring srcfile_inc; - // build the source filename - srcfile_inc.printf("%s%c%s.inc", "src", PATH_SEPARATOR[0], src->name.cstr()); - if(check_file(srcfile_inc)) - parse_for_drivers(srcfile_inc); - } - } - return 0; - } - else - { - include_mapping("src/emu/cpu/cpu.mak"); - include_mapping("src/emu/video/video.mak"); - include_mapping("src/emu/sound/sound.mak"); - include_mapping("src/emu/machine/machine.mak"); - include_mapping("src/emu/bus/bus.mak"); - if (librarylist!=NULL) - { - printf("OBJDIRS += \\\n"); - printf("\t$(OBJ)/target \\\n"); - printf("\t$(OBJ)/mame/audio \\\n"); - printf("\t$(OBJ)/mame/drivers \\\n"); - printf("\t$(OBJ)/mame/layout \\\n"); - printf("\t$(OBJ)/mame/machine \\\n"); - printf("\t$(OBJ)/mame/video \\\n"); - printf("\t$(OBJ)/mess/audio \\\n"); - printf("\t$(OBJ)/mess/drivers \\\n"); - printf("\t$(OBJ)/mess/layout \\\n"); - printf("\t$(OBJ)/mess/machine \\\n"); - printf("\t$(OBJ)/mess/video \\\n"); - printf("\n\n"); - printf("DRVLIBS += \\\n"); - - for (librarylist_entry *lib = librarylist; lib != NULL; lib = lib->next) - { - printf("\t$(OBJ)/target/%s.a \\\n",lib->name.cstr()); - } - printf("\n"); - } - - // recurse over subdirectories - return recurse_dir(srcdir); - } -} - - - -/*************************************************************************** - CORE OUTPUT FUNCTIONS -***************************************************************************/ - -/*------------------------------------------------- - recurse_dependencies - recurse through the - dependencies found, adding the mto the tagmap - unless we already exist in the map --------------------------------------------------*/ - -static void recurse_dependencies(file_entry &file, dependency_map &map) -{ - // skip if we're in an exclude path - int filelen = file.name.len(); - for (exclude_path *exclude = excpaths; exclude != NULL; exclude = exclude->next) - if (exclude->pathlen < filelen && strncmp(file.name, exclude->path, exclude->pathlen) == 0) - if (exclude->recursive || file.name.chr(exclude->pathlen + 1, '/') == -1) - return; - - // attempt to add; if we get an error, we're already present - if (map.add(file.name, 0) != TMERR_NONE) - return; - - // recurse the list from there - for (dependency *dep = file.deplist; dep != NULL; dep = dep->next) - recurse_dependencies(*dep->file, map); -} - - -/*------------------------------------------------- - recurse_dir - recurse through a directory --------------------------------------------------*/ - -static int recurse_dir(astring &srcdir) -{ - int result = 0; - - // iterate through each file - for (librarylist_entry *lib = librarylist; lib != NULL; lib = lib->next) - { - for (list_entry *src = lib->sourcefiles; src != NULL; src = src->next) - { - astring srcfile; - - // build the source filename - srcfile.printf("%s%s.c", srcdir.cstr(), src->name.cstr()); - - dependency_map depend_map; - - // find dependencies - file_entry &file = compute_dependencies(srcfile); - recurse_dependencies(file, depend_map); - - for (dependency_map::entry_t *entry = depend_map.first(); entry != NULL; entry = depend_map.next(entry)) - { - astring t(entry->tag()); - if (core_filename_ends_with(t, ".h")) - { - char *foundfile = include_map.find(t); - if (foundfile != NULL) { - printf("%s\n", foundfile); - // we add things just once when needed - include_map.remove(t); - } - } - } - } - } - - - // iterate through each file - for (librarylist_entry *lib = librarylist; lib != NULL; lib = lib->next) - { - // convert the target from source to object (makes assumptions about rules) - astring target("$(OBJ)/target/",lib->name.cstr()); - target.cat(".a"); - printf("\n%s : \\\n", target.cstr()); - - for (list_entry *src = lib->sourcefiles; src != NULL; src = src->next) - { - astring srcfile; - - // build the source filename - srcfile.printf("%s%s.c", srcdir.cstr(), src->name.cstr()); - dependency_map depend_map; - - // find dependencies - file_entry &file = compute_dependencies(srcfile); - recurse_dependencies(file, depend_map); - - // iterate over the hashed dependencies and output them as well - for (dependency_map::entry_t *entry = depend_map.first(); entry != NULL; entry = depend_map.next(entry)) - { - astring t(entry->tag()); - t.replace(0, "src/", "$(OBJ)/"); - t.replace(0, ".c", ".o"); - if (core_filename_ends_with(t, ".o")) - { - printf("\t%s \\\n", t.cstr()); - } - } - } - printf("\n"); - for (list_entry *src = lib->sourcefiles; src != NULL; src = src->next) - { - astring srcfile; - - // build the source filename - srcfile.printf("%s%s.c", srcdir.cstr(), src->name.cstr()); - dependency_map depend_map; - - // find dependencies - file_entry &file = compute_dependencies(srcfile); - recurse_dependencies(file, depend_map); - for (dependency_map::entry_t *entry = depend_map.first(); entry != NULL; entry = depend_map.next(entry)) - { - astring t(entry->tag()); - if (core_filename_ends_with(t, ".lay")) - { - astring target2(file.name); - target2.replace(0, "src/", "$(OBJ)/"); - target2.replace(0, ".c", ".o"); - - t.replace(0, "src/", "$(OBJ)/"); - t.replace(0, ".lay", ".lh"); - - printf("%s: %s\n", target2.cstr(), t.cstr()); - } - if (core_filename_ends_with(t, ".inc")) - { - astring target2(file.name); - target2.replace(0, "src/", "$(OBJ)/"); - target2.replace(0, ".c", ".o"); - - printf("%s: %s\n", target2.cstr(), t.cstr()); - } - } - } - } - return result; -} - -/*------------------------------------------------- - output_file - output a file, converting to - HTML --------------------------------------------------*/ - -static file_entry &compute_dependencies(astring &srcfile) -{ - // see if we already have an entry - astring normalfile(srcfile); - normalfile.replacechr(PATH_SEPARATOR[0], '/'); - file_entry *foundfile = file_map.find(normalfile); - if (foundfile != NULL) - return *foundfile; - - // create a new header entry - file_entry &file = *new file_entry; - file.deplist = NULL; - file.name = normalfile; - file_map.add(file.name, &file); - - // read the source file - UINT32 filelength; - char *filedata; - if (core_fload(srcfile, (void **)&filedata, &filelength) != FILERR_NONE) - { - fprintf(stderr, "Unable to read file '%s'\n", srcfile.cstr()); - return file; - } - - astring audiofile = astring(srcfile); - audiofile.replace("drivers","audio"); - if (check_file(audiofile)) - { - dependency *dep = new dependency; - dep->next = file.deplist; - file.deplist = dep; - dep->file = &compute_dependencies(audiofile); - } - - astring machinefile = astring(srcfile); - machinefile.replace("drivers","machine"); - if (check_file(machinefile)) - { - dependency *dep = new dependency; - dep->next = file.deplist; - file.deplist = dep; - dep->file = &compute_dependencies(machinefile); - } - - astring videofile = astring(srcfile); - videofile.replace("drivers","video"); - if (check_file(videofile)) - { - dependency *dep = new dependency; - dep->next = file.deplist; - file.deplist = dep; - dep->file = &compute_dependencies(videofile); - } - - - // find the #include directives in this file - for (int index = 0; index < filelength; index++) - if (filedata[index] == '#' && strncmp(&filedata[index + 1], "include", 7) == 0) - { - // first make sure we're not commented or quoted - bool just_continue = false; - for (int scan = index; scan > 2 && filedata[scan] != 13 && filedata[scan] != 10; scan--) - if ((filedata[scan] == '/' && filedata[scan - 1] == '/') || filedata[scan] == '"') - { - just_continue = true; - break; - } - if (just_continue) - continue; - - // scan forward to find the quotes or bracket - index += 7; - int scan; - for (scan = index; scan < filelength && filedata[scan] != '<' && filedata[scan] != '"' && filedata[scan] != 13 && filedata[scan] != 10; scan++) ; - - // ignore if not found or if it's bracketed - if (scan >= filelength || filedata[scan] != '"') - continue; - int start = ++scan; - - // find the closing quote - while (scan < filelength && filedata[scan] != '"') - scan++; - if (scan >= filelength) - continue; - - // find the include file - astring filename(&filedata[start], scan - start); - astring target; - - filename.replace(".lh",".lay"); - - // create a new dependency - if (find_include_file(target, srcfile, filename)) - { - dependency *dep = new dependency; - dep->next = file.deplist; - file.deplist = dep; - dep->file = &compute_dependencies(target); - } - // create a new dependency - } - - osd_free(filedata); - return file; -} - - - -/*************************************************************************** - HELPERS -***************************************************************************/ - -/*------------------------------------------------- - find_include_file - find an include file --------------------------------------------------*/ - -static bool find_include_file(astring &srcincpath, const astring &srcfile, const astring &filename) -{ - // iterate over include paths and find the file - for (include_path *curpath = incpaths; curpath != NULL; curpath = curpath->next) - { - // a '.' include path is specially treated - if (curpath->path == ".") - srcincpath.cpysubstr(srcfile, 0, srcfile.rchr(0, PATH_SEPARATOR[0])); - else - srcincpath.cpy(curpath->path); - - // append the filename piecemeal to account for directories - int lastsepindex = 0; - int sepindex; - while ((sepindex = filename.chr(lastsepindex, '/')) != -1) - { - astring pathpart(filename, lastsepindex, sepindex - lastsepindex); - - // handle .. by removing a chunk from the incpath - if (pathpart == "..") - { - int sepindex_part = srcincpath.rchr(0, PATH_SEPARATOR[0]); - if (sepindex_part != -1) - srcincpath.substr(0, sepindex_part); - } - - // otherwise, append a path separator and the pathpart - else - srcincpath.cat(PATH_SEPARATOR).cat(pathpart); - - // advance past the previous index - lastsepindex = sepindex + 1; - } - - // now append the filename - srcincpath.cat(PATH_SEPARATOR).catsubstr(filename, lastsepindex, -1); - - // see if we can open it - core_file *testfile; - if (core_fopen(srcincpath, OPEN_FLAG_READ, &testfile) == FILERR_NONE) - { - // close the file - core_fclose(testfile); - return true; - } - } - return false; -} From e973a403a097c6374ac90912e07ab4f0f4b57732 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 Apr 2015 21:19:24 +1000 Subject: [PATCH 08/10] Honour debugger font choice with Qt debugger --- src/osd/modules/debugger/debugwin.c | 2 +- src/osd/modules/debugger/qt/debuggerview.c | 10 ++++++++-- src/osd/modules/debugger/win/uimetrics.c | 9 +++++---- src/osd/modules/debugger/win/uimetrics.h | 4 ++-- src/osd/modules/lib/osdobj_common.c | 3 +++ src/osd/modules/lib/osdobj_common.h | 4 ++++ src/osd/windows/winmain.c | 5 ----- src/osd/windows/winmain.h | 8 -------- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/osd/modules/debugger/debugwin.c b/src/osd/modules/debugger/debugwin.c index ff8b94e8646..5f07e0d3057 100644 --- a/src/osd/modules/debugger/debugwin.c +++ b/src/osd/modules/debugger/debugwin.c @@ -96,7 +96,7 @@ void debugger_windows::exit() void debugger_windows::init_debugger(running_machine &machine) { m_machine = &machine; - m_metrics.reset(global_alloc(ui_metrics(downcast(m_machine->options())))); + m_metrics.reset(global_alloc(ui_metrics(downcast(m_machine->options())))); } diff --git a/src/osd/modules/debugger/qt/debuggerview.c b/src/osd/modules/debugger/qt/debuggerview.c index c1319114878..eca5aae1ed3 100644 --- a/src/osd/modules/debugger/qt/debuggerview.c +++ b/src/osd/modules/debugger/qt/debuggerview.c @@ -2,6 +2,9 @@ #include "debuggerview.h" +#include "modules/lib/osdobj_common.h" + + DebuggerView::DebuggerView(const debug_view_type& type, running_machine* machine, QWidget* parent) : @@ -11,9 +14,12 @@ DebuggerView::DebuggerView(const debug_view_type& type, m_machine(machine) { // I like setting the font per-view since it doesn't override the menuing fonts. - QFont viewFontRequest("Courier New"); + const char *const selectedFont(downcast(m_machine->options()).debugger_font()); + const float selectedFontSize(downcast(m_machine->options()).debugger_font_size()); + QFont viewFontRequest((!*selectedFont || !strcmp(selectedFont, OSDOPTVAL_AUTO)) ? "Courier New" : selectedFont); viewFontRequest.setFixedPitch(true); - viewFontRequest.setPointSize(11); + viewFontRequest.setStyleHint(QFont::TypeWriter); + viewFontRequest.setPointSize((selectedFontSize <= 0) ? 11 : selectedFontSize); setFont(viewFontRequest); m_view = m_machine->debug_view().alloc_view(type, diff --git a/src/osd/modules/debugger/win/uimetrics.c b/src/osd/modules/debugger/win/uimetrics.c index 7532518f489..17a74bf73e7 100644 --- a/src/osd/modules/debugger/win/uimetrics.c +++ b/src/osd/modules/debugger/win/uimetrics.c @@ -11,7 +11,7 @@ #include "strconv.h" -ui_metrics::ui_metrics(windows_options const &options) : +ui_metrics::ui_metrics(osd_options const &options) : m_debug_font(NULL), m_debug_font_height(0), m_debug_font_width(0), @@ -23,11 +23,12 @@ ui_metrics::ui_metrics(windows_options const &options) : HDC const temp_dc = GetDC(NULL); if (temp_dc != NULL) { - int const size = options.debugger_font_size(); + float const size = options.debugger_font_size(); + char const *const face = options.debugger_font(); // create a standard font - TCHAR *t_face = tstring_from_utf8(options.debugger_font()); - m_debug_font = CreateFont(-MulDiv(size, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, + TCHAR *t_face = tstring_from_utf8((!*face || !strcmp(OSDOPTVAL_AUTO, face)) ? "Lucida Console" : face); + m_debug_font = CreateFont(-MulDiv((size <= 0) ? 9 : size, GetDeviceCaps(temp_dc, LOGPIXELSY), 72), 0, 0, 0, FW_MEDIUM, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FIXED_PITCH, t_face); osd_free(t_face); t_face = NULL; diff --git a/src/osd/modules/debugger/win/uimetrics.h b/src/osd/modules/debugger/win/uimetrics.h index d8f46c8cc68..bc4523dcd77 100644 --- a/src/osd/modules/debugger/win/uimetrics.h +++ b/src/osd/modules/debugger/win/uimetrics.h @@ -13,13 +13,13 @@ #include "emu.h" -#include "winmain.h" +#include "modules/lib/osdobj_common.h" class ui_metrics { public: - ui_metrics(windows_options const &options); + ui_metrics(osd_options const &options); ui_metrics(ui_metrics const &that); ~ui_metrics(); diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index e66b58026d4..7f7bdfc6078 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -27,6 +27,9 @@ const options_entry osd_options::s_option_entries[] = // debugging options { NULL, NULL, OPTION_HEADER, "OSD DEBUGGING OPTIONS" }, { OSDOPTION_DEBUGGER, OSDOPTVAL_AUTO, OPTION_STRING, "debugger used: " }, + { OSDOPTION_DEBUGGER_FONT ";dfont", OSDOPTVAL_AUTO, OPTION_STRING, "specifies the font to use for debugging" }, + { OSDOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "0", OPTION_FLOAT, "specifies the font size to use for debugging" }, + { OSDOPTION_WATCHDOG ";wdog", "0", OPTION_INTEGER, "force the program to terminate if no updates within specified number of seconds" }, // performance options diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 082ebe1a807..d8bfed565d6 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -30,6 +30,8 @@ #define OSDCOMMAND_LIST_NETWORK_ADAPTERS "listnetwork" #define OSDOPTION_DEBUGGER "debugger" +#define OSDOPTION_DEBUGGER_FONT "debugger_font" +#define OSDOPTION_DEBUGGER_FONT_SIZE "debugger_font_size" #define OSDOPTION_WATCHDOG "watchdog" #define OSDOPTION_MULTITHREADING "multithreading" @@ -87,6 +89,8 @@ public: // debugging options const char *debugger() const { return value(OSDOPTION_DEBUGGER); } + const char *debugger_font() const { return value(OSDOPTION_DEBUGGER_FONT); } + float debugger_font_size() const { return float_value(OSDOPTION_DEBUGGER_FONT_SIZE); } int watchdog() const { return int_value(OSDOPTION_WATCHDOG); } // performance options diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 8b24108b1ca..06d1ce462e0 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -271,11 +271,6 @@ static LONG WINAPI exception_filter(struct _EXCEPTION_POINTERS *info); // struct definitions const options_entry windows_options::s_option_entries[] = { - // debugging options - { NULL, NULL, OPTION_HEADER, "WINDOWS DEBUGGING OPTIONS" }, - { WINOPTION_DEBUGGER_FONT ";dfont", "Lucida Console", OPTION_STRING,"specifies the font to use for debugging; defaults to Lucida Console" }, - { WINOPTION_DEBUGGER_FONT_SIZE ";dfontsize", "9", OPTION_FLOAT, "specifies the font size to use for debugging; defaults to 9 pt" }, - // performance options { NULL, NULL, OPTION_HEADER, "WINDOWS PERFORMANCE OPTIONS" }, { WINOPTION_PRIORITY "(-15-1)", "0", OPTION_INTEGER, "thread priority for the main game thread; range from -15 to 1" }, diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index dec35e3d46d..92e4056973e 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -18,10 +18,6 @@ // CONSTANTS //============================================================ -// debugging options -#define WINOPTION_DEBUGGER_FONT "debugger_font" -#define WINOPTION_DEBUGGER_FONT_SIZE "debugger_font_size" - // performance options #define WINOPTION_PRIORITY "priority" #define WINOPTION_PROFILE "profile" @@ -119,10 +115,6 @@ public: // construction/destruction windows_options(); - // debugging options - const char *debugger_font() const { return value(WINOPTION_DEBUGGER_FONT); } - float debugger_font_size() const { return float_value(WINOPTION_DEBUGGER_FONT_SIZE); } - // performance options int priority() const { return int_value(WINOPTION_PRIORITY); } int profile() const { return int_value(WINOPTION_PROFILE); } From 768fbd1b646d4b3a9596d4bc705a4bc72b417463 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Thu, 9 Apr 2015 22:01:16 +1000 Subject: [PATCH 09/10] Honour -debugger_font and -debugger_font_size in Cocoa debugger. Not perfect yet - text fields and popup menus aren't sized to fit --- src/osd/modules/debugger/osx/debugconsole.m | 2 +- src/osd/modules/debugger/osx/debugview.h | 2 +- src/osd/modules/debugger/osx/debugview.m | 18 +++++++++++++++--- .../modules/debugger/osx/disassemblyviewer.m | 5 +++-- src/osd/modules/debugger/osx/memoryviewer.m | 11 ++++++----- src/osd/modules/debugger/osx/pointsviewer.m | 2 +- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/osd/modules/debugger/osx/debugconsole.m b/src/osd/modules/debugger/osx/debugconsole.m index a0410fcedfa..2f5f7746e5f 100644 --- a/src/osd/modules/debugger/osx/debugconsole.m +++ b/src/osd/modules/debugger/osx/debugconsole.m @@ -77,7 +77,7 @@ // create the command field commandField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)]; [commandField setAutoresizingMask:(NSViewWidthSizable | NSViewMaxYMargin)]; - [commandField setFont:[[MAMEDebugView class] defaultFont]]; + [commandField setFont:[[MAMEDebugView class] defaultFontForMachine:m]]; [commandField setFocusRingType:NSFocusRingTypeNone]; [commandField setTarget:self]; [commandField setAction:@selector(doCommand:)]; diff --git a/src/osd/modules/debugger/osx/debugview.h b/src/osd/modules/debugger/osx/debugview.h index d45d6a6e045..260bb580ac9 100644 --- a/src/osd/modules/debugger/osx/debugview.h +++ b/src/osd/modules/debugger/osx/debugview.h @@ -34,7 +34,7 @@ NSLayoutManager *layoutManager; } -+ (NSFont *)defaultFont; ++ (NSFont *)defaultFontForMachine:(running_machine &)m; - (id)initWithFrame:(NSRect)f type:(debug_view_type)t machine:(running_machine &)m wholeLineScroll:(BOOL)w; diff --git a/src/osd/modules/debugger/osx/debugview.m b/src/osd/modules/debugger/osx/debugview.m index e46e814da4f..7e53ee7d803 100644 --- a/src/osd/modules/debugger/osx/debugview.m +++ b/src/osd/modules/debugger/osx/debugview.m @@ -13,6 +13,10 @@ #include "debug/debugcpu.h" +#include "modules/lib/osdobj_common.h" + +#include + static NSColor *DefaultForeground; static NSColor *ChangedForeground; @@ -209,8 +213,16 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) } -+ (NSFont *)defaultFont { - return [NSFont userFixedPitchFontOfSize:0]; ++ (NSFont *)defaultFontForMachine:(running_machine &)m { + osd_options const &options = downcast(m.options()); + char const *const face = options.debugger_font(); + float const size = options.debugger_font_size(); + + NSFont *const result = (('\0' != *face) && (0 != strcmp(OSDOPTVAL_AUTO, face))) + ? [NSFont fontWithName:[NSString stringWithUTF8String:face] size:MAX(0, size)] + : nil; + + return (nil != result) ? result : [NSFont userFixedPitchFontOfSize:MAX(0, size)]; } @@ -238,7 +250,7 @@ static void debugwin_view_update(debug_view &view, void *osdprivate) [text addLayoutManager:layoutManager]; [layoutManager release]; - [self setFont:[[self class] defaultFont]]; + [self setFont:[[self class] defaultFontForMachine:m]]; NSMenu *contextMenu = [[NSMenu allocWithZone:[NSMenu menuZone]] initWithTitle:@"Context"]; [self addContextMenuItemsToMenu:contextMenu]; diff --git a/src/osd/modules/debugger/osx/disassemblyviewer.m b/src/osd/modules/debugger/osx/disassemblyviewer.m index 7653b322d32..61846d2e879 100644 --- a/src/osd/modules/debugger/osx/disassemblyviewer.m +++ b/src/osd/modules/debugger/osx/disassemblyviewer.m @@ -31,11 +31,12 @@ if (!(self = [super initWithMachine:m title:@"Disassembly" console:c])) return nil; NSRect const contentBounds = [[window contentView] bounds]; + NSFont *const defaultFont = [[MAMEDebugView class] defaultFontForMachine:m]; // create the expression field expressionField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)]; [expressionField setAutoresizingMask:(NSViewWidthSizable | NSViewMaxXMargin | NSViewMinYMargin)]; - [expressionField setFont:[[MAMEDebugView class] defaultFont]]; + [expressionField setFont:defaultFont]; [expressionField setFocusRingType:NSFocusRingTypeNone]; [expressionField setTarget:self]; [expressionField setAction:@selector(doExpression:)]; @@ -51,7 +52,7 @@ [subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinXMargin | NSViewMinYMargin)]; [subviewButton setBezelStyle:NSShadowlessSquareBezelStyle]; [subviewButton setFocusRingType:NSFocusRingTypeNone]; - [subviewButton setFont:[[MAMEDebugView class] defaultFont]]; + [subviewButton setFont:defaultFont]; [subviewButton setTarget:self]; [subviewButton setAction:@selector(changeSubview:)]; [[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom]; diff --git a/src/osd/modules/debugger/osx/memoryviewer.m b/src/osd/modules/debugger/osx/memoryviewer.m index 18aa0b380da..5812aec65b0 100644 --- a/src/osd/modules/debugger/osx/memoryviewer.m +++ b/src/osd/modules/debugger/osx/memoryviewer.m @@ -25,16 +25,17 @@ NSScrollView *memoryScroll; NSView *expressionContainer; NSPopUpButton *actionButton; - NSRect contentBounds, expressionFrame; + NSRect expressionFrame; if (!(self = [super initWithMachine:m title:@"Memory" console:c])) return nil; - contentBounds = [[window contentView] bounds]; + NSRect const contentBounds = [[window contentView] bounds]; + NSFont *const defaultFont = [[MAMEDebugView class] defaultFontForMachine:m]; // create the expression field expressionField = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 100, 19)]; [expressionField setAutoresizingMask:(NSViewWidthSizable | NSViewMaxXMargin | NSViewMinYMargin)]; - [expressionField setFont:[[MAMEDebugView class] defaultFont]]; + [expressionField setFont:defaultFont]; [expressionField setFocusRingType:NSFocusRingTypeNone]; [expressionField setTarget:self]; [expressionField setAction:@selector(doExpression:)]; @@ -50,7 +51,7 @@ [subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinXMargin | NSViewMinYMargin)]; [subviewButton setBezelStyle:NSShadowlessSquareBezelStyle]; [subviewButton setFocusRingType:NSFocusRingTypeNone]; - [subviewButton setFont:[[MAMEDebugView class] defaultFont]]; + [subviewButton setFont:defaultFont]; [subviewButton setTarget:self]; [subviewButton setAction:@selector(changeSubview:)]; [[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom]; @@ -144,7 +145,7 @@ } -- (BOOL)selectSubviewForDevice:(device_t *)device { +- (BOOL)selectSubviewForDevice:(device_t *)device { BOOL const result = [memoryView selectSubviewForDevice:device]; [subviewButton selectItemAtIndex:[subviewButton indexOfItemWithTag:[memoryView selectedSubviewIndex]]]; [window setTitle:[NSString stringWithFormat:@"Memory: %@", [memoryView selectedSubviewName]]]; diff --git a/src/osd/modules/debugger/osx/pointsviewer.m b/src/osd/modules/debugger/osx/pointsviewer.m index dca14527b92..81cc4ee5f8e 100644 --- a/src/osd/modules/debugger/osx/pointsviewer.m +++ b/src/osd/modules/debugger/osx/pointsviewer.m @@ -36,7 +36,7 @@ [subviewButton setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; [subviewButton setBezelStyle:NSShadowlessSquareBezelStyle]; [subviewButton setFocusRingType:NSFocusRingTypeNone]; - [subviewButton setFont:[[MAMEDebugView class] defaultFont]]; + [subviewButton setFont:[[MAMEDebugView class] defaultFontForMachine:m]]; [subviewButton setTarget:self]; [subviewButton setAction:@selector(changeSubview:)]; [[subviewButton cell] setArrowPosition:NSPopUpArrowAtBottom]; From a214550373e059f09e2ef9a60ccdd6663c83b8e2 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 9 Apr 2015 18:05:23 +0200 Subject: [PATCH 10/10] jackie.c, lwings.c, pitnrun.c, splash.c, spoker.c, ssfindo.c: added / completed save state support (nw) --- src/mame/drivers/jackie.c | 140 +++++++++++++----------- src/mame/drivers/lwings.c | 1 + src/mame/drivers/pitnrun.c | 46 ++++---- src/mame/drivers/splash.c | 206 ++++++++++++++++++++---------------- src/mame/drivers/spoker.c | 100 +++++++++-------- src/mame/drivers/ssfindo.c | 89 ++++++++++------ src/mame/includes/pitnrun.h | 78 ++++++++------ src/mame/includes/splash.h | 169 ++++++++++++++++------------- src/mame/machine/pitnrun.c | 44 +++++--- src/mame/video/pitnrun.c | 39 +++---- src/mame/video/splash.c | 18 ++-- 11 files changed, 530 insertions(+), 400 deletions(-) diff --git a/src/mame/drivers/jackie.c b/src/mame/drivers/jackie.c index 5f21d38be05..10c6dcd46df 100644 --- a/src/mame/drivers/jackie.c +++ b/src/mame/drivers/jackie.c @@ -54,18 +54,22 @@ public: jackie_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), + m_gfxdecode(*this, "gfxdecode"), + m_screen(*this, "screen"), + m_palette(*this, "palette"), m_bg_scroll2(*this, "bg_scroll2"), m_bg_scroll(*this, "bg_scroll"), m_reel1_ram(*this, "reel1_ram"), m_reel2_ram(*this, "reel2_ram"), m_reel3_ram(*this, "reel3_ram"), m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), - m_gfxdecode(*this, "gfxdecode"), - m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_fg_color_ram(*this, "fg_color_ram") { } required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_bg_scroll2; required_shared_ptr m_bg_scroll; required_shared_ptr m_reel1_ram; @@ -73,9 +77,6 @@ public: required_shared_ptr m_reel3_ram; required_shared_ptr m_fg_tile_ram; required_shared_ptr m_fg_color_ram; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; int m_exp_bank; tilemap_t *m_fg_tilemap; @@ -92,33 +93,39 @@ public: DECLARE_WRITE8_MEMBER(fg_tile_w); DECLARE_WRITE8_MEMBER(fg_color_w); DECLARE_WRITE8_MEMBER(bg_scroll_w); - DECLARE_WRITE8_MEMBER(jackie_reel1_ram_w); - DECLARE_WRITE8_MEMBER(jackie_reel2_ram_w); - DECLARE_WRITE8_MEMBER(jackie_reel3_ram_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg1_lo_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg2_lo_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg3_lo_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg1_hi_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg2_hi_w); - DECLARE_WRITE8_MEMBER(jackie_unk_reg3_hi_w); - DECLARE_WRITE8_MEMBER(jackie_nmi_and_coins_w); - DECLARE_WRITE8_MEMBER(jackie_lamps_w); + DECLARE_WRITE8_MEMBER(reel1_ram_w); + DECLARE_WRITE8_MEMBER(reel2_ram_w); + DECLARE_WRITE8_MEMBER(reel3_ram_w); + DECLARE_WRITE8_MEMBER(unk_reg1_lo_w); + DECLARE_WRITE8_MEMBER(unk_reg2_lo_w); + DECLARE_WRITE8_MEMBER(unk_reg3_lo_w); + DECLARE_WRITE8_MEMBER(unk_reg1_hi_w); + DECLARE_WRITE8_MEMBER(unk_reg2_hi_w); + DECLARE_WRITE8_MEMBER(unk_reg3_hi_w); + DECLARE_WRITE8_MEMBER(nmi_and_coins_w); + DECLARE_WRITE8_MEMBER(lamps_w); DECLARE_READ8_MEMBER(igs_irqack_r); DECLARE_WRITE8_MEMBER(igs_irqack_w); DECLARE_READ8_MEMBER(expram_r); - void jackie_unk_reg_lo_w( int offset, UINT8 data, int reg ); - void jackie_unk_reg_hi_w( int offset, UINT8 data, int reg ); + + void unk_reg_lo_w( int offset, UINT8 data, int reg ); + void unk_reg_hi_w( int offset, UINT8 data, int reg ); void show_out(); + DECLARE_CUSTOM_INPUT_MEMBER(hopper_r); - DECLARE_DRIVER_INIT(jackie); + TILE_GET_INFO_MEMBER(get_fg_tile_info); - TILE_GET_INFO_MEMBER(get_jackie_reel1_tile_info); - TILE_GET_INFO_MEMBER(get_jackie_reel2_tile_info); - TILE_GET_INFO_MEMBER(get_jackie_reel3_tile_info); + TILE_GET_INFO_MEMBER(get_reel1_tile_info); + TILE_GET_INFO_MEMBER(get_reel2_tile_info); + TILE_GET_INFO_MEMBER(get_reel3_tile_info); + + DECLARE_DRIVER_INIT(jackie); + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - UINT32 screen_update_jackie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(jackie_irq); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + TIMER_DEVICE_CALLBACK_MEMBER(irq); }; @@ -152,13 +159,13 @@ WRITE8_MEMBER(jackie_state::bg_scroll_w) } -WRITE8_MEMBER(jackie_state::jackie_reel1_ram_w) +WRITE8_MEMBER(jackie_state::reel1_ram_w) { m_reel1_ram[offset] = data; m_reel1_tilemap->mark_tile_dirty(offset); } -TILE_GET_INFO_MEMBER(jackie_state::get_jackie_reel1_tile_info) +TILE_GET_INFO_MEMBER(jackie_state::get_reel1_tile_info) { int code = m_reel1_ram[tile_index]; SET_TILE_INFO_MEMBER(1, code, 0, 0); @@ -166,26 +173,26 @@ TILE_GET_INFO_MEMBER(jackie_state::get_jackie_reel1_tile_info) -WRITE8_MEMBER(jackie_state::jackie_reel2_ram_w) +WRITE8_MEMBER(jackie_state::reel2_ram_w) { m_reel2_ram[offset] = data; m_reel2_tilemap->mark_tile_dirty(offset); } -TILE_GET_INFO_MEMBER(jackie_state::get_jackie_reel2_tile_info) +TILE_GET_INFO_MEMBER(jackie_state::get_reel2_tile_info) { int code = m_reel2_ram[tile_index]; SET_TILE_INFO_MEMBER(1, code, 0, 0); } -WRITE8_MEMBER(jackie_state::jackie_reel3_ram_w) +WRITE8_MEMBER(jackie_state::reel3_ram_w) { m_reel3_ram[offset] = data; m_reel3_tilemap->mark_tile_dirty(offset); } -TILE_GET_INFO_MEMBER(jackie_state::get_jackie_reel3_tile_info) +TILE_GET_INFO_MEMBER(jackie_state::get_reel3_tile_info) { int code = m_reel3_ram[tile_index]; SET_TILE_INFO_MEMBER(1, code, 0, 0); @@ -193,9 +200,9 @@ TILE_GET_INFO_MEMBER(jackie_state::get_jackie_reel3_tile_info) void jackie_state::video_start() { - m_reel1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_jackie_reel1_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); - m_reel2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_jackie_reel2_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); - m_reel3_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_jackie_reel3_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); + m_reel1_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_reel1_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); + m_reel2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_reel2_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); + m_reel3_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(jackie_state::get_reel3_tile_info),this),TILEMAP_SCAN_ROWS,8,32, 64, 8); m_reel1_tilemap->set_scroll_cols(64); m_reel2_tilemap->set_scroll_cols(64); @@ -206,7 +213,7 @@ void jackie_state::video_start() } -UINT32 jackie_state::screen_update_jackie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 jackie_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int i,j; int startclipmin = 0; @@ -253,7 +260,16 @@ UINT32 jackie_state::screen_update_jackie(screen_device &screen, bitmap_ind16 &b return 0; } - +void jackie_state::machine_start() +{ + save_item(NAME(m_exp_bank)); + // save_item(NAME(m_irq_enable)); //always 1? + save_item(NAME(m_nmi_enable)); + // save_item(NAME(m_bg_enable)); //always 1? + save_item(NAME(m_hopper)); + save_item(NAME(m_out)); + save_item(NAME(m_unk_reg)); +} void jackie_state::machine_reset() { @@ -276,29 +292,29 @@ void jackie_state::show_out() #endif } -void jackie_state::jackie_unk_reg_lo_w( int offset, UINT8 data, int reg ) +void jackie_state::unk_reg_lo_w( int offset, UINT8 data, int reg ) { m_unk_reg[reg][offset] &= 0xff00; m_unk_reg[reg][offset] |= data; show_out(); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg1_lo_w){ jackie_unk_reg_lo_w( offset, data, 0 ); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg2_lo_w){ jackie_unk_reg_lo_w( offset, data, 1 ); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg3_lo_w){ jackie_unk_reg_lo_w( offset, data, 2 ); } +WRITE8_MEMBER(jackie_state::unk_reg1_lo_w){ unk_reg_lo_w( offset, data, 0 ); } +WRITE8_MEMBER(jackie_state::unk_reg2_lo_w){ unk_reg_lo_w( offset, data, 1 ); } +WRITE8_MEMBER(jackie_state::unk_reg3_lo_w){ unk_reg_lo_w( offset, data, 2 ); } -void jackie_state::jackie_unk_reg_hi_w( int offset, UINT8 data, int reg ) +void jackie_state::unk_reg_hi_w( int offset, UINT8 data, int reg ) { m_unk_reg[reg][offset] &= 0xff; m_unk_reg[reg][offset] |= data << 8; show_out(); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg1_hi_w){ jackie_unk_reg_hi_w( offset, data, 0 ); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg2_hi_w){ jackie_unk_reg_hi_w( offset, data, 1 ); } -WRITE8_MEMBER(jackie_state::jackie_unk_reg3_hi_w){ jackie_unk_reg_hi_w( offset, data, 2 ); } +WRITE8_MEMBER(jackie_state::unk_reg1_hi_w){ unk_reg_hi_w( offset, data, 0 ); } +WRITE8_MEMBER(jackie_state::unk_reg2_hi_w){ unk_reg_hi_w( offset, data, 1 ); } +WRITE8_MEMBER(jackie_state::unk_reg3_hi_w){ unk_reg_hi_w( offset, data, 2 ); } -WRITE8_MEMBER(jackie_state::jackie_nmi_and_coins_w) +WRITE8_MEMBER(jackie_state::nmi_and_coins_w) { coin_counter_w(machine(), 0, data & 0x01); // coin_a coin_counter_w(machine(), 1, data & 0x04); // coin_c @@ -314,7 +330,7 @@ WRITE8_MEMBER(jackie_state::jackie_nmi_and_coins_w) show_out(); } -WRITE8_MEMBER(jackie_state::jackie_lamps_w) +WRITE8_MEMBER(jackie_state::lamps_w) { /* - Lbits - @@ -369,12 +385,12 @@ static ADDRESS_MAP_START( jackie_prg_map, AS_PROGRAM, 8, jackie_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( jackie_io_map, AS_IO, 8, jackie_state ) - AM_RANGE(0x0520, 0x0524) AM_WRITE(jackie_unk_reg1_lo_w) - AM_RANGE(0x0d20, 0x0d24) AM_WRITE(jackie_unk_reg1_hi_w) - AM_RANGE(0x0560, 0x0564) AM_WRITE(jackie_unk_reg2_lo_w) - AM_RANGE(0x0d60, 0x0d64) AM_WRITE(jackie_unk_reg2_hi_w) - AM_RANGE(0x05a0, 0x05a4) AM_WRITE(jackie_unk_reg3_lo_w) - AM_RANGE(0x0da0, 0x0da4) AM_WRITE(jackie_unk_reg3_hi_w) + AM_RANGE(0x0520, 0x0524) AM_WRITE(unk_reg1_lo_w) + AM_RANGE(0x0d20, 0x0d24) AM_WRITE(unk_reg1_hi_w) + AM_RANGE(0x0560, 0x0564) AM_WRITE(unk_reg2_lo_w) + AM_RANGE(0x0d60, 0x0d64) AM_WRITE(unk_reg2_hi_w) + AM_RANGE(0x05a0, 0x05a4) AM_WRITE(unk_reg3_lo_w) + AM_RANGE(0x0da0, 0x0da4) AM_WRITE(unk_reg3_hi_w) AM_RANGE(0x1000, 0x1107) AM_RAM AM_SHARE("bg_scroll2") AM_RANGE(0x2000, 0x27ff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette") AM_RANGE(0x2800, 0x2fff) AM_RAM_DEVWRITE("palette", palette_device, write_ext) AM_SHARE("palette_ext") @@ -383,18 +399,18 @@ static ADDRESS_MAP_START( jackie_io_map, AS_IO, 8, jackie_state ) AM_RANGE(0x4002, 0x4002) AM_READ_PORT("DSW3") /* DSW3 */ AM_RANGE(0x4003, 0x4003) AM_READ_PORT("DSW4") /* DSW4 */ AM_RANGE(0x4004, 0x4004) AM_READ_PORT("DSW5") /* DSW5 */ - AM_RANGE(0x5080, 0x5080) AM_WRITE(jackie_nmi_and_coins_w) + AM_RANGE(0x5080, 0x5080) AM_WRITE(nmi_and_coins_w) AM_RANGE(0x5081, 0x5081) AM_READ_PORT("SERVICE") AM_RANGE(0x5082, 0x5082) AM_READ_PORT("COINS") AM_RANGE(0x5090, 0x5090) AM_READ_PORT("BUTTONS1") - AM_RANGE(0x5091, 0x5091) AM_WRITE(jackie_lamps_w ) + AM_RANGE(0x5091, 0x5091) AM_WRITE(lamps_w ) AM_RANGE(0x50a0, 0x50a0) AM_READ_PORT("BUTTONS2") AM_RANGE(0x50b0, 0x50b1) AM_DEVWRITE("ymsnd", ym2413_device, write) AM_RANGE(0x50c0, 0x50c0) AM_READ(igs_irqack_r) AM_WRITE(igs_irqack_w) AM_RANGE(0x6000, 0x60ff) AM_RAM_WRITE(bg_scroll_w ) AM_SHARE("bg_scroll") - AM_RANGE(0x6800, 0x69ff) AM_RAM_WRITE(jackie_reel1_ram_w ) AM_SHARE("reel1_ram") - AM_RANGE(0x6a00, 0x6bff) AM_RAM_WRITE(jackie_reel2_ram_w ) AM_SHARE("reel2_ram") - AM_RANGE(0x6c00, 0x6dff) AM_RAM_WRITE(jackie_reel3_ram_w ) AM_SHARE("reel3_ram") + AM_RANGE(0x6800, 0x69ff) AM_RAM_WRITE(reel1_ram_w ) AM_SHARE("reel1_ram") + AM_RANGE(0x6a00, 0x6bff) AM_RAM_WRITE(reel2_ram_w ) AM_SHARE("reel2_ram") + AM_RANGE(0x6c00, 0x6dff) AM_RAM_WRITE(reel3_ram_w ) AM_SHARE("reel3_ram") AM_RANGE(0x7000, 0x77ff) AM_RAM_WRITE(fg_tile_w ) AM_SHARE("fg_tile_ram") AM_RANGE(0x7800, 0x7fff) AM_RAM_WRITE(fg_color_w ) AM_SHARE("fg_color_ram") AM_RANGE(0x8000, 0xffff) AM_READ(expram_r) @@ -564,7 +580,7 @@ DRIVER_INIT_MEMBER(jackie_state,jackie) rom[0x7e86] = 0xc3; } -TIMER_DEVICE_CALLBACK_MEMBER(jackie_state::jackie_irq) +TIMER_DEVICE_CALLBACK_MEMBER(jackie_state::irq) { int scanline = param; @@ -583,7 +599,7 @@ static MACHINE_CONFIG_START( jackie, jackie_state ) MCFG_CPU_ADD("maincpu", Z80, XTAL_12MHz / 2) MCFG_CPU_PROGRAM_MAP(jackie_prg_map) MCFG_CPU_IO_MAP(jackie_io_map) - MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", jackie_state, jackie_irq, "screen", 0, 1) + MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", jackie_state, irq, "screen", 0, 1) /* video hardware */ @@ -592,7 +608,7 @@ static MACHINE_CONFIG_START( jackie, jackie_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(jackie_state, screen_update_jackie) + MCFG_SCREEN_UPDATE_DRIVER(jackie_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", jackie) @@ -632,4 +648,4 @@ ROM_START( jackie ) ROM_END -GAME( 1993, jackie, 0, jackie, jackie, jackie_state, jackie, ROT0, "IGS", "Happy Jackie (v110U)", 0 ) +GAME( 1993, jackie, 0, jackie, jackie, jackie_state, jackie, ROT0, "IGS", "Happy Jackie (v110U)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/lwings.c b/src/mame/drivers/lwings.c index 64b86e50dc2..139c01448fa 100644 --- a/src/mame/drivers/lwings.c +++ b/src/mame/drivers/lwings.c @@ -740,6 +740,7 @@ void lwings_state::machine_start() save_item(NAME(m_palette_pen)); save_item(NAME(m_soundstate)); save_item(NAME(m_adpcm)); + save_item(NAME(m_nmi_mask)); } void lwings_state::machine_reset() diff --git a/src/mame/drivers/pitnrun.c b/src/mame/drivers/pitnrun.c index 656fb03c633..b782cc2497e 100644 --- a/src/mame/drivers/pitnrun.c +++ b/src/mame/drivers/pitnrun.c @@ -70,7 +70,7 @@ K1000233A #include "includes/pitnrun.h" -INTERRUPT_GEN_MEMBER(pitnrun_state::pitnrun_nmi_source) +INTERRUPT_GEN_MEMBER(pitnrun_state::nmi_source) { if(m_nmi) device.execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); } @@ -80,12 +80,12 @@ WRITE8_MEMBER(pitnrun_state::nmi_enable_w) m_nmi = data & 1; } -WRITE8_MEMBER(pitnrun_state::pitnrun_hflip_w) +WRITE8_MEMBER(pitnrun_state::hflip_w) { flip_screen_x_set(data); } -WRITE8_MEMBER(pitnrun_state::pitnrun_vflip_w) +WRITE8_MEMBER(pitnrun_state::vflip_w) { flip_screen_y_set(data); } @@ -93,26 +93,26 @@ WRITE8_MEMBER(pitnrun_state::pitnrun_vflip_w) static ADDRESS_MAP_START( pitnrun_map, AS_PROGRAM, 8, pitnrun_state ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x8000, 0x87ff) AM_RAM - AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(pitnrun_videoram_w) AM_SHARE("videoram") - AM_RANGE(0x9000, 0x9fff) AM_RAM_WRITE(pitnrun_videoram2_w) AM_SHARE("videoram2") + AM_RANGE(0x8800, 0x8fff) AM_RAM_WRITE(videoram_w) AM_SHARE("videoram") + AM_RANGE(0x9000, 0x9fff) AM_RAM_WRITE(videoram2_w) AM_SHARE("videoram2") AM_RANGE(0xa000, 0xa0ff) AM_RAM AM_SHARE("spriteram") AM_RANGE(0xa800, 0xa800) AM_READ_PORT("SYSTEM") AM_RANGE(0xa800, 0xa807) AM_WRITENOP /* Analog Sound */ AM_RANGE(0xb000, 0xb000) AM_READ_PORT("DSW") AM_WRITE(nmi_enable_w) - AM_RANGE(0xb001, 0xb001) AM_WRITE(pitnrun_color_select_w) + AM_RANGE(0xb001, 0xb001) AM_WRITE(color_select_w) AM_RANGE(0xb004, 0xb004) AM_WRITENOP/* COLOR SEL 2 - not used ?*/ - AM_RANGE(0xb005, 0xb005) AM_WRITE(pitnrun_char_bank_select) - AM_RANGE(0xb006, 0xb006) AM_WRITE(pitnrun_hflip_w) - AM_RANGE(0xb007, 0xb007) AM_WRITE(pitnrun_vflip_w) + AM_RANGE(0xb005, 0xb005) AM_WRITE(char_bank_select) + AM_RANGE(0xb006, 0xb006) AM_WRITE(hflip_w) + AM_RANGE(0xb007, 0xb007) AM_WRITE(vflip_w) AM_RANGE(0xb800, 0xb800) AM_READ_PORT("INPUTS") AM_WRITE(soundlatch_byte_w) - AM_RANGE(0xc800, 0xc801) AM_WRITE(pitnrun_scroll_w) + AM_RANGE(0xc800, 0xc801) AM_WRITE(scroll_w) AM_RANGE(0xc802, 0xc802) AM_WRITENOP/* VP(VF?)MCV - not used ?*/ - AM_RANGE(0xc804, 0xc804) AM_WRITE(pitnrun_mcu_data_w) - AM_RANGE(0xc805, 0xc805) AM_WRITE(pitnrun_h_heed_w) - AM_RANGE(0xc806, 0xc806) AM_WRITE(pitnrun_v_heed_w) - AM_RANGE(0xc807, 0xc807) AM_WRITE(pitnrun_ha_w) - AM_RANGE(0xd800, 0xd800) AM_READ(pitnrun_mcu_status_r) - AM_RANGE(0xd000, 0xd000) AM_READ(pitnrun_mcu_data_r) + AM_RANGE(0xc804, 0xc804) AM_WRITE(mcu_data_w) + AM_RANGE(0xc805, 0xc805) AM_WRITE(h_heed_w) + AM_RANGE(0xc806, 0xc806) AM_WRITE(v_heed_w) + AM_RANGE(0xc807, 0xc807) AM_WRITE(ha_w) + AM_RANGE(0xd800, 0xd800) AM_READ(mcu_status_r) + AM_RANGE(0xd000, 0xd000) AM_READ(mcu_data_r) AM_RANGE(0xf000, 0xf000) AM_READ(watchdog_reset_r) ADDRESS_MAP_END @@ -134,9 +134,9 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( pitnrun_mcu_map, AS_PROGRAM, 8, pitnrun_state ) ADDRESS_MAP_GLOBAL_MASK(0x7ff) - AM_RANGE(0x0000, 0x0000) AM_READWRITE(pitnrun_68705_portA_r,pitnrun_68705_portA_w) - AM_RANGE(0x0001, 0x0001) AM_READWRITE(pitnrun_68705_portB_r,pitnrun_68705_portB_w) - AM_RANGE(0x0002, 0x0002) AM_READ(pitnrun_68705_portC_r) + AM_RANGE(0x0000, 0x0000) AM_READWRITE(m68705_portA_r,m68705_portA_w) + AM_RANGE(0x0001, 0x0001) AM_READWRITE(m68705_portB_r,m68705_portB_w) + AM_RANGE(0x0002, 0x0002) AM_READ(m68705_portC_r) AM_RANGE(0x0003, 0x007f) AM_RAM AM_RANGE(0x0080, 0x07ff) AM_ROM ADDRESS_MAP_END @@ -220,7 +220,7 @@ GFXDECODE_END static MACHINE_CONFIG_START( pitnrun, pitnrun_state ) MCFG_CPU_ADD("maincpu", Z80,XTAL_18_432MHz/6) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(pitnrun_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", pitnrun_state, pitnrun_nmi_source) + MCFG_CPU_VBLANK_INT_DRIVER("screen", pitnrun_state, nmi_source) MCFG_CPU_ADD("audiocpu", Z80, XTAL_5MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(pitnrun_sound_map) @@ -239,7 +239,7 @@ static MACHINE_CONFIG_START( pitnrun, pitnrun_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(256, 256) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(pitnrun_state, screen_update_pitnrun) + MCFG_SCREEN_UPDATE_DRIVER(pitnrun_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", pitnrun) @@ -331,5 +331,5 @@ ROM_START( pitnruna ) ROM_LOAD( "clr.3", 0x0040, 0x0020, CRC(25e70e5e) SHA1(fdb9c69e9568a725dd0e3ac25835270fb4f49280) ) ROM_END -GAME( 1984, pitnrun, 0, pitnrun, pitnrun, driver_device, 0, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 1)", GAME_IMPERFECT_SOUND ) -GAME( 1984, pitnruna, pitnrun, pitnrun, pitnrun, driver_device, 0, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 2)", GAME_IMPERFECT_SOUND ) +GAME( 1984, pitnrun, 0, pitnrun, pitnrun, driver_device, 0, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 1)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1984, pitnruna, pitnrun, pitnrun, pitnrun, driver_device, 0, ROT90, "Taito Corporation", "Pit & Run - F-1 Race (set 2)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/splash.c b/src/mame/drivers/splash.c index 335953d9572..4b7cbdcd2b9 100644 --- a/src/mame/drivers/splash.c +++ b/src/mame/drivers/splash.c @@ -31,13 +31,13 @@ Sound not working on Return of Lady Frog TS 2006.12.22: - Funny Strip is runing on pSOS RTOS ( http://en.wikipedia.org/wiki/PSOS and http://dr-linux.net/newbase/reference/psosCD/ ) . - There's copyrigth text at $480 + There's copyright text at $480 Also Rebus and TRoLF are running on it (the same internal code structure - traps, interrupt vectors), but copyright messages are removed. - Rebus protection patch sits at the end of trap $b (rtos call) and in some cases returns 0 in D0. It's not a real protection check i think. -More notes about Funny Strip protection issus at the boottom of source file (DRIVER INIT) +More notes about Funny Strip protection issues at the bottom of source file (DRIVER INIT) ***************************************************************************/ @@ -46,7 +46,6 @@ More notes about Funny Strip protection issus at the boottom of source file (DRI #include "cpu/m68000/m68000.h" #include "sound/2203intf.h" #include "sound/3812intf.h" -#include "sound/msm5205.h" #include "includes/splash.h" WRITE16_MEMBER(splash_state::splash_sh_irqtrigger_w) @@ -70,7 +69,7 @@ WRITE16_MEMBER(splash_state::roldf_sh_irqtrigger_w) space.device().execute().spin_until_time(attotime::from_usec(40)); } -WRITE16_MEMBER(splash_state::splash_coin_w) +WRITE16_MEMBER(splash_state::coin_w) { if (ACCESSING_BITS_8_15) { @@ -96,8 +95,8 @@ static ADDRESS_MAP_START( splash_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") AM_RANGE(0x84000e, 0x84000f) AM_WRITE(splash_sh_irqtrigger_w) /* Sound command */ - AM_RANGE(0x84000a, 0x84003b) AM_WRITE(splash_coin_w) /* Coin Counters + Coin Lockout */ - AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_SHARE("videoram") /* Video RAM */ + AM_RANGE(0x84000a, 0x84003b) AM_WRITE(coin_w) /* Coin Counters + Coin Lockout */ + AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ AM_RANGE(0x881804, 0x881fff) AM_RAM /* Work RAM */ AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")/* Palette is xRRRRxGGGGxBBBBx */ @@ -169,8 +168,8 @@ static ADDRESS_MAP_START( roldfrog_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") AM_RANGE(0x84000e, 0x84000f) AM_WRITE(roldf_sh_irqtrigger_w) /* Sound command */ - AM_RANGE(0x84000a, 0x84003b) AM_WRITE(splash_coin_w) /* Coin Counters + Coin Lockout */ - AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_SHARE("videoram") /* Video RAM */ + AM_RANGE(0x84000a, 0x84003b) AM_WRITE(coin_w) /* Coin Counters + Coin Lockout */ + AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ AM_RANGE(0x881804, 0x881fff) AM_RAM /* Work RAM */ AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")/* Palette is xRRRRxGGGGxBBBBx */ @@ -224,14 +223,14 @@ static ADDRESS_MAP_START( funystrp_map, AS_PROGRAM, 16, splash_state ) AM_RANGE(0x000000, 0x01ffff) AM_ROM /* ROM */ AM_RANGE(0x100000, 0x1fffff) AM_RAM /* protection? RAM */ AM_RANGE(0x800000, 0x83ffff) AM_RAM AM_SHARE("pixelram") /* Pixel Layer */ - AM_RANGE(0x84000a, 0x84000b) AM_WRITE(splash_coin_w) /* Coin Counters + Coin Lockout */ + AM_RANGE(0x84000a, 0x84000b) AM_WRITE(coin_w) /* Coin Counters + Coin Lockout */ AM_RANGE(0x84000e, 0x84000f) AM_WRITE(funystrp_sh_irqtrigger_w) /* Sound command */ AM_RANGE(0x840000, 0x840001) AM_READ_PORT("DSW1") AM_RANGE(0x840002, 0x840003) AM_READ_PORT("DSW2") AM_RANGE(0x840004, 0x840005) AM_READ_PORT("P1") AM_RANGE(0x840006, 0x840007) AM_READ_PORT("P2") AM_RANGE(0x840008, 0x840009) AM_READ_PORT("SYSTEM") - AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(splash_vram_w) AM_SHARE("videoram") /* Video RAM */ + AM_RANGE(0x880000, 0x8817ff) AM_RAM_WRITE(vram_w) AM_SHARE("videoram") /* Video RAM */ AM_RANGE(0x881800, 0x881803) AM_RAM AM_SHARE("vregs") /* Scroll registers */ AM_RANGE(0x881804, 0x881fff) AM_WRITENOP AM_RANGE(0x8c0000, 0x8c0fff) AM_RAM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")/* Palette is xRRRRxGGGGxBBBBx */ @@ -472,6 +471,11 @@ static GFXDECODE_START( splash ) GFXDECODE_END +MACHINE_START_MEMBER(splash_state,splash) +{ + save_item(NAME(m_adpcm_data)); +} + MACHINE_RESET_MEMBER(splash_state,splash) { m_adpcm_data = 0; @@ -495,13 +499,14 @@ static MACHINE_CONFIG_START( splash, splash_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(64*8, 64*8) MCFG_SCREEN_VISIBLE_AREA(2*8, 48*8-1, 2*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update_splash) + MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", splash) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + MCFG_MACHINE_START_OVERRIDE(splash_state, splash ) MCFG_MACHINE_RESET_OVERRIDE(splash_state, splash ) /* sound hardware */ @@ -517,6 +522,13 @@ static MACHINE_CONFIG_START( splash, splash_state ) MACHINE_CONFIG_END +MACHINE_START_MEMBER(splash_state, roldfrog) +{ + save_item(NAME(m_ret)); + save_item(NAME(m_vblank_irq)); + save_item(NAME(m_sound_irq)); +} + INTERRUPT_GEN_MEMBER(splash_state::roldfrog_interrupt) { m_vblank_irq = 1; @@ -541,14 +553,14 @@ static MACHINE_CONFIG_START( roldfrog, splash_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(64*8, 64*8) MCFG_SCREEN_VISIBLE_AREA(2*8, 48*8-1, 2*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update_splash) + MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", splash) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - + MCFG_MACHINE_START_OVERRIDE(splash_state, roldfrog ) MCFG_MACHINE_RESET_OVERRIDE(splash_state, splash ) /* sound hardware */ @@ -592,6 +604,21 @@ WRITE_LINE_MEMBER(splash_state::adpcm_int2) } } + +MACHINE_START_MEMBER(splash_state, funystrp) +{ + save_item(NAME(m_funystrp_val)); + save_item(NAME(m_funystrp_ff3cc7_val)); + save_item(NAME(m_funystrp_ff3cc8_val)); + save_item(NAME(m_msm_data1)); + save_item(NAME(m_msm_data2)); + save_item(NAME(m_msm_toggle1)); + save_item(NAME(m_msm_toggle2)); + save_item(NAME(m_msm_source)); + save_item(NAME(m_snd_interrupt_enable1)); + save_item(NAME(m_snd_interrupt_enable2)); +} + static MACHINE_CONFIG_START( funystrp, splash_state ) /* basic machine hardware */ @@ -616,6 +643,7 @@ static MACHINE_CONFIG_START( funystrp, splash_state ) MCFG_PALETTE_ADD("palette", 2048) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) + MCFG_MACHINE_START_OVERRIDE(splash_state, funystrp ) MCFG_MACHINE_RESET_OVERRIDE(splash_state, funystrp ) /* sound hardware */ @@ -1035,222 +1063,222 @@ READ16_MEMBER(splash_state::funystrp_protection_r) // sub $7ACC, $C7EE, subtractions, original value from 68k case ((0x107001 / 2) + 0x0030): // $7ACE - funystrp_val = funystrp_ff3cc7_val & 0x7f; + m_funystrp_val = m_funystrp_ff3cc7_val & 0x7f; return 0; case ((0x107001 / 2) + 0x013e): // $7AFC - return (funystrp_val + 0x13) & 0xff; + return (m_funystrp_val + 0x13) & 0xff; case ((0x107001 / 2) + 0x0279): // $7B38 - return (funystrp_val + 0x22) & 0xff; + return (m_funystrp_val + 0x22) & 0xff; case ((0x107001 / 2) + 0x0357): // $7B6E - return (funystrp_val + 0x44) & 0xff; + return (m_funystrp_val + 0x44) & 0xff; case ((0x107001 / 2) + 0x03b1): // $7BA4 - return (funystrp_val + 0x6a) & 0xff; + return (m_funystrp_val + 0x6a) & 0xff; //----------------------------------------------------------------- // sub $7E76, subtractions, original value from protection device case ((0x110001 / 2) + 0x0013): // $7E80 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x110001 / 2) + 0x0125): // $7E96 - return (funystrp_val + 0x03) & 0xff; + return (m_funystrp_val + 0x03) & 0xff; case ((0x110001 / 2) + 0x0261): // $7ECE - return (funystrp_val + 0x08) & 0xff; + return (m_funystrp_val + 0x08) & 0xff; case ((0x110001 / 2) + 0x0322): // $7F00 - return (funystrp_val + 0x12) & 0xff; + return (m_funystrp_val + 0x12) & 0xff; case ((0x110001 / 2) + 0x039b): // $7F36 - return (funystrp_val + 0x70) & 0xff; + return (m_funystrp_val + 0x70) & 0xff; //----------------------------------------------------------------- // sub $7F70, $8038, $116E2, no subtractions, straight compare!, original value from 68k // increase ff3cc8 value in sub $116e2 case ((0x100001 / 2) + 0x0010): // $7F72 - funystrp_val = funystrp_ff3cc8_val; + m_funystrp_val = m_funystrp_ff3cc8_val; return 0; case ((0x100001 / 2) + 0x0123): // $7F9A - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; case ((0x100001 / 2) + 0x0257): // $7FC4 - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; case ((0x100001 / 2) + 0x0312): // $7FEA - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; case ((0x100001 / 2) + 0x0395): // $8010 // increment $ff3cc8 in $117A8 - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; //----------------------------------------------------------------- // sub $8522, subtractions, original value from protection device, weird cases case ((0x104801 / 2) + 0x013A): // $8524 - funystrp_val = 0; + m_funystrp_val = 0; return 0; // this and above usually swapped... fooling the lazy bootlegger? case ((0x104801 / 2) + 0x0017): // $8542 - return (funystrp_val + 0x12) & 0xff; + return (m_funystrp_val + 0x12) & 0xff; // first case... weird? // case ((0x104801 / 2) + 0x013A): // $857E - // return (funystrp_val + 0x00) & 0xff; + // return (m_funystrp_val + 0x00) & 0xff; case ((0x104801 / 2) + 0x0277): // $85A4 - return (funystrp_val + 0x04) & 0xff; + return (m_funystrp_val + 0x04) & 0xff; case ((0x104801 / 2) + 0x034b): // $85D6 - return (funystrp_val + 0x37) & 0xff; + return (m_funystrp_val + 0x37) & 0xff; case ((0x104801 / 2) + 0x03ac): // $860E - return (funystrp_val + 0x77) & 0xff; + return (m_funystrp_val + 0x77) & 0xff; //----------------------------------------------------------------- // sub $88F8, subtractions, original value from protection device // verified as working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! case ((0x127001 / 2) + 0x0045): // $88FA - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x127001 / 2) + 0x0145): // $8918 - return (funystrp_val + 0x01) & 0xff; + return (m_funystrp_val + 0x01) & 0xff; case ((0x127001 / 2) + 0x028B): // $894A - return (funystrp_val + 0x02) & 0xff; + return (m_funystrp_val + 0x02) & 0xff; case ((0x127001 / 2) + 0x0363): // $8982 - return (funystrp_val + 0x03) & 0xff; + return (m_funystrp_val + 0x03) & 0xff; case ((0x127001 / 2) + 0x03BA): // $89B4 - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; //----------------------------------------------------------------- // sub $9DD2, subtractions, original value from protection device case ((0x170001 / 2) + 0x006B): // $9DD4 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x170001 / 2) + 0x0162): // $9DF2 - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; case ((0x170001 / 2) + 0x02A7): // $9E1E - return (funystrp_val + 0x7c) & 0xff; + return (m_funystrp_val + 0x7c) & 0xff; case ((0x170001 / 2) + 0x0381): // $9E54 - return (funystrp_val + 0x30) & 0xff; + return (m_funystrp_val + 0x30) & 0xff; case ((0x170001 / 2) + 0x03C7): // $9E8A - return (funystrp_val + 0x28) & 0xff; + return (m_funystrp_val + 0x28) & 0xff; //----------------------------------------------------------------- // sub $A944, subtractions, original value from protection device // verified as working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! case ((0x177001 / 2) + 0x0079): // $A946 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x177001 / 2) + 0x01A0): // $A964 - return (funystrp_val + 0x02) & 0xff; + return (m_funystrp_val + 0x02) & 0xff; case ((0x177001 / 2) + 0x02B2): // $A99C - return (funystrp_val + 0x04) & 0xff; + return (m_funystrp_val + 0x04) & 0xff; case ((0x177001 / 2) + 0x039A): // $A9CE - return (funystrp_val + 0x25) & 0xff; + return (m_funystrp_val + 0x25) & 0xff; case ((0x177001 / 2) + 0x03D3): // $AA04 - return (funystrp_val + 0x16) & 0xff; + return (m_funystrp_val + 0x16) & 0xff; //----------------------------------------------------------------- // sub $C5E4, subtractions, original value from 68k // these cases are already in sub $7ACC, last one is new!! // case ((0x107001 / 2) + 0x0030): // $7ACE - // funystrp_val = funystrp_ff3cc7_val & 0x7f; + // m_funystrp_val = m_funystrp_ff3cc7_val & 0x7f; // return 0; // case ((0x107001 / 2) + 0x013e): // $7AFC - // return (funystrp_val + 0x13) & 0xff; + // return (m_funystrp_val + 0x13) & 0xff; // case ((0x107001 / 2) + 0x0279): // $7B38 - // return (funystrp_val + 0x22) & 0xff; + // return (m_funystrp_val + 0x22) & 0xff; // case ((0x107001 / 2) + 0x0357): // $7B6E - // return (funystrp_val + 0x44) & 0xff; + // return (m_funystrp_val + 0x44) & 0xff; case ((0x107001 / 2) + 0x0381): // $7BA4 - return (funystrp_val + 0x6a) & 0xff; + return (m_funystrp_val + 0x6a) & 0xff; //----------------------------------------------------------------- // sub $DBCE, subtractions, original value from protection device case ((0x140001 / 2) + 0x0052): // $DBD0 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x140001 / 2) + 0x015C): // $DBEE - return (funystrp_val + 0x15) & 0xff; + return (m_funystrp_val + 0x15) & 0xff; case ((0x140001 / 2) + 0x0293): // $DC2A - return (funystrp_val + 0x03) & 0xff; + return (m_funystrp_val + 0x03) & 0xff; case ((0x140001 / 2) + 0x0374): // $DC5C - return (funystrp_val + 0x55) & 0xff; + return (m_funystrp_val + 0x55) & 0xff; case ((0x140001 / 2) + 0x03C0): // $DC92 - return (funystrp_val + 0x44) & 0xff; + return (m_funystrp_val + 0x44) & 0xff; //----------------------------------------------------------------- // sub $F72C, subtractions, original value from protection device, // routine verified working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! case ((0x100001 / 2) + 0x0017): // $F72E - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x100001 / 2) + 0x0127): // $F74C - return (funystrp_val + 0x17) & 0xff; + return (m_funystrp_val + 0x17) & 0xff; case ((0x110001 / 2) + 0x0263): // $F788 - return (funystrp_val + 0x0f) & 0xff; + return (m_funystrp_val + 0x0f) & 0xff; case ((0x110001 / 2) + 0x0324): // $F7BE - return (funystrp_val + 0x12) & 0xff; + return (m_funystrp_val + 0x12) & 0xff; case ((0x110001 / 2) + 0x0399): // $F7F4 - return (funystrp_val + 0x70) & 0xff; + return (m_funystrp_val + 0x70) & 0xff; //----------------------------------------------------------------- // sub $F82E, subtractions, original value from protection device, case ((0x100001 / 2) + 0x0013): // $F830 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x100001 / 2) + 0x0125): // $F84E - return (funystrp_val + 0x17) & 0xff; + return (m_funystrp_val + 0x17) & 0xff; // used in sub $7E76 // case ((0x110001 / 2) + 0x0261): // $F88A - // return (funystrp_val + 0x0f) & 0xff; + // return (m_funystrp_val + 0x0f) & 0xff; // case ((0x110001 / 2) + 0x0322): // $F8C0 - // return (funystrp_val + 0x12) & 0xff; + // return (m_funystrp_val + 0x12) & 0xff; // case ((0x110001 / 2) + 0x039B): // $F8F6 - // return (funystrp_val + 0x70) & 0xff; + // return (m_funystrp_val + 0x70) & 0xff; //----------------------------------------------------------------- // sub $10FE2, subtractions, original value from protection device @@ -1258,20 +1286,20 @@ READ16_MEMBER(splash_state::funystrp_protection_r) // examine later to verify this is right case ((0x105001 / 2) + 0x0021): // $10FF6 - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x105001 / 2) + 0x0131): // $1100C - return (funystrp_val + 0x51) & 0xff; + return (m_funystrp_val + 0x51) & 0xff; case ((0x105001 / 2) + 0x026a): // $11038 - return (funystrp_val + 0x22) & 0xff; + return (m_funystrp_val + 0x22) & 0xff; case ((0x105001 / 2) + 0x0331): // $11060 - return (funystrp_val + 0x00) & 0xff; + return (m_funystrp_val + 0x00) & 0xff; case ((0x105001 / 2) + 0x03ab): // $11078 - return (funystrp_val + 0x03) & 0xff; + return (m_funystrp_val + 0x03) & 0xff; //----------------------------------------------------------------- // sub $11F2C, subtractions, original value from protection device, @@ -1279,20 +1307,20 @@ READ16_MEMBER(splash_state::funystrp_protection_r) // examine later to verify this is right case ((0x183001 / 2) + 0x0088): // $11F3C - funystrp_val = 0; + m_funystrp_val = 0; return 0; case ((0x183001 / 2) + 0x01A7): // $11F5A - return (funystrp_val + 0x09) & 0xff; + return (m_funystrp_val + 0x09) & 0xff; case ((0x183001 / 2) + 0x02C4): // $11F86 - return (funystrp_val + 0x01) & 0xff; + return (m_funystrp_val + 0x01) & 0xff; case ((0x183001 / 2) + 0x03B3): // $11FAA - return (funystrp_val + 0x63) & 0xff; + return (m_funystrp_val + 0x63) & 0xff; case ((0x183001 / 2) + 0x03E9): // $11FD2 - return (funystrp_val + 0x65) & 0xff; + return (m_funystrp_val + 0x65) & 0xff; } return 0; @@ -1318,11 +1346,11 @@ WRITE16_MEMBER(splash_state::funystrp_protection_w) return; case (0x1007e5/2): - funystrp_ff3cc8_val = data; + m_funystrp_ff3cc8_val = data; return; case (0x1007e7/2): - funystrp_ff3cc7_val = data; + m_funystrp_ff3cc7_val = data; return; } } @@ -1341,12 +1369,12 @@ DRIVER_INIT_MEMBER(splash_state,funystrp) m_maincpu->space(AS_PROGRAM).install_read_handler(0x100000, 0x1fffff, read16_delegate(FUNC(splash_state::funystrp_protection_r),this)); } -GAME( 1992, splash, 0, splash, splash, splash_state, splash, ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.2 World)", 0 ) -GAME( 1992, splash10, splash, splash, splash, splash_state, splash10, ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.0 World)", 0 ) -GAME( 1992, paintlad, splash, splash, splash, splash_state, splash, ROT0, "Gaelco / OMK Software", "Painted Lady (Splash) (Ver. 1.3 US)", 0 ) +GAME( 1992, splash, 0, splash, splash, splash_state, splash, ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.2 World)", GAME_SUPPORTS_SAVE ) +GAME( 1992, splash10, splash, splash, splash, splash_state, splash10, ROT0, "Gaelco / OMK Software", "Splash! (Ver. 1.0 World)", GAME_SUPPORTS_SAVE ) +GAME( 1992, paintlad, splash, splash, splash, splash_state, splash, ROT0, "Gaelco / OMK Software", "Painted Lady (Splash) (Ver. 1.3 US)", GAME_SUPPORTS_SAVE ) -GAME( 1993, roldfrog, 0, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 1)", 0) -GAME( 1993, roldfroga,roldfrog, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 2)", 0 ) -GAME( 1995, rebus, 0, roldfrog, splash, splash_state, rebus, ROT0, "Microhard", "Rebus", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND ) -GAME( 199?, funystrp, 0, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard / MagicGames", "Funny Strip", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) -GAME( 199?, puckpepl, funystrp, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard", "Puck People", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION ) +GAME( 1993, roldfrog, 0, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1993, roldfroga,roldfrog, roldfrog, splash, splash_state, roldfrog, ROT0, "Microhard", "The Return of Lady Frog (set 2)", GAME_SUPPORTS_SAVE ) +GAME( 1995, rebus, 0, roldfrog, splash, splash_state, rebus, ROT0, "Microhard", "Rebus", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 199?, funystrp, 0, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard / MagicGames", "Funny Strip", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE ) +GAME( 199?, puckpepl, funystrp, funystrp, funystrp, splash_state, funystrp, ROT0, "Microhard", "Puck People", GAME_NOT_WORKING | GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/spoker.c b/src/mame/drivers/spoker.c index f79d95fbc49..3d8eb5c3489 100644 --- a/src/mame/drivers/spoker.c +++ b/src/mame/drivers/spoker.c @@ -27,14 +27,19 @@ class spoker_state : public driver_device public: spoker_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_bg_tile_ram(*this, "bg_tile_ram"), - m_fg_tile_ram(*this, "fg_tile_ram"), - m_fg_color_ram(*this, "fg_color_ram"), m_maincpu(*this, "maincpu"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_bg_tile_ram(*this, "bg_tile_ram"), + m_fg_tile_ram(*this, "fg_tile_ram"), + m_fg_color_ram(*this, "fg_color_ram") { } + required_device m_maincpu; + required_device m_gfxdecode; + required_device m_screen; + required_device m_palette; + required_shared_ptr m_bg_tile_ram; tilemap_t *m_bg_tilemap; @@ -42,32 +47,39 @@ public: required_shared_ptr m_fg_color_ram; tilemap_t *m_fg_tilemap; - int m_video_enable; + // common int m_nmi_ack; + UINT8 m_out[3]; + + // spk116it and spk115it specific + int m_video_enable; int m_hopper; UINT8 m_igs_magic[2]; - UINT8 m_out[3]; + + // common DECLARE_WRITE8_MEMBER(bg_tile_w); DECLARE_WRITE8_MEMBER(fg_tile_w); DECLARE_WRITE8_MEMBER(fg_color_w); - DECLARE_WRITE8_MEMBER(spoker_nmi_and_coins_w); - DECLARE_WRITE8_MEMBER(spoker_video_and_leds_w); - DECLARE_WRITE8_MEMBER(spoker_leds_w); - DECLARE_WRITE8_MEMBER(spoker_magic_w); - DECLARE_READ8_MEMBER(spoker_magic_r); + DECLARE_WRITE8_MEMBER(nmi_and_coins_w); + DECLARE_WRITE8_MEMBER(leds_w); + + // spk116it and spk115it specific + DECLARE_WRITE8_MEMBER(video_and_leds_w); + DECLARE_WRITE8_MEMBER(magic_w); + DECLARE_READ8_MEMBER(magic_r); + DECLARE_CUSTOM_INPUT_MEMBER(hopper_r); + DECLARE_DRIVER_INIT(spk116it); DECLARE_DRIVER_INIT(3super8); - TILE_GET_INFO_MEMBER(get_bg_tile_info); - TILE_GET_INFO_MEMBER(get_fg_tile_info); + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); - UINT32 screen_update_spoker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(spoker_interrupt); - required_device m_maincpu; - required_device m_gfxdecode; - required_device m_screen; - required_device m_palette; + + TILE_GET_INFO_MEMBER(get_bg_tile_info); + TILE_GET_INFO_MEMBER(get_fg_tile_info); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); }; WRITE8_MEMBER(spoker_state::bg_tile_w) @@ -107,7 +119,7 @@ void spoker_state::video_start() m_fg_tilemap->set_transparent_pen(0); } -UINT32 spoker_state::screen_update_spoker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 spoker_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { bitmap.fill(m_palette->black_pen(), cliprect); m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); @@ -132,7 +144,7 @@ static void show_out(UINT8 *out) #endif } -WRITE8_MEMBER(spoker_state::spoker_nmi_and_coins_w) +WRITE8_MEMBER(spoker_state::nmi_and_coins_w) { if ((data) & (0x22)) { @@ -156,7 +168,7 @@ WRITE8_MEMBER(spoker_state::spoker_nmi_and_coins_w) show_out(m_out); } -WRITE8_MEMBER(spoker_state::spoker_video_and_leds_w) +WRITE8_MEMBER(spoker_state::video_and_leds_w) { set_led_status(machine(), 4, data & 0x01); // start? set_led_status(machine(), 5, data & 0x04); // l_bet? @@ -168,7 +180,7 @@ WRITE8_MEMBER(spoker_state::spoker_video_and_leds_w) show_out(m_out); } -WRITE8_MEMBER(spoker_state::spoker_leds_w) +WRITE8_MEMBER(spoker_state::leds_w) { set_led_status(machine(), 0, data & 0x01); // stop_1 set_led_status(machine(), 1, data & 0x02); // stop_2 @@ -180,7 +192,7 @@ WRITE8_MEMBER(spoker_state::spoker_leds_w) show_out(m_out); } -WRITE8_MEMBER(spoker_state::spoker_magic_w) +WRITE8_MEMBER(spoker_state::magic_w) { m_igs_magic[offset] = data; @@ -198,7 +210,7 @@ WRITE8_MEMBER(spoker_state::spoker_magic_w) } } -READ8_MEMBER(spoker_state::spoker_magic_r) +READ8_MEMBER(spoker_state::magic_r) { switch(m_igs_magic[0]) { @@ -237,14 +249,14 @@ static ADDRESS_MAP_START( spoker_portmap, AS_IO, 8, spoker_state ) AM_RANGE( 0x5000, 0x5fff ) AM_RAM_WRITE(fg_tile_w ) AM_SHARE("fg_tile_ram") /* TODO: ppi #1 */ - AM_RANGE( 0x6480, 0x6480 ) AM_WRITE(spoker_nmi_and_coins_w ) + AM_RANGE( 0x6480, 0x6480 ) AM_WRITE(nmi_and_coins_w ) AM_RANGE( 0x6481, 0x6481 ) AM_READ_PORT( "SERVICE" ) AM_RANGE( 0x6482, 0x6482 ) AM_READ_PORT( "COINS" ) /* TODO: ppi #2 */ AM_RANGE( 0x6490, 0x6490 ) AM_READ_PORT( "BUTTONS1" ) - AM_RANGE( 0x6491, 0x6491 ) AM_WRITE(spoker_video_and_leds_w ) - AM_RANGE( 0x6492, 0x6492 ) AM_WRITE(spoker_leds_w ) + AM_RANGE( 0x6491, 0x6491 ) AM_WRITE(video_and_leds_w ) + AM_RANGE( 0x6492, 0x6492 ) AM_WRITE(leds_w ) AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "BUTTONS2" ) @@ -252,7 +264,7 @@ static ADDRESS_MAP_START( spoker_portmap, AS_IO, 8, spoker_state ) AM_RANGE( 0x64c0, 0x64c0 ) AM_DEVREADWRITE("oki", okim6295_device, read, write) - AM_RANGE( 0x64d0, 0x64d1 ) AM_READWRITE(spoker_magic_r, spoker_magic_w ) // DSW1-5 + AM_RANGE( 0x64d0, 0x64d1 ) AM_READWRITE(magic_r, magic_w ) // DSW1-5 AM_RANGE( 0x7000, 0x7fff ) AM_RAM_WRITE(fg_color_w ) AM_SHARE("fg_color_ram") ADDRESS_MAP_END @@ -279,10 +291,10 @@ static ADDRESS_MAP_START( 3super8_portmap, AS_IO, 8, spoker_state ) AM_RANGE( 0x6490, 0x6490 ) AM_READ_PORT( "IN1" ) AM_RANGE( 0x6491, 0x6491 ) AM_DEVREADWRITE("oki", okim6295_device, read, write) AM_RANGE( 0x64a0, 0x64a0 ) AM_READ_PORT( "IN2" ) - AM_RANGE( 0x64b0, 0x64b0 ) AM_WRITE(spoker_leds_w ) + AM_RANGE( 0x64b0, 0x64b0 ) AM_WRITE(leds_w ) AM_RANGE( 0x64c0, 0x64c0 ) AM_READNOP //irq ack? - AM_RANGE( 0x64f0, 0x64f0 ) AM_WRITE(spoker_nmi_and_coins_w ) + AM_RANGE( 0x64f0, 0x64f0 ) AM_WRITE(nmi_and_coins_w ) AM_RANGE( 0x7000, 0x7fff ) AM_RAM_WRITE(fg_color_w ) AM_SHARE("fg_color_ram") ADDRESS_MAP_END @@ -510,6 +522,15 @@ GFXDECODE_END Machine Drivers ***************************************************************************/ +void spoker_state::machine_start() +{ + save_item(NAME(m_nmi_ack)); + save_item(NAME(m_out)); + save_item(NAME(m_video_enable)); + save_item(NAME(m_hopper)); + save_item(NAME(m_igs_magic)); +} + void spoker_state::machine_reset() { m_nmi_ack = 0; @@ -517,18 +538,13 @@ void spoker_state::machine_reset() m_video_enable = 1; } -INTERRUPT_GEN_MEMBER(spoker_state::spoker_interrupt) -{ - device.execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - static MACHINE_CONFIG_START( spoker, spoker_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z180, XTAL_12MHz / 2) /* HD64180RP8, 8 MHz? */ MCFG_CPU_PROGRAM_MAP(spoker_map) MCFG_CPU_IO_MAP(spoker_portmap) - MCFG_CPU_VBLANK_INT_DRIVER("screen", spoker_state, spoker_interrupt) + MCFG_CPU_VBLANK_INT_DRIVER("screen", spoker_state, nmi_line_assert) MCFG_NVRAM_ADD_0FILL("nvram") @@ -539,7 +555,7 @@ static MACHINE_CONFIG_START( spoker, spoker_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(512, 256) MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1) - MCFG_SCREEN_UPDATE_DRIVER(spoker_state, screen_update_spoker) + MCFG_SCREEN_UPDATE_DRIVER(spoker_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_GFXDECODE_ADD("gfxdecode", "palette", spoker) @@ -561,7 +577,7 @@ static MACHINE_CONFIG_DERIVED( 3super8, spoker ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(spoker_map) MCFG_CPU_IO_MAP(3super8_portmap) - MCFG_CPU_VBLANK_INT_DRIVER("screen", spoker_state, spoker_interrupt) + MCFG_CPU_VBLANK_INT_DRIVER("screen", spoker_state, nmi_line_assert) MCFG_CPU_PERIODIC_INT_DRIVER(spoker_state, irq0_line_hold, 120) // this signal comes from the PIC MCFG_GFXDECODE_MODIFY("gfxdecode", 3super8) @@ -714,6 +730,6 @@ DRIVER_INIT_MEMBER(spoker_state,3super8) } } -GAME( 1993?, spk116it, 0, spoker, spoker, spoker_state, spk116it, ROT0, "IGS", "Super Poker (v116IT)", 0 ) -GAME( 1993?, spk115it, spk116it, spoker, spoker, spoker_state, spk116it, ROT0, "IGS", "Super Poker (v115IT)", 0 ) -GAME( 1993?, 3super8, spk116it, 3super8,3super8, spoker_state, 3super8, ROT0, "", "3 Super 8 (Italy)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND ) //roms are badly dumped +GAME( 1993?, spk116it, 0, spoker, spoker, spoker_state, spk116it, ROT0, "IGS", "Super Poker (v116IT)", GAME_SUPPORTS_SAVE ) +GAME( 1993?, spk115it, spk116it, spoker, spoker, spoker_state, spk116it, ROT0, "IGS", "Super Poker (v115IT)", GAME_SUPPORTS_SAVE ) +GAME( 1993?, 3super8, spk116it, 3super8,3super8, spoker_state, 3super8, ROT0, "", "3 Super 8 (Italy)", GAME_NOT_WORKING | GAME_IMPERFECT_GRAPHICS | GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) //roms are badly dumped diff --git a/src/mame/drivers/ssfindo.c b/src/mame/drivers/ssfindo.c index e2270a929ed..70d609bb88e 100644 --- a/src/mame/drivers/ssfindo.c +++ b/src/mame/drivers/ssfindo.c @@ -217,51 +217,72 @@ class ssfindo_state : public driver_device public: ssfindo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_vram(*this, "vram"), m_maincpu(*this, "maincpu"), + m_palette(*this, "palette"), + m_vram(*this, "vram"), m_flashrom(*this, "flash"), - m_io_ps7500(*this, "PS7500"), - m_palette(*this, "palette") { } + m_io_ps7500(*this, "PS7500") { } + required_device m_maincpu; + required_device m_palette; + + required_shared_ptr m_vram; + + required_region_ptr m_flashrom; + + required_ioport m_io_ps7500; + + // driver init configuration + UINT32 m_flashType; + int m_iocr_hack; + + // common UINT32 m_PS7500_IO[MAXIO]; UINT32 m_PS7500_FIFO[256]; - required_shared_ptr m_vram; + emu_timer *m_PS7500timer0; + emu_timer *m_PS7500timer1; + + // ssfindo and ppcar UINT32 m_flashAdr; UINT32 m_flashOffset; UINT32 m_adrLatch; - UINT32 m_flashType; UINT32 m_flashN; - emu_timer *m_PS7500timer0; - emu_timer *m_PS7500timer1; - int m_iocr_hack; + + // common DECLARE_WRITE32_MEMBER(FIFO_w); DECLARE_READ32_MEMBER(PS7500_IO_r); DECLARE_WRITE32_MEMBER(PS7500_IO_w); + + // ssfindo and ppcar DECLARE_READ32_MEMBER(io_r); DECLARE_WRITE32_MEMBER(io_w); + + // ssfindo DECLARE_WRITE32_MEMBER(debug_w); DECLARE_READ32_MEMBER(ff4_r); DECLARE_READ32_MEMBER(SIMPLEIO_r); + + // ppcar DECLARE_READ32_MEMBER(randomized_r); + + // tetfight DECLARE_READ32_MEMBER(tetfight_unk_r); DECLARE_WRITE32_MEMBER(tetfight_unk_w); + DECLARE_DRIVER_INIT(common); DECLARE_DRIVER_INIT(ssfindo); DECLARE_DRIVER_INIT(ppcar); DECLARE_DRIVER_INIT(tetfight); virtual void machine_reset(); - UINT32 screen_update_ssfindo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(ssfindo_interrupt); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + INTERRUPT_GEN_MEMBER(interrupt); TIMER_CALLBACK_MEMBER(PS7500_Timer0_callback); TIMER_CALLBACK_MEMBER(PS7500_Timer1_callback); - required_device m_maincpu; - required_region_ptr m_flashrom; - required_ioport m_io_ps7500; - required_device m_palette; - - typedef void (ssfindo_state::*ssfindo_speedup_func)(address_space &space); - ssfindo_speedup_func ssfindo_speedup; + typedef void (ssfindo_state::*speedup_func)(address_space &space); + speedup_func m_speedup; void PS7500_startTimer0(); void PS7500_startTimer1(); @@ -271,7 +292,7 @@ public: }; -UINT32 ssfindo_state::screen_update_ssfindo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 ssfindo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int s,x,y; @@ -343,7 +364,7 @@ void ssfindo_state::PS7500_startTimer1() m_PS7500timer1->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); } -INTERRUPT_GEN_MEMBER(ssfindo_state::ssfindo_interrupt) +INTERRUPT_GEN_MEMBER(ssfindo_state::interrupt) { m_PS7500_IO[IRQSTA]|=0x08; if(m_PS7500_IO[IRQMSKA]&0x08) @@ -403,7 +424,7 @@ READ32_MEMBER(ssfindo_state::PS7500_IO_r) return (m_PS7500_IO[IRQSTA] & m_PS7500_IO[IRQMSKA]) | 0x80; case IOCR: //TODO: nINT1, OD[n] p.81 - if (ssfindo_speedup) (this->*ssfindo_speedup)(space); + if (m_speedup) (this->*m_speedup)(space); if( m_iocr_hack) { @@ -764,7 +785,7 @@ static MACHINE_CONFIG_START( ssfindo, ssfindo_state ) MCFG_CPU_ADD("maincpu", ARM7, 54000000) // guess... MCFG_CPU_PROGRAM_MAP(ssfindo_map) - MCFG_CPU_VBLANK_INT_DRIVER("screen", ssfindo_state, ssfindo_interrupt) + MCFG_CPU_VBLANK_INT_DRIVER("screen", ssfindo_state, interrupt) MCFG_SCREEN_ADD("screen", RASTER) @@ -772,7 +793,7 @@ static MACHINE_CONFIG_START( ssfindo, ssfindo_state ) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MCFG_SCREEN_SIZE(320, 256) MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(ssfindo_state, screen_update_ssfindo) + MCFG_SCREEN_UPDATE_DRIVER(ssfindo_state, screen_update) MCFG_SCREEN_PALETTE("palette") MCFG_PALETTE_ADD("palette", 256) @@ -864,26 +885,32 @@ ROM_END DRIVER_INIT_MEMBER(ssfindo_state,common) { - ssfindo_speedup = 0; + m_speedup = 0; m_PS7500timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer0_callback),this)); m_PS7500timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer1_callback),this)); - + + save_item(NAME(m_PS7500_IO)); + save_item(NAME(m_PS7500_FIFO)); } DRIVER_INIT_MEMBER(ssfindo_state,ssfindo) { DRIVER_INIT_CALL(common); m_flashType=0; - ssfindo_speedup = &ssfindo_state::ssfindo_speedups; + m_speedup = &ssfindo_state::ssfindo_speedups; m_iocr_hack=0; + + save_item(NAME(m_flashAdr)); + save_item(NAME(m_flashOffset)); + save_item(NAME(m_adrLatch)); + save_item(NAME(m_flashN)); } DRIVER_INIT_MEMBER(ssfindo_state,ppcar) { - DRIVER_INIT_CALL(common); + DRIVER_INIT_CALL(ssfindo); m_flashType=1; - ssfindo_speedup = &ssfindo_state::ppcar_speedups; - m_iocr_hack=0; + m_speedup = &ssfindo_state::ppcar_speedups; } DRIVER_INIT_MEMBER(ssfindo_state,tetfight) @@ -893,6 +920,6 @@ DRIVER_INIT_MEMBER(ssfindo_state,tetfight) m_iocr_hack=1; } -GAME( 1999, ssfindo, 0, ssfindo, ssfindo, ssfindo_state, ssfindo, ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND ) -GAME( 1999, ppcar, 0, ppcar, ppcar, ssfindo_state, ppcar, ROT0, "Icarus", "Pang Pang Car", GAME_NO_SOUND ) -GAME( 2001, tetfight,0, tetfight, tetfight, ssfindo_state, tetfight,ROT0, "Sego", "Tetris Fighters", GAME_NO_SOUND|GAME_NOT_WORKING ) +GAME( 1999, ssfindo, 0, ssfindo, ssfindo, ssfindo_state, ssfindo, ROT0, "Icarus", "See See Find Out", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1999, ppcar, 0, ppcar, ppcar, ssfindo_state, ppcar, ROT0, "Icarus", "Pang Pang Car", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 2001, tetfight,0, tetfight, tetfight, ssfindo_state, tetfight,ROT0, "Sego", "Tetris Fighters", GAME_NO_SOUND | GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/pitnrun.h b/src/mame/includes/pitnrun.h index 744149f8abb..5f1cc06c470 100644 --- a/src/mame/includes/pitnrun.h +++ b/src/mame/includes/pitnrun.h @@ -3,17 +3,24 @@ class pitnrun_state : public driver_device public: pitnrun_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_videoram(*this, "videoram"), - m_videoram2(*this, "videoram2"), - m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_videoram(*this, "videoram"), + m_videoram2(*this, "videoram2"), + m_spriteram(*this, "spriteram") { } + + required_device m_maincpu; + required_device m_mcu; + required_device m_gfxdecode; + required_device m_palette; required_shared_ptr m_videoram; - int m_nmi; required_shared_ptr m_videoram2; + required_shared_ptr m_spriteram; + + int m_nmi; UINT8 m_fromz80; UINT8 m_toz80; int m_zaccept; @@ -30,41 +37,42 @@ public: bitmap_ind16 *m_tmp_bitmap[4]; tilemap_t *m_bg; tilemap_t *m_fg; - required_shared_ptr m_spriteram; + DECLARE_WRITE8_MEMBER(nmi_enable_w); - DECLARE_WRITE8_MEMBER(pitnrun_hflip_w); - DECLARE_WRITE8_MEMBER(pitnrun_vflip_w); - DECLARE_READ8_MEMBER(pitnrun_mcu_data_r); - DECLARE_WRITE8_MEMBER(pitnrun_mcu_data_w); - DECLARE_READ8_MEMBER(pitnrun_mcu_status_r); - DECLARE_READ8_MEMBER(pitnrun_68705_portA_r); - DECLARE_WRITE8_MEMBER(pitnrun_68705_portA_w); - DECLARE_READ8_MEMBER(pitnrun_68705_portB_r); - DECLARE_WRITE8_MEMBER(pitnrun_68705_portB_w); - DECLARE_READ8_MEMBER(pitnrun_68705_portC_r); - DECLARE_WRITE8_MEMBER(pitnrun_videoram_w); - DECLARE_WRITE8_MEMBER(pitnrun_videoram2_w); - DECLARE_WRITE8_MEMBER(pitnrun_char_bank_select); - DECLARE_WRITE8_MEMBER(pitnrun_scroll_w); - DECLARE_WRITE8_MEMBER(pitnrun_ha_w); - DECLARE_WRITE8_MEMBER(pitnrun_h_heed_w); - DECLARE_WRITE8_MEMBER(pitnrun_v_heed_w); - DECLARE_WRITE8_MEMBER(pitnrun_color_select_w); + DECLARE_WRITE8_MEMBER(hflip_w); + DECLARE_WRITE8_MEMBER(vflip_w); + DECLARE_READ8_MEMBER(mcu_data_r); + DECLARE_WRITE8_MEMBER(mcu_data_w); + DECLARE_READ8_MEMBER(mcu_status_r); + DECLARE_READ8_MEMBER(m68705_portA_r); + DECLARE_WRITE8_MEMBER(m68705_portA_w); + DECLARE_READ8_MEMBER(m68705_portB_r); + DECLARE_WRITE8_MEMBER(m68705_portB_w); + DECLARE_READ8_MEMBER(m68705_portC_r); + DECLARE_WRITE8_MEMBER(videoram_w); + DECLARE_WRITE8_MEMBER(videoram2_w); + DECLARE_WRITE8_MEMBER(char_bank_select); + DECLARE_WRITE8_MEMBER(scroll_w); + DECLARE_WRITE8_MEMBER(ha_w); + DECLARE_WRITE8_MEMBER(h_heed_w); + DECLARE_WRITE8_MEMBER(v_heed_w); + DECLARE_WRITE8_MEMBER(color_select_w); + TILE_GET_INFO_MEMBER(get_tile_info1); TILE_GET_INFO_MEMBER(get_tile_info2); + + INTERRUPT_GEN_MEMBER(nmi_source); + TIMER_CALLBACK_MEMBER(mcu_real_data_r); + TIMER_CALLBACK_MEMBER(mcu_real_data_w); + TIMER_CALLBACK_MEMBER(mcu_data_real_r); + TIMER_CALLBACK_MEMBER(mcu_status_real_w); + + virtual void machine_start(); virtual void machine_reset(); virtual void video_start(); DECLARE_PALETTE_INIT(pitnrun); - UINT32 screen_update_pitnrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(pitnrun_nmi_source); - TIMER_CALLBACK_MEMBER(pitnrun_mcu_real_data_r); - TIMER_CALLBACK_MEMBER(pitnrun_mcu_real_data_w); - TIMER_CALLBACK_MEMBER(pitnrun_mcu_data_real_r); - TIMER_CALLBACK_MEMBER(pitnrun_mcu_status_real_w); - void pitnrun_spotlights(); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void spotlights(); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device m_maincpu; - required_device m_mcu; - required_device m_gfxdecode; - required_device m_palette; }; diff --git a/src/mame/includes/splash.h b/src/mame/includes/splash.h index 94be4a7069c..2f5344e411f 100644 --- a/src/mame/includes/splash.h +++ b/src/mame/includes/splash.h @@ -5,12 +5,6 @@ class splash_state : public driver_device public: splash_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_pixelram(*this, "pixelram"), - m_videoram(*this, "videoram"), - m_vregs(*this, "vregs"), - m_spriteram(*this, "spriteram"), - m_protdata(*this, "protdata"), - m_bitmap_mode(*this, "bitmap_mode"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_msm(*this, "msm"), @@ -18,70 +12,18 @@ public: m_msm2(*this, "msm2"), m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), + m_pixelram(*this, "pixelram"), + m_videoram(*this, "videoram"), + m_vregs(*this, "vregs"), + m_spriteram(*this, "spriteram"), + m_protdata(*this, "protdata"), + m_bitmap_mode(*this, "bitmap_mode"), - funystrp_val(0), - funystrp_ff3cc7_val(0), - funystrp_ff3cc8_val(0) + m_funystrp_val(0), + m_funystrp_ff3cc7_val(0), + m_funystrp_ff3cc8_val(0) { } - required_shared_ptr m_pixelram; - required_shared_ptr m_videoram; - required_shared_ptr m_vregs; - required_shared_ptr m_spriteram; - optional_shared_ptr m_protdata; - optional_shared_ptr m_bitmap_mode; - - int m_bitmap_type; - int m_sprite_attr2_shift; - tilemap_t *m_bg_tilemap[2]; - - int m_adpcm_data; - int m_ret; - - int m_vblank_irq; - int m_sound_irq; - - int m_msm_data1; - int m_msm_data2; - int m_msm_toggle1; - int m_msm_toggle2; - int m_msm_source; - int m_snd_interrupt_enable1; - int m_snd_interrupt_enable2; - - DECLARE_WRITE16_MEMBER(splash_sh_irqtrigger_w); - DECLARE_WRITE16_MEMBER(roldf_sh_irqtrigger_w); - DECLARE_WRITE16_MEMBER(splash_coin_w); - DECLARE_WRITE8_MEMBER(splash_adpcm_data_w); - DECLARE_READ16_MEMBER(roldfrog_bombs_r); - DECLARE_WRITE8_MEMBER(sound_bank_w); - DECLARE_WRITE8_MEMBER(roldfrog_vblank_ack_w); - DECLARE_READ8_MEMBER(roldfrog_unk_r); - DECLARE_READ16_MEMBER(spr_read); - DECLARE_WRITE16_MEMBER(spr_write); - DECLARE_READ8_MEMBER(int_source_r); - DECLARE_WRITE8_MEMBER(msm1_data_w); - DECLARE_WRITE8_MEMBER(msm1_interrupt_w); - DECLARE_WRITE8_MEMBER(msm2_interrupt_w); - DECLARE_WRITE8_MEMBER(msm2_data_w); - DECLARE_WRITE16_MEMBER(splash_vram_w); - DECLARE_DRIVER_INIT(splash10); - DECLARE_DRIVER_INIT(roldfrog); - DECLARE_DRIVER_INIT(splash); - DECLARE_DRIVER_INIT(rebus); - TILE_GET_INFO_MEMBER(get_tile_info_splash_tilemap0); - TILE_GET_INFO_MEMBER(get_tile_info_splash_tilemap1); - virtual void video_start(); - DECLARE_MACHINE_RESET(splash); - UINT32 screen_update_splash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - INTERRUPT_GEN_MEMBER(roldfrog_interrupt); - void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); - void splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - void roldfrog_update_irq( ); - DECLARE_WRITE_LINE_MEMBER(splash_msm5205_int); - DECLARE_WRITE_LINE_MEMBER(ym_irq); - DECLARE_WRITE_LINE_MEMBER(adpcm_int1); - DECLARE_WRITE_LINE_MEMBER(adpcm_int2); required_device m_maincpu; required_device m_audiocpu; optional_device m_msm; @@ -90,16 +32,93 @@ public: required_device m_gfxdecode; required_device m_palette; - // Funny Strip - DECLARE_MACHINE_RESET(funystrp); + required_shared_ptr m_pixelram; + required_shared_ptr m_videoram; + required_shared_ptr m_vregs; + required_shared_ptr m_spriteram; + optional_shared_ptr m_protdata; + optional_shared_ptr m_bitmap_mode; + + // driver init configuration + int m_bitmap_type; + int m_sprite_attr2_shift; + + tilemap_t *m_bg_tilemap[2]; + + // splash specific + int m_adpcm_data; + + //roldfrog specific + int m_ret; + int m_vblank_irq; + int m_sound_irq; + + // funystrp specific + UINT8 m_funystrp_val; + UINT8 m_funystrp_ff3cc7_val; + UINT8 m_funystrp_ff3cc8_val; + int m_msm_data1; + int m_msm_data2; + int m_msm_toggle1; + int m_msm_toggle2; + int m_msm_source; + int m_snd_interrupt_enable1; + int m_snd_interrupt_enable2; + + // common + DECLARE_WRITE16_MEMBER(vram_w); + DECLARE_WRITE16_MEMBER(coin_w); + + // splash specific + DECLARE_WRITE_LINE_MEMBER(splash_msm5205_int); + DECLARE_WRITE16_MEMBER(splash_sh_irqtrigger_w); + DECLARE_WRITE8_MEMBER(splash_adpcm_data_w); + + // roldfrog specific + DECLARE_WRITE16_MEMBER(roldf_sh_irqtrigger_w); + DECLARE_READ16_MEMBER(roldfrog_bombs_r); + DECLARE_WRITE8_MEMBER(roldfrog_vblank_ack_w); + DECLARE_READ8_MEMBER(roldfrog_unk_r); + DECLARE_WRITE_LINE_MEMBER(ym_irq); + + // funystrp specific + DECLARE_READ16_MEMBER(spr_read); + DECLARE_WRITE16_MEMBER(spr_write); + DECLARE_READ8_MEMBER(int_source_r); + DECLARE_WRITE8_MEMBER(msm1_data_w); + DECLARE_WRITE8_MEMBER(msm1_interrupt_w); + DECLARE_WRITE8_MEMBER(msm2_interrupt_w); + DECLARE_WRITE8_MEMBER(msm2_data_w); + DECLARE_WRITE_LINE_MEMBER(adpcm_int1); + DECLARE_WRITE_LINE_MEMBER(adpcm_int2); DECLARE_WRITE16_MEMBER(funystrp_protection_w); DECLARE_READ16_MEMBER(funystrp_protection_r); DECLARE_WRITE16_MEMBER(funystrp_sh_irqtrigger_w); - DECLARE_DRIVER_INIT(funystrp); - UINT32 screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); - UINT8 funystrp_val; - UINT8 funystrp_ff3cc7_val; - UINT8 funystrp_ff3cc8_val; + //roldfrog and funystrp specific + DECLARE_WRITE8_MEMBER(sound_bank_w); + + DECLARE_DRIVER_INIT(splash10); + DECLARE_DRIVER_INIT(roldfrog); + DECLARE_DRIVER_INIT(splash); + DECLARE_DRIVER_INIT(rebus); + DECLARE_DRIVER_INIT(funystrp); + virtual void video_start(); + DECLARE_MACHINE_START(splash); + DECLARE_MACHINE_START(roldfrog); + DECLARE_MACHINE_START(funystrp); + DECLARE_MACHINE_RESET(splash); + DECLARE_MACHINE_RESET(funystrp); + + TILE_GET_INFO_MEMBER(get_tile_info_tilemap0); + TILE_GET_INFO_MEMBER(get_tile_info_tilemap1); + + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + UINT32 screen_update_funystrp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + void funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); + + INTERRUPT_GEN_MEMBER(roldfrog_interrupt); + void roldfrog_update_irq( ); }; diff --git a/src/mame/machine/pitnrun.c b/src/mame/machine/pitnrun.c index da7d8353194..9574ed4774b 100644 --- a/src/mame/machine/pitnrun.c +++ b/src/mame/machine/pitnrun.c @@ -12,6 +12,18 @@ #include "includes/pitnrun.h" +void pitnrun_state::machine_start() +{ + save_item(NAME(m_nmi)); + save_item(NAME(m_fromz80)); + save_item(NAME(m_toz80)); + save_item(NAME(m_zaccept)); + save_item(NAME(m_zready)); + save_item(NAME(m_portA_in)); + save_item(NAME(m_portA_out)); + save_item(NAME(m_address)); +} + void pitnrun_state::machine_reset() { m_zaccept = 1; @@ -19,31 +31,31 @@ void pitnrun_state::machine_reset() m_mcu->set_input_line(0, CLEAR_LINE); } -TIMER_CALLBACK_MEMBER(pitnrun_state::pitnrun_mcu_real_data_r) +TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_real_data_r) { m_zaccept = 1; } -READ8_MEMBER(pitnrun_state::pitnrun_mcu_data_r) +READ8_MEMBER(pitnrun_state::mcu_data_r) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::pitnrun_mcu_real_data_r),this)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_real_data_r),this)); return m_toz80; } -TIMER_CALLBACK_MEMBER(pitnrun_state::pitnrun_mcu_real_data_w) +TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_real_data_w) { m_zready = 1; m_mcu->set_input_line(0, ASSERT_LINE); m_fromz80 = param; } -WRITE8_MEMBER(pitnrun_state::pitnrun_mcu_data_w) +WRITE8_MEMBER(pitnrun_state::mcu_data_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::pitnrun_mcu_real_data_w),this), data); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_real_data_w),this), data); machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(5)); } -READ8_MEMBER(pitnrun_state::pitnrun_mcu_status_r) +READ8_MEMBER(pitnrun_state::mcu_status_r) { /* mcu synchronization */ /* bit 0 = the 68705 has read data from the Z80 */ @@ -52,12 +64,12 @@ READ8_MEMBER(pitnrun_state::pitnrun_mcu_status_r) } -READ8_MEMBER(pitnrun_state::pitnrun_68705_portA_r) +READ8_MEMBER(pitnrun_state::m68705_portA_r) { return m_portA_in; } -WRITE8_MEMBER(pitnrun_state::pitnrun_68705_portA_w) +WRITE8_MEMBER(pitnrun_state::m68705_portA_w) { m_portA_out = data; } @@ -82,37 +94,37 @@ WRITE8_MEMBER(pitnrun_state::pitnrun_68705_portA_w) * the main Z80 memory location to access) */ -READ8_MEMBER(pitnrun_state::pitnrun_68705_portB_r) +READ8_MEMBER(pitnrun_state::m68705_portB_r) { return 0xff; } -TIMER_CALLBACK_MEMBER(pitnrun_state::pitnrun_mcu_data_real_r) +TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_data_real_r) { m_zready = 0; } -TIMER_CALLBACK_MEMBER(pitnrun_state::pitnrun_mcu_status_real_w) +TIMER_CALLBACK_MEMBER(pitnrun_state::mcu_status_real_w) { m_toz80 = param; m_zaccept = 0; } -WRITE8_MEMBER(pitnrun_state::pitnrun_68705_portB_w) +WRITE8_MEMBER(pitnrun_state::m68705_portB_w) { address_space &cpu0space = m_maincpu->space(AS_PROGRAM); if (~data & 0x02) { /* 68705 is going to read data from the Z80 */ - machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::pitnrun_mcu_data_real_r),this)); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_data_real_r),this)); m_mcu->set_input_line(0,CLEAR_LINE); m_portA_in = m_fromz80; } if (~data & 0x04) { /* 68705 is writing data for the Z80 */ - machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::pitnrun_mcu_status_real_w),this), m_portA_out); + machine().scheduler().synchronize(timer_expired_delegate(FUNC(pitnrun_state::mcu_status_real_w),this), m_portA_out); } if (~data & 0x10) { @@ -142,7 +154,7 @@ WRITE8_MEMBER(pitnrun_state::pitnrun_68705_portB_w) * passes through) */ -READ8_MEMBER(pitnrun_state::pitnrun_68705_portC_r) +READ8_MEMBER(pitnrun_state::m68705_portC_r) { return (m_zready << 0) | (m_zaccept << 1); } diff --git a/src/mame/video/pitnrun.c b/src/mame/video/pitnrun.c index 266eedbc434..078e177b3aa 100644 --- a/src/mame/video/pitnrun.c +++ b/src/mame/video/pitnrun.c @@ -23,9 +23,7 @@ In debug build press 'w' for spotlight and 'e' for lightning TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info1) { - UINT8 *videoram = m_videoram; - int code; - code = videoram[tile_index]; + int code = m_videoram[tile_index]; SET_TILE_INFO_MEMBER(0, code, 0, @@ -34,28 +32,26 @@ TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info1) TILE_GET_INFO_MEMBER(pitnrun_state::get_tile_info2) { - int code; - code = m_videoram2[tile_index]; + int code = m_videoram2[tile_index]; SET_TILE_INFO_MEMBER(1, code + (m_char_bank<<8), m_color_select&1, 0); } -WRITE8_MEMBER(pitnrun_state::pitnrun_videoram_w) +WRITE8_MEMBER(pitnrun_state::videoram_w) { - UINT8 *videoram = m_videoram; - videoram[offset] = data; + m_videoram[offset] = data; m_fg ->mark_all_dirty(); } -WRITE8_MEMBER(pitnrun_state::pitnrun_videoram2_w) +WRITE8_MEMBER(pitnrun_state::videoram2_w) { m_videoram2[offset] = data; m_bg ->mark_all_dirty(); } -WRITE8_MEMBER(pitnrun_state::pitnrun_char_bank_select) +WRITE8_MEMBER(pitnrun_state::char_bank_select) { if(m_char_bank!=data) { @@ -65,34 +61,34 @@ WRITE8_MEMBER(pitnrun_state::pitnrun_char_bank_select) } -WRITE8_MEMBER(pitnrun_state::pitnrun_scroll_w) +WRITE8_MEMBER(pitnrun_state::scroll_w) { m_scroll = (m_scroll & (0xff<<((offset)?0:8))) |( data<<((offset)?8:0)); m_bg->set_scrollx(0, m_scroll); } -WRITE8_MEMBER(pitnrun_state::pitnrun_ha_w) +WRITE8_MEMBER(pitnrun_state::ha_w) { m_ha=data; } -WRITE8_MEMBER(pitnrun_state::pitnrun_h_heed_w) +WRITE8_MEMBER(pitnrun_state::h_heed_w) { m_h_heed=data; } -WRITE8_MEMBER(pitnrun_state::pitnrun_v_heed_w) +WRITE8_MEMBER(pitnrun_state::v_heed_w) { m_v_heed=data; } -WRITE8_MEMBER(pitnrun_state::pitnrun_color_select_w) +WRITE8_MEMBER(pitnrun_state::color_select_w) { m_color_select=data; machine().tilemap().mark_all_dirty(); } -void pitnrun_state::pitnrun_spotlights() +void pitnrun_state::spotlights() { int x,y,i,b,datapix; UINT8 *ROM = memregion("user1")->base(); @@ -166,7 +162,14 @@ void pitnrun_state::video_start() m_tmp_bitmap[1] = auto_bitmap_ind16_alloc(machine(),128,128); m_tmp_bitmap[2] = auto_bitmap_ind16_alloc(machine(),128,128); m_tmp_bitmap[3] = auto_bitmap_ind16_alloc(machine(),128,128); - pitnrun_spotlights(); + spotlights(); + + save_item(NAME(m_h_heed)); + save_item(NAME(m_v_heed)); + save_item(NAME(m_ha)); + save_item(NAME(m_scroll)); + save_item(NAME(m_char_bank)); + save_item(NAME(m_color_select)); } void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ) @@ -202,7 +205,7 @@ void pitnrun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect } } -UINT32 pitnrun_state::screen_update_pitnrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 pitnrun_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { int dx=0,dy=0; rectangle myclip=cliprect; diff --git a/src/mame/video/splash.c b/src/mame/video/splash.c index a3a9bd43df5..6a0e3fd07b8 100644 --- a/src/mame/video/splash.c +++ b/src/mame/video/splash.c @@ -1,6 +1,6 @@ /*************************************************************************** - video.c + splash.c Functions to emulate the video hardware of the machine. @@ -38,7 +38,7 @@ 0 | xxxx---- -------- | color */ -TILE_GET_INFO_MEMBER(splash_state::get_tile_info_splash_tilemap0) +TILE_GET_INFO_MEMBER(splash_state::get_tile_info_tilemap0) { int data = m_videoram[tile_index]; int attr = data >> 8; @@ -50,7 +50,7 @@ TILE_GET_INFO_MEMBER(splash_state::get_tile_info_splash_tilemap0) 0); } -TILE_GET_INFO_MEMBER(splash_state::get_tile_info_splash_tilemap1) +TILE_GET_INFO_MEMBER(splash_state::get_tile_info_tilemap1) { int data = m_videoram[(0x1000/2) + tile_index]; int attr = data >> 8; @@ -68,7 +68,7 @@ TILE_GET_INFO_MEMBER(splash_state::get_tile_info_splash_tilemap1) ***************************************************************************/ -WRITE16_MEMBER(splash_state::splash_vram_w) +WRITE16_MEMBER(splash_state::vram_w) { COMBINE_DATA(&m_videoram[offset]); m_bg_tilemap[offset >> 11]->mark_tile_dirty(((offset << 1) & 0x0fff) >> 1); @@ -163,8 +163,8 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect) void splash_state::video_start() { - m_bg_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(splash_state::get_tile_info_splash_tilemap0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); - m_bg_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(splash_state::get_tile_info_splash_tilemap1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); + m_bg_tilemap[0] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(splash_state::get_tile_info_tilemap0),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32); + m_bg_tilemap[1] = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(splash_state::get_tile_info_tilemap1),this), TILEMAP_SCAN_ROWS, 16, 16, 32, 32); m_bg_tilemap[0]->set_transparent_pen(0); m_bg_tilemap[1]->set_transparent_pen(0); @@ -201,7 +201,7 @@ void splash_state::video_start() 400| xxxxxxxx -------- | unused */ -void splash_state::splash_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) +void splash_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect) { int i; gfx_element *gfx = m_gfxdecode->gfx(1); @@ -247,7 +247,7 @@ void splash_state::funystrp_draw_sprites(bitmap_ind16 &bitmap,const rectangle &c ***************************************************************************/ -UINT32 splash_state::screen_update_splash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) +UINT32 splash_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* set scroll registers */ m_bg_tilemap[0]->set_scrolly(0, m_vregs[0]); @@ -256,7 +256,7 @@ UINT32 splash_state::screen_update_splash(screen_device &screen, bitmap_ind16 &b draw_bitmap(bitmap, cliprect); m_bg_tilemap[1]->draw(screen, bitmap, cliprect, 0, 0); - splash_draw_sprites(bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_bg_tilemap[0]->draw(screen, bitmap, cliprect, 0, 0); return 0; }