Compare commits

..

6 Commits

14 changed files with 86 additions and 146 deletions

View File

@@ -119,10 +119,20 @@ else ifeq ($(GRUCODE),super3d) # Super3D
DEFINES += SUPER3D_GBI=1 F3D_NEW=1
endif
LIBRARIES := nustd hvqm2 z goddard
# TEXT ENGINES
# s2dex_text_engine - Text Engine by someone2639
TEXT_ENGINE := none
$(eval $(call validate-option,TEXT_ENGINE,none s2dex_text_engine))
ifeq ($(TEXT_ENGINE), s2dex_text_engine)
DEFINES += S2DEX_GBI_2=1 S2DEX_TEXT_ENGINE=1
LIBRARIES += s2d_engine
DUMMY != make -C src/s2d_engine COPY_DIR=$(shell pwd)/lib/
endif
# add more text engines here
LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))
#==============================================================================#
# Optimization flags #
@@ -200,12 +210,6 @@ endif
# 0 - does not
UNF ?= 0
$(eval $(call validate-option,UNF,0 1))
# if `unf` is a target, make sure that UNF is set
ifneq ($(filter unf,$(MAKECMDGOALS)),)
UNF = 1
endif
ifeq ($(UNF),1)
DEFINES += UNF=1
SRC_DIRS += src/usb
@@ -407,18 +411,6 @@ else
$(error Unable to detect a suitable MIPS toolchain installed)
endif
LIBRARIES := nustd hvqm2 z goddard
# Text engine
ifeq ($(TEXT_ENGINE), s2dex_text_engine)
DEFINES += S2DEX_GBI_2=1 S2DEX_TEXT_ENGINE=1
LIBRARIES += s2d_engine
DUMMY != $(MAKE) -C src/s2d_engine COPY_DIR=$(shell pwd)/lib/ CROSS=$(CROSS)
endif
# add more text engines here
LINK_LIBRARIES = $(foreach i,$(LIBRARIES),-l$(i))
export LD_LIBRARY_PATH=./tools
AS := $(CROSS)as
@@ -510,13 +502,8 @@ endif
ENDIAN_BITWIDTH := $(BUILD_DIR)/endian-and-bitwidth
EMULATOR = mupen64plus
EMU_FLAGS =
ifneq (,$(call find-command,wslview))
LOADER = ./$(TOOLS_DIR)/UNFLoader.exe
else
LOADER = ./$(TOOLS_DIR)/UNFLoader
endif
LOADER = loader64
LOADER_FLAGS = -vwf
SHA1SUM = sha1sum
PRINT = printf
@@ -566,18 +553,8 @@ test-pj64: $(ROM)
wine ~/Desktop/new64/Project64.exe $<
# someone2639
# download and extract most recent unfloader build if needed
$(LOADER):
ifeq (,$(wildcard $(LOADER)))
@$(PRINT) "Downloading latest UNFLoader...$(NO_COL)\n"
$(PYTHON) $(TOOLS_DIR)/get_latest_unfloader.py $(TOOLS_DIR)
endif
load: $(ROM) $(LOADER)
$(LOADER) -r $<
unf: $(ROM) $(LOADER)
$(LOADER) -d -r $<
load: $(ROM)
$(LOADER) $(LOADER_FLAGS) $<
libultra: $(BUILD_DIR)/libultra.a

View File

@@ -9,9 +9,3 @@
* Currently this just starts the credits, and enables PUPPYPRINT_DEBUG.
*/
// #define ENABLE_CREDITS_BENCHMARK
#ifdef ENABLE_CREDITS_BENCHMARK
#define DEBUG_ALL
#define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS
#define TEST_LEVEL LEVEL_CASTLE_GROUNDS
#endif

View File

