aboutsummaryrefslogtreecommitdiff
path: root/source/nds
diff options
context:
space:
mode:
authorNebuleon Fumika2013-01-19 20:28:17 -0500
committerNebuleon Fumika2013-01-19 20:28:17 -0500
commit88135c52f8367549d6c864df193018f5a6cb2b35 (patch)
tree57ae06a89349f86544f00060adbf2cdc396a8374 /source/nds
parent2bb2ee8c0aee044998858ff8263be71cb908a663 (diff)
downloadsnesemu-88135c52f8367549d6c864df193018f5a6cb2b35.tar.gz
snesemu-88135c52f8367549d6c864df193018f5a6cb2b35.tar.bz2
snesemu-88135c52f8367549d6c864df193018f5a6cb2b35.zip
Remove unneeded volatility, enabling more optimisations. Sound volatility is #define'd away, GUI volatility is simply removed.
Diffstat (limited to 'source/nds')
-rw-r--r--source/nds/draw.c6
-rw-r--r--source/nds/entry.cpp44
2 files changed, 8 insertions, 42 deletions
diff --git a/source/nds/draw.c b/source/nds/draw.c
index b6916a3..4eb45c2 100644
--- a/source/nds/draw.c
+++ b/source/nds/draw.c
@@ -142,7 +142,7 @@ void drawhline(void* screen_addr, u32 sx, u32 ex, u32 y, u32 color)
{
u32 x;
u32 width = (ex - sx) + 1;
- volatile u16 *dst = VRAM_POS(screen_addr, sx, y);
+ u16 *dst = VRAM_POS(screen_addr, sx, y);
for (x = 0; x < width; x++)
*dst++ = (u16)color;
@@ -155,7 +155,7 @@ void drawvline(void* screen_addr, u32 x, u32 sy, u32 ey, u32 color)
{
int y;
int height = (ey - sy) + 1;
- volatile u16 *dst = VRAM_POS(screen_addr, x, sy);
+ u16 *dst = VRAM_POS(screen_addr, x, sy);
for (y = 0; y < height; y++)
{
@@ -183,7 +183,7 @@ void drawboxfill(void* screen_addr, u32 sx, u32 sy, u32 ex, u32 ey, u32 color)
u32 x, y;
u32 width = (ex - sx) + 1;
u32 height = (ey - sy) + 1;
- volatile u16 *dst = VRAM_POS(screen_addr, sx, sy);
+ u16 *dst = VRAM_POS(screen_addr, sx, sy);
for (y = 0; y < height; y++)
{
diff --git a/source/nds/entry.cpp b/source/nds/entry.cpp
index 1fb5bd8..8cd5c06 100644
--- a/source/nds/entry.cpp
+++ b/source/nds/entry.cpp
@@ -34,10 +34,6 @@ static u8 Buf[MAX_BUFFER_SIZE];
#define FIXED_POINT_SHIFT 16
#define FIXED_POINT_REMAINDER 0xffff
-static volatile bool8 block_signal = FALSE;
-static volatile bool8 pending_signal = FALSE;
-static volatile bool8 DelayingForEarlyFrame = FALSE;
-
void S9xMessage (int /*type*/, int /*number*/, const char *message)
{
#if 1
@@ -677,12 +673,10 @@ void S9xSyncSpeed ()
else // Early
{
skip_rate = 0;
- DelayingForEarlyFrame = TRUE;
ds2_setCPUclocklevel(0);
if (syncdif > 0)
udelay(syncdif * 128 / 3 /* times 42 + 2/3 microseconds */);
set_cpu_clock(clock_speed_number);
- DelayingForEarlyFrame = FALSE;
S9xProcessSound (0);
IPPU.RenderThisFrame = TRUE;
@@ -712,11 +706,9 @@ void S9xSyncSpeed ()
syncdif = sync_next - syncnow;
if (syncdif > 0)
{
- DelayingForEarlyFrame = TRUE;
ds2_setCPUclocklevel(0);
udelay(syncdif * 128 / 3 /* times 42 + 2/3 microseconds */);
set_cpu_clock(clock_speed_number);
- DelayingForEarlyFrame = FALSE;
S9xProcessSound (0);
// After that little delay, what time is it?
syncnow = getSysTime();
@@ -846,8 +838,6 @@ bool8 S9xOpenSoundDevice (int mode, bool8 stereo, int buffer_size)
void S9xGenerateSound ()
{
- block_signal = TRUE;
-
#ifndef FOREVER_16_BIT_SOUND
int bytes_so_far = so.sixteen_bit ? (so.samples_mixed_so_far << 1) :
so.samples_mixed_so_far;
@@ -856,7 +846,7 @@ void S9xGenerateSound ()
#endif
if (bytes_so_far >= so.buffer_size)
- goto end;
+ return;
so.err_counter += so.err_rate;
if (so.err_counter >= FIXED_POINT)
@@ -909,37 +899,17 @@ void S9xGenerateSound ()
byte_offset = (byte_offset + bytes_this_run) & SOUND_BUFFER_SIZE_MASK;
} while (samples_to_write > 0);
}
-
-end:
-
- if (pending_signal)
- {
- block_signal = FALSE;
- pending_signal = FALSE;
- S9xProcessSound (0);
- }
- else
- block_signal = FALSE;
}
void S9xProcessSound (unsigned int)
{
- if (DelayingForEarlyFrame)
- set_cpu_clock(clock_speed_number);
-
- if (block_signal)
- {
- pending_signal = TRUE;
- goto end;
- }
-
unsigned short *audiobuff;
- if (Settings.Paused || so.mute_sound || !game_enable_audio)
- goto end;
+ if (so.mute_sound || !game_enable_audio)
+ return;
if(ds2_checkAudiobuff() > 4)
- goto end;
+ return;
/* Number of samples to generate now */
int sample_count;
@@ -959,7 +929,7 @@ void S9xProcessSound (unsigned int)
audiobuff = (unsigned short*)ds2_getAudiobuff();
if(NULL == audiobuff) //There are audio queue in sending or wait to send
{
- goto end;
+ return;
}
/* If we need more audio samples */
@@ -1075,10 +1045,6 @@ void S9xProcessSound (unsigned int)
}
so.samples_mixed_so_far -= sample_count;
-
-end:
- if (DelayingForEarlyFrame)
- ds2_setCPUclocklevel(0);
}
/*