diff --git a/ZAPDTR/ZAPDUtils/ZAPDUtils.vcxproj b/ZAPDTR/ZAPDUtils/ZAPDUtils.vcxproj index b74fe75f9..05b9e1908 100644 --- a/ZAPDTR/ZAPDUtils/ZAPDUtils.vcxproj +++ b/ZAPDTR/ZAPDUtils/ZAPDUtils.vcxproj @@ -41,7 +41,7 @@ StaticLibrary - true + false v142 MultiByte @@ -136,7 +136,7 @@ true _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) true - MultiThreadedDebug + MultiThreaded Default true diff --git a/libultraship/libultraship/DisplayList.cpp b/libultraship/libultraship/DisplayList.cpp index 93d53a24b..64c578351 100644 --- a/libultraship/libultraship/DisplayList.cpp +++ b/libultraship/libultraship/DisplayList.cpp @@ -12,20 +12,51 @@ namespace Ship while (reader->GetBaseAddress() % 8 != 0) reader->ReadByte(); - while (true) + if (sizeof(uintptr_t) < 8) { - uint64_t data = reader->ReadUInt64(); + while (true) + { + uint64_t data = reader->ReadUInt64(); - dl->instructions.push_back(data); - - uint8_t opcode = data >> 24; + dl->instructions.push_back(data); - // These are 128-bit commands, so read an extra 64 bits... - if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR) - dl->instructions.push_back(reader->ReadUInt64()); + uint8_t opcode = data >> 24; - if (opcode == G_ENDDL) - break; + // These are 128-bit commands, so read an extra 64 bits... + if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR) + dl->instructions.push_back(reader->ReadUInt64()); + + if (opcode == G_ENDDL) + break; + } + } + else + { + while (true) + { + uint64_t data = reader->ReadUInt64(); + uint32_t w0 = (uint32_t)data; + uint32_t w1 = (uint32_t)(data >> 32); + + dl->instructions.push_back(w0); + dl->instructions.push_back(w1); + + uint8_t opcode = (uint8_t)(w0 >> 24); + + if (opcode == G_SETTIMG_OTR || opcode == G_DL_OTR || opcode == G_VTX_OTR || opcode == G_BRANCH_Z_OTR || opcode == G_MARKER || opcode == G_MTX_OTR) + { + data = reader->ReadUInt64(); + + w0 = (uint32_t)data; + w1 = (uint32_t)(data >> 32); + + dl->instructions.push_back(w0); + dl->instructions.push_back(w1); + } + + if (opcode == G_ENDDL) + break; + } } } } \ No newline at end of file diff --git a/libultraship/libultraship/Lib/Fast3D/U64/PR/ultra64/gbi.h b/libultraship/libultraship/Lib/Fast3D/U64/PR/ultra64/gbi.h index a9e4f035e..b2afedfc3 100644 --- a/libultraship/libultraship/Lib/Fast3D/U64/PR/ultra64/gbi.h +++ b/libultraship/libultraship/Lib/Fast3D/U64/PR/ultra64/gbi.h @@ -1637,13 +1637,19 @@ typedef struct { * Generic Gfx Packet */ typedef struct { - unsigned int w0; - unsigned int w1; + uintptr_t w0; + uintptr_t w1; //unsigned long long w0; //unsigned long long w1; } Gwords; +#ifdef __cplusplus +static_assert(sizeof(Gwords) == 2 * sizeof(void*), "fail"); +#else +//_Static_assert(sizeof(Gwords) == 2 * sizeof(void*), "fail"); +#endif + /* * This union is the fundamental type of the display list. * It is, by law, exactly 64 bits in size. @@ -1684,12 +1690,12 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24); \ - _g->words.w1 = (unsigned int)(s); \ + _g->words.w1 = (uintptr_t)(s); \ }) #define gsDma0p(c, s, l) \ { \ - _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (unsigned int)(s) \ + _SHIFTL((c), 24, 8) | _SHIFTL((l), 0, 24), (uintptr_t)(s) \ } #define gDma1p(pkt, c, s, l, p) \ @@ -1698,14 +1704,14 @@ _DW({ \ \ _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ _SHIFTL((l), 0, 16)); \ - _g->words.w1 = (unsigned int)(s); \ + _g->words.w1 = (uintptr_t)(s); \ }) #define gsDma1p(c, s, l, p) \ { \ (_SHIFTL((c), 24, 8) | _SHIFTL((p), 16, 8) | \ _SHIFTL((l), 0, 16)), \ - (unsigned int)(s) \ + (uintptr_t)(s) \ } #define gDma2p(pkt, c, adrs, len, idx, ofs) \ @@ -1713,13 +1719,13 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)); \ - _g->words.w1 = (unsigned int)(adrs); \ + _g->words.w1 = (uintptr_t)(adrs); \ }) #define gsDma2p(c, adrs, len, idx, ofs) \ { \ (_SHIFTL((c),24,8)|_SHIFTL(((len)-1)/8,19,5)| \ _SHIFTL((ofs)/8,8,8)|_SHIFTL((idx),0,8)), \ - (unsigned int)(adrs) \ + (uintptr_t)(adrs) \ } #define gSPNoOp(pkt) gDma0p(pkt, G_SPNOOP, 0, 0) @@ -1750,12 +1756,12 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = \ _SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7); \ - _g->words.w1 = (unsigned int)(v); \ + _g->words.w1 = (uintptr_t)(v); \ }) # define gsSPVertex(v, n, v0) \ { \ (_SHIFTL(G_VTX,24,8)|_SHIFTL((n),12,8)|_SHIFTL((v0)+(n),1,7)), \ - (unsigned int)(v) \ + (uintptr_t)(v) \ } #elif (defined(F3DEX_GBI)||defined(F3DLP_GBI)) /* @@ -1820,12 +1826,12 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ \ _g->words.w0 = _SHIFTL((c), 24, 8); \ - _g->words.w1 = (unsigned int)(p0); \ + _g->words.w1 = (uintptr_t)(p0); \ }) #define gsImmp1(c, p0) \ { \ - _SHIFTL((c), 24, 8), (unsigned int)(p0) \ + _SHIFTL((c), 24, 8), (uintptr_t)(p0) \ } #define gImmp2(pkt, c, p0, p1) \ @@ -1862,13 +1868,13 @@ _DW({ \ \ _g->words.w0 = (_SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | \ _SHIFTL((p1), 0, 8)); \ - _g->words.w1 = (unsigned int) (dat); \ + _g->words.w1 = (uintptr_t) (dat); \ }) #define gsImmp21(c, p0, p1, dat) \ { \ _SHIFTL((c), 24, 8) | _SHIFTL((p0), 8, 16) | _SHIFTL((p1), 0, 8),\ - (unsigned int) (dat) \ + (uintptr_t) (dat) \ } #ifdef F3DEX_GBI_2 @@ -2308,7 +2314,7 @@ _DW({ \ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(dl); \ + _g->words.w1 = (uintptr_t)(dl); \ _g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \ _SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \ @@ -2317,7 +2323,7 @@ _DW({ \ #define gsSPBranchLessZrg(dl, vtx, zval, near, far, flag, zmin, zmax) \ { _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(dl), }, \ + (uintptr_t)(dl), }, \ { _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\ G_DEPTOZSrg(zval, near, far, flag, zmin, zmax), } @@ -2337,18 +2343,18 @@ _DW({ \ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(dl); \ + _g->words.w1 = (uintptr_t)(dl); \ _g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL(G_BRANCH_Z,24,8)| \ _SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12)); \ - _g->words.w1 = (unsigned int)(zval); \ + _g->words.w1 = (uintptr_t)(zval); \ }) #define gsSPBranchLessZraw(dl, vtx, zval) \ { _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(dl), }, \ + (uintptr_t)(dl), }, \ { _SHIFTL(G_BRANCH_Z,24,8)|_SHIFTL((vtx)*5,12,12)|_SHIFTL((vtx)*2,0,12),\ - (unsigned int)(zval), } + (uintptr_t)(zval), } /* * gSPLoadUcode RSP loads specified ucode. @@ -2360,19 +2366,19 @@ _DW({ \ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = _SHIFTL(G_RDPHALF_1,24,8); \ - _g->words.w1 = (unsigned int)(uc_dstart); \ + _g->words.w1 = (uintptr_t)(uc_dstart); \ _g = (Gfx *)(pkt); \ _g->words.w0 = (_SHIFTL(G_LOAD_UCODE,24,8)| \ _SHIFTL((int)(uc_dsize)-1,0,16)); \ - _g->words.w1 = (unsigned int)(uc_start); \ + _g->words.w1 = (uintptr_t)(uc_start); \ }) #define gsSPLoadUcodeEx(uc_start, uc_dstart, uc_dsize) \ { _SHIFTL(G_RDPHALF_1,24,8), \ - (unsigned int)(uc_dstart), }, \ + (uintptr_t)(uc_dstart), }, \ { _SHIFTL(G_LOAD_UCODE,24,8)| \ _SHIFTL((int)(uc_dsize)-1,0,16), \ - (unsigned int)(uc_start), } + (uintptr_t)(uc_start), } #define gSPLoadUcode(pkt, uc_start, uc_dstart) \ gSPLoadUcodeEx((pkt), (uc_start), (uc_dstart), SP_UCODE_DATA_SIZE) @@ -2396,14 +2402,14 @@ _DW({ \ Gfx *_g = (Gfx *)(pkt); \ _g->words.w0 = _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \ _SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12); \ - _g->words.w1 = (unsigned int)(dram); \ + _g->words.w1 = (uintptr_t)(dram); \ }) #define gsSPDma_io(flag, dmem, dram, size) \ { \ _SHIFTL(G_DMA_IO,24,8)|_SHIFTL((flag),23,1)| \ _SHIFTL((dmem)/8,13,10)|_SHIFTL((size)-1,0,12), \ - (unsigned int)(dram) \ + (uintptr_t)(dram) \ } #define gSPDmaRead(pkt,dmem,dram,size) gSPDma_io((pkt),0,(dmem),(dram),(size)) @@ -3018,14 +3024,14 @@ _DW({ \ \ _g->words.w0 = _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12); \ - _g->words.w1 = (unsigned int)(i); \ + _g->words.w1 = (uintptr_t)(i); \ }) #define gsSetImage(cmd, fmt, siz, width, i) \ { \ _SHIFTL(cmd, 24, 8) | _SHIFTL(fmt, 21, 3) | \ _SHIFTL(siz, 19, 2) | _SHIFTL((width)-1, 0, 12), \ - (unsigned int)(i) \ + (uintptr_t)(i) \ } #define gDPSetColorImage(pkt, f, s, w, i) gSetImage(pkt, G_SETCIMG, f, s, w, i) diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index 6f7e8c271..cc1c0f5c9 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -1586,7 +1586,7 @@ static void gfx_sp_movemem(uint8_t index, uint8_t offset, const void* data) { } } -static void gfx_sp_moveword(uint8_t index, uint16_t offset, uint32_t data) { +static void gfx_sp_moveword(uint8_t index, uint16_t offset, uintptr_t data) { switch (index) { case G_MW_NUMLIGHT: #ifdef F3DEX_GBI_2 diff --git a/libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib b/libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib index 6d70cc20f..b603beb6c 100644 Binary files a/libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib and b/libultraship/libultraship/Lib/SDL/lib/x64/SDL2.lib differ diff --git a/libultraship/libultraship/Resource.cpp b/libultraship/libultraship/Resource.cpp index 04fc2bfbb..b1a99208d 100644 --- a/libultraship/libultraship/Resource.cpp +++ b/libultraship/libultraship/Resource.cpp @@ -46,7 +46,7 @@ namespace Ship { auto res = (Ship::DisplayList*)resShared.get(); - Gfx* gfx = (Gfx*)&res->instructions[patches[i].index]; + Gfx* gfx = &((Gfx*)res->instructions.data())[patches[i].index]; gfx->words.w1 = patches[i].origData; } } diff --git a/libultraship/libultraship/libultraship.vcxproj b/libultraship/libultraship/libultraship.vcxproj index b3448e7b0..1ec69e683 100644 --- a/libultraship/libultraship/libultraship.vcxproj +++ b/libultraship/libultraship/libultraship.vcxproj @@ -204,7 +204,7 @@ Level3 true - SPDLOG_ACTIVE_LEVEL=0;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_DX11;ENABLE_OPENGL;%(PreprocessorDefinitions) + SPDLOG_ACTIVE_LEVEL=0;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC true stdcpp20 stdc17 @@ -238,7 +238,7 @@ true true true - SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions) + SPDLOG_ACTIVE_LEVEL=0;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;ENABLE_DX11;%(PreprocessorDefinitions)GLEW_STATIC true stdcpplatest stdc11 @@ -446,4 +446,15 @@ + + + + + {02d10590-9542-3f55-aaf8-6055677e2a2a} + false + + + + + \ No newline at end of file diff --git a/soh/include/functions.h b/soh/include/functions.h index 4631cdb92..0b32e4cdd 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -2176,10 +2176,10 @@ f32 Math_FAtanF(f32 x); f32 Math_FAtan2F(f32 y, f32 x); f32 Math_FAsinF(f32 x); f32 Math_FAcosF(f32 x); -f32 ceilf(f32 x); +/*f32 ceilf(f32 x); f32 truncf(f32 x); f32 roundf(f32 x); -f32 nearbyintf(f32 x); +f32 nearbyintf(f32 x);*/ void SystemArena_CheckPointer(void* ptr, size_t size, const char* name, const char* action); void* SystemArena_Malloc(size_t size); void* SystemArena_MallocDebug(size_t size, const char* file, s32 line); diff --git a/soh/soh.vcxproj b/soh/soh.vcxproj index 0a2006122..385ab9200 100644 --- a/soh/soh.vcxproj +++ b/soh/soh.vcxproj @@ -85,12 +85,12 @@ true - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(IncludePath) + $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath) $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(LibraryPath) false - $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(IncludePath) + $(ProjectDir)assets;$(ProjectDir)build;$(ProjectDir)include;$(ProjectDir)src;$(ProjectDir);$(ProjectDir)..\libultraship\libultraship\Lib\libjpeg\include;$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\spdlog\include;$(ProjectDir)..\ZAPDTR\ZAPDUtils;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64;$(ProjectDir)..\libultraship\libultraship\Lib\Fast3D\U64\PR;$(ProjectDir)..\libultraship\libultraship\Lib\SDL;$(IncludePath) $(OutDir);$(ProjectDir)..\libultraship\libultraship;$(ProjectDir)..\libultraship\libultraship\Lib\SDL\lib\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLEW\x64;$(ProjectDir)..\libultraship\libultraship\Lib\GLFW;$(LibraryPath) @@ -100,14 +100,14 @@ NOINCLUDE_GAME_PRINTF;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;ENABLE_OPENGL;%(PreprocessorDefinitions) true stdcpp20 - MultiThreadedDebug + MultiThreaded true StackFrameRuntimeCheck Console true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) + libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) 8777216 true true @@ -131,7 +131,7 @@ true true true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) + libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) /FORCE:MULTIPLE %(AdditionalOptions) @@ -148,7 +148,7 @@ Console true - libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glfw3dll.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) + libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) /FORCE:MULTIPLE %(AdditionalOptions) @@ -156,13 +156,15 @@ - Level3 + TurnOffAllWarnings true true - true - INCLUDE_GAME_PRINTF;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)GLEW_STATIC + false + INCLUDE_GAME_PRINTF;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)GLEW_STATIC true true + stdcpp20 + MultiThreaded Console @@ -170,6 +172,7 @@ true true /FORCE:MULTIPLE %(AdditionalOptions) + libultraship.lib;ZAPDUtils.lib;opengl32.lib;glu32.lib;SDL2.lib;SDL2main.lib;glew32s.lib;winmm.lib;imm32.lib;version.lib;setupapi.lib;%(AdditionalDependencies) diff --git a/soh/soh.vcxproj.filters b/soh/soh.vcxproj.filters index 04f6030a8..b6af70eb9 100644 --- a/soh/soh.vcxproj.filters +++ b/soh/soh.vcxproj.filters @@ -1,87 +1,710 @@  - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {8d479b58-9306-40c3-9728-2cf5b185f5c4} - - - {8ebc52ba-5b1d-4bb3-9848-ba9ea57fc49f} - - - {54c2fe99-a68e-4ce2-813d-bce0ab1ac24f} - - - {0b91ecc8-6f20-4da1-87ca-6c7263aab3db} - - - {2104d3ab-707c-4ab2-bb1a-5cdce5c3d07d} - - - {022552c8-3bb8-4ba5-904c-e2c3eb28ce10} - - - {3ab8c311-cbfb-4eca-88af-2446ce3c89b0} - - - {8f2da1b8-973e-4be0-a036-c79a63bc3067} - - - {1a584bc2-7081-4251-a953-cdc7b611d62b} - - - {49bb84e4-a0b9-4733-9720-1ea120795083} - - - {d4794b4c-ae5d-4bf0-96f4-077f03807f5e} - - - {981df102-b362-4e2b-8efc-62756c28aa60} - - - {f8b2165f-9b32-4be1-a285-49349e09bef5} - - - {fcaae731-4e17-448b-b6c7-36e4c8413838} - - - {264ed8f8-f42b-475f-82ca-c264225ef56c} - - - {5fde6633-a728-4eea-a616-59d413bec476} - - - {3aeae6ac-1340-4a7b-bf34-cd196667fe37} - - - {fe745190-d4ec-4dc3-a9fd-ea553a971b14} - - - {06ba0ec4-2ee7-4454-93b5-5fd804723b6d} - - - {ffe200b9-a955-4843-a1ce-3603c132e591} - - - {18b9727f-30de-4ab8-a317-916090d4a110} - - - {9a4378ec-e30f-47b6-9ad6-5ce738b4cf99} - - - {04fc1c52-49ff-48e2-ae23-2c00867374f8} - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3761,18 +4384,9 @@ - - Header Files\include - + - - Resource Files - - - - - Resource Files - + \ No newline at end of file diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index e8e1b31c1..ebc4b3621 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -177,7 +177,7 @@ extern "C" void Graph_StartFrame() { extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(CVar_GetS32("g60FPS", 0) == 0 ? R_UPDATE_RATE : 1); - if (!audio.initialized) { + if (!audio.initialized && 0) { audio.initialized = true; std::thread([]() { for (;;) { @@ -235,7 +235,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { OTRGlobals::Instance->context->GetWindow()->RunCommands(commands, mtx_replacements); - { + if (0) { std::unique_lock Lock(audio.mutex); while (audio.processing) { audio.cv_from_thread.wait(Lock); @@ -512,10 +512,10 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData) { uintptr_t i = (uintptr_t)(imgData); - if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1) + if ((i & 1) == 1) return 0; - if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) { + if (i != 0) { if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' && imgData[5] == '_' && imgData[6] == '_') return 1; diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 0a318de73..7e58e3813 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -37,18 +37,22 @@ uint32_t ResourceMgr_GetGameVersion(); void ResourceMgr_CacheDirectory(const char* resName); void ResourceMgr_LoadFile(const char* resName); char* ResourceMgr_LoadFileFromDisk(const char* filePath); +char* ResourceMgr_LoadJPEG(char* data, int dataSize); char* ResourceMgr_LoadTexByName(const char* texPath); char* ResourceMgr_LoadTexOrDListByName(const char* filePath); char* ResourceMgr_LoadPlayerAnimByName(const char* animPath); +AnimationHeaderCommon* ResourceMgr_LoadAnimByName(const char* path); char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc); Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc); Gfx* ResourceMgr_LoadGfxByName(const char* path); Gfx* ResourceMgr_PatchGfxByName(const char* path, int size); +char* ResourceMgr_LoadArrayByNameAsVec3s(const char* path); Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc); Vtx* ResourceMgr_LoadVtxByName(const char* path); CollisionHeader* ResourceMgr_LoadColByName(const char* path); uint64_t GetPerfCounter(); struct SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path); +s32* ResourceMgr_LoadCSByName(const char* path); int ResourceMgr_OTRSigCheck(char* imgData); uint64_t osGetTime(void); uint32_t osGetCount(void); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 123f9c636..fb215cd13 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -449,6 +449,7 @@ bool func_8009899C(GlobalContext* globalCtx, Ship::SceneCommand* cmd) k = 0; //i = globalCtx->objectCtx.unk_09; + i = 0; firstStatus = &globalCtx->objectCtx.status[0]; status = &globalCtx->objectCtx.status[i]; @@ -913,7 +914,7 @@ extern "C" s32 OTRfunc_8009728C(GlobalContext* globalCtx, RoomContext* roomCtx, return 0; // UH OH size = globalCtx->roomList[roomNum].vromEnd - globalCtx->roomList[roomNum].vromStart; - roomCtx->unk_34 = (void*)ALIGN16((u32)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); + roomCtx->unk_34 = (void*)ALIGN16((uintptr_t)roomCtx->bufPtrs[roomCtx->unk_30] - ((size + 8) * roomCtx->unk_30 + 7)); osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); //DmaMgr_SendRequest2(&roomCtx->dmaRequest, roomCtx->unk_34, globalCtx->roomList[roomNum].vromStart, size, 0, diff --git a/soh/src/code/audioMgr.c b/soh/src/code/audioMgr.c index 5b46ad8eb..231fb5087 100644 --- a/soh/src/code/audioMgr.c +++ b/soh/src/code/audioMgr.c @@ -84,6 +84,7 @@ void AudioMgr_Unlock(AudioMgr* audioMgr) { } void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedContext* sched, IrqMgr* irqMgr) { + return; // OTRTODO64 AudioPlayer_Init(); memset(audioMgr,0, sizeof(AudioMgr)); diff --git a/soh/src/code/code_800C3C20.c b/soh/src/code/code_800C3C20.c index bd3b37850..b7090f4e3 100644 --- a/soh/src/code/code_800C3C20.c +++ b/soh/src/code/code_800C3C20.c @@ -7,6 +7,8 @@ u8 D_8012D200[] = { void func_800C3C20(void) { s32 i; + return; // OTRTODO64 + for (i = 0; (i < ARRAY_COUNT(D_8012D200)) & 0xFFFFFFFF; i++) { Audio_StopSfxByBank(D_8012D200[i]); } diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index 23d1ba375..5d61d170e 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -3502,6 +3502,7 @@ void func_800F4A70(void); void func_800F5CF8(void); void func_800F3054(void) { + return; // OTRTODO64 if (func_800FAD34() == 0) { sAudioUpdateTaskStart = gAudioContext.totalTaskCnt; sAudioUpdateStartTime = osGetTime(); @@ -4420,6 +4421,8 @@ void func_800F5918(void) { void func_800F595C(u16 arg0) { u8 arg0b = arg0 & 0xFF; + return; // OTRTODO60 + if (sSeqFlags[arg0b] & 2) { Audio_PlayFanfare(arg0); } else if (sSeqFlags[arg0b] & 4) { @@ -4524,6 +4527,8 @@ void Audio_PlayFanfare(u16 seqId) u8* sp1C; u8* sp18; + return; // OTRTODO64 + sp26 = func_800FA0B4(SEQ_PLAYER_FANFARE); sp1C = func_800E5E84(sp26 & 0xFF, &sp20); sp18 = func_800E5E84(seqId & 0xFF, &sp20); diff --git a/soh/src/code/code_800F7260.c b/soh/src/code/code_800F7260.c index bd8e4091f..bdc3a64ac 100644 --- a/soh/src/code/code_800F7260.c +++ b/soh/src/code/code_800F7260.c @@ -579,6 +579,8 @@ void func_800F8884(u8 bankId, Vec3f* pos) { u8 entryIndex = gSoundBanks[bankId][0].next; u8 prevEntryIndex = 0; + return; // OTRTODO64 + while (entryIndex != 0xFF) { entry = &gSoundBanks[bankId][entryIndex]; if (entry->posX == &pos->x) { @@ -676,6 +678,7 @@ void Audio_StopSfxById(u32 sfxId) { u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next; u8 prevEntryIndex = 0; SoundBankEntry cmp; + return; // OTRTODO64 while (entryIndex != 0xFF) { entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex]; @@ -737,6 +740,7 @@ void func_800F8F88(void) { u8 Audio_IsSfxPlaying(u32 sfxId) { + return; // OTRTODO64 SoundBankEntry* entry; u8 entryIndex = gSoundBanks[SFX_BANK(sfxId)][0].next; diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index 811b0bea1..7c8d86dfa 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -1516,7 +1516,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, GlobalContext* globalCtx, Collis if (globalCtx->sceneNum == SCENE_MALON_STABLE) { // "/* BGCheck LonLon Size %dbyte */\n" osSyncPrintf("/* BGCheck LonLonサイズ %dbyte */\n", 0x3520); - colCtx->memSize = 0x3520; + colCtx->memSize = 0x3520 * (sizeof(void*) / 4); // 64-bit build needs more memory } else { // "/* BGCheck Mini Size %dbyte */\n" osSyncPrintf("/* BGCheck ミニサイズ %dbyte */\n", 0x4E20); diff --git a/soh/src/code/z_kanfont.c b/soh/src/code/z_kanfont.c index c7f3234bb..7ba2b6d00 100644 --- a/soh/src/code/z_kanfont.c +++ b/soh/src/code/z_kanfont.c @@ -194,7 +194,7 @@ void Font_LoadOrderedFont(Font* font) { size_t len; size_t jj; s32 fontStatic; - u32 fontBuf; + u8* fontBuf; s32 codePointIndex; s32 fontBufIndex; s32 offset; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 632ed41f6..d685d9a53 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -198,8 +198,8 @@ void Gameplay_Init(GameState* thisx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; gGlobalCtx = globalCtx; //globalCtx->state.gfxCtx = NULL; - u32 zAlloc; - u32 zAllocAligned; + uintptr_t zAlloc; + uintptr_t zAllocAligned; size_t zAllocSize; Player* player; s32 playerStartCamId; diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 5212799a6..d3e1171ea 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -554,7 +554,7 @@ u32 func_80096FE8(GlobalContext* globalCtx, RoomContext* roomCtx) { roomCtx->bufPtrs[0] = GameState_Alloc(&globalCtx->state, maxRoomSize, "../z_room.c", 946); // "Room buffer initial pointer=%08x" osSyncPrintf("部屋バッファ開始ポインタ=%08x\n", roomCtx->bufPtrs[0]); - roomCtx->bufPtrs[1] = (void*)((s32)roomCtx->bufPtrs[0] + maxRoomSize); + roomCtx->bufPtrs[1] = (void*)((intptr_t)roomCtx->bufPtrs[0] + maxRoomSize); // "Room buffer end pointer=%08x" osSyncPrintf("部屋バッファ終了ポインタ=%08x\n", roomCtx->bufPtrs[1]); osSyncPrintf(VT_RST); diff --git a/soh/src/code/z_scene.c b/soh/src/code/z_scene.c index fe311aa63..e6dbf64d3 100644 --- a/soh/src/code/z_scene.c +++ b/soh/src/code/z_scene.c @@ -61,6 +61,7 @@ void Object_InitBank(GlobalContext* globalCtx, ObjectContext* objectCtx) { for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = OBJECT_INVALID; + objectCtx->status[i].segment = NULL; } osSyncPrintf(VT_FGCOL(GREEN)); diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index 6dbfac7ef..cb066c5e3 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -857,7 +857,7 @@ void AnimationContext_SetLoadFrame(GlobalContext* globalCtx, LinkAnimationHeader animation = ResourceMgr_LoadAnimByName(animation); LinkAnimationHeader* linkAnimHeader = SEGMENTED_TO_VIRTUAL(animation); - u32 ram = frameTable; + Vec3s* ram = frameTable; osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1); diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 51da01932..3b9cebc25 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -2370,7 +2370,7 @@ void EnHorse_CutsceneUpdate(EnHorse* this, GlobalContext* globalCtx) { EnHorse_Freeze(this); return; } - if (linkCsAction != 0 && linkCsAction != 0xABABABAB) { + if (linkCsAction != 0 && (uint32_t)(uintptr_t)linkCsAction != 0xABABABAB) { csFunctionIdx = EnHorse_GetCutsceneFunctionIndex(linkCsAction->action); if (csFunctionIdx != 0) { if (this->cutsceneAction != csFunctionIdx) { diff --git a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 10fdd7c62..17b884982 100644 --- a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -204,6 +204,7 @@ void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnRiverSound_Draw(Actor* thisx, GlobalContext* globalCtx) { + return; // OTRTODO64 static s16 soundEffects[] = { 0, NA_SE_EV_WATER_WALL - SFX_FLAG, diff --git a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c index f91bc16ae..f979a37f3 100644 --- a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -660,7 +660,7 @@ void func_80AF68E4(EnSa* this, GlobalContext* globalCtx) { EnSa_ChangeAnim(this, csAction->action); this->unk_210 = csAction->action; } - if (phi_v0) {} + //if (phi_v0) {} if (csAction->action == 3) { if (this->unk_20C == 0) { phi_v0 = 0; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 24ad28c4a..8f18cb219 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -9419,7 +9419,7 @@ void Player_Init(Actor* thisx, GlobalContext* globalCtx2) { Player_SetEquipmentData(globalCtx, this); this->prevBoots = this->currentBoots; Player_InitCommon(this, globalCtx, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); - this->giObjectSegment = (void*)(((u32)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF); + this->giObjectSegment = (void*)(((uintptr_t)ZeldaArena_MallocDebug(0x3008, "../z_player.c", 17175) + 8) & ~0xF); sp50 = gSaveContext.respawnFlag; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 27575c3b6..28c6ac2c8 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -135,7 +135,7 @@ void KaleidoScope_DrawEquipment(GlobalContext* globalCtx) { u16 pad; s16 cursorMoveResult; u16 cursorItem; - u16 cursorSlot; + u16 cursorSlot = 0; s16 cursorPoint; s16 cursorX; s16 cursorY; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 4dbb1b20f..7d4435788 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -3036,11 +3036,11 @@ void KaleidoScope_Update(GlobalContext* globalCtx) GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; Player* player = GET_PLAYER(globalCtx); Input* input = &globalCtx->state.input[0]; - size_t size; - size_t size0; - size_t size1; - size_t size2; - u16 i; + size_t size = 0; + size_t size0 = 0; + size_t size1 = 0; + size_t size2 = 0; + u16 i = 0; s16 stepR; s16 stepG; s16 stepB; @@ -3103,7 +3103,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) //DmaMgr_SendRequest1(pauseCtx->iconItem24Segment, (uintptr_t)_icon_item_24_staticSegmentRomStart, size, //"../z_kaleido_scope_PAL.c", 3675); - pauseCtx->iconItemAltSegment = (void*)(((uintptr_t)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF); + //pauseCtx->iconItemAltSegment = (void*)(((uintptr_t)pauseCtx->iconItem24Segment + size + 0xF) & ~0xF); #endif switch (globalCtx->sceneNum) { @@ -3151,7 +3151,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) // OTRTODO: LANGUAGE SUPPORT #if 1 - pauseCtx->iconItemLangSegment = (void*)(((uintptr_t)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF); + //pauseCtx->iconItemLangSegment = (void*)(((uintptr_t)pauseCtx->iconItemAltSegment + size2 + 0xF) & ~0xF); if (gSaveContext.language == LANGUAGE_ENG) { //size = (uintptr_t)_icon_item_nes_staticSegmentRomEnd - (uintptr_t)_icon_item_nes_staticSegmentRomStart;