Atmosphere/emummc/tools/fs_ida_nintendo_folder_xref_formatter.au3
Michael Scire b7a370b156 git subrepo clone --branch=develop https://github.com/m4xw/emuMMC emummc
subrepo:
  subdir:   "emummc"
  merged:   "e72e8f1c"
upstream:
  origin:   "https://github.com/m4xw/emuMMC"
  branch:   "develop"
  commit:   "e72e8f1c"
git-subrepo:
  version:  "0.4.0"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "5d6aba9"
2019-06-15 21:37:41 -07:00

36 lines
1.1 KiB
AutoIt

ParseClipboard()
Func FormatLineData($sLineData)
Local $lineData = StringReplace($sLineData, @TAB, " ")
Local $isADRP = false
$lineData = StringReplace($lineData, "Up o sub_71000" , "0x")
$isADRP = StringInStr($lineData, "ADRP")
Local $targetRegister = StringSplit(StringSplit($lineData, "X")[2], ",")[1]
$lineData = StringSplit($lineData, " ")[1]
$lineDataAddr = StringSplit($lineData, "+")[1]
$lineDataAddition = StringSplit($lineData, "+")[2]
$lineDataAddr = StringReplace($lineDataAddr, "0x" , "")
$lineDataAddition = StringReplace($lineDataAddition, "0x" , "")
If $isADRP Then
$lineData = "0x" & Hex(Dec($lineDataAddr) + Dec($lineDataAddition))
Else
Return ""
EndIf
Return "{.opcode_reg = " & $targetRegister & ", .adrp_offset = " & $lineData & "}, \" & @LF
EndFunc
Func ParseClipboard()
Local $sData = ClipGet()
Local $oData = ""
Local $sLineData = StringSplit(StringReplace($sData, @CRLF, @LF), @LF)
For $i = 2 to UBound($sLineData) - 2
Local $lineData = FormatLineData($sLineData[$i])
;ConsoleWrite($lineData)
$oData = $oData & $lineData
Next
ClipPut($oData)
EndFunc