Pr before release (#239)

* Fix match

* Update torch

* fix crash on texture of player

* Copied stuff over for Window icon from Starship.

* Missed comment.

* Corrections.

* Missed a file

* min-max fix

* Update code_80005FD0.c

* Remove interpolation for hm_intro

* look like to remove the crash in menu

* Update menu_items.c

---------

Co-authored-by: MegaMech <7255464+MegaMech@users.noreply.github.com>
Co-authored-by: sitton76 <58642183+sitton76@users.noreply.github.com>
Co-authored-by: MegaMech <MegaMech@users.noreply.github.com>
This commit is contained in:
coco875 2025-06-20 22:54:31 +00:00 committed by GitHub
parent 2126c94a0e
commit e93633773e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 278 additions and 67 deletions

View File

@ -4,6 +4,22 @@ cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
project(Spaghettify VERSION 0.1.0 LANGUAGES C CXX ASM)
include(FetchContent)
set(NATO_PHONETIC_ALPHABET
"Alfa" "Bravo" "Charlie" "Delta" "Echo" "Foxtrot" "Golf" "Hotel"
"India" "Juliett" "Kilo" "Lima" "Mike" "November" "Oscar" "Papa"
"Quebec" "Romeo" "Sierra" "Tango" "Uniform" "Victor" "Whiskey"
"Xray" "Yankee" "Zulu"
)
# Get the patch version number from the project version
math(EXPR PATCH_INDEX "${PROJECT_VERSION_PATCH}")
# Use the patch number to select the correct word
list(GET NATO_PHONETIC_ALPHABET ${PATCH_INDEX} PROJECT_PATCH_WORD)
set(PROJECT_BUILD_NAME "Alfredo ${PROJECT_PATCH_WORD}" CACHE STRING "" FORCE)
set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "" FORCE)
if(APPLE)
enable_language(OBJCXX)
endif()
@ -115,6 +131,10 @@ if (UNIX AND NOT APPLE)
find_package(OpenGL REQUIRED)
endif()
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY)
endif()
# Include directories
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
@ -188,6 +208,7 @@ file(GLOB_RECURSE ALL_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
"src/enhancements/freecam/*.h"
"src/engine/*.cpp"
"src/engine/*.h"
"Resource.rc"
)
list(APPEND ALL_FILES ${ALL_FILES_ROOT})
@ -321,6 +342,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
"NDEBUG"
">"
"INCLUDE_GAME_PRINTF;"
"NOMINMAX"
"UNICODE;"
"_UNICODE;"
"_CRT_SECURE_NO_WARNINGS;"

16
ExecutableResource.h Normal file
View File

@ -0,0 +1,16 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by Resource.rc
//
#define IDI_ICON1 111
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 113
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

115
Resource.rc Normal file
View File

@ -0,0 +1,115 @@
// Microsoft Visual C++ generated resource script.
//
#include "ExecutableResource.h"
#include "properties.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (United States) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"ExecutableResource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version Info
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS VS_FF_DEBUG
#else
FILEFLAGS 0x0L
#endif
FILEOS VOS_NT_WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_str
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON1 ICON "spaghettikart.ico"
/////////////////////////////////////////////////////////////////////////////
//
// RT_MANIFEST
//
1 RT_MANIFEST "spaghettikart.manifest"
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

14
properties.h Normal file
View File

@ -0,0 +1,14 @@
#define VER_FILEVERSION 0, 1, 0, 0
#define VER_FILEVERSION_STR "0.1.0\0"
#define VER_PRODUCTVERSION 0, 1, 0, 0
#define VER_PRODUCTVERSION_str "0.1.0\0"
#define VER_COMPANYNAME_STR "Spaghettikart Team - Harbourmasters\0"
#define VER_PRODUCTNAME_STR "Spaghettikart\0"
#define VER_INTERNALNAME_STR "Spaghettikart\0"
#define VER_ORIGINALFILENAME_STR "Spaghettify.exe\0"
#define VER_FILEDESCRIPTION_STR "Spaghettikart - Alfredo Alfa\0"

14
properties.h.in Normal file
View File

