summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--docs/BUILDING.md2
-rw-r--r--include/fox_record.h22
m---------libultraship0
-rw-r--r--port/shaders/directx/default.shader.hlsl6
-rw-r--r--port/shaders/opengl/default.shader.fs31
-rw-r--r--src/audio/audio_load.c4
-rw-r--r--src/audio/audio_playback.c2
-rw-r--r--src/audio/audio_synthesis.c2
-rw-r--r--src/engine/fox_demo.c24
-rw-r--r--src/engine/fox_display.c15
-rw-r--r--src/overlays/ovl_i1/fox_co.c49
-rw-r--r--src/overlays/ovl_i2/fox_me.c22
-rw-r--r--src/overlays/ovl_i5/fox_ma.c32
-rw-r--r--src/overlays/ovl_i6/fox_sy.c17
-rw-r--r--src/overlays/ovl_menu/fox_map.c1
-rw-r--r--src/port/Engine.cpp7
-rw-r--r--src/port/resource/importers/ResourceUtil.h1
-rw-r--r--src/port/resource/importers/audio/SampleFactory.cpp2
-rw-r--r--src/port/resource/importers/audio/SoundFontFactory.cpp1
-rw-r--r--src/port/resource/loaders/AudioLoader.cpp2
m---------tools/Torch0
22 files changed, 207 insertions, 38 deletions
diff --git a/.gitignore b/.gitignore
index a516fcfe..0ef6aa29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,4 +57,5 @@ src/jp/
src/eu/
src/cn/
-properties.h \ No newline at end of file
+properties.h
+mods*/ \ No newline at end of file
diff --git a/docs/BUILDING.md b/docs/BUILDING.md
index e6922301..6d4e1267 100644
--- a/docs/BUILDING.md
+++ b/docs/BUILDING.md
@@ -86,7 +86,7 @@ C:\Program Files\CMake\bin\cmake.exe --build build-cmake --target clean
#### Debian/Ubuntu
```sh
# using gcc
-apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev ibvorbis-dev
+apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
# or using clang
apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev libboost-dev libopengl-dev libogg-dev libvorbis-dev
diff --git a/include/fox_record.h b/include/fox_record.h
new file mode 100644
index 00000000..1fbfd3ff
--- /dev/null
+++ b/include/fox_record.h
@@ -0,0 +1,22 @@
+/**
+ * Used to reproduce recordings made from real N64 hardware
+ * to accurately reproduce Cutscenes at the correct speed.
+ * These recordings adjust gVisPerFrame during runtime to produce
+ * the same behaviour as the original game.
+ */
+#ifndef N64_RECORD_H
+#define N64_RECORD_H
+
+#include "global.h"
+
+typedef struct Record {
+ u8 vis;
+ u16 frame;
+} Record;
+
+extern u8 gCarrierCutsceneRecord[200];
+
+void UpdateVisPerFrameFromRecording(u8* record, s32 maxFrames);
+void UpdateVisPerFrameFromRecording2(Record* record, s32 maxFrames);
+
+#endif
diff --git a/libultraship b/libultraship
-Subproject 1a8a2f70d1a2624130a40baa7f8b0ce52231455
+Subproject a8cddd2f8991c9d50783db4de855c98a392f4ac
diff --git a/port/shaders/directx/default.shader.hlsl b/port/shaders/directx/default.shader.hlsl
index f36c2dae..980becb8 100644
--- a/port/shaders/directx/default.shader.hlsl
+++ b/port/shaders/directx/default.shader.hlsl
@@ -186,7 +186,7 @@ float4 PSMain(PSInput input, float4 screenSpace : SV_Position) : SV_TARGET {
float2 tc@{i} = input.uv@{i};
@{s = o_clamp[i][0]}
@{t = o_clamp[i][1]}
- @if(s && t)
+ @if(s || t)
int2 texSize@{i};
g_texture@{i}.GetDimensions(texSize@{i}.x, texSize@{i}.y);
@if(s && t)
@@ -224,7 +224,7 @@ float4 PSMain(PSInput input, float4 screenSpace : SV_Position) : SV_TARGET {
@else
float4 blendVal@{i} = float4(0, 0, 0, 0);
@end
- texval@{i} = lerp(texVal@{i}, blendVal@{i}, g_textureMask@{i}.Sample(g_sampler@{i}, tc@{i}).a);
+ texVal@{i} = lerp(texVal@{i}, blendVal@{i}, g_textureMask@{i}.Sample(g_sampler@{i}, tc@{i}).a);
@end
}
@else
@@ -329,4 +329,4 @@ float4 PSMain(PSInput input, float4 screenSpace : SV_Position) : SV_TARGET {
return float4(texel, 1.0);
@end
@end
-} \ No newline at end of file
+}
diff --git a/port/shaders/opengl/default.shader.fs b/port/shaders/opengl/default.shader.fs
index b15e1598..404caae6 100644
--- a/port/shaders/opengl/default.shader.fs
+++ b/port/shaders/opengl/default.shader.fs
@@ -44,6 +44,10 @@ out vec4 vOutColor;
uniform int frame_count;
uniform float noise_scale;
+uniform int texture_width[2];
+uniform int texture_height[2];
+uniform int texture_filtering[2];
+
#define TEX_OFFSET(off) @{texture}(tex, texCoord - off / texSize)
#define WRAP(x, low, high) mod((x)-(low), (high)-(low)) + (low)
@@ -59,7 +63,6 @@ vec4 fromLinear(vec4 linearRGB){
return vec4(mix(higher, lower, cutoff), linearRGB.a);
}
-@if(o_current_filter == FILTER_THREE_POINT)
vec4 filter3point(in sampler2D tex, in vec2 texCoord, in vec2 texSize) {
vec2 offset = fract(texCoord*texSize - vec2(0.5));
offset -= step(1.0, offset.x + offset.y);
@@ -69,14 +72,16 @@ vec4 filter3point(in sampler2D tex, in vec2 texCoord, in vec2 texSize) {
return c0 + abs(offset.x)*(c1-c0) + abs(offset.y)*(c2-c0);
}
-vec4 hookTexture2D(in sampler2D tex, in vec2 uv, in vec2 texSize) {
- return filter3point(tex, uv, texSize);
-}
-@else
-vec4 hookTexture2D(in sampler2D tex, in vec2 uv, in vec2 texSize) {
+vec4 hookTexture2D(in int id, sampler2D tex, in vec2 uv, in vec2 texSize) {
+@if(o_three_point_filtering)
+ if(texture_filtering[id] == @{FILTER_THREE_POINT}) {
+ return filter3point(tex, uv, texSize);
+ }
+@end
return @{texture}(tex, uv);
}
-@end
+
+#define TEX_SIZE(tex) vec2(texture_width[tex], texture_height[tex])
void main() {
@for(i in 0..2)
@@ -84,11 +89,7 @@ void main() {
@{s = o_clamp[i][0]}
@{t = o_clamp[i][1]}
- @if(opengles)
- vec2 texSize@{i} = vec2(textureSize(uTex@{i}, 0));
- @else
- vec2 texSize@{i} = textureSize(uTex@{i}, 0);
- @end
+ vec2 texSize@{i} = TEX_SIZE(@{i});
@if(!s && !t)
vec2 vTexCoordAdj@{i} = vTexCoord@{i};
@@ -102,7 +103,7 @@ void main() {
@end
@end
- vec4 texVal@{i} = hookTexture2D(uTex@{i}, vTexCoordAdj@{i}, texSize@{i});
+ vec4 texVal@{i} = hookTexture2D(@{i}, uTex@{i}, vTexCoordAdj@{i}, texSize@{i});
@if(o_masks[i])
@if(opengles)
@@ -111,10 +112,10 @@ void main() {
vec2 maskSize@{i} = textureSize(uTexMask@{i}, 0);
@end
- vec4 maskVal@{i} = hookTexture2D(uTexMask@{i}, vTexCoordAdj@{i}, maskSize@{i});
+ vec4 maskVal@{i} = hookTexture2D(@{i}, uTexMask@{i}, vTexCoordAdj@{i}, maskSize@{i});
@if(o_blend[i])
- vec4 blendVal@{i} = hookTexture2D(uTexBlend@{i}, vTexCoordAdj@{i}, texSize@{i});
+ vec4 blendVal@{i} = hookTexture2D(@{i}, uTexBlend@{i}, vTexCoordAdj@{i}, texSize@{i});
@else
vec4 blendVal@{i} = vec4(0, 0, 0, 0);
@end
diff --git a/src/audio/audio_load.c b/src/audio/audio_load.c
index 361f303a..4f9a3e8a 100644
--- a/src/audio/audio_load.c
+++ b/src/audio/audio_load.c
@@ -419,8 +419,8 @@ void AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) {
void* AudioLoad_SyncLoadSeq(s32 seqId) {
AudioTable* table = AudioLoad_GetLoadTable(SEQUENCE_TABLE);
char* seqPath = ResourceGetNameByCrc((uint64_t) table->entries[seqId].romAddr);
- printf("seqId: %d\n", seqId);
- printf("seqPath: %s\n", seqPath);
+ // printf("seqId: %d\n", seqId);
+ // printf("seqPath: %s\n", seqPath);
return ResourceGetDataByCrc((uint64_t) table->entries[seqId].romAddr);
}
diff --git a/src/audio/audio_playback.c b/src/audio/audio_playback.c
index 03d4b639..be9dfbcd 100644
--- a/src/audio/audio_playback.c
+++ b/src/audio/audio_playback.c
@@ -243,7 +243,7 @@ Instrument* Audio_GetInstrument(s32 fontId, s32 instId) {
D_80155D88 = (fontId << 8) + instId + 0x01000000;
return instrument;
}
- printf("InstId: %d\n", instId);
+ // printf("InstId: %d\n", instId);
return instrument;
}
diff --git a/src/audio/audio_synthesis.c b/src/audio/audio_synthesis.c
index 1558adfc..84d894c5 100644
--- a/src/audio/audio_synthesis.c
+++ b/src/audio/audio_synthesis.c
@@ -1070,7 +1070,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSub, NoteSynthesisSta
dmemUncompressedAddrOffset1 = numSamplesToLoadAdj;
if (((synthState->samplePosInt * 2) + (numSamplesToLoadAdj)*SAMPLE_SIZE) < bookSample->size) {
- bytesToRead = (numSamplesToLoadAdj)*SAMPLE_SIZE;
+ bytesToRead = (numSamplesToLoadAdj + 16)*SAMPLE_SIZE;
} else {
bytesToRead = bookSample->size - (synthState->samplePosInt * 2);
}
diff --git a/src/engine/fox_demo.c b/src/engine/fox_demo.c
index 40506dbb..c3315a63 100644
--- a/src/engine/fox_demo.c
+++ b/src/engine/fox_demo.c
@@ -19,6 +19,28 @@
#include "assets/ast_katina.h"
#include "assets/ast_allies.h"
#include "port/hooks/Events.h"
+#include "fox_co.h"
+#include "fox_record.h"
+
+void UpdateVisPerFrameFromRecording(u8* record, s32 maxFrames) {
+ if (gCsFrameCount < maxFrames) {
+ gVIsPerFrame = record[gCsFrameCount];
+ }
+}
+
+void UpdateVisPerFrameFromRecording2(Record* record, s32 maxFrames) {
+ int i;
+
+ if (gCsFrameCount > record[maxFrames - 1].frame) {
+ return;
+ }
+
+ for (i = 0; i < maxFrames; i++) {
+ if (gCsFrameCount == record[i].frame) {
+ gVIsPerFrame = record[i].vis;
+ }
+ }
+}
void func_demo_80048AC0(TeamId teamId) {
s32 teamShield;
@@ -925,6 +947,8 @@ void Cutscene_CoComplete2(Player* player) {
Math_SmoothStepToF(&player->camRoll, 0.0f, 0.1f, 5.0f, 0.01f);
+ UpdateVisPerFrameFromRecording(gCarrierCutsceneRecord, ARRAY_COUNT(gCarrierCutsceneRecord));
+
switch (player->csState) {
case 10:
D_ctx_80177A48[2] = 0.0f;
diff --git a/src/engine/fox_display.c b/src/engine/fox_display.c
index d636ad62..0d6e2bad 100644
--- a/src/engine/fox_display.c
+++ b/src/engine/fox_display.c
@@ -148,7 +148,8 @@ void Display_DrawHelpAlert(void) {
RCP_SetupDL(&gMasterDisp, SETUPDL_76_OPTIONAL);
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 0, 255);
if (sp78 < 0.0f) {
- Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(38.0f), 106, 1.0f, 1.0f, "HELP!!");
+ Graphics_DisplaySmallText(OTRGetRectDimensionFromLeftEdgeOverride(38.0f), 106, 1.0f, 1.0f,
+ "HELP!!");
} else {
Graphics_DisplaySmallText(OTRGetRectDimensionFromRightEdgeOverride(248), 106, 1.0f, 1.0f, "HELP!!");
}
@@ -1138,7 +1139,7 @@ void Display_ArwingLaserCharge(Player* player) {
// @port: Tag the transform.
FrameInterpolation_RecordOpenChild("ArwingMuzzleFlash", 0);
-
+
Matrix_Translate(gGfxMatrix, sp94.x, sp94.y, sp94.z, MTXF_NEW);
Matrix_Scale(gGfxMatrix, gMuzzleFlashScale[player->num], gMuzzleFlashScale[player->num], 1.0f,
MTXF_APPLY);
@@ -2049,6 +2050,16 @@ void Display_Update(void) {
if (gInputPress->stick_y < 0) Graphics_DisplaySmallText(110, 220, 1.0f, 1.0f, "NEG:");
#endif
+// For debugging cutscene timings
+#if 0
+ RCP_SetupDL(&gMasterDisp, SETUPDL_83);
+ gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
+ Graphics_DisplaySmallText(10 + 210, 190, 1.0f, 1.0f, "CSFMS:");
+ Graphics_DisplaySmallNumber(60 + 210, 190, (int) gCsFrameCount);
+ Graphics_DisplaySmallText(10 + 210, 200, 1.0f, 1.0f, "PLTIM:");
+ Graphics_DisplaySmallNumber(60 + 210, 200, (int) gPlayer->csTimer);
+#endif
+
// @port: @event: Call DisplayPostUpdateEvent
CALL_EVENT(DisplayPostUpdateEvent);
}
diff --git a/src/overlays/ovl_i1/fox_co.c b/src/overlays/ovl_i1/fox_co.c
index 0e225f4e..a3cd7257 100644
--- a/src/overlays/ovl_i1/fox_co.c
+++ b/src/overlays/ovl_i1/fox_co.c
@@ -9,6 +9,35 @@
#include "assets/ast_corneria.h"
#include "fox_co.h"
#include "port/hooks/Events.h"
+#include "fox_record.h"
+
+// Carrier destroy cutscene timings recorded from a real N64
+u8 gCarrierCutsceneRecord[200] = {
+ 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x04, 0x04, 0x04, 0x05, 0x05, 0x04, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05,
+ 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02
+};
+
+// Granga destroy cutscene timings recorded from a real N64
+u8 gGrangaCutsceneRecord[161] = {
+ 0x02, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04,
+ 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x02
+};
u8 sFightCarrier;
f32 sCoGrangaWork[68];
@@ -182,9 +211,9 @@ void Corneria_CoGranga_HandleDamage(CoGranga* this) {
this->state = GRANGA_EXPLODE;
+ this->timer_050 = 100; // original value
// @port: Adjust timing to compensate the lack of lag.
- // this->timer_050 = 100;
- this->timer_050 = 138;
+ // this->timer_050 = 138; // @port
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM, 80);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_FANFARE, 80);
@@ -2236,19 +2265,19 @@ void Corneria_CoCarrier_Update(CoCarrier* this) {
Math_SmoothStepToF(&this->vel.y, 0.0f, 0.1f, 2.0f, 0.00001f);
Math_SmoothStepToF(&this->vel.z, 0.0f, 0.1f, 2.0f, 0.00001f);
+ this->obj.rot.z -= 2.0f; // original value
+ this->gravity = 1.0f; // original value
// @port: Adjust gravity and rot to compensate the lack of lag.
- // this->obj.rot.z -= 2.0f
- // this->gravity = 1.0f;
- this->obj.rot.z -= 2.0f - 0.86f;
- this->gravity = 1.0f - 0.43f;
+ // this->obj.rot.z -= 2.0f - 0.86f;
+ // this->gravity = 1.0f - 0.43f;
if (this->obj.pos.y < (gGroundHeight + 150.0f)) {
gCameraShake = 100;
func_effect_80081A8C(this->obj.pos.x, this->obj.pos.y, this->obj.pos.z, 40.0f, 12);
-
+
+ this->timer_050 = 20; // original value
// @port: Adjust timings to compensate the lack of lag.
- // this->timer_050 = 20;
- this->timer_050 = 40;
+ // this->timer_050 = 40;
this->vel.y = -10.0f;
this->gravity = 0.0f;
this->fwork[17] = 20.0f;
@@ -3456,6 +3485,8 @@ void Corneria_LevelComplete1(Player* player) {
f32 temp_fa1;
f32 temp_deg;
+ UpdateVisPerFrameFromRecording(gGrangaCutsceneRecord, ARRAY_COUNT(gGrangaCutsceneRecord));
+
player->arwing.upperRightFlapYrot = player->arwing.upperLeftFlapYrot = player->arwing.bottomRightFlapYrot =
player->arwing.bottomLeftFlapYrot = 0.0f;
diff --git a/src/overlays/ovl_i2/fox_me.c b/src/overlays/ovl_i2/fox_me.c
index 678dbfe0..4655908d 100644
--- a/src/overlays/ovl_i2/fox_me.c
+++ b/src/overlays/ovl_i2/fox_me.c
@@ -6,6 +6,26 @@
#include "global.h"
#include "assets/ast_meteo.h"
+#include "fox_record.h"
+
+// MeCrusher destroy cutscene timings recorded from a real N64
+u8 gMeCrusherCutsceneRecord[] = {
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x02
+};
Vec3f D_i2_80195430[] = {
{ 122.0, -5.0, -1200.0 }, { 122.0, -103.0, -727.0 }, { 142.0, -323.0, -848.0 }, { 362.0, -59.0, -435.0 },
@@ -2426,6 +2446,8 @@ void Meteo_LevelComplete(Player* player) {
Math_SmoothStepToAngle(&player->aerobaticPitch, 0.0f, 0.1f, 20.0f, 0.0f);
Math_SmoothStepToF(&player->boostSpeed, 0.0f, 0.1f, 3.0f, 0.0f);
+ UpdateVisPerFrameFromRecording(gMeCrusherCutsceneRecord, ARRAY_COUNT(gMeCrusherCutsceneRecord));
+
switch (player->csState) {
case 0:
Audio_StopSfxByBankAndSource(1, player->sfxSource);
diff --git a/src/overlays/ovl_i5/fox_ma.c b/src/overlays/ovl_i5/fox_ma.c
index 414d0090..6825f828 100644
--- a/src/overlays/ovl_i5/fox_ma.c
+++ b/src/overlays/ovl_i5/fox_ma.c
@@ -10,6 +10,7 @@
#include "assets/ast_landmaster.h"
#include "assets/ast_enmy_planet.h"
// #include "prevent_bss_reordering2.h"
+#include "fox_record.h"
typedef struct {
/* 0x00 */ f32 unk_00;
@@ -59,6 +60,29 @@ Vec3f D_i5_801BE688[2];
Vec3f D_i5_801BE6A0[12];
s32 D_i5_801BE734[4];
+// Train cutscene timings recorded from a real N64
+Record sf64_virecord_macbeth_records[] = {
+ // Train breaking barriers
+ { 0x02, 0x000000 },
+ { 0x03, 0x000002 },
+ { 0x02, 0x00001F },
+ { 0x03, 0x000190 },
+ { 0x02, 0x0001A2 },
+ { 0x03, 0x0001B1 },
+ { 0x04, 0x0001B3 },
+ { 0x03, 0x0001BC },
+ { 0x02, 0x0001FD },
+ // { 0x03, 0x00022F },
+ // { 0x02, 0x000245 },
+ // { 0x03, 0x00024B },
+ // Explosions
+ { 0x02, 0x00024D },
+ { 0x03, 0x0002CA },
+ { 0x04, 0x000335 },
+ { 0x05, 0x000351 },
+ { 0x02, 0x0003AE },
+};
+
UnkStruct_D_i5_801B8E50 D_i5_801B8E50[156] = {
{ 5174.4f, -2141.0f, 0.0f, 350.0f, OBJ_SCENERY_MA_TRAIN_TRACK_3 },
{ 3401.4f, -1828.0f, 0.0f, 350.0f, OBJ_SCENERY_MA_TRAIN_TRACK_3 },
@@ -6472,6 +6496,12 @@ f32 D_i5_801BA854[8] = { 1.5f, -1.0f, 0.7f, 0.0f, 0.9f, 0.7f, -1.0f, 1.5f };
f32 D_i5_801BA874[8] = { 200.0f, 300.0f, 400.0f, 0.0f, 500.0f, 100.0f, 120.0f, 100.0f };
f32 D_i5_801BA894[8] = { 200.0f, 250.0f, 220.0f, 0.0f, 200.0f, 230.0f, 220.0f, 350.0f };
+
+
+
+
+
+
void Macbeth_LevelComplete2(Player* player) {
s32 i;
s32 j;
@@ -6479,6 +6509,8 @@ void Macbeth_LevelComplete2(Player* player) {
Vec3f spD8;
f32 zeroVar = 0.0f;
+ UpdateVisPerFrameFromRecording2(sf64_virecord_macbeth_records, ARRAY_COUNT(sf64_virecord_macbeth_records));
+
switch (player->csState) {
case 0:
gCsFrameCount = 0;
diff --git a/src/overlays/ovl_i6/fox_sy.c b/src/overlays/ovl_i6/fox_sy.c
index dd7b13fa..7eb32b89 100644
--- a/src/overlays/ovl_i6/fox_sy.c
+++ b/src/overlays/ovl_i6/fox_sy.c
@@ -6,6 +6,7 @@
#include "global.h"
#include "assets/ast_sector_y.h"
+#include "fox_record.h"
#define SHOGUN_SHIP (0)
@@ -29,6 +30,19 @@ void SectorY_801A0510(ActorCutscene*, s32);
void SectorY_ActorDebris_Setup(Actor*, f32, f32, f32, f32, f32, f32, s32);
void SectorY_ActorDebris_Spawn(f32, f32, f32, f32, f32, f32, s32);
+// SyRobot destroy cutscene timings recorded from a real N64
+u8 gSyRobotCutsceneRecord[158] = {
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
+ 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x02
+};
+
f32 D_i6_801A8440[3];
void SectorY_80197B30(ActorCutscene* this, s32 timer) {
@@ -475,6 +489,7 @@ void SectorY_80198F5C(SyShogun* this) {
this->vel.y = 0.0f;
this->vel.x = 0.0f;
+ // first and second robot explode
if ((gPlayer[0].state == PLAYERSTATE_ACTIVE) || (gPlayer[0].state == PLAYERSTATE_U_TURN)) {
this->timer_058 = 100;
gPlayer[0].state = PLAYERSTATE_STANDBY;
@@ -2090,6 +2105,8 @@ void SectorY_LevelComplete(Player* player) {
SyShogun* boss = &gBosses[0];
f32 temp_ft1;
+ UpdateVisPerFrameFromRecording(gSyRobotCutsceneRecord, ARRAY_COUNT(gSyRobotCutsceneRecord));
+
switch (player->csState) {
case 0:
gCsFrameCount = 0;
diff --git a/src/overlays/ovl_menu/fox_map.c b/src/overlays/ovl_menu/fox_map.c
index 2708defe..c02cbd83 100644
--- a/src/overlays/ovl_menu/fox_map.c
+++ b/src/overlays/ovl_menu/fox_map.c
@@ -2075,6 +2075,7 @@ void Map_Texture_Sphere(u8* textureDest, u8* textureSrc, f32* offset) {
if (*offset > 95.0f) {
*offset = 0.0f;
}
+ gSPInvalidateTexCache(gMasterDisp++, NULL);
}
void Map_Prologue_Update(void) {
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp
index d8d34711..a2c16ca8 100644
--- a/src/port/Engine.cpp
+++ b/src/port/Engine.cpp
@@ -70,7 +70,12 @@ GameEngine::GameEngine() {
std::vector<std::string> archiveFiles;
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("sf64.o2r");
+#ifdef __linux__
+ const std::string assets_path = Ship::Context::GetPathRelativeToAppBundle("starship.o2r");
+#else
const std::string assets_path = Ship::Context::GetPathRelativeToAppDirectory("starship.o2r");
+#endif
+
#ifdef _WIN32
AllocConsole();
@@ -376,7 +381,7 @@ void GameEngine::HandleAudioThread() {
// gVIsPerFrame = 2;
#define AUDIO_FRAMES_PER_UPDATE (gVIsPerFrame > 0 ? gVIsPerFrame : 1)
-#define MAX_AUDIO_FRAMES_PER_UPDATE 3 // Compile-time constant with max value of gVIsPerFrame
+#define MAX_AUDIO_FRAMES_PER_UPDATE 5 // Compile-time constant with max value of gVIsPerFrame
std::unique_lock<std::mutex> Lock(audio.mutex);
int samples_left = AudioPlayerBuffered();
diff --git a/src/port/resource/importers/ResourceUtil.h b/src/port/resource/importers/ResourceUtil.h
index 32a6fd4c..67ed936a 100644
--- a/src/port/resource/importers/ResourceUtil.h
+++ b/src/port/resource/importers/ResourceUtil.h
@@ -1,6 +1,7 @@
#pragma once
#include "resourcebridge.h"
+#include "ResourceManager.h"
#include "Context.h"
namespace SF64 {
diff --git a/src/port/resource/importers/audio/SampleFactory.cpp b/src/port/resource/importers/audio/SampleFactory.cpp
index 87f6ec14..d4115cb9 100644
--- a/src/port/resource/importers/audio/SampleFactory.cpp
+++ b/src/port/resource/importers/audio/SampleFactory.cpp
@@ -4,7 +4,7 @@
#include "sf64audio_provisional.h"
#define DR_WAV_IMPLEMENTATION
#include <dr_wav.h>
-
+#include <tinyxml2.h>
#define DR_MP3_IMPLEMENTATION
#include <dr_mp3.h>
diff --git a/src/port/resource/importers/audio/SoundFontFactory.cpp b/src/port/resource/importers/audio/SoundFontFactory.cpp
index 126b43fe..c3d16d0f 100644
--- a/src/port/resource/importers/audio/SoundFontFactory.cpp
+++ b/src/port/resource/importers/audio/SoundFontFactory.cpp
@@ -3,6 +3,7 @@
#include "utils/StringHelper.h"
#include <sf64audio_provisional.h>
#include "port/resource/type/audio/SoundFont.h"
+#include <tinyxml2.h>
namespace SF64 {
std::shared_ptr<Ship::IResource> ResourceFactoryBinarySoundFontV0::ReadResource(std::shared_ptr<Ship::File> file,
diff --git a/src/port/resource/loaders/AudioLoader.cpp b/src/port/resource/loaders/AudioLoader.cpp
index 8965af9f..6db4a312 100644
--- a/src/port/resource/loaders/AudioLoader.cpp
+++ b/src/port/resource/loaders/AudioLoader.cpp
@@ -11,7 +11,7 @@
extern "C" SoundFont* Audio_LoadFont(AudioTableEntry entry, uint32_t fontId) {
auto crc = (uint64_t) gSoundFontTable->entries[fontId].romAddr;
auto path = ResourceGetNameByCrc(crc);
- printf("Font: %s\n", path);
+ // printf("Font: %s\n", path);
return (SoundFont*) ResourceGetDataByCrc(crc);
}
diff --git a/tools/Torch b/tools/Torch
-Subproject 580350a2c2a0987811b31e562133106c4979bf0
+Subproject 9c460ea54312e9cefabf155e3b83021c0186284