Skip to content

Commit

Permalink
Synced username includes platform (for debugging))
Browse files Browse the repository at this point in the history
  • Loading branch information
ihatecompvir committed Apr 18, 2024
1 parent c4c1a52 commit 7c935ea
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 77 deletions.
5 changes: 1 addition & 4 deletions include/CrossplayHooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ extern void MessageBrokerDDL(unsigned int doClassID);
void MessageBrokerDDLHook(unsigned int doClassID);
BinStream *OnlineIDReadHook(BinStream *thisBinStream, void *onlineID);
BinStream *OnlineIDWriteHook(BinStream *thisBinStream, void *onlineID);

void GetUserDataWriteEndianHook(BinStream *this, void *data, int size);
void GetUserDataWriteHook(BinStream *this, void *data, int size);
void GetUserDataFromWii(BinStream *this, void *data, int size);
BinStream *WriteUsernameHook(BinStream *thisBinStream, char *username);
148 changes: 76 additions & 72 deletions include/ports.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@
#define PORT_BINSTREAMREAD 0x827c4ea8 // BinStream::Read
#define PORT_BINSTREAMREADENDIAN 0x827c5058 // BinStream::ReadEndian
#define PORT_BINSTREAMWRITEENDIAN 0x827c5098 // BinStream::WriteEndian
#define PORT_BINSTREAMWRITELENGTHSTRING 0x827c5100 // BinStream::WriteLengthString
#define PORT_MESSAGEBROKERDDL 0x823f4498 // MessageBrokerDDL
#define PORT_ONLINEIDREAD 0x82523e80 // OnlineID::operator<<
#define PORT_ONLINEIDWRITE 0x82523a24 // OnlineID::operator>>
#define PORT_WRITEUSERNAME 0x82523a18 // BinStream::WriteLengthString call that writes username into userdata
// instance addresses
#define PORT_MODIFIERMGR_POINTER 0x82dfec08 // pointer to ModifierManager
#define PORT_ROCKCENTRALGATEWAY 0x82cc8f60 // address of RockCentralGateway
Expand Down Expand Up @@ -199,78 +201,80 @@ void DbgPrint(const char *s, ...);
#define PORT_UPDATEPRESENCEBLOCK_B 0x80188194 // branch after the failure case in a function that calls UpdatePresence
// #define PORT_LOADOBJS_BCTRL 0x827562e4
// function patch addresses
#define PORT_SETDISKERROR 0x8030ce7c // PlatformMgr::SetDiskError
#define PORT_NEWFILE 0x802f9ed0 // NewFile
#define PORT_SETTRACKSPEED 0x80441ee0 // TrackPanelDirBase::UpdateTrackSpeed
#define PORT_SETSONGSPEED 0x801130d0 // Game::SetMusicSpeed
#define PORT_MODIFIERMGR_CT 0x8022c1b4 // ModifierManager::__ct
#define PORT_MODIFIERMGR_ACTIVE 0x8022c830 // ModifierManager::ModifierActive
#define PORT_SYMBOL_CT 0x80363f60 // Symbol::Symbol
#define PORT_LOCALIZE 0x803506f4 // Locale::Localize
#define PORT_SETVENUE 0x802282dc // MetaPerformer::SetVenue(?) (actual func name is not known)
#define PORT_EXECUTEDTA 0x802cf7e0 // RockCentralGateway::ExecuteConfig
#define PORT_BANDLABELSETDISPLAYTEXT 0x803b1858 // BandLabel::SetDisplayText
#define PORT_SETSONGANDARTISTNAME 0x801b68a8 // BandLabel::SetSongAndArtistName
#define PORT_KEYSONGUITAR 0x80242ab4 // function that checks "key_keys_on_guitar"
#define PORT_HMXFACTORYFUNCAT 0x8031b2f8 // HmxObjectFactoryFunc::_at
#define PORT_WILLBENOSTRUM 0x80463010 // GameGemList::WillBeNoStrum
#define PORT_ADDGAMEGEM 0x80463198 // GameGemList::AddGameGem
#define PORT_SETADDRESS 0x8001bf74 // Quazal::InetAddress::SetAddress
#define PORT_RANDOMINT 0x802ddd60 // RandomInt(min, max)
#define PORT_GETWIDGETBYNAME 0x800d59b0 // GemManager::GetWidgetByName
#define PORT_DATANODEEVALUATE 0x80322e9c // DataNode::Evaluate
#define PORT_GETSLOTCOLOR 0x800e42a4 // TrackConfig::GetSlotColor
#define PORT_USBWIIGETTYPE 0x806c1a3c // UsbWii::GetType
#define PORT_FILE_EXISTS 0x802fa134 // FileExists
#define PORT_QUEUEMESSAGE 0x80253c50 // PassiveMessagesPanel::QueueMessage
#define PORT_SETSYSTEMLANGUAGE 0x8030f308 // SetSystemLanguage
#define PORT_ISSUPPORTEDLANGUAGE 0x8030f280 // IsSupportedLanguage
#define PORT_DATAREADFILE 0x80319bdc // DataReadFile
#define PORT_GAME_CT 0x80110f20 // Game::__ct
#define PORT_GAME_DT 0x80111614 // Game::__dt
#define PORT_GAMEGETACTIVEPLAYER 0x8011346c // Game::GetActivePlayer
#define PORT_WIINETINIT_DNSLOOKUP 0x8030c3a0 // WiiNetInit::StartDNSLookup
#define PORT_BUILDINSTRUMENTSELECTION 0x802478a8 // BuildInstrumentSelectionList(?) - actual name not known
#define PORT_PREPARESOMEVECTORMAYBE 0x80247c58 // Prepares some vector, used by BuildInstrumentSelectionList
#define PORT_SOMEVECTORPUSHBACKMAYBE 0x802484a8 // vector<class_Key<class_Vector2>,class_stlpmtx_std::StlNodeAlloc<class_Key<class_Vector2>_>_>::push_back
#define PORT_POSTPROC_DOPOST 0x806b52b4 // WiiPostProc::DoPost
#define PORT_MUSICLIBRARYSELECTMAYBE 0x80230d64 // Selects an entry in the Music Library screen - actual name not known
#define PORT_GETSYMBOLBYGAMEORIGIN 0x8027dd3c // SongSortByRecent::GetSymbolByGameOrigin
#define PORT_GETGAMEORIGINBYSYMBOL 0x8027dc58 // SongSortByRecent::GetGameOriginBySymbol
#define PORT_SONGSORTBYRECENT 0x8027dba8 // RecentCmp::__ct
#define PORT_FILESTREAM_CT 0x8034c9f8 // FileStream::__ct (the one that takes a char * path instead of a File object)
#define PORT_CHUNKSTREAM_CT 0x8034aa90 // ChunkStream::__ct
#define PORT_GETBANDUSERFROMSLOT 0x8010021c // BandUserMgr::GetBandUserFromSlot
#define PORT_GETBANDUSERS 0x80100558 // BandUserMgr::GetBandUsers
#define PORT_GETSONGSHORTNAME 0x80224edc // MetaPerformer::GetSongShortname(?) - actual name not known
#define PORT_GETMETADATA 0x80515510 // BandSongMgr::Data (function renamed from the original name to avoid any confusion with Data.h)
#define PORT_GETSONGID 0x8051513c // GetSongID, function used when adding songs to BandSongMgr
#define PORT_SONGMGRGETRANKEDSONGS 0x801d1590 // BandSongMgr::GetRankedSongs(?) - not sure on the real name of the function
#define PORT_GETSONGIDFROMSHORTNAME 0x801d0b44 // BandSongMgr::GetSongIDFromShortname
#define PORT_RNDPROPANIMSETFRAME 0x80632790 // RndPropAnim::SetFrame
#define PORT_DYNAMICCAST 0x806f5e78 // dynamic_cast
#define PORT_OBJECTFINDUIPANEL 0x80101d74 // Object::Find<UIPanel>
#define PORT_JOYPADGETPADDATA 0x80302eec // JoypadGetPadData
#define PORT_MEMALLOC 0x80353e18 // MemAlloc
#define PORT_MEMFREE 0x80354238 // MemFree
#define PORT_SYMBOLPREINIT 0x80364c74 // Symbol::PreInit
#define PORT_QUEUINGSOCKET_BIND 0x800478d4 // Quazal::QueuingSocket::Bind
#define PORT_QUAZALSOCKET_BIND 0x8001cd10 // Quazal::Socket::Bind
#define PORT_INITSONGMETADATA 0x805147a4 // InitSongMetadata
#define PORT_UPDATEPRESENCE 0x801879d4 // PresenceMgr::UpdatePresence
#define PORT_STEPSEQUENCEJOBSETSTEP 0x80025364 // Quazal::StepSequenceJob::SetStep
#define PORT_BINSTREAMWRITE 0x80342f48 // BinStream::Write
#define PORT_BINSTREAMREAD 0x80342e7c // BinStream::Read
#define PORT_BINSTREAMREADENDIAN 0x803430bc // BinStream::ReadEndian
#define PORT_BINSTREAMWRITEENDIAN 0x80343190 // BinStream::WriteEndian
#define PORT_PROPSYNCBOOL 0x800fd3d4 // PropSync::Bool
#define PORT_MESSAGEBROKERDDL 0x800bcbd8 // MessageBrokerDDL
#define PORT_BANDUSERSYNCSAVE 0x800fc408 // BandUser::SyncSave
#define PORT_USERSYNCSAVE 0x803117d4 // User::SyncSave
#define PORT_REMOTEBANDUSERSYNCLOAD 0x800fe6fc // RemoteBandUser::SyncLoad
#define PORT_REMOTEUSERSYNCLOAD 0x80311f14 // RemoteUser::SyncLoad
#define PORT_ONLINEIDREAD 0x80311f58 // OnlineID::operator<<
#define PORT_ONLINEIDWRITE 0x80309370 // OnlineID::operator>>
#define PORT_SETDISKERROR 0x8030ce7c // PlatformMgr::SetDiskError
#define PORT_NEWFILE 0x802f9ed0 // NewFile
#define PORT_SETTRACKSPEED 0x80441ee0 // TrackPanelDirBase::UpdateTrackSpeed
#define PORT_SETSONGSPEED 0x801130d0 // Game::SetMusicSpeed
#define PORT_MODIFIERMGR_CT 0x8022c1b4 // ModifierManager::__ct
#define PORT_MODIFIERMGR_ACTIVE 0x8022c830 // ModifierManager::ModifierActive
#define PORT_SYMBOL_CT 0x80363f60 // Symbol::Symbol
#define PORT_LOCALIZE 0x803506f4 // Locale::Localize
#define PORT_SETVENUE 0x802282dc // MetaPerformer::SetVenue(?) (actual func name is not known)
#define PORT_EXECUTEDTA 0x802cf7e0 // RockCentralGateway::ExecuteConfig
#define PORT_BANDLABELSETDISPLAYTEXT 0x803b1858 // BandLabel::SetDisplayText
#define PORT_SETSONGANDARTISTNAME 0x801b68a8 // BandLabel::SetSongAndArtistName
#define PORT_KEYSONGUITAR 0x80242ab4 // function that checks "key_keys_on_guitar"
#define PORT_HMXFACTORYFUNCAT 0x8031b2f8 // HmxObjectFactoryFunc::_at
#define PORT_WILLBENOSTRUM 0x80463010 // GameGemList::WillBeNoStrum
#define PORT_ADDGAMEGEM 0x80463198 // GameGemList::AddGameGem
#define PORT_SETADDRESS 0x8001bf74 // Quazal::InetAddress::SetAddress
#define PORT_RANDOMINT 0x802ddd60 // RandomInt(min, max)
#define PORT_GETWIDGETBYNAME 0x800d59b0 // GemManager::GetWidgetByName
#define PORT_DATANODEEVALUATE 0x80322e9c // DataNode::Evaluate
#define PORT_GETSLOTCOLOR 0x800e42a4 // TrackConfig::GetSlotColor
#define PORT_USBWIIGETTYPE 0x806c1a3c // UsbWii::GetType
#define PORT_FILE_EXISTS 0x802fa134 // FileExists
#define PORT_QUEUEMESSAGE 0x80253c50 // PassiveMessagesPanel::QueueMessage
#define PORT_SETSYSTEMLANGUAGE 0x8030f308 // SetSystemLanguage
#define PORT_ISSUPPORTEDLANGUAGE 0x8030f280 // IsSupportedLanguage
#define PORT_DATAREADFILE 0x80319bdc // DataReadFile
#define PORT_GAME_CT 0x80110f20 // Game::__ct
#define PORT_GAME_DT 0x80111614 // Game::__dt
#define PORT_GAMEGETACTIVEPLAYER 0x8011346c // Game::GetActivePlayer
#define PORT_WIINETINIT_DNSLOOKUP 0x8030c3a0 // WiiNetInit::StartDNSLookup
#define PORT_BUILDINSTRUMENTSELECTION 0x802478a8 // BuildInstrumentSelectionList(?) - actual name not known
#define PORT_PREPARESOMEVECTORMAYBE 0x80247c58 // Prepares some vector, used by BuildInstrumentSelectionList
#define PORT_SOMEVECTORPUSHBACKMAYBE 0x802484a8 // vector<class_Key<class_Vector2>,class_stlpmtx_std::StlNodeAlloc<class_Key<class_Vector2>_>_>::push_back
#define PORT_POSTPROC_DOPOST 0x806b52b4 // WiiPostProc::DoPost
#define PORT_MUSICLIBRARYSELECTMAYBE 0x80230d64 // Selects an entry in the Music Library screen - actual name not known
#define PORT_GETSYMBOLBYGAMEORIGIN 0x8027dd3c // SongSortByRecent::GetSymbolByGameOrigin
#define PORT_GETGAMEORIGINBYSYMBOL 0x8027dc58 // SongSortByRecent::GetGameOriginBySymbol
#define PORT_SONGSORTBYRECENT 0x8027dba8 // RecentCmp::__ct
#define PORT_FILESTREAM_CT 0x8034c9f8 // FileStream::__ct (the one that takes a char * path instead of a File object)
#define PORT_CHUNKSTREAM_CT 0x8034aa90 // ChunkStream::__ct
#define PORT_GETBANDUSERFROMSLOT 0x8010021c // BandUserMgr::GetBandUserFromSlot
#define PORT_GETBANDUSERS 0x80100558 // BandUserMgr::GetBandUsers
#define PORT_GETSONGSHORTNAME 0x80224edc // MetaPerformer::GetSongShortname(?) - actual name not known
#define PORT_GETMETADATA 0x80515510 // BandSongMgr::Data (function renamed from the original name to avoid any confusion with Data.h)
#define PORT_GETSONGID 0x8051513c // GetSongID, function used when adding songs to BandSongMgr
#define PORT_SONGMGRGETRANKEDSONGS 0x801d1590 // BandSongMgr::GetRankedSongs(?) - not sure on the real name of the function
#define PORT_GETSONGIDFROMSHORTNAME 0x801d0b44 // BandSongMgr::GetSongIDFromShortname
#define PORT_RNDPROPANIMSETFRAME 0x80632790 // RndPropAnim::SetFrame
#define PORT_DYNAMICCAST 0x806f5e78 // dynamic_cast
#define PORT_OBJECTFINDUIPANEL 0x80101d74 // Object::Find<UIPanel>
#define PORT_JOYPADGETPADDATA 0x80302eec // JoypadGetPadData
#define PORT_MEMALLOC 0x80353e18 // MemAlloc
#define PORT_MEMFREE 0x80354238 // MemFree
#define PORT_SYMBOLPREINIT 0x80364c74 // Symbol::PreInit
#define PORT_QUEUINGSOCKET_BIND 0x800478d4 // Quazal::QueuingSocket::Bind
#define PORT_QUAZALSOCKET_BIND 0x8001cd10 // Quazal::Socket::Bind
#define PORT_INITSONGMETADATA 0x805147a4 // InitSongMetadata
#define PORT_UPDATEPRESENCE 0x801879d4 // PresenceMgr::UpdatePresence
#define PORT_STEPSEQUENCEJOBSETSTEP 0x80025364 // Quazal::StepSequenceJob::SetStep
#define PORT_BINSTREAMWRITE 0x80342f48 // BinStream::Write
#define PORT_BINSTREAMREAD 0x80342e7c // BinStream::Read
#define PORT_BINSTREAMREADENDIAN 0x803430bc // BinStream::ReadEndian
#define PORT_BINSTREAMWRITEENDIAN 0x80343190 // BinStream::WriteEndian
#define PORT_BINSTREAMWRITELENGTHSTRING 0x80342ad8 // BinStream::WriteLengthString
#define PORT_PROPSYNCBOOL 0x800fd3d4 // PropSync::Bool
#define PORT_MESSAGEBROKERDDL 0x800bcbd8 // MessageBrokerDDL
#define PORT_BANDUSERSYNCSAVE 0x800fc408 // BandUser::SyncSave
#define PORT_USERSYNCSAVE 0x803117d4 // User::SyncSave
#define PORT_REMOTEBANDUSERSYNCLOAD 0x800fe6fc // RemoteBandUser::SyncLoad
#define PORT_REMOTEUSERSYNCLOAD 0x80311f14 // RemoteUser::SyncLoad
#define PORT_ONLINEIDREAD 0x80311f58 // OnlineID::operator<<
#define PORT_ONLINEIDWRITE 0x80309370 // OnlineID::operator>>
#define PORT_WRITEUSERNAME 0x80311818 // BinStream::WriteLengthString call that writes username into userdata
// instance addresses
#define PORT_MODIFIERMGR_POINTER 0x808fda68 // pointer to ModifierManager
#define PORT_ROCKCENTRALGATEWAY 0x80900870 // address of RockCentralGateway
Expand Down
1 change: 1 addition & 0 deletions include/rb3/BinStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ extern void BinstreamWrite(void *thisBinStream, void *data, int size);
extern void BinstreamRead(void *thisBinStream, void *data, int size);
extern void BinstreamReadEndian(void *thisBinStream, void *data, int size);
extern void BinstreamWriteEndian(void *thisBinStream, void *data, int size);
extern void BinstreamWriteLengthString(void *thisBinStream, char *string);