@ -0,0 +1,14 @@
#define VER_FILEVERSION @CMAKE_PROJECT_VERSION_MAJOR@, @CMAKE_PROJECT_VERSION_MINOR@, @CMAKE_PROJECT_VERSION_PATCH@, 0
#define VER_FILEVERSION_STR "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@\0"
#define VER_PRODUCTVERSION @CMAKE_PROJECT_VERSION_MAJOR@, @CMAKE_PROJECT_VERSION_MINOR@, @CMAKE_PROJECT_VERSION_PATCH@, 0
#define VER_PRODUCTVERSION_str "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@.@CMAKE_PROJECT_VERSION_PATCH@\0"
#define VER_COMPANYNAME_STR "@PROJECT_TEAM@\0"
#define VER_PRODUCTNAME_STR "Spaghettikart\0"
#define VER_INTERNALNAME_STR "@PROJECT_NAME@\0"
#define VER_ORIGINALFILENAME_STR "@PROJECT_NAME@.exe\0"
#define VER_FILEDESCRIPTION_STR "Spaghettikart - @PROJECT_BUILD_NAME@\0"

BIN
spaghettikart.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

37
spaghettikart.manifest Normal file
View File

@ -0,0 +1,37 @@
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="*" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level='asInvoker' uiAccess='false' />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<asmv3:windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- legacy -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to pm if pmv2 is not available -->
</asmv3:windowsSettings>
</asmv3:application>
</assembly>

View File

