Skip to content

Commit

Permalink
Merge pull request #141 from bloppers/phasemem
Browse files Browse the repository at this point in the history
P2/phasemem.c: Match SetPhase, ClearPhase
  • Loading branch information
TheOnlyZac authored Jan 4, 2025
2 parents fd491c4 + 87a4fcf commit 84ec24c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 3 additions & 2 deletions config/sly1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ segments:
#- [0x, asm, P2/ms]
#- [0x, asm, P2/murray]
- [0x917e0, asm, P2/path]
- [0x92e70, asm, P2/phasemem]
- [0x92e70, c, P2/phasemem]
- [0x92ebc, asm, P2/phasemem_padding] # 4 bytes padding to align P2/phasemem
- [0x92ec0, asm, P2/pipe]
- [0x93068, asm, P2/pnt]
- [0x931a8, c, P2/po]
Expand Down Expand Up @@ -403,7 +404,7 @@ segments:
#- [0x, data, P2/murray]
#- [0x, data, P2/path]

- [0x16aba4, data, P2/phasemem]
- [0x16aba4, .data, P2/phasemem]
- [0x16aba8, data, P2/pipe]
- [0x16abac, data]

Expand Down
12 changes: 11 additions & 1 deletion include/phasemem.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

#include "common.h"

// ...
enum PHASE {
PHASE_Nil = -1,
PHASE_None = 0x0,
PHASE_Startup = 0x1,
PHASE_Load = 0x2,
PHASE_Main = 0x3,
PHASE_Mpeg = 0x4,
PHASE_Max = 0x5
};

extern PHASE g_phase;

#endif // PHASEMEM_H
15 changes: 15 additions & 0 deletions src/P2/phasemem.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <phasemem.h>
#include <sdk/ee/eekernel.h>

PHASE g_phase = PHASE_None;

void SetPhase(PHASE phase) {
if (g_phase != phase) {
FlushCache(0);
g_phase = phase;
}
}

void ClearPhase(void) {
g_phase = PHASE_None;
}

0 comments on commit 84ec24c

Please sign in to comment.