Merge branch 'master' into better-reverb

This commit is contained in:
gheskett
2021-08-04 03:19:02 -05:00
11 changed files with 67 additions and 7 deletions

View File

@@ -20,6 +20,7 @@ USE_DEBUG := 0
# Build for the N64 (turn this off for ports) # Build for the N64 (turn this off for ports)
TARGET_N64 ?= 1 TARGET_N64 ?= 1
VC_HACKS ?= 0
# CONSOLE - selects the console to target # CONSOLE - selects the console to target
# bb - Targets the iQue Player (codenamed BB) # bb - Targets the iQue Player (codenamed BB)
@@ -36,6 +37,10 @@ else ifeq ($(CONSOLE),bb)
DEFINES += BBPLAYER=1 DEFINES += BBPLAYER=1
endif endif
ifeq ($(VC_HACKS), 1)
DEFINES += VC_HACKS=1
endif
# COMPILER - selects the C compiler to use # COMPILER - selects the C compiler to use
# gcc - uses the GNU C Compiler # gcc - uses the GNU C Compiler
COMPILER ?= gcc COMPILER ?= gcc
@@ -417,7 +422,7 @@ DEF_INC_CFLAGS := $(foreach i,$(INCLUDE_DIRS),-I$(i)) $(C_DEFINES)
# C compiler options # C compiler options
CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS) CFLAGS = -G 0 $(OPT_FLAGS) $(TARGET_CFLAGS) $(MIPSISET) $(DEF_INC_CFLAGS)
ifeq ($(COMPILER),gcc) ifeq ($(COMPILER),gcc)
CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces CFLAGS += -mno-shared -march=vr4300 -mfix4300 -mabi=32 -mhard-float -mdivide-breaks -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-PIC -mno-abicalls -fno-strict-aliasing -fno-inline-functions -ffreestanding -fwrapv -Wall -Wextra -Wno-missing-braces -fno-jump-tables
else else
CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32 CFLAGS += -non_shared -Wab,-r4300_mul -Xcpluscomm -Xfullwarn -signed -32
endif endif
@@ -492,6 +497,9 @@ all: $(ROM)
ifeq ($(COMPARE),1) ifeq ($(COMPARE),1)
@$(PRINT) "$(GREEN)Checking if ROM matches.. $(NO_COL)\n" @$(PRINT) "$(GREEN)Checking if ROM matches.. $(NO_COL)\n"
@$(SHA1SUM) --quiet -c $(TARGET).sha1 && $(PRINT) "$(TARGET): $(GREEN)OK$(NO_COL)\n" || ($(PRINT) "$(YELLOW)Building the ROM file has succeeded, but does not match the original ROM.\nThis is expected, and not an error, if you are making modifications.\nTo silence this message, use 'make COMPARE=0.' $(NO_COL)\n" && false) @$(SHA1SUM) --quiet -c $(TARGET).sha1 && $(PRINT) "$(TARGET): $(GREEN)OK$(NO_COL)\n" || ($(PRINT) "$(YELLOW)Building the ROM file has succeeded, but does not match the original ROM.\nThis is expected, and not an error, if you are making modifications.\nTo silence this message, use 'make COMPARE=0.' $(NO_COL)\n" && false)
else
@$(SHA1SUM) $(ROM)
@$(PRINT) "${GREEN}Build succeeded.\n"
endif endif
clean: clean:

View File

@@ -52,6 +52,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin
- There is a `gIsConsole` variable that is 1 when running on console and 0 when running on emulator. This way you can wrap your code in a console check. - There is a `gIsConsole` variable that is 1 when running on console and 0 when running on emulator. This way you can wrap your code in a console check.
- Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) * - Expanded audio heap allows for a larger concurrent note count and the importing of more m64 sequences and sound banks (By ArcticJaguar725) *
- You can set a test level in config.h in order to boot straight into it, so you can quickly test the level you're working on. * - You can set a test level in config.h in order to boot straight into it, so you can quickly test the level you're working on. *
- Allows all surfaces in the game to have a `force` parameter. Activating this doesn't REQUIRE you to set `force` for every surface: If you don't set, it will default to 0x0000 rather than crashing. Increases RAM usage of collision. *
- Colored ia4 text support. Format: `"@XXXXXXXX[YOUR TEXT]@--------"` (By ArcticJaguar725) - Colored ia4 text support. Format: `"@XXXXXXXX[YOUR TEXT]@--------"` (By ArcticJaguar725)
- Example Text: `"@FF0000FFRED @00FF00FFGREEN @0000FFFFBLUE @FFFFFF00INVISIBLE @--------NORMAL"` - Example Text: `"@FF0000FFRED @00FF00FFGREEN @0000FFFFBLUE @FFFFFF00INVISIBLE @--------NORMAL"`
- NOTE: It is not mandatory to reset the text color with `"@--------"`, but text will need to be recolored each time it scrolls in a dialog box, or the custom color will reset. - NOTE: It is not mandatory to reset the text color with `"@--------"`, but text will need to be recolored each time it scrolls in a dialog box, or the custom color will reset.

