Skip to content

Commit eb7cdf4

Browse files
committed
Set up the Write Gather Pipe as a union
1 parent cb70799 commit eb7cdf4

File tree

5 files changed

+49
-12
lines changed

5 files changed

+49
-12
lines changed

ttyd-tools/rel/include/gc/ppc.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#pragma once
2+
3+
#include <cstdint>
4+
5+
namespace gc::ppc {
6+
7+
extern "C" {
8+
9+
typedef union WriteGatherPipe
10+
{
11+
int8_t s8;
12+
int16_t s16;
13+
int32_t s32;
14+
int64_t s64;
15+
uint8_t u8;
16+
uint16_t u16;
17+
uint32_t u32;
18+
uint64_t u64;
19+
float f32;
20+
double f64;
21+
} WriteGatherPipe;
22+
23+
extern volatile WriteGatherPipe writeGatherPipe;
24+
25+
}
26+
27+
}

ttyd-tools/rel/include/ttyd.eu.lst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,4 +2005,8 @@
20052005

20062006
// item_data.o
20072007
// data
2008-
8031C638:itemDataTable
2008+
8031C638:itemDataTable
2009+
2010+
// ppc
2011+
// data
2012+
CC008000:writeGatherPipe

ttyd-tools/rel/include/ttyd.jp.lst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2001,4 +2001,8 @@
20012001

20022002
// item_data.o
20032003
// data
2004-
8030EE58:itemDataTable
2004+
8030EE58:itemDataTable
2005+
2006+
// ppc
2007+
// data
2008+
CC008000:writeGatherPipe

ttyd-tools/rel/include/ttyd.us.lst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2002,4 +2002,8 @@
20022002

20032003
// item_data.o
20042004
// data
2005-
803108A8:itemDataTable
2005+
803108A8:itemDataTable
2006+
2007+
// ppc
2008+
// data
2009+
CC008000:writeGatherPipe

ttyd-tools/rel/source/draw.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "memorywatch.h"
88

99
#include <gc/gx.h>
10+
#include <gc/ppc.h>
1011
#include <ttyd/battle_unit.h>
1112
#include <ttyd/fontmgr.h>
1213
#include <ttyd/battle_disp.h>
@@ -42,9 +43,6 @@ void drawArtAttackHitboxes()
4243
uint8_t HSVA[4];
4344
*reinterpret_cast<uint32_t *>(&HSVA) = 0x00FFCCFF; // RGBA value is 0xCC0000FF
4445

45-
// Get the address of the write gather pipe, and handle the value at the address as a float
46-
volatile float *WriteGatherPipe = reinterpret_cast<float *>(0xCC008000);
47-
4846
for (uint32_t Slot = 0; Slot < 64; Slot++)
4947
{
5048
void *BattleUnitPtr = getActorPointer(Slot);
@@ -193,13 +191,13 @@ void drawArtAttackHitboxes()
193191
// Draw the line from corner 1 to corner 2
194192
gc::gx::GXBegin(gc::gx::GXPrimitive::GX_LINES, gc::gx::GXVtxFmt::GX_VTXFMT0, 2);
195193

196-
*WriteGatherPipe = ScreenPointOutLineStart[0];
197-
*WriteGatherPipe = ScreenPointOutLineStart[1];
198-
*WriteGatherPipe = 0;
194+
gc::ppc::writeGatherPipe.f32 = ScreenPointOutLineStart[0];
195+
gc::ppc::writeGatherPipe.f32 = ScreenPointOutLineStart[1];
196+
gc::ppc::writeGatherPipe.f32 = 0;
199197

200-
*WriteGatherPipe = ScreenPointOutLineEnd[0];
201-
*WriteGatherPipe = ScreenPointOutLineEnd[1];
202-
*WriteGatherPipe = 0;
198+
gc::ppc::writeGatherPipe.f32 = ScreenPointOutLineEnd[0];
199+
gc::ppc::writeGatherPipe.f32 = ScreenPointOutLineEnd[1];
200+
gc::ppc::writeGatherPipe.f32 = 0;
203201
}
204202
}
205203
}

0 commit comments

Comments
 (0)