From cc282edca5fd2533a568dd1c26ed6b65402550c0 Mon Sep 17 00:00:00 2001 From: blott Date: Sun, 29 Dec 2024 17:37:12 +0000 Subject: [PATCH 1/2] P2/phasemem.c: Match phasemem --- config/sly1.yaml | 2 +- include/phasemem.h | 13 ++++++++++++- src/P2/phasemem.c | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/P2/phasemem.c diff --git a/config/sly1.yaml b/config/sly1.yaml index 6b2f0a0d..97620c09 100644 --- a/config/sly1.yaml +++ b/config/sly1.yaml @@ -174,7 +174,7 @@ segments: #- [0x, asm, P2/ms] #- [0x, asm, P2/murray] - [0x917e0, asm, P2/path] - - [0x92e70, asm, P2/phasemem] + - [0x92e70, c, P2/phasemem] - [0x92ec0, asm, P2/pipe] - [0x93068, asm, P2/pnt] - [0x931a8, c, P2/po] diff --git a/include/phasemem.h b/include/phasemem.h index 6f4954bf..f382331a 100644 --- a/include/phasemem.h +++ b/include/phasemem.h @@ -5,7 +5,18 @@ #define PHASEMEM_H #include "common.h" +#include -// ... +enum PHASE { + PHASE_Nil = -1, + PHASE_None = 0x0, + PHASE_Startup = 0x1, + PHASE_Load = 0x2, + PHASE_Main = 0x3, + PHASE_Mpeg = 0x4, + PHASE_Max = 0x5 +}; + +static PHASE g_phase; #endif // PHASEMEM_H diff --git a/src/P2/phasemem.c b/src/P2/phasemem.c new file mode 100644 index 00000000..77916742 --- /dev/null +++ b/src/P2/phasemem.c @@ -0,0 +1,12 @@ +#include + +void SetPhase(PHASE phase) { + if (g_phase != phase) { + FlushCache(0); + g_phase = phase; + } +} + +void ClearPhase(void) { + g_phase = PHASE_None; +} From 87a4fcfa070a1527bc4a39fc014fc1ad62128262 Mon Sep 17 00:00:00 2001 From: blott Date: Mon, 30 Dec 2024 14:00:32 +0000 Subject: [PATCH 2/2] P2/phasemem: Fix data & padding --- config/sly1.yaml | 3 ++- include/phasemem.h | 3 +-- src/P2/phasemem.c | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/sly1.yaml b/config/sly1.yaml index 97620c09..2edfae56 100644 --- a/config/sly1.yaml +++ b/config/sly1.yaml @@ -175,6 +175,7 @@ segments: #- [0x, asm, P2/murray] - [0x917e0, asm, P2/path] - [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] @@ -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] diff --git a/include/phasemem.h b/include/phasemem.h index f382331a..5c21d795 100644 --- a/include/phasemem.h +++ b/include/phasemem.h @@ -5,7 +5,6 @@ #define PHASEMEM_H #include "common.h" -#include enum PHASE { PHASE_Nil = -1, @@ -17,6 +16,6 @@ enum PHASE { PHASE_Max = 0x5 }; -static PHASE g_phase; +extern PHASE g_phase; #endif // PHASEMEM_H diff --git a/src/P2/phasemem.c b/src/P2/phasemem.c index 77916742..c31d8b42 100644 --- a/src/P2/phasemem.c +++ b/src/P2/phasemem.c @@ -1,4 +1,7 @@ #include +#include + +PHASE g_phase = PHASE_None; void SetPhase(PHASE phase) { if (g_phase != phase) {