View File

@@ -107,6 +107,8 @@
#define MODEL_ID_COUNT 256 #define MODEL_ID_COUNT 256
// Increase audio heap size to allow for more concurrent notes to be played and for more custom sequences/banks to be imported (does nothing with EU and SH versions) // Increase audio heap size to allow for more concurrent notes to be played and for more custom sequences/banks to be imported (does nothing with EU and SH versions)
#define EXPAND_AUDIO_HEAP #define EXPAND_AUDIO_HEAP
// Allow all surfaces types to have force, (doesn't require setting force, just allows it to be optional).
#define ALL_SURFACES_HAVE_FORCE
// BUG/GAME QOL FIXES // BUG/GAME QOL FIXES
// Fix instant warp offset not working when warping across different areas // Fix instant warp offset not working when warping across different areas

View File

@@ -1,6 +1,8 @@
#ifndef SURFACE_TERRAINS_H #ifndef SURFACE_TERRAINS_H
#define SURFACE_TERRAINS_H #define SURFACE_TERRAINS_H
#include "config.h"
// Surface Types // Surface Types
#define SURFACE_DEFAULT 0x0000 // Environment default #define SURFACE_DEFAULT 0x0000 // Environment default
#define SURFACE_BURNING 0x0001 // Lava / Frostbite (in SL), but is used mostly for Lava #define SURFACE_BURNING 0x0001 // Lava / Frostbite (in SL), but is used mostly for Lava
@@ -202,7 +204,11 @@
#define COL_TRI_INIT(surfType, triNum) surfType, triNum #define COL_TRI_INIT(surfType, triNum) surfType, triNum
// Collision Tri // Collision Tri
#ifdef ALL_SURFACES_HAVE_FORCE
#define COL_TRI(v1, v2, v3) v1, v2, v3, 0
#else
#define COL_TRI(v1, v2, v3) v1, v2, v3 #define COL_TRI(v1, v2, v3) v1, v2, v3
#endif
// Collision Tri With Special Params // Collision Tri With Special Params
#define COL_TRI_SPECIAL(v1, v2, v3, param) v1, v2, v3, param #define COL_TRI_SPECIAL(v1, v2, v3, param) v1, v2, v3, param

View File

@@ -30,8 +30,7 @@
#define TEXT_HUD_CURRENT_RATIO_43 _("ASPECT RATIO: 4:3") #define TEXT_HUD_CURRENT_RATIO_43 _("ASPECT RATIO: 4:3")
#define TEXT_HUD_CURRENT_RATIO_169 _("ASPECT RATIO: 16:9") #define TEXT_HUD_CURRENT_RATIO_169 _("ASPECT RATIO: 16:9")
#define TEXT_HUD_PRESS_L _("PRESS L TO SWITCH") #define TEXT_HUD_PRESS_L _("PRESS L TO SWITCH")
#define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO") #define TEXT_HUD_WIDE_INFO _("PLEASE CONFIGURE YOUR DISPLAY OR YOUR EMULATOR TO\nSTRETCH THE IMAGE TO 16:9")
#define TEXT_HUD_WIDE_INFO2 _("STRETCH THE IMAGE TO 16:9")
#endif #endif
#if defined(VERSION_JP) || defined(VERSION_SH) #if defined(VERSION_JP) || defined(VERSION_SH)

View File

