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