Skip to content

Commit 9b0707b

Browse files
committedMay 9, 2024
fix(entities): Improve errors handling
1 parent ad484df commit 9b0707b

File tree

11 files changed

+574
-433
lines changed

11 files changed

+574
-433
lines changed
 

‎packages/tosu/src/entities/AllTimesData/index.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ export class AllTimesData extends AbstractEntity {
1919
MemorySongsFolder: string = '';
2020

2121
setGameFolder(value: string) {
22+
if (typeof value !== 'string') return;
23+
2224
this.GameFolder = value;
2325
}
2426

2527
setSongsFolder(value: string) {
28+
if (typeof value !== 'string') return;
29+
2630
this.SongsFolder = value;
2731
}
2832

@@ -92,8 +96,14 @@ export class AllTimesData extends AbstractEntity {
9296
) + 0xc
9397
)
9498
);
99+
100+
this.resetReportCount('ATD(updateState)');
95101
} catch (exc) {
96-
wLogger.error(`ATD(updateState) ${(exc as any).message}`);
102+
this.reportError(
103+
'ATD(updateState)',
104+
10,
105+
`ATD(updateState) ${(exc as any).message}`
106+
);
97107
wLogger.debug(exc);
98108
}
99109
}

‎packages/tosu/src/entities/BassDensityData/index.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export class BassDensityData extends AbstractEntity {
77
currentAudioVelocity: number = 0.0;
88
density: number = 0.0;
99

10-
private updateStateErrorAttempts: number = 0;
11-
1210
updateState() {
1311
try {
1412
const { process: osuProcess, patterns } =
@@ -72,15 +70,13 @@ export class BassDensityData extends AbstractEntity {
7270
this.currentAudioVelocity = currentAudioVelocity;
7371
this.density = (1 + currentAudioVelocity) * 0.5;
7472

75-
if (this.updateStateErrorAttempts !== 0) {
76-
this.updateStateErrorAttempts = 0;
77-
}
73+
this.resetReportCount('BDD(updateState)');
7874
} catch (exc) {
79-
this.updateStateErrorAttempts += 1;
80-
81-
if (this.updateStateErrorAttempts > 5) {
82-
wLogger.error(`BDD(updateState) ${(exc as any).message}`);
83-
}
75+
this.reportError(
76+
'BDD(updateState)',
77+
10,
78+
`BDD(updateState) ${(exc as any).message}`
79+
);
8480
wLogger.debug(exc);
8581
}
8682
}

‎packages/tosu/src/entities/BeatmapPpData/index.ts

+288-254
Large diffs are not rendered by default.

‎packages/tosu/src/entities/GamePlayData/index.ts

+54-30
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ export class GamePlayData extends AbstractEntity {
5353
isReplayUiHidden: boolean;
5454

5555
private scoreBase: number = 0;
56-
57-
uheErrorAttempts: number = 0;
56+
private cachedkeys: string = '';
5857

5958
constructor(osuInstance: OsuInstance) {
6059
super(osuInstance);
@@ -257,16 +256,21 @@ export class GamePlayData extends AbstractEntity {
257256
this.ComboPrev = this.Combo;
258257

259258
// [[[Ruleset + 0x68] + 0x38] + 0x38]
260-
261259
this.updateLeaderboard(
262260
process,
263261
patterns.getLeaderStart(),
264262
rulesetAddr
265263
);
266264
this.updateGrade(menuData);
267265
this.updateStarsAndPerformance();
266+
267+
this.resetReportCount('GD(updateState)');
268268
} catch (exc) {
269-
wLogger.error(`GPD(updateState) ${(exc as any).message}`);
269+
this.reportError(
270+
'GD(updateState)',
271+
10,
272+
`GD(updateState) ${(exc as any).message}`
273+
);
270274
wLogger.debug(exc);
271275
}
272276
}
@@ -289,7 +293,7 @@ export class GamePlayData extends AbstractEntity {
289293
const keyOverlayPtr = process.readUInt(rulesetAddr + 0xb0);
290294
if (keyOverlayPtr === 0) {
291295
wLogger.debug(
292-
`GD(updateKeyOverlay) keyOverlayPtr is zero ${keyOverlayPtr} (${rulesetAddr} - ${patterns.getPattern(
296+
`GD(updateKeyOverlay) keyOverlayPtr is zero [${keyOverlayPtr}] (${rulesetAddr} - ${patterns.getPattern(
293297
'rulesetsAddr'
294298
)})`
295299
);
@@ -301,9 +305,7 @@ export class GamePlayData extends AbstractEntity {
301305
process.readInt(keyOverlayPtr + 0x10) + 0x4
302306
);
303307
if (keyOverlayArrayAddr === 0) {
304-
wLogger.debug(
305-
'GD(updateKeyOverlay) keyOverlayArrayAddr is zero'
306-
);
308+
wLogger.debug('GD(updateKeyOverlay) keyOverlayAddr[] is zero');
307309
return;
308310
}
309311

@@ -328,12 +330,20 @@ export class GamePlayData extends AbstractEntity {
328330
this.KeyOverlay = keys;
329331
this.isKeyOverlayDefaultState = false;
330332

331-
wLogger.debug(
332-
`GD(updateKeyOverlay) updated (${rulesetAddr} ${keyOverlayArrayAddr}) ${keys.K1Count}:${keys.K2Count}:${keys.M1Count}:${keys.M2Count}`
333-
);
333+
const keysLine = `${keys.K1Count}:${keys.K2Count}:${keys.M1Count}:${keys.M2Count}`;
334+
if (this.cachedkeys !== keysLine) {
335+
wLogger.debug(
336+
`GD(updateKeyOverlay) updated (${rulesetAddr} ${keyOverlayArrayAddr}) ${keysLine}`
337+
);
338+
this.cachedkeys = keysLine;
339+
}
340+
341+
this.resetReportCount('GD(updateKeyOverlay)');
334342
} catch (exc) {
335-
wLogger.error(
336-
'GD(updateKeyOverlay) error happend while keyboard overlay attempted to parse'
343+
this.reportError(
344+
'GD(updateKeyOverlay)',
345+
10,
346+
`GD(updateKeyOverlay) ${(exc as any).message}`
337347
);
338348
wLogger.debug(exc);
339349
}
@@ -422,17 +432,18 @@ export class GamePlayData extends AbstractEntity {
422432
this.HitErrors.push(error);
423433
}
424434

425-
this.uheErrorAttempts = 0;
435+
this.resetReportCount('GD(updateHitErrors)');
426436
} catch (exc) {
427-
this.uheErrorAttempts += 1;
428-
429-
if (this.uheErrorAttempts > 10) {
430-
wLogger.error('GD(updateHitErrors) failed to parse hitErrors');
431-
}
437+
this.reportError(
438+
'GD(updateHitErrors)',
439+
10,
440+
`GD(updateHitErrors) ${(exc as any).message}`
441+
);
432442
wLogger.debug(exc);
433443
}
434444
}
435445

446+
// IMPROVE, WE DONT NEED TO SUM EVERY HITERROR EACH TIME (for future)
436447
private calculateUR(): number {
437448
if (this.HitErrors.length < 1) {
438449
return 0;
@@ -493,18 +504,31 @@ export class GamePlayData extends AbstractEntity {
493504
leaderStart: number,
494505
rulesetAddr: number
495506
) {
496-
// [Ruleset + 0x7C]
497-
const leaderBoardBase = process.readInt(rulesetAddr + 0x7c);
498-
499-
// [Ruleset + 0x7C] + 0x24
500-
const leaderBoardAddr =
501-
leaderBoardBase > 0 ? process.readInt(leaderBoardBase + 0x24) : 0;
502-
if (!this.Leaderboard) {
503-
this.Leaderboard = new Leaderboard(process, leaderBoardAddr);
504-
} else {
505-
this.Leaderboard.updateBase(leaderBoardAddr);
507+
try {
508+
// [Ruleset + 0x7C]
509+
const leaderBoardBase = process.readInt(rulesetAddr + 0x7c);
510+
511+
// [Ruleset + 0x7C] + 0x24
512+
const leaderBoardAddr =
513+
leaderBoardBase > 0
514+
? process.readInt(leaderBoardBase + 0x24)
515+
: 0;
516+
if (!this.Leaderboard) {
517+
this.Leaderboard = new Leaderboard(process, leaderBoardAddr);
518+
} else {
519+
this.Leaderboard.updateBase(leaderBoardAddr);
520+
}
521+
this.Leaderboard.readLeaderboard(leaderStart);
522+
523+
this.resetReportCount('GD(updateLeaderboard)');
524+
} catch (exc) {
525+
this.reportError(
526+
'GD(updateLeaderboard)',
527+
10,
528+
`GD(updateLeaderboard) ${(exc as any).message}`
529+
);
530+
wLogger.debug(exc);
506531
}
507-
this.Leaderboard.readLeaderboard(leaderStart);
508532
}
509533

510534
private updateStarsAndPerformance() {

‎packages/tosu/src/entities/MenuData/index.ts

+13-11
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export class MenuData extends AbstractEntity {
3030

3131
previousMD5: string = '';
3232

33-
private mp3ErrorAttempts: number = 0;
34-
3533
updateState() {
3634
try {
3735
const { process, patterns } = this.osuInstance.getServices([
@@ -126,8 +124,14 @@ export class MenuData extends AbstractEntity {
126124
this.ObjectCount = process.readInt(beatmapAddr + 0xf8);
127125

128126
this.previousMD5 = this.MD5;
127+
128+
this.resetReportCount('MB(updateState)');
129129
} catch (exc) {
130-
wLogger.error(`MB(updateState) ${(exc as any).message}`);
130+
this.reportError(
131+
'MB(updateState)',
132+
10,
133+
`MB(updateState) ${(exc as any).message}`
134+
);
131135
wLogger.debug(exc);
132136
}
133137
}
@@ -148,15 +152,13 @@ export class MenuData extends AbstractEntity {
148152
)
149153
);
150154

151-
this.mp3ErrorAttempts = 0;
155+
this.resetReportCount('MB(updateMP3Length)');
152156
} catch (exc) {
153-
this.mp3ErrorAttempts += 1;
154-
155-
if (this.mp3ErrorAttempts > 5) {
156-
wLogger.error(
157-
'Unable to parse beatmap mp3 length (you can ignore it)'
158-
);
159-
}
157+
this.reportError(
158+
'MB(updateMP3Length)',
159+
10,
160+
`MB(updateMP3Length) ${(exc as any).message}`
161+
);
160162
wLogger.debug(exc);
161163
}
162164
}

‎packages/tosu/src/entities/ResultsScreenData/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,14 @@ export class ResultsScreenData extends AbstractEntity {
123123
process.readInt(resultScreenBase + 0xa4),
124124
process.readInt(resultScreenBase + 0xa0)
125125
).toISOString();
126+
127+
this.resetReportCount('RSD(updateState)');
126128
} catch (exc) {
127-
wLogger.error(`RSD(updateState) ${(exc as any).message}`);
129+
this.reportError(
130+
'RSD(updateState)',
131+
10,
132+
`RSD(updateState) ${(exc as any).message}`
133+
);
128134
wLogger.debug(exc);
129135
}
130136
}

‎packages/tosu/src/entities/Settings/index.ts

+93-66
Original file line numberDiff line numberDiff line change
@@ -477,22 +477,20 @@ export class Settings extends AbstractEntity {
477477
break;
478478
}
479479

480-
if (value != null) {
481-
// console.log(position, key, value);
482-
483-
this.configList[key].setValue(value);
480+
if (value === null || value === undefined) {
481+
return;
484482
}
485483

486-
this.scvErrorAttempts = 0;
487-
} catch (exc) {
488-
this.scvErrorAttempts += 1;
484+
// console.log(position, key, value);
485+
this.configList[key].setValue(value);
489486

490-
if (this.scvErrorAttempts > 10) {
491-
wLogger.error(
492-
"ATD(setConfigValue) Can't set config value",
493-
position
494-
);
495-
}
487+
this.resetReportCount(`ATD(setConfigValue)[${position}]`);
488+
} catch (exc) {
489+
this.reportError(
490+
`ATD(setConfigValue)[${position}]`,
491+
10,
492+
`ATD(setConfigValue)[${position}] ${(exc as any).message}`
493+
);
496494
wLogger.debug(exc);
497495
}
498496
}
@@ -506,24 +504,21 @@ export class Settings extends AbstractEntity {
506504
const value = process.readInt(current + 0xc);
507505

508506
const bindable = this.bindingList[key];
509-
if (bindable) {
510-
// console.log(position, Bindings[key], VirtualKeyCode[value]);
511-
512-
bindable.setValue(value);
513-
} else {
507+
if (bindable === null || bindable === undefined) {
514508
// console.log('binding', key);
509+
return;
515510
}
516511

517-
this.sbvErrorAttempts = 0;
518-
} catch (exc) {
519-
this.sbvErrorAttempts += 1;
512+
// console.log(position, Bindings[key], VirtualKeyCode[value]);
513+
bindable.setValue(value);
520514

521-
if (this.sbvErrorAttempts > 10) {
522-
wLogger.error(
523-
"ATD(setBindingValue) Can't set binding value",
524-
position
525-
);
526-
}
515+
this.resetReportCount(`ATD(setBindingValue)[${position}]`);
516+
} catch (exc) {
517+
this.reportError(
518+
`ATD(setBindingValue)[${position}]`,
519+
10,
520+
`ATD(setBindingValue)[${position}] ${(exc as any).message}`
521+
);
527522
wLogger.debug(exc);
528523
}
529524
}
@@ -536,19 +531,36 @@ export class Settings extends AbstractEntity {
536531
process.readSharpDictionary(configurationAddr);
537532
for (let i = 0; i < rawSharpDictionary.length; i++) {
538533
const current = rawSharpDictionary[i];
539-
const keyAddress = process.readInt(current);
540534

541-
const key = process.readSharpString(keyAddress);
535+
try {
536+
const keyAddress = process.readInt(current);
537+
const key = process.readSharpString(keyAddress);
542538

543-
if (!(key in this.configList)) {
544-
continue;
545-
}
539+
if (!(key in this.configList)) {
540+
continue;
541+
}
546542

547-
// console.log(i, current, key);
548-
this.configPositions.push(i);
543+
// console.log(i, current, key);
544+
this.configPositions.push(i);
545+
546+
this.resetReportCount(`ATD(configOffset)[${i}]`);
547+
} catch (exc) {
548+
this.reportError(
549+
`ATD(configOffset)[${i}]`,
550+
10,
551+
`ATD(configOffset)[${i}] ${(exc as any).message}`
552+
);
553+
wLogger.debug(exc);
554+
}
549555
}
556+
557+
this.resetReportCount('ATD(findConfigOffsets)');
550558
} catch (exc) {
551-
wLogger.error("ATD(updateConfigState) Can't find config offset");
559+
this.reportError(
560+
'ATD(findConfigOffsets)',
561+
10,
562+
`ATD(findConfigOffsets) ${(exc as any).message}`
563+
);
552564
wLogger.debug(exc);
553565
}
554566
}
@@ -560,19 +572,36 @@ export class Settings extends AbstractEntity {
560572
process.readSharpDictionary(bindingConfigAddr);
561573
for (let i = 0; i < rawSharpDictionary.length; i++) {
562574
const current = rawSharpDictionary[i];
563-
const key = process.readInt(current);
564-
// const value = process.readInt(current + 0xc);
565-
566-
if (!(key in this.bindingList)) {
567-
continue;
575+
try {
576+
const key = process.readInt(current);
577+
// const value = process.readInt(current + 0xc);
578+
579+
if (!(key in this.bindingList)) {
580+
continue;
581+
}
582+
583+
// const bindable = Bindings[key];
584+
// console.log(i, current, bindable, key, value);
585+
this.bindingPositions.push(i);
586+
587+
this.resetReportCount(`ATD(bindingOffset)[${i}]`);
588+
} catch (exc) {
589+
this.reportError(
590+
`ATD(bindingOffset)[${i}]`,
591+
10,
592+
`ATD(bindingOffset)[${i}] ${(exc as any).message}`
593+
);
594+
wLogger.debug(exc);
568595
}
569-
570-
// const bindable = Bindings[key];
571-
// console.log(i, current, bindable, key, value);
572-
this.bindingPositions.push(i);
573596
}
597+
598+
this.resetReportCount('ATD(findBindingOffsets)');
574599
} catch (exc) {
575-
wLogger.error("ATD(updateConfigState) Can't find binding offset");
600+
this.reportError(
601+
'ATD(findBindingOffsets)',
602+
10,
603+
`ATD(findBindingOffsets) ${(exc as any).message}`
604+
);
576605
wLogger.debug(exc);
577606
}
578607
}
@@ -588,17 +617,13 @@ export class Settings extends AbstractEntity {
588617
this.setConfigValue(process, configurationAddr, position);
589618
}
590619

591-
if (this.configStateErrorAttempts !== 0) {
592-
this.configStateErrorAttempts = 0;
593-
}
620+
this.resetReportCount('ATD(updateConfigState)');
594621
} catch (exc) {
595-
this.configStateErrorAttempts += 1;
596-
597-
if (this.configStateErrorAttempts > 5) {
598-
wLogger.error(
599-
"ATD(updateConfigState) Can't update config state"
600-
);
601-
}
622+
this.reportError(
623+
'ATD(updateConfigState)',
624+
10,
625+
`ATD(updateConfigState) ${(exc as any).message}`
626+
);
602627
wLogger.debug(exc);
603628
}
604629
}
@@ -614,17 +639,13 @@ export class Settings extends AbstractEntity {
614639
this.setBindingValue(process, bindingConfigAddr, position);
615640
}
616641

617-
if (this.bindingStateErrorAttempts !== 0) {
618-
this.bindingStateErrorAttempts = 0;
619-
}
642+
this.resetReportCount('ATD(updateBindingState)');
620643
} catch (exc) {
621-
this.bindingStateErrorAttempts += 1;
622-
623-
if (this.bindingStateErrorAttempts > 5) {
624-
wLogger.error(
625-
"ATD(updateBindingState) Can't update binding state"
626-
);
627-
}
644+
this.reportError(
645+
'ATD(updateBindingState)',
646+
10,
647+
`ATD(updateBindingState) ${(exc as any).message}`
648+
);
628649
wLogger.debug(exc);
629650
}
630651
}
@@ -647,8 +668,14 @@ export class Settings extends AbstractEntity {
647668
);
648669

649670
this.updateBindingState(process, process.readPointer(bindingsAddr));
671+
672+
this.resetReportCount('SETTINGS(updatestate)');
650673
} catch (exc) {
651-
wLogger.error(`S(updateState) ${(exc as any).message}`);
674+
this.reportError(
675+
'SETTINGS(updatestate)',
676+
10,
677+
`SETTINGS(updatestate) ${(exc as any).message}`
678+
);
652679
wLogger.debug(exc);
653680
}
654681
}

‎packages/tosu/src/entities/TourneyManagerData/index.ts

+79-49
Original file line numberDiff line numberDiff line change
@@ -91,69 +91,99 @@ export class TourneyManagerData extends AbstractEntity {
9191
// because osu creates 40 channels with language topics, lobby, osu, etc... (bancho announces this to you)
9292
// and 41 is commonly for multiplayer in tourney client
9393
for (let i = channelsLength - 1; i >= 0; i--) {
94-
const current =
95-
channelsItems + patterns.getLeaderStart() + 0x4 * i;
96-
97-
const channelAddr = process.readInt(current);
98-
if (channelAddr === 0) {
99-
continue;
100-
}
94+
try {
95+
const current =
96+
channelsItems + patterns.getLeaderStart() + 0x4 * i;
10197

102-
const chatTag = process.readSharpString(
103-
process.readInt(channelAddr + 0x4)
104-
);
105-
if (chatTag !== '#multiplayer') {
106-
continue;
107-
}
98+
const channelAddr = process.readInt(current);
99+
if (channelAddr === 0) {
100+
continue;
101+
}
108102

109-
const result: ITourneyManagetChatItem[] = [];
103+
const chatTag = process.readSharpString(
104+
process.readInt(channelAddr + 0x4)
105+
);
106+
if (chatTag !== '#multiplayer') {
107+
continue;
108+
}
110109

111-
const messagesAddr = process.readInt(channelAddr + 0x10);
110+
const result: ITourneyManagetChatItem[] = [];
112111

113-
const messagesItems = process.readInt(messagesAddr + 0x4);
114-
const messagesSize = process.readInt(messagesAddr + 0xc);
112+
const messagesAddr = process.readInt(channelAddr + 0x10);
115113

116-
if (this.Messages.length === messagesSize) {
117-
// Not needed an update
118-
continue;
119-
}
114+
const messagesItems = process.readInt(messagesAddr + 0x4);
115+
const messagesSize = process.readInt(messagesAddr + 0xc);
120116

121-
for (let i = 0; i < messagesSize; i++) {
122-
const current =
123-
messagesItems + patterns.getLeaderStart() + 0x4 * i;
124-
const currentItem = process.readInt(current);
125-
126-
// [Base + 0x4]
127-
const content = process.readSharpString(
128-
process.readInt(currentItem + 0x4)
129-
);
130-
// NOTE: Check for empty, and !mp commands
131-
if (content === '' || content.startsWith('!mp')) {
117+
if (this.Messages.length === messagesSize) {
118+
// Not needed an update
132119
continue;
133120
}
134-
// [Base + 0x8]
135-
const timeName = process.readSharpString(
136-
process.readInt(currentItem + 0x8)
121+
122+
for (let i = 0; i < messagesSize; i++) {
123+
try {
124+
const current =
125+
messagesItems +
126+
patterns.getLeaderStart() +
127+
0x4 * i;
128+
const currentItem = process.readInt(current);
129+
130+
// [Base + 0x4]
131+
const content = process.readSharpString(
132+
process.readInt(currentItem + 0x4)
133+
);
134+
// NOTE: Check for empty, and !mp commands
135+
if (content === '' || content.startsWith('!mp')) {
136+
continue;
137+
}
138+
// [Base + 0x8]
139+
const timeName = process.readSharpString(
140+
process.readInt(currentItem + 0x8)
141+
);
142+
const [time] = timeName.split(' ');
143+
144+
result.push({
145+
time: time.trim(),
146+
name: timeName
147+
.replace(time, '')
148+
.replace(/:$/, '')
149+
.trimStart(),
150+
content
151+
});
152+
153+
this.resetReportCount('TMD(chatMessage)');
154+
} catch (exc) {
155+
this.reportError(
156+
'TMD(chatMessage)',
157+
10,
158+
`TMD(chatMessage) ${(exc as any).message}`
159+
);
160+
wLogger.debug(exc);
161+
}
162+
}
163+
164+
this.Messages = result;
165+
wLogger.debug('TMD(updateState) Chat Updated');
166+
167+
this.resetReportCount('TMD(channelUpdate)');
168+
} catch (exc) {
169+
this.reportError(
170+
'TMD(channelUpdate)',
171+
10,
172+
`TMD(channelUpdate) ${(exc as any).message}`
137173
);
138-
const [time] = timeName.split(' ');
139-
140-
result.push({
141-
time: time.trim(),
142-
name: timeName
143-
.replace(time, '')
144-
.replace(/:$/, '')
145-
.trimStart(),
146-
content
147-
});
174+
wLogger.debug(exc);
148175
}
149-
150-
this.Messages = result;
151-
wLogger.debug('TMD(updateState) Chat Updated');
152176
}
153177

154178
wLogger.debug('TMD(updateState) updated');
179+
180+
this.resetReportCount('TMD(updateState)');
155181
} catch (exc) {
156-
wLogger.error(`TMD(updateState) ${(exc as any).message}`);
182+
this.reportError(
183+
'TMD(updateState)',
184+
10,
185+
`TMD(updateState) ${(exc as any).message}`
186+
);
157187
wLogger.debug(exc);
158188
}
159189
}

‎packages/tosu/src/entities/TourneyUserProfileData/index.ts

+15-1
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,19 @@ export class TourneyUserProfileData extends AbstractEntity {
4545
);
4646
if (!spectatingUserDrawable) {
4747
wLogger.debug('TUPD(updateState) Slot is not equiped');
48+
this.reportError(
49+
'TUPD(updateState) Slot',
50+
20,
51+
`TUPD(updateState) Slot is not equiped`
52+
);
53+
4854
this.resetState();
4955
gamePlayData.init();
5056
return;
5157
}
5258

59+
this.resetReportCount('TUPD(updateState) Slot');
60+
5361
try {
5462
// UserDrawable + 0x4
5563
this.Accuracy = process.readDouble(spectatingUserDrawable + 0x4);
@@ -73,8 +81,14 @@ export class TourneyUserProfileData extends AbstractEntity {
7381
this.UserID = process.readInt(spectatingUserDrawable + 0x70);
7482

7583
this.isDefaultState = false;
84+
85+
this.resetReportCount('TUPD(updateState)');
7686
} catch (exc) {
77-
wLogger.error('TUPD(updateState) signature failed');
87+
this.reportError(
88+
'TUPD(updateState)',
89+
10,
90+
`TUPD(updateState) ${(exc as any).message}`
91+
);
7892
wLogger.debug(exc);
7993
}
8094

‎packages/tosu/src/entities/UserProfile/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ export class UserProfile extends AbstractEntity {
4747
this.performancePoints = process.readShort(profileBase + 0x9c);
4848
// ARGB, to convert use UserProfile.backgroundColour.toString(16)
4949
this.backgroundColour = process.readUInt(profileBase + 0xac);
50+
51+
this.resetReportCount('UP(updateState)');
5052
} catch (exc) {
51-
wLogger.error(`UP(updateState) ${(exc as any).message}`);
53+
this.reportError(
54+
'UP(updateState)',
55+
10,
56+
`UP(updateState) ${(exc as any).message}`
57+
);
5258
wLogger.debug(exc);
5359
}
5460
}

‎packages/tosu/src/objects/instanceManager/osuInstance.ts

+1-9
Original file line numberDiff line numberDiff line change
@@ -424,15 +424,7 @@ export class OsuInstance {
424424
this.previousState !== currentState
425425
) {
426426
this.previousState = currentState;
427-
428-
try {
429-
beatmapPpData.updateMapMetadata(currentMods);
430-
} catch (exc) {
431-
wLogger.error(
432-
"OI(updateMapMetadata) Can't update beatmap metadata"
433-
);
434-
wLogger.debug(exc);
435-
}
427+
beatmapPpData.updateMapMetadata(currentMods);
436428
}
437429

438430
setTimeout(() => {

0 commit comments

Comments
 (0)
Please sign in to comment.