@@ -1088,6 +1088,11 @@ s32 audio_shut_down_and_reset_step(void) {
* Waits until a specified number of audio frames have been created * Waits until a specified number of audio frames have been created
*/ */
void wait_for_audio_frames(s32 frames) { void wait_for_audio_frames(s32 frames) {
#ifdef VC_HACKS
// VC emulator stubs this function because busy loops are not supported
// Technically we can put infinite loop that _looks_ like -O0 for emu but this is cleaner
return;
#endif
gAudioFrameCount = 0; gAudioFrameCount = 0;
// Sound thread will update gAudioFrameCount // Sound thread will update gAudioFrameCount
while (gAudioFrameCount < frames) { while (gAudioFrameCount < frames) {

View File

@@ -15,6 +15,8 @@
#include "game/object_list_processor.h" #include "game/object_list_processor.h"
#include "surface_load.h" #include "surface_load.h"
#include "config.h"
s32 unused8038BE90; s32 unused8038BE90;
/** /**
@@ -389,6 +391,7 @@ static struct Surface *read_surface_data(s16 *vertexData, s16 **vertexIndices) {
return surface; return surface;
} }
#ifndef ALL_SURFACES_HAVE_FORCE
/** /**
* Returns whether a surface has exertion/moves Mario * Returns whether a surface has exertion/moves Mario
* based on the surface type. * based on the surface type.
@@ -412,6 +415,7 @@ static s32 surface_has_force(s16 surfaceType) {
} }
return hasForce; return hasForce;
} }
#endif
/** /**
* Returns whether a surface should have the * Returns whether a surface should have the
@@ -444,7 +448,9 @@ static void load_static_surfaces(s16 **data, s16 *vertexData, s16 surfaceType, s
s32 numSurfaces; s32 numSurfaces;
struct Surface *surface; struct Surface *surface;
s8 room = 0; s8 room = 0;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce = surface_has_force(surfaceType); s16 hasForce = surface_has_force(surfaceType);
#endif
s16 flags = surf_has_no_cam_collision(surfaceType); s16 flags = surf_has_no_cam_collision(surfaceType);
numSurfaces = *(*data); numSurfaces = *(*data);
@@ -462,19 +468,27 @@ static void load_static_surfaces(s16 **data, s16 *vertexData, s16 surfaceType, s
surface->type = surfaceType; surface->type = surfaceType;
surface->flags = (s8) flags; surface->flags = (s8) flags;
#ifdef ALL_SURFACES_HAVE_FORCE
surface->force = *(*data + 3);
#else
if (hasForce) { if (hasForce) {
surface->force = *(*data + 3); surface->force = *(*data + 3);
} else { } else {
surface->force = 0; surface->force = 0;
} }
#endif
add_surface(surface, FALSE); add_surface(surface, FALSE);
} }
#ifdef ALL_SURFACES_HAVE_FORCE
*data += 4;
#else
*data += 3; *data += 3;
if (hasForce) { if (hasForce) {
*data += 1; *data += 1;
} }
#endif
} }
} }
@@ -549,7 +563,9 @@ u32 get_area_terrain_size(s16 *data) {
s32 numVertices; s32 numVertices;
s32 numRegions; s32 numRegions;
s32 numSurfaces; s32 numSurfaces;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce; s16 hasForce;
#endif
while (!end) { while (!end) {
terrainLoadType = *data++; terrainLoadType = *data++;
@@ -578,8 +594,12 @@ u32 get_area_terrain_size(s16 *data) {
default: default:
numSurfaces = *data++; numSurfaces = *data++;
#ifdef ALL_SURFACES_HAVE_FORCE
data += 4 * numSurfaces;
#else
hasForce = surface_has_force(terrainLoadType); hasForce = surface_has_force(terrainLoadType);
data += (3 + hasForce) * numSurfaces; data += (3 + hasForce) * numSurfaces;
#endif
break; break;
} }
} }
@@ -709,7 +729,9 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
s32 surfaceType; s32 surfaceType;
s32 i; s32 i;
s32 numSurfaces; s32 numSurfaces;
#ifndef ALL_SURFACES_HAVE_FORCE
s16 hasForce; s16 hasForce;
#endif
s16 flags; s16 flags;
s16 room; s16 room;
@@ -719,7 +741,9 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
numSurfaces = *(*data); numSurfaces = *(*data);
(*data)++; (*data)++;
#ifndef ALL_SURFACES_HAVE_FORCE
hasForce = surface_has_force(surfaceType); hasForce = surface_has_force(surfaceType);
#endif
flags = surf_has_no_cam_collision(surfaceType); flags = surf_has_no_cam_collision(surfaceType);
flags |= SURFACE_FLAG_DYNAMIC; flags |= SURFACE_FLAG_DYNAMIC;
@@ -739,22 +763,30 @@ void load_object_surfaces(s16 **data, s16 *vertexData) {
surface->object = gCurrentObject; surface->object = gCurrentObject;
surface->type = surfaceType; surface->type = surfaceType;
#ifdef ALL_SURFACES_HAVE_FORCE
surface->force = *(*data + 3);
#else
if (hasForce) { if (hasForce) {
surface->force = *(*data + 3); surface->force = *(*data + 3);
} else { } else {
surface->force = 0; surface->force = 0;
} }
#endif
surface->flags |= flags; surface->flags |= flags;
surface->room = (s8) room; surface->room = (s8) room;
add_surface(surface, TRUE); add_surface(surface, TRUE);
} }
#ifdef ALL_SURFACES_HAVE_FORCE
*data += 4;
#else
if (hasForce) { if (hasForce) {
*data += 4; *data += 4;
} else { } else {
*data += 3; *data += 3;
} }
#endif
} }
} }

View File

@@ -382,9 +382,14 @@ void render_init(void) {
exec_display_list(&gGfxPool->spTask); exec_display_list(&gGfxPool->spTask);
// Skip incrementing the initial framebuffer index on emulators so that they display immediately as the Gfx task finishes // Skip incrementing the initial framebuffer index on emulators so that they display immediately as the Gfx task finishes
if ((*(volatile u32 *)0xA4100010) != 0) { // Read RDP Clock Register, has a value of zero on emulators // VC probably emulates osViSwapBuffer accurately so instant patch breaks VC compatibility
#ifndef VC_HACKS
if (gIsConsole) { // Read RDP Clock Register, has a value of zero on emulators
#endif
sRenderingFrameBuffer++; sRenderingFrameBuffer++;
#ifndef VC_HACKS
} }
#endif
gGlobalTimer++; gGlobalTimer++;
} }
@@ -420,14 +425,18 @@ void display_and_vsync(void) {
profiler_log_thread5_time(THREAD5_END); profiler_log_thread5_time(THREAD5_END);
osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK); osRecvMesg(&gGameVblankQueue, &gMainReceivedMesg, OS_MESG_BLOCK);
// Skip swapping buffers on emulator so that they display immediately as the Gfx task finishes // Skip swapping buffers on emulator so that they display immediately as the Gfx task finishes
if ((*(volatile u32 *)0xA4100010) != 0) { // Read RDP Clock Register, has a value of zero on emulators #ifndef VC_HACKS
if (gIsConsole) { // Read RDP Clock Register, has a value of zero on emulators
#endif
if (++sRenderedFramebuffer == 3) { if (++sRenderedFramebuffer == 3) {
sRenderedFramebuffer = 0; sRenderedFramebuffer = 0;
} }
if (++sRenderingFrameBuffer == 3) { if (++sRenderingFrameBuffer == 3) {
sRenderingFrameBuffer = 0; sRenderingFrameBuffer = 0;
} }
#ifndef VC_HACKS
} }
#endif
gGlobalTimer++; gGlobalTimer++;
} }

View File

@@ -36,7 +36,6 @@ u8 textCurrRatio43[] = { TEXT_HUD_CURRENT_RATIO_43 };
u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 }; u8 textCurrRatio169[] = { TEXT_HUD_CURRENT_RATIO_169 };
u8 textPressL[] = { TEXT_HUD_PRESS_L }; u8 textPressL[] = { TEXT_HUD_PRESS_L };
u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO }; u8 textWideInfo[] = { TEXT_HUD_WIDE_INFO };
u8 textWideInfo2[] = { TEXT_HUD_WIDE_INFO2 };
#endif #endif
extern u8 gLastCompletedCourseNum; extern u8 gLastCompletedCourseNum;
@@ -1505,7 +1504,6 @@ void render_widescreen_setting(void) {
print_generic_string(10, 20, textCurrRatio169); print_generic_string(10, 20, textCurrRatio169);
print_generic_string(10, 7, textPressL); print_generic_string(10, 7, textPressL);
print_generic_string(10, 220, textWideInfo); print_generic_string(10, 220, textWideInfo);
print_generic_string(10, 200, textWideInfo2);
} }
gSPDisplayList(gDisplayListHead++, dl_ia_text_end); gSPDisplayList(gDisplayListHead++, dl_ia_text_end);
if (gPlayer1Controller->buttonPressed & L_TRIG){ if (gPlayer1Controller->buttonPressed & L_TRIG){

Binary file not shown.

Binary file not shown.