#endif // _BINSTREAM_H
30 changes: 29 additions & 1 deletion source/CrossplayHooks.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "rb3e_include.h"
#include "CrossplayHooks.h"
#include <string.h>

void MessageBrokerDDLHook(unsigned int doClassID)
{
Expand All @@ -19,4 +20,31 @@ BinStream *OnlineIDWriteHook(BinStream *thisBinStream, void *onlineID)
char empty[36] = {0};
BinstreamWrite(thisBinStream, (void *)&empty, 36);
return thisBinStream;
}
}

// this is mostly for debugging purposes
// might remove for final release
// however, maybe i could use font glyphs for the platform? might be cool
BinStream *WriteUsernameHook(BinStream *thisBinStream, char *username)
{
char newUsername[64] = {0}; // Buffer for the new username with platform prefix
const char *platformPrefix;
size_t remainingSize = 0;
size_t usedLength = 0;
#ifdef RB3E_WII
platformPrefix = "[Wii] ";
#else
platformPrefix = "[360] ";
#endif

// cant use strncat on wii so this will have to do
strncpy(newUsername, platformPrefix, sizeof(newUsername) - 1);
newUsername[sizeof(newUsername) - 1] = '\0';

usedLength = strlen(newUsername);
remainingSize = sizeof(newUsername) - usedLength - 1;

strncpy(newUsername + usedLength, username, remainingSize);
newUsername[sizeof(newUsername) - 1] = '\0';
BinstreamWriteLengthString(thisBinStream, newUsername);
}
1 change: 1 addition & 0 deletions source/_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,6 @@ RB3E_STUB(BinstreamWrite)
RB3E_STUB(BinstreamRead)
RB3E_STUB(BinstreamReadEndian)
RB3E_STUB(BinstreamWriteEndian)
RB3E_STUB(BinstreamWriteLengthString)
RB3E_STUB(MessageBrokerDDL)
RB3E_STUB(PropSyncBool)
2 changes: 2 additions & 0 deletions source/rb3enhanced.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ void InitialiseFunctions()
POKE_B(&BinstreamRead, PORT_BINSTREAMREAD);
POKE_B(&BinstreamWriteEndian, PORT_BINSTREAMWRITEENDIAN);
POKE_B(&BinstreamReadEndian, PORT_BINSTREAMREADENDIAN);
POKE_B(&BinstreamWriteLengthString, PORT_BINSTREAMWRITELENGTHSTRING);
RB3E_MSG("Functions initialized!", NULL);
}

Expand All @@ -337,6 +338,7 @@ void ApplyCrossplayHooks()
HookFunction(PORT_MESSAGEBROKERDDL, &MessageBrokerDDL, &MessageBrokerDDLHook);
POKE_BL(PORT_ONLINEIDREAD, &OnlineIDReadHook);
POKE_BL(PORT_ONLINEIDWRITE, &OnlineIDWriteHook);
POKE_BL(PORT_WRITEUSERNAME, &WriteUsernameHook);

#ifdef RB3E_WII // wii exclusive hooks

Expand Down

0 comments on commit 7c935ea

Please sign in to comment.