Skip to content

Commit

Permalink
Music Controlled by ASM (#399)
Browse files Browse the repository at this point in the history
Co-authored-by: Daryl Pinto <daryl.j.pinto@gmail.com>

uses
project-slippi/slippi-ssbm-c@01efbfc
project-slippi/slippi-ssbm-asm@273b1fb
  • Loading branch information
JLaferri authored Aug 16, 2023
1 parent a9fd2cb commit bc9a35c
Show file tree
Hide file tree
Showing 9 changed files with 203 additions and 19 deletions.
Binary file modified Data/Sys/GameFiles/GALE01/GameSetup.dat
Binary file not shown.
67 changes: 62 additions & 5 deletions Data/Sys/GameSettings/GALE01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,11 @@ C208D698 00000005 #Recording/GetLCancelStatus/GetLCancelStatus.asm
C206C324 00000002 #Recording/GetLCancelStatus/ResetLCancelStatus.asm
38600000 987E25FF
807E00B0 00000000
C21A4CB4 00000004 #Common/AllocBuffer.asm
38600080 3D808037
618CF1E4 7D8903A6
4E800421 906DAFC4
38000000 00000000
C20055F8 0000000F #Common/GetIsFollower.asm
7C0802A6 90010004
9421FF20 BE8100B0
Expand Down Expand Up @@ -2040,11 +2045,6 @@ BA8100B0 800100E4
800100E4 382100E0
7C0803A6 2C1E0000
60000000 00000000
C21A4CB4 00000004 #Online/Core/EXIFileLoad/AllocBuffer.asm
38600080 3D808037
618CF1E4 7D8903A6
4E800421 906DAFC4
38000000 00000000
C20163FC 0000001B #Online/Core/EXIFileLoad/GetFileSize.asm
7C7E1B78 7C0802A6
90010004 9421FF20
Expand Down Expand Up @@ -2194,6 +2194,63 @@ C2019608 0000000F #Online/Core/Hacks/PreventPadAlarmDuringRollback.asm
618C9618 7D8903A6
4E800420 38600000
60000000 00000000
C238E910 0000001A #Online/Core/Music/StartSong.asm
7C0802A6 90010004
9421FF54 BE81007C
7C7E1B78 3D808034
618C7364 7D8903A6
4E800421 7C7D1B78
7FC3F378 38810008
3D808033 618C7C60
7D8903A6 4E800421
2C030000 41820044
3BE10048 3BFF001F
57FF0034 386000D6
987F0000 80610038
907F0001 8061003C
907F0005 7FE3FB78
38800009 38A00001
3D808000 618C55F0
7D8903A6 4E800421
38610008 3D808033
618C7CD4 7D8903A6
4E800421 7FA3EB78
3D808034 618C738C
7D8903A6 4E800421
7FC3F378 BA81007C
800100B0 382100AC
7C0803A6 800DA998
60000000 00000000
C20236EC 0000000B #Online/Core/Music/Stop.asm
7C0802A6 90010004
9421FF9C BE810034
3BE10008 3BFF001F
57FF0034 386000D7
987F0000 7FE3FB78
38800001 38A00001
3D808000 618C55F0
7D8903A6 4E800421
BA810034 80010068
38210064 7C0803A6
38000000 00000000
C20249F0 00000011 #Online/Core/Music/VolumeChange.asm
4800000C 4E800021
00000000 900D81E8
7C0802A6 90010004
9421FF9C BE810034
4BFFFFE5 7FC802A6
808D81E8 807E0000
7C032000 4182003C
909E0000 3BE10008
3BFF001F 57FF0034
386000D8 987F0000
989F0001 7FE3FB78
38800002 38A00001
3D808000 618C55F0
7D8903A6 4E800421
BA810034 80010068
38210064 7C0803A6
60000000 00000000
C21D4578 00000003 #Online/Core/PreventFileAlarms/FreezeStadium.asm
FFE00890 3D80801D
618C4FD8 7D8903A6
Expand Down
67 changes: 62 additions & 5 deletions Data/Sys/GameSettings/GALJ01r2.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,11 @@ C208D698 00000005 #Recording/GetLCancelStatus/GetLCancelStatus.asm
C206C324 00000002 #Recording/GetLCancelStatus/ResetLCancelStatus.asm
38600000 987E25FF
807E00B0 00000000
C21A4CB4 00000004 #Common/AllocBuffer.asm
38600080 3D808037
618CF1E4 7D8903A6
4E800421 906DAFC4
38000000 00000000
C20055F8 0000000F #Common/GetIsFollower.asm
7C0802A6 90010004
9421FF20 BE8100B0
Expand Down Expand Up @@ -2039,11 +2044,6 @@ BA8100B0 800100E4
800100E4 382100E0
7C0803A6 2C1E0000
60000000 00000000
C21A4CB4 00000004 #Online/Core/EXIFileLoad/AllocBuffer.asm
38600080 3D808037
618CF1E4 7D8903A6
4E800421 906DAFC4
38000000 00000000
C20163FC 0000001B #Online/Core/EXIFileLoad/GetFileSize.asm
7C7E1B78 7C0802A6
90010004 9421FF20
Expand Down Expand Up @@ -2193,6 +2193,63 @@ C2019608 0000000F #Online/Core/Hacks/PreventPadAlarmDuringRollback.asm
618C9618 7D8903A6
4E800420 38600000
60000000 00000000
C238E910 0000001A #Online/Core/Music/StartSong.asm
7C0802A6 90010004
9421FF54 BE81007C
7C7E1B78 3D808034
618C7364 7D8903A6
4E800421 7C7D1B78
7FC3F378 38810008
3D808033 618C7C60
7D8903A6 4E800421
2C030000 41820044
3BE10048 3BFF001F
57FF0034 386000D6
987F0000 80610038
907F0001 8061003C
907F0005 7FE3FB78
38800009 38A00001
3D808000 618C55F0
7D8903A6 4E800421
38610008 3D808033
618C7CD4 7D8903A6
4E800421 7FA3EB78
3D808034 618C738C
7D8903A6 4E800421
7FC3F378 BA81007C
800100B0 382100AC
7C0803A6 800DA998
60000000 00000000
C20236EC 0000000B #Online/Core/Music/Stop.asm
7C0802A6 90010004
9421FF9C BE810034
3BE10008 3BFF001F
57FF0034 386000D7
987F0000 7FE3FB78
38800001 38A00001
3D808000 618C55F0
7D8903A6 4E800421
BA810034 80010068
38210064 7C0803A6
38000000 00000000
C20249F0 00000011 #Online/Core/Music/VolumeChange.asm
4800000C 4E800021
00000000 900D81E8
7C0802A6 90010004
9421FF9C BE810034
4BFFFFE5 7FC802A6
808D81E8 807E0000
7C032000 4182003C
909E0000 3BE10008
3BFF001F 57FF0034
386000D8 987F0000
989F0001 7FE3FB78
38800002 38A00001
3D808000 618C55F0
7D8903A6 4E800421
BA810034 80010068
38210064 7C0803A6
60000000 00000000
C21D4578 00000003 #Online/Core/PreventFileAlarms/FreezeStadium.asm
FFE00890 3D80801D
618C4FD8 7D8903A6
Expand Down
7 changes: 7 additions & 0 deletions Data/Sys/Slippi/InjectionLists/list_console_core.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@
"Annotation": "Recording/GetLCancelStatus/ResetLCancelStatus.asm",
"Tags": ""
},
{
"InjectionAddress": "801A4CB4",
"Name": "Slippi Recording",
"Codetype": "Auto",
"Annotation": "Common/AllocBuffer.asm",
"Tags": ""
},
{
"InjectionAddress": "800055F8",
"Name": "Slippi Recording",
Expand Down
35 changes: 28 additions & 7 deletions Data/Sys/Slippi/InjectionLists/list_netplay.json
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@
"Annotation": "Recording/GetLCancelStatus/ResetLCancelStatus.asm",
"Tags": ""
},
{
"InjectionAddress": "801A4CB4",
"Name": "Required: Slippi Recording",
"Codetype": "Auto",
"Annotation": "Common/AllocBuffer.asm",
"Tags": ""
},
{
"InjectionAddress": "800055F8",
"Name": "Required: Slippi Recording",
Expand Down Expand Up @@ -651,13 +658,6 @@
"Annotation": "Online/Core/TriggerSendInput.asm",
"Tags": ""
},
{
"InjectionAddress": "801A4CB4",
"Name": "Required: Slippi Online",
"Codetype": "Auto",
"Annotation": "Online/Core/EXIFileLoad/AllocBuffer.asm",
"Tags": ""
},
{
"InjectionAddress": "800163FC",
"Name": "Required: Slippi Online",
Expand Down Expand Up @@ -728,6 +728,27 @@
"Annotation": "Online/Core/Hacks/PreventPadAlarmDuringRollback.asm",
"Tags": ""
},
{
"InjectionAddress": "8038E910",
"Name": "Required: Slippi Online",
"Codetype": "Auto",
"Annotation": "Online/Core/Music/StartSong.asm",
"Tags": ""
},
{
"InjectionAddress": "800236EC",
"Name": "Required: Slippi Online",
"Codetype": "Auto",
"Annotation": "Online/Core/Music/Stop.asm",
"Tags": ""
},
{
"InjectionAddress": "800249F0",
"Name": "Required: Slippi Online",
"Codetype": "Auto",
"Annotation": "Online/Core/Music/VolumeChange.asm",
"Tags": ""
},
{
"InjectionAddress": "801D4578",
"Name": "Required: Slippi Online",
Expand Down
17 changes: 16 additions & 1 deletion Source/Core/Core/HW/EXI_DeviceSlippi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3284,6 +3284,21 @@ void CEXISlippi::DMAWrite(u32 _uAddr, u32 _uSize)
case CMD_GET_PLAYER_SETTINGS:
handleGetPlayerSettings();
break;
case CMD_PLAY_MUSIC:
{
auto args = SlippiExiTypes::Convert<SlippiExiTypes::PlayMusicQuery>(&memPtr[bufLoc]);
slprs_exi_device_jukebox_play_music(slprs_exi_device_ptr, args.offset, args.size);
break;
}
case CMD_STOP_MUSIC:
slprs_exi_device_jukebox_stop_music(slprs_exi_device_ptr);
break;
case CMD_CHANGE_MUSIC_VOLUME:
{
auto args = SlippiExiTypes::Convert<SlippiExiTypes::ChangeMusicVolumeQuery>(&memPtr[bufLoc]);
slprs_exi_device_jukebox_set_music_volume(slprs_exi_device_ptr, args.volume);
break;
}
default:
writeToFileAsync(&memPtr[bufLoc], payloadLen + 1, "");
m_slippiserver->write(&memPtr[bufLoc], payloadLen + 1);
Expand Down Expand Up @@ -3332,7 +3347,7 @@ void CEXISlippi::ConfigureJukebox()
#endif

slprs_exi_device_configure_jukebox(slprs_exi_device_ptr, SConfig::GetInstance().bSlippiJukeboxEnabled,
Memory::m_pRAM, AudioCommonGetCurrentVolume);
AudioCommonGetCurrentVolume);
#endif
}

