mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-12-22 00:10:25 +00:00
Adds support for compiling other regions (#378)
* Initial support for compiling with EU. * Fix EU text. * JP now compiles, TODO: Fix Autogen to fix JP and fix text in djui. * audio: Prevent crash in EU. * audio: Sync EU audio to 60 Hz instead of 50 Hz * Add logging and remove sanity check to hopefully track EU crash. * Various improvements for EU Improve some memory debugging Improve sound debugging Initalize some variables in load.c for the sound system Synchronize the EU cutscenes with the US version. * Fix credits music playing in EU, Document some EU audio code. * Autogen now supports version excluded object fields and functions. Reran autogen in accordance. * Fix some potentional shifting issues due to version differences. * Decrease the sleep times in some spots, We do not need them to be so long. (#373) * Add the region to the version string. --------- Co-authored-by: djoslin0 <djoslin0@users.noreply.github.com>
This commit is contained in:
parent
b1662a3338
commit
ee3a7018ab
41 changed files with 1197 additions and 814 deletions
6
Makefile
6
Makefile
|
@ -1307,6 +1307,12 @@ ifeq ($(VERSION),eu)
|
|||
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/us/define_courses.inc.c
|
||||
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/de/define_courses.inc.c
|
||||
$(BUILD_DIR)/levels/menu/leveldata.o: $(BUILD_DIR)/text/fr/define_courses.inc.c
|
||||
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/include/text_strings.h
|
||||
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/us/define_courses.inc.c
|
||||
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/de/define_courses.inc.c
|
||||
$(BUILD_DIR)/src/game/level_info.o: $(BUILD_DIR)/text/fr/define_courses.inc.c
|
||||
|
||||
O_FILES += $(BUILD_DIR)/bin/eu/translation_en.o $(BUILD_DIR)/bin/eu/translation_de.o $(BUILD_DIR)/bin/eu/translation_fr.o
|
||||
else
|
||||
ifeq ($(VERSION),sh)
|
||||
TEXT_DIRS := text/jp
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/bash
|
||||
python3 ./autogen/convert_structs.py
|
||||
python3 ./autogen/convert_functions.py
|
||||
python3 ./autogen/convert_constants.py
|
||||
python3 ./autogen/convert_constants.py
|
|
@ -113,6 +113,12 @@ override_hide_functions = {
|
|||
"smlua_deprecated.h" : [ ".*" ],
|
||||
}
|
||||
|
||||
override_function_version_excludes = {
|
||||
"bhv_play_music_track_when_touched_loop": "VERSION_JP",
|
||||
"play_knockback_sound": "VERSION_JP",
|
||||
"cur_obj_spawn_star_at_y_offset": "VERSION_JP"
|
||||
}
|
||||
|
||||
lua_function_params = {
|
||||
"src/pc/lua/utils/smlua_obj_utils.h::spawn_object_sync::objSetupFunction": [ "struct Object*" ]
|
||||
}
|
||||
|
@ -596,11 +602,14 @@ def build_call(function):
|
|||
def build_function(function, do_extern):
|
||||
s = ''
|
||||
fid = function['identifier']
|
||||
|
||||
if fid in override_function_version_excludes:
|
||||
s += '#ifndef ' + override_function_version_excludes[fid] + '\n'
|
||||
|
||||
if len(function['params']) <= 0:
|
||||
s = 'int smlua_func_%s(UNUSED lua_State* L) {\n' % function['identifier']
|
||||
s += 'int smlua_func_%s(UNUSED lua_State* L) {\n' % function['identifier']
|
||||
else:
|
||||
s = 'int smlua_func_%s(lua_State* L) {\n' % function['identifier']
|
||||
s += 'int smlua_func_%s(lua_State* L) {\n' % function['identifier']
|
||||
|
||||
s += """ if (L == NULL) { return 0; }\n
|
||||
int top = lua_gettop(L);
|
||||
|
@ -628,6 +637,9 @@ def build_function(function, do_extern):
|
|||
s += '\n'
|
||||
|
||||
s += ' return 1;\n}\n'
|
||||
|
||||
if fid in override_function_version_excludes:
|
||||
s += '#endif\n'
|
||||
|
||||
function['implemented'] = 'UNIMPLEMENTED' not in s
|
||||
if 'UNIMPLEMENTED' in s:
|
||||
|
@ -648,9 +660,15 @@ def build_functions(processed_files):
|
|||
return s
|
||||
|
||||
def build_bind(function):
|
||||
s = 'smlua_bind_function(L, "%s", smlua_func_%s);' % (function['identifier'], function['identifier'])
|
||||
fid = function['identifier']
|
||||
s = 'smlua_bind_function(L, "%s", smlua_func_%s);' % (fid, fid)
|
||||
if function['implemented']:
|
||||
s = ' ' + s
|
||||
# There is no point in adding the ifndef statement if the function is commented out here anyways.
|
||||
# So we only do it on implemented functions.
|
||||
if fid in override_function_version_excludes:
|
||||
s = '#ifndef ' + override_function_version_excludes[fid] + '\n' + s
|
||||
s += '\n#endif'
|
||||
else:
|
||||
s = ' //' + s + ' <--- UNIMPLEMENTED'
|
||||
return s + "\n"
|
||||
|
|
|
@ -98,6 +98,11 @@ override_field_immutable = {
|
|||
"SpawnInfo": [ "syncID" ]
|
||||
}
|
||||
|
||||
override_field_version_excludes = {
|
||||
"oCameraLakituUnk104": "VERSION_JP",
|
||||
"oCoinUnk1B0": "VERSION_JP"
|
||||
}
|
||||
|
||||
override_allowed_structs = {
|
||||
"src/pc/network/network.h": [ 'ServerSettings' ],
|
||||
}
|
||||
|
@ -157,6 +162,8 @@ def table_to_string(table):
|
|||
|
||||
for row in table:
|
||||
for i in range(columns):
|
||||
if '#' in row[i]:
|
||||
continue
|
||||
if len(row[i]) > column_width[i]:
|
||||
column_width[i] = len(row[i])
|
||||
|
||||
|
@ -268,15 +275,24 @@ def build_struct(struct):
|
|||
if sid in override_field_invisible:
|
||||
if fid in override_field_invisible[sid]:
|
||||
continue
|
||||
|
||||
version = None
|
||||
|
||||
row = []
|
||||
row.append(' { ' )
|
||||
|
||||
startStr = ''
|
||||
endStr = ' },'
|
||||
if fid in override_field_version_excludes:
|
||||
startStr += '#ifndef ' + override_field_version_excludes[fid] + '\n'
|
||||
endStr += '\n#endif'
|
||||
startStr += ' { '
|
||||
row.append(startStr )
|
||||
row.append('"%s", ' % fid )
|
||||
row.append('%s, ' % lvt )
|
||||
row.append('offsetof(struct %s, %s), ' % (sid, field['identifier']) )
|
||||
row.append('%s, ' % fimmutable )
|
||||
row.append("%s" % lot )
|
||||
row.append(' },' )
|
||||
row.append(endStr )
|
||||
field_table.append(row)
|
||||
|
||||
field_table_str, field_count = table_to_string(field_table)
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
// Include text/define_text.inc.c, preprocessed with -I text/de/ to get the
|
||||
// right translation strings, with symbols renamed as below.
|
||||
#define seg2_course_name_table course_name_table_eu_de
|
||||
#define seg2_course_name_table_original course_name_table_eu_de_original
|
||||
#define seg2_act_name_table act_name_table_eu_de
|
||||
#define seg2_act_name_table_original act_name_table_eu_de_original
|
||||
#define seg2_dialog_table dialog_table_eu_de
|
||||
#define seg2_dialog_original dialog_table_eu_de_original
|
||||
|
||||
#include "text/de/define_text.inc.c"
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
// Include text/define_text.inc.c, preprocessed with -I text/us/ to get the
|
||||
// right translation strings, with symbols renamed as below.
|
||||
#define seg2_course_name_table course_name_table_eu_en
|
||||
#define seg2_course_name_table_original course_name_table_eu_en_original
|
||||
#define seg2_act_name_table act_name_table_eu_en
|
||||
#define seg2_act_name_table_original act_name_table_eu_en_original
|
||||
#define seg2_dialog_table dialog_table_eu_en
|
||||
#define seg2_dialog_original dialog_table_eu_en_original
|
||||
|
||||
#include "text/us/define_text.inc.c"
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
// Include text/define_text.inc.c, preprocessed with -I text/fr/ to get the
|
||||
// right translation strings, with symbols renamed as below.
|
||||
#define seg2_course_name_table course_name_table_eu_fr
|
||||
#define seg2_course_name_table_original course_name_table_eu_fr_original
|
||||
#define seg2_act_name_table act_name_table_eu_fr
|
||||
#define seg2_act_name_table_original act_name_table_eu_fr_original
|
||||
#define seg2_dialog_table dialog_table_eu_fr
|
||||
#define seg2_dialog_original dialog_table_eu_fr_original
|
||||
|
||||
#include "text/fr/define_text.inc.c"
|
||||
|
|
|
@ -86,14 +86,14 @@ ALIGNED8 const Texture texture_hud_char_I[] = {
|
|||
#include "textures/segment2/segment2.02400.rgba16.inc.c"
|
||||
};
|
||||
|
||||
ALIGNED8 static const u8 texture_hud_char_J[] = {
|
||||
#include "textures/segment2/custom_hud_j.rgba16.inc.c"
|
||||
};
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_SH)
|
||||
ALIGNED8 const Texture texture_hud_char_J[] = {
|
||||
#include "textures/segment2/segment2.02600.rgba16.inc.c"
|
||||
};
|
||||
#else
|
||||
ALIGNED8 static const u8 texture_hud_char_J[] = {
|
||||
#include "textures/segment2/custom_hud_j.rgba16.inc.c"
|
||||
};
|
||||
#endif
|
||||
|
||||
ALIGNED8 const Texture texture_hud_char_K[] = {
|
||||
|
|
|
@ -341,7 +341,9 @@ const struct BehaviorTableEntry gBehaviorTable[id_bhv_max_count] = {
|
|||
BHV_ENTRY(bhvPiranhaPlantWakingBubbles),
|
||||
BHV_ENTRY(bhvPitBowlingBall),
|
||||
BHV_ENTRY(bhvPlatformOnTrack),
|
||||
#ifndef VERSION_JP
|
||||
BHV_ENTRY(bhvPlaysMusicTrackWhenTouched),
|
||||
#endif
|
||||
BHV_ENTRY(bhvPlungeBubble),
|
||||
BHV_ENTRY(bhvPokey),
|
||||
BHV_ENTRY(bhvPokeyBodyPart),
|
||||
|
|
|
@ -256,7 +256,6 @@ s64 DynOS_Common_ParseBhvConstants(const String &_Arg, bool *found) {
|
|||
common_constant(bhvTweesterSandParticle);
|
||||
common_constant(bhvTweester);
|
||||
common_constant(bhvMerryGoRoundBooManager);
|
||||
common_constant(bhvPlaysMusicTrackWhenTouched);
|
||||
common_constant(bhvAnimatedTexture);
|
||||
common_constant(bhvBooInCastle);
|
||||
common_constant(bhvBooWithCage);
|
||||
|
@ -556,6 +555,11 @@ s64 DynOS_Common_ParseBhvConstants(const String &_Arg, bool *found) {
|
|||
common_legacy_constant(bhvFish2, bhvManyBlueFishSpawner);
|
||||
common_legacy_constant(bhvFish3, bhvFewBlueFishSpawner);
|
||||
common_legacy_constant(bhvLargeFishGroup, bhvFishSpawner);
|
||||
|
||||
// Version exclusive behaviors
|
||||
#ifndef VERSION_JP
|
||||
common_constant(bhvPlaysMusicTrackWhenTouched);
|
||||
#endif
|
||||
|
||||
*found = false;
|
||||
return 0;
|
||||
|
|
|
@ -4,6 +4,11 @@ extern "C" {
|
|||
#include "game/save_file.h"
|
||||
#include "levels/scripts.h"
|
||||
#include "pc/lua/utils/smlua_level_utils.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#include "eu_translation.h"
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -310,7 +315,11 @@ const u8 *DynOS_Level_GetName(s32 aLevel, bool aDecaps, bool aAddCourseNumber) {
|
|||
} else if (_Course >= COURSE_CAKE_END) {
|
||||
SetConvertedTextToBuffer(sBuffer, DYNOS_LEVEL_TEXT_CASTLE);
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
const u8 *_CourseName = ((const u8 **) course_name_table_eu_en)[_Course - COURSE_BOB] + 3;
|
||||
#else
|
||||
const u8 *_CourseName = ((const u8 **) seg2_course_name_table)[_Course - COURSE_BOB] + 3;
|
||||
#endif
|
||||
memcpy(sBuffer, _CourseName, DynOS_String_Length(_CourseName));
|
||||
}
|
||||
|
||||
|
@ -356,7 +365,11 @@ const u8 *DynOS_Level_GetActName(s32 aLevel, s32 aAct, bool aDecaps, bool aAddSt
|
|||
} else if (aAct >= 7) {
|
||||
SetConvertedTextToBuffer(sBuffer, DYNOS_LEVEL_TEXT_100_COINS_STAR);
|
||||
} else {
|
||||
#ifdef VERSION_EU
|
||||
const u8 *_ActName = ((const u8 **) act_name_table_eu_en)[(_Course - COURSE_BOB) * 6 + (aAct - 1)];
|
||||
#else
|
||||
const u8 *_ActName = ((const u8 **) seg2_act_name_table)[(_Course - COURSE_BOB) * 6 + (aAct - 1)];
|
||||
#endif
|
||||
memcpy(sBuffer, _ActName, DynOS_String_Length(_ActName));
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ extern "C" {
|
|||
#include "behavior_table.h"
|
||||
#include "levels/scripts.h"
|
||||
#include "object_fields.h"
|
||||
#include "engine/behavior_script.h"
|
||||
#include "engine/level_script.h"
|
||||
#include "engine/surface_load.h"
|
||||
#include "game/object_helpers.h"
|
||||
|
@ -1584,7 +1585,12 @@ static const void* sDynosBuiltinFuncs[] = {
|
|||
define_builtin(bhv_bbh_tilting_trap_platform_loop),
|
||||
define_builtin(bhv_haunted_bookshelf_loop),
|
||||
define_builtin(bhv_merry_go_round_loop),
|
||||
// We can't move this without forcing all old mods to possibly need to recompile. How annoying.
|
||||
#ifndef VERSION_JP
|
||||
define_builtin(bhv_play_music_track_when_touched_loop),
|
||||
#else
|
||||
(const void *) "bhv_play_music_track_when_touched_loop", (const void *) stub_behavior_script_2,
|
||||
#endif
|
||||
define_builtin(bhv_beta_bowser_anchor_loop),
|
||||
define_builtin(bhv_static_checkered_platform_loop),
|
||||
define_builtin(bhv_castle_floor_trap_init),
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,8 @@
|
|||
#ifndef EU_TRANSLATION_H
|
||||
#define EU_TRANSLATION_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
// EU changes most text to arrays for each language. This define allows these
|
||||
// differences to be combined.
|
||||
#ifdef VERSION_EU
|
||||
|
@ -9,16 +11,25 @@
|
|||
#define LANGUAGE_ARRAY(cmd) cmd
|
||||
#endif
|
||||
|
||||
extern void *dialog_table_eu_en[];
|
||||
extern void *course_name_table_eu_en[];
|
||||
extern void *act_name_table_eu_en[];
|
||||
extern u8 *dialog_table_eu_en[];
|
||||
extern u8 *course_name_table_eu_en[];
|
||||
extern u8 *act_name_table_eu_en[];
|
||||
extern u8 *dialog_table_eu_en_original[];
|
||||
extern u8 *course_name_table_eu_en_original[];
|
||||
extern u8 *act_name_table_eu_en_original[];
|
||||
|
||||
extern void *dialog_table_eu_fr[];
|
||||
extern void *course_name_table_eu_fr[];
|
||||
extern void *act_name_table_eu_fr[];
|
||||
extern u8 *dialog_table_eu_fr[];
|
||||
extern u8 *course_name_table_eu_fr[];
|
||||
extern u8 *act_name_table_eu_fr[];
|
||||
extern u8 *dialog_table_eu_fr_original[];
|
||||
extern u8 *course_name_table_eu_fr_original[];
|
||||
extern u8 *act_name_table_eu_fr_original[];
|
||||
|
||||
extern void *dialog_table_eu_de[];
|
||||
extern void *course_name_table_eu_de[];
|
||||
extern void *act_name_table_eu_de[];
|
||||
extern u8 *dialog_table_eu_de[];
|
||||
extern u8 *course_name_table_eu_de[];
|
||||
extern u8 *act_name_table_eu_de[];
|
||||
extern u8 *dialog_table_eu_de_original[];
|
||||
extern u8 *course_name_table_eu_de_original[];
|
||||
extern u8 *act_name_table_eu_de_original[];
|
||||
|
||||
#endif // EU_TRANSLATION_H
|
||||
|
|
|
@ -50,7 +50,7 @@ const LevelScript level_main_menu_entry_1[] = {
|
|||
GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_SAVE_FILE_NUM),
|
||||
STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
|
||||
TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
|
||||
SLEEP(/*frames*/ 16),
|
||||
SLEEP(/*frames*/ 8), // Was 16 frames
|
||||
CLEAR_LEVEL(),
|
||||
SLEEP_BEFORE_EXIT(/*frames*/ 1),
|
||||
SET_REG(/*value*/ LEVEL_CASTLE_GROUNDS),
|
||||
|
@ -80,13 +80,13 @@ const LevelScript level_main_menu_entry_2[] = {
|
|||
CALL(/*arg*/ 0, /*func*/ lvl_init_act_selector_values_and_stars),
|
||||
|
||||
/*27*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_FROM_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
|
||||
/*29*/ SLEEP(/*frames*/ 16),
|
||||
/*29*/ SLEEP(/*frames*/ 8), // Was 16 frames
|
||||
/*30*/ SET_MENU_MUSIC(/*seq*/ 0x000D),
|
||||
/*33*/ CALL_LOOP(/*arg*/ 0, /*func*/ lvl_update_obj_and_load_act_button_actions),
|
||||
/*35*/ GET_OR_SET(/*op*/ OP_SET, /*var*/ VAR_CURR_ACT_NUM),
|
||||
/*36*/ STOP_MUSIC(/*fadeOutTime*/ 0x00BE),
|
||||
/*37*/ TRANSITION(/*transType*/ WARP_TRANSITION_FADE_INTO_COLOR, /*time*/ 16, /*color*/ 0xFF, 0xFF, 0xFF),
|
||||
/*39*/ SLEEP(/*frames*/ 16),
|
||||
/*39*/ SLEEP(/*frames*/ 10), // Was 16 frames
|
||||
/*40*/ CLEAR_LEVEL(),
|
||||
/*41*/ SLEEP_BEFORE_EXIT(/*frames*/ 1),
|
||||
// L1:
|
||||
|
|
|
@ -151,7 +151,7 @@ const LevelScript level_main_scripts_entry[] = {
|
|||
LOOP_BEGIN(),
|
||||
EXECUTE(/*seg*/ 0x14, _menuSegmentRomStart, _menuSegmentRomEnd, level_main_menu_entry_2),
|
||||
JUMP_LINK(script_exec_level_table),
|
||||
SLEEP(/*frames*/ 1),
|
||||
//SLEEP(/*frames*/ 1),
|
||||
LOOP_UNTIL(/*op*/ OP_LT, /*arg*/ 0),
|
||||
JUMP_IF(/*op*/ OP_EQ, /*arg*/ -1, script_L2),
|
||||
JUMP_IF(/*op*/ OP_EQ, /*arg*/ -2, goto_mario_head_regular),
|
||||
|
|
|
@ -902,8 +902,8 @@ volatile s32 gAudioLoadLock = AUDIO_LOCK_UNINITIALIZED;
|
|||
|
||||
#if defined(VERSION_EU)
|
||||
u8 bufferDelete2[12] = { 0 };
|
||||
u8 D_EU_80302010 = 0;
|
||||
u8 D_EU_80302014 = 0;
|
||||
u8 gQueuedAudioCmdCount = 0;
|
||||
u8 gLastQueuedAudioCmdCount = 0;
|
||||
|
||||
struct OSMesgQueue *OSMesgQueues[4] = { &OSMesgQueue0, &OSMesgQueue1, &OSMesgQueue2, &OSMesgQueue3 };
|
||||
#elif defined(VERSION_JP) || defined(VERSION_US)
|
||||
|
|
|
@ -122,8 +122,8 @@ extern u32 gAudioRandom;
|
|||
#define AUDIO_INIT_POOL_SIZE (0x2500 + EXT_AUDIO_INIT_POOL_SIZE)
|
||||
#endif
|
||||
|
||||
// Normal Heap Size, Extended Heap Size, Extended Audio Init Pool Size
|
||||
#define AUDIO_HEAP_SIZE (AUDIO_HEAP_BASE + EXT_AUDIO_HEAP_SIZE + EXT_AUDIO_INIT_POOL_SIZE)
|
||||
// Normal Heap Size, Extended Heap Size
|
||||
#define AUDIO_HEAP_SIZE (AUDIO_HEAP_BASE + EXT_AUDIO_HEAP_SIZE)
|
||||
|
||||
#ifdef VERSION_SH
|
||||
extern f32 unk_sh_data_1[];
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "seq_ids.h"
|
||||
#include "dialog_ids.h"
|
||||
#include "level_table.h"
|
||||
#include "pc/debuglog.h"
|
||||
#include "pc/lua/utils/smlua_level_utils.h"
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
|
@ -281,7 +282,7 @@ u16 sLevelAcousticReaches[LEVEL_COUNT] = {
|
|||
#define VOLUME_RANGE_UNK2 0.8f
|
||||
#endif
|
||||
|
||||
const u8 sBackgroundMusicDefaultVolumeDefault[] = {
|
||||
const u8 sBackgroundMusicDefaultVolumeDefault[35] = {
|
||||
127, // SEQ_SOUND_PLAYER
|
||||
80, // SEQ_EVENT_CUTSCENE_COLLECT_STAR
|
||||
80, // SEQ_MENU_TITLE_SCREEN
|
||||
|
@ -451,7 +452,7 @@ OSPiHandle DriveRomHandle; // used in osDriveRomInit.c. Why here?
|
|||
s8 D_SH_80343E48_pad[0x8];
|
||||
#endif
|
||||
|
||||
struct Sound sSoundRequests[0x100];
|
||||
struct Sound sSoundRequests[0x100] = { 0 };
|
||||
struct ChannelVolumeScaleFade D_80360928[SEQUENCE_PLAYERS][CHANNELS_MAX] = { 0 };
|
||||
u8 sUsedChannelsForSoundBank[SOUND_BANK_COUNT] = { 0 };
|
||||
u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND_BANK] = { 0 }; // index into sSoundBanks
|
||||
|
@ -464,10 +465,10 @@ u8 sCurrentSound[SOUND_BANK_COUNT][MAX_CHANNELS_PER_SOUND_BANK] = { 0 }; // inde
|
|||
*/
|
||||
struct SoundCharacteristics sSoundBanks[SOUND_BANK_COUNT][SOUND_INDEX_COUNT] = { 0 };
|
||||
|
||||
u8 sSoundMovingSpeed[SOUND_BANK_COUNT];
|
||||
u8 sSoundMovingSpeed[SOUND_BANK_COUNT] = { 0 };
|
||||
u8 sBackgroundMusicTargetVolume;
|
||||
static u8 sLowerBackgroundMusicVolume;
|
||||
struct SequenceQueueItem sBackgroundMusicQueue[MAX_BACKGROUND_MUSIC_QUEUE_SIZE];
|
||||
struct SequenceQueueItem sBackgroundMusicQueue[MAX_BACKGROUND_MUSIC_QUEUE_SIZE] = { 0 };
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
s32 unk_sh_8034754C;
|
||||
|
@ -480,7 +481,7 @@ OSMesgQueue OSMesgQueue2;
|
|||
OSMesgQueue OSMesgQueue3;
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
|
||||
struct EuAudioCmd sAudioCmd[0x100];
|
||||
struct EuAudioCmd sAudioCmd[0x100] = { 0 };
|
||||
|
||||
OSMesg OSMesg0;
|
||||
s32 pad1; // why is there 1 s32 here
|
||||
|
@ -500,9 +501,9 @@ typedef s32 FadeT;
|
|||
#endif
|
||||
|
||||
// some sort of main thread -> sound thread dispatchers
|
||||
extern void func_802ad728(u32 bits, f32 arg);
|
||||
extern void func_802ad74c(u32 bits, u32 arg);
|
||||
extern void func_802ad770(u32 bits, s8 arg);
|
||||
extern void queue_audio_cmd_f32(u32 bits, f32 arg);
|
||||
extern void queue_audio_cmd_u32(u32 bits, u32 arg);
|
||||
extern void queue_audio_cmd_s8(u32 bits, s8 arg);
|
||||
|
||||
static void update_background_music_after_sound(u8 bank, u8 soundIndex);
|
||||
static void update_game_sound(void);
|
||||
|
@ -684,7 +685,7 @@ static void seq_player_fade_to_zero_volume(s32 player, FadeT fadeDuration) {
|
|||
/**
|
||||
* Called from threads: thread4_sound, thread5_game_loop
|
||||
*/
|
||||
static void func_8031D690(s32 player, FadeT fadeInTime) {
|
||||
static void seq_player_fade_from_zero_volume(s32 player, FadeT fadeInTime) {
|
||||
struct SequencePlayer *seqPlayer = &gSequencePlayers[player];
|
||||
|
||||
if (fadeInTime == 0 || seqPlayer->state == SEQUENCE_PLAYER_STATE_FADE_OUT) {
|
||||
|
@ -796,7 +797,7 @@ static void seq_player_fade_to_target_volume(s32 player, FadeT fadeDuration, u8
|
|||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
#ifdef VERSION_EU
|
||||
extern void func_802ad7a0(void);
|
||||
extern void send_process_queued_audio_cmds(void);
|
||||
#else
|
||||
extern void func_sh_802F64C8(void);
|
||||
#endif
|
||||
|
@ -810,7 +811,7 @@ void maybe_tick_game_sound(void) {
|
|||
sGameLoopTicked = 0;
|
||||
}
|
||||
#ifdef VERSION_EU
|
||||
func_802ad7a0();
|
||||
send_process_queued_audio_cmds();
|
||||
#else
|
||||
func_sh_802F64C8(); // moved in SH
|
||||
#endif
|
||||
|
@ -819,7 +820,7 @@ void maybe_tick_game_sound(void) {
|
|||
void func_eu_802e9bec(s32 player, s32 channel, s32 arg2) {
|
||||
// EU verson of unused_803209D8
|
||||
// chan->stopSomething2 = arg2?
|
||||
func_802ad770(0x08000000 | (player & 0xff) << 16 | (channel & 0xff) << 8, (s8) arg2);
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x08, player, channel, 0), (s8)arg2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -1428,8 +1429,8 @@ static void update_game_sound(void) {
|
|||
if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_CONSTANT_FREQUENCY)) {
|
||||
if (sSoundMovingSpeed[bank] > 8) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1));
|
||||
#else
|
||||
value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1);
|
||||
|
@ -1438,7 +1439,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)
|
||||
* ((sSoundMovingSpeed[bank] + 8.0f) / 16));
|
||||
#else
|
||||
|
@ -1448,7 +1449,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
}
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z));
|
||||
#else
|
||||
|
@ -1460,8 +1461,8 @@ static void update_game_sound(void) {
|
|||
if ((sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_SOUNDID)
|
||||
== (SOUND_MOVING_FLYING & SOUNDARGS_MASK_SOUNDID)) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex)
|
||||
+ ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0)));
|
||||
#else
|
||||
|
@ -1471,8 +1472,8 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex)
|
||||
+ ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0)));
|
||||
#else
|
||||
|
@ -1482,7 +1483,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
}
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
|
@ -1494,9 +1495,9 @@ static void update_game_sound(void) {
|
|||
// fallthrough
|
||||
case SOUND_BANK_MENU:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), 1);
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), 64);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0), 1);
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0), 64);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = 1.0f;
|
||||
|
@ -1509,16 +1510,14 @@ static void update_game_sound(void) {
|
|||
case SOUND_BANK_LUIGI_VOICE:
|
||||
case SOUND_BANK_WARIO_VOICE:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1));
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z)
|
||||
* 127.0f
|
||||
+ 0.5f);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
*sSoundBanks[bank][soundIndex].z) * 127.0f + 0.5f);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
|
||||
|
@ -1539,16 +1538,14 @@ static void update_game_sound(void) {
|
|||
case SOUND_BANK_GENERAL2:
|
||||
case SOUND_BANK_OBJ2:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2));
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z)
|
||||
* 127.0f
|
||||
+ 0.5f);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
*sSoundBanks[bank][soundIndex].z) * 127.0f + 0.5f);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
|
@ -1605,8 +1602,8 @@ static void update_game_sound(void) {
|
|||
if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_CONSTANT_FREQUENCY)) {
|
||||
if (sSoundMovingSpeed[bank] > 8) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1));
|
||||
#else
|
||||
value = get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1);
|
||||
|
@ -1615,7 +1612,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1)
|
||||
* ((sSoundMovingSpeed[bank] + 8.0f) / 16));
|
||||
#else
|
||||
|
@ -1625,7 +1622,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
}
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z));
|
||||
#else
|
||||
|
@ -1637,8 +1634,8 @@ static void update_game_sound(void) {
|
|||
if ((sSoundBanks[bank][soundIndex].soundBits & SOUNDARGS_MASK_SOUNDID)
|
||||
== (SOUND_MOVING_FLYING & SOUNDARGS_MASK_SOUNDID)) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex)
|
||||
+ ((f32) sSoundMovingSpeed[bank] / US_FLOAT(80.0)));
|
||||
#else
|
||||
|
@ -1648,8 +1645,8 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
} else {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(
|
||||
0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(
|
||||
AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex)
|
||||
+ ((f32) sSoundMovingSpeed[bank] / US_FLOAT(400.0)));
|
||||
#else
|
||||
|
@ -1659,7 +1656,7 @@ static void update_game_sound(void) {
|
|||
#endif
|
||||
}
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
|
@ -1671,9 +1668,9 @@ static void update_game_sound(void) {
|
|||
// fallthrough
|
||||
case SOUND_BANK_MENU:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8), 1);
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8), 64);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0), 1);
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0), 64);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume = 1.0f;
|
||||
|
@ -1684,16 +1681,14 @@ static void update_game_sound(void) {
|
|||
case SOUND_BANK_ACTION:
|
||||
case SOUND_BANK_MARIO_VOICE:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK1));
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z)
|
||||
* 127.0f
|
||||
+ 0.5f);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
*sSoundBanks[bank][soundIndex].z) * 127.0f + 0.5f);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
|
||||
|
@ -1714,16 +1709,14 @@ static void update_game_sound(void) {
|
|||
case SOUND_BANK_GENERAL2:
|
||||
case SOUND_BANK_OBJ2:
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x05, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
func_802ad728(0x02020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x02, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2));
|
||||
func_802ad770(0x03020000 | ((channelIndex & 0xff) << 8),
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x03, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_pan(*sSoundBanks[bank][soundIndex].x,
|
||||
*sSoundBanks[bank][soundIndex].z)
|
||||
* 127.0f
|
||||
+ 0.5f);
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
*sSoundBanks[bank][soundIndex].z) * 127.0f + 0.5f);
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
|
@ -1743,7 +1736,13 @@ static void update_game_sound(void) {
|
|||
|
||||
// add custom pitch bend
|
||||
if (soundIndex < SOUND_INDEX_COUNT && sSoundBanks[bank][soundIndex].customFreqScale != 0) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x04, SEQ_PLAYER_SFX, channelIndex, 0),
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale
|
||||
* sSoundBanks[bank][soundIndex].customFreqScale);
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale *= sSoundBanks[bank][soundIndex].customFreqScale;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Increment to the next channel that this bank owns
|
||||
|
@ -1777,8 +1776,8 @@ static void seq_player_play_sequence(u8 player, u8 seqId, u16 arg2) {
|
|||
}
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad770(0x46000000 | ((u8)(u32) player) << 16, seqId & SEQ_VARIATION);
|
||||
func_802ad74c(0x82000000 | ((u8)(u32) player) << 16 | ((u8)(seqId & SEQ_BASE_ID)) << 8, arg2);
|
||||
queue_audio_cmd_s8(AUDIO_CMD_ARGS(0x46, player, 0, 0), seqId & SEQ_VARIATION);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0x82, player, seqId & SEQ_BASE_ID, 0), arg2);
|
||||
|
||||
if (player == SEQ_PLAYER_LEVEL) {
|
||||
targetVolume = begin_background_music_fade(0);
|
||||
|
@ -1798,7 +1797,7 @@ static void seq_player_play_sequence(u8 player, u8 seqId, u16 arg2) {
|
|||
gSequencePlayers[SEQ_PLAYER_LEVEL].fadeVolume = (f32) targetVolume / US_FLOAT(127.0);
|
||||
}
|
||||
} else {
|
||||
func_8031D690(player, arg2);
|
||||
seq_player_fade_from_zero_volume(player, arg2);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1811,12 +1810,12 @@ void seq_player_fade_out(u8 player, u16 fadeDuration) {
|
|||
#ifdef VERSION_EU
|
||||
u32 fd = fadeDuration;
|
||||
#else
|
||||
s32 fd = fadeDuration; // will also match if we change function signature func_802ad74c to use s32 as arg1
|
||||
s32 fd = fadeDuration; // will also match if we change function signature queue_audio_cmd_u32 to use s32 as arg1
|
||||
#endif
|
||||
if (!player) {
|
||||
sCurrentBackgroundMusicSeqId = SEQUENCE_NONE;
|
||||
}
|
||||
func_802ad74c(0x83000000 | (player & 0xff) << 16, fd);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0x83, player, 0, 0), fd);
|
||||
#else
|
||||
if (player == SEQ_PLAYER_LEVEL) {
|
||||
sCurrentBackgroundMusicSeqId = SEQUENCE_NONE;
|
||||
|
@ -1864,7 +1863,7 @@ static void func_8031F96C(u8 player) {
|
|||
&& D_80360928[player][i].remainingFrames != 0) {
|
||||
D_80360928[player][i].current += D_80360928[player][i].velocity;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8,
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x01, player, i, 0),
|
||||
D_80360928[player][i].current);
|
||||
#else
|
||||
gSequencePlayers[player].channels[i]->volumeScale = D_80360928[player][i].current;
|
||||
|
@ -1872,10 +1871,10 @@ static void func_8031F96C(u8 player) {
|
|||
D_80360928[player][i].remainingFrames--;
|
||||
if (D_80360928[player][i].remainingFrames == 0) {
|
||||
#if defined(VERSION_EU)
|
||||
func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8,
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x01, player, i, 0),
|
||||
FLOAT_CAST(D_80360928[player][i].target) / 127.0);
|
||||
#elif defined(VERSION_SH)
|
||||
func_802ad728(0x01000000 | (player & 0xff) << 16 | (i & 0xff) << 8,
|
||||
queue_audio_cmd_f32(AUDIO_CMD_ARGS(0x01, player, i, 0),
|
||||
FLOAT_CAST(D_80360928[player][i].target) / 127.0f);
|
||||
#else
|
||||
gSequencePlayers[player].channels[i]->volumeScale =
|
||||
|
@ -2150,9 +2149,9 @@ void set_audio_muted(u8 muted) {
|
|||
for (i = 0; i < SEQUENCE_PLAYERS; i++) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
if (muted)
|
||||
func_802ad74c(0xf1000000, 0);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0xf1, 0, 0, 0), 0);
|
||||
else
|
||||
func_802ad74c(0xf2000000, 0);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0xf2, 0, 0, 0), 0);
|
||||
#else
|
||||
gSequencePlayers[i].muted = muted;
|
||||
#endif
|
||||
|
@ -2426,6 +2425,8 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
|||
u8 priority = seqArgs >> 8;
|
||||
u8 i;
|
||||
u8 foundIndex = 0;
|
||||
|
||||
//LOG_DEBUG("Playing music with arguments: %d, 0x%X, %d, %d", player, seqId, priority, fadeTimer);
|
||||
|
||||
// Except for the background music player, we don't support queued
|
||||
// sequences. Just play them immediately, stopping any old sequence.
|
||||
|
@ -2436,6 +2437,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
|||
|
||||
// Abort if the queue is already full.
|
||||
if (sBackgroundMusicQueueSize == MAX_BACKGROUND_MUSIC_QUEUE_SIZE) {
|
||||
LOG_DEBUG("Background music queue reached max size! Ignoring request to queue sequence %d.", seqId);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2449,6 +2451,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
|||
} else if (!gSequencePlayers[SEQ_PLAYER_LEVEL].enabled) {
|
||||
stop_background_music(sBackgroundMusicQueue[0].seqId);
|
||||
}
|
||||
//LOG_DEBUG("Sequence 0x%X is already in the background music queue!", seqId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2465,6 +2468,7 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) {
|
|||
// one more entry in the queue.
|
||||
if (foundIndex == 0) {
|
||||
seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer);
|
||||
//LOG_DEBUG("Playing sequence 0x%X as it's first in the background music queue!", seqId);
|
||||
sBackgroundMusicQueueSize++;
|
||||
}
|
||||
|
||||
|
@ -2671,7 +2675,7 @@ void func_803210D4(u16 fadeDuration) {
|
|||
|
||||
if (gSequencePlayers[SEQ_PLAYER_LEVEL].enabled == TRUE) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad74c(0x83000000, fadeDuration);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0x83, 0, 0, 0), fadeDuration);
|
||||
#else
|
||||
seq_player_fade_to_zero_volume(SEQ_PLAYER_LEVEL, fadeDuration);
|
||||
#endif
|
||||
|
@ -2679,7 +2683,7 @@ void func_803210D4(u16 fadeDuration) {
|
|||
|
||||
if (gSequencePlayers[SEQ_PLAYER_ENV].enabled == TRUE) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
func_802ad74c(0x83010000, fadeDuration);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0x83, SEQ_PLAYER_ENV, 0, 0), fadeDuration);
|
||||
#else
|
||||
seq_player_fade_to_zero_volume(SEQ_PLAYER_ENV, fadeDuration);
|
||||
#endif
|
||||
|
@ -2799,7 +2803,7 @@ void sound_reset(u8 presetId) {
|
|||
disable_all_sequence_players();
|
||||
sound_init();
|
||||
#ifdef VERSION_SH
|
||||
func_802ad74c(0xF2000000, 0);
|
||||
queue_audio_cmd_u32(AUDIO_CMD_ARGS(0xF2, 0, 0, 0), 0);
|
||||
#endif
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
audio_reset_session(&gAudioSessionPresets[presetId]);
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
// bit which may be read by the sequence script.
|
||||
#define SEQUENCE_ARGS(priority, seqId) ((priority << 8) | seqId)
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
#define AUDIO_CMD_ARGS(cmd, arg1, arg2, arg3) (((cmd & 0xff) << 24) | ((arg1 & 0xff) << 16) | ((arg2 & 0xff) << 8) | (arg3 & 0xff))
|
||||
#endif
|
||||
|
||||
#define SOUND_MODE_STEREO 0
|
||||
#define SOUND_MODE_MONO 3
|
||||
#define SOUND_MODE_HEADSET 1
|
||||
|
@ -21,6 +25,9 @@
|
|||
extern s32 gAudioErrorFlags;
|
||||
extern f32 gGlobalSoundSource[3];
|
||||
|
||||
extern const u8 sBackgroundMusicDefaultVolumeDefault[35];
|
||||
extern u8 sBackgroundMusicDefaultVolume[64];
|
||||
|
||||
// defined in data.c, used by the game
|
||||
extern u32 gAudioRandom;
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
#include "seqplayer.h"
|
||||
#include "effects.h"
|
||||
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
struct PoolSplit {
|
||||
|
@ -248,16 +250,23 @@ void discard_sequence(s32 seqId) {
|
|||
|
||||
void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
u8 *start;
|
||||
u8 *pos;
|
||||
u32 alignedSize = ALIGN16(size);
|
||||
|
||||
if (pool == NULL || pool->cur == NULL) {
|
||||
LOG_ERROR("Failed to allocate for sound pool! Pool is NULL!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
start = pool->cur;
|
||||
u8 *start = pool->cur;
|
||||
if (start + alignedSize <= pool->start + pool->size) {
|
||||
bzero(start, alignedSize);
|
||||
pool->cur += alignedSize;
|
||||
} else {
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes at %p (%i free)\n", ALIGN16(size), (void*)pool, pool->start + pool->size - pool->cur);
|
||||
LOG_ERROR("Tried to alloc %u bytes at %p (%i free) and failed!", ALIGN16(size), (void*)pool, pool->start + pool->size - pool->cur);
|
||||
return NULL;
|
||||
}
|
||||
if (start == NULL) {
|
||||
LOG_ERROR("An unknown error occured when allocating %u bytes at %p (%i free)!", ALIGN16(size), (void*)pool, pool->start + pool->size - pool->cur);
|
||||
return NULL;
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
|
@ -268,7 +277,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
|||
u32 alignedSize = ALIGN16(size);
|
||||
|
||||
if (pool == NULL || pool->cur == NULL) {
|
||||
fprintf(stderr, "soundAlloc failed: pull was invalid\n");
|
||||
LOG_ERROR("Failed to allocate for sound pool! Pool is NULL!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -277,7 +286,7 @@ void *soundAlloc(struct SoundAllocPool *pool, u32 size) {
|
|||
bzero(start, alignedSize);
|
||||
pool->cur += alignedSize;
|
||||
} else {
|
||||
fprintf(stderr, "soundAlloc failed: tried to alloc %u bytes at %p (%i free)\n", (unsigned int)ALIGN16(size), (void*)pool, (int)(pool->start + pool->size - pool->cur));
|
||||
LOG_ERROR("Tried to alloc %u bytes at %p (%i free) and failed!", (unsigned int)ALIGN16(size), (void*)pool, (int)(pool->start + pool->size - pool->cur));
|
||||
return NULL;
|
||||
}
|
||||
return start;
|
||||
|
@ -1199,6 +1208,7 @@ void audio_reset_session(void) {
|
|||
gAudioBufferParameters.samplesPerFrameTarget = ALIGN16(gAudioBufferParameters.frequency / gRefreshRate);
|
||||
gAudioBufferParameters.minAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget - 0x10;
|
||||
gAudioBufferParameters.maxAiBufferLength = gAudioBufferParameters.samplesPerFrameTarget + 0x10;
|
||||
//printf("samplesPerFrameTarget: %d, maxAiBufferLength: %d, minAiBufferLength: %d\n", gAudioBufferParameters.samplesPerFrameTarget, gAudioBufferParameters.maxAiBufferLength, gAudioBufferParameters.minAiBufferLength);
|
||||
#ifdef VERSION_SH
|
||||
gAudioBufferParameters.updatesPerFrame = (gAudioBufferParameters.samplesPerFrameTarget + 0x10) / 192 + 1;
|
||||
gAudioBufferParameters.samplesPerUpdate = (gAudioBufferParameters.samplesPerFrameTarget / gAudioBufferParameters.updatesPerFrame) & -8;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <assert.h>
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "data.h"
|
||||
|
@ -32,7 +33,7 @@ void func_sh_802f6a9c(void);
|
|||
void func_sh_802f51d4(struct AudioBankSound *sound, struct AudioBank *memBase, struct PatchStruct *patchInfo);
|
||||
#endif
|
||||
|
||||
struct Note *gNotes;
|
||||
struct Note *gNotes = NULL;
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
static u8 pad[4];
|
||||
|
@ -76,27 +77,31 @@ OSMesg gUnkMesgBufs2[0x10];
|
|||
#endif
|
||||
|
||||
OSMesgQueue gCurrAudioFrameDmaQueue;
|
||||
OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE];
|
||||
OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE];
|
||||
OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE] = { 0 };
|
||||
OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE] = { 0 };
|
||||
|
||||
OSMesgQueue gAudioDmaMesgQueue;
|
||||
OSMesg gAudioDmaMesg;
|
||||
OSIoMesg gAudioDmaIoMesg;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define SAMPLE_DMA_COUNT 0x100
|
||||
#else
|
||||
#define SAMPLE_DMA_COUNT 0x90
|
||||
#endif
|
||||
|
||||
#ifdef VERSION_SH
|
||||
struct SharedDma *sSampleDmas; // sh: 0x803503D0
|
||||
struct SharedDma *sSampleDmas = NULL; // sh: 0x803503D0
|
||||
#else
|
||||
struct SharedDma sSampleDmas[SAMPLE_DMA_COUNT];
|
||||
struct SharedDma sSampleDmas[SAMPLE_DMA_COUNT] = { 0 };
|
||||
#endif
|
||||
u32 gSampleDmaNumListItems; // sh: 0x803503D4
|
||||
u32 sSampleDmaListSize1; // sh: 0x803503D8
|
||||
u32 sUnused80226B40; // set to 0, never read, sh: 0x803503DC
|
||||
|
||||
// Circular buffer of DMAs with ttl = 0. tail <= head, wrapping around mod 256.
|
||||
u8 sSampleDmaReuseQueue1[256];
|
||||
u8 sSampleDmaReuseQueue2[256];
|
||||
u8 sSampleDmaReuseQueue1[256] = { 0 };
|
||||
u8 sSampleDmaReuseQueue2[256] = { 0 };
|
||||
u8 sSampleDmaReuseQueueTail1;
|
||||
u8 sSampleDmaReuseQueueTail2;
|
||||
u8 sSampleDmaReuseQueueHead1; // sh: 0x803505E2
|
||||
|
@ -104,11 +109,11 @@ u8 sSampleDmaReuseQueueHead2; // sh: 0x803505E3
|
|||
|
||||
// bss correct up to here
|
||||
|
||||
ALSeqFile *gSeqFileHeader;
|
||||
ALSeqFile *gAlCtlHeader;
|
||||
ALSeqFile *gAlTbl;
|
||||
u8 *gAlBankSets;
|
||||
u16 gSequenceCount;
|
||||
ALSeqFile *gSeqFileHeader = NULL;
|
||||
ALSeqFile *gAlCtlHeader = NULL;
|
||||
ALSeqFile *gAlTbl = NULL;
|
||||
u8 *gAlBankSets = NULL;
|
||||
u16 gSequenceCount = 0;
|
||||
|
||||
struct CtlEntry *gCtlEntries; // sh: 0x803505F8
|
||||
|
||||
|
@ -417,6 +422,9 @@ void init_sample_dma_buffers(UNUSED s32 arg0) {
|
|||
sDmaBufSize = 144 * 9 * 4;
|
||||
#endif
|
||||
|
||||
// Sanity check to prevent a buffer overflow into memory we're not supposed to touch.
|
||||
assert(gSampleDmaNumListItems < SAMPLE_DMA_COUNT);
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
for (s32 i = 0; i < gMaxSimultaneousNotes * 3 * gAudioBufferParameters.presetUnk4; i++)
|
||||
#else
|
||||
|
@ -1850,8 +1858,10 @@ void audio_init() {
|
|||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
D_EU_802298D0 = 20.03042f;
|
||||
gRefreshRate = 50;
|
||||
// We want the refresh rate to be 60 FPS on PC.
|
||||
// We shouldn't need to worry about PAL specfic computers anymore.
|
||||
D_EU_802298D0 = 16.713f;
|
||||
gRefreshRate = 60;
|
||||
port_eu_init();
|
||||
if (k) {
|
||||
}
|
||||
|
|
|
@ -346,24 +346,21 @@ void process_notes(void) {
|
|||
f32 cap;
|
||||
#endif
|
||||
#endif
|
||||
struct Note *note;
|
||||
struct Note *note = NULL;
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
struct NotePlaybackState *playbackState;
|
||||
struct NoteSubEu *noteSubEu;
|
||||
struct NotePlaybackState *playbackState = NULL;
|
||||
struct NoteSubEu *noteSubEu = NULL;
|
||||
#ifndef VERSION_SH
|
||||
UNUSED u8 pad[12];
|
||||
u8 reverb;
|
||||
UNUSED u8 pad3;
|
||||
u8 pan;
|
||||
#else
|
||||
u8 pad[8];
|
||||
struct ReverbInfo reverbInfo;
|
||||
#endif
|
||||
u8 bookOffset;
|
||||
#endif
|
||||
struct NoteAttributes *attributes;
|
||||
struct NoteAttributes *attributes = NULL;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
struct AudioListItem *it;
|
||||
struct AudioListItem *it = NULL;
|
||||
#endif
|
||||
s32 i;
|
||||
|
||||
|
@ -443,9 +440,6 @@ void process_notes(void) {
|
|||
#endif
|
||||
d:
|
||||
if (playbackState->priority != NOTE_PRIORITY_DISABLED) {
|
||||
#ifdef VERSION_SH
|
||||
if (1) {}
|
||||
#endif
|
||||
noteSubEu = ¬e->noteSubEu;
|
||||
#ifdef VERSION_SH
|
||||
if (playbackState->unkSH34 >= 1 || noteSubEu->finished) {
|
||||
|
@ -477,10 +471,6 @@ void process_notes(void) {
|
|||
goto skip;
|
||||
}
|
||||
}
|
||||
#ifndef VERSION_SH
|
||||
if (1) {
|
||||
}
|
||||
#endif
|
||||
} else if (playbackState->adsr.state == ADSR_STATE_DISABLED) {
|
||||
note_disable(note);
|
||||
audio_list_remove(¬e->listItem);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "data.h"
|
||||
#include "seqplayer.h"
|
||||
#include "synthesis.h"
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
|
||||
|
@ -27,12 +28,12 @@ extern u8 gAudioResetPresetIdToLoad;
|
|||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime);
|
||||
void seq_player_fade_from_zero_volume(s32 player, FadeT fadeInTime);
|
||||
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime);
|
||||
void port_eu_init_queues(void);
|
||||
void decrease_sample_dma_ttls(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void func_802ad7ec(u32);
|
||||
void process_queued_audio_cmds(u32);
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
return NULL;
|
||||
|
@ -40,9 +41,10 @@ struct SPTask *create_next_audio_frame_task(void) {
|
|||
void create_next_audio_buffer(s16 *samples, u32 num_samples) {
|
||||
s32 writtenCmds;
|
||||
OSMesg msg;
|
||||
|
||||
gAudioFrameCount++;
|
||||
decrease_sample_dma_ttls();
|
||||
if (osRecvMesg(OSMesgQueues[2], &msg, 0) != -1) {
|
||||
if (osRecvMesg(OSMesgQueues[2], &msg, OS_MESG_NOBLOCK) != -1) {
|
||||
gAudioResetPresetIdToLoad = (u8) (s32) msg;
|
||||
gAudioResetStatus = 5;
|
||||
}
|
||||
|
@ -52,7 +54,7 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
|
|||
gAudioResetStatus = 0;
|
||||
}
|
||||
if (osRecvMesg(OSMesgQueues[1], &msg, OS_MESG_NOBLOCK) != -1) {
|
||||
func_802ad7ec((u32) msg);
|
||||
process_queued_audio_cmds((u32) msg);
|
||||
}
|
||||
synthesis_execute(gAudioCmdBuffers[0], &writtenCmds, samples, num_samples);
|
||||
gAudioRandom = ((gAudioRandom + gAudioFrameCount) * gAudioFrameCount);
|
||||
|
@ -70,7 +72,8 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
|||
case 0x82:
|
||||
case 0x88:
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
seq_player_fade_from_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
//LOG_DEBUG("Playing sequence with arguments: %d, 0x%X, %d", cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
|
@ -107,8 +110,8 @@ void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
|||
const char undefportcmd[] = "Undefined Port Command %d\n";
|
||||
|
||||
extern OSMesgQueue *OSMesgQueues[];
|
||||
extern u8 D_EU_80302010;
|
||||
extern u8 D_EU_80302014;
|
||||
extern u8 gQueuedAudioCmdCount;
|
||||
extern u8 gLastQueuedAudioCmdCount;
|
||||
extern OSMesg OSMesg0;
|
||||
extern OSMesg OSMesg1;
|
||||
extern OSMesg OSMesg2;
|
||||
|
@ -119,14 +122,14 @@ void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime) {
|
|||
fadeOutTime = 1;
|
||||
}
|
||||
gSequencePlayers[player].fadeVelocity = -(gSequencePlayers[player].fadeVolume / fadeOutTime);
|
||||
gSequencePlayers[player].state = 2;
|
||||
gSequencePlayers[player].state = 2; // These are reversed compared to USA, Which is 2 for a fade in and 1 for a fade out.
|
||||
gSequencePlayers[player].fadeRemainingFrames = fadeOutTime;
|
||||
|
||||
}
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime) {
|
||||
void seq_player_fade_from_zero_volume(s32 player, FadeT fadeInTime) {
|
||||
if (fadeInTime != 0) {
|
||||
gSequencePlayers[player].state = 1;
|
||||
gSequencePlayers[player].state = 1; // These are reversed compared to USA, Which is 2 for a fade in and 1 for a fade out.
|
||||
gSequencePlayers[player].fadeTimerUnkEu = fadeInTime;
|
||||
gSequencePlayers[player].fadeRemainingFrames = fadeInTime;
|
||||
gSequencePlayers[player].fadeVolume = 0.0f;
|
||||
|
@ -135,42 +138,42 @@ void func_8031D690(s32 player, FadeT fadeInTime) {
|
|||
}
|
||||
|
||||
void port_eu_init_queues(void) {
|
||||
D_EU_80302010 = 0;
|
||||
D_EU_80302014 = 0;
|
||||
gQueuedAudioCmdCount = 0;
|
||||
gLastQueuedAudioCmdCount = 0;
|
||||
osCreateMesgQueue(OSMesgQueues[0], &OSMesg0, 1);
|
||||
osCreateMesgQueue(OSMesgQueues[1], &OSMesg1, 4);
|
||||
osCreateMesgQueue(OSMesgQueues[2], &OSMesg2, 1);
|
||||
osCreateMesgQueue(OSMesgQueues[3], &OSMesg3, 1);
|
||||
}
|
||||
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_EU_80302010 & 0xff];
|
||||
void queue_audio_cmd(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[gQueuedAudioCmdCount & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
D_EU_80302010++;
|
||||
gQueuedAudioCmdCount++;
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
void queue_audio_cmd_f32(u32 arg0, f32 arg1) {
|
||||
queue_audio_cmd(arg0, (s32*) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32*) &arg1);
|
||||
void queue_audio_cmd_u32(u32 arg0, u32 arg1) {
|
||||
queue_audio_cmd(arg0, (s32*) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
void queue_audio_cmd_s8(u32 arg0, s8 arg1) {
|
||||
s32 sp1C = arg1 << 24;
|
||||
func_802ad6f0(arg0, &sp1C);
|
||||
queue_audio_cmd(arg0, &sp1C);
|
||||
}
|
||||
|
||||
void func_802ad7a0(void) {
|
||||
void send_process_queued_audio_cmds(void) {
|
||||
osSendMesg(OSMesgQueues[1],
|
||||
(OSMesg)(u32)((D_EU_80302014 & 0xff) << 8 | (D_EU_80302010 & 0xff)),
|
||||
(OSMesg)(u32)((gLastQueuedAudioCmdCount & 0xff) << 8 | (gQueuedAudioCmdCount & 0xff)),
|
||||
OS_MESG_NOBLOCK);
|
||||
D_EU_80302014 = D_EU_80302010;
|
||||
gLastQueuedAudioCmdCount = gQueuedAudioCmdCount;
|
||||
}
|
||||
|
||||
void func_802ad7ec(u32 arg0) {
|
||||
void process_queued_audio_cmds(u32 arg0) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
|
|
|
@ -259,7 +259,7 @@ void func_sh_802f6330(void) {
|
|||
}
|
||||
|
||||
extern struct EuAudioCmd sAudioCmd[0x100]; // sAudioCmd, maybe?
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
|
||||
void queue_audio_cmd(s32 arg0, s32 *arg1) { // func_sh_802f63f8
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
|
@ -269,17 +269,17 @@ void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
|
|||
}
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) { // func_sh_802f6450
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
void queue_audio_cmd_f32(u32 arg0, f32 arg1) { // func_sh_802f6450
|
||||
queue_audio_cmd(arg0, (s32 *) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) { // func_sh_802f6474
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
void queue_audio_cmd_u32(u32 arg0, u32 arg1) { // func_sh_802f6474
|
||||
queue_audio_cmd(arg0, (s32 *) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) { // func_sh_802f6498
|
||||
void queue_audio_cmd_s8(u32 arg0, s8 arg1) { // func_sh_802f6498
|
||||
s32 sp1C = arg1 << 24;
|
||||
func_802ad6f0(arg0, &sp1C);
|
||||
queue_audio_cmd(arg0, &sp1C);
|
||||
}
|
||||
|
||||
char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n";
|
||||
|
|
|
@ -51,8 +51,10 @@ void bhv_camera_lakitu_init(void) {
|
|||
sync_object_init_field(o, &o->oCameraLakituSpeed);
|
||||
sync_object_init_field(o, &o->oCameraLakituCircleRadius);
|
||||
sync_object_init_field(o, &o->oCameraLakituFinishedDialog);
|
||||
sync_object_init_field(o, &o->oCameraLakituUnk104);
|
||||
sync_object_init_field(o, &o->oCameraLakituPitchVel);
|
||||
#ifndef VERSION_JP
|
||||
sync_object_init_field(o, &o->oCameraLakituUnk104);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6560,7 +6560,7 @@ struct CutsceneSplinePoint sIntroPipeToDialogPosition[] = {
|
|||
/**
|
||||
* Describes the spline that the camera's focus follows, during the same part of the intro as the above.
|
||||
*/
|
||||
#ifdef VERSION_EU
|
||||
/**#ifdef VERSION_EU
|
||||
struct CutsceneSplinePoint sIntroPipeToDialogFocus[] = {
|
||||
{ 0, 25, { -1248, 450, 4596 } }, { 1, 71, { -1258, 485, 4606 } }, { 2, 71, { -1379, 344, 4769 } },
|
||||
{ 3, 22, { -1335, 366, 4815 } }, { 4, 23, { -1315, 370, 4450 } }, { 5, 40, { -1322, 333, 4591 } },
|
||||
|
@ -6568,7 +6568,7 @@ struct CutsceneSplinePoint sIntroPipeToDialogFocus[] = {
|
|||
{ 9, 21, { -1321, 346, 4098 } }, { 0, 0, { -1328, 385, 4354 } }, { 0, 0, { -1328, 385, 4354 } },
|
||||
{ 0, 0, { -1328, 385, 4354 } }, { -1, 0, { -1328, 385, 4354 } }
|
||||
};
|
||||
#else
|
||||
#else**/
|
||||
struct CutsceneSplinePoint sIntroPipeToDialogFocus[] = {
|
||||
{ 0, 20, { -1248, 450, 4596 } }, { 1, 59, { -1258, 485, 4606 } }, { 2, 59, { -1379, 344, 4769 } },
|
||||
{ 3, 20, { -1335, 366, 4815 } }, { 4, 23, { -1315, 370, 4450 } }, { 5, 40, { -1322, 333, 4591 } },
|
||||
|
@ -6576,7 +6576,7 @@ struct CutsceneSplinePoint sIntroPipeToDialogFocus[] = {
|
|||
{ 9, 21, { -1321, 346, 4098 } }, { 0, 0, { -1328, 385, 4354 } }, { 0, 0, { -1328, 385, 4354 } },
|
||||
{ 0, 0, { -1328, 385, 4354 } }, { -1, 0, { -1328, 385, 4354 } }
|
||||
};
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
struct CutsceneSplinePoint sEndingFlyToWindowPos[] = {
|
||||
{ 0, 0, { -86, 876, 640 } }, { 1, 0, { -86, 876, 610 } }, { 2, 0, { -66, 945, 393 } },
|
||||
|
@ -6621,11 +6621,11 @@ struct CutsceneSplinePoint sEndingLookUpAtCastle[] = {
|
|||
};
|
||||
|
||||
struct CutsceneSplinePoint sEndingLookAtSkyFocus[] = {
|
||||
#ifdef VERSION_EU
|
||||
{ 0, 50, { 484, 1368, -868 } }, { 0, 72, { 479, 1372, -872 } }, { 0, 50, { 351, 1817, -918 } },
|
||||
#else
|
||||
//#ifdef VERSION_EU
|
||||
// { 0, 50, { 484, 1368, -868 } }, { 0, 72, { 479, 1372, -872 } }, { 0, 50, { 351, 1817, -918 } },
|
||||
//#else
|
||||
{ 0, 50, { 484, 1368, -888 } }, { 0, 72, { 479, 1372, -892 } }, { 0, 50, { 351, 1817, -918 } },
|
||||
#endif
|
||||
//#endif
|
||||
{ 0, 50, { 351, 1922, -598 } }, { 0, 0, { 636, 2027, -415 } }, { 0, 0, { 636, 2027, -415 } },
|
||||
{ -1, 0, { 636, 2027, -415 } }
|
||||
};
|
||||
|
@ -7543,15 +7543,15 @@ BAD_RETURN(s32) cutscene_ending_look_up_at_castle(UNUSED struct Camera *c) {
|
|||
BAD_RETURN(s32) cutscene_ending_peach_wakeup(struct Camera *c) {
|
||||
cutscene_event(cutscene_ending_reset_spline, c, 0, 0);
|
||||
cutscene_event(cutscene_ending_look_up_at_castle, c, 0, 0);
|
||||
#ifdef VERSION_EU
|
||||
/**#ifdef VERSION_EU
|
||||
cutscene_event(cutscene_ending_look_up_at_castle, c, 265, -1);
|
||||
cutscene_spawn_obj(7, 315);
|
||||
cutscene_spawn_obj(9, 355);
|
||||
#else
|
||||
#else**/
|
||||
cutscene_event(cutscene_ending_look_up_at_castle, c, 250, -1);
|
||||
cutscene_spawn_obj(7, 300);
|
||||
cutscene_spawn_obj(9, 340);
|
||||
#endif
|
||||
//#endif
|
||||
vec3f_set(c->pos, -163.f, 978.f, -1082.f);
|
||||
player2_rotate_cam(c, -0x800, 0x2000, -0x2000, 0x2000);
|
||||
}
|
||||
|
@ -7595,11 +7595,11 @@ BAD_RETURN(s32) cutscene_ending_kiss_here_we_go(struct Camera *c) {
|
|||
*/
|
||||
BAD_RETURN(s32) cutscene_ending_kiss(struct Camera *c) {
|
||||
cutscene_event(cutscene_ending_kiss_closeup, c, 0, 0);
|
||||
#ifdef VERSION_EU
|
||||
/**#ifdef VERSION_EU
|
||||
cutscene_event(cutscene_ending_kiss_here_we_go, c, 185, -1);
|
||||
#else
|
||||
#else**/
|
||||
cutscene_event(cutscene_ending_kiss_here_we_go, c, 155, -1);
|
||||
#endif
|
||||
//#endif
|
||||
player2_rotate_cam(c, -0x800, 0x2000, -0x2000, 0x2000);
|
||||
}
|
||||
|
||||
|
@ -9779,16 +9779,17 @@ BAD_RETURN(s32) cutscene_intro_peach_fly_to_pipe(struct Camera *c) {
|
|||
#if defined(VERSION_US) || defined(VERSION_SH)
|
||||
cutscene_event(play_sound_intro_turn_on_hud, c, 818, 818);
|
||||
#elif defined(VERSION_EU)
|
||||
cutscene_event(play_sound_intro_turn_on_hud, c, 673, 673);
|
||||
//cutscene_event(play_sound_intro_turn_on_hud, c, 673, 673);
|
||||
cutscene_event(play_sound_intro_turn_on_hud, c, 818, 818);
|
||||
#endif
|
||||
cutscene_spawn_obj(6, 1);
|
||||
cutscene_event(cutscene_intro_peach_start_flying_music, c, 0, 0);
|
||||
cutscene_event(cutscene_intro_peach_start_to_pipe_spline, c, 0, -1);
|
||||
#ifdef VERSION_EU
|
||||
/**#ifdef VERSION_EU
|
||||
cutscene_event(cutscene_intro_peach_clear_cutscene_status, c, 572, 572);
|
||||
#else
|
||||
#else**/
|
||||
cutscene_event(cutscene_intro_peach_clear_cutscene_status, c, 717, 717);
|
||||
#endif
|
||||
//#endif
|
||||
clamp_pitch(c->pos, c->focus, 0x3B00, -0x3B00);
|
||||
sCutsceneVars[1].point[1] = 400.f;
|
||||
}
|
||||
|
@ -10571,7 +10572,7 @@ BAD_RETURN(s32) cutscene_door_mode(struct Camera *c) {
|
|||
struct Cutscene sCutsceneEnding[] = {
|
||||
{ cutscene_ending_mario_fall, 170 },
|
||||
{ cutscene_ending_mario_land, 70 },
|
||||
#ifdef VERSION_EU
|
||||
/**#ifdef VERSION_EU
|
||||
{ cutscene_ending_mario_land_closeup, 0x44 },
|
||||
{ cutscene_ending_stars_free_peach, 0x15c },
|
||||
{ cutscene_ending_peach_appears, 0x6d },
|
||||
|
@ -10580,7 +10581,7 @@ struct Cutscene sCutsceneEnding[] = {
|
|||
{ cutscene_ending_peach_wakeup, 0x1a4 },
|
||||
{ cutscene_ending_dialog, 0x114 },
|
||||
{ cutscene_ending_kiss, 0x10b },
|
||||
#else
|
||||
#else**/
|
||||
{ cutscene_ending_mario_land_closeup, 75 },
|
||||
#ifdef VERSION_SH
|
||||
{ cutscene_ending_stars_free_peach, 431 },
|
||||
|
@ -10598,7 +10599,7 @@ struct Cutscene sCutsceneEnding[] = {
|
|||
{ cutscene_ending_dialog, 236 },
|
||||
#endif
|
||||
{ cutscene_ending_kiss, 245 },
|
||||
#endif
|
||||
//#endif
|
||||
{ cutscene_ending_cake_for_mario, CUTSCENE_LOOP },
|
||||
{ cutscene_ending_stop, 0 }
|
||||
};
|
||||
|
@ -10742,11 +10743,11 @@ struct Cutscene sCutsceneUnusedExit[] = {
|
|||
struct Cutscene sCutsceneIntroPeach[] = {
|
||||
{ cutscene_intro_peach_letter, CUTSCENE_LOOP },
|
||||
{ cutscene_intro_peach_reset_fov, 35 },
|
||||
#ifdef VERSION_EU
|
||||
{ cutscene_intro_peach_fly_to_pipe, 675 },
|
||||
#else
|
||||
//#ifdef VERSION_EU
|
||||
// { cutscene_intro_peach_fly_to_pipe, 675 },
|
||||
//#else
|
||||
{ cutscene_intro_peach_fly_to_pipe, 820 },
|
||||
#endif
|
||||
//#endif
|
||||
{ cutscene_intro_peach_mario_appears, 270 },
|
||||
{ cutscene_intro_peach_dialog, CUTSCENE_LOOP }
|
||||
};
|
||||
|
|
|
@ -514,6 +514,9 @@ void str_ascii_to_dialog(const char* string, u8* dialog, u16 length) {
|
|||
}
|
||||
|
||||
f32 get_generic_dialog_width(u8* dialog) {
|
||||
#ifdef VERSION_JP
|
||||
return 0;
|
||||
#else
|
||||
f32 largestWidth = 0;
|
||||
f32 width = 0;
|
||||
u8* d = dialog;
|
||||
|
@ -528,6 +531,7 @@ f32 get_generic_dialog_width(u8* dialog) {
|
|||
d++;
|
||||
}
|
||||
return largestWidth;
|
||||
#endif
|
||||
}
|
||||
|
||||
f32 get_generic_ascii_string_width(const char* ascii) {
|
||||
|
@ -2881,9 +2885,11 @@ static u32 pause_castle_get_stars(s32 index) {
|
|||
|
||||
static void render_pause_castle_course_name(const u8 *courseName, s16 x, s16 y) {
|
||||
s16 width = 0;
|
||||
#ifndef VERSION_JP
|
||||
for (const u8 *c = courseName; *c != DIALOG_CHAR_TERMINATOR; c++) {
|
||||
width += gDialogCharWidths[*c];
|
||||
}
|
||||
#endif
|
||||
print_generic_string(x - width / 2, y, courseName);
|
||||
}
|
||||
|
||||
|
@ -2985,10 +2991,28 @@ void render_pause_castle_main_strings_extended(s16 x, s16 y) {
|
|||
|
||||
gSPDisplayList(gDisplayListHead++, dl_ia_text_begin);
|
||||
gDPSetEnvColor(gDisplayListHead++, 255, 255, 255, gDialogTextAlpha);
|
||||
|
||||
void **courseNameTbl = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
courseNameTbl = segmented_to_virtual(seg2_course_name_table);
|
||||
#endif
|
||||
|
||||
// Main courses (0-14)
|
||||
if (gDialogLineNum < COURSE_STAGES_COUNT) {
|
||||
const u8 *courseName = seg2_course_name_table[gDialogLineNum];
|
||||
const u8 *courseName = courseNameTbl[gDialogLineNum];
|
||||
const u8 textCoin[] = { TEXT_COIN_X };
|
||||
u8 textCoinCount[8];
|
||||
render_pause_castle_course_name(courseName, 160, y + 30);
|
||||
|
@ -3000,14 +3024,14 @@ void render_pause_castle_main_strings_extended(s16 x, s16 y) {
|
|||
|
||||
// Secret courses (15-24)
|
||||
else if (gDialogLineNum >= COURSE_STAGES_COUNT && gDialogLineNum < INDEX_CASTLE_STARS) {
|
||||
const u8 *courseName = seg2_course_name_table[gDialogLineNum];
|
||||
const u8 *courseName = courseNameTbl[gDialogLineNum];
|
||||
render_pause_castle_course_name(courseName + 3, 160, y + 30);
|
||||
render_pause_castle_course_stars_extended(x + 20, y);
|
||||
}
|
||||
|
||||
// Castle stars (25)
|
||||
else if (gDialogLineNum == INDEX_CASTLE_STARS) {
|
||||
const u8 *courseName = seg2_course_name_table[COURSE_MAX];
|
||||
const u8 *courseName = courseNameTbl[COURSE_MAX];
|
||||
const u8 textStar[] = { TEXT_STAR_X };
|
||||
u8 textStarCount[8];
|
||||
render_pause_castle_course_name(courseName + 3, 160, y + 30);
|
||||
|
@ -3409,24 +3433,24 @@ void render_save_confirmation(s16 x, s16 y, s8 *index, s16 sp6e)
|
|||
#endif
|
||||
{
|
||||
#ifdef VERSION_EU
|
||||
u8 textSaveAndContinueArr[][24] = {
|
||||
u8 textSaveAndContinueArr[][30] = {
|
||||
{ TEXT_SAVE_AND_CONTINUE },
|
||||
{ TEXT_SAVE_AND_CONTINUE_FR },
|
||||
{ TEXT_SAVE_AND_CONTINUE_DE }
|
||||
};
|
||||
u8 textSaveAndQuitArr[][22] = {
|
||||
u8 textSaveAndQuitArr[][30] = {
|
||||
{ TEXT_SAVE_AND_QUIT },
|
||||
{ TEXT_SAVE_AND_QUIT_FR },
|
||||
{ TEXT_SAVE_AND_QUIT_DE }
|
||||
};
|
||||
|
||||
u8 textSaveExitGame[][26] = { // New function to exit game
|
||||
u8 textSaveExitGame[][30] = { // New function to exit game
|
||||
{ TEXT_SAVE_EXIT_GAME },
|
||||
{ TEXT_SAVE_EXIT_GAME_FR },
|
||||
{ TEXT_SAVE_EXIT_GAME_DE }
|
||||
};
|
||||
|
||||
u8 textContinueWithoutSaveArr[][27] = {
|
||||
u8 textContinueWithoutSaveArr[][30] = {
|
||||
{ TEXT_CONTINUE_WITHOUT_SAVING },
|
||||
{ TEXT_CONTINUE_WITHOUT_SAVING_FR },
|
||||
{ TEXT_CONTINUE_WITHOUT_SAVING_DE }
|
||||
|
|
|
@ -6,16 +6,13 @@
|
|||
#include "game/memory.h"
|
||||
#include "level_info.h"
|
||||
#include "level_table.h"
|
||||
#include "save_file.h"
|
||||
#include "types.h"
|
||||
#include "pc/lua/utils/smlua_level_utils.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
extern u8 *course_name_table_eu_en[];
|
||||
extern u8 *course_name_table_eu_fr[];
|
||||
extern u8 *course_name_table_eu_de[];
|
||||
extern u8 *act_name_table_eu_en[];
|
||||
extern u8 *act_name_table_eu_fr[];
|
||||
extern u8 *act_name_table_eu_de[];
|
||||
extern s32 gInGameLanguage;
|
||||
#include "eu_translation.h"
|
||||
#else
|
||||
extern u8 *seg2_course_name_table[];
|
||||
extern u8 *seg2_act_name_table[];
|
||||
|
|
|
@ -278,7 +278,7 @@ void fade_into_special_warp(u32 arg, u32 color) {
|
|||
|
||||
fadeout_music(190);
|
||||
play_transition(WARP_TRANSITION_FADE_INTO_COLOR, 0x10, color, color, color);
|
||||
level_set_transition(30, NULL);
|
||||
level_set_transition(16, NULL);
|
||||
|
||||
warp_special(arg);
|
||||
}
|
||||
|
|
|
@ -1880,7 +1880,8 @@ static void intro_cutscene_hide_hud_and_mario(struct MarioState *m) {
|
|||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define TIMER_SPAWN_PIPE 47
|
||||
//#define TIMER_SPAWN_PIPE 47
|
||||
#define TIMER_SPAWN_PIPE 37
|
||||
#else
|
||||
#define TIMER_SPAWN_PIPE 37
|
||||
#endif
|
||||
|
@ -1900,7 +1901,8 @@ static void intro_cutscene_peach_lakitu_scene(struct MarioState *m) {
|
|||
#undef TIMER_SPAWN_PIPE
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define TIMER_RAISE_PIPE 28
|
||||
//#define TIMER_RAISE_PIPE 28
|
||||
#define TIMER_RAISE_PIPE 38
|
||||
#else
|
||||
#define TIMER_RAISE_PIPE 38
|
||||
#endif
|
||||
|
@ -2317,8 +2319,10 @@ static void end_peach_cutscene_summon_jumbo_star(struct MarioState *m) {
|
|||
}
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
#define TIMER_FADE_IN_PEACH 201
|
||||
#define TIMER_DESCEND_PEACH 280
|
||||
//#define TIMER_FADE_IN_PEACH 201
|
||||
//#define TIMER_DESCEND_PEACH 280
|
||||
#define TIMER_FADE_IN_PEACH 276
|
||||
#define TIMER_DESCEND_PEACH 355
|
||||
#elif defined(VERSION_SH)
|
||||
#define TIMER_FADE_IN_PEACH 276
|
||||
#define TIMER_DESCEND_PEACH 400
|
||||
|
@ -2380,7 +2384,8 @@ static void end_peach_cutscene_spawn_peach(struct MarioState *m) {
|
|||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define TIMER_RUN_TO_PEACH 531
|
||||
//#define TIMER_RUN_TO_PEACH 531
|
||||
#define TIMER_RUN_TO_PEACH 584
|
||||
#else
|
||||
#define TIMER_RUN_TO_PEACH 584
|
||||
#endif
|
||||
|
@ -2532,8 +2537,10 @@ static void end_peach_cutscene_dialog_1(struct MarioState *m) {
|
|||
}
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
#define TIMER_SOMETHING_SPECIAL 150
|
||||
#define TIMER_PEACH_KISS 260
|
||||
//#define TIMER_SOMETHING_SPECIAL 150
|
||||
//#define TIMER_PEACH_KISS 260
|
||||
#define TIMER_SOMETHING_SPECIAL 130
|
||||
#define TIMER_PEACH_KISS 200
|
||||
#elif defined(VERSION_SH)
|
||||
#define TIMER_SOMETHING_SPECIAL 170
|
||||
#define TIMER_PEACH_KISS 250
|
||||
|
@ -2848,9 +2855,12 @@ static s32 act_end_peach_cutscene(struct MarioState *m) {
|
|||
}
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
#define TIMER_CREDITS_SHOW 51
|
||||
#define TIMER_CREDITS_PROGRESS 80
|
||||
#define TIMER_CREDITS_WARP 160
|
||||
//#define TIMER_CREDITS_SHOW 51
|
||||
//#define TIMER_CREDITS_PROGRESS 80
|
||||
//#define TIMER_CREDITS_WARP 160
|
||||
#define TIMER_CREDITS_SHOW 61
|
||||
#define TIMER_CREDITS_PROGRESS 90
|
||||
#define TIMER_CREDITS_WARP 200
|
||||
#elif defined(VERSION_SH)
|
||||
#define TIMER_CREDITS_SHOW 61
|
||||
#define TIMER_CREDITS_PROGRESS 90
|
||||
|
|
|
@ -134,7 +134,7 @@ void *main_pool_alloc(u32 size, u32 side) {
|
|||
}
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Main pool alloc failed!");
|
||||
LOG_ERROR("Main pool failed to allocate memory of size 0x%X on side %d.", size, side);
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ void *main_pool_realloc(void *addr, u32 size) {
|
|||
newAddr = main_pool_alloc(size, MEMORY_POOL_LEFT);
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Main pool realloc failed!");
|
||||
LOG_ERROR("Main pool failed to reallocate memory of size 0x%X at %p!", size, addr);
|
||||
}
|
||||
return newAddr;
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ struct AllocOnlyPool *alloc_only_pool_init(u32 size, u32 side) {
|
|||
subPool->freePtr = (u8 *) addr + sizeof(struct AllocOnlyPool);
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Alloc only pool init failed!");
|
||||
LOG_ERROR("Allocate only pool failed to initalize memory of size 0x%X on side %d.", size, side);
|
||||
}
|
||||
return subPool;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void *alloc_only_pool_alloc(struct AllocOnlyPool *pool, s32 size) {
|
|||
pool->usedSpace += size;
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Alloc only pool alloc failed!");
|
||||
LOG_ERROR("Allocate only pool failed to allocate memory of size 0x%X on at pool %p.", size, pool);
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ struct AllocOnlyPool *alloc_only_pool_resize(struct AllocOnlyPool *pool, u32 siz
|
|||
pool->totalSpace = size;
|
||||
}
|
||||
if (newPool == NULL) {
|
||||
LOG_ERROR("Alloc only pool realloc failed!");
|
||||
LOG_ERROR("Allocate only pool failed to reallocate memory of size 0x%X on at pool %p.", size, pool);
|
||||
}
|
||||
return newPool;
|
||||
}
|
||||
|
@ -335,7 +335,7 @@ struct MemoryPool *mem_pool_init(u32 size, u32 side) {
|
|||
block->size = pool->totalSpace;
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Mem pool init failed!");
|
||||
LOG_ERROR("Memory pool failed to initalize memory of size 0x%X on side %d.", size, side);
|
||||
}
|
||||
return pool;
|
||||
}
|
||||
|
@ -365,7 +365,7 @@ void *mem_pool_alloc(struct MemoryPool *pool, u32 size) {
|
|||
freeBlock = freeBlock->next;
|
||||
}
|
||||
if (addr == NULL) {
|
||||
LOG_ERROR("Mem pool alloc failed!");
|
||||
LOG_ERROR("Memory pool failed to allocate memory of size 0x%X on at pool %p.", size, pool);
|
||||
}
|
||||
return addr;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ void *alloc_display_list(u32 size) {
|
|||
gGfxPoolEnd -= size;
|
||||
ptr = gGfxPoolEnd;
|
||||
} else {
|
||||
LOG_ERROR("Failed to alloc display list!");
|
||||
LOG_ERROR("Failed to allocate display list of size 0x%X!", size);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "sm64.h"
|
||||
#include "sound_init.h"
|
||||
#include "rumble_init.h"
|
||||
#include "pc/debuglog.h"
|
||||
|
||||
#define MUSIC_NONE 0xFFFF
|
||||
|
||||
|
|
|
@ -1120,7 +1120,9 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
|||
{ "oCameraLakituFinishedDialog", LVT_S32, offsetof(struct Object, oCameraLakituFinishedDialog), false, LOT_NONE },
|
||||
{ "oCameraLakituPitchVel", LVT_S16, offsetof(struct Object, oCameraLakituPitchVel), false, LOT_NONE },
|
||||
{ "oCameraLakituSpeed", LVT_F32, offsetof(struct Object, oCameraLakituSpeed), false, LOT_NONE },
|
||||
#ifndef VERSION_JP
|
||||
{ "oCameraLakituUnk104", LVT_S32, offsetof(struct Object, oCameraLakituUnk104), false, LOT_NONE },
|
||||
#endif
|
||||
{ "oCameraLakituYawVel", LVT_S16, offsetof(struct Object, oCameraLakituYawVel), false, LOT_NONE },
|
||||
{ "oCannonBarrelBubblesUnkF4", LVT_F32, offsetof(struct Object, oCannonBarrelBubblesUnkF4), false, LOT_NONE },
|
||||
{ "oCannonPlayerIndex", LVT_S32, offsetof(struct Object, oCannonPlayerIndex), false, LOT_NONE },
|
||||
|
@ -1160,7 +1162,9 @@ static struct LuaObjectField sObjectFields[LUA_OBJECT_FIELD_COUNT] = {
|
|||
{ "oCloudFwooshMovementRadius", LVT_S16, offsetof(struct Object, oCloudFwooshMovementRadius), false, LOT_NONE },
|
||||
{ "oCloudGrowSpeed", LVT_F32, offsetof(struct Object, oCloudGrowSpeed), false, LOT_NONE },
|
||||
{ "oCoinUnk110", LVT_F32, offsetof(struct Object, oCoinUnk110), false, LOT_NONE },
|
||||
#ifndef VERSION_JP
|
||||
{ "oCoinUnk1B0", LVT_S32, offsetof(struct Object, oCoinUnk1B0), false, LOT_NONE },
|
||||
#endif
|
||||
{ "oCoinUnkF4", LVT_S32, offsetof(struct Object, oCoinUnkF4), false, LOT_NONE },
|
||||
{ "oCoinUnkF8", LVT_S32, offsetof(struct Object, oCoinUnkF8), false, LOT_NONE },
|
||||
{ "oCollisionDistance", LVT_F32, offsetof(struct Object, oCollisionDistance), false, LOT_NONE },
|
||||
|
|
|
@ -10,6 +10,7 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_lot'] == b['_lot'] and a['_pointer'] ~= nil and a['_lot'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_CPointer = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" return nil\n"
|
||||
|
@ -23,6 +24,7 @@ char gSmluaConstants[] = ""
|
|||
" return a['_pointer'] == b['_pointer'] and a['_pointer'] ~= nil and a['_lvt'] ~= nil\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_SyncTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -34,6 +36,7 @@ char gSmluaConstants[] = ""
|
|||
" _set_sync_table_field(t, k, v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"_ReadOnlyTable = {\n"
|
||||
" __index = function (t,k)\n"
|
||||
" local _table = rawget(t, '_table')\n"
|
||||
|
@ -42,6 +45,7 @@ char gSmluaConstants[] = ""
|
|||
" __newindex = function (t,k,v)\n"
|
||||
" end\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param src Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -51,6 +55,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -62,6 +67,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -71,6 +77,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
|
@ -81,6 +88,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -90,6 +98,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
"function vec3f_normalize(dest)\n"
|
||||
|
@ -97,23 +106,28 @@ char gSmluaConstants[] = ""
|
|||
" if divisor == 0 then\n"
|
||||
" return dest\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" local invsqrt = 1.0 / divisor\n"
|
||||
" dest.x = dest.x * invsqrt\n"
|
||||
" dest.y = dest.y * invsqrt\n"
|
||||
" dest.z = dest.z * invsqrt\n"
|
||||
"\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_length(a)\n"
|
||||
" return math.sqrt(a.x * a.x + a.y * a.y + a.z * a.z)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param a Vec3f\n"
|
||||
"--- @param b Vec3f\n"
|
||||
"--- @return number\n"
|
||||
"function vec3f_dot(a, b)\n"
|
||||
" return a.x * b.x + a.y * b.y + a.z * b.z\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param vec Vec3f\n"
|
||||
"--- @param onto Vec3f\n"
|
||||
"--- @return Vec3f\n"
|
||||
|
@ -125,6 +139,7 @@ char gSmluaConstants[] = ""
|
|||
" vec3f_mul(out, numerator / denominator)\n"
|
||||
" return out\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3f\n"
|
||||
"--- @param v2 Vec3f\n"
|
||||
"--- @return number\n"
|
||||
|
@ -134,6 +149,7 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param src Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -143,6 +159,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = src.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param x number\n"
|
||||
"--- @param y number\n"
|
||||
|
@ -154,6 +171,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -163,6 +181,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z + a.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a Vec3s\n"
|
||||
"--- @param b Vec3s\n"
|
||||
|
@ -173,6 +192,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = a.z + b.z\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param dest Vec3s\n"
|
||||
"--- @param a number\n"
|
||||
"--- @return Vec3s\n"
|
||||
|
@ -182,6 +202,7 @@ char gSmluaConstants[] = ""
|
|||
" dest.z = dest.z * a\n"
|
||||
" return dest\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param v1 Vec3s\n"
|
||||
"--- @param v2 Vec3s\n"
|
||||
"--- @return number\n"
|
||||
|
@ -191,6 +212,7 @@ char gSmluaConstants[] = ""
|
|||
" dz = v1.z - v2.z\n"
|
||||
" return math.sqrt(dx * dx + dy * dy + dz * dz)\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -210,6 +232,7 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param current number\n"
|
||||
"--- @param target number\n"
|
||||
"--- @param inc number\n"
|
||||
|
@ -227,6 +250,7 @@ char gSmluaConstants[] = ""
|
|||
" current = target\n"
|
||||
" end\n"
|
||||
" end\n"
|
||||
"\n"
|
||||
" -- keep within 32 bits\n"
|
||||
" if current > 2147483647 then\n"
|
||||
" current = -2147483648 + (current - 2147483647)\n"
|
||||
|
@ -235,6 +259,7 @@ char gSmluaConstants[] = ""
|
|||
" end\n"
|
||||
" return current;\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"--- @param bank number\n"
|
||||
"--- @param soundID number\n"
|
||||
"--- @param priority number\n"
|
||||
|
@ -244,9 +269,11 @@ char gSmluaConstants[] = ""
|
|||
" if flags == nil then flags = 0 end\n"
|
||||
" return (bank << 28) | (soundID << 16) | (priority << 8) | flags | SOUND_STATUS_WAITING\n"
|
||||
"end\n"
|
||||
"\n"
|
||||
"-------------\n"
|
||||
"-- courses --\n"
|
||||
"-------------\n"
|
||||
"\n"
|
||||
"--- @type integer\n"
|
||||
"COURSE_NONE = 0\n"
|
||||
"--- @type integer\n"
|
||||
|
|
|
@ -5298,6 +5298,7 @@ int smlua_func_bhv_platform_on_track_update(UNUSED lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef VERSION_JP
|
||||
int smlua_func_bhv_play_music_track_when_touched_loop(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
@ -5312,6 +5313,7 @@ int smlua_func_bhv_play_music_track_when_touched_loop(UNUSED lua_State* L) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int smlua_func_bhv_pokey_body_part_update(UNUSED lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
@ -14171,6 +14173,7 @@ int smlua_func_play_flip_sounds(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef VERSION_JP
|
||||
int smlua_func_play_knockback_sound(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
@ -14188,6 +14191,7 @@ int smlua_func_play_knockback_sound(lua_State* L) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int smlua_func_should_get_stuck_in_ground(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
@ -22913,6 +22917,7 @@ int smlua_func_cur_obj_spawn_particles(lua_State* L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifndef VERSION_JP
|
||||
int smlua_func_cur_obj_spawn_star_at_y_offset(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
||||
|
@ -22936,6 +22941,7 @@ int smlua_func_cur_obj_spawn_star_at_y_offset(lua_State* L) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
int smlua_func_cur_obj_start_cam_event(lua_State* L) {
|
||||
if (L == NULL) { return 0; }
|
||||
|
@ -29704,7 +29710,9 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "bhv_platform_normals_init", smlua_func_bhv_platform_normals_init);
|
||||
smlua_bind_function(L, "bhv_platform_on_track_init", smlua_func_bhv_platform_on_track_init);
|
||||
smlua_bind_function(L, "bhv_platform_on_track_update", smlua_func_bhv_platform_on_track_update);
|
||||
#ifndef VERSION_JP
|
||||
smlua_bind_function(L, "bhv_play_music_track_when_touched_loop", smlua_func_bhv_play_music_track_when_touched_loop);
|
||||
#endif
|
||||
smlua_bind_function(L, "bhv_pokey_body_part_update", smlua_func_bhv_pokey_body_part_update);
|
||||
smlua_bind_function(L, "bhv_pokey_update", smlua_func_bhv_pokey_update);
|
||||
smlua_bind_function(L, "bhv_pole_base_loop", smlua_func_bhv_pole_base_loop);
|
||||
|
@ -30203,7 +30211,9 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "mario_execute_airborne_action", smlua_func_mario_execute_airborne_action);
|
||||
smlua_bind_function(L, "play_far_fall_sound", smlua_func_play_far_fall_sound);
|
||||
smlua_bind_function(L, "play_flip_sounds", smlua_func_play_flip_sounds);
|
||||
#ifndef VERSION_JP
|
||||
smlua_bind_function(L, "play_knockback_sound", smlua_func_play_knockback_sound);
|
||||
#endif
|
||||
smlua_bind_function(L, "should_get_stuck_in_ground", smlua_func_should_get_stuck_in_ground);
|
||||
smlua_bind_function(L, "update_air_with_turn", smlua_func_update_air_with_turn);
|
||||
smlua_bind_function(L, "update_air_without_turn", smlua_func_update_air_without_turn);
|
||||
|
@ -30607,7 +30617,9 @@ void smlua_bind_functions_autogen(void) {
|
|||
smlua_bind_function(L, "cur_obj_spawn_loot_blue_coin", smlua_func_cur_obj_spawn_loot_blue_coin);
|
||||
smlua_bind_function(L, "cur_obj_spawn_loot_coin_at_mario_pos", smlua_func_cur_obj_spawn_loot_coin_at_mario_pos);
|
||||
smlua_bind_function(L, "cur_obj_spawn_particles", smlua_func_cur_obj_spawn_particles);
|
||||
#ifndef VERSION_JP
|
||||
smlua_bind_function(L, "cur_obj_spawn_star_at_y_offset", smlua_func_cur_obj_spawn_star_at_y_offset);
|
||||
#endif
|
||||
smlua_bind_function(L, "cur_obj_start_cam_event", smlua_func_cur_obj_start_cam_event);
|
||||
smlua_bind_function(L, "cur_obj_unhide", smlua_func_cur_obj_unhide);
|
||||
smlua_bind_function(L, "cur_obj_unrender_and_reset_state", smlua_func_cur_obj_unrender_and_reset_state);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "types.h"
|
||||
#include "seq_ids.h"
|
||||
#include "audio/external.h"
|
||||
#include "game/camera.h"
|
||||
#include "engine/math_util.h"
|
||||
|
@ -45,7 +46,17 @@ static void smlua_audio_utils_reset(struct AudioOverride* override) {
|
|||
void smlua_audio_utils_reset_all(void) {
|
||||
audio_init();
|
||||
for (s32 i = 0; i < MAX_AUDIO_OVERRIDE; i++) {
|
||||
#ifdef VERSION_EU
|
||||
if (sAudioOverrides[i].enabled) {
|
||||
if (i >= SEQ_EVENT_CUTSCENE_LAKITU) {
|
||||
sBackgroundMusicDefaultVolume[i] = 75;
|
||||
return;
|
||||
}
|
||||
sBackgroundMusicDefaultVolume[i] = sBackgroundMusicDefaultVolumeDefault[i];
|
||||
}
|
||||
#else
|
||||
if (sAudioOverrides[i].enabled) { sound_reset_background_music_default_volume(i); }
|
||||
#endif
|
||||
smlua_audio_utils_reset(&sAudioOverrides[i]);
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +134,11 @@ void smlua_audio_utils_replace_sequence(u8 sequenceId, u8 bankId, u8 defaultVolu
|
|||
override->filename = strdup(file->cachedPath);
|
||||
override->enabled = true;
|
||||
override->bank = bankId;
|
||||
#ifdef VERSION_EU
|
||||
//sBackgroundMusicDefaultVolume[sequenceId] = defaultVolume;
|
||||
#else
|
||||
sound_set_background_music_default_volume(sequenceId, defaultVolume);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,14 @@
|
|||
#include "course_table.h"
|
||||
#include "game/memory.h"
|
||||
#include "game/ingame_menu.h"
|
||||
#include "game/save_file.h"
|
||||
#include "game/segment2.h"
|
||||
|
||||
#ifdef VERSION_EU
|
||||
extern s32 gInGameLanguage;
|
||||
#include "eu_translation.h"
|
||||
#endif
|
||||
|
||||
static bool sReplacedDialog[DIALOG_COUNT] = { 0 };
|
||||
static bool sReplacedCourseName[COURSE_COUNT+2] = { 0 };
|
||||
static bool sReplacedActName[(COURSE_RR+2)*6] = { 0 };
|
||||
|
@ -17,35 +23,93 @@ static u8* smlua_text_utils_convert(const char* str) {
|
|||
}
|
||||
|
||||
void smlua_text_utils_reset_all(void) {
|
||||
void **dialogTable = segmented_to_virtual(seg2_dialog_table);
|
||||
void **dialogTable = NULL;
|
||||
void **actNameTbl = NULL;
|
||||
void **courseNameTbl = NULL;
|
||||
void **dialogTableOrg = NULL;
|
||||
void **actNameTblOrg = NULL;
|
||||
void **courseNameTblOrg = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_en);
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_en);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
|
||||
dialogTableOrg = segmented_to_virtual(dialog_table_eu_en_original);
|
||||
actNameTblOrg = segmented_to_virtual(act_name_table_eu_en_original);
|
||||
courseNameTblOrg = segmented_to_virtual(course_name_table_eu_en_original);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_fr);
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_fr);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
|
||||
dialogTableOrg = segmented_to_virtual(dialog_table_eu_fr_original);
|
||||
actNameTblOrg = segmented_to_virtual(act_name_table_eu_fr_original);
|
||||
courseNameTblOrg = segmented_to_virtual(course_name_table_eu_fr_original);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_de);
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_de);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
|
||||
dialogTableOrg = segmented_to_virtual(dialog_table_eu_de_original);
|
||||
actNameTblOrg = segmented_to_virtual(act_name_table_eu_de_original);
|
||||
courseNameTblOrg = segmented_to_virtual(course_name_table_eu_de_original);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
dialogTable = segmented_to_virtual(seg2_dialog_table);
|
||||
actNameTbl = segmented_to_virtual(seg2_act_name_table);
|
||||
courseNameTbl = segmented_to_virtual(seg2_course_name_table);
|
||||
dialogTableOrg = segmented_to_virtual(seg2_dialog_original);
|
||||
actNameTblOrg = segmented_to_virtual(seg2_act_name_table_original);
|
||||
courseNameTblOrg = segmented_to_virtual(seg2_course_name_table_original);
|
||||
#endif
|
||||
|
||||
for (s32 i = 0; i < DIALOG_COUNT; i++) {
|
||||
if (!sReplacedDialog[i]) { continue; }
|
||||
struct DialogEntry *dialog = segmented_to_virtual(dialogTable[i]);
|
||||
free((u8*)dialog->str);
|
||||
dialog->str = seg2_dialog_original[i];
|
||||
dialog->str = dialogTableOrg[i];
|
||||
sReplacedDialog[i] = false;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < COURSE_COUNT+2; i++) {
|
||||
if (!sReplacedCourseName[i]) { continue; }
|
||||
free((u8*)seg2_course_name_table[i]);
|
||||
seg2_course_name_table[i] = seg2_course_name_table_original[i];
|
||||
free((u8*)courseNameTbl[i]);
|
||||
courseNameTbl[i] = segmented_to_virtual(courseNameTblOrg[i]);
|
||||
sReplacedCourseName[i] = false;
|
||||
}
|
||||
|
||||
for (s32 i = 0; i < (COURSE_RR+2)*6; i++) {
|
||||
if (!sReplacedActName[i]) { continue; }
|
||||
free((u8*)seg2_act_name_table[i]);
|
||||
seg2_act_name_table[i] = seg2_act_name_table_original[i];
|
||||
free((u8*)actNameTbl[i]);
|
||||
actNameTbl[i] = segmented_to_virtual(actNameTblOrg[i]);
|
||||
sReplacedActName[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
void smlua_text_utils_dialog_replace(enum DialogId dialogId, UNUSED u32 unused, s8 linesPerBox, s16 leftOffset, s16 width, const char* str) {
|
||||
if (dialogId >= DIALOG_COUNT) { return; }
|
||||
|
||||
void **dialogTable = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
dialogTable = segmented_to_virtual(dialog_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
dialogTable = segmented_to_virtual(seg2_dialog_table);
|
||||
#endif
|
||||
|
||||
void **dialogTable = segmented_to_virtual(seg2_dialog_table);
|
||||
struct DialogEntry *dialog = segmented_to_virtual(dialogTable[dialogId]);
|
||||
|
||||
if (sReplacedDialog[dialogId]) {
|
||||
|
@ -63,12 +127,35 @@ void smlua_text_utils_dialog_replace(enum DialogId dialogId, UNUSED u32 unused,
|
|||
void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName, const char* act1, const char* act2, const char* act3, const char* act4, const char* act5, const char* act6) {
|
||||
if (courseNum <= 0 || courseNum > COURSE_RR) { return; }
|
||||
s16 courseOffset = courseNum - 1;
|
||||
|
||||
void **actNameTbl = NULL;
|
||||
void **courseNameTbl = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_en);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_fr);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_de);
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
actNameTbl = segmented_to_virtual(seg2_act_name_table);
|
||||
courseNameTbl = segmented_to_virtual(seg2_course_name_table);
|
||||
#endif
|
||||
|
||||
// replace course name
|
||||
if (sReplacedCourseName[courseOffset]) {
|
||||
free(seg2_course_name_table[courseOffset]);
|
||||
free(courseNameTbl[courseOffset]);
|
||||
}
|
||||
seg2_course_name_table[courseOffset] = smlua_text_utils_convert(courseName);
|
||||
courseNameTbl[courseOffset] = smlua_text_utils_convert(courseName);
|
||||
sReplacedCourseName[courseOffset] = true;
|
||||
|
||||
// replace act names
|
||||
|
@ -77,10 +164,10 @@ void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName,
|
|||
s32 index = (courseOffset * 6 + i);
|
||||
|
||||
if (sReplacedActName[index]) {
|
||||
free(seg2_act_name_table[index]);
|
||||
free(actNameTbl[index]);
|
||||
}
|
||||
|
||||
seg2_act_name_table[index] = smlua_text_utils_convert(newActs[i]);
|
||||
actNameTbl[index] = smlua_text_utils_convert(newActs[i]);
|
||||
sReplacedActName[index] = true;
|
||||
}
|
||||
}
|
||||
|
@ -88,35 +175,89 @@ void smlua_text_utils_course_acts_replace(s16 courseNum, const char* courseName,
|
|||
void smlua_text_utils_secret_star_replace(s16 courseNum, const char* courseName) {
|
||||
if (courseNum <= COURSE_RR || courseNum > COURSE_COUNT) { return; }
|
||||
s16 courseOffset = courseNum - 1;
|
||||
|
||||
void **courseNameTbl = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
courseNameTbl = segmented_to_virtual(seg2_course_name_table);
|
||||
#endif
|
||||
|
||||
if (sReplacedCourseName[courseOffset]) {
|
||||
free(seg2_course_name_table[courseOffset]);
|
||||
free(courseNameTbl[courseOffset]);
|
||||
}
|
||||
|
||||
seg2_course_name_table[courseOffset] = smlua_text_utils_convert(courseName);
|
||||
courseNameTbl[courseOffset] = smlua_text_utils_convert(courseName);
|
||||
sReplacedCourseName[courseOffset] = true;
|
||||
}
|
||||
|
||||
void smlua_text_utils_castle_secret_stars_replace(const char* name) {
|
||||
s16 courseOffset = COURSE_COUNT;
|
||||
|
||||
void **courseNameTbl = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
courseNameTbl = segmented_to_virtual(course_name_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
courseNameTbl = segmented_to_virtual(seg2_course_name_table);
|
||||
#endif
|
||||
|
||||
if (sReplacedCourseName[courseOffset]) {
|
||||
free(seg2_course_name_table[courseOffset]);
|
||||
free(courseNameTbl[courseOffset]);
|
||||
}
|
||||
|
||||
seg2_course_name_table[courseOffset] = smlua_text_utils_convert(name);
|
||||
courseNameTbl[courseOffset] = smlua_text_utils_convert(name);
|
||||
sReplacedCourseName[courseOffset] = true;
|
||||
}
|
||||
|
||||
void smlua_text_utils_extra_text_replace(s16 index, const char* text) {
|
||||
if (index < 0 || index > 6) { return; }
|
||||
index = (COURSE_RR * 6 + index);
|
||||
|
||||
void **actNameTbl = NULL;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
switch (gInGameLanguage) {
|
||||
case LANGUAGE_ENGLISH:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_en);
|
||||
break;
|
||||
case LANGUAGE_FRENCH:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_fr);
|
||||
break;
|
||||
case LANGUAGE_GERMAN:
|
||||
actNameTbl = segmented_to_virtual(act_name_table_eu_de);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
actNameTbl = segmented_to_virtual(seg2_act_name_table);
|
||||
#endif
|
||||
|
||||
if (sReplacedActName[index]) {
|
||||
free(seg2_act_name_table[index]);
|
||||
free(actNameTbl[index]);
|
||||
}
|
||||
|
||||
seg2_act_name_table[index] = smlua_text_utils_convert(text);
|
||||
actNameTbl[index] = smlua_text_utils_convert(text);
|
||||
sReplacedActName[index] = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ static char sLocalVersionString[MAX_LOCAL_VERSION_LENGTH] = { 0 };
|
|||
|
||||
char* get_version(void) {
|
||||
if (MINOR_VERSION_NUMBER > 0) {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER);
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, VERSION_REGION);
|
||||
} else {
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d", VERSION_TEXT, VERSION_NUMBER);
|
||||
snprintf(sVersionString, MAX_VERSION_LENGTH, "%s %d %s", VERSION_TEXT, VERSION_NUMBER, VERSION_REGION);
|
||||
}
|
||||
return sVersionString;
|
||||
}
|
||||
|
@ -18,6 +18,6 @@ char* get_version_local(void) {
|
|||
if (PATCH_VERSION_NUMBER <= 0) {
|
||||
return get_version();
|
||||
}
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s %d.%d.%d", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER);
|
||||
snprintf(sLocalVersionString, MAX_LOCAL_VERSION_LENGTH, "%s %d.%d.%d %s", VERSION_TEXT, VERSION_NUMBER, MINOR_VERSION_NUMBER, PATCH_VERSION_NUMBER, VERSION_REGION);
|
||||
return sLocalVersionString;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,18 @@
|
|||
#define MINOR_VERSION_NUMBER 1
|
||||
#define PATCH_VERSION_NUMBER 0
|
||||
|
||||
#define MAX_VERSION_LENGTH 28
|
||||
#define MAX_LOCAL_VERSION_LENGTH 32
|
||||
#if defined(VERSION_JP)
|
||||
#define VERSION_REGION "JP"
|
||||
#elif defined(VERSION_EU)
|
||||
#define VERSION_REGION "EU"
|
||||
#elif defined(VERSION_SH)
|
||||
#define VERSION_REGION "SH"
|
||||
#else
|
||||
#define VERSION_REGION "US"
|
||||
#endif
|
||||
|
||||
#define MAX_VERSION_LENGTH 32
|
||||
#define MAX_LOCAL_VERSION_LENGTH 36
|
||||
char* get_version(void);
|
||||
char* get_version_local(void);
|
||||
|
||||
|
|
|
@ -110,8 +110,8 @@ void send_display_list(struct SPTask *spTask) {
|
|||
}
|
||||
|
||||
#ifdef VERSION_EU
|
||||
#define SAMPLES_HIGH 656
|
||||
#define SAMPLES_LOW 640
|
||||
#define SAMPLES_HIGH 560 // gAudioBufferParameters.maxAiBufferLength
|
||||
#define SAMPLES_LOW 528 // gAudioBufferParameters.minAiBufferLength
|
||||
#else
|
||||
#define SAMPLES_HIGH 544
|
||||
#define SAMPLES_LOW 528
|
||||
|
|
Loading…
Reference in a new issue