From: Toni Wilen Date: Sat, 3 Feb 2018 09:13:35 +0000 (+0200) Subject: Integer value ini write functions. X-Git-Tag: 4000~216 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2968d109e4ee1c853ad2416313ea9a5697f200cd;p=francis%2Fwinuae.git Integer value ini write functions. --- diff --git a/include/ini.h b/include/ini.h index 5d8f9ef8..553bd124 100644 --- a/include/ini.h +++ b/include/ini.h @@ -20,6 +20,8 @@ bool ini_save(struct ini_data *ini, const TCHAR *path); void ini_addnewstring(struct ini_data *ini, const TCHAR *section, const TCHAR *key, const TCHAR *val); void ini_addnewdata(struct ini_data *ini, const TCHAR *section, const TCHAR *key, const uae_u8 *data, int len); void ini_addnewcomment(struct ini_data *ini, const TCHAR *section, const TCHAR *val); +void ini_addnewval(struct ini_data *ini, const TCHAR *section, const TCHAR *key, uae_u32 v); +void ini_addnewval64(struct ini_data *ini, const TCHAR *section, const TCHAR *key, uae_u64 v); bool ini_getstring(struct ini_data *ini, const TCHAR *section, const TCHAR *key, TCHAR **out); bool ini_getval(struct ini_data *ini, const TCHAR *section, const TCHAR *key, int *v); diff --git a/ini.cpp b/ini.cpp index c190e0ce..7bb1ff11 100644 --- a/ini.cpp +++ b/ini.cpp @@ -107,6 +107,20 @@ void ini_addnewstring(struct ini_data *ini, const TCHAR *section, const TCHAR *k ini->inidata[cnt] = il; } +void ini_addnewval(struct ini_data *ini, const TCHAR *section, const TCHAR *key, uae_u32 v) +{ + TCHAR tmp[MAX_DPATH]; + _stprintf(tmp, _T("%08X ; %u"), v, v); + ini_addnewstring(ini, section, key, tmp); +} + +void ini_addnewval64(struct ini_data *ini, const TCHAR *section, const TCHAR *key, uae_u64 v) +{ + TCHAR tmp[MAX_DPATH]; + _stprintf(tmp, _T("%016llX ; %llu"), v, v); + ini_addnewstring(ini, section, key, tmp); +} + void ini_addnewdata(struct ini_data *ini, const TCHAR *section, const TCHAR *key, const uae_u8 *data, int len) { TCHAR *s = xcalloc(TCHAR, len * 3);