summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/code_80005FD0.c2
-rw-r--r--src/code_8006E9C0.c4
-rw-r--r--src/ending/podium_ceremony_actors.c4
-rw-r--r--src/main.c4
-rw-r--r--src/os/__osViInit.c2
-rw-r--r--src/os/bstring.h1
-rw-r--r--src/os/osCartRomInit.c2
-rw-r--r--src/os/osInitialize.c2
-rw-r--r--src/os/osLeoDiskInit.c2
-rw-r--r--src/port/audio/HMAS.h2
-rw-r--r--src/racing/memory.c21
11 files changed, 22 insertions, 24 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c
index f0b524754..7a06214bc 100644
--- a/src/code_80005FD0.c
+++ b/src/code_80005FD0.c
@@ -3468,7 +3468,7 @@ void func_8000F124(void) {
// Delete track waypoints
void clear_path_point(TrackPathPoint* arg0, size_t size) {
- bzero((void*) arg0, size * sizeof(TrackPathPoint));
+ memset((void*) arg0, 0, size * sizeof(TrackPathPoint));
}
// Appears to allocate memory for each track.
diff --git a/src/code_8006E9C0.c b/src/code_8006E9C0.c
index 1ffadf8b1..7aedf0cc9 100644
--- a/src/code_8006E9C0.c
+++ b/src/code_8006E9C0.c
@@ -60,7 +60,7 @@ void reset_object_variable(void) {
s32 j;
func_8006EB10();
clear_object_list();
- bzero(playerHUD, HUD_PLAYERS_SIZE * sizeof(hud_player));
+ memset(playerHUD, 0, HUD_PLAYERS_SIZE * sizeof(hud_player));
for (i = 0; i < HUD_PLAYERS_SIZE; i++) {
playerHUD[i].lapCount = 0;
@@ -114,7 +114,7 @@ void func_8006EB10(void) {
}
void clear_object_list() {
- bzero(gObjectList, OBJECT_LIST_SIZE * sizeof(Object));
+ memset(gObjectList, 0, OBJECT_LIST_SIZE * sizeof(Object));
objectListSize = -1;
}
diff --git a/src/ending/podium_ceremony_actors.c b/src/ending/podium_ceremony_actors.c
index cdf9a83c0..040f79512 100644
--- a/src/ending/podium_ceremony_actors.c
+++ b/src/ending/podium_ceremony_actors.c
@@ -105,7 +105,7 @@ CeremonyActor* find_available_entry(void) {
// Find an inactive actor.
if ((actor->isActive & 1) == 0) {
- bzero(actor, sizeof(CeremonyActor));
+ memset(actor, 0, sizeof(CeremonyActor));
actor->isActive = 1;
actor->unk24 = 1.0f;
return actor;
@@ -311,7 +311,7 @@ void unused_80280FA8(UNUSED CeremonyActor* actor) {
void balloons_and_fireworks_init(void) {
D_802874D8.actorTimer = 0;
sPodiumActorList = (CeremonyActor*) get_next_available_memory_addr(sizeof(CeremonyActor) * 200);
- bzero(sPodiumActorList, (sizeof(CeremonyActor) * 200));
+ memset(sPodiumActorList, 0, (sizeof(CeremonyActor) * 200));
new_actor(&initDummy);
}
diff --git a/src/main.c b/src/main.c
index b682244e3..728d65609 100644
--- a/src/main.c
+++ b/src/main.c
@@ -522,7 +522,7 @@ void display_and_vsync(void) {
void init_segment_ending_sequences(void) {
#ifdef TARGET_N64
- bzero((void*) SEG_ENDING, SEG_ENDING_SIZE);
+ memset((void*) SEG_ENDING, 0, SEG_ENDING_SIZE);
osWritebackDCacheAll();
dma_copy((u8*) SEG_ENDING, (u8*) SEG_ENDING_ROM_START, SEG_ENDING_ROM_SIZE);
osInvalICache((void*) SEG_ENDING, SEG_ENDING_SIZE);
@@ -532,7 +532,7 @@ void init_segment_ending_sequences(void) {
void init_segment_racing(void) {
#ifdef TARGET_N64
- bzero((void*) SEG_RACING, SEG_RACING_SIZE);
+ memset((void*) SEG_RACING, 0, SEG_RACING_SIZE);
osWritebackDCacheAll();
dma_copy((u8*) SEG_RACING, (u8*) SEG_RACING_ROM_START, SEG_RACING_ROM_SIZE);
osInvalICache((void*) SEG_RACING, SEG_RACING_SIZE);
diff --git a/src/os/__osViInit.c b/src/os/__osViInit.c
index f57607a3c..14ea5c3c1 100644
--- a/src/os/__osViInit.c
+++ b/src/os/__osViInit.c
@@ -15,7 +15,7 @@ extern OSViMode osViModeMpalLan1;
extern OSViMode osViModeNtscLan1;
void __osViInit(void) {
- bzero(sViContexts, sizeof(sViContexts));
+ memset(sViContexts, 0, sizeof(sViContexts));
__osViCurr = &sViContexts[0];
__osViNext = &sViContexts[1];
__osViNext->retraceCount = 1;
diff --git a/src/os/bstring.h b/src/os/bstring.h
index eef8beeb1..21a03430b 100644
--- a/src/os/bstring.h
+++ b/src/os/bstring.h
@@ -28,7 +28,6 @@ extern "C" {
extern void bcopy(const void*, void*, size_t);
extern int bcmp(const void*, const void*, int);
-extern void bzero(void*, size_t);
extern void blkclr(void*, int);
#ifdef __cplusplus
diff --git a/src/os/osCartRomInit.c b/src/os/osCartRomInit.c
index a51513799..ccae4530e 100644
--- a/src/os/osCartRomInit.c
+++ b/src/os/osCartRomInit.c
@@ -29,7 +29,7 @@ OSPiHandle* osCartRomInit(void) {
CartRomHandle.domain = PI_DOMAIN1;
// CartRomHandle.speed = 0;
- bzero(&CartRomHandle.transferInfo, sizeof(__OSTranxInfo));
+ memset(&CartRomHandle.transferInfo, 0, sizeof(__OSTranxInfo));
saveMask = __osDisableInt();
CartRomHandle.next = __osPiTable;
diff --git a/src/os/osInitialize.c b/src/os/osInitialize.c
index 32376df0e..4b44b96d2 100644
--- a/src/os/osInitialize.c
+++ b/src/os/osInitialize.c
@@ -57,7 +57,7 @@ void osInitialize(void) {
}
osClockRate = osClockRate * 3 / 4;
if (osResetType == RESET_TYPE_COLD_RESET) {
- bzero(osAppNmiBuffer, sizeof(osAppNmiBuffer));
+ memset(osAppNmiBuffer, 0, sizeof(osAppNmiBuffer));
}
eu_sp30 = HW_REG(PI_STATUS_REG, u32);
diff --git a/src/os/osLeoDiskInit.c b/src/os/osLeoDiskInit.c
index 7b5065dff..ca222ab5d 100644
--- a/src/os/osLeoDiskInit.c
+++ b/src/os/osLeoDiskInit.c
@@ -26,7 +26,7 @@ OSPiHandle* osLeoDiskInit(void) {
HW_REG(PI_BSD_DOM2_PWD_REG, u32) = LeoDiskHandle.pulse;
HW_REG(PI_BSD_DOM2_PGS_REG, u32) = LeoDiskHandle.pageSize;
HW_REG(PI_BSD_DOM2_RLS_REG, u32) = LeoDiskHandle.relDuration;
- bzero(&LeoDiskHandle.transferInfo, sizeof(__OSTranxInfo));
+ memset(&LeoDiskHandle.transferInfo, 0, sizeof(__OSTranxInfo));
sp1c = __osDisableInt();
LeoDiskHandle.next = __osPiTable;
__osPiTable = &LeoDiskHandle;
diff --git a/src/port/audio/HMAS.h b/src/port/audio/HMAS.h
index 826e98dcb..c8ac4cd01 100644
--- a/src/port/audio/HMAS.h
+++ b/src/port/audio/HMAS.h
@@ -58,7 +58,7 @@ struct HMAS_Effect {
struct HMAS_ChannelInfo {
ma_sound* sound;
- uint64_t cursor;
+ ma_uint64 cursor;
float pitch;
float volume;
diff --git a/src/racing/memory.c b/src/racing/memory.c
index aed1697d6..6607d08c4 100644
--- a/src/racing/memory.c
+++ b/src/racing/memory.c
@@ -25,7 +25,7 @@
s32 sGfxSeekPosition;
s32 sPackedSeekPosition;
-static u8 sMemoryPool[0xFFFFFFF]; // Stock memory pool size: 0xAB630
+static u8 sMemoryPool[0x10000000] ALIGNED4096;
uintptr_t sPoolEnd = sMemoryPool + sizeof(sMemoryPool);
uintptr_t sPoolFreeSpace;
@@ -88,17 +88,16 @@ static uintptr_t get_texture2(size_t offset, const course_texture* textures) {
* Default memory size, 701.984 Kilobytes.
*/
void initialize_memory_pool() {
+ // Clear pool
+ memset(sMemoryPool, 0, sizeof(sMemoryPool));
- uintptr_t poolStart = sMemoryPool;
- // uintptr_t sPoolEnd = sMemoryPool + sizeof(sMemoryPool);
+ // Force the pointer to be exactly at the start of the aligned array
+ uintptr_t poolStart = (uintptr_t)sMemoryPool;
+
+ // Ensure sPoolEnd is exactly at the end of the 256MB block
+ sPoolEnd = poolStart + sizeof(sMemoryPool);
- bzero(sMemoryPool, sizeof(sMemoryPool));
-
- poolStart = ALIGN16(poolStart);
- // Truncate to a 16-byte boundary.
- sPoolEnd &= ~0xF;
-
- gFreeMemorySize = (sPoolEnd - poolStart) - 0x10;
+ gFreeMemorySize = sPoolEnd - poolStart;
gNextFreeMemoryAddress = poolStart;
PRINT_MEMPOOL;
@@ -309,7 +308,7 @@ u8* load_lakitu_tlut_x64(const char** textureList, size_t length) {
}
u8* textures = (u8*) gNextFreeMemoryAddress;
- gNextFreeMemoryAddress += size;
+ gNextFreeMemoryAddress = ALIGN16(gNextFreeMemoryAddress + size);
size_t offset = 0;
for (size_t i = 0; i < length; i++) {
u8* tex = (u8*) LOAD_ASSET_RAW(textureList[i]);