Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GCC ?= 0
# eu.v10 - builds the 1997 1.0 PAL version
# eu.v11 - builds the 1997 1.1 PAL version
VERSION ?= us
$(eval $(call validate-option,VERSION,us eu.v10 eu.v11))
$(eval $(call validate-option,VERSION,us eu.v10 eu.v11 jp.v10 jp.v11))

ifeq ($(VERSION),us)
DEFINES += VERSION_US=1
Expand All @@ -51,6 +51,12 @@ else ifeq ($(VERSION),eu.v10)
else ifeq ($(VERSION),eu.v11)
DEFINES += VERSION_EU=1 VERSION_EU_V11=1
GRUCODE ?= f3dex_old
else ifeq ($(VERSION),jp.v10)
DEFINES += VERSION_JP=1 VERSION_JP_V10=1
GRUCODE ?= f3dex_old
else ifeq ($(VERSION),jp.v11)
DEFINES += VERSION_JP=1 VERSION_JP_V11=1
GRUCODE ?= f3dex_old
endif

ifeq ($(DEBUG),1)
Expand Down
19 changes: 17 additions & 2 deletions asm/rom_header.s
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,27 @@

.ifdef VERSION_EU
.ascii "P" /* PAL (Europe) */
.else
.endif

.ifdef VERSION_JP
.ascii "J" /* NTSC-J (Japan) */
.endif

.ifdef VERSION_US
.ascii "E" /* NTSC-U (North America) */
.endif


.ifdef VERSION_EU_V11
.set REVISION_V11, 1
.endif

.ifdef VERSION_JP_V11
.set REVISION_V11, 1
.endif

.ifdef REVISION_V11
.byte 0x01 /* Version */
.else
.byte 0x00 /* Version */
.endif
.endif
4 changes: 4 additions & 0 deletions diff_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def add_custom_arguments(parser):
help="Set version to EU 1.0.")
group.add_argument('-eu11', dest='lang', action='store_const', const='eu.v11',
help="Set version to EU 1.1.")
group.add_argument('-jp10', dest='lang', action='store_const', const='jp.v10',
help="Set version to JP 1.0.")
group.add_argument('-jp11', dest='lang', action='store_const', const='jp.v11',
help="Set version to JP 1.1.")

def apply(config, args):
lang = args.lang or 'us'
Expand Down
16 changes: 16 additions & 0 deletions first-diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@
const="eu.v11",
dest="version",
)
versionGroup.add_argument(
"-j",
"--jp10",
help="use Japanese (1.0) version",
action="store_const",
const="jp.v10",
dest="version",
)
versionGroup.add_argument(
"-J",
"--jp11",
help="use Japanese (1.1) version",
action="store_const",
const="jp.v11",
dest="version",
)
parser.add_argument(
"-m", "--make", help="run make before finding difference(s)", action="store_true"
)
Expand Down
4 changes: 2 additions & 2 deletions include/PR/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#define A_INTERLEAVE 13
#define A_SETLOOP 15

#if !(defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU))
#if !(defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_JP))

#define A_ENVMIXER 3
#define A_LOADBUFF 4
Expand Down Expand Up @@ -636,7 +636,7 @@ typedef short ENVMIX_STATE[40];
_a->words.w1 = (uintptr_t) (tr); \
}