@@ -21,12 +21,17 @@
#define USE_PROFILER
/**
* -- TEST LEVEL --
* Uncomment this define and set a test level in order to boot straight into said level.
* This allows you to quickly test the level you're working on.
* If you want the game to boot normally, just comment out the define again.
* -- DEBUG STARTUP SPAWN PARAMETERS --
* Sets a level in order to boot straight into said level, skipping the title screen and file select.
* This allows you to quickly test the level or location you're working on.
* NOTE: STARTUP_SPAWN_LEVEL is required for the other parameters to have an effect.
* NOTE: It is recommended to set STARTUP_SPAWN_POS in addition to STARTUP_SPAWN_AREA, otherwise the default position may be out of bounds.
* NOTE: STARTUP_SPAWN_ANGLE is an s16 angle.
*/
// #define TEST_LEVEL LEVEL_BOB
// #define STARTUP_SPAWN_LEVEL LEVEL_BOB
// #define STARTUP_SPAWN_AREA 1
// #define STARTUP_SPAWN_POS 0, 0, 0
// #define STARTUP_SPAWN_ANGLE 0x0
/**
* Enables debug level select. Hold L while the game boots to turn it on.

View File

@@ -75,7 +75,10 @@
#ifdef DISABLE_ALL
#undef DEBUG_ALL
#undef TEST_LEVEL
#undef STARTUP_SPAWN_LEVEL
#undef STARTUP_SPAWN_AREA
#undef STARTUP_SPAWN_POS
#undef STARTUP_SPAWN_ANGLE
#undef DEBUG_LEVEL_SELECT
#undef ENABLE_DEBUG_FREE_MOVE
#undef VANILLA_DEBUG
@@ -87,6 +90,7 @@
#undef COMPLETE_SAVE_FILE
#undef DEBUG_FORCE_CRASH_ON_BOOT
#undef USE_PROFILER
#undef ENABLE_CREDITS_BENCHMARK
#endif // DISABLE_ALL
#ifdef DEBUG_ALL
@@ -112,6 +116,12 @@
#define COMPLETE_SAVE_FILE
#endif // DEBUG_ALL
#ifndef STARTUP_SPAWN_LEVEL
#undef STARTUP_SPAWN_AREA
#undef STARTUP_SPAWN_POS
#undef STARTUP_SPAWN_ANGLE
#endif // STARTUP_SPAWN_LEVEL
#ifdef PUPPYPRINT_DEBUG
#undef PUPPYPRINT
#define PUPPYPRINT
@@ -125,6 +135,17 @@
#endif // COMPLETE_SAVE_FILE
/*****************
* config_benchmark.h
*/
#ifdef ENABLE_CREDITS_BENCHMARK
#define DEBUG_ALL
#define ENABLE_VANILLA_LEVEL_SPECIFIC_CHECKS
#define STARTUP_SPAWN_LEVEL LEVEL_CASTLE_GROUNDS
#endif
/*****************
* config_camera.h
*/

View File

