mirror of
https://github.com/blawar/ooot.git
synced 2024-06-25 22:09:34 +00:00
initial linux commit (does not compile)
This commit is contained in:
parent
fa1d23677b
commit
b333a47586
10
README.md
10
README.md
|
@ -66,8 +66,16 @@ Not currently supported, however a makefile and porting of GLideN64 would allow
|
|||
|
||||
### Linux (Native or under WSL / VM)
|
||||
|
||||
Not currently supported, however a makefile and porting of GLideN64 would allow this and a PR is welcome.
|
||||
```
|
||||
sudo apt install gcc-multilib g++-multilib
|
||||
sudo apt install libsdl2-dev
|
||||
sudo apt install meson
|
||||
|
||||
setup.py -b EUR_MQD
|
||||
meson setup linux
|
||||
cd linux
|
||||
ninja
|
||||
```
|
||||
|
||||
|
||||
## Contributing
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
#ifndef ALLOCA_H
|
||||
#define ALLOCA_H
|
||||
|
||||
#define alloca _alloca
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "z64math.h"
|
||||
|
||||
struct AudioTask;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
void __assert(const char* exp, const char* file, s32 line);
|
||||
void oot_assert(const char* exp, const char* file, s32 line);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "ultra64/printf.h"
|
||||
#include "ultra64/gbi.h"
|
||||
#include "ultra64/message.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "color.h"
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "porting_defs.h"
|
||||
#include "z64.h"
|
||||
|
||||
|
@ -12,16 +13,13 @@
|
|||
#include <stdarg.h>
|
||||
void osSyncPrintf(const char* fmt, ...);
|
||||
|
||||
#if defined(_MSC_VER) && 0
|
||||
#define bcopy(b1, b2, len) (memmove((b2), (b1), (len)), (void)0)
|
||||
#define bzero(b, len) (memset((b), '\0', (len)), (void)0)
|
||||
#else
|
||||
#if defined(_MSC_VER)
|
||||
void bzero(void* __s, size_t __n);
|
||||
void bcopy(void* __s, void* __d, size_t __n);
|
||||
#endif
|
||||
|
||||
u64 osGetTime();
|
||||
void __assert(const char* exp, const char* file, s32 line);
|
||||
void oot_assert(const char* exp, const char* file, s32 line);
|
||||
|
||||
#include "z_debug_display.h"
|
||||
|
||||
|
|
|
@ -121,9 +121,9 @@ MES(n30), MES(n31), MES(n32), MES(n33)}
|
|||
#ifdef NDEBUG
|
||||
#define ASSERT(cond, msg, file, line) ((void)0)
|
||||
#elif defined(REAL_ASSERT_MACRO)
|
||||
#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(#cond, __FILE__, __LINE__))
|
||||
#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : oot_assert(#cond, __FILE__, __LINE__))
|
||||
#else
|
||||
#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : __assert(msg, file, line))
|
||||
#define ASSERT(cond, msg, file, line) ((cond) ? ((void)0) : oot_assert(msg, file, line))
|
||||
#endif
|
||||
|
||||
#define gDPSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
||||
|
@ -149,7 +149,10 @@ MES(n30), MES(n31), MES(n32), MES(n33)}
|
|||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifndef M_SQRT2
|
||||
#define M_SQRT2 1.41421356237309504880f
|
||||
#endif
|
||||
|
||||
#define FLT_MAX 340282346638528859811704183484516925440.0f
|
||||
#define SHT_MAX 32767.0f
|
||||
#define SHT_MINV (1.0f / SHT_MAX)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "ultra64/types.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "padmgr.h"
|
||||
|
||||
struct FaultClient {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include <functional>
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "ultra64/controller.h"
|
||||
#include "ultra64/pfs.h"
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@
|
|||
#include <stdint.h>
|
||||
#include "ultra64/types.h"
|
||||
|
||||
#ifndef LITTLE_ENDIAN
|
||||
#define LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#define SWAP16(data) \
|
||||
( (((data) >> 8) & 0x00FF) | (((data) << 8) & 0xFF00) )
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
typedef signed char s8;
|
||||
typedef unsigned char u8;
|
||||
|
|
7
include/z64alloca.h
Normal file
7
include/z64alloca.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
#ifndef _MSC_VER
|
||||
#include <alloca.h>
|
||||
#else
|
||||
#define alloca _alloca
|
||||
#endif
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "ultra64/types.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
|
||||
struct JpegQuantizationTable {
|
||||
/* 0x00 */ u16 table[8 * 8];
|
||||
|
|
|
@ -19,7 +19,7 @@ u8 SystemArena_IsInitalized(void);
|
|||
|
||||
void* z_memset(void* ptr, s32 val, size_t size);
|
||||
|
||||
void __assert(const char* exp, const char* file, s32 line);
|
||||
void oot_assert(const char* exp, const char* file, s32 line);
|
||||
|
||||
f32 LogUtils_CheckFloatRange(const char* exp, s32 line, const char* valueName, f32 value, const char* minName, f32 min,
|
||||
const char* maxName, f32 max);
|
||||
|
|
754
meson.build
754
meson.build
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
#include "def/assert.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void __assert(const char* exp, const char* file, s32 line) {
|
||||
void oot_assert(const char* exp, const char* file, s32 line) {
|
||||
char msg[256];
|
||||
|
||||
osSyncPrintf("Assertion failed: %s, file %s, line %d, thread %d\n", exp, file, line, 0);
|
||||
|
|
|
@ -1,10 +1 @@
|
|||
#include "global.h"
|
||||
#include "sched.h"
|
||||
|
||||
StackEntry sBootThreadInfo;
|
||||
OSThread sIdleThread;
|
||||
u8 sIdleThreadStack[0x400];
|
||||
StackEntry sIdleThreadInfo;
|
||||
u8 sBootThreadStack[0x400];
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define INTERNAL_SRC_BOOT_Z_STD_DMA_C
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "ultra64/pi.h"
|
||||
#include "z64dma.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_PRERENDER_C
|
||||
#include "global.h"
|
||||
#include "alloca.h"
|
||||
#include "z64alloca.h"
|
||||
#include "z64render.h"
|
||||
#include "gfx.h"
|
||||
#include "regs.h"
|
||||
|
@ -24,7 +24,7 @@ void PreRender_SetValuesSave(PreRender* pthis, u32 width, u32 height, void* fbuf
|
|||
}
|
||||
|
||||
void PreRender_Init(PreRender* pthis) {
|
||||
bzero(pthis, sizeof(PreRender));
|
||||
memset(pthis, 0, sizeof(PreRender));
|
||||
ListAlloc_Init(&pthis->alloc);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,5 +147,5 @@ void THA_Ct(TwoHeadArena* tha, void* ptr, u32 size) {
|
|||
}
|
||||
|
||||
void THA_Dt(TwoHeadArena* tha) {
|
||||
bzero(tha, sizeof(TwoHeadArena));
|
||||
memset(tha, 0, sizeof(TwoHeadArena));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "global.h"
|
||||
#include "z64audio.h"
|
||||
#include "audiomgr.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "ultra64/message.h"
|
||||
#include "speedmeter.h"
|
||||
#include "regs.h"
|
||||
|
@ -15,6 +15,7 @@
|
|||
#include "../../AziAudio/AziAudio/AudioSpec.h"
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
#include <string.h>
|
||||
#include "ultra64/rcp.h"
|
||||
#include "redef_msgqueue.h"
|
||||
|
||||
|
@ -139,7 +140,11 @@ void azi_init()
|
|||
hw_regs.AI_DACRATE_REG = 0x3FFF;
|
||||
hw_regs.AI_BITRATE_REG = 0xF;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
Audio_Info.hwnd = GetActiveWindow();
|
||||
#else
|
||||
Audio_Info.hwnd = NULL;
|
||||
#endif
|
||||
Audio_Info.AI_DRAM_ADDR_REG = &hw_regs.AI_DRAM_ADDR_REG;
|
||||
Audio_Info.AI_LEN_REG = &hw_regs.AI_LEN_REG;
|
||||
Audio_Info.AI_CONTROL_REG = &hw_regs.AI_CONTROL_REG;
|
||||
|
@ -153,7 +158,7 @@ void azi_init()
|
|||
}
|
||||
|
||||
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) {
|
||||
bzero(audioMgr, sizeof(AudioMgr));
|
||||
memset(audioMgr, 0, sizeof(AudioMgr));
|
||||
g_audioMgr = audioMgr;
|
||||
azi_init();
|
||||
|
||||
|
@ -171,11 +176,11 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon
|
|||
|
||||
void AudioMgr_Shutdown()
|
||||
{
|
||||
Sleep(500);//Wait until the audio buffer finishes playing
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500)); // Wait until the audio buffer finishes playing
|
||||
|
||||
CloseDLL();//Shut down Azi
|
||||
|
||||
Sleep(1000);//Keep the audio thread open a bit longer
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000)); // Keep the audio thread open a bit longer
|
||||
|
||||
g_aziInit = false;//Thread closes now
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "ultra64.h"
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include "z64audio.h"
|
||||
#include "def/aisetfreq.h"
|
||||
#include "def/audio_data.h"
|
||||
|
@ -191,7 +192,11 @@ void* AudioHeap_AllocZeroed(AudioAllocPool* pool, u32 size) {
|
|||
|
||||
void* AudioHeap_Alloc(AudioAllocPool* pool, u32 size) {
|
||||
pool->count++;
|
||||
#ifdef _MSC_VER
|
||||
return _aligned_malloc(ALIGN16(size), 0x10);
|
||||
#else
|
||||
return aligned_alloc(ALIGN16(size), 0x10);
|
||||
#endif
|
||||
//return malloc(size);
|
||||
u32 aligned = ALIGN16(size);
|
||||
u8* ret = pool->cur;
|
||||
|
|
|
@ -1175,7 +1175,7 @@ Acmd* AudioSynth_LoadWaveSamples(Acmd* cmd, NoteSubEu* noteSubEu, NoteSynthesisS
|
|||
if (temp_v0 < nSamplesToLoad) {
|
||||
repeats = ((nSamplesToLoad - temp_v0 + 0x3F) / 0x40);
|
||||
if (repeats != 0) {
|
||||
aDuplicate(cmd++, repeats, DMEM_UNCOMPRESSED_NOTE, DMEM_UNCOMPRESSED_NOTE + 0x80, 0x80);
|
||||
aDuplicate(cmd++, repeats, DMEM_UNCOMPRESSED_NOTE, DMEM_UNCOMPRESSED_NOTE + 0x80);
|
||||
}
|
||||
}
|
||||
synthState->samplePosInt = samplePosInt;
|
||||
|
@ -1238,6 +1238,6 @@ Acmd* AudioSynth_NoteApplyHeadsetPanEffects(Acmd* cmd, NoteSubEu* noteSubEu, Not
|
|||
aSaveBuffer(cmd++, DMEM_NOTE_PAN_TEMP + bufLen, &synthState->synthesisBuffers->panResampleState[0x8],
|
||||
ALIGN16(panShift));
|
||||
}
|
||||
aAddMixer(cmd++, ALIGN64(bufLen), DMEM_NOTE_PAN_TEMP, dest, 0x7FFF);
|
||||
aAddMixer(cmd++, ALIGN64(bufLen), DMEM_NOTE_PAN_TEMP, dest);
|
||||
return cmd;
|
||||
}
|
||||
|
|
|
@ -83,15 +83,15 @@ void func_800ACE98(struct_801664F0* pthis, Gfx** gfxp) {
|
|||
gSPDisplayList(gfx++, D_8012AC40);
|
||||
break;
|
||||
case 2:
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, pthis->color. r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, (u32)pthis->color);
|
||||
gSPDisplayList(gfx++, D_8012AC58);
|
||||
break;
|
||||
case 3:
|
||||
gDPSetColor(gfx++, G_SETBLENDCOLOR, pthis->color.r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETBLENDCOLOR, (u32)pthis->color);
|
||||
gSPDisplayList(gfx++, D_8012AC00);
|
||||
break;
|
||||
case 4:
|
||||
gDPSetColor(gfx++, G_SETFOGCOLOR, pthis->color.r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETFOGCOLOR, (u32)pthis->color);
|
||||
gSPDisplayList(gfx++, D_8012AC28);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ void func_800AD958(struct_80166500* pthis, Gfx** gfxp) {
|
|||
gDPSetCombineLERP(gfx++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT,
|
||||
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT);
|
||||
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, pthis->primColor.r, pthis->primColor.g, pthis->primColor.b, pthis->primColor.a);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, pthis->envColor.r, pthis->envColor.g, pthis->envColor.b, pthis->envColor.a);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, (u32)pthis->primColor);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, (u32)pthis->envColor);
|
||||
|
||||
for (y = 0; y <= SCREEN_HEIGHT - height; y += height) {
|
||||
gDPLoadTextureBlock(gfx++, tex, fmt, G_IM_SIZ_16b, SCREEN_WIDTH, height, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "def/__osMalloc.h"
|
||||
#include "def/debug_malloc.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define LOG_SEVERITY_NOLOG 0
|
||||
#define LOG_SEVERITY_ERROR 2
|
||||
|
@ -51,7 +52,7 @@ void* DebugArena_Calloc(u32 num, u32 size) {
|
|||
|
||||
ret = malloc(n);
|
||||
if (ret != NULL) {
|
||||
bzero(ret, n);
|
||||
memset(ret, 0, n);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_FAULT_C
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
#include "alloca.h"
|
||||
#include "z64alloca.h"
|
||||
#include "padmgr.h"
|
||||
#include "n64fault.h"
|
||||
#include "ultra64/convert.h"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "z_title.h"
|
||||
#include "gfx.h"
|
||||
#include "gfxapi.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "padmgr.h"
|
||||
#include "z64save.h"
|
||||
#include "speedmeter.h"
|
||||
|
@ -106,7 +106,7 @@ GameStateOverlay* Graph_GetNextGameState(GameState* gameState) {
|
|||
}
|
||||
|
||||
void Graph_Init(GraphicsContext* gfxCtx) {
|
||||
bzero(gfxCtx, sizeof(GraphicsContext));
|
||||
memset(gfxCtx, 0, sizeof(GraphicsContext));
|
||||
gfxCtx->gfxPoolIdx = 0;
|
||||
gfxCtx->fbIdx = 0;
|
||||
gfxCtx->viMode = NULL;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_IRQMGR_C
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "ultra64/exception.h"
|
||||
#include <stdbool.h>
|
||||
#include "def/irqmgr.h"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#define INTERNAL_SRC_CODE_PADUTILS_C
|
||||
#include "global.h"
|
||||
#include "padmgr.h"
|
||||
#include <string.h>
|
||||
#include "def/padutils.h"
|
||||
|
||||
void PadUtils_Init(Input* input) {
|
||||
bzero(input, sizeof(Input));
|
||||
memset(input, 0, sizeof(Input));
|
||||
}
|
||||
|
||||
void func_800FCB70(void) {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "z64game.h"
|
||||
#include "z_play.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "regs.h"
|
||||
#include "speedmeter.h"
|
||||
#include "ultra64/vi.h"
|
||||
|
|
|
@ -54,7 +54,7 @@ void* SystemArena_Calloc(u32 num, u32 size) {
|
|||
ret = malloc(n);
|
||||
|
||||
if (ret != NULL) {
|
||||
bzero(ret, n);
|
||||
memset(ret, 0, n);
|
||||
}
|
||||
|
||||
SystemArena_CheckPointer(ret, n, "calloc", "Secure");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include <algorithm>
|
||||
#include "global.h"
|
||||
#include "vt.h"
|
||||
#include <string.h>
|
||||
#include "z64global.h"
|
||||
#include "sfx.h"
|
||||
#include "framerate.h"
|
||||
|
@ -2003,7 +2004,7 @@ void func_800304DC(GlobalContext* globalCtx, ActorContext* actorCtx, ActorEntry*
|
|||
|
||||
savedSceneFlags = &gSaveContext.sceneFlags[globalCtx->sceneNum];
|
||||
|
||||
bzero(actorCtx, sizeof(*actorCtx));
|
||||
memset(actorCtx, 0, sizeof(*actorCtx));
|
||||
|
||||
ActorOverlayTable_Init();
|
||||
MtxF* tmp = &globalCtx->billboardMtxF;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_Z_CAMERA_C
|
||||
#include "ultra64.h"
|
||||
#include <string.h>
|
||||
#include "global.h"
|
||||
#include "z64global.h"
|
||||
#include "state.h"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_Z_COMMON_DATA_C
|
||||
#include "global.h"
|
||||
#include "z64save.h"
|
||||
#include <string.h>
|
||||
#include "sequence.h"
|
||||
#include "def/z_common_data.h"
|
||||
|
||||
|
@ -11,8 +12,8 @@ u32 D_8015FA8C;
|
|||
u8 Get_Language();
|
||||
|
||||
void SaveContext_Init(void) {
|
||||
u8 currentLanguage = Get_Language();
|
||||
bzero(&gSaveContext, sizeof(gSaveContext));
|
||||
u8 currentLanguage = Get_Language();
|
||||
memset(&gSaveContext, 0, sizeof(gSaveContext));
|
||||
D_8015FA88 = 0;
|
||||
D_8015FA8C = 0;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_Z_FBDEMO_C
|
||||
#include "global.h"
|
||||
#include "gfx.h"
|
||||
#include <string.h>
|
||||
#include "z64transition.h"
|
||||
#include "def/mtxf2l.h"
|
||||
#include "def/ortho.h"
|
||||
|
@ -138,7 +139,7 @@ void TransitionUnk_Destroy(TransitionUnk* pthis) {
|
|||
|
||||
TransitionUnk* TransitionUnk_Init(TransitionUnk* pthis, s32 row, s32 col) {
|
||||
osSyncPrintf("fbdemo_init(%08x, %d, %d)\n", pthis, row, col);
|
||||
bzero(pthis, sizeof(*pthis));
|
||||
memset(pthis, 0, sizeof(*pthis));
|
||||
pthis->frame = 0;
|
||||
pthis->row = row;
|
||||
pthis->col = col;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_Z_FBDEMO_CIRCLE_C
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "gfx.h"
|
||||
#include "z64transition.h"
|
||||
#include "z64audio.h"
|
||||
|
@ -106,7 +107,7 @@ void TransitionCircle_Start(void* thisx) {
|
|||
void* TransitionCircle_Init(void* thisx) {
|
||||
TransitionCircle* pthis = (TransitionCircle*)thisx;
|
||||
|
||||
bzero(pthis, sizeof(*pthis));
|
||||
memset(pthis, 0, sizeof(*pthis));
|
||||
return pthis;
|
||||
}
|
||||
|
||||
|
@ -163,8 +164,8 @@ void TransitionCircle_Draw(void* thisx, Gfx** gfxP) {
|
|||
texScroll = Gfx_BranchTexScroll(&gfx, pthis->texX, pthis->texY, 0x10, 0x40);
|
||||
gSPSegment(gfx++, 9, texScroll);
|
||||
gSPSegment(gfx++, 8, pthis->texture);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, pthis->color.r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, pthis->color.r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, (u32)pthis->color);
|
||||
gDPSetColor(gfx++, G_SETENVCOLOR, (u32)pthis->color);
|
||||
gSPMatrix(gfx++, &pthis->projection, G_MTX_PROJECTION | G_MTX_LOAD);
|
||||
gSPPerspNormalize(gfx++, pthis->normal);
|
||||
gSPMatrix(gfx++, &pthis->lookAt, G_MTX_PROJECTION | G_MTX_NOPUSH | G_MTX_MUL);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_Z_FBDEMO_FADE_C
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "gfx.h"
|
||||
#include "z64transition.h"
|
||||
#include "framerate.h"
|
||||
|
@ -43,7 +44,7 @@ void TransitionFade_Start(void* pthisx) {
|
|||
void* TransitionFade_Init(void* pthisx) {
|
||||
TransitionFade* pthis = (TransitionFade*)pthisx;
|
||||
|
||||
bzero(pthis, sizeof(*pthis));
|
||||
memset(pthis, 0, sizeof(*pthis));
|
||||
return pthis;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_Z_FBDEMO_TRIFORCE_C
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "z64transition.h"
|
||||
#include "code/fbdemo_triforce/z_fbdemo_triforce.cpp"
|
||||
#include "def/ortho.h"
|
||||
|
@ -23,7 +24,7 @@ void TransitionTriforce_Start(void* pthisx) {
|
|||
void* TransitionTriforce_Init(void* pthisx) {
|
||||
TransitionTriforce* pthis = (TransitionTriforce*)pthisx;
|
||||
|
||||
bzero(pthis, sizeof(*pthis));
|
||||
memset(pthis, 0, sizeof(*pthis));
|
||||
guOrtho(&pthis->projection, -160.0f, 160.0f, -120.0f, 120.0f, -1000.0f, 1000.0f, 1.0f);
|
||||
pthis->transPos = 1.0f;
|
||||
pthis->state = 2;
|
||||
|
@ -89,7 +90,7 @@ void TransitionTriforce_Draw(void* pthisx, Gfx** gfxP) {
|
|||
guTranslate(&modelView[2], 0.0f, 0.0f, 0.0f);
|
||||
gDPPipeSync(gfx++);
|
||||
gSPDisplayList(gfx++, sTriforceWipeDL);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, pthis->color.r, pthis->color.g, pthis->color.b, pthis->color.a);
|
||||
gDPSetColor(gfx++, G_SETPRIMCOLOR, (u32)pthis->color);
|
||||
gDPSetCombineMode(gfx++, G_CC_PRIMITIVE, G_CC_PRIMITIVE);
|
||||
gSPMatrix(gfx++, &pthis->projection, G_MTX_LOAD | G_MTX_PROJECTION);
|
||||
gSPMatrix(gfx++, &modelView[0], G_MTX_LOAD);
|
||||
|
|
|
@ -64,7 +64,7 @@ void TransitionWipe_Start(void* pthisx) {
|
|||
void* TransitionWipe_Init(void* pthisx) {
|
||||
TransitionWipe* pthis = (TransitionWipe*)pthisx;
|
||||
|
||||
bzero(pthis, sizeof(*pthis));
|
||||
memset(pthis, 0, sizeof(*pthis));
|
||||
return pthis;
|
||||
}
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ void LightContext_Init(GlobalContext* globalCtx, LightContext* lightCtx) {
|
|||
LightContext_InitList(globalCtx, lightCtx);
|
||||
LightContext_SetAmbientColor(lightCtx, 80, 80, 80);
|
||||
LightContext_SetFog(lightCtx, 0, 0, 0, 996, 12800);
|
||||
bzero(&sLightsBuffer, sizeof(sLightsBuffer));
|
||||
memset(&sLightsBuffer, 0, sizeof(sLightsBuffer));
|
||||
}
|
||||
|
||||
void LightContext_SetAmbientColor(LightContext* lightCtx, u8 r, u8 g, u8 b) {
|
||||
|
|
|
@ -57,7 +57,7 @@ void* ZeldaArena_Calloc(u32 num, u32 size) {
|
|||
ret = malloc(n);
|
||||
|
||||
if (ret != NULL) {
|
||||
bzero(ret, n);
|
||||
memset(ret, 0, n);
|
||||
}
|
||||
|
||||
ZeldaArena_CheckPointer(ret, n, "zelda_calloc", "確保");
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define INTERNAL_SRC_CODE_Z_MSGEVENT_C
|
||||
#include "global.h"
|
||||
#include "sched.h"
|
||||
#include "ultra64/sched.h"
|
||||
#include "def/createmesgqueue.h"
|
||||
#include "def/recvmesg.h"
|
||||
#include "def/sched.h"
|
||||
|
|
|
@ -128,7 +128,7 @@ void func_800BC590(GlobalContext* globalCtx) {
|
|||
void func_800BC5E0(GlobalContext* globalCtx, s32 transitionType) {
|
||||
TransitionContext* transitionCtx = &globalCtx->transitionCtx;
|
||||
|
||||
bzero(transitionCtx, sizeof(TransitionContext));
|
||||
memset(transitionCtx, 0, sizeof(TransitionContext));
|
||||
|
||||
transitionCtx->transitionType = transitionType;
|
||||
|
||||
|
|
|
@ -35,7 +35,11 @@
|
|||
|
||||
extern bool (*gSceneCmdHandlers[26])(GlobalContext*, const SceneCmd*);
|
||||
|
||||
RomFile sNaviMsgFiles[];
|
||||
RomFile sNaviMsgFiles[] = {
|
||||
ROM_FILE(elf_message_field),
|
||||
ROM_FILE(elf_message_ydan),
|
||||
ROM_FILE_UNSET,
|
||||
};
|
||||
|
||||
s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId) {
|
||||
objectCtx->num++;
|
||||
|
@ -431,12 +435,6 @@ static bool (*gSceneCmdHandlers[])(GlobalContext*, const SceneCmd*) = {
|
|||
cmd_sound_settings, cmd_echo_settings, cmd_cutscene_data, cmd_alternate_headers, cmd_misc_settings,
|
||||
};
|
||||
|
||||
RomFile sNaviMsgFiles[] = {
|
||||
ROM_FILE(elf_message_field),
|
||||
ROM_FILE(elf_message_ydan),
|
||||
ROM_FILE_UNSET,
|
||||
};
|
||||
|
||||
s16 gLinkObjectIds[] = { OBJECT_LINK_BOY, OBJECT_LINK_CHILD };
|
||||
|
||||
u32 gObjectTableSize = ARRAY_COUNT(gObjectTable);
|
||||
|
|
|
@ -180,7 +180,7 @@ static u16 sNewSaveChecksum = 0;
|
|||
void Sram_InitNewSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
||||
memset(&SAVE_INFO, 0, sizeof(SaveInfo));
|
||||
gSaveContext.totalDays = 0;
|
||||
gSaveContext.bgsDayCount = 0;
|
||||
|
||||
|
@ -269,7 +269,7 @@ static u16 sDebugSaveChecksum = 0;
|
|||
void Sram_InitDebugSave(void) {
|
||||
SaveContext* temp = &gSaveContext;
|
||||
|
||||
bzero(&SAVE_INFO, sizeof(SaveInfo));
|
||||
memset(&SAVE_INFO, 0, sizeof(SaveInfo));
|
||||
gSaveContext.totalDays = 0;
|
||||
gSaveContext.bgsDayCount = 0;
|
||||
|
||||
|
@ -533,7 +533,7 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* s
|
|||
u16 dayTime;
|
||||
|
||||
osSyncPrintf("SRAM START-LOAD\n");
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
memset(sramCtx->readBuff, 0, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
|
||||
dayTime = ((void)0, gSaveContext.dayTime);
|
||||
|
@ -575,14 +575,14 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* s
|
|||
if (newChecksum != oldChecksum) {
|
||||
// backup save didnt work, make new save
|
||||
osSyncPrintf("ERROR!!! = %x(%d+3)\n", gSramSlotOffsets[slotNum + 3], slotNum);
|
||||
bzero(&gSaveContext.entranceIndex, sizeof(s32));
|
||||
bzero(&gSaveContext.linkAge, sizeof(s32));
|
||||
bzero(&gSaveContext.cutsceneIndex, sizeof(s32));
|
||||
memset(&gSaveContext.entranceIndex, 0, sizeof(s32));
|
||||
memset(&gSaveContext.linkAge, 0, sizeof(s32));
|
||||
memset(&gSaveContext.cutsceneIndex, 0, sizeof(s32));
|
||||
// note that gSaveContext.dayTime is not actually the sizeof(s32)
|
||||
bzero(&gSaveContext.dayTime, sizeof(s32));
|
||||
bzero(&gSaveContext.nightFlag, sizeof(s32));
|
||||
bzero(&gSaveContext.totalDays, sizeof(s32));
|
||||
bzero(&gSaveContext.bgsDayCount, sizeof(s32));
|
||||
memset(&gSaveContext.dayTime, 0, sizeof(s32));
|
||||
memset(&gSaveContext.nightFlag, 0, sizeof(s32));
|
||||
memset(&gSaveContext.totalDays, 0, sizeof(s32));
|
||||
memset(&gSaveContext.bgsDayCount, 0, sizeof(s32));
|
||||
|
||||
if (!slotNum) {
|
||||
Sram_InitDebugSave();
|
||||
|
@ -632,7 +632,7 @@ void Sram_VerifyAndLoadAllSaves(FileChooseContext* fileChooseCtx, SramContext* s
|
|||
}
|
||||
}
|
||||
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
memset(sramCtx->readBuff, 0, SRAM_SIZE);
|
||||
SsSram_ReadWrite(OS_K1_TO_PHYSICAL(0xA8000000), sramCtx->readBuff, SRAM_SIZE, OS_READ);
|
||||
gSaveContext.dayTime = dayTime;
|
||||
|
||||
|
@ -894,7 +894,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
|
|||
}
|
||||
|
||||
if (CHECK_BTN_ANY(gameState->input[2].cur.button, BTN_DRIGHT)) {
|
||||
bzero(sramCtx->readBuff, SRAM_SIZE);
|
||||
memset(sramCtx->readBuff, 0, SRAM_SIZE);
|
||||
for (i = 0; i < CHECKSUM_SIZE; i++) {
|
||||
sramCtx->readBuff[i] = i;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_CODE_Z_VISMONO_C
|
||||
|
||||
#include "global.h"
|
||||
#include <string.h>
|
||||
#include "gfx.h"
|
||||
#include "z_vismono.h"
|
||||
#include "def/graph.h"
|
||||
|
@ -20,7 +21,7 @@ void enableFbEffects();
|
|||
|
||||
void VisMono_Init(VisMono* pthis)
|
||||
{
|
||||
bzero(pthis, sizeof(VisMono));
|
||||
memset(pthis, 0, sizeof(VisMono));
|
||||
pthis->unk_00 = 0;
|
||||
pthis->setScissor = false;
|
||||
pthis->primColor.r = 255;
|
||||
|
|
|
@ -863,7 +863,7 @@ void EnHorse_Init(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_IN, pthis->actor.world.pos.x, pthis->actor.world.pos.y,
|
||||
pthis->actor.world.pos.z, pthis->actor.shape.rot.x, pthis->actor.shape.rot.y, 1, 1);
|
||||
if (pthis->rider == NULL) {
|
||||
__assert("pthis->race.rider != NULL", "../z_en_horse.c", 3077);
|
||||
oot_assert("pthis->race.rider != NULL", "../z_en_horse.c", 3077);
|
||||
}
|
||||
if (!(gSaveContext.eventInf[0] & 0x40)) {
|
||||
pthis->ingoHorseMaxSpeed = 12.07f;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#define INTERNAL_SRC_OVERLAYS_ACTORS_OVL_PLAYER_ACTOR_Z_PLAYER_C
|
||||
#include "actor_common.h"
|
||||
#include <z64camera.h>
|
||||
#include "z64camera.h"
|
||||
#include <string.h>
|
||||
#include "z_player.h"
|
||||
#include "framerate.h"
|
||||
#include "z_scene_table.h"
|
||||
|
@ -10351,7 +10352,7 @@ void Player_Update(Actor* pthisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
if (pthis->stateFlags1 & 0x20000020) {
|
||||
bzero(&sp44, sizeof(sp44));
|
||||
memset(&sp44, 0, sizeof(sp44));
|
||||
} else {
|
||||
sp44 = globalCtx->state.input[0];
|
||||
if (pthis->unk_88E != 0) {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../options.h"
|
||||
#include "def/z_player_lib.h"
|
||||
#include "state.h"
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#define TAS_DIR "sdmc:/switch/oot/tas"
|
||||
|
@ -23,6 +24,10 @@ static inline int8_t invert(const int8_t value)
|
|||
return -value;
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define fopen_s(pFile, filename, mode) ((*(pFile)) = fopen((filename), (mode))) == NULL
|
||||
#endif
|
||||
|
||||
namespace oot::hid
|
||||
{
|
||||
static bool g_firstPersonEnabled = false;
|
||||
|
|
|
@ -185,6 +185,7 @@ int main(int argc, char** argv)
|
|||
run();
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#include <string.h>
|
||||
|
||||
void bzero(void* __s, size_t __n)
|
||||
|
@ -195,4 +196,5 @@ void bzero(void* __s, size_t __n)
|
|||
void bcopy(void* __s, void* __d, size_t __n)
|
||||
{
|
||||
memmove(__d, __s, __n);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ static struct {
|
|||
} buf;
|
||||
} rspa;
|
||||
|
||||
static int16_t resample_table[64][4] = {
|
||||
static u16 resample_table[64][4] = {
|
||||
{0x0c39, 0x66ad, 0x0d46, 0xffdf}, {0x0b39, 0x6696, 0x0e5f, 0xffd8},
|
||||
{0x0a44, 0x6669, 0x0f83, 0xffd0}, {0x095a, 0x6626, 0x10b4, 0xffc8},
|
||||
{0x087d, 0x65cd, 0x11f0, 0xffbf}, {0x07ab, 0x655e, 0x1338, 0xffb6},
|
||||
|
@ -234,7 +234,7 @@ void aResampleImpl(uint8_t flags, uint16_t pitch, RESAMPLE_STATE state) {
|
|||
|
||||
do {
|
||||
for (i = 0; i < 8; i++) {
|
||||
tbl = resample_table[pitch_accumulator * 64 >> 16];
|
||||
tbl = (s16*)resample_table[pitch_accumulator * 64 >> 16];
|
||||
sample = ((in[0] * tbl[0] + 0x4000) >> 15) +
|
||||
((in[1] * tbl[1] + 0x4000) >> 15) +
|
||||
((in[2] * tbl[2] + 0x4000) >> 15) +
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "xxhash64.h"
|
||||
#include <fstream>
|
||||
#include "json.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __SWITCH__
|
||||
#include "pc/nx.h"
|
||||
|
|
|
@ -19,6 +19,10 @@ namespace oot
|
|||
State state;
|
||||
}
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define fopen_s(pFile, filename, mode) ((*(pFile)) = fopen((filename), (mode))) == NULL
|
||||
#endif
|
||||
|
||||
static std::unique_ptr<platform::window::Base> gWindow;
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#include <algorithm>
|
||||
#include <string.h>
|
||||
#include "players.h"
|
||||
#include "../controller/controllers.h"
|
||||
#include "z64.h";
|
||||
#include "../options.h"
|
||||
|
||||
#include "z64.h"
|
||||
#include "padmgr.h"
|
||||
|
||||
extern PadMgr gPadMgr;
|
||||
|
@ -58,4 +62,4 @@ namespace oot
|
|||
m_size = std::max((u64)playerId + 1, m_size);
|
||||
}
|
||||
}
|
||||
} // namespace oot
|
||||
} // namespace oot
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
#include <chrono>
|
||||
#include "../../AziAudio/AziAudio/AudioSpec.h"
|
||||
|
||||
#ifndef _MSC_VER
|
||||
#define fopen_s(pFile, filename, mode) ((*(pFile)) = fopen((filename), (mode))) == NULL
|
||||
#endif
|
||||
|
||||
HardwareRegisters hw_regs;
|
||||
|
||||
extern u32 osTvType;
|
||||
|
@ -385,6 +389,7 @@ static char buffer[0x10000];
|
|||
|
||||
void osSyncPrintf(const char* fmt, ...)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
//return; // temp disable this, because osSyncPrintf is not type safe, and globalCtx->state.frames gets passed to it as an object instead of expected int and it crashes
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
va_list arg;
|
||||
|
@ -396,6 +401,7 @@ void osSyncPrintf(const char* fmt, ...)
|
|||
auto s = utf8_to_utf16(buffer);
|
||||
// OutputDebugStringA(buffer);
|
||||
OutputDebugString(s.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "jpeg_decoder.h"
|
||||
|
@ -569,10 +575,12 @@ s32 osRecvMesg(OSMesgQueue* mq, OSMesg* msg, s32 flag)
|
|||
|
||||
uintptr_t check_pointer(uintptr_t p, u32 sz)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
if(IsBadReadPtr((const void*)p, sz))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return p;
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -1,15 +1,26 @@
|
|||
#include "str.h"
|
||||
|
||||
#define MAX_TMP_STRING 8
|
||||
static std::string g_tmp[MAX_TMP_STRING];
|
||||
static int g_i = 0;
|
||||
|
||||
const char* STR(const std::string& s)
|
||||
{
|
||||
return s.c_str();
|
||||
auto& result = g_tmp[(g_i++) % MAX_TMP_STRING];
|
||||
result = s;
|
||||
std::replace(result.begin(), result.end(), '\\', '/');
|
||||
return result.c_str();
|
||||
}
|
||||
|
||||
const char* STR(const std::filesystem::path& p)
|
||||
{
|
||||
auto& result = g_tmp[(g_i++) % MAX_TMP_STRING];
|
||||
result = p.string();
|
||||
std::replace(result.begin(), result.end(), '\\', '/');
|
||||
|
||||
#ifdef _MSC_VER
|
||||
return p.string().c_str();
|
||||
return result.c_str();
|
||||
#else
|
||||
return p.c_str();
|
||||
return result.c_str();
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user