Look of a Working ini reader that I can put in my menu to turn options on and off. I have done a lot of research online and I cant find the right stuff or I'm just not understanding how to set it up one. Any help would be greatly appreciated.
(01-05-2020 - 06:01 AM)mrbignasty87 Wrote: Look of a Working ini reader that I can put in my menu to turn options on and off. I have done a lot of research online and I cant find the right stuff or I'm just not understanding how to set it up one. Any help would be greatly appreciated.void presetsettings()
{
int fd;
uint64_t unk;
char ReadBuffer[1024] = { 0 };
char* locationToWrite = "/dev_hdd0/tmp/NeelixV2/preset.ini";
if (cellFsOpen(locationToWrite, CELL_FS_O_RDONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
return;
cellFsRead(fd, ReadBuffer, 5000, &unk);
cellFsClose(fd);
int LineNumber = 0;
char line[5000];
for (int i = 0; i < 5000; i++) {
if (ReadBuffer[i] == NULL)
break;
if
(ReadBuffer[i] == '\n') {
LineNumber++;
switch (LineNumber) {
case 2:
if (CompareStrings(line, "godmode: 1"))
bool_SelfOptions[1] = true;
break;
case 3:
if (CompareStrings(line, "never wanted: 1"))
bool_SelfOptions[3] = true;
break;
}
memset(line, 0, 5000);
}
else
sprintf(line, "%s%c", line, ReadBuffer[i]);
loadini = false;
}
}
if (loadini)
{
presetsettings();
}
bool loadini = true;
(01-18-2020 - 01:36 PM)Torxi Wrote:(01-05-2020 - 06:01 AM)mrbignasty87 Wrote: Look of a Working ini reader that I can put in my menu to turn options on and off. I have done a lot of research online and I cant find the right stuff or I'm just not understanding how to set it up one. Any help would be greatly appreciated.void presetsettings()
{
int fd;
uint64_t unk;
char ReadBuffer[1024] = { 0 };
char* locationToWrite = "/dev_hdd0/tmp/NeelixV2/preset.ini";
if (cellFsOpen(locationToWrite, CELL_FS_O_RDONLY, &fd, NULL, 0) != CELL_FS_SUCCEEDED)
return;
cellFsRead(fd, ReadBuffer, 5000, &unk);
cellFsClose(fd);
int LineNumber = 0;
char line[5000];
for (int i = 0; i < 5000; i++) {
if (ReadBuffer[i] == NULL)
break;
if
(ReadBuffer[i] == '\n') {
LineNumber++;
switch (LineNumber) {
case 2:
if (CompareStrings(line, "godmode: 1"))
bool_SelfOptions[1] = true;
break;
case 3:
if (CompareStrings(line, "never wanted: 1"))
bool_SelfOptions[3] = true;
break;
}
memset(line, 0, 5000);
}
else
sprintf(line, "%s%c", line, ReadBuffer[i]);
loadini = false;
}
}
if (loadini)
{
presetsettings();
}
bool loadini = true;
Thanks a bunch
Users browsing: 1 Guest(s)