Skip to content

Commit

Permalink
change led behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvita committed Mar 10, 2021
1 parent e4db580 commit 8ae25de
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ include $(DEVKITPRO)/libnx/switch_rules
#---------------------------------------------------------------------------------
VERSION_MAJOR := 3
VERSION_MINOR := 8
VERSION_MICRO := 11preview
VERSION_MICRO := 11
NIGHTLY :=

APP_TITLE := EdiZon SE
Expand Down
24 changes: 12 additions & 12 deletions source/guis/gui_cheats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@ void GuiCheats::MTsearchMemoryAddressesPrimary(Debugger *debugger, searchValue_t
continue;
else if ( (meminfo.perm & Perm_Rw) != Perm_Rw) //searchRegion == SEARCH_REGION_RAM &&
continue;
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
u64 offset = 0;
u64 bufferSize = MAX_BUFFER_SIZE; // consider to increase from 10k to 1M (not a big problem)
Expand Down Expand Up @@ -5700,7 +5700,7 @@ void GuiCheats::searchMemoryAddressesPrimary(Debugger *debugger, searchValue_t s
// printf("%s%lx", ", meminfo.perm, ", meminfo.perm);
// printf("%s%lx", ", meminfo.device_refcount, ", meminfo.device_refcount);
// printf("%s%lx\n", ", meminfo.ipc_refcount, ", meminfo.ipc_refcount);
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;

u64 offset = 0;
Expand Down Expand Up @@ -6021,7 +6021,7 @@ void GuiCheats::searchMemoryAddressesSecondary(Debugger *debugger, searchValue_t

if (i % 50000 == 0)
{
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
}

Expand Down Expand Up @@ -6316,7 +6316,7 @@ void GuiCheats::searchMemoryAddressesSecondary2(Debugger *debugger, searchValue_

if (i % 50000 == 0)
{
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
}

Expand Down Expand Up @@ -6526,7 +6526,7 @@ void GuiCheats::searchMemoryValuesPrimary(Debugger *debugger, searchType_t searc
else if (searchRegion == SEARCH_REGION_RAM && (meminfo.perm & Perm_Rw) != Perm_Rw)
continue;

setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
// printf("%s%lx\n", "meminfo.size ", meminfo.size);
// printf("%s%lx\n", "meminfo.addr ", meminfo.addr);
Expand Down Expand Up @@ -6603,7 +6603,7 @@ void GuiCheats::searchMemoryValuesSecondary(Debugger *debugger, searchType_t sea
else if (searchRegion == SEARCH_REGION_RAM && (meminfo.perm & Perm_Rw) != Perm_Rw)
continue;

setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
printf("%s%lx\n", "meminfo.size ", meminfo.size);
printf("%s%lx\n", "meminfo.addr ", meminfo.addr);
Expand All @@ -6620,7 +6620,7 @@ void GuiCheats::searchMemoryValuesSecondary(Debugger *debugger, searchType_t sea

while (offset < meminfo.size)
{
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;

if (meminfo.size - offset < bufferSize)
Expand Down Expand Up @@ -6961,7 +6961,7 @@ void GuiCheats::searchMemoryValuesTertiary(Debugger *debugger, searchValue_t sea

if (i % 10000 == 0)
{
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
}

Expand Down Expand Up @@ -9115,7 +9115,7 @@ void GuiCheats::PCdump()
{
if (meminfo.type != MemType_Heap && meminfo.type != MemType_CodeWritable && meminfo.type != MemType_CodeMutable)
continue;
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
u64 offset = 0;
u64 bufferSize = MAX_BUFFER_SIZE; // consider to increase from 10k to 1M (not a big problem)
Expand Down Expand Up @@ -9209,7 +9209,7 @@ void GuiCheats::searchMemoryAddressesPrimary2(Debugger *debugger, searchValue_t
else if (searchRegion == SEARCH_REGION_RAM && (meminfo.perm & Perm_Rw) != Perm_Rw)
continue;

setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
printf("meminfo.addr,%lx,meminfo.size,%lx,meminfo.type,%d,", meminfo.addr, meminfo.size, meminfo.type);
PCAttr->addData((u8 *)&meminfo, sizeof(MemoryInfo));
Expand Down Expand Up @@ -9391,7 +9391,7 @@ void GuiCheats::prep_pointersearch(Debugger *debugger, std::vector<MemoryInfo> m
{
if (((meminfo.type != MemType_Heap && meminfo.type != MemType_CodeWritable && meminfo.type != MemType_CodeMutable)) || !((meminfo.addr < m_heapEnd && meminfo.addr >= m_heapBaseAddr) || (meminfo.addr < m_mainend && meminfo.addr >= m_mainBaseAddr)))
continue;
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
printf("meminfo.addr,%lx,meminfo.size,%lx,meminfo.type,%d,", meminfo.addr, meminfo.size, meminfo.type);
PCAttr->addData((u8 *)&meminfo, sizeof(MemoryInfo));
Expand Down Expand Up @@ -9614,7 +9614,7 @@ void GuiCheats::refresh_fromto()
{
while (Foffset < m_PC_Dump->size())
{
setLedState(ledOn);
setLedState(true);
ledOn = !ledOn;
if (m_PC_Dump->size() - Foffset < FbufferSize)
FbufferSize = m_PC_Dump->size() - Foffset;
Expand Down
26 changes: 19 additions & 7 deletions source/helpers/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,30 @@ void ledInit() {
memset(&g_patternOn, 0x00, sizeof(HidsysNotificationLedPattern));
memset(&g_patternOff, 0x00, sizeof(HidsysNotificationLedPattern));

g_patternOn.baseMiniCycleDuration = 0x0F;
g_patternOn.startIntensity = 0x0F;
g_patternOn.miniCycles[0].ledIntensity = 0x0F;
g_patternOn.miniCycles[0].transitionSteps = 0x0F;
g_patternOn.miniCycles[0].finalStepDuration = 0x0F;
// g_patternOn.baseMiniCycleDuration = 0x0F;
// g_patternOn.startIntensity = 0x0F;
// g_patternOn.miniCycles[0].ledIntensity = 0x0F;
// g_patternOn.miniCycles[0].transitionSteps = 0x0F;
// g_patternOn.miniCycles[0].finalStepDuration = 0x0F;
g_patternOn.baseMiniCycleDuration = 0x8; // 100ms.
g_patternOn.totalMiniCycles = 0x2; // 3 mini cycles. Last one 12.5ms.
g_patternOn.totalFullCycles = 0x0; // Repeat forever.
g_patternOn.startIntensity = 0x2; // 13%.
g_patternOn.miniCycles[0].ledIntensity = 0xF; // 100%.
g_patternOn.miniCycles[0].transitionSteps = 0xF; // 15 steps. Transition time 1.5s.
g_patternOn.miniCycles[0].finalStepDuration = 0x0; // Forced 12.5ms.
g_patternOn.miniCycles[1].ledIntensity = 0x2; // 13%.
g_patternOn.miniCycles[1].transitionSteps = 0xF; // 15 steps. Transition time 1.5s.
g_patternOn.miniCycles[1].finalStepDuration = 0x0; // Forced 12.5ms.
}

void setLedState(bool state) {
for(u8 i = 0; i < g_uniquePadCnt; i++)
hidsysSetNotificationLedPattern(state ? &g_patternOn : &g_patternOff, g_uniquePadIds[i]);
// hidsysSetNotificationLedPattern(state ? &g_patternOn : &g_patternOff, g_uniquePadIds[i]);
hidsysSetNotificationLedPatternWithTimeout(state ? &g_patternOn : &g_patternOff, g_uniquePadIds[i], 50000000000ULL);
for (u8 i = 0; i < total_entries; i++)
hidsysSetNotificationLedPattern(state ? &g_patternOn : &g_patternOff, unique_pad_ids[i]);
// hidsysSetNotificationLedPattern(state ? &g_patternOn : &g_patternOff, unique_pad_ids[i]);
hidsysSetNotificationLedPatternWithTimeout(state ? &g_patternOn : &g_patternOff, unique_pad_ids[i], 50000000000ULL);
}

void overclockSystem(bool enable) {
Expand Down

0 comments on commit 8ae25de

Please sign in to comment.