Skip to content

Commit e7f1ade

Browse files
committed
Fixed INI issues
Fixed INI settings Changed how INI files get written
1 parent 0129331 commit e7f1ade

File tree

8 files changed

+50
-39
lines changed

8 files changed

+50
-39
lines changed

arm9/source/globalsettings.cpp

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,23 @@ void cGlobalSettings::loadSettings() {
8282
homebrewreset = ini.GetInt("system", "homebrewreset", homebrewreset);
8383
resetHotKey = ini.GetInt("system", "resethotkey", resetHotKey);
8484
phatCol = ini.GetInt("system", "phatCol", phatCol);
85-
85+
86+
temp = ini.GetString("system", "saveext", ".sav");
87+
saveExt = (temp == ".sav");
8688
temp = ini.GetString("system", "scrollSpeed", "fast");
87-
scrollSpeed =
88-
(temp == "slow") ? EScrollSlow : ((temp == "medium") ? EScrollMedium : EScrollFast);
89-
89+
scrollSpeed = (temp == "slow") ? EScrollSlow
90+
: (temp == "medium") ? EScrollMedium
91+
: EScrollFast;
9092
temp = ini.GetString("system", "viewMode", "icon");
91-
viewMode = (temp == "list") ? EViewList
92-
: (temp == "icon") ? EViewIcon
93-
: (temp == "small") ? EViewSmall
94-
: EViewInternal;
95-
93+
viewMode = (temp == "list") ? EViewList
94+
: (temp == "icon") ? EViewIcon
95+
: (temp == "small") ? EViewSmall
96+
: (temp == "internal") ? EViewInternal
97+
: EViewInternal;
9698
temp = ini.GetString("system", "slot2mode", "ask");
97-
slot2mode = (temp == "gba") ? ESlot2Gba : ((temp == "nds") ? ESlot2Nds : ESlot2Ask);
98-
99-
temp = ini.GetString("system", "saveext", ".sav");
100-
saveExt = (temp == ".sav");
99+
slot2mode = (temp == "gba") ? ESlot2Gba
100+
: (temp == "nds") ? ESlot2Nds
101+
: ESlot2Ask;
101102

102103
#ifdef __KERNEL_LAUNCHER_SUPPORT__
103104
temp = ini.GetString("system", "nds-bootstrap", "false");
@@ -137,21 +138,29 @@ void cGlobalSettings::saveSettings() {
137138
ini.SetInt("system", "resethotkey", resetHotKey);
138139
ini.SetInt("system", "dsonly", dsOnly);
139140
ini.SetInt("system", "phatCol", phatCol);
140-
141-
ini.SetString("system", "scrollSpeed",
142-
(scrollSpeed == EScrollSlow)
143-
? "slow"
144-
: ((scrollSpeed == EScrollMedium) ? "medium" : "fast"));
141+
ini.SetString(
142+
"system", "saveext",
143+
saveExt ? ".sav"
144+
: ".nds.sav");
145+
ini.SetString(
146+
"system", "scrollSpeed",
147+
(scrollSpeed == EScrollSlow) ? "slow"
148+
: (scrollSpeed == EScrollMedium) ? "medium"
149+
: (scrollSpeed == EScrollFast) ? "fast"
150+
: "fast");
145151
ini.SetString(
146152
"system", "viewMode",
147153
(viewMode == EViewList) ? "list"
148154
: (viewMode == EViewIcon) ? "icon"
149155
: (viewMode == EViewSmall) ? "small"
150156
: (viewMode == EViewInternal) ? "internal"
151157
: "internal");
152-
ini.SetString("system", "slot2mode",
153-
(slot2mode == ESlot2Gba) ? "gba" : ((slot2mode == ESlot2Nds) ? "nds" : "ask"));
154-
ini.SetString("system", "saveext", saveExt ? ".sav" : ".nds.sav");
158+
ini.SetString(
159+
"system", "slot2mode",
160+
(slot2mode == ESlot2Gba) ? "gba"
161+
: (slot2mode == ESlot2Nds) ? "nds"
162+
: (slot2mode == ESlot2Ask) ? "ask"
163+
: "ask" );
155164

156165
#ifdef __KERNEL_LAUNCHER_SUPPORT__
157166
ini.SetString("system", "nds-bootstrap",

arm9/source/inifile.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -190,29 +190,30 @@ bool CIniFile::SaveIniFileModified(const std::string& FileName) {
190190
bool CIniFile::SaveIniFile(const std::string& FileName) {
191191
if (FileName != "") m_sFileName = FileName;
192192

193-
FILE* f = fopen(m_sFileName.c_str(), "wb");
194-
if (NULL == f) {
193+
FILE* f = fopen(m_sFileName.c_str(), "w");
194+
if (f == NULL) {
195195
return false;
196196
}
197197

198198
for (size_t ii = 0; ii < m_FileContainer.size(); ii++) {
199199
std::string& strline = m_FileContainer[ii];
200200
size_t notSpace = strline.find_first_not_of(' ');
201-
strline = strline.substr(notSpace);
201+
if (notSpace != std::string::npos) {
202+
strline = strline.substr(notSpace);
203+
}
204+
202205
if (strline.find('[') == 0 && ii > 0) {
203-
if (!m_FileContainer[ii - 1].empty() && m_FileContainer[ii - 1] != "")
204-
fwrite("\r\n", 1, 2, f);
206+
if (!m_FileContainer[ii - 1].empty())
207+
fprintf(f, "\n");
205208
}
206-
if (!strline.empty() && strline != "") {
207-
fwrite(strline.c_str(), 1, strline.length(), f);
208-
fwrite("\r\n", 1, 2, f);
209+
210+
if (!strline.empty()) {
211+
fprintf(f, "%s\n", strline.c_str());
209212
}
210213
}
211214

212215
fclose(f);
213-
214216
m_bModified = false;
215-
216217
return true;
217218
}
218219

arm9/source/mainwnd.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,7 @@ void cMainWnd::setParam(void) {
537537
_values.clear();
538538
_values.push_back(LANG("switches", "Disable"));
539539
_values.push_back(LANG("switches", "Enable"));
540-
settingWnd.addSettingItem(LANG("file settings", "show hidden files"), _values,
541-
gs().showHiddenFiles);
540+
settingWnd.addSettingItem(LANG("file settings", "show hidden files"), _values, gs().showHiddenFiles);
542541
_values.clear();
543542
_values.push_back(".nds.sav");
544543
_values.push_back(".sav");
@@ -556,8 +555,8 @@ void cMainWnd::setParam(void) {
556555
settingWnd.addSettingItem(LANG("nds bootstrap", "dsmode"), _values, gs().dsOnly);
557556
#ifdef __DSIMODE__
558557
_values.clear();
559-
_values.push_back("disable");
560558
_values.push_back("enable");
559+
_values.push_back("disable");
561560
settingWnd.addSettingItem(LANG("nds bootstrap", "phatCol"), _values, gs().phatCol);
562561
#endif
563562
_values.clear();
@@ -610,8 +609,8 @@ void cMainWnd::setParam(void) {
610609

611610
// page 3: filesystem
612611
gs().showHiddenFiles = settingWnd.getItemSelection(2, 0);
613-
gs().saveExt = settingWnd.getItemSelection(2, 2);
614-
gs().saveDir = settingWnd.getItemSelection(2, 3);
612+
gs().saveExt = settingWnd.getItemSelection(2, 1);
613+
gs().saveDir = settingWnd.getItemSelection(2, 2);
615614

616615
// page 4: ndsbs
617616
gs().dsOnly = settingWnd.getItemSelection(3, 0);

arm9/source/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
#define AKMENU_VERSION_MAIN "1"
11-
#define AKMENU_VERSION_SUB "6"
11+
#define AKMENU_VERSION_SUB "6.1"
1212

1313
#ifndef __KERNEL_LAUNCHER_SUPPORT__
1414
#define AKMENU_LOADER_NAME "nds-bootstrap"

language/Deutsch/language.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ target slot = Ziel Speicher-Slot
280280
flash memory = Flash Memory
281281
microsd card = microSD Card
282282
slot2 card = Slot2 Card
283+
slot1 card = Slot1 Card
283284
favorites = Favoriten
284285

285286
[hotkeys]

language/Français/language.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ target slot = Slot de destination
278278
flash memory = Flash Memory
279279
microsd card = microSD Card
280280
slot2 card = Slot 2 Card
281-
slot2 card = Slot 1 Card
281+
slot1 card = Slot 1 Card
282282
favorites = Favorites
283283

284284
[hotkeys]

package/_nds/akmenunext/language/Deutsch/language.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ target slot = Ziel Speicher-Slot
280280
flash memory = Flash Memory
281281
microsd card = microSD Card
282282
slot2 card = Slot2 Card
283+
slot1 card = Slot1 Card
283284
favorites = Favoriten
284285

285286
[hotkeys]

package/_nds/akmenunext/language/Français/language.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ target slot = Slot de destination
278278
flash memory = Flash Memory
279279
microsd card = microSD Card
280280
slot2 card = Slot 2 Card
281-
slot2 card = Slot 1 Card
281+
slot1 card = Slot 1 Card
282282
favorites = Favorites
283283

284284
[hotkeys]

0 commit comments

Comments
 (0)