pokeemerald/asm/international_string_util.s

356 lines
5.3 KiB
ArmAsm
Raw Normal View History

2017-09-17 03:32:37 +02:00
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_81DB41C
sub_81DB41C: @ 81DB41C
push {r4-r7,lr}
adds r4, r0, 0
ldr r1, [r4]
movs r7, 0
movs r6, 0
ldrh r0, [r4, 0xC]
cmp r7, r0
bge _081DB44C
adds r5, r1, 0
_081DB42E:
ldrb r0, [r4, 0x17]
lsls r0, 26
lsrs r0, 26
ldr r1, [r5]
movs r2, 0
bl GetStringWidth
cmp r0, r7
ble _081DB442
adds r7, r0, 0
_081DB442:
adds r5, 0x8
adds r6, 0x1
ldrh r0, [r4, 0xC]
cmp r6, r0
blt _081DB42E
_081DB44C:
ldrb r0, [r4, 0x12]
adds r1, r7, r0
adds r0, r1, 0
adds r0, 0x9
cmp r0, 0
bge _081DB45A
adds r0, 0x7
_081DB45A:
asrs r0, 3
cmp r0, 0x1C
ble _081DB462
movs r0, 0x1C
_081DB462:
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_81DB41C
2017-11-08 18:05:47 +01:00
thumb_func_start CopyMonCategoryText
CopyMonCategoryText: @ 81DB468
2017-09-17 03:32:37 +02:00
push {lr}
adds r2, r0, 0
adds r0, r1, 0
lsls r2, 5
ldr r1, =gPokedexEntries
adds r2, r1
adds r1, r2, 0
bl StringCopy
movs r1, 0
strb r1, [r0]
adds r0, 0x1
ldr r1, =gText_Pokemon
bl StringCopy
pop {r0}
bx r0
.pool
2017-11-08 18:05:47 +01:00
thumb_func_end CopyMonCategoryText
2017-09-17 03:32:37 +02:00
thumb_func_start sub_81DB494
sub_81DB494: @ 81DB494
push {r4-r7,lr}
adds r6, r1, 0
adds r5, r2, 0
adds r7, r3, 0
cmp r5, 0
beq _081DB4B6
adds r1, r5, 0
bl StringCopy
adds r4, r0, 0
lsls r0, r6, 24
lsrs r0, 24
adds r1, r5, 0
movs r2, 0
bl GetStringWidth
b _081DB4BA
_081DB4B6:
adds r4, r0, 0
movs r0, 0
_081DB4BA:
subs r3, r7, r0
cmp r3, 0
ble _081DB4D4
movs r0, 0xFC
strb r0, [r4]
adds r4, 0x1
movs r0, 0x11
strb r0, [r4]
adds r4, 0x1
strb r3, [r4]
adds r4, 0x1
movs r0, 0xFF
strb r0, [r4]
_081DB4D4:
adds r0, r4, 0
pop {r4-r7}
pop {r1}
bx r1
thumb_func_end sub_81DB494
thumb_func_start sub_81DB4DC
sub_81DB4DC: @ 81DB4DC
push {r4,r5,lr}
adds r4, r0, 0
lsls r1, 24
lsrs r5, r1, 24
bl StripExtCtrlCodes
adds r0, r4, 0
bl StringLength
lsls r0, 24
lsrs r1, r0, 24
cmp r5, 0xFC
bne _081DB51A
cmp r1, 0x5
bhi _081DB51E
movs r3, 0xFC
movs r2, 0x7
_081DB4FE:
adds r0, r4, r1
strb r3, [r0]
strb r2, [r0, 0x1]
adds r0, r1, 0x2
lsls r0, 24
lsrs r1, r0, 24
cmp r1, 0x5
bls _081DB4FE
b _081DB51E
_081DB510:
adds r0, r4, r1
strb r5, [r0]
adds r0, r1, 0x1
lsls r0, 24
lsrs r1, r0, 24
_081DB51A:
cmp r1, 0x5
bls _081DB510
_081DB51E:
adds r1, r4, r1
movs r0, 0xFF
strb r0, [r1]
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81DB4DC
thumb_func_start sub_81DB52C
sub_81DB52C: @ 81DB52C
push {r4,lr}
adds r4, r0, 0
bl StringLength
lsls r0, 16
lsrs r0, 16
cmp r0, 0x5
bhi _081DB546
adds r0, r4, 0
movs r1, 0x1
bl ConvertInternationalString
b _081DB54C
_081DB546:
adds r0, r4, 0
bl StripExtCtrlCodes
_081DB54C:
pop {r4}
pop {r0}
bx r0
thumb_func_end sub_81DB52C
thumb_func_start sub_81DB554
sub_81DB554: @ 81DB554
push {r4,r5,lr}
adds r4, r0, 0
lsls r1, 24
lsrs r5, r1, 24
bl StringLength
lsls r0, 16
lsrs r0, 16
cmp r0, 0x5
bhi _081DB572
adds r0, r4, 0
movs r1, 0x1
bl ConvertInternationalString
b _081DB5A4
_081DB572:
cmp r5, 0xFC
bne _081DB57E
adds r0, r4, 0
bl StripExtCtrlCodes
b _081DB5A4
_081DB57E:
adds r1, r4, 0
b _081DB584
_081DB582:
adds r1, 0x1
_081DB584:
ldrb r0, [r1, 0x1]
cmp r0, 0xFF
bne _081DB582
cmp r1, r4
bcc _081DB5A4
ldrb r0, [r1]
cmp r0, r5
bne _081DB5A4
movs r2, 0xFF
_081DB596:
strb r2, [r1]
subs r1, 0x1
cmp r1, r4
bcc _081DB5A4
ldrb r0, [r1]
cmp r0, r5
beq _081DB596
_081DB5A4:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_81DB554
thumb_func_start sub_81DB5AC
sub_81DB5AC: @ 81DB5AC
push {lr}
adds r2, r0, 0
ldrb r0, [r2]
adds r2, 0x1
cmp r0, 0xFC
bne _081DB5E4
ldrb r0, [r2]
adds r2, 0x1
cmp r0, 0x15
bne _081DB5E4
b _081DB5CE
_081DB5C2:
cmp r1, 0xFC
bne _081DB5CC
ldrb r0, [r2, 0x1]
cmp r0, 0x16
beq _081DB5E4
_081DB5CC:
adds r2, 0x1
_081DB5CE:
ldrb r1, [r2]
adds r0, r1, 0
cmp r0, 0xFF
bne _081DB5C2
movs r0, 0xFC
strb r0, [r2]
adds r2, 0x1
movs r0, 0x16
strb r0, [r2]
movs r0, 0xFF
strb r0, [r2, 0x1]
_081DB5E4:
pop {r0}
bx r0
thumb_func_end sub_81DB5AC
Decompile TV (#80) * ClearTVShowData * special_0x44 * DoTVShow (nonmatching because align) * DoTVShowBravoTrainerPokemonProfile * Update field names * DoTVShowBravoTrainerBattleTower * Renaming of struct fields * sub_80EBFF4 and UpdateTVScreensOnMap * SetTVMetatilesOnMap * Power buttons for the TV screens on the map * special_0x45 * sub_80EC18C * special_0x4a * ResetGabbyAndTy * GabbyAndTyBeforeInterview * GabbyAndTyAfterInterview * Through IsTVShowInSearchOfTrainersAiring * GabbyAndTyGetLastQuote * GabbyAndTyGetLastBattleTrivia * GabbyAndTySetScriptVarsToFieldObjectLocalIds * InterviewAfter; use TVShow as a precursor for making the individual show structs anonymous * Make TV structs anonymous within the union * Move the TV union to its own subheader * Move TV show enums to the global.tv.h subheader * Funcion renaming * Apply static attributes where able * PutPokemonTodayCaughtOnAir * sub_80EC8A4 * PutPokemonTodayFailedOnTheAir * sub_80EC9E8, sub_80ECA10 * sub_80ECA38 * sub_80ECB00 * Put3CheersForPokeblocksOnTheAir * PutFanClubSpecialOnTheAir * ContestLiveUpdates_BeforeInterview * Other before-interview Contest Live Updates functions * ContestLiveUpdates_BeforeInterview_5 * InterviewAfter_BravoTrainerPokemonProfile * BravoTrainerPokemonProfile_BeforeInterview1 * BravoTrainerPokemonProfile_BeforeInterview2 * Disassemble TV data * Decompile TV data * InterviewAfter_BravoTrainerBattleTowerProfile * SaveRecordedItemPurchasesForTVShow * PutNameRaterShowOnTheAir * StartMassOutbreak * PutLilycoveContestLadyShowOnTheAir * InterviewAfter_FanClubLetter * Rip TV strings * InterviewAfter_RecentHappenings * InterviewAfter_PkmnFanClubOpinions * sub_80ED718 * EndMassOutbreak * sub_80ED888 * sub_80ED8B4 * UpdateMassOutbreakTimeLeft * sub_80ED950 * PutFishingAdviceShowOnTheAir * through sub_80EDA80 * ewram and common syms are now fetched from the object files * BSS symbols are taken from the tv.o file * through sub_80EDC60 * sub_80EDCE8 * sub_80EDD78 * through sub_80EDE84 * nomatching sub_80EDE98 * sub_80EDFB4 * sub_80EE104 * sub_80EE104 * sub_80EE184 * sub_80EE2CC * sub_80EE35C * sub_80EE44C * sub_80EE4DC * sub_80EE5A4 * sub_80EE69C * sub_80EE72C * sub_80EE7C0 * sub_80EE818 * sub_80EE8C8 * sub_80EEA70 * sub_80EEB98 * sub_80EEBF4 * through sub_80EED60 * Functions relating to Pokemon News * sub_80EEF6C * GetPriceReduction * IsPriceDiscounted * sub_80EF120 * through sub_80EF370 * sub_80EF40C * HasMixableShowAlreadyBeenSpawnedWithPlayerID * TV_SortPurchasesByQuantity * FindActiveBroadcastByShowType_SetScriptResult * InterviewBefore * through sub_80EF88C * through sub_80EF93C * through sub_80EFA24 * through TV_BernoulliTrial * sub_80EFB58 * sub_80EFBA4 * sub_80EFBDC * through sub_80EFD98 * ChangePokemonNickname * ChangeBoxPokemonNickname * sub_80EFF9C * through player_id_to_dword * CheckForBigMovieOrEmergencyNewsOnTV * GetMomOrDadStringForTVMessage * sub_80F01E8 * sub_80F0358 * sub_80F049C * TV record mixing functions * sub_80F06D0 * sub_80F0708 nonmatching * through sub_80F0B24 * sub_80F0B64 * through sub_80F0C04 * sub_80F0C7C * sub_80F0D60 * sub_80F0E58 * sub_80F0E84 * through sub_80F0F24 * sub_80F0F64 * sub_80F1208 * sub_80F1254 * sub_80F1290 * sub_80F12A4 * sub_80F14F8 * DoTVShowTodaysSmartShopper * DoTVShowTheNameRaterShow * DoTVShowPokemonTodaySuccessfulCapture * DoTVShowPokemonTodayFailedCapture * DoTVShowPokemonFanClubLetter * DoTVShowRecentHappenings * DoTVShowPokemonFanClubOpinions * DoTVShowPokemonNewsMassOutbreak * DoTVShowPokemonContestLiveUpdates * DoTVShowPokemonBattleUpdate * DoTVShow3CheersForPokeblocks * DoTVShowInSearchOfTrainers * Label GabbyAndTyData fields; remove ddump comments from data/text/tv.inc * DoTVShowPokemonAngler * DoTVShowTheWorldOfMasters; update RAM symbols and field names * Decorate static functions * DoTVShowTodaysRivalTrainer; region map enums * TVDewfordTrendWatcherNetworkTextGroup * DoTVShowHoennTreasureInvestigators * DoTVShowFindThatGamer * DoTVShowBreakingNewsTV * DoTVShowSecretBaseVisit * DoTVShowPokemonLotterWinnerFlashReport * DoTVShowThePokemonBattleSeminar * DoTVShowTrainerFanClubSpecial, DoTVShowTrainerFanClub * DoTVShowSpotTheCuties * DoTVShowPokemonNewsBattleFrontier * DoTVShowWhatsNo1InHoennToday * Helpers for DoTVShowSecretBaseSecrets * DoTVShowSecretBaseSecrets * DoTVShowSafariFanClub * Finish decompilation of tv.s * Some renaming * Rename text group pointers * revoke statis; pokenews enums * Labels are number one * Label all TV struct fields * Make data/text/tv.inc more readable * Split data/text/tv.inc * Rename pokenews text pointers * Frontier Symbol constants; indicate static rodata objects with 's' prefix * Fix leading spaces/tabs F*** CLion sometimes * Fix inconsequential warning
2017-10-13 17:09:36 +02:00
thumb_func_start TVShowConvertInternationalString
TVShowConvertInternationalString: @ 81DB5E8
2017-09-17 03:32:37 +02:00
push {r4,r5,lr}
adds r5, r0, 0
adds r4, r2, 0
bl StringCopy
lsls r4, 24
lsrs r4, 24
adds r0, r5, 0
adds r1, r4, 0
bl ConvertInternationalString
pop {r4,r5}
pop {r0}
bx r0
Decompile TV (#80) * ClearTVShowData * special_0x44 * DoTVShow (nonmatching because align) * DoTVShowBravoTrainerPokemonProfile * Update field names * DoTVShowBravoTrainerBattleTower * Renaming of struct fields * sub_80EBFF4 and UpdateTVScreensOnMap * SetTVMetatilesOnMap * Power buttons for the TV screens on the map * special_0x45 * sub_80EC18C * special_0x4a * ResetGabbyAndTy * GabbyAndTyBeforeInterview * GabbyAndTyAfterInterview * Through IsTVShowInSearchOfTrainersAiring * GabbyAndTyGetLastQuote * GabbyAndTyGetLastBattleTrivia * GabbyAndTySetScriptVarsToFieldObjectLocalIds * InterviewAfter; use TVShow as a precursor for making the individual show structs anonymous * Make TV structs anonymous within the union * Move the TV union to its own subheader * Move TV show enums to the global.tv.h subheader * Funcion renaming * Apply static attributes where able * PutPokemonTodayCaughtOnAir * sub_80EC8A4 * PutPokemonTodayFailedOnTheAir * sub_80EC9E8, sub_80ECA10 * sub_80ECA38 * sub_80ECB00 * Put3CheersForPokeblocksOnTheAir * PutFanClubSpecialOnTheAir * ContestLiveUpdates_BeforeInterview * Other before-interview Contest Live Updates functions * ContestLiveUpdates_BeforeInterview_5 * InterviewAfter_BravoTrainerPokemonProfile * BravoTrainerPokemonProfile_BeforeInterview1 * BravoTrainerPokemonProfile_BeforeInterview2 * Disassemble TV data * Decompile TV data * InterviewAfter_BravoTrainerBattleTowerProfile * SaveRecordedItemPurchasesForTVShow * PutNameRaterShowOnTheAir * StartMassOutbreak * PutLilycoveContestLadyShowOnTheAir * InterviewAfter_FanClubLetter * Rip TV strings * InterviewAfter_RecentHappenings * InterviewAfter_PkmnFanClubOpinions * sub_80ED718 * EndMassOutbreak * sub_80ED888 * sub_80ED8B4 * UpdateMassOutbreakTimeLeft * sub_80ED950 * PutFishingAdviceShowOnTheAir * through sub_80EDA80 * ewram and common syms are now fetched from the object files * BSS symbols are taken from the tv.o file * through sub_80EDC60 * sub_80EDCE8 * sub_80EDD78 * through sub_80EDE84 * nomatching sub_80EDE98 * sub_80EDFB4 * sub_80EE104 * sub_80EE104 * sub_80EE184 * sub_80EE2CC * sub_80EE35C * sub_80EE44C * sub_80EE4DC * sub_80EE5A4 * sub_80EE69C * sub_80EE72C * sub_80EE7C0 * sub_80EE818 * sub_80EE8C8 * sub_80EEA70 * sub_80EEB98 * sub_80EEBF4 * through sub_80EED60 * Functions relating to Pokemon News * sub_80EEF6C * GetPriceReduction * IsPriceDiscounted * sub_80EF120 * through sub_80EF370 * sub_80EF40C * HasMixableShowAlreadyBeenSpawnedWithPlayerID * TV_SortPurchasesByQuantity * FindActiveBroadcastByShowType_SetScriptResult * InterviewBefore * through sub_80EF88C * through sub_80EF93C * through sub_80EFA24 * through TV_BernoulliTrial * sub_80EFB58 * sub_80EFBA4 * sub_80EFBDC * through sub_80EFD98 * ChangePokemonNickname * ChangeBoxPokemonNickname * sub_80EFF9C * through player_id_to_dword * CheckForBigMovieOrEmergencyNewsOnTV * GetMomOrDadStringForTVMessage * sub_80F01E8 * sub_80F0358 * sub_80F049C * TV record mixing functions * sub_80F06D0 * sub_80F0708 nonmatching * through sub_80F0B24 * sub_80F0B64 * through sub_80F0C04 * sub_80F0C7C * sub_80F0D60 * sub_80F0E58 * sub_80F0E84 * through sub_80F0F24 * sub_80F0F64 * sub_80F1208 * sub_80F1254 * sub_80F1290 * sub_80F12A4 * sub_80F14F8 * DoTVShowTodaysSmartShopper * DoTVShowTheNameRaterShow * DoTVShowPokemonTodaySuccessfulCapture * DoTVShowPokemonTodayFailedCapture * DoTVShowPokemonFanClubLetter * DoTVShowRecentHappenings * DoTVShowPokemonFanClubOpinions * DoTVShowPokemonNewsMassOutbreak * DoTVShowPokemonContestLiveUpdates * DoTVShowPokemonBattleUpdate * DoTVShow3CheersForPokeblocks * DoTVShowInSearchOfTrainers * Label GabbyAndTyData fields; remove ddump comments from data/text/tv.inc * DoTVShowPokemonAngler * DoTVShowTheWorldOfMasters; update RAM symbols and field names * Decorate static functions * DoTVShowTodaysRivalTrainer; region map enums * TVDewfordTrendWatcherNetworkTextGroup * DoTVShowHoennTreasureInvestigators * DoTVShowFindThatGamer * DoTVShowBreakingNewsTV * DoTVShowSecretBaseVisit * DoTVShowPokemonLotterWinnerFlashReport * DoTVShowThePokemonBattleSeminar * DoTVShowTrainerFanClubSpecial, DoTVShowTrainerFanClub * DoTVShowSpotTheCuties * DoTVShowPokemonNewsBattleFrontier * DoTVShowWhatsNo1InHoennToday * Helpers for DoTVShowSecretBaseSecrets * DoTVShowSecretBaseSecrets * DoTVShowSafariFanClub * Finish decompilation of tv.s * Some renaming * Rename text group pointers * revoke statis; pokenews enums * Labels are number one * Label all TV struct fields * Make data/text/tv.inc more readable * Split data/text/tv.inc * Rename pokenews text pointers * Frontier Symbol constants; indicate static rodata objects with 's' prefix * Fix leading spaces/tabs F*** CLion sometimes * Fix inconsequential warning
2017-10-13 17:09:36 +02:00
thumb_func_end TVShowConvertInternationalString
2017-09-17 03:32:37 +02:00
thumb_func_start sub_81DB604
sub_81DB604: @ 81DB604
push {lr}
adds r1, r0, 0
ldrb r0, [r1]
cmp r0, 0xFC
bne _081DB618
ldrb r0, [r1, 0x1]
cmp r0, 0x15
bne _081DB618
movs r0, 0x1
b _081DB61A
_081DB618:
movs r0, 0x2
_081DB61A:
pop {r1}
bx r1
thumb_func_end sub_81DB604
thumb_func_start sub_81DB620
sub_81DB620: @ 81DB620
push {r4-r7,lr}
sub sp, 0x4
lsls r4, r0, 1
adds r4, r0
lsls r4, 2
ldr r0, =gWindows
adds r4, r0
lsls r7, r3, 5
ldrb r0, [r4, 0x3]
lsls r6, r0, 5
muls r2, r6
ldr r0, [r4, 0x8]
adds r0, r2
lsls r1, 5
adds r5, r0, r1
ldr r0, [sp, 0x18]
cmp r0, 0
ble _081DB66C
adds r4, r0, 0
_081DB646:
ldr r0, =0x11111111
str r0, [sp]
adds r2, r7, 0
cmp r2, 0
bge _081DB652
adds r2, 0x3
_081DB652:
lsls r2, 9
lsrs r2, 11
movs r0, 0x80
lsls r0, 17
orrs r2, r0
mov r0, sp
adds r1, r5, 0
bl CpuFastSet
adds r5, r6
subs r4, 0x1
cmp r4, 0
bne _081DB646
_081DB66C:
add sp, 0x4
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_81DB620
.align 2, 0 @ Don't pad with nop.