@ -5924,15 +5924,12 @@ void func_80016C3C(UNUSED s32 playerId, UNUSED f32 arg1, s32 cameraId) {
}
void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32 cameraId);
#ifdef NON_MATCHING
// https://decomp.me/scratch/Ck7hV
// Really crazy diff, permuter only able to find fakematches for improvements (and they're big improvements)
// There's something really, really wrong with the empty `if` statement
void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32 cameraId) {
s32 pad5[2];
f32 diffX2;
f32 diffY2;
f32 diffZ2;
s32 stackPadding0;
s32 stackPadding1;
f32 spAC;
f32 spA8;
f32 spA4;
s32 stackPadding2;
s32 stackPadding3;
f32 camX;
@ -5942,36 +5939,33 @@ void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32
f32 lookAtY;
f32 lookAtZ;
f32 diffX;
f32 diffZ;
f32 diffY;
f32 distance;
s32 pad;
f32 diffZ;
s32 stackPadding7;
s32 stackPadding8;
s16 waypoint1;
s16 waypoint2;
s32 pad2[3];
f32 stackPadding9;
s32 playerId;
f32 distance;
s32 pathIndex;
s32 pad3;
s32 sp58;
s16 sp56;
s32 playerId;
playerId = camera->playerId;
pathIndex = D_80163DD8[cameraId];
D_80164648[cameraId] += (D_80164658[cameraId] - D_80164648[cameraId]) * 0.5f;
pathIndex = D_80163DD8[cameraId];
sp58 = gPathCountByPathIndex[pathIndex];
D_80163238 = playerId;
sp56 = gNearestPathPointByCameraId[cameraId];
gNearestPathPointByCameraId[cameraId] =
func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestPathPointByCameraId[cameraId], pathIndex);
gNearestPathPointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestPathPointByCameraId[cameraId], pathIndex);
if (IsYoshiValley()) {
if ((sp56 != gNearestPathPointByCameraId[cameraId]) && (gNearestPathPointByCameraId[cameraId] == 1)) {
pathIndex = (D_80163DD8[cameraId] = random_int(4U));
gNearestPathPointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2],
gNearestPathPointByCameraId[cameraId], pathIndex);
D_80163DD8[cameraId] = random_int(4);
pathIndex = D_80163DD8[cameraId];
gNearestPathPointByCameraId[cameraId] = func_8000D33C(camera->pos[0], camera->pos[1], camera->pos[2], gNearestPathPointByCameraId[cameraId], pathIndex);
}
}
// LookAt XZ 0xA points ahead
waypoint1 = (gNearestPathPointByCameraId[cameraId] + 0xA) % sp58;
waypoint2 = (gNearestPathPointByCameraId[cameraId] + 0xB) % sp58;
set_track_offset_position(waypoint1, D_80164688[cameraId], pathIndex);
@ -5981,7 +5975,6 @@ void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32
lookAtX += gOffsetPosition[0] * 0.5;
lookAtZ += gOffsetPosition[2] * 0.5;
// LookAt Y 5 points ahead
waypoint1 = (gNearestPathPointByCameraId[cameraId] + 5) % sp58;
waypoint2 = (gNearestPathPointByCameraId[cameraId] + 6) % sp58;
lookAtY = (gTrackPaths[pathIndex][waypoint1].posY + gTrackPaths[pathIndex][waypoint2].posY) * 0.5f;
@ -5998,49 +5991,42 @@ void func_80017054(Camera* camera, UNUSED Player* player, UNUSED s32 index, s32
diffX = camX - D_801645F8[cameraId];
diffY = camY - D_80164618[cameraId];
diffZ = camZ - D_80164638[cameraId];
// magnitude
#define SQ(x) (x * x)
distance = sqrtf(SQ(diffX) + SQ(diffY) + SQ(diffZ));
distance = sqrtf(((diffX * diffX) + (diffY * diffY)) + (diffZ * diffZ));
if (distance != 0.0) {
diffX = D_801645F8[cameraId] + ((D_80164648[cameraId] * diffX) / distance);
diffY = D_80164618[cameraId] + ((D_80164648[cameraId] * diffY) / distance);
diffZ = D_80164638[cameraId] + ((D_80164648[cameraId] * diffZ) / distance);
camX = D_801645F8[cameraId] + (((stackPadding9 = D_80164648[cameraId]) * diffX) / distance);
camY = D_80164618[cameraId] + ((D_80164648[cameraId] * diffY) / distance);
camZ = D_80164638[cameraId] + ((D_80164648[cameraId] * diffZ) / distance);
} else {
diffX = D_801645F8[cameraId];
diffY = D_80164618[cameraId];
diffZ = D_80164638[cameraId];
camX = D_801645F8[cameraId];
camY = D_80164618[cameraId];
camZ = D_80164638[cameraId];
}
if (((diffX > (-10000.0))) && ((diffX < 10000.0))) {
camera->pos[0] = diffX;
camera->pos[2] = diffZ;
if (camX < -10000.0 || camX > 10000.0) {
if (lookAtX < -10000.0 || lookAtX > 10000.0) {}
}
camera->pos[0] = camX;
camera->pos[2] = camZ;
camera->pos[1] = camY + 10.0;
// camera->pos[0] = camX;
camera->pos[1] = diffY + 10.0; // Set camera 10 points above the ground
if (1) {}
if (1) {}
if (1) {}
if (1) {}
if (1) {}
D_801645F8[cameraId] = diffX;
D_80164638[cameraId] = diffZ;
D_801645F8[cameraId] = camX;
D_80164618[cameraId] = camY;
D_80164638[cameraId] = camZ;
if (lookAtX < -10000.0 || lookAtX > 10000.0) {}
if (lookAtZ < -10000.0 || lookAtZ > 10000.0) {}
camera->lookAt[0] = lookAtX;
camera->lookAt[1] = lookAtY + 8.0;
camera->lookAt[2] = lookAtZ;
func_80014D30(cameraId, pathIndex);
diffX2 = camera->lookAt[0] - camera->pos[0];
diffY2 = camera->lookAt[1] - camera->pos[1];
diffZ2 = camera->lookAt[2] - camera->pos[2];
camera->rot[1] = atan2s(diffX2, diffZ2);
camera->rot[0] = atan2s(sqrtf((diffX2 * diffX2) + (diffZ2 * diffZ2)), diffY2);
spAC = camera->lookAt[0] - camera->pos[0];
spA8 = camera->lookAt[1] - camera->pos[1];
spA4 = camera->lookAt[2] - camera->pos[2];
camera->rot[1] = atan2s(spAC, spA4);
camera->rot[0] = atan2s(sqrtf((spAC * spAC) + (spA4 * spA4)), spA8);
camera->rot[2] = 0;
}
#else
GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80017054.s")
#endif
void func_80017720(s32 playerId, UNUSED f32 arg1, s32 cameraId, s16 pathIndex) {
Camera* camera = cameras + cameraId;

View File

@ -116,7 +116,7 @@ void HarbourMastersIntro::SpagBob(FVector& pos, IRotator& rot, f32 bobAmp, f32 b
}
void HarbourMastersIntro::HM_DrawIntro() {
FrameInterpolation_ShouldInterpolateFrame(false);
//FrameInterpolation_ShouldInterpolateFrame(false);
HarbourMastersIntro::Setup();
gSPMatrix(gDisplayListHead++, &gGfxPool->mtxScreen, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
@ -124,28 +124,28 @@ void HarbourMastersIntro::HM_DrawIntro() {
gDPSetRenderMode(gDisplayListHead++, G_RM_AA_ZB_OPA_SURF, G_RM_AA_ZB_OPA_SURF2);
gDPSetEnvColor(gDisplayListHead++, 0x00, 0x00, 0x00, 0x00);
FrameInterpolation_RecordOpenChild("spag_ship", 0);
//FrameInterpolation_RecordOpenChild("spag_ship", 0);
Mat4 mtx_spaghettiShip;
ApplyMatrixTransformations(mtx_spaghettiShip, _pos, _rot, _scale);
render_set_position(mtx_spaghettiShip, 0);
gSPDisplayList(gDisplayListHead++, ship1_spag1_mesh);
FrameInterpolation_RecordCloseChild();
//FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("ship2", 0);
//FrameInterpolation_RecordOpenChild("ship2", 0);
Mat4 mtx_ship2;
ApplyMatrixTransformations(mtx_ship2, _ship2Pos, _ship2Rot, _scale);
render_set_position(mtx_ship2, 0);
gSPDisplayList(gDisplayListHead++, ship2_SoH_mesh);
FrameInterpolation_RecordCloseChild();
//FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("ship3", 0);
//FrameInterpolation_RecordOpenChild("ship3", 0);
Mat4 mtx_ship3;
ApplyMatrixTransformations(mtx_ship3, _shipPos, _shipRot, _scale);
render_set_position(mtx_ship3, 0);
gSPDisplayList(gDisplayListHead++, ship3_2Ship_mesh);
FrameInterpolation_RecordCloseChild();
//FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("hm_geo", 0);
//FrameInterpolation_RecordOpenChild("hm_geo", 0);
Mat4 mtx_geo;
ApplyMatrixTransformations(mtx_geo, _hPos, _hRot, _hScale);
render_set_position(mtx_geo, 0);
@ -155,17 +155,17 @@ void HarbourMastersIntro::HM_DrawIntro() {
gSPDisplayList(gDisplayListHead++, castle_map_002_mesh);
gSPDisplayList(gDisplayListHead++, road_map_001_mesh);
gSPDisplayList(gDisplayListHead++, water_water1_mesh);
FrameInterpolation_RecordCloseChild();
//FrameInterpolation_RecordCloseChild();
FrameInterpolation_RecordOpenChild("hm_lus", 0);
//FrameInterpolation_RecordOpenChild("hm_lus", 0);
Mat4 lusMtx;
ApplyMatrixTransformations(lusMtx, lusPos, lusRot, lusScale);
render_set_position(lusMtx, 0);
gSPDisplayList(gDisplayListHead++, (Gfx*)"__OTR__hmintro/poweredbylus");
FrameInterpolation_RecordCloseChild();
//FrameInterpolation_RecordCloseChild();
HarbourMastersIntro::Sync();
FrameInterpolation_ShouldInterpolateFrame(true);
//FrameInterpolation_ShouldInterpolateFrame(true);
}
void HarbourMastersIntro::Setup() {

View File

@ -74,7 +74,7 @@ void ApplyMatrixTransformations(Mat4 mtx, FVector pos, IRotator rot, FVector sca
f32 sine1, cosine1;
f32 sine2, cosine2;
f32 sine3, cosine3;
FrameInterpolation_ApplyMatrixTransformations((Mat4*)mtx, pos, rot, scale);
//FrameInterpolation_ApplyMatrixTransformations((Mat4*)mtx, pos, rot, scale);
// Compute the sine and cosine of the orientation (Euler angles)
sine1 = sins(rot.pitch);

View File

@ -4241,7 +4241,12 @@ void adjust_img_colour(s32 index, s32 screenSize, s32 r, s32 g, s32 b) {
gSPInvalidateTexCache(gDisplayListHead++, sMenuTextureMap[index].offset);
}
/**
* Searches the menu texture cache for a texture. If not cached then return NULL
* This function is no longer required so the ptr can be returned back.
*/
u16* func_8009B8C4(u64* arg0) {
return arg0; // Prevent random CI8 crash in the menus
UNUSED s32 pad[2];
s32 offset;
s32 found;

View File

@ -1664,12 +1664,14 @@ void render_kart(Player* player, s8 playerId, s8 screenId, s8 arg3) {
(struct_D_802F1F80*) &gPlayerPalettesList[D_801651D0[screenId][playerId]][screenId][playerId * 0x100];
#endif
if ((screenId == 0) || (screenId == 1)) {
load_kart_texture(player, playerId, screenId, screenId, 0);
sKartUpperTexture = gEncodedKartTexture[D_801651D0[screenId][playerId]][screenId][playerId].unk_00;
#ifdef TARGET_N64
sKartLowerTexture =
&D_802BFB80.arraySize8[D_801651D0[screenId][playerId]][screenId][playerId].pixel_index_array[0x7C0];
#endif
} else {
load_kart_texture(player, playerId - 4, screenId - 1, screenId - 1, 0);
sKartUpperTexture = gEncodedKartTexture[D_801651D0[screenId][playerId]][screenId - 1][playerId - 4].unk_00;
#ifdef TARGET_N64
sKartLowerTexture =

2
torch

@ -1 +1 @@
Subproject commit 9d09de18c83a48f060caa573a95103dc073b186b
Subproject commit 5773373b3620e4a6bc6c92fdc4690d66741c086d