mirror of
https://github.com/libretro/gw-libretro.git
synced 2024-12-02 13:07:46 +00:00
Release 1.5.0, see the changelog
This commit is contained in:
parent
f37e775b57
commit
635f5cbd3b
@ -372,7 +372,7 @@ endif
|
||||
$(CORE_DIR)/gwlua/functions.o: $(CORE_DIR)/gwlua/entries.c $(HEADERS)
|
||||
|
||||
$(CORE_DIR)/src/version.c: FORCE
|
||||
cat $(CORE_DIR)/etc/version.c.templ | sed s/VERSION/1.4.0/g | sed s/HASH/`git rev-parse HEAD | tr -d "\n"`/g > $@
|
||||
cat $(CORE_DIR)/etc/version.c.templ | sed s/VERSION/1.5.0/g | sed s/HASH/`git rev-parse HEAD | tr -d "\n"`/g > $@
|
||||
|
||||
clean-objs:
|
||||
rm -f $(OBJS)
|
||||
|
@ -10,6 +10,12 @@ The [SNES controller](http://commons.wikimedia.org/wiki/File:SNES_controller.svg
|
||||
|
||||
## Changelog
|
||||
|
||||
### 1.5.0
|
||||
|
||||
* Avoided buttons being pressed when the menu or the controller are active.
|
||||
* Added ability to pause and resume audio playback.
|
||||
* Pause the timers and the audio when the game is not active.
|
||||
|
||||
### 1.4.0
|
||||
|
||||
* Removed the `constcast.cpp` aberration, the core is now pure C.
|
||||
|
@ -30,7 +30,7 @@ $(CORE_DIR)/gwlua/functions.c: $(CORE_DIR)/gwlua/entries.c $(HEADERS)
|
||||
touch $@
|
||||
|
||||
$(CORE_DIR)/src/version.c: FORCE
|
||||
cat $(CORE_DIR)/etc/version.c.templ | sed s/VERSION/1.4.0/g | sed s/HASH/`git rev-parse HEAD | tr -d "\n"`/g > $@
|
||||
cat $(CORE_DIR)/etc/version.c.templ | sed s/VERSION/1.5.0/g | sed s/HASH/`git rev-parse HEAD | tr -d "\n"`/g > $@
|
||||
|
||||
clean-objs:
|
||||
rm -f $(OBJS)
|
||||
|
@ -160,6 +160,24 @@ static int l_stopsounds( lua_State* L )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_pausesounds( lua_State* L )
|
||||
{
|
||||
rl_sound_pause();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_resumesounds( lua_State* L )
|
||||
{
|
||||
rl_sound_resume();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_issoundactive( lua_State* L )
|
||||
{
|
||||
lua_pushboolean( L, rl_sound_is_active() );
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_randomize( lua_State* L )
|
||||
{
|
||||
rl_srand( time( NULL ) );
|
||||
@ -503,6 +521,9 @@ void register_functions( lua_State* L, gwlua_t* state )
|
||||
{
|
||||
{ "playsound", l_playsound },
|
||||
{ "stopsounds", l_stopsounds },
|
||||
{ "pausesounds", l_pausesounds },
|
||||
{ "resumesounds", l_resumesounds },
|
||||
{ "issoundactive", l_issoundactive },
|
||||
{ "randomize", l_randomize },
|
||||
{ "random", l_random },
|
||||
{ "round", l_round },
|
||||
|
@ -185,10 +185,16 @@ void gwlua_set_button( gwlua_t* state, int port, int button, int pressed )
|
||||
|
||||
void gwlua_tick( gwlua_t* state )
|
||||
{
|
||||
state->now += 16666;
|
||||
|
||||
gwlua_ref_get( state->L, state->tick_ref );
|
||||
l_pcall( state->L, 0, 0 );
|
||||
l_pcall( state->L, 0, 1 );
|
||||
|
||||
if ( lua_toboolean( state->L, -1 ) )
|
||||
{
|
||||
state->now += 16666;
|
||||
}
|
||||
|
||||
lua_pop( state->L, 1 );
|
||||
|
||||
lua_gc( state->L, LUA_GCSTEP, 0 );
|
||||
}
|
||||
|
||||
|
1132
gwlua/lua/system.h
1132
gwlua/lua/system.h
File diff suppressed because it is too large
Load Diff
@ -248,16 +248,24 @@ return function( M )
|
||||
for button, pos in pairs( pos ) do
|
||||
text[ button ] = render( snes_x + pos[ 1 ], snes_y + pos[ 2 ], msgs[ button ] or '', pos[ 3 ] )
|
||||
end
|
||||
|
||||
local help = { active = false }
|
||||
|
||||
help.isactive = function( self )
|
||||
return self.active
|
||||
end
|
||||
|
||||
return {
|
||||
setvisible = function( self, visible )
|
||||
snes_spt.visible = visible
|
||||
|
||||
for _, render in pairs( text ) do
|
||||
render:setvisible( visible )
|
||||
end
|
||||
help.setvisible = function( self, visible )
|
||||
snes_spt.visible = visible
|
||||
|
||||
for _, render in pairs( text ) do
|
||||
render:setvisible( visible )
|
||||
end
|
||||
}
|
||||
|
||||
self.active = visible
|
||||
end
|
||||
|
||||
return help
|
||||
end
|
||||
|
||||
local createmenu = function( keydown, keyup, zoom, width, options, help )
|
||||
@ -473,6 +481,16 @@ return function( M )
|
||||
end
|
||||
|
||||
return function()
|
||||
local gameactive = true
|
||||
|
||||
if help:isactive() then
|
||||
gameactive = false
|
||||
end
|
||||
|
||||
if menu and menu:isactive() then
|
||||
gameactive = false
|
||||
end
|
||||
|
||||
system.inputstate( newstate )
|
||||
|
||||
for button, pressed in pairs( newstate ) do
|
||||
@ -480,13 +498,15 @@ return function( M )
|
||||
local keys = keymap[ button ]
|
||||
|
||||
if keys then
|
||||
if pressed then
|
||||
for _, key in ipairs( keys ) do
|
||||
keydown( key )
|
||||
end
|
||||
else
|
||||
for _, key in ipairs( keys ) do
|
||||
keyup( key )
|
||||
if gameactive then
|
||||
if pressed then
|
||||
for _, key in ipairs( keys ) do
|
||||
keydown( key )
|
||||
end
|
||||
else
|
||||
for _, key in ipairs( keys ) do
|
||||
keyup( key )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -518,13 +538,21 @@ return function( M )
|
||||
end
|
||||
end
|
||||
|
||||
if menu and not menu:isactive() then
|
||||
if gameactive then
|
||||
if not system.issoundactive() then
|
||||
system.resumesounds()
|
||||
end
|
||||
|
||||
for _, timer in ipairs( timers ) do
|
||||
timer:tick()
|
||||
end
|
||||
else
|
||||
if system.issoundactive() then
|
||||
system.pausesounds()
|
||||
end
|
||||
end
|
||||
|
||||
return state
|
||||
return gameactive
|
||||
end
|
||||
end
|
||||
end
|
||||
|
BIN
retroluxury/etc/luai/luai.exe
Normal file
BIN
retroluxury/etc/luai/luai.exe
Normal file
Binary file not shown.
@ -41,6 +41,7 @@ voice_t;
|
||||
|
||||
static int16_t audio_buffer[ RL_SAMPLES_PER_FRAME * 2 ];
|
||||
static voice_t voices[ RL_MAX_VOICES ];
|
||||
static int active;
|
||||
|
||||
#ifdef RL_OGG_VORBIS
|
||||
static stb_vorbis* ogg_stream;
|
||||
@ -58,6 +59,8 @@ void rl_sound_init( void )
|
||||
{
|
||||
voices[ i ].sound = NULL;
|
||||
}
|
||||
|
||||
active = 1;
|
||||
|
||||
#ifdef RL_OGG_VORBIS
|
||||
ogg_stream = NULL;
|
||||
@ -75,6 +78,21 @@ void rl_sound_done( void )
|
||||
#endif
|
||||
}
|
||||
|
||||
void rl_sound_pause( void )
|
||||
{
|
||||
active -= active != 0;
|
||||
}
|
||||
|
||||
void rl_sound_resume( void )
|
||||
{
|
||||
active++;
|
||||
}
|
||||
|
||||
int rl_sound_is_active( void )
|
||||
{
|
||||
return active != 0;
|
||||
}
|
||||
|
||||
rl_sound_t* rl_sound_create( const void* data, size_t size, int stereo )
|
||||
{
|
||||
union
|
||||
@ -383,8 +401,15 @@ again:
|
||||
const int16_t* rl_sound_mix( void )
|
||||
{
|
||||
int32_t buffer[ RL_SAMPLES_PER_FRAME * 2 ];
|
||||
memset( buffer, 0, sizeof( buffer ) );
|
||||
|
||||
if ( !active )
|
||||
{
|
||||
memset( audio_buffer, 0, sizeof( audio_buffer ) );
|
||||
return audio_buffer;
|
||||
}
|
||||
|
||||
memset( buffer, 0, sizeof( buffer ) );
|
||||
|
||||
voice_t* restrict voice = voices;
|
||||
const voice_t* restrict end = voices + RL_MAX_VOICES;
|
||||
|
||||
|
@ -23,6 +23,10 @@ typedef void ( *rl_soundstop_t )( const rl_sound_t* );
|
||||
void rl_sound_init( void );
|
||||
void rl_sound_done( void );
|
||||
|
||||
void rl_sound_pause( void );
|
||||
void rl_sound_resume( void );
|
||||
int rl_sound_is_active( void );
|
||||
|
||||
rl_sound_t* rl_sound_create( const void* data, size_t size, int stereo );
|
||||
#define rl_sound_destroy( sound ) do { rl_free( sound ); } while ( 0 )
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user