mirror of
https://github.com/libretro/retroluxury.git
synced 2025-02-17 05:37:57 +00:00
added the ability to retrieve the runtime retroluxury configuration
This commit is contained in:
parent
72261b523e
commit
59f555e5a1
@ -4,7 +4,7 @@ DEFINES=-DOUTSIDE_SPEEX -DRANDOM_PREFIX=speex -DEXPORT= -DFIXED_POINT
|
||||
#CFLAGS=-O3 --std=c99 -Wall $(INCLUDES) $(DEFINES)
|
||||
CFLAGS=-O0 -g --std=c99 -Wall $(INCLUDES) $(DEFINES)
|
||||
|
||||
OBJS=rl_backgrnd.o rl_image.o rl_imgdata.o rl_pack.o rl_rand.o rl_resample.o rl_sound.o rl_snddata.o rl_sprite.o rl_version.o rl_xml.o external/resample.o
|
||||
OBJS=rl_backgrnd.o rl_config.o rl_image.o rl_imgdata.o rl_pack.o rl_rand.o rl_resample.o rl_sound.o rl_snddata.o rl_sprite.o rl_version.o rl_xml.o external/resample.o
|
||||
|
||||
%.o: %.c
|
||||
gcc $(CFLAGS) -c $< -o $@
|
||||
|
27
src/rl_config.c
Normal file
27
src/rl_config.c
Normal file
@ -0,0 +1,27 @@
|
||||
#include <rl_config.h>
|
||||
|
||||
static const rl_config_t config =
|
||||
{
|
||||
RL_VERSION_MAJOR,
|
||||
RL_VERSION_MINOR,
|
||||
RL_BACKGRND_MARGIN,
|
||||
RL_MAX_SPRITES,
|
||||
RL_BG_SAVE_SIZE,
|
||||
RL_FRAME_RATE,
|
||||
RL_SAMPLE_RATE,
|
||||
RL_SAMPLES_PER_FRAME,
|
||||
RL_RESAMPLER_QUALITY,
|
||||
RL_MAX_VOICES,
|
||||
RL_OGG_INCREMENT,
|
||||
#ifdef RL_OGG_VORBIS
|
||||
1,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
RL_USERDATA_COUNT
|
||||
};
|
||||
|
||||
const rl_config_t* rl_get_config( void )
|
||||
{
|
||||
return &config;
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
#ifndef RL_CONFIG_H
|
||||
#define RL_CONFIG_H
|
||||
|
||||
/* retroluxury version. */
|
||||
#define RL_VERSION_MAJOR 1
|
||||
#define RL_VERSION_MINOR 0
|
||||
|
||||
/*
|
||||
The margin to use when blitting sprites, must be a power of 2. The exact same
|
||||
value must be used when rle-encoding images with rlrle.lua.
|
||||
@ -29,6 +33,9 @@ value must be used when rle-encoding images with rlrle.lua.
|
||||
#define RL_SAMPLE_RATE 44100
|
||||
#endif
|
||||
|
||||
/* Number of 16-bit stereo samples per frame. DO NOT CHANGE! */
|
||||
#define RL_SAMPLES_PER_FRAME ( RL_SAMPLE_RATE / RL_FRAME_RATE )
|
||||
|
||||
/* The quality to use with the resampler [0, 10]. */
|
||||
#define RL_RESAMPLER_QUALITY 4
|
||||
|
||||
@ -50,4 +57,25 @@ value must be used when rle-encoding images with rlrle.lua.
|
||||
#define RL_USERDATA_COUNT 4
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned version_major;
|
||||
unsigned version_minor;
|
||||
unsigned backgrnd_margin;
|
||||
unsigned max_sprites;
|
||||
unsigned bg_save_size;
|
||||
unsigned frame_rate;
|
||||
unsigned sample_rate;
|
||||
unsigned samples_per_frame;
|
||||
unsigned resampler_quality;
|
||||
unsigned max_voices;
|
||||
unsigned ogg_increment;
|
||||
unsigned ogg_vorbis; /* != 0 if compiled with ogg vorbis support */
|
||||
unsigned userdata_count;
|
||||
}
|
||||
rl_config_t;
|
||||
|
||||
/* Do *not* use the macros above, use this function to retrieve the runtime values. */
|
||||
const rl_config_t* rl_get_config( void );
|
||||
|
||||
#endif /* RL_CONFIG_H */
|
||||
|
@ -7,9 +7,6 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Number of 16-bit stereo samples per frame. DO NOT CHANGE! */
|
||||
#define RL_SAMPLES_PER_FRAME ( RL_SAMPLE_RATE / RL_FRAME_RATE )
|
||||
|
||||
/* Reasons passed to the stop callback. */
|
||||
#define RL_SOUND_FINISHED 0
|
||||
#define RL_SOUND_STOPPED 1
|
||||
|
@ -209,17 +209,21 @@ void retro_set_input_poll( retro_input_poll_t cb )
|
||||
|
||||
void retro_get_system_av_info( struct retro_system_av_info* info )
|
||||
{
|
||||
const rl_config_t* config = rl_get_config();
|
||||
|
||||
info->geometry.base_width = WIDTH;
|
||||
info->geometry.base_height = HEIGHT;
|
||||
info->geometry.max_width = WIDTH;
|
||||
info->geometry.max_height = HEIGHT;
|
||||
info->geometry.aspect_ratio = 0.0f;
|
||||
info->timing.fps = 60.0;
|
||||
info->timing.sample_rate = RL_SAMPLE_RATE;
|
||||
info->timing.fps = config->frame_rate;
|
||||
info->timing.sample_rate = config->sample_rate;
|
||||
}
|
||||
|
||||
void retro_run( void )
|
||||
{
|
||||
const rl_config_t* config = rl_get_config();
|
||||
|
||||
input_poll_cb();
|
||||
|
||||
unsigned width = WIDTH - state.imgdata.width;
|
||||
@ -255,10 +259,10 @@ void retro_run( void )
|
||||
}
|
||||
|
||||
rl_sprites_blit();
|
||||
video_cb( (void*)rl_backgrnd_fb( NULL, NULL ), WIDTH, HEIGHT, ( WIDTH + RL_BACKGRND_MARGIN ) * 2 );
|
||||
video_cb( (void*)rl_backgrnd_fb( NULL, NULL ), WIDTH, HEIGHT, ( WIDTH + config->backgrnd_margin ) * 2 );
|
||||
rl_sprites_unblit();
|
||||
|
||||
audio_cb( rl_sound_mix(), RL_SAMPLES_PER_FRAME );
|
||||
audio_cb( rl_sound_mix(), config->samples_per_frame );
|
||||
}
|
||||
|
||||
void retro_deinit( void )
|
||||
|
Loading…
x
Reference in New Issue
Block a user