Repository: proferabg/EdiZon-Overlay
Branch: main
Commit: 6542436d26f3
Files: 15
Total size: 67.6 KB
Directory structure:
gitextract__rpiy0qz/
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .gitmodules
├── Makefile
├── README.md
├── include/
│ ├── cheat.hpp
│ ├── cheat_engine_types.hpp
│ ├── dmntcht.h
│ ├── result.hpp
│ ├── results.hpp
│ ├── service_guard.h
│ └── utils.hpp
└── source/
├── cheat.cpp
├── dmntcht.c
└── main.cpp
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/main.yml
================================================
name: Release
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to run on'
required: true
default: 'main'
jobs:
build_and_release:
name: Build and release
runs-on: ubuntu-22.04
container: devkitpro/devkita64:20250728
steps:
- name: Update packages
run: |
sudo -n apt-get update
sudo -n apt-get install -y build-essential zip python3 python3-pip python3-lz4
shell: bash
- name: Update latest libnx
run: |
git config --global --add safe.directory "*"
git clone --recurse-submodules https://github.com/switchbrew/libnx.git
cd libnx
make install -j$(nproc)
shell: bash
- name: Checkout latest code
uses: actions/checkout@v5.0.0
with:
ref: main
clean: true
fetch-depth: 0
fetch-tags: true
submodules: recursive
- name: Setup ENV parameters
run: |
VER_FILE=Makefile
VERSION=$(awk '/^APP_VERSION/{print $3}' $VER_FILE)
echo "TAG=${VERSION}" >> "${GITHUB_ENV}"
echo "RELEASE_NAME=${VERSION}" >> "${GITHUB_ENV}"
echo "RELEASE=1" >> "${GITHUB_ENV}"
shell: bash
- name: Replace Tesla Colors
run: |
sed -i '/constexpr Color ColorHighlight/c\ constexpr Color ColorHighlight = { 0x0, 0xC, 0xF, 0xF }; ///< Greenish highlight color' ./libs/libultrahand/libtesla/include/tesla.hpp
sed -i '/static Color onTextColor/c\ static Color onTextColor = RGB888("00CCFF");' ./libs/libultrahand/libtesla/include/tesla.hpp
sed -i '/static Color trackBarFullColor/c\ static Color trackBarFullColor = RGB888("00CCFF");' ./libs/libultrahand/libtesla/include/tesla.hpp
shell: bash
- name: Build
run: |
export DEVKITPRO=/opt/devkitpro
make all
shell: bash
- name: Upload Release Asset
uses: softprops/action-gh-release@v2.4.1
with:
name: ${{ env.RELEASE_NAME }}
tag_name: ${{ env.TAG }}
draft: false
prerelease: false
generate_release_notes: yes
make_latest: true
files: |
./SdOut/EdiZon-Overlay.zip
./SdOut/switch/.overlays/ovlEdiZon.ovl
================================================
FILE: .gitignore
================================================
###################
#.gitignore #
###################
#
# Visual Studio Code
#
.settings/
.classpath
.factorypath
.project
.vscode/
#
# CMAKE
#
build/
out/
*.lst
#
# Custom
#
SdOut/
================================================
FILE: .gitmodules
================================================
[submodule "libs/libultrahand"]
path = libs/libultrahand
url = https://github.com/ppkantorski/libultrahand
================================================
FILE: Makefile
================================================
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
endif
TOPDIR ?= $(CURDIR)
include $(DEVKITPRO)/libnx/switch_rules
APP_TITLE := EdiZon
APP_FILENAME := ovlEdiZon
APP_AUTHOR := WerWolv, proferabg, and ppkantorski
APP_VERSION := v1.0.14
ifeq ($(RELEASE), 1)
APP_VERSION := $(APP_VERSION)-$(shell git describe --always)
endif
TARGET := $(APP_TITLE)
OUTDIR := out
BUILD := build
SOURCES_TOP := source
SOURCES += $(foreach dir,$(SOURCES_TOP),$(shell find $(dir) -type d 2>/dev/null))
INCLUDES := include
#EXCLUDES := dmntcht.c
DATA := data
# This location should reflect where you place the libultrahand directory (lib can vary between projects).
include ${TOPDIR}/libs/libultrahand/ultrahand.mk
#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
null :=
SPACE := $(null) $(null)
ARCH := -march=armv8-a -mtune=cortex-a57 -mtp=soft -fPIE
CFLAGS := -g -Wall -O3 -ffunction-sections -fdata-sections -flto -ffast-math -fomit-frame-pointer \
-fuse-linker-plugin -finline-small-functions -fno-strict-aliasing -frename-registers -falign-functions=16 \
$(ARCH) $(DEFINES) -DVERSION_STRING=\"$(subst $(SPACE),\$(SPACE),${APP_VERSION})\"
CFLAGS += $(INCLUDE) -D__SWITCH__ -D__OVERLAY__ -I$(PORTLIBS)/include/freetype2 $(pkg-config --cflags --libs python3) -Wno-deprecated-declarations
CFLAGS += -DAPP_VERSION=\"$(APP_VERSION)\" -DAPP_TITLE=\"$(APP_TITLE)\" -DAPP_AUTHOR=\""$(APP_AUTHOR)"\"
CXXFLAGS := $(CFLAGS) -fexceptions -std=c++26
ASFLAGS := -g $(ARCH)
LDFLAGS = -specs=$(DEVKITPRO)/libnx/switch.specs -g $(ARCH) -Wl,-Map,$(notdir $*.map)
LIBS := -lnx
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := $(CURDIR)/libs/nxpy $(PORTLIBS) $(LIBNX)
#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------
export OUTPUT := $(CURDIR)/$(OUTDIR)/$(APP_FILENAME)
export TOPDIR := $(CURDIR)
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
export DEPSDIR := $(CURDIR)/$(BUILD)
CFILES := $(filter-out $(EXCLUDES),$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))))
CPPFILES := $(filter-out $(EXCLUDES),$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))))
SFILES := $(filter-out $(EXCLUDES),$(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))))
BINFILES := $(filter-out $(EXCLUDES),$(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))))
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
ifeq ($(strip $(CPPFILES)),)
#---------------------------------------------------------------------------------
export LD := $(CC)
#---------------------------------------------------------------------------------
else
#---------------------------------------------------------------------------------
export LD := $(CXX)
#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
-I$(CURDIR)/$(BUILD)
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
ifeq ($(strip $(CONFIG_JSON)),)
jsons := $(wildcard *.json)
ifneq (,$(findstring $(TARGET).json,$(jsons)))
export APP_JSON := $(TOPDIR)/$(TARGET).json
else
ifneq (,$(findstring config.json,$(jsons)))
export APP_JSON := $(TOPDIR)/config.json
endif
endif
else
export APP_JSON := $(TOPDIR)/$(CONFIG_JSON)
endif
ifeq ($(strip $(ICON)),)
icons := $(wildcard *.jpg)
ifneq (,$(findstring $(TARGET).jpg,$(icons)))
export APP_ICON := $(TOPDIR)/$(TARGET).jpg
else
ifneq (,$(findstring icon.jpg,$(icons)))
export APP_ICON := $(TOPDIR)/icon.jpg
endif
endif
else
export APP_ICON := $(TOPDIR)/$(ICON)
endif
ifeq ($(strip $(NO_ICON)),)
export NROFLAGS += --icon=$(APP_ICON)
endif
ifeq ($(strip $(NO_NACP)),)
export NROFLAGS += --nacp=$(OUTPUT).nacp
endif
ifneq ($(APP_TITLEID),)
export NACPFLAGS += --titleid=$(APP_TITLEID)
endif
ifneq ($(ROMFS),)
export NROFLAGS += --romfsdir=$(CURDIR)/$(ROMFS)
endif
.PHONY: $(BUILD) clean all install
#---------------------------------------------------------------------------------
all: $(BUILD)
$(BUILD):
@[ -d $@ ] || mkdir -p $@ $(BUILD) $(OUTDIR)
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
@rm -rf SdOut
@mkdir -p SdOut/switch/.overlays
@cp -rf $(OUTPUT).ovl SdOut/switch/.overlays/
@cd $(CURDIR)/SdOut; zip -r -q -9 $(APP_TITLE)-Overlay.zip switch; cd $(CURDIR)
#---------------------------------------------------------------------------------
clean:
@echo " RM " $(BUILD) $(OUTDIR) SdOut
@rm -fr $(BUILD) $(OUTDIR) SdOut
#---------------------------------------------------------------------------------
install: all
@echo " LFTP " $@
@lftp -e "put -O /switch/.overlays ./out/$(APP_FILENAME).ovl;bye" $(IP)
#---------------------------------------------------------------------------------
else
.PHONY: all
DEPENDS := $(OFILES:.o=.d)
#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
all : $(OUTPUT).ovl
$(OUTPUT).ovl : $(OUTPUT).nro
@cp $(OUTPUT).nro $(OUTPUT).ovl
@printf 'ULTR' >> $(OUTPUT).ovl
@echo "Ultrahand signature has been added."
$(OUTPUT).nsp : $(OUTPUT).nso $(OUTPUT).npdm
$(OUTPUT).nso : $(OUTPUT).elf
$(OUTPUT).nro : $(OUTPUT).nso $(OUTPUT).nacp
$(OUTPUT).elf : $(OFILES)
$(OFILES_SRC) : $(HFILES_BIN)
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
%.bin.o %_bin.h : %.bin
@echo " BIN " $@
@$(bin2o)
%.ttf.o %_ttf.h : %.ttf
@echo " BIN " $@
@$(bin2o)
-include $(DEPENDS)
#---------------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------------
================================================
FILE: README.md
================================================
# EdiZon-Overlay []()
Originally by [@WerWolv](https://www.github.com/WerWolv)
Continued Support by proferabg & ppkantorski
<br />
<br />
# Latest Changelog - v1.0.14
Update libultrahand to v2.2.0
<br />
# How To Use Submenus
In your cheat text document, you can add submenus by using these 2 tags
[--SectionStart:<Section Name>--]
[--SectionEnd:<Section Name>--]
Example:
[--SectionStart:Item Codes--]
00000000 00000000 00000000
[Items x999]
040A0000 01DB2A08 52807CE0
[--SectionEnd:Item Codes--]
00000000 00000000 00000000
This will create a submenu called ***Item Codes*** with ***Items x999*** being a cheat in that submenu.
You can also disable the submenu feature (skips submenu items in cheat file).
To do so, insert the following at the very top of the file.
[--DisableSubmenus--]
00000000 00000000 00000000
Warning: Having too many cheats at once can lead to stability issues and can crash.
<br />
# How To Enable Cheats by Default on Overlay Open
In your cheat text document, you can have cheats turn on by default on opening of the overlay.
To do this, simply find the cheat you want to enable by default and add ***:ENABLED*** onto the end of the name.
Example:
[60 FPS Mod:ENABLED]
00000000 00000000 00000000
Warning: This will turn the cheat on every time the overlay is relaunched. Also, turning the cheat off in the menu and relaunching the overlay will turn the cheat back on.
================================================
FILE: include/cheat.hpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon.
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "dmntcht.h"
#include "cheat_engine_types.hpp"
#include "result.hpp"
#include "results.hpp"
#include <string>
#include <vector>
namespace edz::cheat {
// Work around for EResult madness
bool Succeeded(Result res);
#define EDIZON_CHEATS_DIR EDIZON_DIR "/cheats"
#define EMPTY_RESPONSE { }
class Cheat {
public:
Cheat(DmntCheatEntry cheatEntry);
std::string getName();
u32 getID();
bool toggle();
bool setState(bool state);
bool isEnabled();
private:
std::string m_name;
u32 m_id;
};
class FrozenAddress {
public:
FrozenAddress(DmntFrozenAddressEntry);
FrozenAddress(u64 address, u8 width, u64 value);
FrozenAddress(u64 address, u8 width);
u64 getAddress();
u8 getWidth();
u64 getValue();
u64 setValue(u64 value, u8 width);
bool toggle();
bool isFrozen();
private:
DmntFrozenAddressEntry m_frozenAddressEntry;
bool m_frozen;
};
class CheatManager {
public:
static Result initialize();
static void exit();
static bool isCheatServiceAvailable();
static Result forceAttach();
static bool hasCheatProcess();
static u64 getTitleID();
static u64 getProcessID();
static u64 getBuildID();
static types::Region getBaseRegion();
static types::Region getHeapRegion();
static types::Region getMainRegion();
static types::Region getAliasRegion();
//static EResultVal<std::string> getCheatFile();
//static EResultVal<u32> addCheat(DmntCheatDefinition cheatDefinition, bool enabled);
static Result removeCheat(u32 cheatID);
static std::vector<Cheat*>& getCheats();
static std::vector<FrozenAddress*>& getFrozenAddresses();
static MemoryInfo queryMemory(u64 address);
static std::vector<MemoryInfo> getMemoryRegions();
static Result readMemory(u64 address, void *buffer, size_t bufferSize);
static Result writeMemory(u64 address, const void *buffer, size_t bufferSize);
static Result reload();
private:
static inline std::vector<Cheat*> s_cheats;
static inline std::vector<FrozenAddress*> s_frozenAddresses;
static inline DmntCheatProcessMetadata s_processMetadata;
};
}
================================================
FILE: include/cheat_engine_types.hpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon.
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <cstring>
#include <vector>
namespace edz::cheat::types {
struct Region {
u64 baseAddress;
u64 size;
bool contains(u64 addr) {
return addr >= baseAddress && addr < (baseAddress + size);
}
};
enum class Signedness {
Unsigned,
Signed
};
class Pattern {
public:
Pattern() : m_pattern(nullptr), m_size(0) { }
Pattern(u8 *pattern, std::size_t size) : m_pattern(pattern), m_size(size) {}
void setPattern(u8 *pattern) { this->m_pattern = pattern; }
void setSize(std::size_t size) { this->m_size = size; }
void setSignedness(Signedness signedness) { this->m_signedness = signedness; }
bool operator==(Pattern& other) {
if (this->m_size != other.m_size) return false;
return std::memcmp(this->m_pattern, other.m_pattern, this->m_size) == 0;
}
bool operator!=(Pattern& other) {
return !operator==(other);
}
bool operator>(Pattern& other) {
if (this->m_size != other.m_size) return false;
if (this->m_signedness == Signedness::Signed) {
if ((reinterpret_cast<u8*>(this->m_pattern)[this->m_size - 1] & 0x80) > (reinterpret_cast<u8*>(other.m_pattern)[this->m_size - 1] & 0x80))
return false;
for (s8 i = this->m_size - 1; i >= 0; i--)
if (reinterpret_cast<u8*>(this->m_pattern)[i] > reinterpret_cast<u8*>(other.m_pattern)[i])
return true;
} else {
for (s8 i = this->m_size - 1; i >= 0; i--) {
if (reinterpret_cast<u8*>(this->m_pattern)[i] > reinterpret_cast<u8*>(other.m_pattern)[i])
return true;
}
}
return false;
}
bool operator<(Pattern& other) {
if (this->m_size != other.m_size) return false;
if (this->m_signedness == Signedness::Signed) {
if ((reinterpret_cast<u8*>(this->m_pattern)[this->m_size - 1] & 0x80) < (reinterpret_cast<u8*>(other.m_pattern)[this->m_size - 1] & 0x80))
return false;
for (s8 i = 0; i < this->m_size; i++)
if (reinterpret_cast<u8*>(this->m_pattern)[i] < reinterpret_cast<u8*>(other.m_pattern)[i])
return true;
} else {
for (s8 i = 0; i < this->m_size; i++) {
if (reinterpret_cast<u8*>(this->m_pattern)[i] < reinterpret_cast<u8*>(other.m_pattern)[i])
return true;
}
}
return false;
}
private:
u8 *m_pattern;
ssize_t m_size;
Signedness m_signedness;
};
using Operation = bool(Pattern::*)(Pattern&);
#define STRATEGY(operation) &edz::cheat::types::Pattern::operator operation
}
================================================
FILE: include/dmntcht.h
================================================
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <switch.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
u64 base;
u64 size;
} DmntMemoryRegionExtents;
typedef struct {
u64 process_id;
u64 title_id;
DmntMemoryRegionExtents main_nso_extents;
DmntMemoryRegionExtents heap_extents;
DmntMemoryRegionExtents alias_extents;
DmntMemoryRegionExtents address_space_extents;
u8 main_nso_build_id[0x20];
} DmntCheatProcessMetadata;
typedef struct {
char readable_name[0x40];
uint32_t num_opcodes;
uint32_t opcodes[0x100];
} DmntCheatDefinition;
typedef struct {
bool enabled;
uint32_t cheat_id;
DmntCheatDefinition definition;
} DmntCheatEntry;
typedef struct {
u64 value;
u8 width;
} DmntFrozenAddressValue;
typedef struct {
u64 address;
DmntFrozenAddressValue value;
} DmntFrozenAddressEntry;
Result dmntchtInitialize(void);
void dmntchtExit(void);
Service* dmntchtGetServiceSession(void);
Result dmntchtHasCheatProcess(bool *out);
Result dmntchtGetCheatProcessEvent(Event *event);
Result dmntchtGetCheatProcessMetadata(DmntCheatProcessMetadata *out_metadata);
Result dmntchtForceOpenCheatProcess(void);
Result dmntchtForceCloseCheatProcess(void);
Result dmntchtGetCheatProcessMappingCount(u64 *out_count);
Result dmntchtGetCheatProcessMappings(MemoryInfo *buffer, u64 max_count, u64 offset, u64 *out_count);
Result dmntchtReadCheatProcessMemory(u64 address, void *buffer, size_t size);
Result dmntchtWriteCheatProcessMemory(u64 address, const void *buffer, size_t size);
Result dmntchtQueryCheatProcessMemory(MemoryInfo *mem_info, u64 address);
Result dmntchtPauseCheatProcess(void);
Result dmntchtResumeCheatProcess(void);
Result dmntchtGetCheatCount(u64 *out_count);
Result dmntchtGetCheats(DmntCheatEntry *buffer, u64 max_count, u64 offset, u64 *out_count);
Result dmntchtGetCheatById(DmntCheatEntry *out_cheat, u32 cheat_id);
Result dmntchtToggleCheat(u32 cheat_id);
Result dmntchtAddCheat(DmntCheatDefinition *cheat, bool enabled, u32 *out_cheat_id);
Result dmntchtRemoveCheat(u32 cheat_id);
Result dmntchtReadStaticRegister(u64 *out, u8 which);
Result dmntchtWriteStaticRegister(u8 which, u64 value);
Result dmntchtResetStaticRegisters();
Result dmntchtSetMasterCheat(DmntCheatDefinition *cheat);
Result dmntchtGetFrozenAddressCount(u64 *out_count);
Result dmntchtGetFrozenAddresses(DmntFrozenAddressEntry *buffer, u64 max_count, u64 offset, u64 *out_count);
Result dmntchtGetFrozenAddress(DmntFrozenAddressEntry *out, u64 address);
Result dmntchtEnableFrozenAddress(u64 address, u64 width, u64 *out_value);
Result dmntchtDisableFrozenAddress(u64 address);
#ifdef __cplusplus
}
#endif
================================================
FILE: include/result.hpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon.
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <switch.h>
#include <string>
#define MODULE_EDIZONHB 337
#define MODULE_EDIZONSYS 338
namespace edz {
class EResult {
public:
constexpr EResult() : m_module(0), m_desc(0) {}
constexpr EResult(u32 module, u32 desc) : m_module(module), m_desc(desc) {}
constexpr EResult(Result result) : m_module(static_cast<u32>(R_MODULE(result))), m_desc(static_cast<u32>(R_DESCRIPTION(result))) {}
constexpr u32 getModule() {
return this->m_module;
}
constexpr u32 getDescription() {
return this->m_desc;
}
std::string getString() {
char buffer[0x20];
sprintf(buffer, "2%03d-%04d (0x%x)", this->getModule(), this->getDescription(), static_cast<u32>(*this));
return buffer;
}
constexpr bool operator==(EResult &other) {
return this->getDescription() == other.getDescription();
}
constexpr bool operator!=(EResult &other) {
return this->getDescription() != other.getDescription();
}
constexpr bool operator==(Result &other) {
return this->getDescription() == EResult(other).getDescription() && this->getDescription() == EResult(other).getModule();
}
constexpr bool operator!=(Result &other) {
return this->getDescription() != EResult(other).getDescription() || this->getDescription() != EResult(other).getModule();
}
constexpr EResult operator=(u32 &other) {
return Result(other);
}
constexpr EResult operator=(EResult &other) {
return EResult(other.getDescription());
}
constexpr EResult operator=(Result other) {
return EResult(static_cast<u32>(other));
}
constexpr operator u32() const {
return MAKERESULT(this->m_module, this->m_desc);
}
constexpr bool succeeded() {
return this->m_module == 0 && this->m_desc == 0;
}
constexpr bool failed() {
return !this->succeeded();
}
private:
const u32 m_module, m_desc;
};
template<typename T>
using EResultVal = std::pair<EResult, T>;
}
================================================
FILE: include/results.hpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon.
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <switch.h>
#include "result.hpp"
namespace edz {
#define EDZHBRES(desc) MAKERESULT(MODULE_EDIZONHB, desc)
#define EDZSYSRES(desc) MAKERESULT(MODULE_EDIZONSYS, desc)
/* Common error codes */
constexpr EResult ResultSuccess = MAKERESULT(0, 0);
/* Homebrew error codes */
constexpr EResult ResultEdzBorealisInitFailed = EDZHBRES(1);
constexpr EResult ResultEdzCurlInitFailed = EDZHBRES(2);
constexpr EResult ResultEdzNotYetImplemented = EDZHBRES(3);
constexpr EResult ResultEdzErrorDuringErrorHandling = EDZHBRES(4);
constexpr EResult ResultEdzNotFound = EDZHBRES(5);
constexpr EResult ResultEdzOperationFailed = EDZHBRES(6);
constexpr EResult ResultEdzSysmoduleAlreadyRunning = EDZHBRES(101);
constexpr EResult ResultEdzSysmoduleNotRunning = EDZHBRES(102);
constexpr EResult ResultEdzSysmoduleLaunchFailed = EDZHBRES(103);
constexpr EResult ResultEdzSysmoduleTerminationFailed = EDZHBRES(104);
constexpr EResult ResultEdzEditorNoConfigFound = EDZHBRES(201);
constexpr EResult ResultEdzEditorNoScriptFound = EDZHBRES(202);
constexpr EResult ResultEdzEditorConfigOutdated = EDZHBRES(203);
constexpr EResult ResultEdzEditorScriptSyntaxError = EDZHBRES(204);
constexpr EResult ResultEdzEditorTooManyRedirects = EDZHBRES(205);
constexpr EResult ResultEdzEditorAlreadyLoaded = EDZHBRES(206);
constexpr EResult ResultEdzEditorNotLoaded = EDZHBRES(207);
constexpr EResult ResultEdzEditorLoadFailed = EDZHBRES(208);
constexpr EResult ResultEdzEditorStoreFailed = EDZHBRES(209);
constexpr EResult ResultEdzScriptRuntimeError = EDZHBRES(301);
constexpr EResult ResultEdzScriptInvalidArgument = EDZHBRES(302);
constexpr EResult ResultEdzCurlError = EDZHBRES(401);
constexpr EResult ResultEdzAPIError = EDZHBRES(402);
constexpr EResult ResultEdzSaveNoSaveFS = EDZHBRES(501);
constexpr EResult ResultEdzSaveNoSuchBackup = EDZHBRES(502);
constexpr EResult ResultEdzSaveInvalidArgument = EDZHBRES(503);
constexpr EResult ResultEdzCheatParsingFailed = EDZHBRES(601);
constexpr EResult ResultEdzCheatServiceNotAvailable = EDZHBRES(602);
constexpr EResult ResultEdzMemoryReadFailed = EDZHBRES(701);
constexpr EResult ResultEdzMemoryOverflow = EDZHBRES(702);
constexpr EResult ResultEdzOutOfRange = EDZHBRES(703);
constexpr EResult ResultEdzNoValuesFound = EDZHBRES(704);
constexpr EResult ResultEdzInvalidOperation = EDZHBRES(705);
/* SysmoduEle error codes */
constexpr EResult ResultEdzAlreadyRegistered = EDZSYSRES(1);
constexpr EResult ResultEdzUnknownButtonID = EDZSYSRES(2);
constexpr EResult ResultEdzInvalidButtonCombination = EDZSYSRES(3);
constexpr EResult ResultEdzAttachFailed = EDZSYSRES(4);
constexpr EResult ResultEdzDetachFailed = EDZSYSRES(5);
constexpr EResult ResultEdzInvalidBuffer = EDZSYSRES(6);
constexpr EResult ResultEdzTCPInitFailed = EDZSYSRES(101);
constexpr EResult ResultEdzUSBInitFailed = EDZSYSRES(102);
constexpr EResult ResultEdzScreenInitFailed = EDZSYSRES(103);
constexpr EResult ResultEdzFontInitFailed = EDZSYSRES(104);
constexpr EResult ResultEdzSocketInitFailed = EDZSYSRES(201);
constexpr EResult ResultEdzAbortFailed = EDZSYSRES(301);
}
================================================
FILE: include/service_guard.h
================================================
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <switch/types.h>
#include <switch/result.h>
#include <switch/kernel/mutex.h>
#include <switch/sf/service.h>
#include <switch/services/sm.h>
typedef struct ServiceGuard {
Mutex mutex;
u32 refCount;
} ServiceGuard;
NX_INLINE bool serviceGuardBeginInit(ServiceGuard* g)
{
mutexLock(&g->mutex);
return (g->refCount++) == 0;
}
NX_INLINE Result serviceGuardEndInit(ServiceGuard* g, Result rc, void (*cleanupFunc)(void))
{
if (R_FAILED(rc)) {
cleanupFunc();
--g->refCount;
}
mutexUnlock(&g->mutex);
return rc;
}
NX_INLINE void serviceGuardExit(ServiceGuard* g, void (*cleanupFunc)(void))
{
mutexLock(&g->mutex);
if (g->refCount && (--g->refCount) == 0)
cleanupFunc();
mutexUnlock(&g->mutex);
}
#define NX_GENERATE_SERVICE_GUARD_PARAMS(name, _paramdecl, _parampass) \
\
static ServiceGuard g_##name##Guard; \
NX_INLINE Result _##name##Initialize _paramdecl; \
static void _##name##Cleanup(void); \
\
Result name##Initialize _paramdecl \
{ \
Result rc = 0; \
if (serviceGuardBeginInit(&g_##name##Guard)) \
rc = _##name##Initialize _parampass; \
return serviceGuardEndInit(&g_##name##Guard, rc, _##name##Cleanup); \
} \
\
void name##Exit(void) \
{ \
serviceGuardExit(&g_##name##Guard, _##name##Cleanup); \
}
#define NX_GENERATE_SERVICE_GUARD(name) NX_GENERATE_SERVICE_GUARD_PARAMS(name, (void), ())
#ifdef __cplusplus
}
#endif
================================================
FILE: include/utils.hpp
================================================
#pragma once
#include <string>
#include <sstream>
#include <iomanip>
#include <cstring>
/* C++ style sprintf */
template <typename ...Args>
std::string formatString(const std::string& format, Args && ...args) {
auto size = std::snprintf(nullptr, 0, format.c_str(), args...);
char output[size + 1];
std::memset(output, ' ', sizeof(output));
std::sprintf(output, format.c_str(), args...);
return output;
}
================================================
FILE: source/cheat.cpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon.
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#include "cheat.hpp"
#include <cstring>
namespace edz::cheat {
bool Succeeded(Result res){
return (R_MODULE(res) == 0 && R_DESCRIPTION(res) == 0);
}
/////// Cheat Type ///////
Cheat::Cheat(DmntCheatEntry cheatEntry) : m_name(cheatEntry.definition.readable_name), m_id(cheatEntry.cheat_id) {
}
std::string Cheat::getName() {
return this->m_name;
}
u32 Cheat::getID() {
return this->m_id;
}
bool Cheat::toggle() {
dmntchtToggleCheat(getID());
return isEnabled();
}
bool Cheat::setState(bool state) {
bool ret = state;
if (isEnabled() != state)
ret = this->toggle();
return ret;
}
bool Cheat::isEnabled() {
DmntCheatEntry cheatEntry;
if (!Succeeded(dmntchtGetCheatById(&cheatEntry, getID()))) {
return false;
}
return cheatEntry.enabled;
}
/////// FrozenAddress Type ///////
FrozenAddress::FrozenAddress(DmntFrozenAddressEntry frozenAddressEntry) : m_frozenAddressEntry(frozenAddressEntry), m_frozen(true) {
}
FrozenAddress::FrozenAddress(u64 address, u8 width, u64 value) : m_frozen(false) {
this->m_frozenAddressEntry.address = address;
this->m_frozenAddressEntry.value.width = width;
this->m_frozenAddressEntry.value.value = value;
}
FrozenAddress::FrozenAddress(u64 address, u8 width) : m_frozen(false) {
this->m_frozenAddressEntry.address = address;
this->m_frozenAddressEntry.value.width = width;
}
u64 FrozenAddress::getAddress() {
return this->m_frozenAddressEntry.address;
}
u8 FrozenAddress::getWidth() {
return this->m_frozenAddressEntry.value.width;
}
u64 FrozenAddress::getValue() {
return this->m_frozenAddressEntry.value.value;
}
u64 FrozenAddress::setValue(u64 value, u8 width) {
bool wasFrozen = isFrozen();
u64 newValue = 0;
dmntchtDisableFrozenAddress(getAddress());
dmntchtWriteCheatProcessMemory(getAddress(), &value, width);
if (wasFrozen) {
if (Succeeded(dmntchtEnableFrozenAddress(getAddress(), getWidth(), &newValue)))
return -1;
}
// Check if the value was set correctly
if (std::memcmp(&value, &newValue, width) == 0) {
this->m_frozenAddressEntry.value.value = newValue;
this->m_frozenAddressEntry.value.width = width;
return newValue;
}
return -1;
}
bool FrozenAddress::toggle() {
if (isFrozen()) {
if (Succeeded(dmntchtDisableFrozenAddress(getAddress())))
this->m_frozen = false;
}
else {
if (Succeeded(dmntchtEnableFrozenAddress(getAddress(), getWidth(), &m_frozenAddressEntry.value.value)))
this->m_frozen = true;
}
return isFrozen();
}
bool FrozenAddress::isFrozen() {
return this->m_frozen;
}
/////// FrozenAddress Type ///////
Result CheatManager::initialize() {
dmntchtInitialize();
return CheatManager::reload();
}
void CheatManager::exit() {
dmntchtExit();
for (auto &cheat : CheatManager::s_cheats)
delete cheat;
CheatManager::s_cheats.clear();
for (auto &frozenAddress : CheatManager::s_frozenAddresses)
delete frozenAddress;
CheatManager::s_frozenAddresses.clear();
}
bool CheatManager::isCheatServiceAvailable() {
static s8 running = -1;
if (running == -1){
Handle handle;
SmServiceName service_name = smEncodeName("dmnt:cht");
running = R_FAILED(smRegisterService(&handle, service_name, false, 1));
svcCloseHandle(handle);
if (!running)
smUnregisterService(service_name);
}
return !!running;
}
Result CheatManager::forceAttach() {
if (!CheatManager::isCheatServiceAvailable())
return ResultEdzCheatServiceNotAvailable;
uint64_t PID = 0;
for(int i = 0; i < 10; i++) {
if (R_SUCCEEDED(pmdmntGetApplicationProcessId(&PID))) {
return dmntchtForceOpenCheatProcess();
}
}
return ResultEdzAttachFailed;
}
bool CheatManager::hasCheatProcess() {
if (R_FAILED(CheatManager::forceAttach()))
return false;
bool hasCheatProcess;
dmntchtHasCheatProcess(&hasCheatProcess);
return hasCheatProcess;
}
u64 CheatManager::getTitleID() {
return CheatManager::s_processMetadata.title_id;
}
u64 CheatManager::getProcessID() {
return CheatManager::s_processMetadata.process_id;
}
u64 CheatManager::getBuildID() {
u64 buildid = 0;
std::memcpy(&buildid, CheatManager::s_processMetadata.main_nso_build_id, sizeof(u64));
return __builtin_bswap64(buildid);;
}
types::Region CheatManager::getBaseRegion() {
if (!CheatManager::isCheatServiceAvailable())
return { };
return types::Region{ CheatManager::s_processMetadata.address_space_extents.base, CheatManager::s_processMetadata.address_space_extents.size };
}
types::Region CheatManager::getHeapRegion() {
if (!CheatManager::isCheatServiceAvailable())
return { };
return types::Region{ CheatManager::s_processMetadata.heap_extents.base, CheatManager::s_processMetadata.heap_extents.size };
}
types::Region CheatManager::getMainRegion() {
if (!CheatManager::isCheatServiceAvailable())
return { };
return types::Region{ CheatManager::s_processMetadata.main_nso_extents.base, CheatManager::s_processMetadata.main_nso_extents.size };
}
types::Region CheatManager::getAliasRegion() {
if (!CheatManager::isCheatServiceAvailable())
return { };
return types::Region{ CheatManager::s_processMetadata.alias_extents.base, CheatManager::s_processMetadata.alias_extents.size };
}
/*EResultVal<std::string> CheatManager::getCheatFile() {
if (!CheatManager::isCheatServiceAvailable())
return { ResultEdzCheatServiceNotAvailable, "" };
std::string expectedFileName = hlp::toHexString(CheatManager::getBuildID()) + ".txt";
for (auto &[fileName, file] : hlp::Folder(EDIZON_CHEATS_DIR).getFiles()) {
if (strcasecmp(expectedFileName.c_str(), fileName.c_str()) == 0)
return { ResultSuccess, fileName };
}
return { ResultEdzNotFound, "" };
}
EResultVal<u32> CheatManager::addCheat(DmntCheatDefinition cheatDefinition, bool enabled) {
if (!CheatManager::isCheatServiceAvailable())
return { ResultEdzCheatServiceNotAvailable, 0 };
u32 cheatID = 0;
Result res;
if (res = dmntchtAddCheat(&cheatDefinition, enabled, &cheatID); !Succeeded(res))
return { res, 0 };
if (res = CheatManager::reload(); !Succeeded(res))
return { res, 0 };
return { res, cheatID };
}*/
Result CheatManager::removeCheat(u32 cheatID) {
if (!CheatManager::isCheatServiceAvailable())
return ResultEdzCheatServiceNotAvailable;
Result res;
if (res = dmntchtRemoveCheat(cheatID); !Succeeded(res))
return res;
return CheatManager::reload();
}
std::vector<Cheat*>& CheatManager::getCheats() {
return CheatManager::s_cheats;
}
std::vector<FrozenAddress*>& CheatManager::getFrozenAddresses() {
return CheatManager::s_frozenAddresses;
}
MemoryInfo CheatManager::queryMemory(u64 address) {
if (!CheatManager::isCheatServiceAvailable())
return { 0 };
MemoryInfo memInfo = { 0 };
dmntchtQueryCheatProcessMemory(&memInfo, address);
return memInfo;
}
std::vector<MemoryInfo> CheatManager::getMemoryRegions() {
if (!CheatManager::isCheatServiceAvailable())
return EMPTY_RESPONSE;
MemoryInfo memInfo = { 0 };
std::vector<MemoryInfo> memInfos;
u64 lastAddress = 0;
do {
lastAddress = memInfo.addr;
memInfo = queryMemory(memInfo.addr + memInfo.size);
memInfos.push_back(memInfo);
} while (lastAddress < (memInfo.addr + memInfo.size));
return memInfos;
}
Result CheatManager::readMemory(u64 address, void *buffer, size_t bufferSize) {
if (!CheatManager::isCheatServiceAvailable())
return ResultEdzCheatServiceNotAvailable;
return dmntchtReadCheatProcessMemory(address, buffer, bufferSize);
}
Result CheatManager::writeMemory(u64 address, const void *buffer, size_t bufferSize) {
if (!CheatManager::isCheatServiceAvailable())
return ResultEdzCheatServiceNotAvailable;
return dmntchtWriteCheatProcessMemory(address, buffer, bufferSize);
}
Result CheatManager::reload() {
if (!CheatManager::isCheatServiceAvailable())
return ResultEdzCheatServiceNotAvailable;
Result res;
if (R_FAILED(res = CheatManager::forceAttach()))
return res;
// Delete local cheats copy if there are any
for (auto &cheat : CheatManager::s_cheats)
delete cheat;
CheatManager::s_cheats.clear();
// Delete local frozen addresses copy if there are any
for (auto &frozenAddress : CheatManager::s_frozenAddresses)
delete frozenAddress;
CheatManager::s_frozenAddresses.clear();
// Get process metadata
if (res = dmntchtGetCheatProcessMetadata(&CheatManager::s_processMetadata); !Succeeded(res))
return res;
// Get all loaded cheats
u64 cheatCnt = 0;
if (res = dmntchtGetCheatCount(&cheatCnt); !Succeeded(res))
return res;
DmntCheatEntry *cheatEntries = new DmntCheatEntry[cheatCnt];
if (res = dmntchtGetCheats(cheatEntries, cheatCnt, 0, &cheatCnt); !Succeeded(res))
return res;
CheatManager::s_cheats.reserve(cheatCnt);
for (u32 i = 0; i < cheatCnt; i++)
CheatManager::s_cheats.push_back(new Cheat(cheatEntries[i]));
// Get all frozen addresses
u64 frozenAddressCnt = 0;
if (res = dmntchtGetFrozenAddressCount(&frozenAddressCnt); !Succeeded(res))
return res;
DmntFrozenAddressEntry frozenAddressEntries[frozenAddressCnt];
if (res = dmntchtGetFrozenAddresses(frozenAddressEntries, frozenAddressCnt, 0, &frozenAddressCnt); !Succeeded(res))
return res;
CheatManager::s_frozenAddresses.reserve(frozenAddressCnt);
for (auto &frozenAddressEntry : frozenAddressEntries)
CheatManager::s_frozenAddresses.push_back(new FrozenAddress(frozenAddressEntry));
return res;
}
}
================================================
FILE: source/dmntcht.c
================================================
/*
* Copyright (c) Atmosphère-NX
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define NX_SERVICE_ASSUME_NON_DOMAIN
#include "service_guard.h"
#include "dmntcht.h"
static Service g_dmntchtSrv;
NX_GENERATE_SERVICE_GUARD(dmntcht);
Result _dmntchtInitialize(void) {
return smGetService(&g_dmntchtSrv, "dmnt:cht");
}
void _dmntchtCleanup(void) {
serviceClose(&g_dmntchtSrv);
}
Service* dmntchtGetServiceSession(void) {
return &g_dmntchtSrv;
}
Result dmntchtHasCheatProcess(bool *out) {
u8 tmp;
Result rc = serviceDispatchOut(&g_dmntchtSrv, 65000, tmp);
if (R_SUCCEEDED(rc) && out) *out = tmp & 1;
return rc;
}
Result dmntchtGetCheatProcessEvent(Event *event) {
Handle evt_handle;
Result rc = serviceDispatch(&g_dmntchtSrv, 65001,
.out_handle_attrs = { SfOutHandleAttr_HipcCopy },
.out_handles = &evt_handle,
);
if (R_SUCCEEDED(rc)) {
eventLoadRemote(event, evt_handle, true);
}
return rc;
}
Result dmntchtGetCheatProcessMetadata(DmntCheatProcessMetadata *out_metadata) {
return serviceDispatchOut(&g_dmntchtSrv, 65002, *out_metadata);
}
static Result _dmntchtCmdVoid(Service* srv, u32 cmd_id) {
return serviceDispatch(srv, cmd_id);
}
Result dmntchtForceOpenCheatProcess(void) {
return _dmntchtCmdVoid(&g_dmntchtSrv, 65003);
}
Result dmntchtPauseCheatProcess(void) {
return _dmntchtCmdVoid(&g_dmntchtSrv, 65004);
}
Result dmntchtResumeCheatProcess(void) {
return _dmntchtCmdVoid(&g_dmntchtSrv, 65005);
}
Result dmntchtForceCloseCheatProcess(void) {
return _dmntchtCmdVoid(&g_dmntchtSrv, 65006);
}
static Result _dmntchtGetCount(u64 *out_count, u32 cmd_id) {
return serviceDispatchOut(&g_dmntchtSrv, cmd_id, *out_count);
}
static Result _dmntchtGetEntries(void *buffer, u64 buffer_size, u64 offset, u64 *out_count, u32 cmd_id) {
return serviceDispatchInOut(&g_dmntchtSrv, cmd_id, offset, *out_count,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcMapAlias },
.buffers = { { buffer, buffer_size } },
);
}
static Result _dmntchtCmdInU32NoOut(u32 in, u32 cmd_id) {
return serviceDispatchIn(&g_dmntchtSrv, cmd_id, in);
}
Result dmntchtGetCheatProcessMappingCount(u64 *out_count) {
return _dmntchtGetCount(out_count, 65100);
}
Result dmntchtGetCheatProcessMappings(MemoryInfo *buffer, u64 max_count, u64 offset, u64 *out_count) {
return _dmntchtGetEntries(buffer, sizeof(*buffer) * max_count, offset, out_count, 65101);
}
Result dmntchtReadCheatProcessMemory(u64 address, void *buffer, size_t size) {
const struct {
u64 address;
u64 size;
} in = { address, size };
return serviceDispatchIn(&g_dmntchtSrv, 65102, in,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcMapAlias },
.buffers = { { buffer, size } },
);
}
Result dmntchtWriteCheatProcessMemory(u64 address, const void *buffer, size_t size) {
const struct {
u64 address;
u64 size;
} in = { address, size };
return serviceDispatchIn(&g_dmntchtSrv, 65103, in,
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias },
.buffers = { { buffer, size } },
);
}
Result dmntchtQueryCheatProcessMemory(MemoryInfo *mem_info, u64 address){
return serviceDispatchInOut(&g_dmntchtSrv, 65104, address, *mem_info);
}
Result dmntchtGetCheatCount(u64 *out_count) {
return _dmntchtGetCount(out_count, 65200);
}
Result dmntchtGetCheats(DmntCheatEntry *buffer, u64 max_count, u64 offset, u64 *out_count) {
return _dmntchtGetEntries(buffer, sizeof(*buffer) * max_count, offset, out_count, 65201);
}
Result dmntchtGetCheatById(DmntCheatEntry *out, u32 cheat_id) {
return serviceDispatchIn(&g_dmntchtSrv, 65202, cheat_id,
.buffer_attrs = { SfBufferAttr_Out | SfBufferAttr_HipcMapAlias | SfBufferAttr_FixedSize },
.buffers = { { out, sizeof(*out) } },
);
}
Result dmntchtToggleCheat(u32 cheat_id) {
return _dmntchtCmdInU32NoOut(cheat_id, 65203);
}
Result dmntchtAddCheat(DmntCheatDefinition *cheat_def, bool enabled, u32 *out_cheat_id) {
const u8 in = enabled != 0;
return serviceDispatchInOut(&g_dmntchtSrv, 65204, in, *out_cheat_id,
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias | SfBufferAttr_FixedSize },
.buffers = { { cheat_def, sizeof(*cheat_def) } },
);
}
Result dmntchtRemoveCheat(u32 cheat_id) {
return _dmntchtCmdInU32NoOut(cheat_id, 65205);
}
Result dmntchtReadStaticRegister(u64 *out, u8 which) {
return serviceDispatchInOut(&g_dmntchtSrv, 65206, which, *out);
}
Result dmntchtWriteStaticRegister(u8 which, u64 value) {
const struct {
u64 which;
u64 value;
} in = { which, value };
return serviceDispatchIn(&g_dmntchtSrv, 65207, in);
}
Result dmntchtResetStaticRegisters() {
return _dmntchtCmdVoid(&g_dmntchtSrv, 65208);
}
Result dmntchtSetMasterCheat(DmntCheatDefinition *cheat_def) {
return serviceDispatch(&g_dmntchtSrv, 65209,
.buffer_attrs = { SfBufferAttr_In | SfBufferAttr_HipcMapAlias | SfBufferAttr_FixedSize },
.buffers = { { cheat_def, sizeof(*cheat_def) } },
);
}
Result dmntchtGetFrozenAddressCount(u64 *out_count) {
return _dmntchtGetCount(out_count, 65300);
}
Result dmntchtGetFrozenAddresses(DmntFrozenAddressEntry *buffer, u64 max_count, u64 offset, u64 *out_count) {
return _dmntchtGetEntries(buffer, sizeof(*buffer) * max_count, offset, out_count, 65301);
}
Result dmntchtGetFrozenAddress(DmntFrozenAddressEntry *out, u64 address) {
return serviceDispatchInOut(&g_dmntchtSrv, 65302, address, *out);
}
Result dmntchtEnableFrozenAddress(u64 address, u64 width, u64 *out_value) {
const struct {
u64 address;
u64 width;
} in = { address, width };
return serviceDispatchInOut(&g_dmntchtSrv, 65303, in, *out_value);
}
Result dmntchtDisableFrozenAddress(u64 address) {
return serviceDispatchIn(&g_dmntchtSrv, 65304, address);
}
================================================
FILE: source/main.cpp
================================================
/**
* Copyright (C) 2019 - 2020 WerWolv
*
* This file is part of EdiZon
*
* EdiZon is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* EdiZon is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EdiZon. If not, see <http://www.gnu.org/licenses/>.
*/
#define TESLA_INIT_IMPL
#include <tesla.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <switch.h>
#include <switch/nro.h>
#include <switch/nacp.h>
#include "utils.hpp"
#include "cheat.hpp"
#include <unistd.h>
#include <netinet/in.h>
class GuiCheats;
class GuiStats;
class GuiMain : public tsl::Gui {
public:
GuiMain() { }
~GuiMain() { }
virtual tsl::elm::Element* createUI() {
auto *rootFrame = new tsl::elm::HeaderOverlayFrame();
rootFrame->setHeader(new tsl::elm::CustomDrawer([this](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
renderer->drawString(APP_TITLE, false, 20, 50, 32, (tsl::defaultOverlayColor));
renderer->drawString(APP_VERSION, false, 20, 52+23, 15, (tsl::bannerVersionTextColor));
if (edz::cheat::CheatManager::getProcessID() != 0) {
renderer->drawString("Program ID", false, 150 +14, 40 -6, 15, (tsl::style::color::ColorText));
renderer->drawString("Build ID", false, 150 +14, 60 -6, 15, (tsl::style::color::ColorText));
renderer->drawString("Process ID", false, 150 +14, 80 -6, 15, (tsl::style::color::ColorText));
renderer->drawString(GuiMain::s_runningTitleIDString.c_str(), false, 250 +14, 40 -6, 15, (tsl::style::color::ColorHighlight));
renderer->drawString(GuiMain::s_runningBuildIDString.c_str(), false, 250 +14, 60 -6, 15, (tsl::style::color::ColorHighlight));
renderer->drawString(GuiMain::s_runningProcessIDString.c_str(), false, 250 +14, 80 -6, 15, (tsl::style::color::ColorHighlight));
}
}));
auto list = new tsl::elm::List();
if(edz::cheat::CheatManager::isCheatServiceAvailable()){
auto cheatsItem = new tsl::elm::ListItem("Cheats");
cheatsItem->setClickListener([](s64 keys) {
if (keys & KEY_A) {
tsl::changeTo<GuiCheats>("");
return true;
}
return false;
});
list->addItem(cheatsItem);
} else {
auto noDmntSvc = new tsl::elm::ListItem("Cheat Service Unavailable!");
list->addItem(noDmntSvc);
}
auto statsItem = new tsl::elm::ListItem("System Information");
statsItem->setClickListener([](s64 keys) {
if (keys & KEY_A) {
tsl::changeTo<GuiStats>();
return true;
}
return false;
});
list->addItem(statsItem);
//list->disableCaching();
rootFrame->setContent(list);
return rootFrame;
}
virtual void update() { }
public:
static inline std::string s_runningTitleIDString;
static inline std::string s_runningProcessIDString;
static inline std::string s_runningBuildIDString;
static inline bool b_firstRun = true;
};
class GuiCheats : public tsl::Gui {
public:
GuiCheats(std::string section) {
this->m_section = section;
}
~GuiCheats() { }
virtual tsl::elm::Element* createUI() override {
auto rootFrame = new tsl::elm::HeaderOverlayFrame(97);
bool setOnce = true; // for ensuring header sync with frame caching for header overlayframe
rootFrame->setHeader(new tsl::elm::CustomDrawer([this, &setOnce](tsl::gfx::Renderer *renderer, s32 x, s32 y, s32 w, s32 h) {
renderer->drawString(APP_TITLE, false, 20, 50, 32, (tsl::defaultOverlayColor));
//static bool runOnce = true;
if (setOnce) {
renderer->drawString(APP_VERSION, false, 20, 52+23, 15, (tsl::bannerVersionTextColor));
setOnce = false;
} else {
renderer->drawString("Cheats", false, 20, 52+23, 15, (tsl::bannerVersionTextColor));
}
if (edz::cheat::CheatManager::getProcessID() != 0) {
renderer->drawString("Program ID", false, 150 +14, 40 -6, 15, (tsl::style::color::ColorText));
renderer->drawString("Build ID", false, 150 +14, 60 -6, 15, (tsl::style::color::ColorText));
renderer->drawString("Process ID", false, 150 +14, 80 -6, 15, (tsl::style::color::ColorText));
renderer->drawString(GuiMain::s_runningTitleIDString.c_str(), false, 250 +14, 40 -6, 15, (tsl::style::color::ColorHighlight));
renderer->drawString(GuiMain::s_runningBuildIDString.c_str(), false, 250 +14, 60 -6, 15, (tsl::style::color::ColorHighlight));
renderer->drawString(GuiMain::s_runningProcessIDString.c_str(), false, 250 +14, 80 -6, 15, (tsl::style::color::ColorHighlight));
}
}));
if (edz::cheat::CheatManager::getCheats().size() == 0) {
auto warning = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, u16 x, u16 y, u16 w, u16 h){
renderer->drawString("\uE150", false, 180, 274, 90, (0xFFFF));
renderer->drawString("No Cheats loaded!", false, 110, 360, 25, (0xFFFF));
});
rootFrame->setContent(warning);
} else {
auto list = new tsl::elm::List();
std::string head = "Section: " + this->m_section;
if(m_section.length() > 0) list->addItem(new tsl::elm::CategoryHeader(head));
else list->addItem(new tsl::elm::CategoryHeader("Available cheats"));
bool skip = false, inSection = false, submenus = true;
std::string skipUntil = "";
for (auto &cheat : edz::cheat::CheatManager::getCheats()) {
if(cheat->getID() == 1 && cheat->getName().find("--DisableSubmenus--") != std::string::npos)
submenus = false;
if(submenus){
// Find section start and end
if(this->m_section.length() > 0 && !inSection && cheat->getName().find("--SectionStart:" + this->m_section + "--") == std::string::npos) continue;
else if(cheat->getName().find("--SectionStart:" + this->m_section + "--") != std::string::npos) { inSection = true; continue; }
else if(inSection && cheat->getName().find("--SectionEnd:" + this->m_section + "--") != std::string::npos) break;
// new section
if(!skip && cheat->getName().find("--SectionStart:") != std::string::npos){
//remove formatting
std::string name = cheat->getName();
replaceAll(name, "--", "");
replaceAll(name, "SectionStart:", "");
//create submenu button
auto cheatsSubmenu = new tsl::elm::ListItem(name);
cheatsSubmenu->setClickListener([name = name](s64 keys) {
if (keys & KEY_A) {
tsl::changeTo<GuiCheats>(name);
return true;
}
return false;
});
list->addItem(cheatsSubmenu);
this->m_numCheats++;
//skip over items in section
skip = true;
skipUntil = "--SectionEnd:" + name + "--";
}
// found end of child section
else if (skip && cheat->getName().compare(skipUntil) == 0){
skip = false;
skipUntil = "";
}
// items to add to section
else if(!skip && (inSection || this->m_section.length() < 1)) {
std::string cheatNameCheck = cheat->getName();
replaceAll(cheatNameCheck, ":ENABLED", "");
auto cheatToggleItem = new tsl::elm::ToggleListItem(/*formatString("%d:%s: %s", cheat->getID(), (cheat->isEnabled() ? "y" : "n"),*/ cheatNameCheck/*.c_str()).c_str()*/, cheat->isEnabled());
cheatToggleItem->setStateChangedListener([&cheat](bool state) { cheat->setState(state); });
this->m_cheatToggleItems.insert({cheat->getID(), cheatToggleItem});
list->addItem(cheatToggleItem);
this->m_numCheats++;
}
} else {
if(cheat->getName().find("--SectionStart:") != std::string::npos || cheat->getName().find("--SectionEnd:") != std::string::npos || cheat->getName().find("--DisableSubmenus--") != std::string::npos)
continue;
std::string cheatNameCheck = cheat->getName();
replaceAll(cheatNameCheck, ":ENABLED", "");
auto cheatToggleItem = new tsl::elm::ToggleListItem(cheatNameCheck, cheat->isEnabled());
cheatToggleItem->setStateChangedListener([&cheat](bool state) { cheat->setState(state); });
this->m_cheatToggleItems.insert({cheat->getID(), cheatToggleItem});
list->addItem(cheatToggleItem);
this->m_numCheats++;
}
}
//list->disableCaching();
// display if no cheats in submenu
if(this->m_numCheats < 1){
auto warning = new tsl::elm::CustomDrawer([](tsl::gfx::Renderer *renderer, u16 x, u16 y, u16 w, u16 h){
renderer->drawString("\uE150", false, 180, 250, 90, (0xFFFF));
renderer->drawString("No Cheats in Submenu!", false, 110, 340, 25, (0xFFFF));
});
rootFrame->setContent(warning);
} else rootFrame->setContent(list);
}
return rootFrame;
}
void replaceAll(std::string& str, const std::string& from, const std::string& to) {
if(from.empty())
return;
size_t start_pos = 0;
while((start_pos = str.find(from, start_pos)) != std::string::npos) {
str.replace(start_pos, from.length(), to);
start_pos += to.length();
}
}
virtual void update() override {
for (auto const& [cheatId, toggleElem] : this->m_cheatToggleItems)
for(auto &cheat : edz::cheat::CheatManager::getCheats())
if(cheat->getID() == cheatId)
toggleElem->setState(cheat->isEnabled());
}
private:
int m_numCheats = 0;
std::string m_section;
std::map<u32, tsl::elm::ToggleListItem*> m_cheatToggleItems;
};
class GuiStats : public tsl::Gui {
public:
GuiStats() {
if (hosversionAtLeast(8,0,0)) {
clkrstOpenSession(&this->m_clkrstSessionCpu, PcvModuleId_CpuBus, 3);
clkrstOpenSession(&this->m_clkrstSessionGpu, PcvModuleId_GPU, 3);
clkrstOpenSession(&this->m_clkrstSessionMem, PcvModuleId_EMC, 3);
}
tsl::hlp::doWithSmSession([this]{
nifmGetCurrentIpAddress(&this->m_ipAddress);
this->m_ipAddressString = formatString("%d.%d.%d.%d", this->m_ipAddress & 0xFF, (this->m_ipAddress >> 8) & 0xFF, (this->m_ipAddress >> 16) & 0xFF, (this->m_ipAddress >> 24) & 0xFF);
});
}
~GuiStats() {
if (hosversionAtLeast(8,0,0)) {
clkrstCloseSession(&this->m_clkrstSessionCpu);
clkrstCloseSession(&this->m_clkrstSessionGpu);
clkrstCloseSession(&this->m_clkrstSessionMem);
}
}
virtual tsl::elm::Element* createUI() override {
auto rootFrame = new tsl::elm::OverlayFrame(APP_TITLE, "System Information");
auto infos = new tsl::elm::CustomDrawer([this](tsl::gfx::Renderer *renderer, u16 x, u16 y, u16 w, u16 h){
renderer->drawString("CPU Temperature:", false, 63, 200, 18, (tsl::style::color::ColorText));
renderer->drawString("PCB Temperature:", false, 63, 230, 18, (tsl::style::color::ColorText));
renderer->drawRect(x, 243, w, 1, renderer->a(tsl::style::color::ColorFrame));
renderer->drawString("CPU Clock:", false, 63, 270, 18, (tsl::style::color::ColorText));
renderer->drawString("GPU Clock:", false, 63, 300, 18, (tsl::style::color::ColorText));
renderer->drawString("MEM Clock:", false, 63, 330, 18, (tsl::style::color::ColorText));
renderer->drawRect(x, 343, w, 1, renderer->a(tsl::style::color::ColorFrame));
renderer->drawString("Local IP:", false, 63, 370, 18, (tsl::style::color::ColorText));
// Draw temperatures and battery percentage
static char PCB_temperatureStr[10];
static char SOC_temperatureStr[10];
// Use temporary float variables to receive the temperature values
static float tempSOC = 0.0f;
static float tempPCB = 0.0f;
ult::ReadSocTemperature(&tempSOC, false);
ult::ReadPcbTemperature(&tempPCB, false);
snprintf(SOC_temperatureStr, sizeof(SOC_temperatureStr) - 1, "%.1f °C", static_cast<double>(tempSOC));
snprintf(PCB_temperatureStr, sizeof(PCB_temperatureStr) - 1, "%.1f °C", static_cast<double>(tempPCB));
renderer->drawString(SOC_temperatureStr, false, 258, 200, 18, (tsl::style::color::ColorHighlight));
renderer->drawString(PCB_temperatureStr, false, 258, 230, 18, (tsl::style::color::ColorHighlight));
static u32 cpuClock = 0, gpuClock = 0, memClock = 0;
if (hosversionAtLeast(8,0,0)) {
clkrstGetClockRate(&this->m_clkrstSessionCpu, &cpuClock);
clkrstGetClockRate(&this->m_clkrstSessionGpu, &gpuClock);
clkrstGetClockRate(&this->m_clkrstSessionMem, &memClock);
} else {
pcvGetClockRate(PcvModule_CpuBus, &cpuClock);
pcvGetClockRate(PcvModule_GPU, &gpuClock);
pcvGetClockRate(PcvModule_EMC, &memClock);
}
renderer->drawString(formatString("%.01f MHz", cpuClock / 1'000'000.0F).c_str(), false, 258, 270, 18, (tsl::style::color::ColorHighlight));
renderer->drawString(formatString("%.01f MHz", gpuClock / 1'000'000.0F).c_str(), false, 258, 300, 18, (tsl::style::color::ColorHighlight));
renderer->drawString(formatString("%.01f MHz", memClock / 1'000'000.0F).c_str(), false, 258, 330, 18, (tsl::style::color::ColorHighlight));
if (this->m_ipAddressString == "0.0.0.0")
renderer->drawString("Offline", false, 258, 370, 18, (tsl::style::color::ColorHighlight));
else
renderer->drawString(this->m_ipAddressString.c_str(), false, 258, 370, 18, (tsl::style::color::ColorHighlight));
if(hosversionAtLeast(15,0,0)){
NifmInternetConnectionType conType;
u32 wifiStrength;
NifmInternetConnectionStatus conStatus;
nifmGetInternetConnectionStatus(&conType, &wifiStrength, &conStatus);
renderer->drawString("Connection:", false, 63, 400, 18, (tsl::style::color::ColorText));
if(conStatus == NifmInternetConnectionStatus_Connected && conType == NifmInternetConnectionType_WiFi) {
std::string wifiStrengthStr = "(Strong)";
tsl::Color color = tsl::Color(0x0, 0xF, 0x0, 0xF);
if(wifiStrength == 2){
wifiStrengthStr = "(Fair)";
color = tsl::Color(0xE, 0xE, 0x2, 0xF);
} else if(wifiStrength <= 1){
wifiStrengthStr = "(Poor)";
color = tsl::Color(0xF, 0x0, 0x0, 0xF);
}
renderer->drawString("WiFi", false, 258, 400, 18, (tsl::style::color::ColorHighlight));
renderer->drawString(wifiStrengthStr.c_str(), false, 303, 400, 18, (color));
} else if(conStatus == NifmInternetConnectionStatus_Connected && conType == NifmInternetConnectionType_Ethernet){
renderer->drawString("Ethernet", false, 258, 400, 18, (tsl::style::color::ColorHighlight));
} else {
renderer->drawString("Disconnected", false, 258, 400, 18, (tsl::style::color::ColorHighlight));
}
} else {
s32 signalStrength = 0;
wlaninfGetRSSI(&signalStrength);
renderer->drawString("WiFi Signal:", false, 63, 400, 18, (tsl::style::color::ColorText));
renderer->drawString(formatString("%d dBm", signalStrength).c_str(), false, 258, 400, 18, (tsl::style::color::ColorHighlight));
}
renderer->drawString("Credits:", false, 63, 600, 18, (tsl::style::color::ColorText));
renderer->drawString(APP_AUTHOR, false, 75, 630, 18, (tsl::style::color::ColorHighlight));
});
rootFrame->setContent(infos);
return rootFrame;
}
virtual void update() { }
private:
ClkrstSession m_clkrstSessionCpu, m_clkrstSessionGpu, m_clkrstSessionMem;
u32 m_ipAddress;
std::string m_ipAddressString;
};
class EdiZonOverlay : public tsl::Overlay {
public:
EdiZonOverlay() { }
~EdiZonOverlay() { }
void initServices() override {
// GDB Check & Saved Cheat Enabling
if(edz::cheat::CheatManager::isCheatServiceAvailable()){
edz::cheat::CheatManager::initialize();
for (auto &cheat : edz::cheat::CheatManager::getCheats()) {
if(cheat->getName().find(":ENABLED") != std::string::npos){
cheat->setState(true);
}
}
}
clkrstInitialize();
pcvInitialize();
i2cInitialize();
nifmInitialize(NifmServiceType_User);
}
virtual void exitServices() override {
if (edz::cheat::CheatManager::isCheatServiceAvailable())
edz::cheat::CheatManager::exit();
nifmExit();
i2cExit();
wlaninfExit();
nifmExit();
clkrstExit();
pcvExit();
}
virtual void onShow() override {
edz::cheat::CheatManager::reload();
GuiMain::s_runningTitleIDString = formatString("%016lX", edz::cheat::CheatManager::getTitleID());
GuiMain::s_runningBuildIDString = formatString("%016lX", edz::cheat::CheatManager::getBuildID());
GuiMain::s_runningProcessIDString = formatString("%lu", edz::cheat::CheatManager::getProcessID());
}
std::unique_ptr<tsl::Gui> loadInitialGui() override {
return initially<GuiMain>();
}
};
int main(int argc, char **argv) {
return tsl::loop<EdiZonOverlay>(argc, argv);
}
gitextract__rpiy0qz/
├── .github/
│ └── workflows/
│ └── main.yml
├── .gitignore
├── .gitmodules
├── Makefile
├── README.md
├── include/
│ ├── cheat.hpp
│ ├── cheat_engine_types.hpp
│ ├── dmntcht.h
│ ├── result.hpp
│ ├── results.hpp
│ ├── service_guard.h
│ └── utils.hpp
└── source/
├── cheat.cpp
├── dmntcht.c
└── main.cpp
SYMBOL INDEX (96 symbols across 10 files)
FILE: include/cheat.hpp
type edz::cheat (line 30) | namespace edz::cheat {
class Cheat (line 38) | class Cheat {
class FrozenAddress (line 54) | class FrozenAddress {
class CheatManager (line 74) | class CheatManager {
FILE: include/cheat_engine_types.hpp
type edz::cheat::types (line 25) | namespace edz::cheat::types {
type Region (line 27) | struct Region {
method contains (line 31) | bool contains(u64 addr) {
type Signedness (line 36) | enum class Signedness {
class Pattern (line 41) | class Pattern {
method Pattern (line 43) | Pattern() : m_pattern(nullptr), m_size(0) { }
method Pattern (line 44) | Pattern(u8 *pattern, std::size_t size) : m_pattern(pattern), m_size(...
method setPattern (line 46) | void setPattern(u8 *pattern) { this->m_pattern = pattern; }
method setSize (line 47) | void setSize(std::size_t size) { this->m_size = size; }
method setSignedness (line 48) | void setSignedness(Signedness signedness) { this->m_signedness = sig...
FILE: include/dmntcht.h
type DmntMemoryRegionExtents (line 24) | typedef struct {
type DmntCheatProcessMetadata (line 29) | typedef struct {
type DmntCheatDefinition (line 39) | typedef struct {
type DmntCheatEntry (line 45) | typedef struct {
type DmntFrozenAddressValue (line 51) | typedef struct {
type DmntFrozenAddressEntry (line 56) | typedef struct {
FILE: include/result.hpp
type edz (line 28) | namespace edz {
class EResult (line 30) | class EResult {
method EResult (line 32) | constexpr EResult() : m_module(0), m_desc(0) {}
method EResult (line 34) | constexpr EResult(u32 module, u32 desc) : m_module(module), m_desc(d...
method EResult (line 36) | constexpr EResult(Result result) : m_module(static_cast<u32>(R_MODUL...
method u32 (line 38) | constexpr u32 getModule() {
method u32 (line 42) | constexpr u32 getDescription() {
method getString (line 46) | std::string getString() {
method EResult (line 70) | constexpr EResult operator=(u32 &other) {
method EResult (line 74) | constexpr EResult operator=(EResult &other) {
method EResult (line 78) | constexpr EResult operator=(Result other) {
method succeeded (line 86) | constexpr bool succeeded() {
method failed (line 90) | constexpr bool failed() {
FILE: include/results.hpp
type edz (line 25) | namespace edz {
FILE: include/service_guard.h
type ServiceGuard (line 13) | typedef struct ServiceGuard {
function NX_INLINE (line 18) | NX_INLINE bool serviceGuardBeginInit(ServiceGuard* g)
function NX_INLINE (line 24) | NX_INLINE Result serviceGuardEndInit(ServiceGuard* g, Result rc, void (*...
function NX_INLINE (line 34) | NX_INLINE void serviceGuardExit(ServiceGuard* g, void (*cleanupFunc)(void))
FILE: include/utils.hpp
function formatString (line 10) | std::string formatString(const std::string& format, Args && ...args) {
FILE: source/cheat.cpp
type edz::cheat (line 24) | namespace edz::cheat {
function Succeeded (line 26) | bool Succeeded(Result res){
function u32 (line 40) | u32 Cheat::getID() {
function u64 (line 87) | u64 FrozenAddress::getAddress() {
function u8 (line 91) | u8 FrozenAddress::getWidth() {
function u64 (line 95) | u64 FrozenAddress::getValue() {
function u64 (line 99) | u64 FrozenAddress::setValue(u64 value, u8 width) {
function Result (line 144) | Result CheatManager::initialize() {
function Result (line 176) | Result CheatManager::forceAttach() {
function u64 (line 201) | u64 CheatManager::getTitleID() {
function u64 (line 205) | u64 CheatManager::getProcessID() {
function u64 (line 209) | u64 CheatManager::getBuildID() {
function Result (line 278) | Result CheatManager::removeCheat(u32 cheatID) {
function MemoryInfo (line 300) | MemoryInfo CheatManager::queryMemory(u64 address) {
function Result (line 331) | Result CheatManager::readMemory(u64 address, void *buffer, size_t buff...
function Result (line 338) | Result CheatManager::writeMemory(u64 address, const void *buffer, size...
function Result (line 345) | Result CheatManager::reload() {
FILE: source/dmntcht.c
function Result (line 24) | Result _dmntchtInitialize(void) {
function _dmntchtCleanup (line 28) | void _dmntchtCleanup(void) {
function Service (line 32) | Service* dmntchtGetServiceSession(void) {
function Result (line 36) | Result dmntchtHasCheatProcess(bool *out) {
function Result (line 61) | static Result _dmntchtCmdVoid(Service* srv, u32 cmd_id) {
function Result (line 65) | Result dmntchtForceOpenCheatProcess(void) {
function Result (line 69) | Result dmntchtPauseCheatProcess(void) {
function Result (line 73) | Result dmntchtResumeCheatProcess(void) {
function Result (line 77) | Result dmntchtForceCloseCheatProcess(void) {
function Result (line 81) | static Result _dmntchtGetCount(u64 *out_count, u32 cmd_id) {
function Result (line 96) | Result dmntchtGetCheatProcessMappingCount(u64 *out_count) {
function Result (line 100) | Result dmntchtGetCheatProcessMappings(MemoryInfo *buffer, u64 max_count,...
function Result (line 130) | Result dmntchtGetCheatCount(u64 *out_count) {
function Result (line 134) | Result dmntchtGetCheats(DmntCheatEntry *buffer, u64 max_count, u64 offse...
function Result (line 161) | Result dmntchtReadStaticRegister(u64 *out, u8 which) {
function Result (line 165) | Result dmntchtWriteStaticRegister(u8 which, u64 value) {
function Result (line 174) | Result dmntchtResetStaticRegisters() {
function Result (line 189) | Result dmntchtGetFrozenAddresses(DmntFrozenAddressEntry *buffer, u64 max...
function Result (line 193) | Result dmntchtGetFrozenAddress(DmntFrozenAddressEntry *out, u64 address) {
function Result (line 197) | Result dmntchtEnableFrozenAddress(u64 address, u64 width, u64 *out_value) {
function Result (line 205) | Result dmntchtDisableFrozenAddress(u64 address) {
FILE: source/main.cpp
class GuiCheats (line 38) | class GuiCheats
method GuiCheats (line 108) | GuiCheats(std::string section) {
method replaceAll (line 241) | void replaceAll(std::string& str, const std::string& from, const std::...
method update (line 251) | virtual void update() override {
class GuiStats (line 40) | class GuiStats
method GuiStats (line 266) | GuiStats() {
method update (line 380) | virtual void update() { }
class GuiMain (line 42) | class GuiMain : public tsl::Gui {
method GuiMain (line 44) | GuiMain() { }
method update (line 96) | virtual void update() { }
class GuiCheats (line 106) | class GuiCheats : public tsl::Gui {
method GuiCheats (line 108) | GuiCheats(std::string section) {
method replaceAll (line 241) | void replaceAll(std::string& str, const std::string& from, const std::...
method update (line 251) | virtual void update() override {
class GuiStats (line 264) | class GuiStats : public tsl::Gui {
method GuiStats (line 266) | GuiStats() {
method update (line 380) | virtual void update() { }
class EdiZonOverlay (line 391) | class EdiZonOverlay : public tsl::Overlay {
method EdiZonOverlay (line 393) | EdiZonOverlay() { }
method initServices (line 396) | void initServices() override {
method exitServices (line 413) | virtual void exitServices() override {
method onShow (line 425) | virtual void onShow() override {
method loadInitialGui (line 432) | std::unique_ptr<tsl::Gui> loadInitialGui() override {
function main (line 440) | int main(int argc, char **argv) {
Condensed preview — 15 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (72K chars).
[
{
"path": ".github/workflows/main.yml",
"chars": 2355,
"preview": "name: Release\n\non:\n workflow_dispatch:\n inputs:\n branch:\n description: 'Branch to run on'\n requir"
},
{
"path": ".gitignore",
"chars": 191,
"preview": "###################\n#.gitignore #\n###################\n\n#\n# Visual Studio Code\n#\n.settings/\n.classpath\n.factorypath"
},
{
"path": ".gitmodules",
"chars": 109,
"preview": "[submodule \"libs/libultrahand\"]\n\tpath = libs/libultrahand\n\turl = https://github.com/ppkantorski/libultrahand\n"
},
{
"path": "Makefile",
"chars": 7403,
"preview": "#---------------------------------------------------------------------------------\n.SUFFIXES:\n#-------------------------"
},
{
"path": "README.md",
"chars": 1567,
"preview": "# EdiZon-Overlay []()\n"
},
{
"path": "include/cheat.hpp",
"chars": 3134,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon.\n * \n * EdiZon is free software: you can red"
},
{
"path": "include/cheat_engine_types.hpp",
"chars": 3680,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon.\n * \n * EdiZon is free software: you can red"
},
{
"path": "include/dmntcht.h",
"chars": 3291,
"preview": "/*\n * Copyright (c) Atmosphère-NX\n *\n * This program is free software; you can redistribute it and/or modify it\n * under"
},
{
"path": "include/result.hpp",
"chars": 2975,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon.\n * \n * EdiZon is free software: you can red"
},
{
"path": "include/results.hpp",
"chars": 4613,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon.\n * \n * EdiZon is free software: you can red"
},
{
"path": "include/service_guard.h",
"chars": 1479,
"preview": "#pragma once\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#include <switch/types.h>\n#include <switch/result.h>\n#include <swi"
},
{
"path": "include/utils.hpp",
"chars": 426,
"preview": "#pragma once\n\n#include <string>\n#include <sstream>\n#include <iomanip>\n#include <cstring>\n\n/* C++ style sprintf */\ntempla"
},
{
"path": "source/cheat.cpp",
"chars": 11858,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon.\n * \n * EdiZon is free software: you can red"
},
{
"path": "source/dmntcht.c",
"chars": 6517,
"preview": "/*\n * Copyright (c) Atmosphère-NX\n *\n * This program is free software; you can redistribute it and/or modify it\n * under"
},
{
"path": "source/main.cpp",
"chars": 19615,
"preview": "/**\n * Copyright (C) 2019 - 2020 WerWolv\n * \n * This file is part of EdiZon\n * \n * EdiZon is free software: you can redi"
}
]
About this extraction
This page contains the full source code of the proferabg/EdiZon-Overlay GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 15 files (67.6 KB), approximately 18.1k tokens, and a symbol index with 96 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.