#if defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU)
#if defined(VERSION_SH) || defined(VERSION_US) || defined(VERSION_EU) || defined(VERSION_JP)
#undef aLoadBuffer
#undef aSaveBuffer
#undef aMix
Expand Down
1 change: 1 addition & 0 deletions mk64.jp.v10.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
afeeec65b9a03f0cb8ec92f9ba7a9f0122e8bd0e build/jp.v10/mk64.jp.v10.z64
1 change: 1 addition & 0 deletions mk64.jp.v11.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9f439457585146a4e1da7e1dd9104f7f94381688 build/jp.v11/mk64.jp.v11.z64
10 changes: 10 additions & 0 deletions mk64.ld
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ SECTIONS
BUILD_DIR/src/main.o(.text*);
BUILD_DIR/src/code_800029B0.o(.text*);
BUILD_DIR/src/profiler.o(.text*);
#ifdef VERSION_JP // TODO: Arrange these in data, rodata and bss
BUILD_DIR/src/staff_ghosts.o(.text*);
BUILD_DIR/src/camera.o(.text*);
BUILD_DIR/src/cpu_vehicles_camera_path.jp.o(.text*);
BUILD_DIR/src/animation.o(.text*);
BUILD_DIR/src/render_player.o(.text*);
BUILD_DIR/src/crash_screen.o(.text*);
BUILD_DIR/src/kart_dma.o(.text*);
#else
BUILD_DIR/src/crash_screen.o(.text*);
BUILD_DIR/src/animation.o(.text*);
BUILD_DIR/src/staff_ghosts.o(.text*);
Expand All @@ -56,6 +65,7 @@ SECTIONS
BUILD_DIR/src/camera.o(.text*);
BUILD_DIR/src/render_player.o(.text*);
BUILD_DIR/src/kart_dma.o(.text*);
#endif
BUILD_DIR/src/player_controller.o(.text*);
BUILD_DIR/src/spawn_players.o(.text*);
BUILD_DIR/src/code_8003DC40.o(.text*);
Expand Down
171 changes: 96 additions & 75 deletions src/cpu_vehicles_camera_path/cpu_speed_control.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,93 +133,114 @@ void regulate_cpu_speed(s32 playerId, f32 targetSpeed, Player* player) {
s32 var_a1;

speed = player->speed;
if (!(player->effects & 0x80) && !(player->effects & 0x40) && !(player->effects & 0x20000) &&
!(player->soundEffects & 0x400000) && !(player->soundEffects & 0x01000000) && !(player->soundEffects & 2) &&
!(player->soundEffects & 4)) {
if (gCurrentCourseId == COURSE_AWARD_CEREMONY) {
func_80007FA4(playerId, player, speed);
} else if ((bStopAICrossing[playerId] == true) && !(player->effects & (STAR_EFFECT | BOO_EFFECT))) {
decelerate_player(player, 10.0f);
if (player->currentSpeed == 0.0) {
player->velocity[0] = 0.0f;
player->velocity[2] = 0.0f;

if (player->effects & 0x80 || player->effects & 0x40 || player->effects & 0x20000) {
return;
}

if (player->soundEffects & 0x400000 || player->soundEffects & 0x01000000) {
return;
}

if (player->soundEffects & 2 || player->soundEffects & 4) {
return;
}

if (gCurrentCourseId == COURSE_AWARD_CEREMONY) {
func_80007FA4(playerId, player, speed);
return;
}

#ifdef VERSION_JP
check_ai_crossing_distance(playerId);
#endif

if ((bStopAICrossing[playerId] == true) && !(player->effects & (STAR_EFFECT | BOO_EFFECT))) {
#ifdef VERSION_JP
player->effects &= ~UNKNOWN_EFFECT_0x200000;
#endif
decelerate_player(player, 10.0f);
if (player->currentSpeed == 0.0) {
player->velocity[0] = 0.0f;
player->velocity[2] = 0.0f;
}
} else {
var_f0 = 3.3333333f;
switch (gCCSelection) { /* irregular */
case CC_100:
case CC_EXTRA:
break;
case CC_50:
var_f0 = 2.5f;
break;
case CC_150:
var_f0 = 3.75f;
break;
}
if (speed < var_f0) {
#ifndef VERSION_JP
player->effects &= ~UNKNOWN_EFFECT_0x200000;
#endif
player_accelerate(player);
} else if (player->type & PLAYER_CINEMATIC_MODE) {
if (speed < targetSpeed) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
decelerate_player(player, 1.0f);
}
} else if ((D_801631E0[playerId] == true) && (D_80163330[playerId] != 1)) {
if (func_800088D8(playerId, gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerIdDup[playerId]) ==
1) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
decelerate_player(player, 1.0f);
}
} else {
var_f0 = 3.3333333f;
switch (gCCSelection) { /* irregular */
case CC_100:
case CC_EXTRA:
var_a1 = 1;
switch (gSpeedCPUBehaviour[playerId]) { /* switch 1; irregular */
case SPEED_cpu_BEHAVIOUR_FAST: /* switch 1 */
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
break;
case CC_50:
var_f0 = 2.5f;
case SPEED_cpu_BEHAVIOUR_MAX: /* switch 1 */
player->effects |= UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
break;
case SPEED_cpu_BEHAVIOUR_SLOW: /* switch 1 */
if (((speed / 18.0f) * 216.0f) > 20.0f) {
targetSpeed = 1.6666666f;
}
var_a1 = 0;
break;
case CC_150:
var_f0 = 3.75f;
case SPEED_cpu_BEHAVIOUR_NORMAL: /* switch 1 */
default: /* switch 1 */
var_a1 = 0;
break;
}
if (speed < var_f0) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else if (player->type & PLAYER_CINEMATIC_MODE) {
if (var_a1 != 1) {
if (speed < targetSpeed) {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
decelerate_player(player, 1.0f);
}
} else if ((D_801631E0[playerId] == true) && (D_80163330[playerId] != 1)) {
if (func_800088D8(playerId, gLapCountByPlayerId[playerId], gGPCurrentRaceRankByPlayerIdDup[playerId]) ==
1) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
decelerate_player(player, 1.0f);
}
} else {
var_a1 = 1;
switch (gSpeedCPUBehaviour[playerId]) { /* switch 1; irregular */
case SPEED_cpu_BEHAVIOUR_FAST: /* switch 1 */
player->effects &= ~UNKNOWN_EFFECT_0x200000;
if ((gDemoMode == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) {
player_accelerate(player);
break;
case SPEED_cpu_BEHAVIOUR_MAX: /* switch 1 */
} else if (D_80163330[playerId] == 1) {
func_80007D04(playerId, player);
} else if (func_800088D8(playerId, gLapCountByPlayerId[playerId],
gGPCurrentRaceRankByPlayerIdDup[playerId]) == true) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
break;
case SPEED_cpu_BEHAVIOUR_SLOW: /* switch 1 */
if (((speed / 18.0f) * 216.0f) > 20.0f) {
targetSpeed = 1.6666666f;
}
var_a1 = 0;
break;
case SPEED_cpu_BEHAVIOUR_NORMAL: /* switch 1 */
default: /* switch 1 */
var_a1 = 0;
break;
}
if (var_a1 != 1) {
if (speed < targetSpeed) {
if ((gDemoMode == 1) && (gCurrentCourseId != COURSE_AWARD_CEREMONY)) {
player_accelerate(player);
} else if (D_80163330[playerId] == 1) {
func_80007D04(playerId, player);
} else if (func_800088D8(playerId, gLapCountByPlayerId[playerId],
gGPCurrentRaceRankByPlayerIdDup[playerId]) == true) {
player->effects |= UNKNOWN_EFFECT_0x200000;
player_accelerate(player);
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
decelerate_player(player, 1.0f);
}
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
if (targetSpeed > 1.0f) {
decelerate_player(player, 2.0f);
} else {
decelerate_player(player, 5.0f);
}
decelerate_player(player, 1.0f);
}
} else {
player->effects &= ~UNKNOWN_EFFECT_0x200000;
if (targetSpeed > 1.0f) {
decelerate_player(player, 2.0f);
} else {
decelerate_player(player, 5.0f);
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ void thread1_idle(void* arg) {
osCreateViManager(OS_PRIORITY_VIMGR);
#ifdef VERSION_EU
osViSetMode(&osViModeTable[OS_VI_PAL_LAN1]);
#elif VERSION_JP
osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]);
#else // VERSION_US
if (osTvType == TV_TYPE_NTSC) {
osViSetMode(&osViModeTable[OS_VI_NTSC_LAN1]);
Expand Down
1 change: 1 addition & 0 deletions tools/m2ctx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ CPP_FLAGS = [
"-D__sgi",
"-DVERSION_US",
"-DVERSION_EU",
"-DVERSION_JP",
"-DTARGET_N64",
"-D_LANGUAGE_C",
"-DF3DEX_GBI",
Expand Down
Loading