Skip to content

Commit d6ce5f6

Browse files
committed
Moved clear_DC_IC_Cache to commonfunctions.cpp
1 parent 2b969f7 commit d6ce5f6

File tree

6 files changed

+12
-28
lines changed

6 files changed

+12
-28
lines changed

ttyd-tools/rel/include/clearcache.h

Lines changed: 0 additions & 9 deletions
This file was deleted.

ttyd-tools/rel/include/commonfunctions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ bool checkIfBadgeEquipped(int16_t badge);
4242
void recheckJumpAndHammerLevels();
4343
uint32_t getCurrentPitFloor();
4444
void clearGSWFsRange(uint32_t lowerBound, uint32_t upperBound);
45+
void clear_DC_IC_Cache(void *ptr, uint32_t size);
4546
bool checkIfPointerIsValid(void *ptr);
4647
void *getLastPointerFromPath(void *address, int32_t *offset, uint32_t offsetAmount);;
4748

ttyd-tools/rel/include/patch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include "clearcache.h"
3+
#include "commonfunctions.h"
44

55
#include <cstdint>
66

@@ -17,7 +17,7 @@ Func hookFunction(Func function, Dest destination)
1717

1818
// Original instruction
1919
trampoline[0] = instructions[0];
20-
clearcache::clear_DC_IC_Cache(&trampoline[0], sizeof(uint32_t));
20+
clear_DC_IC_Cache(&trampoline[0], sizeof(uint32_t));
2121

2222
// Branch to original function past hook
2323
writeBranch(&trampoline[1], &instructions[1]);

ttyd-tools/rel/source/clearcache.cpp

Lines changed: 0 additions & 15 deletions
This file was deleted.

ttyd-tools/rel/source/commonfunctions.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "commonfunctions.h"
22
#include "global.h"
33

4+
#include <gc/OSCache.h>
45
#include <ttyd/system.h>
56
#include <ttyd/seqdrv.h>
67
#include <ttyd/battle.h>
@@ -284,6 +285,12 @@ void clearGSWFsRange(uint32_t lowerBound, uint32_t upperBound)
284285
}
285286
}
286287

288+
void clear_DC_IC_Cache(void *ptr, uint32_t size)
289+
{
290+
gc::OSCache::DCFlushRange(ptr, size);
291+
gc::OSCache::ICInvalidateRange(ptr, size);
292+
}
293+
287294
bool checkIfPointerIsValid(void *ptr)
288295
{
289296
uint32_t ptrRaw = reinterpret_cast<uint32_t>(ptr);

ttyd-tools/rel/source/patch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#include "patch.h"
2-
#include "clearcache.h"
2+
#include "commonfunctions.h"
33

44
#include <cstdint>
55

@@ -14,7 +14,7 @@ void writeBranch(void *ptr, void *destination)
1414
uint32_t *p = reinterpret_cast<uint32_t *>(ptr);
1515
*p = value;
1616

17-
clearcache::clear_DC_IC_Cache(ptr, sizeof(uint32_t));
17+
clear_DC_IC_Cache(ptr, sizeof(uint32_t));
1818
}
1919

2020
}

0 commit comments

Comments
 (0)