Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MAKEFILES := sysmod overlay
TARGETS := $(foreach dir,$(MAKEFILES),$(CURDIR)/$(dir))

# the below was taken from atmosphere + switch-examples makefile
export VERSION := 1.5.5
export VERSION := 1.5.6

ifneq ($(strip $(shell git symbolic-ref --short HEAD 2>/dev/null)),)
export GIT_BRANCH := $(shell git symbolic-ref --short HEAD)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ patch_sysmmc=1 ; 1=(default) patch sysmmc, 0=don't patch sysmmc
patch_emummc=1 ; 1=(default) patch emummc, 0=don't patch emummc
enable_logging=1 ; 1=(default) output /config/sys-patch/log.ini 0=no log
version_skip=1 ; 1=(default) skips out of date patterns, 0=search all patterns
clean_config=1 ; 1=(default) clean the config file 0=don't clean the config file
```

---
Expand Down Expand Up @@ -43,7 +44,7 @@ The overlay can be used to change the config options and to see what patches are
- Install [devkitpro](https://devkitpro.org/wiki/Getting_Started)
- Run the following:
```sh
git clone --recurse-submodules https://github.com/ITotalJustice/sys-patch.git
git clone --recurse-submodules https://github.com/impeeza/sys-patch.git
cd ./sys-patch
make
```
Expand Down
29 changes: 29 additions & 0 deletions common/minIni/minGlue.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,35 @@ bool ini_read(char* buffer, u64 size, struct NxFile* nxfile) {
return true;
}

bool ini_read2(char* buffer, u64 size, struct NxFile* nxfile) {
u64 bytes_read = 0;

if (R_FAILED(fsFileRead(&nxfile->file, nxfile->offset, buffer, size - 1, FsReadOption_None, &bytes_read))) {
return false;
}

if (bytes_read == 0) {
return false;
}

buffer[bytes_read] = '\0';

char* eol = strchr(buffer, '\n');
if (!eol) {
eol = strchr(buffer, '\r');
}

if (eol) {
*eol = '\0';
nxfile->offset += (eol - buffer + 1);
} else {
nxfile->offset += bytes_read;
return true;
}

return true;
}

bool ini_write(const char* buffer, struct NxFile* nxfile) {
const size_t size = strlen(buffer);
if (R_FAILED(fsFileWrite(&nxfile->file, nxfile->offset, buffer, size, FsWriteOption_None))) {
Expand Down
1 change: 1 addition & 0 deletions common/minIni/minGlue.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ bool ini_openwrite(const char* filename, struct NxFile* nxfile);
bool ini_openrewrite(const char* filename, struct NxFile* nxfile);
bool ini_close(struct NxFile* nxfile);
bool ini_read(char* buffer, u64 size, struct NxFile* nxfile);
bool ini_read2(char* buffer, u64 size, struct NxFile* nxfile);
bool ini_write(const char* buffer, struct NxFile* nxfile);
bool ini_tell(struct NxFile* nxfile, s64* pos);
bool ini_seek(struct NxFile* nxfile, s64* pos);
Expand Down
16 changes: 15 additions & 1 deletion common/minIni/minIni.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* These routines are in part based on the article "Multiplatform .INI Files"
* by Joseph J. Graf in the March 1994 issue of Dr. Dobb's Journal.
*
* Copyright (c) CompuPhase, 2008-2021
* Copyright (c) CompuPhase, 2008-2024
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -949,4 +949,18 @@ int ini_putf(const TCHAR *Section, const TCHAR *Key, INI_REAL Value, const TCHAR
return ini_puts(Section, Key, LocalBuffer, Filename);
}
#endif /* INI_REAL */

/** ini_putbool()
* \param Section the name of the section to write the value in
* \param Key the name of the entry to write
* \param Value the value to write; it should be 0 or 1.
* \param Filename the name and full path of the .ini file to write to
*
* \return 1 if successful, otherwise 0
*/
int ini_putbool(const TCHAR *Section, const TCHAR *Key, int Value, const TCHAR *Filename)
{
return ini_puts(Section, Key, Value ? __T("true") : __T("false"), Filename);
}

#endif /* !INI_READONLY */
29 changes: 15 additions & 14 deletions common/minIni/minIni.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* minIni - Multi-Platform INI file parser, suitable for embedded systems
*
* Copyright (c) CompuPhase, 2008-2021
* Copyright (c) CompuPhase, 2008-2024
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -37,24 +37,25 @@
extern "C" {
#endif

int ini_getbool(const mTCHAR *Section, const mTCHAR *Key, int DefValue, const mTCHAR *Filename);
long ini_getl(const mTCHAR *Section, const mTCHAR *Key, long DefValue, const mTCHAR *Filename);
int ini_gets(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *DefValue, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);
int ini_getsection(int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);
int ini_getkey(const mTCHAR *Section, int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);
int ini_getbool(const mTCHAR *Section, const mTCHAR *Key, int DefValue, const mTCHAR *Filename);
long ini_getl(const mTCHAR *Section, const mTCHAR *Key, long DefValue, const mTCHAR *Filename);
int ini_gets(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *DefValue, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);
int ini_getsection(int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);
int ini_getkey(const mTCHAR *Section, int idx, mTCHAR *Buffer, int BufferSize, const mTCHAR *Filename);

int ini_hassection(const mTCHAR *Section, const mTCHAR *Filename);
int ini_haskey(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Filename);
int ini_hassection(const mTCHAR *Section, const mTCHAR *Filename);
int ini_haskey(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Filename);

#if defined INI_REAL
INI_REAL ini_getf(const mTCHAR *Section, const mTCHAR *Key, INI_REAL DefValue, const mTCHAR *Filename);
#endif

#if !defined INI_READONLY
int ini_putl(const mTCHAR *Section, const mTCHAR *Key, long Value, const mTCHAR *Filename);
int ini_puts(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, const mTCHAR *Filename);
int ini_putbool(const mTCHAR *Section, const mTCHAR *Key, int Value, const mTCHAR *Filename);
int ini_putl(const mTCHAR *Section, const mTCHAR *Key, long Value, const mTCHAR *Filename);
int ini_puts(const mTCHAR *Section, const mTCHAR *Key, const mTCHAR *Value, const mTCHAR *Filename);
#if defined INI_REAL
int ini_putf(const mTCHAR *Section, const mTCHAR *Key, INI_REAL Value, const mTCHAR *Filename);
int ini_putf(const mTCHAR *Section, const mTCHAR *Key, INI_REAL Value, const mTCHAR *Filename);
#endif
#endif /* INI_READONLY */

Expand Down Expand Up @@ -124,15 +125,15 @@ int ini_browse(INI_CALLBACK Callback, void *UserData, const mTCHAR *Filename);
#endif

#if ! defined INI_READONLY
bool put(const std::string& Section, const std::string& Key, bool Value)
{ return ini_putbool(Section.c_str(), Key.c_str(), (int)Value, iniFilename.c_str()) != 0; }

bool put(const std::string& Section, const std::string& Key, long Value)
{ return ini_putl(Section.c_str(), Key.c_str(), Value, iniFilename.c_str()) != 0; }

bool put(const std::string& Section, const std::string& Key, int Value)
{ return ini_putl(Section.c_str(), Key.c_str(), (long)Value, iniFilename.c_str()) != 0; }

bool put(const std::string& Section, const std::string& Key, bool Value)
{ return ini_putl(Section.c_str(), Key.c_str(), (long)Value, iniFilename.c_str()) != 0; }

bool put(const std::string& Section, const std::string& Key, const std::string& Value)
{ return ini_puts(Section.c_str(), Key.c_str(), Value.c_str(), iniFilename.c_str()) != 0; }

Expand Down
2 changes: 2 additions & 0 deletions overlay/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class GuiOptions final : public tsl::Gui {
list->addItem(config_patch_emummc.create_list_item("Patch emuMMC"));
list->addItem(config_logging.create_list_item("Logging"));
list->addItem(config_version_skip.create_list_item("Version skip"));
list->addItem(config_clean_config.create_list_item("Clean configuration"));

frame->setContent(list);
return frame;
Expand All @@ -88,6 +89,7 @@ class GuiOptions final : public tsl::Gui {
ConfigEntry config_patch_emummc{"options", "patch_emummc", true};
ConfigEntry config_logging{"options", "enable_logging", true};
ConfigEntry config_version_skip{"options", "version_skip", true};
ConfigEntry config_clean_config{"options", "clean_config", true};
};

class GuiToggle final : public tsl::Gui {
Expand Down
Loading