mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-12-26 11:11:48 +01:00
-added CHEATS_UPDATE macro definition (required by last commit)
-removed unused soundbuffer for all platforms -renamed osd_input_Update to osd_input_update
This commit is contained in:
parent
83d4312e3c
commit
0beaccaea9
@ -40,6 +40,8 @@
|
||||
#ifndef _CHEATS_H
|
||||
#define _CHEATS_H
|
||||
|
||||
#define CHEATS_UPDATE() ROMCheatUpdate()
|
||||
|
||||
extern void CheatMenu(void);
|
||||
extern void CheatLoad(void);
|
||||
extern void RAMCheatUpdate(void);
|
||||
|
@ -124,8 +124,12 @@ void gx_audio_Shutdown(void)
|
||||
***/
|
||||
void gx_audio_Update(void)
|
||||
{
|
||||
/* retrieve audio samples (size must be multiple of 32 bytes) */
|
||||
int size = audio_update() * 4;
|
||||
/* Current available soundbuffer */
|
||||
s16 *sb = (s16 *)(soundbuffer[mixbuffer]);
|
||||
|
||||
/* Retrieve audio samples (size must be multiple of 32 bytes) */
|
||||
int size = audio_update(sb) * 4;
|
||||
|
||||
#ifdef LOG_TIMING
|
||||
if (prevtime && (frame_cnt < LOGSIZE - 1))
|
||||
{
|
||||
@ -137,8 +141,7 @@ void gx_audio_Update(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* set next DMA soundbuffer */
|
||||
s16 *sb = (s16 *)(soundbuffer[mixbuffer]);
|
||||
/* Update DMA settings */
|
||||
DCFlushRange((void *)sb, size);
|
||||
AUDIO_InitDMA((u32) sb, size);
|
||||
mixbuffer ^= 1;
|
||||
|
@ -40,6 +40,8 @@
|
||||
#ifndef _GC_INPUT_H_
|
||||
#define _GC_INPUT_H_
|
||||
|
||||
#define osd_input_update() gx_input_UpdateEmu()
|
||||
|
||||
/* max. supported inputs */
|
||||
#ifdef HW_RVL
|
||||
#define MAX_INPUTS 8
|
||||
@ -50,6 +52,7 @@
|
||||
/* Configurable keys */
|
||||
#define MAX_KEYS 8
|
||||
|
||||
|
||||
/* Key configuration structure */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "gx_video.h"
|
||||
#include "config.h"
|
||||
#include "fileio.h"
|
||||
#include "cheats.h"
|
||||
|
||||
#define DEFAULT_PATH "/genplus"
|
||||
#define GG_ROM "/genplus/ggenie.bin"
|
||||
@ -40,8 +41,6 @@
|
||||
#define VERSION "Genesis Plus GX 1.6.1 (GCN)"
|
||||
#endif
|
||||
|
||||
#define osd_input_Update() gx_input_UpdateEmu()
|
||||
|
||||
/* globals */
|
||||
extern void legal(void);
|
||||
extern double get_framerate(void);
|
||||
|
@ -101,13 +101,6 @@ int audio_init(int samplerate, double framerate)
|
||||
snd.fm.buffer = (int32 *) malloc(snd.buffer_size * sizeof(int32) * 2);
|
||||
if (!snd.fm.buffer) return (-1);
|
||||
|
||||
#ifndef NGC
|
||||
/* Output buffers */
|
||||
snd.buffer[0] = (int16 *) malloc(snd.buffer_size * sizeof(int16));
|
||||
snd.buffer[1] = (int16 *) malloc(snd.buffer_size * sizeof(int16));
|
||||
if (!snd.buffer[0] || !snd.buffer[1]) return (-1);
|
||||
#endif
|
||||
|
||||
/* Resampling buffer */
|
||||
if (config.hq_fm && !Fir_Resampler_initialize(4096)) return (-1);
|
||||
|
||||
@ -137,10 +130,6 @@ void audio_reset(void)
|
||||
snd.fm.pos = snd.fm.buffer;
|
||||
if (snd.psg.buffer) memset (snd.psg.buffer, 0, snd.buffer_size * sizeof(int16));
|
||||
if (snd.fm.buffer) memset (snd.fm.buffer, 0, snd.buffer_size * sizeof(int32) * 2);
|
||||
#ifndef NGC
|
||||
if (snd.buffer[0]) memset (snd.buffer[0], 0, snd.buffer_size * sizeof(int16));
|
||||
if (snd.buffer[1]) memset (snd.buffer[1], 0, snd.buffer_size * sizeof(int16));
|
||||
#endif
|
||||
}
|
||||
|
||||
void audio_set_equalizer(void)
|
||||
@ -156,16 +145,12 @@ void audio_shutdown(void)
|
||||
/* Sound buffers */
|
||||
if (snd.fm.buffer) free(snd.fm.buffer);
|
||||
if (snd.psg.buffer) free(snd.psg.buffer);
|
||||
#ifndef NGC
|
||||
if (snd.buffer[0]) free(snd.buffer[0]);
|
||||
if (snd.buffer[1]) free(snd.buffer[1]);
|
||||
#endif
|
||||
|
||||
/* Resampling buffer */
|
||||
Fir_Resampler_shutdown();
|
||||
}
|
||||
|
||||
int audio_update(void)
|
||||
int audio_update(int16 *buffer)
|
||||
{
|
||||
int32 i, l, r;
|
||||
int32 ll = llp;
|
||||
@ -180,10 +165,6 @@ int audio_update(void)
|
||||
int32 *fm = snd.fm.buffer;
|
||||
int16 *psg = snd.psg.buffer;
|
||||
|
||||
#ifdef NGC
|
||||
int16 *sb = (int16 *) soundbuffer[mixbuffer];
|
||||
#endif
|
||||
|
||||
/* get number of available samples */
|
||||
int size = sound_update(mcycles_vdp);
|
||||
|
||||
@ -249,12 +230,12 @@ int audio_update(void)
|
||||
else if (r < -32768) r = -32768;
|
||||
|
||||
/* update sound buffer */
|
||||
#ifndef NGC
|
||||
snd.buffer[0][i] = l;
|
||||
snd.buffer[1][i] = r;
|
||||
#ifdef LSB_FIRST
|
||||
*buffer++ = l;
|
||||
*buffer++ = r;
|
||||
#else
|
||||
*sb++ = r;
|
||||
*sb++ = l;
|
||||
*buffer++ = r;
|
||||
*buffer++ = l;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -539,7 +520,7 @@ void system_frame_gen(int do_skip)
|
||||
}
|
||||
|
||||
/* update inputs before VINT (Warriors of Eternal Sun) */
|
||||
osd_input_Update();
|
||||
osd_input_update();
|
||||
|
||||
/* delay between VINT flag & V Interrupt (Ex-Mutants, Tyrant) */
|
||||
m68k_run(mcycles_vdp + 588);
|
||||
@ -945,7 +926,7 @@ void system_frame_sms(int do_skip)
|
||||
}
|
||||
|
||||
/* update inputs before VINT */
|
||||
osd_input_Update();
|
||||
osd_input_update();
|
||||
|
||||
/* run Z80 until end of line */
|
||||
z80_run(mcycles_vdp + MCYCLES_PER_LINE);
|
||||
|
@ -84,11 +84,10 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sample_rate; /* Output Sample rate (8000-48000) */
|
||||
double frame_rate; /* Output Frame rate (usually 50 or 60 frames per second) */
|
||||
int enabled; /* 1= sound emulation is enabled */
|
||||
int buffer_size; /* Size of sound buffer (in bytes) */
|
||||
int16 *buffer[2]; /* Signed 16-bit stereo sound data */
|
||||
int sample_rate; /* Output Sample rate (8000-48000) */
|
||||
double frame_rate; /* Output Frame rate (usually 50 or 60 frames per second) */
|
||||
int enabled; /* 1= sound emulation is enabled */
|
||||
int buffer_size; /* Size of sound buffer (in bytes) */
|
||||
struct
|
||||
{
|
||||
int32 *pos;
|
||||
@ -116,7 +115,7 @@ extern uint32 system_clock;
|
||||
extern int audio_init(int samplerate, double framerate);
|
||||
extern void audio_reset(void);
|
||||
extern void audio_shutdown(void);
|
||||
extern int audio_update(void);
|
||||
extern int audio_update(int16 *buffer);
|
||||
extern void audio_set_equalizer(void);
|
||||
extern void system_init(void);
|
||||
extern void system_reset(void);
|
||||
|
@ -29,6 +29,9 @@ struct {
|
||||
int current_emulated_samples;
|
||||
} sdl_sound;
|
||||
|
||||
|
||||
static short soundframe[SOUND_SAMPLES_SIZE];
|
||||
|
||||
static void sdl_sound_callback(void *userdata, Uint8 *stream, int len)
|
||||
{
|
||||
if(sdl_sound.current_emulated_samples < len) {
|
||||
@ -85,25 +88,23 @@ static int sdl_sound_init()
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void sdl_sound_update()
|
||||
static void sdl_sound_update(enabled)
|
||||
{
|
||||
int i;
|
||||
short* p;
|
||||
|
||||
int size = audio_update();
|
||||
|
||||
if (use_sound)
|
||||
int size = audio_update(soundframe) * 2;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
int i;
|
||||
short *out;
|
||||
|
||||
SDL_LockAudio();
|
||||
p = (short*)sdl_sound.current_pos;
|
||||
for(i = 0; i < size; ++i) {
|
||||
*p = snd.buffer[0][i];
|
||||
++p;
|
||||
*p = snd.buffer[1][i];
|
||||
++p;
|
||||
out = (short*)sdl_sound.current_pos;
|
||||
for(i = 0; i < size; i++)
|
||||
{
|
||||
*out++ = soundframe[i];
|
||||
}
|
||||
sdl_sound.current_pos = (char*)p;
|
||||
sdl_sound.current_emulated_samples += size * 2 * sizeof(short);
|
||||
sdl_sound.current_pos = (char*)out;
|
||||
sdl_sound.current_emulated_samples += size * sizeof(short);
|
||||
SDL_UnlockAudio();
|
||||
}
|
||||
}
|
||||
@ -768,7 +769,7 @@ int main (int argc, char **argv)
|
||||
}
|
||||
|
||||
sdl_video_update();
|
||||
sdl_sound_update();
|
||||
sdl_sound_update(use_sound);
|
||||
|
||||
if(!turbo_mode && sdl_sync.sem_sync && sdl_video.frames_rendered % 3 == 0)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "unzip.h"
|
||||
#include "fileio.h"
|
||||
|
||||
#define osd_input_Update sdl_input_update
|
||||
#define osd_input_update sdl_input_update
|
||||
|
||||
#define GG_ROM "./ggenie.bin"
|
||||
#define AR_ROM "./areplay.bin"
|
||||
|
Loading…
Reference in New Issue
Block a user