]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Integer value ini write functions.
authorToni Wilen <twilen@winuae.net>
Sat, 3 Feb 2018 09:13:35 +0000 (11:13 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 3 Feb 2018 09:13:35 +0000 (11:13 +0200)
include/ini.h
ini.cpp

index 5d8f9ef8fa0ca5016407281fd1630cb36dc5c2cd..553bd12485dc8d6764d7202ff52308c6d4dc5bb6 100644 (file)
@@ -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 c190e0ce939a7a2a4ed3be55b525d83de949392f..7bb1ff115b337ef16b92b70c196dc2012efd9b7f 100644 (file)
--- 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);