mirror of
https://github.com/holub/mame
synced 2025-07-06 18:39:28 +03:00
plugins/hiscore: add option to hiscore.ini to only_save_at_exit (nw)
This commit is contained in:
parent
7741c94805
commit
ec2685c66c
@ -32,11 +32,12 @@ function hiscore.startplugin()
|
||||
local scores_have_been_read = false;
|
||||
local mem_check_passed = false;
|
||||
local found_hiscore_entry = false;
|
||||
local timed_save = true;
|
||||
|
||||
local positions = {};
|
||||
-- Configuration file will be searched in the first path defined
|
||||
-- in mame inipath option.
|
||||
local function read_config()
|
||||
local function read_config()
|
||||
if config_read then return true end;
|
||||
local file = io.open( config_path, "r" );
|
||||
if file then
|
||||
@ -45,9 +46,11 @@ function hiscore.startplugin()
|
||||
local _conf = {}
|
||||
for line in io.lines(config_path) do
|
||||
token, value = string.match(line, '([^ ]+) ([^ ]+)');
|
||||
_conf[token] = lfs.env_replace(value);
|
||||
_conf[token] = value;
|
||||
end
|
||||
hiscore_path = _conf["hi_path"];
|
||||
hiscore_path = lfs.env_replace(_conf["hi_path"] or hiscore_path);
|
||||
timed_save = _conf["only_save_at_exit"] ~= "1"
|
||||
print(timed_save)
|
||||
-- hiscoredata_path = _conf["dat_path"]; -- don't know if I should do it, but wathever
|
||||
return true
|
||||
end
|
||||
@ -233,7 +236,7 @@ function hiscore.startplugin()
|
||||
-- set up scores if they have been
|
||||
init();
|
||||
-- only allow save check to run when
|
||||
if mem_check_passed then
|
||||
if mem_check_passed and timed_save then
|
||||
-- The reason for this complicated mess is that
|
||||
-- MAME does expose a hook for "exit". Once it does,
|
||||
-- this should obviously just be done when the emulator
|
||||
|
@ -828,7 +828,7 @@ void lua_engine::initialize()
|
||||
[](emu_file &file, const char *path, u32 flags) { new (&file) emu_file(path, flags); },
|
||||
[](emu_file &file, const char *mode) {
|
||||
int flags = 0;
|
||||
for(int i = 0; i < 2; i++) // limit to three chars
|
||||
for(int i = 0; i < 3 && mode[i]; i++) // limit to three chars
|
||||
{
|
||||
switch(mode[i])
|
||||
{
|
||||
@ -847,7 +847,7 @@ void lua_engine::initialize()
|
||||
},
|
||||
[](emu_file &file, const char *path, const char* mode) {
|
||||
int flags = 0;
|
||||
for(int i = 0; i < 2; i++) // limit to three chars
|
||||
for(int i = 0; i < 3 && mode[i]; i++) // limit to three chars
|
||||
{
|
||||
switch(mode[i])
|
||||
{
|
||||
@ -1587,8 +1587,8 @@ void lua_engine::initialize()
|
||||
* input:code_name(code) - get code friendly name
|
||||
* input:seq_from_tokens(tokens) - get input_seq for multiple space separated KEYCODE_* string tokens
|
||||
* input:seq_pressed(seq) - get pressed state for input_seq
|
||||
* input:seq_to_token(seq) - get KEYCODE_* string tokens for seq
|
||||
* input:seq_to_name(seq) - get seq friendly name
|
||||
* input:seq_to_tokens(seq) - get KEYCODE_* string tokens for seq
|
||||
* input:seq_name(seq) - get seq friendly name
|
||||
*/
|
||||
|
||||
sol().registry().new_usertype<input_manager>("input", "new", sol::no_constructor,
|
||||
|
Loading…
Reference in New Issue
Block a user