mirror of
https://github.com/libretro/snes9x2005.git
synced 2024-11-24 00:39:50 +00:00
Remove unneeded volatility, enabling more optimisations. Sound volatility is #define'd away, GUI volatility is simply removed.
This commit is contained in:
parent
2bb2ee8c0a
commit
88135c52f8
2
Makefile
2
Makefile
@ -70,7 +70,7 @@ DEFS := -DSPC700_C -DEXECUTE_SUPERFX_PER_LINE -DSDD1_DECOMP \
|
||||
-DVAR_CYCLES -DCPU_SHUTDOWN -DSPC700_SHUTDOWN \
|
||||
-DNO_INLINE_SET_GET -DNOASM -DHAVE_MKSTEMP '-DACCEPT_SIZE_T=size_t' \
|
||||
-DUNZIP_SUPPORT -DFOREVER_16_BIT_SOUND -DFOREVER_STEREO \
|
||||
-DFOREVER_FORWARD_STEREO -DSYNC_JOYPAD_AT_HBLANK
|
||||
-DFOREVER_FORWARD_STEREO -DNO_VOLATILE_SOUND -DSYNC_JOYPAD_AT_HBLANK
|
||||
|
||||
.PHONY: clean makedirs
|
||||
.SUFFIXES: .elf .dat .plg
|
||||
|
@ -216,7 +216,14 @@ uint32 current_graphic_format = RGB565;
|
||||
|
||||
struct SCheatData Cheat;
|
||||
|
||||
// Define NO_VOLATILE_SOUND if you're always reading or writing sound from one
|
||||
// thread or one co-routine. If you're using interrupts or a thread, sound must
|
||||
// be volatile.
|
||||
#ifndef NO_VOLATILE_SOUND
|
||||
volatile SoundStatus so;
|
||||
#else
|
||||
SoundStatus so;
|
||||
#endif
|
||||
|
||||
int Echo [24000];
|
||||
int DummyEchoBuffer [SOUND_BUFFER_SIZE];
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -144,7 +144,14 @@ typedef struct {
|
||||
uint32 err_rate;
|
||||
} SoundStatus;
|
||||
|
||||
// Define NO_VOLATILE_SOUND if you're always reading or writing sound from one
|
||||
// thread or one co-routine. If you're using interrupts or a thread, sound must
|
||||
// be volatile.
|
||||
#ifndef NO_VOLATILE_SOUND
|
||||
EXTERN_C volatile SoundStatus so;
|
||||
#else
|
||||
EXTERN_C SoundStatus so;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int state;
|
||||
|
Loading…
Reference in New Issue
Block a user