From 8607e7827d78b64f51e32eb66d551b4a812a7fb2 Mon Sep 17 00:00:00 2001 From: "simon.kagstrom" Date: Sat, 7 Nov 2009 10:12:49 +0000 Subject: [PATCH] Move linecount to c64 --- Src/C64.h | 1 + Src/C64_SDL.h | 1 + Src/Network.cpp | 3 +-- Src/SID.cpp | 3 +-- Src/SID_linux.h | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Src/C64.h b/Src/C64.h index 76610a9..06703c0 100644 --- a/Src/C64.h +++ b/Src/C64.h @@ -199,6 +199,7 @@ public: int network_connection_type; Network *peer; TTF_Font *menu_font; + int linecnt; bool fake_key_sequence; const char *fake_key_str; diff --git a/Src/C64_SDL.h b/Src/C64_SDL.h index 85557d5..4553bd0 100644 --- a/Src/C64_SDL.h +++ b/Src/C64_SDL.h @@ -43,6 +43,7 @@ void C64::c64_ctor1(void) joy_minx = joy_miny = 32767; joy_maxx = joy_maxy = -32768; #endif + this->linecnt = 0; this->fake_key_sequence = false; this->fake_key_index = 0; diff --git a/Src/Network.cpp b/Src/Network.cpp index f09f983..0367c01 100644 --- a/Src/Network.cpp +++ b/Src/Network.cpp @@ -405,8 +405,6 @@ void Network::EnqueueSound(uint32 linecnt_diff, uint8 adr, uint8 val) { NetworkUpdateSoundInfo *cur = &this->sound_active[this->sound_head]; - if (linecnt_diff > 400) - linecnt_diff = 400; cur->adr = adr; cur->val = val; cur->delay_cycles = linecnt_diff; @@ -461,6 +459,7 @@ void Network::FlushSound(void) InitNetworkUpdate(dst, SOUND_UPDATE, sizeof(NetworkUpdate) + sizeof(NetworkUpdateSound) + sizeof(NetworkUpdateSoundInfo) * snd->n_items); this->AddNetworkUpdate(dst); + this->sound_last_cycles = TheC64->linecnt; bytes = 0; } diff --git a/Src/SID.cpp b/Src/SID.cpp index 902f6e1..e1b936f 100644 --- a/Src/SID.cpp +++ b/Src/SID.cpp @@ -445,7 +445,6 @@ private: #if defined(__linux__) || defined(GEKKO) int devfd, sndbufsize, buffer_rate; int16 *sound_buffer; - uint32 linecnt; #endif #ifdef SUN @@ -921,7 +920,7 @@ void DigitalRenderer::WriteRegister(uint16 adr, uint8 byte) if (TheC64) { if (TheC64->network_connection_type == MASTER) - TheC64->peer->RegisterSidWrite(this->linecnt, adr, byte); + TheC64->peer->RegisterSidWrite(TheC64->linecnt, adr, byte); } int v = adr/7; // Voice number diff --git a/Src/SID_linux.h b/Src/SID_linux.h index b4c9b67..aa81189 100644 --- a/Src/SID_linux.h +++ b/Src/SID_linux.h @@ -47,7 +47,6 @@ void DigitalRenderer::init_sound(void) int arg; unsigned long format; - linecnt = 0; ready = false; devfd = open("/dev/dsp", O_WRONLY); if (devfd < 0) @@ -166,7 +165,7 @@ void DigitalRenderer::EmulateLine(void) } } this->PushVolume(volume); - this->linecnt++; + TheC64->linecnt++; }