Expand Down
6 changes: 6 additions & 0 deletions Source/Core/Core/HW/EXI_DeviceSlippi.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ class CEXISlippi : public IEXIDevice
CMD_GCT_LENGTH = 0xD3,
CMD_GCT_LOAD = 0xD4,
CMD_GET_DELAY = 0xD5,
CMD_PLAY_MUSIC = 0xD6,
CMD_STOP_MUSIC = 0xD7,
CMD_CHANGE_MUSIC_VOLUME = 0xD8,
CMD_PREMADE_TEXT_LENGTH = 0xE1,
CMD_PREMADE_TEXT_LOAD = 0xE2,
};
Expand Down Expand Up @@ -146,6 +149,9 @@ class CEXISlippi : public IEXIDevice
{CMD_GCT_LENGTH, 0x0},
{CMD_GCT_LOAD, 0x4},
{CMD_GET_DELAY, 0x0},
{CMD_PLAY_MUSIC, static_cast<u32>(sizeof(SlippiExiTypes::PlayMusicQuery) - 1)},
{CMD_STOP_MUSIC, 0x0},
{CMD_CHANGE_MUSIC_VOLUME, static_cast<u32>(sizeof(SlippiExiTypes::ChangeMusicVolumeQuery) - 1)},
{CMD_PREMADE_TEXT_LENGTH, 0x2},
{CMD_PREMADE_TEXT_LOAD, 0x2},
};
Expand Down
21 changes: 21 additions & 0 deletions Source/Core/Core/Slippi/SlippiExiTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,19 @@ struct GetPlayerSettingsResponse
PlayerSettings settings[4];
};

struct PlayMusicQuery
{
u8 command;
u32 offset;
u32 size;
};

struct ChangeMusicVolumeQuery
{
u8 command;
u8 volume;
};

// Not sure if resetting is strictly needed, might be contained to the file
#pragma pack()

Expand Down Expand Up @@ -121,4 +134,12 @@ template <> inline OverwriteSelectionsQuery Convert(u8 *payload)
q.stage_id = Common::FromBigEndian(q.stage_id);
return q;
}

template <> inline PlayMusicQuery Convert(u8* payload)
{
auto q = *reinterpret_cast<PlayMusicQuery *>(payload);
q.offset = Common::FromBigEndian(q.offset);
q.size = Common::FromBigEndian(q.size);
return q;
}
}; // namespace SlippiExiTypes

0 comments on commit bc9a35c

Please sign in to comment.