@@ -377,10 +377,9 @@ enum GoddardScene {
CMD_BBBB(destArea, destNode, flags, 0x00)
#define INSTANT_WARP(index, destArea, displaceX, displaceY, displaceZ) \
CMD_BBBB(LEVEL_CMD_CREATE_INSTANT_WARP, 0x10, index, destArea), \
CMD_W(displaceX), \
CMD_W(displaceY), \
CMD_W(displaceZ)
CMD_BBBB(LEVEL_CMD_CREATE_INSTANT_WARP, 0x0C, index, destArea), \
CMD_HH(displaceX, displaceY), \
CMD_HH(displaceZ, 0x0000)
#define LOAD_AREA(area) \
CMD_BBBB(LEVEL_CMD_LOAD_AREA, 0x04, area, 0x00)

View File

@@ -227,10 +227,6 @@ enum SurfaceTypes {
SURFACE_TRAPDOOR, // 0x00FF // Bowser Left trapdoor, has no action defined
};
// From Surface 0x1B to 0x1E
#define INSTANT_WARP_INDEX_START 0x00 // Equal and greater than Surface 0x1B
#define INSTANT_WARP_INDEX_STOP 0x04 // Less than Surface 0x1F
#define SURFACE_IS_NEW_WATER(cmd) (((cmd) == SURFACE_NEW_WATER) || ((cmd) == SURFACE_NEW_WATER_BOTTOM))
#define SURFACE_IS_QUICKSAND(cmd) ((((cmd) >= SURFACE_SHALLOW_QUICKSAND) && ((cmd) <= SURFACE_MOVING_QUICKSAND)) || ((cmd) == SURFACE_INSTANT_MOVING_QUICKSAND))
#define SURFACE_IS_NOT_HARD(cmd) (((cmd) != SURFACE_HARD) && !((cmd) >= SURFACE_HARD_SLIPPERY && ((cmd) <= SURFACE_HARD_NOT_SLIPPERY)))
@@ -242,7 +238,7 @@ enum SurfaceTypes {
#define SURFACE_IS_PAINTING_WARP_LEFT(cmd) ((((cmd) - SURFACE_PAINTING_WARP_D3 ) % 3) == 0)
#define SURFACE_IS_PAINTING_WARP_MIDDLE(cmd) ((((cmd) - SURFACE_PAINTING_WARP_D4 ) % 3) == 0)
#define SURFACE_IS_PAINTING_WARP_RIGHT(cmd) ((((cmd) - SURFACE_PAINTING_WARP_D5 ) % 3) == 0)
#define SURFACE_IS_INSTANT_WARP(cmd) (((cmd) >= SURFACE_INSTANT_WARP_1B) && ((cmd) < SURFACE_INSTANT_WARP_1B + INSTANT_WARP_INDEX_STOP))
#define SURFACE_IS_INSTANT_WARP(cmd) (((cmd) >= SURFACE_INSTANT_WARP_1B) && ((cmd) <= SURFACE_INSTANT_WARP_1E))
#define SURFACE_IS_WARP(cmd) (((cmd) == SURFACE_LOOK_UP_WARP) || ((cmd) == SURFACE_WOBBLING_WARP) || SURFACE_IS_PAINTING_WARP(cmd) || SURFACE_IS_INSTANT_WARP(cmd))
#define SURFACE_IS_UNSAFE(cmd) (((cmd) == SURFACE_BURNING) || SURFACE_IS_QUICKSAND(cmd) || SURFACE_IS_WARP(cmd))

View File

@@ -14,8 +14,8 @@ const LevelScript level_script_entry[] = {
INIT_LEVEL(),
SLEEP(/*frames*/ 2),
BLACKOUT(/*active*/ FALSE),
#ifdef TEST_LEVEL
SET_REG(/*value*/ TEST_LEVEL),
#ifdef STARTUP_SPAWN_LEVEL
SET_REG(/*value*/ STARTUP_SPAWN_LEVEL),
EXECUTE(/*seg*/ SEGMENT_GLOBAL_LEVEL_SCRIPT, /*script*/ _scriptsSegmentRomStart, /*scriptEnd*/ _scriptsSegmentRomEnd, /*entry*/ level_main_scripts_entry),
#else
SET_REG(/*value*/ 0),

View File

@@ -540,12 +540,12 @@ static void level_cmd_create_instant_warp(void) {
warp = gAreas[sCurrAreaIndex].instantWarps + CMD_GET(u8, 2);
warp[0].id = SURFACE_INSTANT_WARP_1B + CMD_GET(u8, 2);
warp[0].id = 1;
warp[0].area = CMD_GET(u8, 3);
warp[0].displacement[0] = CMD_GET(s32, 4);
warp[0].displacement[1] = CMD_GET(s32, 8);
warp[0].displacement[2] = CMD_GET(s32, 12);
vec3s_set(warp[0].displacement, CMD_GET(s16, 4),
CMD_GET(s16, 6),
CMD_GET(s16, 8));
}
sCurrentCmd = CMD_NEXT;
@@ -692,6 +692,10 @@ static void level_cmd_unload_area(void) {
sCurrentCmd = CMD_NEXT;
}
#ifdef STARTUP_SPAWN_LEVEL
static u8 sFirstWarp = TRUE;
#endif
static void level_cmd_set_mario_start_pos(void) {
gMarioSpawnInfo->areaIndex = CMD_GET(u8, 2);
@@ -700,7 +704,25 @@ static void level_cmd_set_mario_start_pos(void) {
#else
vec3s_copy(gMarioSpawnInfo->startPos, CMD_GET(Vec3s, 6));
#endif
vec3s_set(gMarioSpawnInfo->startAngle, 0, CMD_GET(s16, 4) * 0x8000 / 180, 0);
vec3s_set(gMarioSpawnInfo->startAngle, 0x0, degrees_to_angle(CMD_GET(s16, 4)), 0x0);
#ifdef STARTUP_SPAWN_LEVEL
if (sFirstWarp) {
sFirstWarp = FALSE;
#ifdef STARTUP_SPAWN_AREA
if (gAreaData[STARTUP_SPAWN_AREA].terrainData != NULL) {
gMarioSpawnInfo->areaIndex = STARTUP_SPAWN_AREA;
}
#endif
#ifdef STARTUP_SPAWN_POS
vec3s_set(gMarioSpawnInfo->startPos, STARTUP_SPAWN_POS);
#endif
#ifdef STARTUP_SPAWN_ANGLE
gMarioSpawnInfo->startAngle[1] = STARTUP_SPAWN_ANGLE;
#endif
}
#endif // STARTUP_SPAWN_LEVEL
sCurrentCmd = CMD_NEXT;
}

View File

@@ -20,10 +20,14 @@ struct ObjectWarpNode {
/*0x08*/ struct ObjectWarpNode *next;
};
// From Surface 0x1B to 0x1E
#define INSTANT_WARP_INDEX_START 0x00 // Equal and greater than Surface 0x1B
#define INSTANT_WARP_INDEX_STOP 0x04 // Less than Surface 0x1F
struct InstantWarp {
/*0x00*/ u8 id; // 0 = 0x1B / 1 = 0x1C / 2 = 0x1D / 3 = 0x1E
/*0x01*/ u8 area;
/*0x04*/ Vec3f displacement;
/*0x02*/ Vec3s displacement;
};
struct SpawnInfo {

View File

@@ -435,9 +435,6 @@ void update_walking_speed(struct MarioState *m) {
// Slow down if moving backwards
m->forwardVel += 1.1f;
} else if (m->forwardVel <= targetSpeed) {
if (m->forwardVel <= 8.0f) {
m->forwardVel = MIN(m->intendedMag, 8.0f); // same fix as melee dashback
}
// If accelerating
m->forwardVel += 1.1f - m->forwardVel / 43.0f;
} else if (m->floor->normal.y >= 0.95f) {

View File

@@ -10,6 +10,7 @@ DUMMY != mkdir -p $(BUILD_DIR)
C_FILES = $(wildcard ./*.c)
O_FILES = $(foreach file,$(C_FILES),$(BUILD_DIR)/$(file:.c=.o))
CROSS := mips-linux-gnu-
CC = $(CROSS)gcc
AR = $(CROSS)ar

View File

@@ -72,7 +72,6 @@ all: all-except-recomp
clean:
$(RM) $(ALL_PROGRAMS)
$(RM) UNFLoader*
$(MAKE) -C audiofile clean
define COMPILE

View File

@@ -18,24 +18,8 @@ if [ -z "$QEMU_IRIX" ]; then
exit 1
fi
# detect prefix for MIPS toolchain unless CROSS is already defined
if [ -z "$CROSS" ]; then
if command -v mips64-elf-ld &> /dev/null ; then
CROSS=mips64-elf-
elif command -v mips-n64-ld &> /dev/null ; then
CROSS=mips-n64-
elif command -v mips64-ld &> /dev/null ; then
CROSS=mips64-
elif command -v mips-linux-gnu-ld &> /dev/null ; then
CROSS=mips-linux-gnu-
elif command -v mips64-linux-gnu-ld &> /dev/null ; then
CROSS=mips64-linux-gnu-
elif command -v mips-ld &> /dev/null ; then
CROSS=mips-
else
echo "Unable to detect a suitable MIPS toolchain installed"
exit 1
fi
fi
# bss indexing starts at 3

View File

@@ -1,59 +0,0 @@
import platform
import os
import zipfile
import stat
import sys
from requests import request
def get_latest_build_artifacts_url():
res = request('GET', 'https://dev.azure.com/buu342/6fa21e4f-4c4b-425c-891d-28537ab457a9/_apis/build/builds?$top=1&api-version=4.1')
body = res.json()
return os.path.join(body['value'][0]['url'], 'artifacts')
def main():
destpath = sys.argv[1] if len(sys.argv) > 1 else './'
is_wsl = 'microsoft-standard' in str(platform.uname()).lower()
unf_fn = 'UNFLoader.exe' if is_wsl else 'UNFLoader'
artifact_url = get_latest_build_artifacts_url()
# get all artifacts from most recent build
artifacts_res = request('GET', f'{artifact_url}?api-version=4.1')
artifacts = artifacts_res.json()['value']
# get artifact url for current platform
platform_artifact_url = None
platform_name = 'windows' if is_wsl else 'linux'
for artifact in artifacts:
a_name = artifact['name']
if platform_name in a_name:
platform_artifact_url = artifact['resource']['downloadUrl']
# download unf zipfile
artifact_res = request('GET', platform_artifact_url)
with open('UNFLoader.zip', 'wb') as unf_fp:
unf_fp.write(artifact_res.content)
# only extract the specific file that we need
unfpath = None
with zipfile.ZipFile('UNFLoader.zip', 'r') as zip_ref:
for zipinfo in zip_ref.infolist():
if not zipinfo.is_dir():
unfpath = zip_ref.extract(zipinfo)
unf_bin_path = os.path.join(destpath, unf_fn)
# file gets extracted to ./unfloader-{platform}/UNFLoader[.exe],
# so move binary to ./UNFLoader[.exe]
os.rename(unfpath, unf_bin_path)
# remove ./unfloader-{platform}/ directory
os.rmdir(unfpath.rstrip(unf_fn))
# remove UNFLoader.zip
os.remove('UNFLoader.zip')
# now need to add executable file permissions to unfloader
st = os.stat(unf_bin_path)
os.chmod(unf_bin_path, st.st_mode | stat.S_IEXEC)
if __name__ == '__main__':
main()